@vm0/cli 9.274.10 → 9.274.12

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.
Files changed (105) hide show
  1. package/{agent-FLAWLBHS.js → agent-SJPXFCY2.js} +7 -9
  2. package/{agent-FLAWLBHS.js.map → agent-SJPXFCY2.js.map} +1 -1
  3. package/{banking-YAVKAKZG.js → banking-JFQN7LVP.js} +4 -4
  4. package/{browser-TQCR4QO2.js → browser-Y45XHNLP.js} +4 -4
  5. package/{chat-FHJ2ISVP.js → chat-VGV4X4P6.js} +5 -5
  6. package/{chunk-55OOIO3Y.js → chunk-3C4OVVAG.js} +2 -2
  7. package/{chunk-SS35GZL5.js → chunk-FCA3SHQR.js} +15 -12
  8. package/chunk-FCA3SHQR.js.map +1 -0
  9. package/{chunk-2T64ACFV.js → chunk-GNT5CELD.js} +7 -21
  10. package/chunk-GNT5CELD.js.map +1 -0
  11. package/{chunk-T7KKAPXV.js → chunk-NU4QI6YS.js} +2 -2
  12. package/{chunk-U4SI4F5E.js → chunk-O4QQXFOU.js} +2 -2
  13. package/{chunk-WHGCJQBT.js → chunk-PTH6CS2U.js} +2 -2
  14. package/{chunk-EUZGV3TS.js → chunk-R6YSBKNW.js} +2 -2
  15. package/{chunk-TFNZKFHF.js → chunk-UMJS5E7A.js} +16 -4
  16. package/{chunk-TFNZKFHF.js.map → chunk-UMJS5E7A.js.map} +1 -1
  17. package/{chunk-Y7RLOQPB.js → chunk-UST46T62.js} +13 -5
  18. package/{chunk-Y7RLOQPB.js.map → chunk-UST46T62.js.map} +1 -1
  19. package/{computer-use-RQFEXMNN.js → computer-use-EX7NUHO6.js} +4 -4
  20. package/{connector-6X7OUT7E.js → connector-CJAQUQ2Y.js} +167 -46
  21. package/connector-CJAQUQ2Y.js.map +1 -0
  22. package/{credit-2EDFXE7L.js → credit-5E3T27Q5.js} +5 -5
  23. package/{developer-support-4VTZP26I.js → developer-support-A4QV7VNK.js} +4 -4
  24. package/{doctor-X6VYBUMF.js → doctor-QVV4Y2R7.js} +5 -5
  25. package/{feishu-ZAJ6DMM2.js → feishu-2JGDX7Y2.js} +4 -4
  26. package/{finance-CQCJPGEN.js → finance-H5IQQC6J.js} +4 -4
  27. package/{generate-IENVOMAL.js → generate-DV6USGFJ.js} +6 -6
  28. package/{github-PW7YAJWN.js → github-XLESF6RQ.js} +4 -4
  29. package/{goal-KRA6TDDS.js → goal-ZPC7PCZJ.js} +4 -4
  30. package/{host-LVFXSZXE.js → host-IFEXU6CT.js} +4 -4
  31. package/{logs-EVEAQBQS.js → logs-LWVYA5M5.js} +6 -6
  32. package/{mail-VIFM7OQC.js → mail-S4TY6S5F.js} +6 -6
  33. package/{maps-M3QEVTF7.js → maps-MF5TNF3I.js} +4 -4
  34. package/{model-JRYQATDZ.js → model-N7BJ6UJZ.js} +5 -5
  35. package/{model-provider-CECCURPK.js → model-provider-DOGJE3JW.js} +5 -5
  36. package/{org-HRQLRSLW.js → org-FY4AJSGQ.js} +4 -4
  37. package/package.json +1 -1
  38. package/{people-search-HCJ57TUJ.js → people-search-WOZJFEK5.js} +4 -4
  39. package/{phone-I34UAINK.js → phone-XHAJ2AES.js} +4 -4
  40. package/{preference-KUNORDNU.js → preference-R5UX5KBL.js} +4 -4
  41. package/{recognize-GP5GEFH2.js → recognize-BIGJNW5H.js} +4 -4
  42. package/{resource-PDE7V6KO.js → resource-O42P5MLK.js} +4 -4
  43. package/{scrape-GLPSOR2T.js → scrape-K4T4EMPC.js} +4 -4
  44. package/{search-OJFN36GD.js → search-YKKUZUGO.js} +6 -6
  45. package/{secret-JNBSMTLG.js → secret-CN4PPKFG.js} +4 -4
  46. package/{slack-EWNDIJ6E.js → slack-2C32JESK.js} +4 -4
  47. package/{teams-OEF65MIB.js → teams-QAFZ4V7H.js} +4 -4
  48. package/{telegram-6S3DYPVD.js → telegram-L73T7GI2.js} +4 -4
  49. package/{upgrade-JTWU4NHS.js → upgrade-CCRFWNS2.js} +3 -3
  50. package/{variable-NCKBKGFF.js → variable-UK6VNJOX.js} +4 -4
  51. package/{video-A5CSCJUP.js → video-PTYXK3VC.js} +3 -3
  52. package/{weather-SQVSJWS6.js → weather-TMQGK6VE.js} +4 -4
  53. package/{web-XRD3IC4O.js → web-IQN3B5EF.js} +4 -4
  54. package/{web-search-DZYEO7UD.js → web-search-CQOCUSUM.js} +4 -4
  55. package/{whoami-BP4VAGA7.js → whoami-ZITONHAH.js} +7 -9
  56. package/{whoami-BP4VAGA7.js.map → whoami-ZITONHAH.js.map} +1 -1
  57. package/{workflow-2ZO3HLD6.js → workflow-G474Q6PL.js} +5 -5
  58. package/zero.js +44 -44
  59. package/chunk-2T64ACFV.js.map +0 -1
  60. package/chunk-SS35GZL5.js.map +0 -1
  61. package/chunk-TAY6RIUI.js +0 -22
  62. package/chunk-TAY6RIUI.js.map +0 -1
  63. package/connector-6X7OUT7E.js.map +0 -1
  64. /package/{banking-YAVKAKZG.js.map → banking-JFQN7LVP.js.map} +0 -0
  65. /package/{browser-TQCR4QO2.js.map → browser-Y45XHNLP.js.map} +0 -0
  66. /package/{chat-FHJ2ISVP.js.map → chat-VGV4X4P6.js.map} +0 -0
  67. /package/{chunk-55OOIO3Y.js.map → chunk-3C4OVVAG.js.map} +0 -0
  68. /package/{chunk-T7KKAPXV.js.map → chunk-NU4QI6YS.js.map} +0 -0
  69. /package/{chunk-U4SI4F5E.js.map → chunk-O4QQXFOU.js.map} +0 -0
  70. /package/{chunk-WHGCJQBT.js.map → chunk-PTH6CS2U.js.map} +0 -0
  71. /package/{chunk-EUZGV3TS.js.map → chunk-R6YSBKNW.js.map} +0 -0
  72. /package/{computer-use-RQFEXMNN.js.map → computer-use-EX7NUHO6.js.map} +0 -0
  73. /package/{credit-2EDFXE7L.js.map → credit-5E3T27Q5.js.map} +0 -0
  74. /package/{developer-support-4VTZP26I.js.map → developer-support-A4QV7VNK.js.map} +0 -0
  75. /package/{doctor-X6VYBUMF.js.map → doctor-QVV4Y2R7.js.map} +0 -0
  76. /package/{feishu-ZAJ6DMM2.js.map → feishu-2JGDX7Y2.js.map} +0 -0
  77. /package/{finance-CQCJPGEN.js.map → finance-H5IQQC6J.js.map} +0 -0
  78. /package/{generate-IENVOMAL.js.map → generate-DV6USGFJ.js.map} +0 -0
  79. /package/{github-PW7YAJWN.js.map → github-XLESF6RQ.js.map} +0 -0
  80. /package/{goal-KRA6TDDS.js.map → goal-ZPC7PCZJ.js.map} +0 -0
  81. /package/{host-LVFXSZXE.js.map → host-IFEXU6CT.js.map} +0 -0
  82. /package/{logs-EVEAQBQS.js.map → logs-LWVYA5M5.js.map} +0 -0
  83. /package/{mail-VIFM7OQC.js.map → mail-S4TY6S5F.js.map} +0 -0
  84. /package/{maps-M3QEVTF7.js.map → maps-MF5TNF3I.js.map} +0 -0
  85. /package/{model-JRYQATDZ.js.map → model-N7BJ6UJZ.js.map} +0 -0
  86. /package/{model-provider-CECCURPK.js.map → model-provider-DOGJE3JW.js.map} +0 -0
  87. /package/{org-HRQLRSLW.js.map → org-FY4AJSGQ.js.map} +0 -0
  88. /package/{people-search-HCJ57TUJ.js.map → people-search-WOZJFEK5.js.map} +0 -0
  89. /package/{phone-I34UAINK.js.map → phone-XHAJ2AES.js.map} +0 -0
  90. /package/{preference-KUNORDNU.js.map → preference-R5UX5KBL.js.map} +0 -0
  91. /package/{recognize-GP5GEFH2.js.map → recognize-BIGJNW5H.js.map} +0 -0
  92. /package/{resource-PDE7V6KO.js.map → resource-O42P5MLK.js.map} +0 -0
  93. /package/{scrape-GLPSOR2T.js.map → scrape-K4T4EMPC.js.map} +0 -0
  94. /package/{search-OJFN36GD.js.map → search-YKKUZUGO.js.map} +0 -0
  95. /package/{secret-JNBSMTLG.js.map → secret-CN4PPKFG.js.map} +0 -0
  96. /package/{slack-EWNDIJ6E.js.map → slack-2C32JESK.js.map} +0 -0
  97. /package/{teams-OEF65MIB.js.map → teams-QAFZ4V7H.js.map} +0 -0
  98. /package/{telegram-6S3DYPVD.js.map → telegram-L73T7GI2.js.map} +0 -0
  99. /package/{upgrade-JTWU4NHS.js.map → upgrade-CCRFWNS2.js.map} +0 -0
  100. /package/{variable-NCKBKGFF.js.map → variable-UK6VNJOX.js.map} +0 -0
  101. /package/{video-A5CSCJUP.js.map → video-PTYXK3VC.js.map} +0 -0
  102. /package/{weather-SQVSJWS6.js.map → weather-TMQGK6VE.js.map} +0 -0
  103. /package/{web-XRD3IC4O.js.map → web-IQN3B5EF.js.map} +0 -0
  104. /package/{web-search-DZYEO7UD.js.map → web-search-CQOCUSUM.js.map} +0 -0
  105. /package/{workflow-2ZO3HLD6.js.map → workflow-G474Q6PL.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/discovery.ts","../src/commands/zero/connector/search.ts","../src/commands/zero/connector/status.ts","../src/commands/zero/connector/custom/index.ts","../src/commands/zero/connector/custom/create.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 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 type ZeroConnectorCheckDiagnosticResult,\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\nexport type ResolvedDiagnostic = Extract<\n ZeroConnectorCheckDiagnosticResult,\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\nexport function buildConnectorUrlDiagnosticRequest(args: {\n readonly url: string;\n readonly method: string;\n readonly connectorSlug?: string;\n readonly environmentName?: string;\n}): UrlDiagnosticRequest {\n if (rawUrlAuthorityHasUserinfo(args.url)) {\n throw unsafeInputError(\"invalid-url\");\n }\n return {\n mode: \"url\",\n method: args.method.toUpperCase(),\n url: stripUrlQueryAndFragment(args.url),\n ...(args.connectorSlug !== undefined\n ? { connectorSlug: args.connectorSlug }\n : {}),\n ...(args.environmentName !== undefined\n ? { environmentName: args.environmentName }\n : {}),\n };\n}\n\nfunction buildDiagnosticRequest(\n opts: ValidatedCheckConnectorOptions,\n method: string,\n): ConnectorCheckRequest {\n if (opts.url !== undefined) {\n return buildConnectorUrlDiagnosticRequest({\n method,\n url: opts.url,\n connectorSlug: opts.connector,\n 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 ZeroConnectorCheckDiagnosticResult,\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 ZeroConnectorCheckDiagnosticResult,\n { readonly outcome: \"ambiguous\" }\n >,\n): Error {\n const candidates = [...result.candidates].sort((left, right) => {\n return left.connectorSlug.localeCompare(right.connectorSlug);\n });\n const commands = candidates.map((candidate) => {\n return ` ${connectorSelectionCommand(request.url, request.method, candidate.connectorSlug)}`;\n });\n return new Error(\n `Multiple connectors match ${request.method} ${request.url}: ${candidates\n .map((candidate) => {\n return candidate.connectorSlug;\n })\n .join(\", \")}\\nSelect one explicitly:\\n${commands.join(\"\\n\")}`,\n );\n}\n\nfunction unknownConnectorError(request: ConnectorCheckRequest): Error {\n if (request.mode === \"url\" && request.connectorSlug !== undefined) {\n return new Error(\n `Unknown connector slug: ${request.connectorSlug}\\nRun: zero connector search ${shellQuoteArg(request.connectorSlug)}`,\n );\n }\n return new Error(\"The requested connector is unknown.\");\n}\n\nfunction noMatchError(\n result: Extract<\n ZeroConnectorCheckDiagnosticResult,\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 ZeroConnectorCheckDiagnosticResult,\n { readonly outcome: \"connector-mismatch\" }\n >,\n): Error {\n const requestedSlug = request.connectorSlug ?? \"the requested connector\";\n return new Error(\n `Connector ${requestedSlug} does not own ${request.method} ${request.url}; the matching connector is ${result.connector.connectorSlug}\\nRun: ${connectorSelectionCommand(request.url, request.method, result.connector.connectorSlug)}`,\n );\n}\n\nfunction environmentNotOwnedError(\n request: ConnectorCheckRequest,\n result: Extract<\n ZeroConnectorCheckDiagnosticResult,\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 ZeroConnectorCheckDiagnosticResult,\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\nexport function resolveConnectorCheckDiagnostic(\n request: ConnectorCheckRequest,\n result: ZeroConnectorCheckDiagnosticResult,\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.connectorSlug} 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 (slug: ${result.connector.connectorSlug}).`,\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 (slug: ${result.connector.connectorSlug}).`,\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 request: UrlDiagnosticRequest | 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 request,\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 request,\n );\n return;\n case \"unavailable\":\n printUnavailablePolicy(policy);\n return;\n }\n}\n\nfunction permissionRequestCommand(\n connectorSlug: string,\n permission: string,\n request: UrlDiagnosticRequest,\n): string {\n return `zero connector permission-request ${shellQuoteArg(connectorSlug)} --permission ${shellQuoteArg(permission)} --url ${shellQuoteArg(request.url)} --method ${shellQuoteArg(request.method)}`;\n}\n\nfunction printPermissionRequestCommands(\n connectorSlug: string,\n permission: string,\n agentId: string | undefined,\n introduction: string,\n request: UrlDiagnosticRequest | undefined,\n): void {\n if (request === undefined) {\n console.log(\n \"Diagnose the failed request with zero connector check --url <FAILED_URL> --method <METHOD> before requesting this permission.\",\n );\n return;\n }\n const command = permissionRequestCommand(connectorSlug, permission, request);\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 request: UrlDiagnosticRequest,\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 request,\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 request,\n );\n return;\n case \"unavailable\":\n printUnavailablePolicy(policy);\n return;\n }\n}\n\nfunction printUrlPermissionDiagnostic(\n request: UrlDiagnosticRequest,\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.connectorSlug,\n permission.name,\n permission.policy,\n agentId,\n request,\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.connectorSlug,\n result.permission.policy,\n agentId,\n request,\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.connectorSlug,\n permissionName,\n result.permission,\n agentId,\n undefined,\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 new Option(\n \"--connector <slug>\",\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 = resolveConnectorCheckDiagnostic(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.connectorSlug,\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(\n requireUrlRequest(request),\n result,\n ctx.agentId,\n );\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 .argument(\"<slug>\", \"Connector slug (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.slug,\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(` Slug: ${connector.slug}`));\n console.log(chalk.dim(` Auth Method: ${connector.authMethod}`));\n console.log(chalk.dim(` Run: zero connector status ${connector.slug}`));\n }),\n );\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n listZeroConnectorCatalogStatus,\n listZeroCustomConnectors,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveConnectorDiscoveryAgentContext } from \"./agent-context\";\nimport { padEndAnsi, stripAnsi } from \"./connected-as\";\nimport {\n connectorDiscoveryItems,\n isConnectorDiscoveryAuthorized,\n renderConnectorDiscoveryConnectedAsCell,\n} from \"./discovery\";\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 }, customConnectors, agentCtx] = await Promise.all([\n listZeroConnectorCatalogStatus(),\n listZeroCustomConnectors(),\n resolveConnectorDiscoveryAgentContext(options.agent),\n ]);\n const discoveredConnectors = connectorDiscoveryItems(\n connectors,\n customConnectors,\n );\n\n const connectorSlugs = discoveredConnectors.map((connector) => {\n return connector.slug;\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 = discoveredConnectors.map((connector) => {\n return renderConnectorDiscoveryConnectedAsCell(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 \"SLUG\".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 connector = discoveredConnectors[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 isConnectorDiscoveryAuthorized(connector, agentCtx)\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 chalk from \"chalk\";\nimport type { CustomConnectorResponse } from \"@vm0/api-contracts/contracts/zero-custom-connectors\";\nimport type { ZeroConnectorCatalogStatus } from \"../../../lib/api/domains/zero-connectors\";\nimport type { ConnectorDiscoveryAgentContext } from \"./agent-context\";\nimport { renderConnectedAsCell } from \"./connected-as\";\n\ninterface CatalogConnectorDiscoveryItem {\n readonly kind: \"catalog\";\n readonly slug: string;\n readonly label: string;\n readonly description: string;\n readonly category: string;\n readonly tags: readonly string[];\n readonly generation: readonly string[];\n readonly authMethods: ZeroConnectorCatalogStatus[\"authMethods\"];\n readonly catalogConnector: ZeroConnectorCatalogStatus;\n}\n\ninterface CustomConnectorDiscoveryItem {\n readonly kind: \"custom\";\n readonly slug: string;\n readonly label: string;\n readonly description: string;\n readonly category: string;\n readonly tags: readonly string[];\n readonly generation: readonly string[];\n readonly authMethods: readonly [];\n readonly customConnector: CustomConnectorResponse;\n}\n\ntype ConnectorDiscoveryItem =\n | CatalogConnectorDiscoveryItem\n | CustomConnectorDiscoveryItem;\n\nexport function connectorDiscoveryItems(\n catalogConnectors: readonly ZeroConnectorCatalogStatus[],\n customConnectors: readonly CustomConnectorResponse[],\n): readonly ConnectorDiscoveryItem[] {\n return [\n ...catalogConnectors.map((connector): CatalogConnectorDiscoveryItem => {\n return {\n kind: \"catalog\",\n slug: connector.slug,\n label: connector.label,\n description: connector.description,\n category: connector.category,\n tags: connector.tags,\n generation: connector.generation,\n authMethods: connector.authMethods,\n catalogConnector: connector,\n };\n }),\n ...customConnectors.map((connector): CustomConnectorDiscoveryItem => {\n return {\n kind: \"custom\",\n slug: connector.slug,\n label: connector.displayName,\n description: \"\",\n category: \"custom\",\n tags: [],\n generation: [],\n authMethods: [],\n customConnector: connector,\n };\n }),\n ];\n}\n\nexport function renderConnectorDiscoveryConnectedAsCell(\n connector: ConnectorDiscoveryItem,\n): string {\n if (connector.kind === \"catalog\") {\n return renderConnectedAsCell(connector.catalogConnector);\n }\n if (connector.customConnector.connected) {\n return chalk.green(\"connected\");\n }\n if (connector.customConnector.missingRequiredFields.length === 0) {\n return chalk.dim(\"(not connected)\");\n }\n return chalk.yellow(\n `missing ${connector.customConnector.missingRequiredFields.join(\", \")}`,\n );\n}\n\nexport function isConnectorDiscoveryAuthorized(\n connector: ConnectorDiscoveryItem,\n agentContext: ConnectorDiscoveryAgentContext,\n): boolean {\n if (connector.kind === \"catalog\") {\n return agentContext.authorizedConnectorSlugs.has(connector.slug);\n }\n return agentContext.authorizedCustomConnectorIds.has(\n connector.customConnector.id,\n );\n}\n","import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport {\n listZeroConnectorCatalogStatus,\n listZeroCustomConnectors,\n} from \"../../../lib/api\";\nimport { withErrorHandler } from \"../../../lib/command\";\nimport { resolveConnectorDiscoveryAgentContext } from \"./agent-context\";\nimport { padEndAnsi, stripAnsi } from \"./connected-as\";\nimport {\n connectorDiscoveryItems,\n isConnectorDiscoveryAuthorized,\n renderConnectorDiscoveryConnectedAsCell,\n} from \"./discovery\";\nimport { searchConnectorCatalog } 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 slug, 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 }, customConnectors, agentCtx] = await Promise.all([\n listZeroConnectorCatalogStatus(),\n listZeroCustomConnectors(),\n resolveConnectorDiscoveryAgentContext(options.agent),\n ]);\n const { results, total } = searchConnectorCatalog(\n connectorDiscoveryItems(connectors, customConnectors),\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 = \"SLUG\";\n const connectedAsHeader = \"CONNECTED AS\";\n\n const connectedCells = results.map((r) => {\n return renderConnectorDiscoveryConnectedAsCell(r.connector);\n });\n\n const connectorSlugWidth = Math.max(\n connectorSlugHeader.length,\n ...results.map((r) => {\n return r.connector.slug.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.slug.padEnd(connectorSlugWidth),\n padEndAnsi(connectedCells[i]!, connectedAsWidth),\n ];\n if (agentCtx) {\n parts.push(\n isConnectorDiscoveryAuthorized(result.connector, agentCtx)\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.slug;\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.slug;\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 .argument(\"<slug>\", \"Connector slug (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.slug)}`);\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 {\n getZeroAgent,\n getZeroAgentCustomConnectors,\n getZeroCustomConnector,\n listZeroCustomConnectors,\n} from \"../../../../lib/api\";\nimport { withErrorHandler } from \"../../../../lib/command\";\nimport { createCustomConnectorCommand } from \"./create\";\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\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\nexport const customConnectorCommand = new Command()\n .name(\"custom\")\n .description(\"Create and inspect org custom connectors\")\n .addCommand(createCustomConnectorCommand)\n .addCommand(listCommand)\n .addCommand(statusCommand);\n","import { readFile } from \"node:fs/promises\";\n\nimport {\n customConnectorAuthModeSchema,\n customConnectorOAuthConfigInputSchema,\n customConnectorValueInputSchema,\n updateCustomConnectorBodySchema,\n type CustomConnectorResponse,\n} from \"@vm0/api-contracts/contracts/zero-custom-connectors\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\n\nimport {\n addZeroAgentCustomConnector,\n createZeroCustomConnector,\n getZeroAgent,\n setZeroCustomConnectorValues,\n startZeroCustomConnectorOAuth2,\n} from \"../../../../lib/api\";\nimport { decodeZeroTokenPayload } from \"../../../../lib/api/zero-token\";\nimport { withErrorHandler } from \"../../../../lib/command\";\n\nconst customConnectorDefinitionSchema = updateCustomConnectorBodySchema.omit({\n authMode: true,\n oauthConfig: true,\n});\n\nconst manualCustomConnectorCreateSchema = customConnectorDefinitionSchema\n .extend({\n authMode: customConnectorAuthModeSchema.extract([\"manual\"]),\n values: customConnectorValueInputSchema.array(),\n })\n .strict();\n\nconst oauthCreateConfigSchema = customConnectorOAuthConfigInputSchema.required({\n clientSecret: true,\n});\n\nconst oauthCustomConnectorCreateSchema = customConnectorDefinitionSchema\n .extend({\n authMode: customConnectorAuthModeSchema.extract([\"oauth\"]),\n oauthConfig: oauthCreateConfigSchema,\n values: customConnectorValueInputSchema.array(),\n })\n .strict();\n\nconst customConnectorCreateSchema = manualCustomConnectorCreateSchema.or(\n oauthCustomConnectorCreateSchema,\n);\n\ntype CustomConnectorCreateInput = ReturnType<\n typeof customConnectorCreateSchema.parse\n>;\n\ninterface CreateOptions {\n readonly file: string;\n readonly agent?: string;\n readonly json?: boolean;\n}\n\ninterface CreateResult {\n readonly connector: CustomConnectorResponse;\n readonly agentId?: string;\n readonly authorizationUrl?: string;\n}\n\nfunction requireCustomConnectorWriteCapability(): void {\n const payload = decodeZeroTokenPayload();\n if (payload && !payload.capabilities.includes(\"connector:write\")) {\n throw new Error(\n \"Custom connector creation is not enabled for this agent run\",\n );\n }\n}\n\nfunction valueMarker(value: {\n readonly key: string;\n readonly kind: \"secret\" | \"variable\";\n}): string {\n return `${value.kind}:${value.key}`;\n}\n\nfunction validateValues(definition: CustomConnectorCreateInput): void {\n const fields = new Map(\n definition.fields.map((field) => {\n return [valueMarker(field), field] as const;\n }),\n );\n const provided = new Set<string>();\n for (const value of definition.values) {\n const marker = valueMarker(value);\n if (!fields.has(marker)) {\n throw new Error(`Unknown custom connector value: ${marker}`);\n }\n if (provided.has(marker)) {\n throw new Error(`Duplicate custom connector value: ${marker}`);\n }\n provided.add(marker);\n }\n const missing = definition.fields.flatMap((field) => {\n const marker = valueMarker(field);\n return field.required && !provided.has(marker) ? [marker] : [];\n });\n if (missing.length > 0) {\n throw new Error(\n `Missing required custom connector values: ${missing.join(\", \")}`,\n );\n }\n}\n\nfunction printCreateResult(result: CreateResult, json: boolean): void {\n if (json) {\n console.log(JSON.stringify(result, null, 2));\n return;\n }\n\n console.log(\n chalk.green(`✓ Custom connector \"${result.connector.displayName}\" created`),\n );\n console.log(chalk.dim(` ID: ${result.connector.id}`));\n console.log(chalk.dim(` Slug: ${result.connector.slug}`));\n console.log(\n chalk.dim(` Authentication: ${result.connector.authMode ?? \"manual\"}`),\n );\n console.log(\n chalk.dim(\n ` Status: ${\n result.connector.connected ? \"connected\" : \"awaiting authorization\"\n }`,\n ),\n );\n if (result.agentId && !result.authorizationUrl) {\n console.log(chalk.dim(` Agent: ${result.agentId} (authorized)`));\n }\n if (!result.authorizationUrl) {\n return;\n }\n\n console.log();\n console.log(\"Complete OAuth authorization:\");\n console.log(\n ` [Authorize ${result.connector.displayName}](${result.authorizationUrl})`,\n );\n if (result.agentId) {\n console.log(\n chalk.dim(\n ` Approval will also authorize this connector for agent ${result.agentId}.`,\n ),\n );\n }\n}\n\nasync function createManualCustomConnector(\n definition: Extract<CustomConnectorCreateInput, { authMode: \"manual\" }>,\n agentId: string | undefined,\n): Promise<CreateResult> {\n validateValues(definition);\n const { values, ...body } = definition;\n const created = await createZeroCustomConnector(body);\n const connector = await setZeroCustomConnectorValues(created.id, values);\n if (agentId) {\n await addZeroAgentCustomConnector(agentId, connector.id);\n }\n return {\n connector,\n ...(agentId ? { agentId } : {}),\n };\n}\n\nasync function createOAuthCustomConnector(\n definition: Extract<CustomConnectorCreateInput, { authMode: \"oauth\" }>,\n agentId: string | undefined,\n): Promise<CreateResult> {\n const { values, ...body } = definition;\n if (body.fields.length > 0 || values.length > 0) {\n throw new Error(\n \"OAuth custom connectors require empty fields and values arrays\",\n );\n }\n const created = await createZeroCustomConnector(body);\n const authorizationUrl = await startZeroCustomConnectorOAuth2(\n created.id,\n agentId,\n );\n return {\n connector: created,\n authorizationUrl,\n ...(agentId ? { agentId } : {}),\n };\n}\n\nexport const createCustomConnectorCommand = new Command()\n .name(\"create\")\n .description(\n \"Create and configure a manual or OAuth custom connector from JSON\",\n )\n .requiredOption(\n \"-f, --file <path>\",\n \"JSON file containing the connector definition and credentials\",\n )\n .option(\n \"--agent <id>\",\n \"Authorize this agent (defaults to ZERO_AGENT_ID when available)\",\n )\n .option(\"--json\", \"Print the connector and authorization result as JSON\")\n .addHelpText(\n \"after\",\n `\nFile format:\n The file must contain one complete connector definition. The agent should\n generate this file from the user's requirements and credentials.\n\nAgent workflow:\n 1. Ask the user in chat only for missing API details and credentials.\n 2. Derive the prefixes, fields, injections, and OAuth settings.\n 3. Write a temporary JSON file, run this command, then remove the file.\n The user should not need to write JSON or run this command.\n\n Common fields:\n displayName Human-readable connector name\n prefixTemplates Allowed HTTPS API URL prefixes\n fields Inputs referenced by manual templates\n headerInjections Headers added to matching requests\n queryInjections Query parameters added to matching requests\n authMode \"manual\" or \"oauth\"\n\nManual mode:\n Add a values array with one entry for every required field. References use\n {{secrets.KEY}} or {{variables.KEY}}. The command creates the connector,\n stores the values, and authorizes --agent in one flow.\n\n {\n \"displayName\": \"Acme API\",\n \"prefixTemplates\": [\"https://api.acme.example/v1/\"],\n \"fields\": [\n {\n \"key\": \"api_key\",\n \"label\": \"API key\",\n \"kind\": \"secret\",\n \"required\": true\n }\n ],\n \"headerInjections\": [\n {\n \"name\": \"Authorization\",\n \"valueTemplate\": \"Bearer {{secrets.api_key}}\"\n }\n ],\n \"queryInjections\": [],\n \"authMode\": \"manual\",\n \"values\": [\n { \"key\": \"api_key\", \"kind\": \"secret\", \"value\": \"<user-api-key>\" }\n ]\n }\n\nOAuth mode:\n Use {{oauth.access_token}} in an injection and provide the complete OAuth\n client configuration. OAuth mode requires empty fields and values arrays.\n The command prints an authorization link. If --agent is set, completing\n OAuth also authorizes that agent.\n\n {\n \"displayName\": \"Acme OAuth API\",\n \"prefixTemplates\": [\"https://api.acme.example/v1/\"],\n \"fields\": [],\n \"headerInjections\": [\n {\n \"name\": \"Authorization\",\n \"valueTemplate\": \"Bearer {{oauth.access_token}}\"\n }\n ],\n \"queryInjections\": [],\n \"authMode\": \"oauth\",\n \"values\": [],\n \"oauthConfig\": {\n \"providerAdapter\": \"standard\",\n \"clientId\": \"<oauth-client-id>\",\n \"clientSecret\": \"<oauth-client-secret>\",\n \"authorizationUrl\": \"https://acme.example/oauth/authorize\",\n \"tokenUrl\": \"https://acme.example/oauth/token\",\n \"tokenEndpointAuthMethod\": \"client_secret_post\",\n \"pkceMethod\": \"S256\",\n \"scopes\": [\"read\", \"write\"],\n \"authorizationParams\": {}\n }\n }\n\nExamples:\n zero connector custom create --file ./connector.json\n zero connector custom create --file ./connector.json --agent <agent-id>\n zero connector custom create --file ./connector.json --json\n\nNotes:\n - Requires an organization admin\n - Requires the customConnectorCliCreate feature\n - OAuth custom connectors also require the customConnectorOAuth2 feature\n - --agent defaults to ZERO_AGENT_ID inside an agent run\n - OAuth always requires the user to approve the generated authorization link\n - The file contains plaintext credentials; keep it temporary and never commit it`,\n )\n .action(\n withErrorHandler(async (options: CreateOptions) => {\n requireCustomConnectorWriteCapability();\n const raw = await readFile(options.file, \"utf8\");\n const input: unknown = JSON.parse(raw);\n const definition = customConnectorCreateSchema.parse(input);\n const agentId = options.agent ?? process.env.ZERO_AGENT_ID;\n if (agentId) {\n await getZeroAgent(agentId);\n }\n const result =\n definition.authMode === \"manual\"\n ? await createManualCustomConnector(definition, agentId)\n : await createOAuthCustomConnector(definition, agentId);\n printCreateResult(result, options.json ?? false);\n }),\n );\n","import { Command, Option } from \"commander\";\nimport { UNKNOWN_PERMISSION_GRANT } from \"@vm0/connectors/firewall-types\";\nimport type { ConnectorCheckPolicy } from \"@vm0/api-contracts/contracts/zero-connector-check\";\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} from \"../../../lib/api\";\nimport { diagnoseZeroConnectorCheck } from \"../../../lib/api/domains/zero-connectors\";\nimport {\n addRequestedCallbackSearchParams,\n connectorActionCallbackAvailable,\n printCallbackTurnInstruction,\n} from \"./action-url\";\nimport {\n buildConnectorUrlDiagnosticRequest,\n resolveConnectorCheckDiagnostic,\n type ResolvedDiagnostic,\n} from \"./check\";\n\nfunction permissionDescription(permission: string): string {\n return permission === UNKNOWN_PERMISSION_GRANT\n ? \"unknown endpoints\"\n : `the \"${permission}\" permission`;\n}\n\nfunction permissionPolicyForDiagnostic(args: {\n readonly result: ResolvedDiagnostic;\n readonly permission: string;\n readonly method: string;\n readonly url: string;\n}): ConnectorCheckPolicy {\n if (args.result.mode !== \"url\") {\n throw new Error(\n \"Connector diagnostic returned an environment result for a URL request.\",\n );\n }\n\n if (args.permission === UNKNOWN_PERMISSION_GRANT) {\n if (args.result.permission.kind === \"unknown-endpoint\") {\n return args.result.permission.policy;\n }\n throw permissionMismatchError({\n permission: args.permission,\n method: args.method,\n url: args.url,\n matchedPermissions: args.result.permission.permissions.map(\n (permission) => {\n return permission.name;\n },\n ),\n });\n }\n\n if (args.result.permission.kind === \"unknown-endpoint\") {\n throw permissionMismatchError({\n permission: args.permission,\n method: args.method,\n url: args.url,\n matchedPermissions: [UNKNOWN_PERMISSION_GRANT],\n });\n }\n\n const matchedPermission = args.result.permission.permissions.find(\n (permission) => {\n return permission.name === args.permission;\n },\n );\n if (matchedPermission === undefined) {\n throw permissionMismatchError({\n permission: args.permission,\n method: args.method,\n url: args.url,\n matchedPermissions: args.result.permission.permissions.map(\n (permission) => {\n return permission.name;\n },\n ),\n });\n }\n return matchedPermission.policy;\n}\n\nfunction permissionMismatchError(args: {\n readonly permission: string;\n readonly method: string;\n readonly url: string;\n readonly matchedPermissions: readonly string[];\n}): Error {\n return new Error(\n `Permission \"${args.permission}\" does not match ${args.method} ${args.url}. The request maps to: ${args.matchedPermissions.join(\", \")}. Use the exact permission-request command printed by zero connector check; provider OAuth scopes and missing_scope/needed values cannot be granted here.`,\n );\n}\n\nfunction assertRequestablePolicy(args: {\n readonly policy: ConnectorCheckPolicy;\n readonly permission: string;\n readonly method: string;\n readonly url: string;\n}): void {\n switch (args.policy.outcome) {\n case \"deny\":\n case \"ask\":\n return;\n case \"allow\":\n throw new Error(\n `${permissionDescription(args.permission)} is already allowed by Zero for ${args.method} ${args.url}. Provider authorization failures cannot be fixed with a Zero permission request.`,\n );\n case \"unavailable\":\n throw new Error(\n `Zero permission policy is unavailable for ${args.method} ${args.url}. Retry zero connector check from an active run before requesting access.`,\n );\n }\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 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 --url https://api.github.com/repos/vm0-ai/vm0 --method POST --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 .argument(\"<slug>\", \"The connector slug (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(\n new Option(\n \"--url <URL>\",\n \"The failed request URL reported to zero connector check\",\n ),\n )\n .addOption(\n new Option(\"--method <METHOD>\", \"The failed request HTTP method\").default(\n \"GET\",\n ),\n )\n .addOption(callbackPromptOption)\n .addHelpText(\n \"after\",\n `\nExamples:\n zero connector permission-request github --permission contents:read --url https://api.github.com/repos/vm0-ai/vm0 --method GET\n${callbackPromptExample} zero connector permission-request gmail --permission messages.write --url https://gmail.googleapis.com/gmail/v1/users/me/messages --method POST --agent <agent-id>\n zero connector permission-request cloudflare --permission __unknown__ --url https://api.cloudflare.com/client/v4/example --method POST\n zero connector permission-request computer-use --permission computer-use:write\n zero connector permission-request browser --permission browser:write\n\nNotes:\n - First run zero connector check --url <FAILED_URL> --method <METHOD>\n - Use the exact permission-request command printed by connector check\n - A platform URL is output only when that request maps to a denied or approval-required 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 url?: string;\n method: 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 if (opts.url === undefined) {\n throw new Error(\n \"--url is required for connector permission requests. Run zero connector check --url <FAILED_URL> --method <METHOD> and use the permission-request command it prints.\",\n );\n }\n\n const diagnosticRequest = buildConnectorUrlDiagnosticRequest({\n url: opts.url,\n method: opts.method,\n connectorSlug,\n });\n const diagnostic = await diagnoseZeroConnectorCheck(diagnosticRequest);\n const result = resolveConnectorCheckDiagnostic(\n diagnosticRequest,\n diagnostic,\n );\n const policy = permissionPolicyForDiagnostic({\n result,\n permission: opts.permission,\n method: diagnosticRequest.method,\n url: diagnosticRequest.url,\n });\n assertRequestablePolicy({\n policy,\n permission: opts.permission,\n method: diagnosticRequest.method,\n url: diagnosticRequest.url,\n });\n\n await outputPermissionRequestMessage(\n result.connector.connectorSlug,\n result.connector.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,Y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,QAC3D,KAAK,KAAK;AAAA,QACV,QAAQ,KAAK;AAAA,QACb;AAAA,MACF,CAAC;AACD,YAAM,aAAa,MAAM,2BAA2B,iBAAiB;AACrE,YAAM,SAAS;AAAA,QACb;AAAA,QACA;AAAA,MACF;AACA,YAAM,SAAS,8BAA8B;AAAA,QAC3C;AAAA,QACA,YAAY,KAAK;AAAA,QACjB,QAAQ,kBAAkB;AAAA,QAC1B,KAAK,kBAAkB;AAAA,MACzB,CAAC;AACD,8BAAwB;AAAA,QACtB;AAAA,QACA,YAAY,KAAK;AAAA,QACjB,QAAQ,kBAAkB;AAAA,QAC1B,KAAK,kBAAkB;AAAA,MACzB,CAAC;AAED,YAAM;AAAA,QACJ,OAAO,UAAU;AAAA,QACjB,OAAO,UAAU;AAAA,QACjB,KAAK;AAAA,QACL;AAAA,QACA,KAAK;AAAA,MACP;AAAA,IACF;AAAA,EACF;AACF;;;AXhaK,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-Y7RLOQPB.js";
14
- import "./chunk-T7KKAPXV.js";
13
+ } from "./chunk-UST46T62.js";
14
+ import "./chunk-NU4QI6YS.js";
15
15
  import {
16
16
  planUpgradeUrl
17
17
  } from "./chunk-RIJV7M6E.js";
18
18
  import {
19
19
  getPlatformOrigin
20
- } from "./chunk-55OOIO3Y.js";
20
+ } from "./chunk-3C4OVVAG.js";
21
21
  import "./chunk-IPJJ6SPP.js";
22
22
  import {
23
23
  source_default,
24
24
  withErrorHandler
25
- } from "./chunk-EUZGV3TS.js";
25
+ } from "./chunk-R6YSBKNW.js";
26
26
  import {
27
27
  decodeZeroTokenPayload
28
28
  } from "./chunk-KLI6K4VO.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-2EDFXE7L.js.map
166
+ //# sourceMappingURL=credit-5E3T27Q5.js.map
@@ -4,12 +4,12 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  requestDeveloperSupportConsent,
6
6
  submitDeveloperSupport
7
- } from "./chunk-Y7RLOQPB.js";
8
- import "./chunk-T7KKAPXV.js";
7
+ } from "./chunk-UST46T62.js";
8
+ import "./chunk-NU4QI6YS.js";
9
9
  import "./chunk-IPJJ6SPP.js";
10
10
  import {
11
11
  withErrorHandler
12
- } from "./chunk-EUZGV3TS.js";
12
+ } from "./chunk-R6YSBKNW.js";
13
13
  import "./chunk-KLI6K4VO.js";
14
14
  import {
15
15
  Command
@@ -61,4 +61,4 @@ Notes:
61
61
  export {
62
62
  zeroDeveloperSupportCommand
63
63
  };
64
- //# sourceMappingURL=developer-support-4VTZP26I.js.map
64
+ //# sourceMappingURL=developer-support-A4QV7VNK.js.map
@@ -9,19 +9,19 @@ import {
9
9
  getZeroBillingStatus,
10
10
  getZeroOrg,
11
11
  getZeroOrgMembers
12
- } from "./chunk-Y7RLOQPB.js";
13
- import "./chunk-T7KKAPXV.js";
12
+ } from "./chunk-UST46T62.js";
13
+ import "./chunk-NU4QI6YS.js";
14
14
  import {
15
15
  planUpgradeUrl
16
16
  } from "./chunk-RIJV7M6E.js";
17
17
  import {
18
18
  getPlatformOrigin
19
- } from "./chunk-55OOIO3Y.js";
19
+ } from "./chunk-3C4OVVAG.js";
20
20
  import "./chunk-IPJJ6SPP.js";
21
21
  import {
22
22
  source_default,
23
23
  withErrorHandler
24
- } from "./chunk-EUZGV3TS.js";
24
+ } from "./chunk-R6YSBKNW.js";
25
25
  import "./chunk-KLI6K4VO.js";
26
26
  import {
27
27
  Command
@@ -122,4 +122,4 @@ Notes:
122
122
  export {
123
123
  zeroDoctorCommand
124
124
  };
125
- //# sourceMappingURL=doctor-X6VYBUMF.js.map
125
+ //# sourceMappingURL=doctor-QVV4Y2R7.js.map
@@ -7,13 +7,13 @@ import {
7
7
  downloadFeishuFile,
8
8
  initFeishuFileUpload,
9
9
  sendFeishuMessage
10
- } from "./chunk-Y7RLOQPB.js";
11
- import "./chunk-T7KKAPXV.js";
10
+ } from "./chunk-UST46T62.js";
11
+ import "./chunk-NU4QI6YS.js";
12
12
  import "./chunk-IPJJ6SPP.js";
13
13
  import {
14
14
  source_default,
15
15
  withErrorHandler
16
- } from "./chunk-EUZGV3TS.js";
16
+ } from "./chunk-R6YSBKNW.js";
17
17
  import "./chunk-KLI6K4VO.js";
18
18
  import {
19
19
  Command
@@ -278,4 +278,4 @@ Examples:
278
278
  export {
279
279
  zeroFeishuCommand
280
280
  };
281
- //# sourceMappingURL=feishu-ZAJ6DMM2.js.map
281
+ //# sourceMappingURL=feishu-2JGDX7Y2.js.map
@@ -14,13 +14,13 @@ import {
14
14
  zeroFinanceQuoteRequestSchema,
15
15
  zeroFinanceRangeSchema,
16
16
  zeroFinanceSearchRequestSchema
17
- } from "./chunk-Y7RLOQPB.js";
18
- import "./chunk-T7KKAPXV.js";
17
+ } from "./chunk-UST46T62.js";
18
+ import "./chunk-NU4QI6YS.js";
19
19
  import "./chunk-IPJJ6SPP.js";
20
20
  import {
21
21
  source_default,
22
22
  withErrorHandler
23
- } from "./chunk-EUZGV3TS.js";
23
+ } from "./chunk-R6YSBKNW.js";
24
24
  import "./chunk-KLI6K4VO.js";
25
25
  import {
26
26
  Command,
@@ -125,4 +125,4 @@ Notes:
125
125
  export {
126
126
  zeroFinanceCommand
127
127
  };
128
- //# sourceMappingURL=finance-CQCJPGEN.js.map
128
+ //# sourceMappingURL=finance-H5IQQC6J.js.map
@@ -28,27 +28,27 @@ import {
28
28
  getZeroBillingStatus,
29
29
  listZeroConnectorCatalog,
30
30
  listZeroConnectorCatalogStatus
31
- } from "./chunk-Y7RLOQPB.js";
31
+ } from "./chunk-UST46T62.js";
32
32
  import {
33
33
  generateWebImage,
34
34
  generateWebVideo,
35
35
  generateWebVoice
36
- } from "./chunk-T7KKAPXV.js";
36
+ } from "./chunk-NU4QI6YS.js";
37
37
  import {
38
38
  planUpgradeUrl
39
39
  } from "./chunk-RIJV7M6E.js";
40
40
  import {
41
41
  getPlatformOrigin
42
- } from "./chunk-55OOIO3Y.js";
42
+ } from "./chunk-3C4OVVAG.js";
43
43
  import "./chunk-IPJJ6SPP.js";
44
44
  import {
45
45
  ApiRequestError,
46
46
  source_default,
47
47
  withErrorHandler
48
- } from "./chunk-EUZGV3TS.js";
48
+ } from "./chunk-R6YSBKNW.js";
49
49
  import {
50
50
  isFeatureEnabled
51
- } from "./chunk-2T64ACFV.js";
51
+ } from "./chunk-GNT5CELD.js";
52
52
  import {
53
53
  decodeZeroTokenPayload
54
54
  } from "./chunk-KLI6K4VO.js";
@@ -2854,4 +2854,4 @@ var generateCommand = new Command().name("generate").description(
2854
2854
  export {
2855
2855
  generateCommand
2856
2856
  };
2857
- //# sourceMappingURL=generate-IENVOMAL.js.map
2857
+ //# sourceMappingURL=generate-DV6USGFJ.js.map
@@ -5,12 +5,12 @@ import {
5
5
  completeGithubFileUpload,
6
6
  downloadGithubFile,
7
7
  initGithubFileUpload
8
- } from "./chunk-Y7RLOQPB.js";
9
- import "./chunk-T7KKAPXV.js";
8
+ } from "./chunk-UST46T62.js";
9
+ import "./chunk-NU4QI6YS.js";
10
10
  import "./chunk-IPJJ6SPP.js";
11
11
  import {
12
12
  withErrorHandler
13
- } from "./chunk-EUZGV3TS.js";
13
+ } from "./chunk-R6YSBKNW.js";
14
14
  import "./chunk-KLI6K4VO.js";
15
15
  import {
16
16
  Command
@@ -205,4 +205,4 @@ Examples:
205
205
  export {
206
206
  zeroGithubCommand
207
207
  };
208
- //# sourceMappingURL=github-PW7YAJWN.js.map
208
+ //# sourceMappingURL=github-XLESF6RQ.js.map
@@ -10,12 +10,12 @@ import {
10
10
  getGoal,
11
11
  pauseGoal,
12
12
  resumeGoal
13
- } from "./chunk-Y7RLOQPB.js";
14
- import "./chunk-T7KKAPXV.js";
13
+ } from "./chunk-UST46T62.js";
14
+ import "./chunk-NU4QI6YS.js";
15
15
  import "./chunk-IPJJ6SPP.js";
16
16
  import {
17
17
  withErrorHandler
18
- } from "./chunk-EUZGV3TS.js";
18
+ } from "./chunk-R6YSBKNW.js";
19
19
  import "./chunk-KLI6K4VO.js";
20
20
  import {
21
21
  Command
@@ -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-KRA6TDDS.js.map
81
+ //# sourceMappingURL=goal-ZPC7PCZJ.js.map
@@ -7,13 +7,13 @@ import {
7
7
  getHostedSiteFiles,
8
8
  hostedArtifactKindSchema,
9
9
  prepareHostedSite
10
- } from "./chunk-Y7RLOQPB.js";
11
- import "./chunk-T7KKAPXV.js";
10
+ } from "./chunk-UST46T62.js";
11
+ import "./chunk-NU4QI6YS.js";
12
12
  import "./chunk-IPJJ6SPP.js";
13
13
  import {
14
14
  source_default,
15
15
  withErrorHandler
16
- } from "./chunk-EUZGV3TS.js";
16
+ } from "./chunk-R6YSBKNW.js";
17
17
  import "./chunk-KLI6K4VO.js";
18
18
  import {
19
19
  Command,
@@ -657,4 +657,4 @@ Notes:
657
657
  export {
658
658
  zeroHostCommand
659
659
  };
660
- //# sourceMappingURL=host-LVFXSZXE.js.map
660
+ //# sourceMappingURL=host-IFEXU6CT.js.map
@@ -7,7 +7,7 @@ import {
7
7
  isSupportedFramework,
8
8
  parseTime,
9
9
  searchCommand
10
- } from "./chunk-TFNZKFHF.js";
10
+ } from "./chunk-UMJS5E7A.js";
11
11
  import {
12
12
  collectLogItems,
13
13
  formatIsoTimestamp,
@@ -20,14 +20,14 @@ import "./chunk-GHTEDTGL.js";
20
20
  import {
21
21
  getZeroRunAgentEvents,
22
22
  listZeroLogs
23
- } from "./chunk-Y7RLOQPB.js";
24
- import "./chunk-T7KKAPXV.js";
23
+ } from "./chunk-UST46T62.js";
24
+ import "./chunk-NU4QI6YS.js";
25
25
  import "./chunk-IPJJ6SPP.js";
26
26
  import {
27
27
  source_default,
28
28
  withErrorHandler
29
- } from "./chunk-EUZGV3TS.js";
30
- import "./chunk-2T64ACFV.js";
29
+ } from "./chunk-R6YSBKNW.js";
30
+ import "./chunk-GNT5CELD.js";
31
31
  import "./chunk-KLI6K4VO.js";
32
32
  import {
33
33
  Command
@@ -273,4 +273,4 @@ Examples:
273
273
  export {
274
274
  zeroLogsCommand
275
275
  };
276
- //# sourceMappingURL=logs-EVEAQBQS.js.map
276
+ //# sourceMappingURL=logs-LWVYA5M5.js.map
@@ -7,20 +7,20 @@ import {
7
7
  findConnectorStatusItem,
8
8
  printCallbackTurnInstruction,
9
9
  resolveAgentContext
10
- } from "./chunk-WHGCJQBT.js";
10
+ } from "./chunk-PTH6CS2U.js";
11
11
  import {
12
12
  linkZeroMailDraft,
13
13
  listZeroConnectorCatalogStatus
14
- } from "./chunk-Y7RLOQPB.js";
15
- import "./chunk-T7KKAPXV.js";
14
+ } from "./chunk-UST46T62.js";
15
+ import "./chunk-NU4QI6YS.js";
16
16
  import {
17
17
  getPlatformOrigin
18
- } from "./chunk-55OOIO3Y.js";
18
+ } from "./chunk-3C4OVVAG.js";
19
19
  import "./chunk-IPJJ6SPP.js";
20
20
  import {
21
21
  source_default,
22
22
  withErrorHandler
23
- } from "./chunk-EUZGV3TS.js";
23
+ } from "./chunk-R6YSBKNW.js";
24
24
  import "./chunk-KLI6K4VO.js";
25
25
  import {
26
26
  Command,
@@ -234,4 +234,4 @@ var zeroMailCommand = new Command().name("mail").description("Review linked Gmai
234
234
  export {
235
235
  zeroMailCommand
236
236
  };
237
- //# sourceMappingURL=mail-VIFM7OQC.js.map
237
+ //# sourceMappingURL=mail-S4TY6S5F.js.map