@vm0/cli 9.264.7 → 9.264.8
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-7TQZ2JNP.js → agent-4MCHGF7N.js} +20 -15
- package/{agent-7TQZ2JNP.js.map → agent-4MCHGF7N.js.map} +1 -1
- package/{banking-XMPJDCX4.js → banking-GXQ7POKU.js} +4 -4
- package/{browser-EFDP23US.js → browser-KSZXTUQA.js} +4 -4
- package/{chat-3I3QSPCW.js → chat-5WGKZHMB.js} +5 -5
- package/{chunk-MIVNAXCC.js → chunk-2KEUNCZT.js} +2 -2
- package/{chunk-R6EQANV5.js → chunk-7WMNSSBC.js} +6 -6
- package/chunk-7WMNSSBC.js.map +1 -0
- package/{chunk-KD6CU6C6.js → chunk-AOHVC7EW.js} +2 -3
- package/chunk-AOHVC7EW.js.map +1 -0
- package/{chunk-SQ4ZYZMV.js → chunk-B5VQCVCY.js} +29 -24
- package/chunk-B5VQCVCY.js.map +1 -0
- package/{chunk-CTAGNU3W.js → chunk-IYS3T6IA.js} +2 -2
- package/{chunk-JQSR2FQW.js → chunk-KCVBW7AC.js} +88 -56
- package/chunk-KCVBW7AC.js.map +1 -0
- package/{chunk-O2ZRRF6W.js → chunk-TCZ2FX3X.js} +2 -2
- package/{chunk-4YEMIZDG.js → chunk-WUJWUDPD.js} +9 -9
- package/{chunk-4YEMIZDG.js.map → chunk-WUJWUDPD.js.map} +1 -1
- package/{chunk-DHADLTRS.js → chunk-XAVHX57D.js} +2 -2
- package/{chunk-D53LZEPV.js → chunk-YV3LWRZZ.js} +23 -8
- package/{chunk-D53LZEPV.js.map → chunk-YV3LWRZZ.js.map} +1 -1
- package/{computer-use-PLMPMCUY.js → computer-use-7IYJ2JNT.js} +4 -4
- package/{connector-45KWH4GF.js → connector-RUCYHNTI.js} +119 -108
- package/connector-RUCYHNTI.js.map +1 -0
- package/{credit-Q6RGVKM6.js → credit-SWBRMGXY.js} +5 -5
- package/{developer-support-RLFWS3US.js → developer-support-FTYPJJ6Q.js} +4 -4
- package/{doctor-NTJCG5E3.js → doctor-6AOKR5UU.js} +5 -5
- package/{feishu-KKWRQ2BO.js → feishu-VHY2XR6D.js} +4 -4
- package/{finance-OVJSFJE5.js → finance-4ZD3LPNN.js} +4 -4
- package/{generate-GKI4KYTD.js → generate-ULUL52MM.js} +31 -25
- package/generate-ULUL52MM.js.map +1 -0
- package/{github-WLWS3NDF.js → github-A3C3OGLD.js} +4 -4
- package/{goal-V7MRASUE.js → goal-EB5VK2GK.js} +4 -4
- package/{host-QRNSGCEI.js → host-BYHZZN2I.js} +4 -4
- package/{logs-4TC3XVNS.js → logs-IFUUWA54.js} +6 -6
- package/{mail-IEXIV6SF.js → mail-YI5KA3CI.js} +15 -15
- package/mail-YI5KA3CI.js.map +1 -0
- package/{maps-GR6M6KB4.js → maps-KTC5S7FA.js} +4 -4
- package/{model-UNL2R4ZB.js → model-AYKQFU7E.js} +5 -5
- package/{model-provider-T3PLIV44.js → model-provider-4MKVAZCR.js} +5 -5
- package/{org-RYVXLOYP.js → org-IZAWNWIE.js} +4 -4
- package/package.json +1 -1
- package/{people-search-VLZ7NPR7.js → people-search-J45HXJB3.js} +4 -4
- package/{phone-PPVFHJC2.js → phone-YSGX6TYA.js} +4 -4
- package/{preference-MNUW5R5G.js → preference-O6URTHMQ.js} +4 -4
- package/{resource-4SKQNOTT.js → resource-FKEP5R3M.js} +4 -4
- package/{scrape-W4DWXZ7B.js → scrape-TO3EO4NH.js} +4 -4
- package/{search-YHU5HQOW.js → search-PUZI5HRX.js} +6 -6
- package/{secret-A7VJZCL5.js → secret-6PYNLRMC.js} +4 -4
- package/{slack-O6RAMJBK.js → slack-6TBB72IQ.js} +4 -4
- package/{teams-BYZY4YZT.js → teams-TCTUKRSH.js} +4 -4
- package/{telegram-LOP4EISR.js → telegram-PD2GOYYR.js} +4 -4
- package/{upgrade-5VBTF5UN.js → upgrade-GOWPZRKS.js} +3 -3
- package/{variable-MGQ6QHX2.js → variable-RNHRIK7S.js} +4 -4
- package/{video-5H3CCX2T.js → video-HWANWKDT.js} +3 -3
- package/{weather-MVJYZQWZ.js → weather-IWQDSXJG.js} +4 -4
- package/{web-CQ2W6UFJ.js → web-5RDGLDVJ.js} +4 -4
- package/{web-search-JFBZWJPA.js → web-search-7SV3KXHO.js} +4 -4
- package/{whoami-ZPH3YLXD.js → whoami-CUHEGGL2.js} +12 -12
- package/whoami-CUHEGGL2.js.map +1 -0
- package/{workflow-3Q4DQDHW.js → workflow-UGDNPUJG.js} +5 -5
- package/zero.js +43 -43
- package/chunk-JQSR2FQW.js.map +0 -1
- package/chunk-KD6CU6C6.js.map +0 -1
- package/chunk-R6EQANV5.js.map +0 -1
- package/chunk-SQ4ZYZMV.js.map +0 -1
- package/connector-45KWH4GF.js.map +0 -1
- package/generate-GKI4KYTD.js.map +0 -1
- package/mail-IEXIV6SF.js.map +0 -1
- package/whoami-ZPH3YLXD.js.map +0 -1
- /package/{banking-XMPJDCX4.js.map → banking-GXQ7POKU.js.map} +0 -0
- /package/{browser-EFDP23US.js.map → browser-KSZXTUQA.js.map} +0 -0
- /package/{chat-3I3QSPCW.js.map → chat-5WGKZHMB.js.map} +0 -0
- /package/{chunk-MIVNAXCC.js.map → chunk-2KEUNCZT.js.map} +0 -0
- /package/{chunk-CTAGNU3W.js.map → chunk-IYS3T6IA.js.map} +0 -0
- /package/{chunk-O2ZRRF6W.js.map → chunk-TCZ2FX3X.js.map} +0 -0
- /package/{chunk-DHADLTRS.js.map → chunk-XAVHX57D.js.map} +0 -0
- /package/{computer-use-PLMPMCUY.js.map → computer-use-7IYJ2JNT.js.map} +0 -0
- /package/{credit-Q6RGVKM6.js.map → credit-SWBRMGXY.js.map} +0 -0
- /package/{developer-support-RLFWS3US.js.map → developer-support-FTYPJJ6Q.js.map} +0 -0
- /package/{doctor-NTJCG5E3.js.map → doctor-6AOKR5UU.js.map} +0 -0
- /package/{feishu-KKWRQ2BO.js.map → feishu-VHY2XR6D.js.map} +0 -0
- /package/{finance-OVJSFJE5.js.map → finance-4ZD3LPNN.js.map} +0 -0
- /package/{github-WLWS3NDF.js.map → github-A3C3OGLD.js.map} +0 -0
- /package/{goal-V7MRASUE.js.map → goal-EB5VK2GK.js.map} +0 -0
- /package/{host-QRNSGCEI.js.map → host-BYHZZN2I.js.map} +0 -0
- /package/{logs-4TC3XVNS.js.map → logs-IFUUWA54.js.map} +0 -0
- /package/{maps-GR6M6KB4.js.map → maps-KTC5S7FA.js.map} +0 -0
- /package/{model-UNL2R4ZB.js.map → model-AYKQFU7E.js.map} +0 -0
- /package/{model-provider-T3PLIV44.js.map → model-provider-4MKVAZCR.js.map} +0 -0
- /package/{org-RYVXLOYP.js.map → org-IZAWNWIE.js.map} +0 -0
- /package/{people-search-VLZ7NPR7.js.map → people-search-J45HXJB3.js.map} +0 -0
- /package/{phone-PPVFHJC2.js.map → phone-YSGX6TYA.js.map} +0 -0
- /package/{preference-MNUW5R5G.js.map → preference-O6URTHMQ.js.map} +0 -0
- /package/{resource-4SKQNOTT.js.map → resource-FKEP5R3M.js.map} +0 -0
- /package/{scrape-W4DWXZ7B.js.map → scrape-TO3EO4NH.js.map} +0 -0
- /package/{search-YHU5HQOW.js.map → search-PUZI5HRX.js.map} +0 -0
- /package/{secret-A7VJZCL5.js.map → secret-6PYNLRMC.js.map} +0 -0
- /package/{slack-O6RAMJBK.js.map → slack-6TBB72IQ.js.map} +0 -0
- /package/{teams-BYZY4YZT.js.map → teams-TCTUKRSH.js.map} +0 -0
- /package/{telegram-LOP4EISR.js.map → telegram-PD2GOYYR.js.map} +0 -0
- /package/{upgrade-5VBTF5UN.js.map → upgrade-GOWPZRKS.js.map} +0 -0
- /package/{variable-MGQ6QHX2.js.map → variable-RNHRIK7S.js.map} +0 -0
- /package/{video-5H3CCX2T.js.map → video-HWANWKDT.js.map} +0 -0
- /package/{weather-MVJYZQWZ.js.map → weather-IWQDSXJG.js.map} +0 -0
- /package/{web-CQ2W6UFJ.js.map → web-5RDGLDVJ.js.map} +0 -0
- /package/{web-search-JFBZWJPA.js.map → web-search-7SV3KXHO.js.map} +0 -0
- /package/{workflow-3Q4DQDHW.js.map → workflow-UGDNPUJG.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/zero/connector/index.ts","../src/commands/zero/connector/check.ts","../src/commands/zero/connector/computer-use-guidance.ts","../src/commands/zero/connector/connect.ts","../src/commands/zero/connector/list.ts","../src/commands/zero/connector/connected-as.ts","../src/commands/zero/connector/search.ts","../src/commands/zero/connector/status.ts","../src/commands/zero/connector/custom/index.ts","../src/commands/zero/connector/permission-request.ts","../src/commands/zero/connector/browser-guidance.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { checkConnectorCommand } from \"./check\";\nimport { connectCommand } from \"./connect\";\nimport { listCommand } from \"./list\";\nimport { searchCommand } from \"./search\";\nimport { statusCommand } from \"./status\";\nimport { customConnectorCommand } from \"./custom\";\nimport { permissionRequestCommand } from \"./permission-request\";\n\nexport const zeroConnectorCommand = new Command()\n .name(\"connector\")\n .description(\"Manage and diagnose third-party service connections\")\n .addCommand(checkConnectorCommand)\n .addCommand(customConnectorCommand)\n .addCommand(connectCommand)\n .addCommand(listCommand)\n .addCommand(searchCommand)\n .addCommand(statusCommand)\n .addCommand(permissionRequestCommand);\n","import { Command, Option } from \"commander\";\nimport type { ConnectorSlug } from \"@vm0/api-contracts/contracts/connector-identity\";\nimport type {\n ConnectorCheckDiagnosticResult,\n ConnectorCheckPolicy,\n ConnectorCheckRequest,\n} from \"@vm0/api-contracts/contracts/zero-connector-check\";\n\nimport { getApiUrl } from \"../../../lib/api/config\";\nimport {\n diagnoseZeroConnectorCheck,\n getZeroConnector,\n} from \"../../../lib/api/domains/zero-connectors\";\nimport { getZeroAgentUserConnectors } from \"../../../lib/api/domains/zero-agents\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { toPlatformUrl } from \"../doctor/platform-url\";\nimport {\n isComputerUsePermissionTarget,\n printComputerUsePermissionGuidance,\n} from \"./computer-use-guidance\";\nimport {\n CALLBACK_PROMPT_PLACEHOLDER,\n connectorActionUrl,\n currentChatSupportsActionCallback,\n printCallbackActionUrlExample,\n} from \"./action-url\";\n\ninterface CheckConnectorOptions {\n readonly connector?: string;\n readonly envName?: string;\n readonly url?: string;\n readonly method: string;\n readonly checkPermission?: string;\n}\n\ntype ValidatedCheckConnectorOptions = CheckConnectorOptions &\n (\n | { readonly url: string }\n | { readonly url?: undefined; readonly envName: string }\n );\n\ntype ResolvedDiagnostic = Extract<\n ConnectorCheckDiagnosticResult,\n { readonly outcome: \"resolved\" }\n>;\ntype ResolvedUrlDiagnostic = Extract<\n ResolvedDiagnostic,\n { readonly mode: \"url\" }\n>;\ntype ResolvedEnvironmentDiagnostic = Extract<\n ResolvedDiagnostic,\n { readonly mode: \"environment\" }\n>;\ntype UrlDiagnosticRequest = Extract<\n ConnectorCheckRequest,\n { readonly mode: \"url\" }\n>;\n\ninterface DiagContext {\n readonly environmentNames: readonly string[] | null;\n readonly connectorSlug: ConnectorSlug;\n readonly label: string;\n readonly connectorAvailable: boolean;\n readonly credentialResolution: \"network-boundary\" | \"none\";\n readonly run: ResolvedDiagnostic[\"run\"];\n readonly platformOrigin: string;\n readonly agentId: string | undefined;\n}\n\nfunction stripUrlQueryAndFragment(url: string): string {\n const queryIndex = url.indexOf(\"?\");\n const fragmentIndex = url.indexOf(\"#\");\n let end = url.length;\n if (queryIndex !== -1) end = Math.min(end, queryIndex);\n if (fragmentIndex !== -1) end = Math.min(end, fragmentIndex);\n return url.slice(0, end);\n}\n\nfunction rawUrlAuthorityHasUserinfo(url: string): boolean {\n const schemeEnd = url.indexOf(\"://\");\n if (schemeEnd === -1) return false;\n\n const authorityStart = schemeEnd + 3;\n let authorityEnd = url.length;\n for (const delimiter of [\"/\", \"?\", \"#\"]) {\n const delimiterIndex = url.indexOf(delimiter, authorityStart);\n if (delimiterIndex !== -1) {\n authorityEnd = Math.min(authorityEnd, delimiterIndex);\n }\n }\n return url.slice(authorityStart, authorityEnd).includes(\"@\");\n}\n\nfunction shellQuoteArg(value: string): string {\n return `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n\nfunction connectorSelectionCommand(\n url: string,\n method: string,\n connectorSlug: string,\n): string {\n const args = [\n `--url ${shellQuoteArg(url)}`,\n `--connector ${shellQuoteArg(connectorSlug)}`,\n ];\n if (method !== \"GET\") {\n args.push(`--method ${shellQuoteArg(method)}`);\n }\n return `zero connector check ${args.join(\" \")}`;\n}\n\nfunction rawPathFromUrl(url: string): string | undefined {\n const sanitizedUrl = stripUrlQueryAndFragment(url);\n const schemeEnd = sanitizedUrl.indexOf(\"://\");\n if (schemeEnd === -1) return undefined;\n\n const pathStart = sanitizedUrl.indexOf(\"/\", schemeEnd + 3);\n return pathStart === -1 ? \"/\" : sanitizedUrl.slice(pathStart);\n}\n\nfunction isComputerUseCheckTarget(opts: CheckConnectorOptions): boolean {\n return isComputerUsePermissionTarget({\n connectorSlug: opts.connector ?? \"\",\n path: opts.url === undefined ? undefined : rawPathFromUrl(opts.url),\n permission: opts.checkPermission,\n });\n}\n\nfunction validateCheckConnectorOptions(\n opts: CheckConnectorOptions,\n command: Command,\n): asserts opts is ValidatedCheckConnectorOptions {\n const hasUrl = opts.url !== undefined;\n // Reject embedded credentials before the diagnostic request leaves the client.\n if (opts.url !== undefined && rawUrlAuthorityHasUserinfo(opts.url)) {\n throw unsafeInputError(\"invalid-url\");\n }\n if (opts.connector !== undefined && !hasUrl) {\n throw new Error(\n \"--connector can only be used with --url. Add --url <URL> or remove --connector.\",\n );\n }\n if (opts.checkPermission !== undefined && hasUrl) {\n throw new Error(\n \"--check-permission cannot be used with --url because the permission is derived from the request. Remove --check-permission.\",\n );\n }\n if (opts.checkPermission?.trim() === \"\") {\n throw new Error(\"--check-permission requires a non-empty permission name.\");\n }\n if (!hasUrl && command.getOptionValueSource(\"method\") === \"cli\") {\n throw new Error(\n \"--method can only be used with --url. Add --url <URL> or remove --method.\",\n );\n }\n if (opts.envName === undefined && !hasUrl) {\n throw new Error(\n \"Either --env-name or --url is required. Use --help for usage.\",\n );\n }\n}\n\nfunction buildDiagnosticRequest(\n opts: ValidatedCheckConnectorOptions,\n method: string,\n): ConnectorCheckRequest {\n if (opts.url !== undefined) {\n return {\n mode: \"url\",\n method,\n url: stripUrlQueryAndFragment(opts.url),\n ...(opts.connector !== undefined ? { connectorRef: opts.connector } : {}),\n ...(opts.envName !== undefined ? { environmentName: opts.envName } : {}),\n };\n }\n\n return {\n mode: \"environment\",\n environmentName: opts.envName,\n ...(opts.checkPermission !== undefined\n ? { permission: opts.checkPermission }\n : {}),\n };\n}\n\nfunction requireUrlRequest(\n request: ConnectorCheckRequest,\n): UrlDiagnosticRequest {\n if (request.mode !== \"url\") {\n throw new Error(\n \"Connector diagnostic returned a URL-only outcome for an environment request.\",\n );\n }\n return request;\n}\n\nfunction requestedEnvironmentName(request: ConnectorCheckRequest): string {\n if (request.environmentName === undefined) {\n throw new Error(\n \"Connector diagnostic returned an environment outcome without an environment name.\",\n );\n }\n return request.environmentName;\n}\n\nfunction unsafeInputError(\n reason: Extract<\n ConnectorCheckDiagnosticResult,\n { readonly outcome: \"unsafe-input\" }\n >[\"reason\"],\n): Error {\n switch (reason) {\n case \"invalid-method\":\n return new Error(\n \"connector check requires --method to be a supported HTTP method.\",\n );\n case \"invalid-url\":\n return new Error(\n \"connector check requires --url to be a valid absolute http or https URL.\",\n );\n case \"unsafe-path\":\n return new Error(\n \"connector check cannot diagnose unsafe URL paths because they are blocked before permission policy evaluation.\",\n );\n }\n}\n\nfunction ambiguousConnectorError(\n request: UrlDiagnosticRequest,\n result: Extract<\n ConnectorCheckDiagnosticResult,\n { readonly outcome: \"ambiguous\" }\n >,\n): Error {\n const candidates = [...result.candidates].sort((left, right) => {\n return left.connectorRef.localeCompare(right.connectorRef);\n });\n const commands = candidates.map((candidate) => {\n return ` ${connectorSelectionCommand(request.url, request.method, candidate.connectorRef)}`;\n });\n return new Error(\n `Multiple connectors match ${request.method} ${request.url}: ${candidates\n .map((candidate) => {\n return candidate.connectorRef;\n })\n .join(\", \")}\\nSelect one explicitly:\\n${commands.join(\"\\n\")}`,\n );\n}\n\nfunction unknownConnectorError(request: ConnectorCheckRequest): Error {\n if (request.mode === \"url\" && request.connectorRef !== undefined) {\n return new Error(\n `Unknown connector type: ${request.connectorRef}\\nRun: zero connector search ${shellQuoteArg(request.connectorRef)}`,\n );\n }\n return new Error(\"The requested connector is unknown.\");\n}\n\nfunction noMatchError(\n result: Extract<\n ConnectorCheckDiagnosticResult,\n { readonly outcome: \"no-match\" }\n >,\n): Error {\n return new Error(\n result.scope === \"run\"\n ? \"No connector found for provided URL — no connector configured for the current run matches this URL\"\n : \"No connector found for provided URL — no registered connector base URL matches this URL\",\n );\n}\n\nfunction connectorMismatchError(\n request: UrlDiagnosticRequest,\n result: Extract<\n ConnectorCheckDiagnosticResult,\n { readonly outcome: \"connector-mismatch\" }\n >,\n): Error {\n const requestedSlug = request.connectorRef ?? \"the requested connector\";\n return new Error(\n `Connector ${requestedSlug} does not own ${request.method} ${request.url}; the matching connector is ${result.connector.connectorRef}\\nRun: ${connectorSelectionCommand(request.url, request.method, result.connector.connectorRef)}`,\n );\n}\n\nfunction environmentNotOwnedError(\n request: ConnectorCheckRequest,\n result: Extract<\n ConnectorCheckDiagnosticResult,\n { readonly outcome: \"environment-not-owned\" }\n >,\n): Error {\n const environmentName = requestedEnvironmentName(request);\n return new Error(\n `${environmentName} is not an environment name for the ${result.connector.label} connector. Remove --env-name to use the matched route metadata.`,\n );\n}\n\nfunction environmentNotUsedError(\n request: ConnectorCheckRequest,\n result: Extract<\n ConnectorCheckDiagnosticResult,\n { readonly outcome: \"environment-not-used\" }\n >,\n): Error {\n const environmentName = requestedEnvironmentName(request);\n return new Error(\n `${environmentName} is not used by the matched API route. Expected one of: ${result.environmentNames.join(\", \") || \"none\"}. Remove --env-name to use the matched route metadata.`,\n );\n}\n\nfunction resolvedDiagnostic(\n request: ConnectorCheckRequest,\n result: ConnectorCheckDiagnosticResult,\n): ResolvedDiagnostic {\n switch (result.outcome) {\n case \"resolved\":\n return result;\n case \"unsafe-input\":\n throw unsafeInputError(result.reason);\n case \"unknown-connector\":\n throw unknownConnectorError(request);\n case \"unknown-environment\":\n throw new Error(\n `Unknown environment name: ${requestedEnvironmentName(request)} — not managed by any connector`,\n );\n case \"no-match\":\n throw noMatchError(result);\n case \"ambiguous\":\n throw ambiguousConnectorError(requireUrlRequest(request), result);\n case \"connector-mismatch\":\n throw connectorMismatchError(requireUrlRequest(request), result);\n case \"environment-not-owned\":\n throw environmentNotOwnedError(request, result);\n case \"environment-not-used\":\n throw environmentNotUsedError(request, result);\n case \"unresolved-dynamic-base\":\n throw new Error(\n `No authoritative ${result.connector.label} base URL is available for this diagnostic. Verify the ${result.connector.connectorRef} connector configuration for the affected context and retry.`,\n );\n case \"run-context-unavailable\":\n throw new Error(\n \"The current run context is unavailable for connector diagnosis. Retry from an active run or start a new run.\",\n );\n }\n}\n\nfunction printDiagnosticSummary(\n request: ConnectorCheckRequest,\n result: ResolvedDiagnostic,\n): void {\n if (result.mode === \"url\") {\n const urlRequest = requireUrlRequest(request);\n console.log(\n `URL ${urlRequest.url} matches the ${result.connector.label} connector (type: ${result.connector.connectorRef}).`,\n );\n console.log(` Matched base URL: ${result.base}`);\n console.log(` Relative path: ${result.relativePath}`);\n if (result.environmentNames === null) {\n console.log(\" Environment names: unavailable\");\n } else {\n console.log(\n ` Environment names: [${result.environmentNames.join(\", \")}]`,\n );\n }\n return;\n }\n\n console.log(\n `${result.environmentName} is managed by the ${result.connector.label} connector (type: ${result.connector.connectorRef}).`,\n );\n}\n\nfunction diagnosticEnvironmentNames(\n result: ResolvedDiagnostic,\n): readonly string[] | null {\n return result.mode === \"url\"\n ? result.environmentNames\n : [result.environmentName];\n}\n\nfunction printConnectorConnectionStatus(\n ctx: DiagContext,\n isConnected: boolean,\n isExpired: boolean,\n hasPermission: boolean,\n): void {\n console.log(\n \"### 2a: Connector status (user must configure via OAuth login or API key)\",\n );\n console.log(\"\");\n if (!ctx.connectorAvailable) {\n console.log(\n `The ${ctx.label} connector is not available for this account.`,\n );\n } else if (!isConnected) {\n console.log(`The ${ctx.label} connector is not connected.`);\n if (ctx.agentId && hasPermission) {\n const connectUrl = connectorActionUrl({\n origin: ctx.platformOrigin,\n path: `/connectors/${ctx.connectorSlug}/connect`,\n agentId: ctx.agentId,\n });\n console.log(`Connect it at: [Connect ${ctx.label}](${connectUrl})`);\n printCallbackActionUrlExample(connectUrl, ctx.agentId);\n } else if (!ctx.agentId) {\n const connectUrl = connectorActionUrl({\n origin: ctx.platformOrigin,\n path: `/connectors/${ctx.connectorSlug}/connect`,\n });\n console.log(`Connect it at: [Connect ${ctx.label}](${connectUrl})`);\n }\n } else if (isExpired) {\n const url = connectorActionUrl({\n origin: ctx.platformOrigin,\n path: `/connectors/${ctx.connectorSlug}/connect`,\n agentId: ctx.agentId,\n });\n console.log(\n `The ${ctx.label} connector is connected but has expired and needs to be reconnected.`,\n );\n console.log(`Reconnect it at: [Reconnect ${ctx.label}](${url})`);\n printCallbackActionUrlExample(url, ctx.agentId);\n } else {\n console.log(`The ${ctx.label} connector is connected and active.`);\n }\n console.log(\"\");\n}\n\nfunction printAgentAuthorizationStatus(\n ctx: DiagContext,\n isConnected: boolean,\n isExpired: boolean,\n hasPermission: boolean,\n): void {\n if (!ctx.agentId) {\n console.log(\"ZERO_AGENT_ID is not set — cannot check agent authorization.\");\n } else if (isExpired) {\n console.log(\n `Skipped — agent authorization can only be checked once the ${ctx.label} connector is reconnected (see 2a).`,\n );\n } else if (hasPermission) {\n console.log(\n isConnected\n ? `The ${ctx.label} connector is authorized for this agent.`\n : `The ${ctx.label} connector is authorized for this agent, but it is not connected.`,\n );\n } else {\n const url = connectorActionUrl({\n origin: ctx.platformOrigin,\n path: `/connectors/${ctx.connectorSlug}/authorize`,\n agentId: ctx.agentId,\n });\n console.log(\n isConnected\n ? `The ${ctx.label} connector is not authorized for this agent (${ctx.agentId}).`\n : `The ${ctx.label} connector needs to be connected and authorized for this agent (${ctx.agentId}).`,\n );\n console.log(`Authorize it at: [Authorize ${ctx.label}](${url})`);\n printCallbackActionUrlExample(url, ctx.agentId);\n }\n}\n\nfunction printConnectorAuthorizationStatus(\n ctx: DiagContext,\n isConnected: boolean,\n isExpired: boolean,\n hasPermission: boolean,\n): void {\n console.log(\n \"### 2b: Agent authorization (user must authorize agent to use this connector)\",\n );\n console.log(\"\");\n if (!ctx.connectorAvailable) {\n console.log(\n `Skipped — the ${ctx.label} connector is not available for this account.`,\n );\n } else {\n printAgentAuthorizationStatus(ctx, isConnected, isExpired, hasPermission);\n }\n console.log(\n `This run uses agent-scoped connector authorization for ${ctx.label} access.`,\n );\n console.log(\"\");\n}\n\nfunction checkEnvironmentNames(ctx: DiagContext): void {\n console.log(\"## Step 1: Sandbox environment name\");\n console.log(\"\");\n if (ctx.environmentNames === null) {\n console.log(\n \"Environment metadata is unavailable for this run's sanitized firewall entry, so no environment name was guessed.\",\n );\n console.log(\"\");\n return;\n }\n if (ctx.environmentNames.length === 0) {\n console.log(\n \"The matched API route does not use a sandbox environment name.\",\n );\n console.log(\"\");\n return;\n }\n\n let environmentPresent = false;\n for (const environmentName of ctx.environmentNames) {\n const present = Boolean(process.env[environmentName]);\n environmentPresent ||= present;\n console.log(\n `Checking process.env.${environmentName}: ${present ? \"present\" : \"not present\"}`,\n );\n }\n if (environmentPresent) {\n console.log(\n \"At least one connector value is present in the sandbox environment. These values may be non-secret connector settings or credential placeholders; real credentials are never injected and are resolved at the network boundary for registered base URLs.\",\n );\n } else {\n console.log(\n \"No value found for these environment names. Note: credential replacement at the network boundary is independent of these names — the proxy injects auth headers based on the destination URL.\",\n );\n }\n console.log(\"\");\n}\n\nasync function checkConnectorStatus(ctx: DiagContext): Promise<{\n readonly isConnected: boolean;\n readonly isExpired: boolean;\n readonly hasPermission: boolean;\n}> {\n console.log(\"## Step 2: Connector configuration\");\n console.log(\"\");\n console.log(\n \"A Connector holds the real credentials (OAuth tokens or API keys) for an external service. These credentials are never injected into the sandbox. Instead, when the sandbox sends an HTTP request to a base URL registered by the Connector, the network boundary intercepts the request and replaces the auth headers with real credentials. For this to work, three conditions must be met:\",\n );\n console.log(\"\");\n\n const [connector, enabledConnectorSlugs] = await Promise.all([\n getZeroConnector(ctx.connectorSlug),\n ctx.agentId\n ? getZeroAgentUserConnectors(ctx.agentId)\n : Promise.resolve(null),\n ]);\n\n const isConnected = connector !== null;\n const isExpired = connector?.connectionStatus === \"reconnect-required\";\n const hasPermission =\n enabledConnectorSlugs !== null &&\n enabledConnectorSlugs.includes(ctx.connectorSlug);\n\n printConnectorConnectionStatus(ctx, isConnected, isExpired, hasPermission);\n printConnectorAuthorizationStatus(ctx, isConnected, isExpired, hasPermission);\n\n return { isConnected, isExpired, hasPermission };\n}\n\nfunction checkConnectorDomains(ctx: DiagContext): boolean | null {\n console.log(\n \"### 2c: Registered base URLs (credential replacement only applies to URLs matching these prefixes)\",\n );\n console.log(\"\");\n\n switch (ctx.run.status) {\n case \"not-scoped\":\n console.log(\n \"This diagnostic is not scoped to a run — skipping the run base URL check.\",\n );\n console.log(\"\");\n return null;\n case \"not-configured\":\n console.log(\n `No configuration found for the ${ctx.label} connector in this run.`,\n );\n console.log(\n \"This means no base URLs are registered for credential replacement for this connector.\",\n );\n console.log(\"\");\n return false;\n case \"configured\":\n console.log(\n `The ${ctx.label} connector is configured for this run with the following base URLs:`,\n );\n for (const base of ctx.run.bases) {\n console.log(` - ${base}`);\n }\n console.log(\"\");\n if (ctx.credentialResolution === \"network-boundary\") {\n console.log(\n \"Credentials are resolved at the network boundary for requests matching these registered base URLs.\",\n );\n }\n console.log(\"\");\n return true;\n }\n}\n\nfunction printUnavailablePolicy(\n policy: Extract<\n ConnectorCheckPolicy,\n {\n readonly outcome: \"unavailable\";\n }\n >,\n): void {\n switch (policy.basis) {\n case \"not-run-scoped\":\n console.log(\n \"Result: Permission policy is unavailable because this diagnostic is not scoped to a run.\",\n );\n return;\n case \"policies-unavailable\":\n console.log(\n \"Result: Network policies are unavailable for this run, so the permission status cannot be determined.\",\n );\n return;\n case \"connector-not-configured\":\n console.log(\n \"Result: The connector is not configured for this run, so requests cannot receive credentials.\",\n );\n return;\n }\n}\n\nfunction printNamedPolicyResult(\n connectorSlug: string,\n permission: string,\n policy: ConnectorCheckPolicy,\n agentId: string | undefined,\n): void {\n switch (policy.outcome) {\n case \"allow\": {\n switch (policy.basis) {\n case \"allow-list\":\n console.log(\n `Result: \"${permission}\" is in the allow list — allowed.`,\n );\n return;\n case \"not-blocked\":\n console.log(\n `Result: \"${permission}\" is not blocked by the deny or ask list — allowed.`,\n );\n return;\n case \"no-policy\":\n console.log(\n `Result: No policy entry exists for this connector — \"${permission}\" is allowed.`,\n );\n return;\n case \"unknown-policy\":\n console.log(\n `Result: The server policy allows \"${permission}\" through the unknown-endpoint policy.`,\n );\n return;\n }\n break;\n }\n case \"deny\":\n console.log(\n policy.basis === \"deny-list\"\n ? `Result: \"${permission}\" is in the deny list — denied.`\n : `Result: The unknown-endpoint policy denies \"${permission}\".`,\n );\n printPermissionRequestCommands(\n connectorSlug,\n permission,\n agentId,\n \"To request this permission, run\",\n );\n return;\n case \"ask\":\n console.log(\n policy.basis === \"ask-list\"\n ? `Result: \"${permission}\" is in the ask list — blocked until approval.`\n : `Result: The unknown-endpoint policy blocks \"${permission}\" until approval.`,\n );\n printPermissionRequestCommands(\n connectorSlug,\n permission,\n agentId,\n \"To request this permission, run\",\n );\n return;\n case \"unavailable\":\n printUnavailablePolicy(policy);\n return;\n }\n}\n\nfunction permissionRequestCommand(\n connectorSlug: string,\n permission: string,\n): string {\n return `zero connector permission-request ${connectorSlug} --permission ${permission}`;\n}\n\nfunction printPermissionRequestCommands(\n connectorSlug: string,\n permission: string,\n agentId: string | undefined,\n introduction: string,\n): void {\n const command = permissionRequestCommand(connectorSlug, permission);\n console.log(`${introduction}: ${command}`);\n if (!currentChatSupportsActionCallback(agentId)) {\n return;\n }\n\n console.log(\"\");\n console.log(\n \"Or, if this is the only connector or permission action needed, run the callback command below. After the user completes this action, Zero will automatically start the next round with the callback prompt:\",\n );\n console.log(`${command} --callback-prompt \"${CALLBACK_PROMPT_PLACEHOLDER}\"`);\n}\n\nfunction printUnknownEndpointPolicy(\n connectorSlug: string,\n policy: ConnectorCheckPolicy,\n agentId: string | undefined,\n): void {\n switch (policy.outcome) {\n case \"allow\":\n console.log(\n policy.basis === \"no-policy\"\n ? \"Result: No policy entry exists for this connector, so the request is allowed.\"\n : \"Result: No permission matched. The unknown endpoint policy allows this request.\",\n );\n return;\n case \"deny\":\n console.log(\n \"Result: No permission matched. The unknown endpoint policy denies this request.\",\n );\n printPermissionRequestCommands(\n connectorSlug,\n \"__unknown__\",\n agentId,\n \"To request access to unknown endpoints, run\",\n );\n return;\n case \"ask\":\n console.log(\n \"Result: No permission matched. The unknown endpoint policy requires approval.\",\n );\n printPermissionRequestCommands(\n connectorSlug,\n \"__unknown__\",\n agentId,\n \"To request access to unknown endpoints, run\",\n );\n return;\n case \"unavailable\":\n printUnavailablePolicy(policy);\n return;\n }\n}\n\nfunction printUrlPermissionDiagnostic(\n result: ResolvedUrlDiagnostic,\n agentId: string | undefined,\n): void {\n console.log(\"## Step 3: Permission policy check (auto-detected from URL)\");\n console.log(\"\");\n console.log(\n `Matching ${result.method} ${result.relativePath} (relative to base URL ${result.base}) against the ${result.connector.label} connector's permission rules.`,\n );\n console.log(\"\");\n\n if (result.permission.kind === \"matched\") {\n console.log(\n `Matched permissions: [${result.permission.permissions\n .map((permission) => {\n return permission.name;\n })\n .join(\", \")}]`,\n );\n console.log(\"\");\n for (const permission of result.permission.permissions) {\n printNamedPolicyResult(\n result.connector.connectorRef,\n permission.name,\n permission.policy,\n agentId,\n );\n }\n } else {\n console.log(\n `No named permission matches ${result.method} ${result.relativePath}. This request falls through to the unknown-endpoint policy.`,\n );\n console.log(\"\");\n printUnknownEndpointPolicy(\n result.connector.connectorRef,\n result.permission.policy,\n agentId,\n );\n }\n console.log(\"\");\n}\n\nfunction printEnvironmentPermissionDiagnostic(\n result: ResolvedEnvironmentDiagnostic,\n permissionName: string | undefined,\n agentId: string | undefined,\n): void {\n if (result.permission === null) {\n return;\n }\n if (permissionName === undefined) {\n throw new Error(\n \"Connector diagnostic returned a permission outcome without a requested permission.\",\n );\n }\n console.log(\"## Step 3: Permission policy check\");\n console.log(\"\");\n console.log(\n `Checking permission: \"${permissionName}\" for the ${result.connector.label} connector.`,\n );\n console.log(\"\");\n printNamedPolicyResult(\n result.connector.connectorRef,\n permissionName,\n result.permission,\n agentId,\n );\n console.log(\"\");\n}\n\nfunction printRediagnoseHint(\n opts: CheckConnectorOptions,\n method: string,\n): void {\n const args: string[] = [];\n if (opts.url !== undefined) {\n args.push(`--url ${shellQuoteArg(stripUrlQueryAndFragment(opts.url))}`);\n if (opts.connector !== undefined) {\n args.push(`--connector ${shellQuoteArg(opts.connector)}`);\n }\n if (opts.envName !== undefined) {\n args.push(`--env-name ${shellQuoteArg(opts.envName)}`);\n }\n if (method !== \"GET\") {\n args.push(`--method ${shellQuoteArg(method)}`);\n }\n } else if (opts.envName !== undefined) {\n args.push(`--env-name ${shellQuoteArg(opts.envName)}`);\n }\n if (opts.checkPermission !== undefined) {\n args.push(`--check-permission ${shellQuoteArg(opts.checkPermission)}`);\n }\n console.log(\n `To re-diagnose after changes, run: zero connector check ${args.join(\" \")}`,\n );\n}\n\nexport const checkConnectorCommand = new Command()\n .name(\"check\")\n .description(\n \"Diagnose connector health: environment names, connector configuration, and permission policies\",\n )\n .addOption(\n new Option(\n \"--env-name <ENV_NAME>\",\n \"The connector environment name to check (e.g. GITHUB_TOKEN)\",\n ),\n )\n .addOption(\n new Option(\n \"--url <URL>\",\n \"A full URL to diagnose — matches connector ownership, route environment names, and permission (e.g. https://api.github.com/repos/owner/repo)\",\n ),\n )\n .addOption(\n // TODO(#23619): Rename this stable CLI option value label in the CLI rollout.\n new Option(\n \"--connector <type>\",\n \"Select the connector when multiple connectors own the same URL route\",\n ),\n )\n .addOption(\n new Option(\n \"--method <METHOD>\",\n \"HTTP method to use when matching permissions with --url\",\n ).default(\"GET\"),\n )\n .addOption(\n new Option(\n \"--check-permission <name>\",\n \"Check whether a specific permission is allowed or denied (e.g. contents:read)\",\n ),\n )\n .addHelpText(\n \"after\",\n `\nExamples:\n zero connector check --env-name GITHUB_TOKEN\n zero connector check --url https://api.github.com/repos/owner/repo\n zero connector check --url https://api.accounts.nintendo.com/2.0.0/users/me --connector nintendo-store\n zero connector check --url https://slack.com/api/chat.postMessage --method POST\n zero connector check --env-name SLACK_TOKEN --check-permission chat:write\n\nHow connectors work:\n A Connector holds the real credentials for an external service. These credentials\n are never injected into the sandbox. Instead, when the sandbox sends an HTTP\n request to a base URL registered by the Connector, the network boundary intercepts\n the request and replaces the auth headers with real credentials.\n\n This command checks each part of that pipeline and reports what it finds.`,\n )\n .action(\n withErrorHandler(async (opts: CheckConnectorOptions, command: Command) => {\n validateCheckConnectorOptions(opts, command);\n if (isComputerUseCheckTarget(opts)) {\n printComputerUsePermissionGuidance();\n return;\n }\n const method = opts.method.toUpperCase();\n const request = buildDiagnosticRequest(opts, method);\n const diagnostic = await diagnoseZeroConnectorCheck(request);\n const result = resolvedDiagnostic(request, diagnostic);\n\n printDiagnosticSummary(request, result);\n console.log(\"\");\n\n const platformUrl = toPlatformUrl(await getApiUrl());\n const ctx: DiagContext = {\n environmentNames: diagnosticEnvironmentNames(result),\n connectorSlug: result.connector.connectorRef,\n label: result.connector.label,\n connectorAvailable: result.connector.visibility === \"available\",\n credentialResolution: result.connector.credentialResolution,\n run: result.run,\n platformOrigin: platformUrl.origin,\n agentId: process.env.ZERO_AGENT_ID || undefined,\n };\n\n checkEnvironmentNames(ctx);\n const { isConnected, isExpired, hasPermission } =\n await checkConnectorStatus(ctx);\n const configuredForRun = checkConnectorDomains(ctx);\n\n if (configuredForRun === false) {\n console.log(\n `Steps 1-2 summary: The ${ctx.label} connector is not configured for this run. Check the agent authorization settings, then start a new run after updating them.`,\n );\n } else if (isConnected && !isExpired && hasPermission) {\n console.log(\n `Steps 1-2 summary: The ${ctx.label} connector is connected, active, and authorized. Outbound requests to the registered base URLs will have credentials injected at the network boundary.`,\n );\n }\n console.log(\"\");\n\n if (result.mode === \"url\") {\n printUrlPermissionDiagnostic(result, ctx.agentId);\n } else {\n printEnvironmentPermissionDiagnostic(\n result,\n request.mode === \"environment\" ? request.permission : undefined,\n ctx.agentId,\n );\n }\n\n printRediagnoseHint(opts, method);\n }),\n );\n","const COMPUTER_USE_CONNECTOR_SLUG = \"computer-use\";\nconst COMPUTER_USE_CAPABILITY = \"computer-use:write\";\nconst COMPUTER_USE_PATH_PREFIX = \"/computer-use\";\nconst COMPUTER_USE_PATH_PREFIX_WITH_SLASH = `${COMPUTER_USE_PATH_PREFIX}/`;\n\ninterface ComputerUsePermissionTarget {\n readonly connectorSlug: string;\n readonly path?: string;\n readonly permission?: string;\n}\n\nexport function isComputerUsePermissionTarget(\n target: ComputerUsePermissionTarget,\n): boolean {\n return (\n target.connectorSlug === COMPUTER_USE_CONNECTOR_SLUG ||\n target.permission === COMPUTER_USE_CAPABILITY ||\n target.path === COMPUTER_USE_PATH_PREFIX ||\n target.path?.startsWith(COMPUTER_USE_PATH_PREFIX_WITH_SLASH) === true\n );\n}\n\nexport function printComputerUsePermissionGuidance(): void {\n console.log(\"Computer Use access is not managed as a connector permission.\");\n console.log(\n \"The current run token needs computer-use:write, which is issued only when a Zero Desktop Computer Use host is selected for the chat or thread before the run starts.\",\n );\n console.log(\n \"Open Zero Desktop, make sure Computer Use is online, select the Computer Use host for this chat/thread, then start a new run. Existing run tokens cannot be upgraded in place.\",\n );\n console.log(\n \"Run `zero whoami` to confirm whether the current ZERO_TOKEN includes computer-use:write.\",\n );\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n connectZeroConnectorManualGrant,\n listZeroConnectorCatalogStatus,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport {\n availableConnectorSlugs,\n findConnectorStatusItem,\n resolveManualGrantAuthMethod,\n} from \"./public-catalog\";\n\ninterface ConnectOptions {\n readonly authMethod?: string;\n readonly value?: readonly string[];\n readonly json?: boolean;\n}\n\nfunction collectValue(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nfunction parseConnectorValues(rawValues: readonly string[] | undefined) {\n if (!rawValues || rawValues.length === 0) {\n throw new Error(\"At least one --value NAME=VALUE is required\", {\n cause: new Error(\n \"Example: zero connector connect zendesk --value apiToken=token\",\n ),\n });\n }\n\n const values: Record<string, string> = {};\n for (const rawValue of rawValues) {\n const separatorIndex = rawValue.indexOf(\"=\");\n if (separatorIndex <= 0) {\n throw new Error(\"Invalid --value format\", {\n cause: new Error(\"Use --value NAME=VALUE\"),\n });\n }\n\n const name = rawValue.slice(0, separatorIndex);\n if (!name.trim()) {\n throw new Error(\"Invalid --value format\", {\n cause: new Error(\"Field name cannot be empty\"),\n });\n }\n\n values[name] = rawValue.slice(separatorIndex + 1);\n }\n\n return values;\n}\n\nexport const connectCommand = new Command()\n .name(\"connect\")\n .description(\"Connect a connector with manual grant values\")\n // TODO(#23619): Rename this stable CLI argument label in the CLI rollout.\n .argument(\"<type>\", \"Connector type (e.g., zendesk)\")\n .option(\"--auth-method <method>\", \"Connector auth method to use\")\n .option(\n \"--value <name=value>\",\n \"Connector field value; repeat for multiple fields\",\n collectValue,\n [],\n )\n .option(\"--json\", \"Print the connector response as JSON\")\n .action(\n withErrorHandler(async (connectorSlug: string, options: ConnectOptions) => {\n const values = parseConnectorValues(options.value);\n const catalog = await listZeroConnectorCatalogStatus();\n const connectorMetadata = findConnectorStatusItem(\n catalog.connectors,\n connectorSlug,\n );\n if (!connectorMetadata) {\n throw new Error(`Unknown or unavailable connector: ${connectorSlug}`, {\n cause: new Error(\n `Available connectors: ${availableConnectorSlugs(catalog.connectors)}`,\n ),\n });\n }\n\n const authMethod = resolveManualGrantAuthMethod(\n connectorMetadata,\n options.authMethod,\n );\n const connector = await connectZeroConnectorManualGrant(\n connectorMetadata.connectorRef,\n authMethod.id,\n values,\n );\n\n if (options.json) {\n console.log(JSON.stringify(connector, null, 2));\n return;\n }\n\n console.log(chalk.green(`✓ ${connectorMetadata.label} connected`));\n console.log(chalk.dim(` Type: ${connector.type}`));\n console.log(chalk.dim(` Auth Method: ${connector.authMethod}`));\n console.log(chalk.dim(` Run: zero connector status ${connector.type}`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroConnectorCatalogStatus } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { padEndAnsi, renderConnectedAsCell, stripAnsi } from \"./connected-as\";\n\nexport const listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List all connectors and their status\")\n .option(\"--agent <id>\", \"Show per-agent authorization column\")\n .action(\n withErrorHandler(async (options: { agent?: string }) => {\n const [{ connectors }, agentCtx] = await Promise.all([\n listZeroConnectorCatalogStatus(),\n resolveAgentContext(options.agent),\n ]);\n\n const connectorSlugs = connectors.map((connector) => {\n return connector.connectorRef;\n });\n\n const connectorSlugWidth = Math.max(\n 4,\n ...connectorSlugs.map((connectorSlug) => {\n return connectorSlug.length;\n }),\n );\n\n const connectedAsHeader = \"CONNECTED AS\";\n const connectedCells = connectors.map((connector) => {\n return renderConnectedAsCell(connector);\n });\n const connectedAsWidth = Math.max(\n connectedAsHeader.length,\n ...connectedCells.map((c) => {\n return stripAnsi(c).length;\n }),\n );\n\n const authorizedHeader = agentCtx\n ? `AUTHORIZED FOR ${agentCtx.displayName}`\n : null;\n\n // Print header\n const headerParts = [\n \"TYPE\".padEnd(connectorSlugWidth),\n connectedAsHeader.padEnd(connectedAsWidth),\n ];\n if (authorizedHeader) headerParts.push(authorizedHeader);\n console.log(chalk.dim(headerParts.join(\" \")));\n\n // Print rows\n for (let i = 0; i < connectorSlugs.length; i++) {\n const connectorSlug = connectorSlugs[i]!;\n const connectedCell = padEndAnsi(connectedCells[i]!, connectedAsWidth);\n const parts = [connectorSlug.padEnd(connectorSlugWidth), connectedCell];\n if (agentCtx) {\n parts.push(\n agentCtx.authorizedConnectorSlugs.has(connectorSlug)\n ? chalk.green(\"✓\")\n : chalk.dim(\"-\"),\n );\n }\n console.log(parts.join(\" \"));\n }\n }),\n );\n","import chalk from \"chalk\";\nimport type { PublicConnectorStatus } from \"./public-catalog\";\n\nfunction renderIdentity(connector: PublicConnectorStatus): string {\n if (connector.connection?.externalUsername) {\n return `@${connector.connection.externalUsername}`;\n }\n if (connector.connection?.externalEmail)\n return connector.connection.externalEmail;\n return \"-\";\n}\n\nexport function renderConnectedAsCell(\n connector: PublicConnectorStatus | undefined,\n): string {\n if (!connector || connector.connectionStatus === \"not-connected\") {\n return chalk.dim(\"(not connected)\");\n }\n const identity = renderIdentity(connector);\n if (connector.connectionStatus === \"reconnect-required\") {\n return chalk.yellow(`${identity} (reconnect needed)`);\n }\n if (\n connector.scopeMismatch ||\n connector.connectionStatus === \"scope-mismatch\"\n ) {\n return chalk.yellow(`${identity} (permissions update available)`);\n }\n return identity;\n}\n\nconst ESC = \"\\u001b\";\nconst ANSI_PATTERN = new RegExp(`${ESC}\\\\[[0-9;]*m`, \"g\");\n\nexport function stripAnsi(s: string): string {\n return s.replace(ANSI_PATTERN, \"\");\n}\n\nexport function padEndAnsi(s: string, width: number): string {\n const visible = stripAnsi(s).length;\n return s + \" \".repeat(Math.max(0, width - visible));\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroConnectorCatalogStatus } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { padEndAnsi, renderConnectedAsCell, stripAnsi } from \"./connected-as\";\nimport { searchPublicConnectorCatalog } from \"./public-catalog\";\n\nconst DEFAULT_LIMIT = 5;\nconst EXACT_MATCH_THRESHOLD = 80;\n\nfunction parseLimit(raw: string): number {\n const trimmed = raw.trim();\n const n = Number(trimmed);\n if (!/^\\d+$/.test(trimmed) || !Number.isSafeInteger(n) || n <= 0) {\n throw new Error(`--limit must be a positive integer, got \"${raw}\".`);\n }\n return n;\n}\n\nexport const searchCommand = new Command()\n .name(\"search\")\n .description(\n \"Search connectors by type, label, category, generation type, or tag\",\n )\n .argument(\"<keyword>\", \"Search keyword (case-insensitive)\")\n .option(\"--agent <id>\", \"Show per-agent authorization column\")\n .option(\n \"--limit <n>\",\n `Maximum number of results to display (default ${DEFAULT_LIMIT})`,\n parseLimit,\n DEFAULT_LIMIT,\n )\n .action(\n withErrorHandler(\n async (keyword: string, options: { agent?: string; limit: number }) => {\n const trimmed = keyword.trim();\n if (!trimmed) {\n throw new Error(\"Keyword cannot be empty.\");\n }\n\n const [{ connectors }, agentCtx] = await Promise.all([\n listZeroConnectorCatalogStatus(),\n resolveAgentContext(options.agent),\n ]);\n const { results, total } = searchPublicConnectorCatalog(\n connectors,\n trimmed,\n options.limit,\n );\n\n if (results.length === 0) {\n console.log(\"No matches found.\");\n return;\n }\n\n const topScore = results[0]!.score;\n if (topScore < EXACT_MATCH_THRESHOLD) {\n console.log(\"No exact match. Showing closest:\");\n }\n if (total > options.limit) {\n console.log(`Too many results (top ${options.limit} of ${total}):`);\n }\n\n const connectorSlugHeader = \"TYPE\";\n const connectedAsHeader = \"CONNECTED AS\";\n\n const connectedCells = results.map((r) => {\n return renderConnectedAsCell(r.connector);\n });\n\n const connectorSlugWidth = Math.max(\n connectorSlugHeader.length,\n ...results.map((r) => {\n return r.connector.connectorRef.length;\n }),\n );\n const connectedAsWidth = Math.max(\n connectedAsHeader.length,\n ...connectedCells.map((c) => {\n return stripAnsi(c).length;\n }),\n );\n\n const headerParts = [\n connectorSlugHeader.padEnd(connectorSlugWidth),\n connectedAsHeader.padEnd(connectedAsWidth),\n ];\n if (agentCtx) {\n headerParts.push(`AUTHORIZED FOR ${agentCtx.displayName}`);\n }\n console.log(chalk.dim(headerParts.join(\" \")));\n\n for (let i = 0; i < results.length; i++) {\n const result = results[i]!;\n const parts = [\n result.connector.connectorRef.padEnd(connectorSlugWidth),\n padEndAnsi(connectedCells[i]!, connectedAsWidth),\n ];\n if (agentCtx) {\n parts.push(\n agentCtx.authorizedConnectorSlugs.has(\n result.connector.connectorRef,\n )\n ? chalk.green(\"✓\")\n : chalk.dim(\"-\"),\n );\n }\n console.log(parts.join(\" \"));\n }\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { listZeroConnectorCatalogStatus } from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveAgentContext } from \"./agent-context\";\nimport { getPlatformOrigin } from \"../doctor/platform-url\";\nimport {\n availableConnectorSlugs,\n findConnectorStatusItem,\n type PublicConnectorStatus,\n} from \"./public-catalog\";\nimport {\n connectorActionUrl,\n printCallbackActionUrlExample,\n} from \"./action-url\";\n\nconst LABEL_WIDTH = 16;\n\ntype AgentContext = NonNullable<\n Awaited<ReturnType<typeof resolveAgentContext>>\n>;\n\nfunction printConnectorDetails(connector: PublicConnectorStatus): void {\n if (connector.connectionStatus === \"not-connected\") {\n console.log(\n `${\"Status:\".padEnd(LABEL_WIDTH)}${chalk.dim(\"not connected\")}`,\n );\n return;\n }\n\n console.log(\n `${\"Status:\".padEnd(LABEL_WIDTH)}${\n connector.connectionStatus === \"reconnect-required\"\n ? chalk.yellow(\"reconnect needed\")\n : chalk.green(\"connected\")\n }`,\n );\n if (connector.connection?.externalUsername) {\n console.log(\n `${\"Account:\".padEnd(LABEL_WIDTH)}@${connector.connection.externalUsername}`,\n );\n } else if (connector.connection?.externalEmail) {\n console.log(\n `${\"Account:\".padEnd(LABEL_WIDTH)}${connector.connection.externalEmail}`,\n );\n }\n if (connector.connection?.authMethod) {\n console.log(\n `${\"Auth Method:\".padEnd(LABEL_WIDTH)}${connector.connection.authMethod}`,\n );\n }\n if (connector.scopeMismatch) {\n console.log(\n `${\"Permissions:\".padEnd(LABEL_WIDTH)}${chalk.yellow(\"update available\")}`,\n );\n }\n if (connector.tokenExpiresAt) {\n console.log(\n `${\"Token Expires:\".padEnd(LABEL_WIDTH)}${connector.tokenExpiresAt}`,\n );\n }\n}\n\nasync function printAgentAction(\n connector: PublicConnectorStatus,\n agentCtx: AgentContext,\n): Promise<void> {\n const connectorSlug = connector.connectorRef;\n const authorized = agentCtx.authorizedConnectorSlugs.has(connectorSlug);\n const isConnected = connector.connected;\n const needsReconnect = connector.connectionStatus === \"reconnect-required\";\n const agentLabel =\n agentCtx.displayName === agentCtx.agentId\n ? agentCtx.agentId\n : `${agentCtx.displayName} (${agentCtx.agentId})`;\n\n console.log();\n if (needsReconnect) {\n const origin = await getPlatformOrigin();\n const url = connectorActionUrl({\n origin,\n path: `/connectors/${connectorSlug}/connect`,\n agentId: agentCtx.agentId,\n });\n console.log(\n `The ${connectorSlug} connector is connected but needs to be reconnected before agent ${agentLabel} can use it.`,\n );\n console.log(`Reconnect it at: [Reconnect ${connectorSlug}](${url})`);\n printCallbackActionUrlExample(url, agentCtx.agentId);\n } else if (authorized && !isConnected) {\n const origin = await getPlatformOrigin();\n const url = connectorActionUrl({\n origin,\n path: `/connectors/${connectorSlug}/connect`,\n agentId: agentCtx.agentId,\n });\n console.log(\n `The ${connectorSlug} connector is authorized for agent ${agentLabel}, but it is not connected.`,\n );\n console.log(`Connect it at: [Connect ${connectorSlug}](${url})`);\n printCallbackActionUrlExample(url, agentCtx.agentId);\n } else if (authorized) {\n console.log(\n `The ${connectorSlug} connector is authorized for agent ${agentLabel}.`,\n );\n } else if (!isConnected) {\n const origin = await getPlatformOrigin();\n const url = connectorActionUrl({\n origin,\n path: `/connectors/${connectorSlug}/connect`,\n agentId: agentCtx.agentId,\n });\n console.log(\n `The ${connectorSlug} connector is not connected. Once connected, it will be authorized for agent ${agentLabel}.`,\n );\n console.log(\n `Connect and authorize it at: [Connect ${connectorSlug}](${url})`,\n );\n printCallbackActionUrlExample(url, agentCtx.agentId);\n } else {\n const origin = await getPlatformOrigin();\n const url = connectorActionUrl({\n origin,\n path: `/connectors/${connectorSlug}/authorize`,\n agentId: agentCtx.agentId,\n });\n console.log(\n `The ${connectorSlug} connector is not authorized for agent ${agentLabel}.`,\n );\n console.log(`Authorize it at: [Authorize ${connectorSlug}](${url})`);\n printCallbackActionUrlExample(url, agentCtx.agentId);\n }\n}\n\nasync function printStandaloneAction(\n connector: PublicConnectorStatus,\n): Promise<void> {\n const connectorSlug = connector.connectorRef;\n if (\n connector.connectionStatus === \"connected\" ||\n connector.connectionStatus === \"scope-mismatch\"\n ) {\n return;\n }\n\n const origin = await getPlatformOrigin();\n console.log();\n if (connector.connectionStatus === \"reconnect-required\") {\n const url = `${origin}/connectors`;\n console.log(\n `The ${connectorSlug} connector is connected but needs to be reconnected.`,\n );\n console.log(`Reconnect it at: [Reconnect ${connectorSlug}](${url})`);\n } else {\n const url = `${origin}/connectors/${connectorSlug}/connect`;\n console.log(`Connect it at: [Connect ${connectorSlug}](${url})`);\n }\n}\n\nexport const statusCommand = new Command()\n .name(\"status\")\n .description(\"Show detailed status of a connector\")\n // TODO(#23619): Rename this stable CLI argument label in the CLI rollout.\n .argument(\"<type>\", \"Connector type (e.g., github)\")\n .option(\"--agent <id>\", \"Show authorization state for the given agent\")\n .action(\n withErrorHandler(\n async (connectorSlug: string, options: { agent?: string }) => {\n const [catalog, agentCtx] = await Promise.all([\n listZeroConnectorCatalogStatus(),\n resolveAgentContext(options.agent),\n ]);\n const connector = findConnectorStatusItem(\n catalog.connectors,\n connectorSlug,\n );\n if (!connector) {\n throw new Error(\n `Unknown or unavailable connector: ${connectorSlug}`,\n {\n cause: new Error(\n `Available connectors: ${availableConnectorSlugs(catalog.connectors)}`,\n ),\n },\n );\n }\n\n console.log(`Connector: ${chalk.cyan(connector.connectorRef)}`);\n console.log();\n\n printConnectorDetails(connector);\n\n if (agentCtx) {\n await printAgentAction(connector, agentCtx);\n } else {\n await printStandaloneAction(connector);\n }\n },\n ),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { readFile } from \"node:fs/promises\";\nimport { customConnectorProposalSchema } from \"@vm0/api-contracts/contracts/zero-custom-connectors\";\nimport {\n getZeroAgent,\n getZeroAgentCustomConnectors,\n getZeroCustomConnector,\n listZeroCustomConnectors,\n} from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport { getPlatformOrigin } from \"../../doctor/platform-url\";\n\nconst LABEL_WIDTH = 18;\n\nfunction renderConnected(connector: {\n readonly connected: boolean;\n readonly missingRequiredFields: readonly string[];\n}): string {\n if (connector.connected) {\n return chalk.green(\"connected\");\n }\n if (connector.missingRequiredFields.length === 0) {\n return chalk.dim(\"not connected\");\n }\n return chalk.yellow(`missing ${connector.missingRequiredFields.join(\", \")}`);\n}\n\nfunction encodeBase64UrlJson(value: unknown): string {\n return Buffer.from(JSON.stringify(value), \"utf8\").toString(\"base64url\");\n}\n\nfunction isJsonObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nasync function resolveCustomAgentContext(agentId: string | undefined): Promise<{\n readonly agentId: string;\n readonly displayName: string;\n readonly authorizedIds: Set<string>;\n} | null> {\n const resolvedAgentId = agentId ?? process.env.ZERO_AGENT_ID;\n if (!resolvedAgentId) {\n return null;\n }\n const [agent, enabledIds] = await Promise.all([\n getZeroAgent(resolvedAgentId),\n getZeroAgentCustomConnectors(resolvedAgentId),\n ]);\n return {\n agentId: agent.agentId,\n displayName: agent.displayName ?? agent.agentId,\n authorizedIds: new Set(enabledIds),\n };\n}\n\nconst listCommand = new Command()\n .name(\"list\")\n .alias(\"ls\")\n .description(\"List org custom connectors\")\n .option(\"--agent <id>\", \"Show per-agent authorization column\")\n .action(\n withErrorHandler(async (options: { agent?: string }) => {\n const [connectors, agentCtx] = await Promise.all([\n listZeroCustomConnectors(),\n resolveCustomAgentContext(options.agent),\n ]);\n const idWidth = Math.max(\n 2,\n ...connectors.map((connector) => {\n return connector.id.length;\n }),\n );\n const nameWidth = Math.max(\n 4,\n ...connectors.map((connector) => {\n return connector.displayName.length;\n }),\n );\n const header = [\"ID\".padEnd(idWidth), \"NAME\".padEnd(nameWidth), \"STATUS\"];\n if (agentCtx) {\n header.push(`AUTHORIZED FOR ${agentCtx.displayName}`);\n }\n console.log(chalk.dim(header.join(\" \")));\n for (const connector of connectors) {\n const row = [\n connector.id.padEnd(idWidth),\n connector.displayName.padEnd(nameWidth),\n renderConnected(connector),\n ];\n if (agentCtx) {\n row.push(\n agentCtx.authorizedIds.has(connector.id)\n ? chalk.green(\"✓\")\n : chalk.dim(\"-\"),\n );\n }\n console.log(row.join(\" \"));\n }\n }),\n );\n\nconst statusCommand = new Command()\n .name(\"status\")\n .description(\"Show detailed status of a custom connector\")\n .argument(\"<connector-id>\", \"Custom connector id\")\n .option(\"--agent <id>\", \"Show authorization state for the given agent\")\n .action(\n withErrorHandler(\n async (connectorId: string, options: { agent?: string }) => {\n const [connector, agentCtx] = await Promise.all([\n getZeroCustomConnector(connectorId),\n resolveCustomAgentContext(options.agent),\n ]);\n if (!connector) {\n throw new Error(`Custom connector not found: ${connectorId}`);\n }\n console.log(`Custom connector: ${chalk.cyan(connector.displayName)}`);\n console.log();\n console.log(`${\"ID:\".padEnd(LABEL_WIDTH)}${connector.id}`);\n console.log(\n `${\"Status:\".padEnd(LABEL_WIDTH)}${renderConnected(connector)}`,\n );\n console.log(\n `${\"Prefixes:\".padEnd(LABEL_WIDTH)}${connector.prefixTemplates.join(\", \")}`,\n );\n console.log(\n `${\"Fields:\".padEnd(LABEL_WIDTH)}${connector.fields\n .map((field) => {\n return `${field.kind}:${field.key}${field.required ? \"\" : \"?\"}`;\n })\n .join(\", \")}`,\n );\n if (connector.headerInjections.length > 0) {\n console.log(\n `${\"Headers:\".padEnd(LABEL_WIDTH)}${connector.headerInjections\n .map((header) => {\n return header.name;\n })\n .join(\", \")}`,\n );\n }\n if (connector.queryInjections.length > 0) {\n console.log(\n `${\"Query params:\".padEnd(LABEL_WIDTH)}${connector.queryInjections\n .map((query) => {\n return query.name;\n })\n .join(\", \")}`,\n );\n }\n if (agentCtx) {\n console.log(\n `${\"Authorized:\".padEnd(LABEL_WIDTH)}${\n agentCtx.authorizedIds.has(connector.id)\n ? chalk.green(\"yes\")\n : chalk.yellow(\"no\")\n }`,\n );\n }\n },\n ),\n );\n\nconst proposeCommand = new Command()\n .name(\"propose\")\n .description(\"Create a browser save link for a custom connector proposal\")\n .requiredOption(\"--proposal-file <path>\", \"JSON proposal file\")\n .option(\"--connector-id <id>\", \"Override connector id for update proposals\")\n .option(\"--agent <id>\", \"Authorize this agent when the proposal is saved\")\n .action(\n withErrorHandler(\n async (options: {\n proposalFile: string;\n connectorId?: string;\n agent?: string;\n }) => {\n const raw = await readFile(options.proposalFile, \"utf8\");\n const proposalJson: unknown = JSON.parse(raw);\n if (!isJsonObject(proposalJson)) {\n throw new Error(\"Proposal file must contain a JSON object\");\n }\n const parsed = customConnectorProposalSchema.parse({\n ...proposalJson,\n ...(options.connectorId ? { connectorId: options.connectorId } : {}),\n });\n const origin = await getPlatformOrigin();\n const params = new URLSearchParams({\n p: encodeBase64UrlJson(parsed),\n });\n const agentId = options.agent ?? process.env.ZERO_AGENT_ID;\n if (agentId) {\n params.set(\"agentId\", agentId);\n }\n const url = `${origin}/connectors/custom/proposal?${params.toString()}`;\n console.log(`[Configure ${parsed.displayName}](${url})`);\n console.log();\n console.log(\n \"Open this link to review, save values, and authorize the connector.\",\n );\n },\n ),\n );\n\nexport const customConnectorCommand = new Command()\n .name(\"custom\")\n .description(\"Inspect and propose org custom connectors\")\n .addCommand(listCommand)\n .addCommand(statusCommand)\n .addCommand(proposeCommand);\n","import { Command, Option } from \"commander\";\nimport { findFirewallMetadataPermission } from \"@vm0/connectors/firewall-metadata/policy\";\nimport { UNKNOWN_PERMISSION_GRANT } from \"@vm0/connectors/firewall-types\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { getPlatformOrigin } from \"../doctor/platform-url\";\nimport {\n isComputerUsePermissionTarget,\n printComputerUsePermissionGuidance,\n} from \"./computer-use-guidance\";\nimport {\n isBrowserPermissionTarget,\n printBrowserPermissionGuidance,\n} from \"./browser-guidance\";\nimport {\n ApiRequestError,\n createBrowserAuthorizationRequest,\n createComputerUseAuthorizationRequest,\n getZeroConnectorCatalogPermissions,\n} from \"../../../lib/api\";\nimport {\n addRequestedCallbackSearchParams,\n connectorActionCallbackAvailable,\n printCallbackTurnInstruction,\n} from \"./action-url\";\n\nfunction permissionDescription(permission: string): string {\n return permission === UNKNOWN_PERMISSION_GRANT\n ? \"unknown endpoints\"\n : `the \"${permission}\" permission`;\n}\n\nfunction printSensitivePermissionGuidance(\n connectorSlug: string,\n permission: string,\n): void {\n // Slack chat:write: strongly recommend bot-based messaging over user identity\n if (connectorSlug === \"slack\" && permission === \"chat:write\") {\n console.log(\"\");\n console.log(\n \"IMPORTANT: Granting chat:write allows sending messages AS THE USER's identity, not as a bot.\",\n );\n console.log(\n \"Use `zero slack message send -c <channel> -t <text>` to send messages as the bot instead — this is the recommended approach for most use cases.\",\n );\n console.log(\n \"Only allow this permission below if acting as the user is specifically required.\",\n );\n console.log(\"\");\n }\n\n // Gmail send permissions: strongly recommend draft-based workflow over direct send.\n if (\n connectorSlug === \"gmail\" &&\n (permission === \"messages.send\" || permission === \"drafts.send\")\n ) {\n console.log(\"\");\n console.log(\n \"IMPORTANT: Granting Gmail send permissions allows the agent to send emails directly as the user.\",\n );\n console.log(\n \"Consider keeping messages.send and drafts.send disabled and using drafts.write instead — the agent can create drafts for the user to review and send manually.\",\n );\n console.log(\n \"Only allow this permission below if direct sending is specifically required.\",\n );\n console.log(\"\");\n }\n}\n\nfunction printPermissionRequestMessage(args: {\n readonly permission: string;\n readonly label: string;\n readonly url: string;\n}): void {\n console.log(\n `You can allow ${permissionDescription(args.permission)} for your connector access: [Manage ${args.label} permissions](${args.url})`,\n );\n}\n\nfunction printComputerUseAuthorizationLink(args: {\n readonly authorizationUrl: string;\n readonly expiresAt: string;\n}): void {\n console.log(\n \"Computer Use needs a Zero Desktop host selected before a run starts.\",\n );\n console.log(\n \"Ask the user to authorize a host for future runs in this chat or Slack thread:\",\n );\n console.log(args.authorizationUrl);\n console.log(\n `This link expires at ${args.expiresAt}. Existing run tokens cannot be upgraded in place; start a new run after authorization.`,\n );\n}\n\nasync function printComputerUsePermissionRequestMessage(): Promise<void> {\n if (!process.env.ZERO_TOKEN) {\n printComputerUsePermissionGuidance();\n return;\n }\n\n try {\n const request = await createComputerUseAuthorizationRequest();\n printComputerUseAuthorizationLink({\n authorizationUrl: request.authorizationUrl,\n expiresAt: request.expiresAt,\n });\n } catch (error) {\n if (error instanceof ApiRequestError) {\n console.log(\n `Computer Use authorization link unavailable: ${error.message}`,\n );\n printComputerUsePermissionGuidance();\n return;\n }\n const message = error instanceof Error ? error.message : \"Unknown error\";\n console.log(`Computer Use authorization link unavailable: ${message}`);\n printComputerUsePermissionGuidance();\n }\n}\n\nfunction printBrowserAuthorizationLink(args: {\n readonly authorizationUrl: string;\n readonly expiresAt: string;\n}): void {\n console.log(\n \"Cloud browser needs to be enabled for this chat thread before a run starts.\",\n );\n console.log(\n \"Ask the user to enable the cloud browser for future runs in this thread:\",\n );\n console.log(args.authorizationUrl);\n console.log(\n `This link expires at ${args.expiresAt}. Existing run tokens cannot be upgraded in place; start a new run after authorization.`,\n );\n}\n\nasync function printBrowserPermissionRequestMessage(): Promise<void> {\n if (!process.env.ZERO_TOKEN) {\n printBrowserPermissionGuidance();\n return;\n }\n try {\n const request = await createBrowserAuthorizationRequest();\n printBrowserAuthorizationLink(request);\n } catch (error) {\n if (error instanceof ApiRequestError) {\n console.log(\n `Cloud browser authorization link unavailable: ${error.message}`,\n );\n printBrowserPermissionGuidance();\n return;\n }\n const message = error instanceof Error ? error.message : \"Unknown error\";\n console.log(`Cloud browser authorization link unavailable: ${message}`);\n printBrowserPermissionGuidance();\n }\n}\n\nasync function outputPermissionRequestMessage(\n connectorSlug: string,\n label: string,\n permission: string,\n agentId: string | undefined,\n callbackPrompt: string | undefined,\n): Promise<void> {\n const platformOrigin = await getPlatformOrigin();\n\n const urlParams = new URLSearchParams({\n ref: connectorSlug,\n permission,\n action: \"allow\",\n });\n addRequestedCallbackSearchParams(urlParams, callbackPrompt, agentId);\n\n const pagePath = agentId ? `/agents/${agentId}/permissions` : \"/agents\";\n const url = `${platformOrigin}${pagePath}?${urlParams.toString()}`;\n\n printSensitivePermissionGuidance(connectorSlug, permission);\n printPermissionRequestMessage({\n permission,\n label,\n url,\n });\n if (callbackPrompt !== undefined) {\n printCallbackTurnInstruction();\n }\n}\n\nconst callbackPromptOption = new Option(\n \"--callback-prompt <prompt>\",\n \"Start the next web chat round with this prompt after the permission is granted\",\n);\nconst callbackPromptAvailable = connectorActionCallbackAvailable();\nif (!callbackPromptAvailable) {\n callbackPromptOption.hideHelp();\n}\nconst callbackPromptExample = callbackPromptAvailable\n ? ' zero connector permission-request github --permission contents:write --callback-prompt \"Re-check the permission, then continue the previous task\"\\n'\n : \"\";\nconst callbackPromptNotes = callbackPromptAvailable\n ? \" - Use --callback-prompt only when this turn needs exactly one connector or permission action\\n - Callback prompts are included in the URL; keep them concise and do not include secrets\\n\"\n : \"\";\n\nexport const permissionRequestCommand = new Command()\n .name(\"permission-request\")\n .description(\"Request permission to use a connector capability\")\n // TODO(#23619): Rename this stable CLI argument label in the CLI rollout.\n .argument(\"<connector-ref>\", \"The connector type (e.g. github)\")\n .addOption(\n new Option(\n \"--permission <name>\",\n \"The permission name to request\",\n ).makeOptionMandatory(),\n )\n .addOption(\n new Option(\n \"--agent <id>\",\n \"Agent ID whose permission page should be opened (defaults to ZERO_AGENT_ID)\",\n ),\n )\n .addOption(callbackPromptOption)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero connector permission-request github --permission contents:read\n${callbackPromptExample} zero connector permission-request gmail --permission messages.write --agent <agent-id>\n zero connector permission-request cloudflare --permission __unknown__\n zero connector permission-request computer-use --permission computer-use:write\n zero connector permission-request browser --permission browser:write\n\nNotes:\n - Outputs a platform URL for the user to allow the permission\n - Use --permission __unknown__ to request access to unknown endpoints\n - Use --agent to request a permission for another agent; defaults to ZERO_AGENT_ID\n - The user chooses the permission duration on the confirmation page\n${callbackPromptNotes} - Permission requests update the current user's connector grants after confirmation`,\n )\n .action(\n withErrorHandler(\n async (\n connectorSlug: string,\n opts: {\n permission: string;\n agent?: string;\n callbackPrompt?: string;\n },\n ) => {\n if (\n isBrowserPermissionTarget({\n connectorSlug,\n permission: opts.permission,\n })\n ) {\n if (opts.callbackPrompt !== undefined) {\n throw new Error(\n \"--callback-prompt is not supported for cloud browser authorization requests\",\n );\n }\n await printBrowserPermissionRequestMessage();\n return;\n }\n if (\n isComputerUsePermissionTarget({\n connectorSlug,\n permission: opts.permission,\n })\n ) {\n if (opts.callbackPrompt !== undefined) {\n throw new Error(\n \"--callback-prompt is not supported for Computer Use authorization requests\",\n );\n }\n await printComputerUsePermissionRequestMessage();\n return;\n }\n\n const agentId = opts.agent ?? process.env.ZERO_AGENT_ID;\n\n const metadata =\n await getZeroConnectorCatalogPermissions(connectorSlug);\n if (!metadata) {\n throw new Error(`Unknown connector type: ${connectorSlug}`);\n }\n\n if (\n opts.permission !== UNKNOWN_PERMISSION_GRANT &&\n !findFirewallMetadataPermission(metadata, opts.permission)\n ) {\n throw new Error(\n `Unknown permission \"${opts.permission}\" for ${connectorSlug}`,\n );\n }\n\n await outputPermissionRequestMessage(\n connectorSlug,\n metadata.label,\n opts.permission,\n agentId,\n opts.callbackPrompt,\n );\n },\n ),\n );\n","const BROWSER_CONNECTOR_SLUG = \"browser\";\nconst BROWSER_WRITE_CAPABILITY = \"browser:write\";\n\nexport function isBrowserPermissionTarget(args: {\n readonly connectorSlug: string;\n readonly permission: string;\n}): boolean {\n return (\n args.connectorSlug === BROWSER_CONNECTOR_SLUG ||\n args.permission === BROWSER_WRITE_CAPABILITY\n );\n}\n\nexport function printBrowserPermissionGuidance(): void {\n console.log(\n \"Cloud browser access is controlled by the current chat thread, not a connector grant.\",\n );\n console.log(\n \"Enable Cloud browser under Your computer in the chat composer, then start a new run. Existing run tokens cannot be upgraded in place.\",\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;ACAA;;;ACAA;AAAA,IAAM,8BAA8B;AACpC,IAAM,0BAA0B;AAChC,IAAM,2BAA2B;AACjC,IAAM,sCAAsC,GAAG,wBAAwB;AAQhE,SAAS,8BACd,QACS;AACT,SACE,OAAO,kBAAkB,+BACzB,OAAO,eAAe,2BACtB,OAAO,SAAS,4BAChB,OAAO,MAAM,WAAW,mCAAmC,MAAM;AAErE;AAEO,SAAS,qCAA2C;AACzD,UAAQ,IAAI,+DAA+D;AAC3E,UAAQ;AAAA,IACN;AAAA,EACF;AACA,UAAQ;AAAA,IACN;AAAA,EACF;AACA,UAAQ;AAAA,IACN;AAAA,EACF;AACF;;;ADoCA,SAAS,yBAAyB,KAAqB;AACrD,QAAM,aAAa,IAAI,QAAQ,GAAG;AAClC,QAAM,gBAAgB,IAAI,QAAQ,GAAG;AACrC,MAAI,MAAM,IAAI;AACd,MAAI,eAAe,GAAI,OAAM,KAAK,IAAI,KAAK,UAAU;AACrD,MAAI,kBAAkB,GAAI,OAAM,KAAK,IAAI,KAAK,aAAa;AAC3D,SAAO,IAAI,MAAM,GAAG,GAAG;AACzB;AAEA,SAAS,2BAA2B,KAAsB;AACxD,QAAM,YAAY,IAAI,QAAQ,KAAK;AACnC,MAAI,cAAc,GAAI,QAAO;AAE7B,QAAM,iBAAiB,YAAY;AACnC,MAAI,eAAe,IAAI;AACvB,aAAW,aAAa,CAAC,KAAK,KAAK,GAAG,GAAG;AACvC,UAAM,iBAAiB,IAAI,QAAQ,WAAW,cAAc;AAC5D,QAAI,mBAAmB,IAAI;AACzB,qBAAe,KAAK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AI,KAAK,mBAAmB,QAAW;AACrC,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AAAA,QACF;AACA,cAAM,yCAAyC;AAC/C;AAAA,MACF;AAEA,YAAM,UAAU,KAAK,SAAS,QAAQ,IAAI;AAE1C,YAAM,WACJ,MAAM,mCAAmC,aAAa;AACxD,UAAI,CAAC,UAAU;AACb,cAAM,IAAI,MAAM,2BAA2B,aAAa,EAAE;AAAA,MAC5D;AAEA,UACE,KAAK,eAAe,4BACpB,CAAC,+BAA+B,UAAU,KAAK,UAAU,GACzD;AACA,cAAM,IAAI;AAAA,UACR,uBAAuB,KAAK,UAAU,SAAS,aAAa;AAAA,QAC9D;AAAA,MACF;AAEA,YAAM;AAAA,QACJ;AAAA,QACA,SAAS;AAAA,QACT,KAAK;AAAA,QACL;AAAA,QACA,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACF;;;ATvSK,IAAM,uBAAuB,IAAI,QAAQ,EAC7C,KAAK,WAAW,EAChB,YAAY,qDAAqD,EACjE,WAAW,qBAAqB,EAChC,WAAW,sBAAsB,EACjC,WAAW,cAAc,EACzB,WAAW,WAAW,EACtB,WAAW,aAAa,EACxB,WAAW,aAAa,EACxB,WAAWC,yBAAwB;","names":["LABEL_WIDTH","listCommand","statusCommand","permissionRequestCommand","permissionRequestCommand"]}
|
|
@@ -10,19 +10,19 @@ import {
|
|
|
10
10
|
createZeroCreditCheckout,
|
|
11
11
|
getZeroBillingStatus,
|
|
12
12
|
getZeroOrgMembers
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-KCVBW7AC.js";
|
|
14
|
+
import "./chunk-TCZ2FX3X.js";
|
|
15
15
|
import {
|
|
16
16
|
planUpgradeUrl
|
|
17
17
|
} from "./chunk-2NW76WYJ.js";
|
|
18
18
|
import {
|
|
19
19
|
getPlatformOrigin
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IYS3T6IA.js";
|
|
21
21
|
import "./chunk-MA22KQYU.js";
|
|
22
22
|
import {
|
|
23
23
|
source_default,
|
|
24
24
|
withErrorHandler
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-2KEUNCZT.js";
|
|
26
26
|
import {
|
|
27
27
|
decodeZeroTokenPayload
|
|
28
28
|
} from "./chunk-MD3YWUKO.js";
|
|
@@ -163,4 +163,4 @@ var zeroCreditCommand = new Command().name("credit").description("View credit ba
|
|
|
163
163
|
export {
|
|
164
164
|
zeroCreditCommand
|
|
165
165
|
};
|
|
166
|
-
//# sourceMappingURL=credit-
|
|
166
|
+
//# sourceMappingURL=credit-SWBRMGXY.js.map
|
|
@@ -4,12 +4,12 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
requestDeveloperSupportConsent,
|
|
6
6
|
submitDeveloperSupport
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-KCVBW7AC.js";
|
|
8
|
+
import "./chunk-TCZ2FX3X.js";
|
|
9
9
|
import "./chunk-MA22KQYU.js";
|
|
10
10
|
import {
|
|
11
11
|
withErrorHandler
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-2KEUNCZT.js";
|
|
13
13
|
import "./chunk-MD3YWUKO.js";
|
|
14
14
|
import {
|
|
15
15
|
Command
|
|
@@ -61,4 +61,4 @@ Notes:
|
|
|
61
61
|
export {
|
|
62
62
|
zeroDeveloperSupportCommand
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=developer-support-
|
|
64
|
+
//# sourceMappingURL=developer-support-FTYPJJ6Q.js.map
|
|
@@ -9,19 +9,19 @@ import {
|
|
|
9
9
|
getZeroBillingStatus,
|
|
10
10
|
getZeroOrg,
|
|
11
11
|
getZeroOrgMembers
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-KCVBW7AC.js";
|
|
13
|
+
import "./chunk-TCZ2FX3X.js";
|
|
14
14
|
import {
|
|
15
15
|
planUpgradeUrl
|
|
16
16
|
} from "./chunk-2NW76WYJ.js";
|
|
17
17
|
import {
|
|
18
18
|
getPlatformOrigin
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-IYS3T6IA.js";
|
|
20
20
|
import "./chunk-MA22KQYU.js";
|
|
21
21
|
import {
|
|
22
22
|
source_default,
|
|
23
23
|
withErrorHandler
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-2KEUNCZT.js";
|
|
25
25
|
import "./chunk-MD3YWUKO.js";
|
|
26
26
|
import {
|
|
27
27
|
Command
|
|
@@ -122,4 +122,4 @@ Notes:
|
|
|
122
122
|
export {
|
|
123
123
|
zeroDoctorCommand
|
|
124
124
|
};
|
|
125
|
-
//# sourceMappingURL=doctor-
|
|
125
|
+
//# sourceMappingURL=doctor-6AOKR5UU.js.map
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
downloadFeishuFile,
|
|
8
8
|
initFeishuFileUpload,
|
|
9
9
|
sendFeishuMessage
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-KCVBW7AC.js";
|
|
11
|
+
import "./chunk-TCZ2FX3X.js";
|
|
12
12
|
import "./chunk-MA22KQYU.js";
|
|
13
13
|
import {
|
|
14
14
|
source_default,
|
|
15
15
|
withErrorHandler
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-2KEUNCZT.js";
|
|
17
17
|
import "./chunk-MD3YWUKO.js";
|
|
18
18
|
import {
|
|
19
19
|
Command
|
|
@@ -274,4 +274,4 @@ Examples:
|
|
|
274
274
|
export {
|
|
275
275
|
zeroFeishuCommand
|
|
276
276
|
};
|
|
277
|
-
//# sourceMappingURL=feishu-
|
|
277
|
+
//# sourceMappingURL=feishu-VHY2XR6D.js.map
|
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
zeroFinanceQuoteRequestSchema,
|
|
15
15
|
zeroFinanceRangeSchema,
|
|
16
16
|
zeroFinanceSearchRequestSchema
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-KCVBW7AC.js";
|
|
18
|
+
import "./chunk-TCZ2FX3X.js";
|
|
19
19
|
import "./chunk-MA22KQYU.js";
|
|
20
20
|
import {
|
|
21
21
|
source_default,
|
|
22
22
|
withErrorHandler
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-2KEUNCZT.js";
|
|
24
24
|
import "./chunk-MD3YWUKO.js";
|
|
25
25
|
import {
|
|
26
26
|
Command,
|
|
@@ -125,4 +125,4 @@ Notes:
|
|
|
125
125
|
export {
|
|
126
126
|
zeroFinanceCommand
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=finance-
|
|
128
|
+
//# sourceMappingURL=finance-4ZD3LPNN.js.map
|
|
@@ -28,24 +28,24 @@ import {
|
|
|
28
28
|
getZeroBillingStatus,
|
|
29
29
|
listZeroConnectorCatalog,
|
|
30
30
|
listZeroConnectorCatalogStatus
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-KCVBW7AC.js";
|
|
32
32
|
import {
|
|
33
33
|
generateWebImage,
|
|
34
34
|
generateWebVideo,
|
|
35
35
|
generateWebVoice
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-TCZ2FX3X.js";
|
|
37
37
|
import {
|
|
38
38
|
planUpgradeUrl
|
|
39
39
|
} from "./chunk-2NW76WYJ.js";
|
|
40
40
|
import {
|
|
41
41
|
getPlatformOrigin
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-IYS3T6IA.js";
|
|
43
43
|
import "./chunk-MA22KQYU.js";
|
|
44
44
|
import {
|
|
45
45
|
ApiRequestError,
|
|
46
46
|
source_default,
|
|
47
47
|
withErrorHandler
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-2KEUNCZT.js";
|
|
49
49
|
import "./chunk-MD3YWUKO.js";
|
|
50
50
|
import {
|
|
51
51
|
Command,
|
|
@@ -245,7 +245,7 @@ async function resolveConnector(provider, generationType) {
|
|
|
245
245
|
return entry === connectorGenerationType;
|
|
246
246
|
});
|
|
247
247
|
return {
|
|
248
|
-
|
|
248
|
+
connectorSlug: connector.connectorRef,
|
|
249
249
|
label: connector.label,
|
|
250
250
|
supportsGenerationType: supports
|
|
251
251
|
};
|
|
@@ -262,7 +262,7 @@ async function printConnectorGuidance(generationType, provider) {
|
|
|
262
262
|
}
|
|
263
263
|
if (!guidance.supportsGenerationType) {
|
|
264
264
|
console.log(
|
|
265
|
-
`${guidance.label} (${guidance.
|
|
265
|
+
`${guidance.label} (${guidance.connectorSlug}) does not advertise ${generationType} generation.`
|
|
266
266
|
);
|
|
267
267
|
console.log("");
|
|
268
268
|
console.log(
|
|
@@ -271,17 +271,17 @@ async function printConnectorGuidance(generationType, provider) {
|
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
273
|
console.log(
|
|
274
|
-
`${guidance.label} (${guidance.
|
|
274
|
+
`${guidance.label} (${guidance.connectorSlug}) handles ${generationType} generation through its own connector skill, not through "zero generate".`
|
|
275
275
|
);
|
|
276
276
|
console.log("");
|
|
277
277
|
console.log(`Next steps:`);
|
|
278
|
-
console.log(` - Use the "${guidance.
|
|
278
|
+
console.log(` - Use the "${guidance.connectorSlug}" skill in this session.`);
|
|
279
279
|
console.log(
|
|
280
280
|
` - Or call the connector directly via its documented endpoints.`
|
|
281
281
|
);
|
|
282
282
|
console.log("");
|
|
283
283
|
console.log(
|
|
284
|
-
`Run "zero connector status ${guidance.
|
|
284
|
+
`Run "zero connector status ${guidance.connectorSlug}" to verify the connector is connected and authorized for the current agent.`
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
287
|
|
|
@@ -517,7 +517,7 @@ function formatAccount(connector) {
|
|
|
517
517
|
}
|
|
518
518
|
return void 0;
|
|
519
519
|
}
|
|
520
|
-
function getAction(status,
|
|
520
|
+
function getAction(status, connectorSlug, label, agentId, platformOrigin) {
|
|
521
521
|
if (status === "needs-reconnect") {
|
|
522
522
|
return {
|
|
523
523
|
actionLabel: `Reconnect ${label}`,
|
|
@@ -527,26 +527,26 @@ function getAction(status, type, label, agentId, platformOrigin) {
|
|
|
527
527
|
if (status === "not-authorized" && agentId) {
|
|
528
528
|
return {
|
|
529
529
|
actionLabel: `Authorize ${label}`,
|
|
530
|
-
actionUrl: `${platformOrigin}/connectors/${
|
|
530
|
+
actionUrl: `${platformOrigin}/connectors/${connectorSlug}/authorize?agentId=${agentId}`
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
533
|
if (status === "not-connected") {
|
|
534
534
|
if (agentId) {
|
|
535
535
|
return {
|
|
536
536
|
actionLabel: `Connect and authorize ${label}`,
|
|
537
|
-
actionUrl: `${platformOrigin}/connectors/${
|
|
537
|
+
actionUrl: `${platformOrigin}/connectors/${connectorSlug}/connect?agentId=${agentId}`
|
|
538
538
|
};
|
|
539
539
|
}
|
|
540
540
|
return {
|
|
541
541
|
actionLabel: `Connect ${label}`,
|
|
542
|
-
actionUrl: `${platformOrigin}/connectors/${
|
|
542
|
+
actionUrl: `${platformOrigin}/connectors/${connectorSlug}/connect`
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
545
|
return {};
|
|
546
546
|
}
|
|
547
547
|
function toCandidate(params) {
|
|
548
|
-
const { connector,
|
|
549
|
-
const
|
|
548
|
+
const { connector, authorizedConnectorSlugs, agentId, platformOrigin } = params;
|
|
549
|
+
const connectorSlug = connector.connectorRef;
|
|
550
550
|
let status;
|
|
551
551
|
let reason;
|
|
552
552
|
if (connector.connectionStatus === "reconnect-required") {
|
|
@@ -555,7 +555,7 @@ function toCandidate(params) {
|
|
|
555
555
|
} else if (!connector.connected) {
|
|
556
556
|
status = "not-connected";
|
|
557
557
|
reason = agentId ? "not connected or authorized for current agent" : "not connected";
|
|
558
|
-
} else if (
|
|
558
|
+
} else if (authorizedConnectorSlugs && !authorizedConnectorSlugs.has(connectorSlug)) {
|
|
559
559
|
status = "not-authorized";
|
|
560
560
|
reason = "connected, not authorized for current agent";
|
|
561
561
|
} else {
|
|
@@ -563,23 +563,29 @@ function toCandidate(params) {
|
|
|
563
563
|
reason = agentId ? "connected and authorized for current agent" : "connected; agent authorization was not checked";
|
|
564
564
|
}
|
|
565
565
|
return {
|
|
566
|
-
|
|
566
|
+
connectorSlug,
|
|
567
567
|
label: connector.label,
|
|
568
568
|
status,
|
|
569
569
|
reason,
|
|
570
570
|
account: connector.connected ? formatAccount(connector) : void 0,
|
|
571
571
|
authMethod: connector.connection?.authMethod,
|
|
572
|
-
...getAction(
|
|
572
|
+
...getAction(
|
|
573
|
+
status,
|
|
574
|
+
connectorSlug,
|
|
575
|
+
connector.label,
|
|
576
|
+
agentId,
|
|
577
|
+
platformOrigin
|
|
578
|
+
)
|
|
573
579
|
};
|
|
574
580
|
}
|
|
575
581
|
function pad(value, width) {
|
|
576
582
|
return value.padEnd(width);
|
|
577
583
|
}
|
|
578
584
|
function renderRows(candidates) {
|
|
579
|
-
const
|
|
585
|
+
const connectorSlugWidth = Math.max(
|
|
580
586
|
4,
|
|
581
587
|
...candidates.map((candidate) => {
|
|
582
|
-
return candidate.
|
|
588
|
+
return candidate.connectorSlug.length;
|
|
583
589
|
})
|
|
584
590
|
);
|
|
585
591
|
const labelWidth = Math.max(
|
|
@@ -591,7 +597,7 @@ function renderRows(candidates) {
|
|
|
591
597
|
for (const candidate of candidates) {
|
|
592
598
|
const suffix = candidate.status === "ready" ? candidate.account ?? candidate.authMethod ?? "" : candidate.reason;
|
|
593
599
|
console.log(
|
|
594
|
-
` ${pad(candidate.
|
|
600
|
+
` ${pad(candidate.connectorSlug, connectorSlugWidth)} ${pad(candidate.label, labelWidth)} ${suffix}`
|
|
595
601
|
);
|
|
596
602
|
}
|
|
597
603
|
}
|
|
@@ -707,18 +713,18 @@ function renderText(params) {
|
|
|
707
713
|
async function runLister(generationType, options = {}) {
|
|
708
714
|
const connectorGenerationType = getConnectorGenerationType(generationType);
|
|
709
715
|
const agentId = process.env.ZERO_AGENT_ID;
|
|
710
|
-
const [catalog,
|
|
716
|
+
const [catalog, enabledConnectorSlugs, platformOrigin, billing] = await Promise.all([
|
|
711
717
|
listZeroConnectorCatalogStatus(),
|
|
712
718
|
agentId ? getZeroAgentUserConnectors(agentId) : Promise.resolve(null),
|
|
713
719
|
getPlatformOrigin(),
|
|
714
720
|
generationType === "video" && currentTokenCanReadBilling() ? getZeroBillingStatus() : Promise.resolve(null)
|
|
715
721
|
]);
|
|
716
|
-
const
|
|
722
|
+
const authorizedConnectorSlugs = enabledConnectorSlugs ? new Set(enabledConnectorSlugs) : null;
|
|
717
723
|
const candidates = connectorGenerationType ? getGenerationConnectors(connectorGenerationType, catalog.connectors).map(
|
|
718
724
|
(connector) => {
|
|
719
725
|
return toCandidate({
|
|
720
726
|
connector,
|
|
721
|
-
|
|
727
|
+
authorizedConnectorSlugs,
|
|
722
728
|
agentId,
|
|
723
729
|
platformOrigin
|
|
724
730
|
});
|
|
@@ -2828,4 +2834,4 @@ var generateCommand = new Command().name("generate").description(
|
|
|
2828
2834
|
export {
|
|
2829
2835
|
generateCommand
|
|
2830
2836
|
};
|
|
2831
|
-
//# sourceMappingURL=generate-
|
|
2837
|
+
//# sourceMappingURL=generate-ULUL52MM.js.map
|