diff --git a/src/main/connectors.ts b/src/main/connectors.ts index 2af23d73..a90ca9e9 100644 --- a/src/main/connectors.ts +++ b/src/main/connectors.ts @@ -1,5 +1,6 @@ -import type { ConnectorRecord } from "@shared/types"; -import { CONNECTORS } from "./connector-definitions"; +import type { CapabilityMatrix, ConnectorRecord } from "@shared/types"; +import { CONNECTORS, type ConnectorDefinition } from "./connector-definitions"; +import { buildApiKeyDoc, buildCloudDoc, buildOAuthDoc } from "./connector-definitions-docs"; export { CONNECTORS } from "./connector-definitions"; export type { ConnectorDefinition } from "./connector-definitions"; export { findConnectorDefinition, listFeaturedOnboardingConnectors } from "./connector-definitions-lookup"; @@ -16,6 +17,27 @@ const RESERVED_ENV_BINDING_KEYS = new Set([ "PWD", ]); +/** + * Pi-mono drives all provider dispatch through pi-ai, so the adapter-era + * capability matrix now collapses to a uniform baseline. These values are + * still written into the `connectors` table for legacy UI surfaces that read + * them, but the worker and resolver no longer branch on them. + */ +const PI_MONO_CAPABILITIES: CapabilityMatrix = { + sessionResume: true, + gracefulCancel: true, + modelDiscovery: true, + structuredTranscript: true, + costAttribution: true, +}; + +/** + * Legacy `ConnectorRecord.command` column. Pi-mono has no CLI command — the + * worker calls pi-ai directly — so this is an empty string that the UI + * treats as "managed by pi-mono". + */ +const PI_MONO_DEFAULT_COMMAND = ""; + export function getConnectorDefinition(id: string) { const definition = CONNECTORS.find((entry) => entry.id === id); if (!definition) { @@ -44,6 +66,30 @@ export function listInvalidEnvBindingKeys(text: string): string[] { }); } +function renderConfigurationDoc(definition: ConnectorDefinition): string { + switch (definition.auth.type) { + case "oauth": + return buildOAuthDoc(definition.label, definition.auth.oauthId); + case "api_key": + return buildApiKeyDoc(definition.label, definition.auth.envKey); + case "aws": + return buildCloudDoc( + definition.label, + "Credentials are discovered via the standard AWS chain (profile, IAM keys, Bedrock bearer token, ECS roles, or IRSA).", + ); + case "azure": + return buildCloudDoc( + definition.label, + "Provide AZURE_OPENAI_API_KEY plus AZURE_OPENAI_BASE_URL or AZURE_OPENAI_RESOURCE_NAME.", + ); + case "gcp_adc": + return buildCloudDoc( + definition.label, + "Uses Google Cloud Application Default Credentials. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS.", + ); + } +} + export function buildDefaultConnectorRows(existing: Array> = []): ConnectorRecord[] { const byId = new Map(existing.map((record) => [record.id, record])); return CONNECTORS.map((definition) => { @@ -53,16 +99,16 @@ export function buildDefaultConnectorRows(existing: Array