Strips adapter module, defaultCommand, listModels, configurationDoc, capabilityMatrix, and notes fields from the ConnectorDefinition type. What remains is the declarative pi-mono shape: id, provider, label, description, defaultModel, auth descriptor, onboardingFeatured, notes. The three data files are imported and spread into the CONNECTORS array. findConnectorDefinition + listFeaturedOnboardingConnectors stay in the lookup module unchanged. Docs builders still provide buildOAuthDoc / buildApiKeyDoc / buildCloudDoc for the Settings panel and are consumed by connectors.ts when synthesising per-row configuration docs. ConnectorAuth now uses `type` as the discriminator (legacy `kind` alias removed — credential-resolver and ipc-credentials-handlers already keyed off `type`).
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
/**
|
|
* Per-auth-kind configuration documentation builders for the Settings →
|
|
* Providers panel. Extracted from `connector-definitions.ts` to keep that
|
|
* file under the 400-line cap.
|
|
*/
|
|
|
|
import type { PiOAuthProviderId } from "./connector-definitions";
|
|
|
|
export function buildOAuthDoc(label: string, oauthId: PiOAuthProviderId): string {
|
|
return [
|
|
`# ${label}`,
|
|
"",
|
|
"Authenticate via OAuth in your system browser. AgentCompany opens",
|
|
"the provider's authorization page; the redirect handler runs locally on",
|
|
"`http://localhost:53692/callback`.",
|
|
"",
|
|
`OAuth provider id: \`${oauthId}\`.`,
|
|
"",
|
|
"Tokens are encrypted by the OS keychain (or per-profile vault) and",
|
|
"stored in the `credentials` table. Tokens are refreshed automatically",
|
|
"before each run (60 second window).",
|
|
].join("\n");
|
|
}
|
|
|
|
export function buildApiKeyDoc(label: string, envVar: string): string {
|
|
return [
|
|
`# ${label}`,
|
|
"",
|
|
`API key authentication. Either paste the literal key or use a system`,
|
|
`environment variable name (default: \`${envVar}\`).`,
|
|
"",
|
|
"Keys are encrypted at rest via OS keychain (or per-profile vault).",
|
|
].join("\n");
|
|
}
|
|
|
|
export function buildCloudDoc(label: string, body: string): string {
|
|
return [`# ${label}`, "", body].join("\n");
|
|
}
|