File size: 1,262 Bytes
e249c6d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /**
* Core-internal auth policy for bundled auth-owning CLI backends. Membership controls
* selected-profile resolution and raw credential forwarding during prepareExecution;
* third-party plugins cannot declare this trust decision through Plugin SDK metadata.
*/
export type BundledCliBackendAuthPolicy = {
/** Disable profile fallback and fail closed when the selected profile cannot materialize. */
strictSelectedProfile: boolean;
/** Owner responsible for refreshing selected OAuth credentials before execution. */
oauthRefreshOwner: "core" | "cli";
/** Retired OAuth profile identities that the native runtime owns instead. */
nativeAuthProfileIds?: readonly string[];
};
const BUNDLED_CLI_BACKEND_AUTH_POLICIES = {
"claude-cli": {
strictSelectedProfile: true,
oauthRefreshOwner: "core",
nativeAuthProfileIds: ["anthropic:claude-cli"],
},
"google-gemini-cli": {
strictSelectedProfile: false,
oauthRefreshOwner: "cli",
},
} satisfies Record<string, BundledCliBackendAuthPolicy>;
export function resolveBundledCliBackendAuthPolicy(
backendId: string,
): BundledCliBackendAuthPolicy | undefined {
return BUNDLED_CLI_BACKEND_AUTH_POLICIES[
backendId as keyof typeof BUNDLED_CLI_BACKEND_AUTH_POLICIES
];
}
|