From bad37249f5ec9cbde20a228ebfc7100dfcba69f1 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 13 Jul 2026 12:31:28 -0700 Subject: [PATCH] refactor(agents): privatize auth planning types (#106756) * refactor(agents): privatize auth planning types * chore(deadcode): refresh export baseline --- scripts/deadcode-exports.baseline.mjs | 9 --------- src/agents/auth-profiles/store.ts | 4 ++-- src/agents/model-auth-env.ts | 4 ++-- src/agents/provider-model-auth-source-plan.ts | 6 +++--- src/agents/provider-model-route-auth.ts | 4 ++-- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/scripts/deadcode-exports.baseline.mjs b/scripts/deadcode-exports.baseline.mjs index 3f54fc63bdd1..f103bd3b1cc5 100644 --- a/scripts/deadcode-exports.baseline.mjs +++ b/scripts/deadcode-exports.baseline.mjs @@ -826,8 +826,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [ "src/agents/auth-profiles/runtime-snapshots.ts: getRuntimeAuthProfileStoreCredentialMutationRevision", "src/agents/auth-profiles/runtime-snapshots.ts: getRuntimeAuthProfileStoreStateMutationRevision", "src/agents/auth-profiles/runtime-snapshots.ts: testing", - "src/agents/auth-profiles/store.ts: AuthProfileStorePersistenceSnapshot", - "src/agents/auth-profiles/store.ts: CommittedAuthProfileStoreSave", "src/agents/auth-profiles/store.ts: testing", "src/agents/auth-profiles/usage.ts: testing", "src/agents/bash-process-registry.ts: resetProcessRegistryForTests", @@ -979,8 +977,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [ "src/agents/mcp-ui-resource.ts: testing", "src/agents/media-generation-task-status-shared.ts: findRecentStartedMediaGenerationTaskForSession", "src/agents/media-generation-task-status-shared.ts: resetRecentMediaGenerationDuplicateGuardsForTests", - "src/agents/model-auth-env.ts: ProviderDirectAuthPlanningEvidence", - "src/agents/model-auth-env.ts: ProviderEnvAuthEvidence", "src/agents/model-catalog-route.ts: ModelCatalogLogicalIdentity", "src/agents/model-catalog-route.ts: ModelCatalogLogicalOverrides", "src/agents/model-catalog-route.ts: ModelCatalogRouteMatcher", @@ -1013,11 +1009,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [ "src/agents/provider-attribution.ts: listProviderAttributionPolicies", "src/agents/provider-attribution.ts: resolveProviderAttributionIdentity", "src/agents/provider-attribution.ts: resolveProviderAttributionPolicy", - "src/agents/provider-model-auth-source-plan.ts: ProviderModelAuthAutomaticProfiles", - "src/agents/provider-model-auth-source-plan.ts: ProviderModelAuthReadiness", - "src/agents/provider-model-auth-source-plan.ts: ProviderModelAuthRequiredReason", - "src/agents/provider-model-route-auth.ts: ProviderModelAuthLogicalAttempt", - "src/agents/provider-model-route-auth.ts: ProviderModelRouteAuthAttempt", "src/agents/provider-request-config.ts: mergeProviderRequestOverrides", "src/agents/provider-request-config.ts: sanitizeRuntimeProviderRequestOverrides", "src/agents/provider-transport-stream.ts: isTransportAwareApiSupported", diff --git a/src/agents/auth-profiles/store.ts b/src/agents/auth-profiles/store.ts index 0b5a395c94a0..a8b955647508 100644 --- a/src/agents/auth-profiles/store.ts +++ b/src/agents/auth-profiles/store.ts @@ -1320,7 +1320,7 @@ export function saveAuthProfileStore( publishRuntimeSnapshotsAfterCommit(publishRuntimeSnapshots); } -export type AuthProfileStorePersistenceSnapshot = { +type AuthProfileStorePersistenceSnapshot = { credentialsRaw: unknown; stateRaw: unknown; runtimeCaptured: boolean; @@ -1340,7 +1340,7 @@ export type AuthProfileStorePersistenceSnapshot = { }>; }; -export type CommittedAuthProfileStoreSave = { +type CommittedAuthProfileStoreSave = { owned: AuthProfileStorePersistenceSnapshot; publishRuntimeSnapshots: () => boolean; }; diff --git a/src/agents/model-auth-env.ts b/src/agents/model-auth-env.ts index 50c8c2a24b3b..73c10a7d3b7d 100644 --- a/src/agents/model-auth-env.ts +++ b/src/agents/model-auth-env.ts @@ -20,13 +20,13 @@ export type EnvApiKeyResult = { source: string; }; -export type ProviderEnvAuthEvidence = { +type ProviderEnvAuthEvidence = { mode: "api-key" | "aws-sdk" | "oauth"; source: string; }; /** Secret-free direct-auth fact retained for runtime credential resolution. */ -export type ProviderDirectAuthPlanningEvidence = +type ProviderDirectAuthPlanningEvidence = | ({ kind: "environment" } & ProviderEnvAuthEvidence) | { kind: "setup-provider"; diff --git a/src/agents/provider-model-auth-source-plan.ts b/src/agents/provider-model-auth-source-plan.ts index 795947e4f14b..4d40fb3202ce 100644 --- a/src/agents/provider-model-auth-source-plan.ts +++ b/src/agents/provider-model-auth-source-plan.ts @@ -1,4 +1,4 @@ -export type ProviderModelAuthReadiness = "ready" | "unknown" | "unavailable"; +type ProviderModelAuthReadiness = "ready" | "unknown" | "unavailable"; export type ProviderModelAuthEvidence = | "aws-sdk" @@ -29,9 +29,9 @@ export type ProviderModelAuthSource = | ProviderModelAuthProfileSource | ProviderModelAuthDirectSource; -export type ProviderModelAuthRequiredReason = "configured-auth" | "provider-binding" | "user-lock"; +type ProviderModelAuthRequiredReason = "configured-auth" | "provider-binding" | "user-lock"; -export type ProviderModelAuthAutomaticProfiles = +type ProviderModelAuthAutomaticProfiles = | { kind: "empty"; explicitOrder: boolean } | { kind: "usable"; diff --git a/src/agents/provider-model-route-auth.ts b/src/agents/provider-model-route-auth.ts index 455deccab09e..1e4f1d46e37b 100644 --- a/src/agents/provider-model-route-auth.ts +++ b/src/agents/provider-model-route-auth.ts @@ -18,7 +18,7 @@ export type ProviderModelAuthSourceSelection = | { kind: "unavailable"; source: ProviderModelAuthProfileSource } | { kind: "none" }; -export type ProviderModelAuthLogicalAttempt = +type ProviderModelAuthLogicalAttempt = | { kind: "profile"; source: ProviderModelAuthProfileSource } | { kind: "direct"; @@ -26,7 +26,7 @@ export type ProviderModelAuthLogicalAttempt = allowAuthProfileFallback: false; }; -export type ProviderModelRouteAuthAttempt = +type ProviderModelRouteAuthAttempt = | { kind: "profile"; source: ProviderModelAuthProfileSource;