From 6823763ed85c64c961145ff2b707848b8c51f967 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Wed, 26 Aug 2026 18:16:18 -0500 Subject: [PATCH 1/2] Update BEDROCK_DEFAULTS guidance for readiness-gated synthesis --- memory-bank/aiConfig.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory-bank/aiConfig.md b/memory-bank/aiConfig.md index 958f80e..c018c27 100644 --- a/memory-bank/aiConfig.md +++ b/memory-bank/aiConfig.md @@ -45,7 +45,7 @@ the map/translator live inside ai-config (see [Legacy Positron settings](#legacy - **Vocabulary** (`src/vocabulary.ts`): `BUILTIN_PROVIDER_IDS`, `CLIENT_KIND_VALUES`, `PROTOCOL_VALUES`, `RESERVED_PROVIDER_KEYS`, `isBuiltinProviderId()`, and the `BuiltinProviderId` / `ClientKind` / `Protocol` / `ReservedProviderKey` types. - **Schemas** (`src/schema.ts`): `providersConfigSchema` (full, strict) and `providersConfigFragmentSchema` (relaxed — custom-entry `type` optional; the fragment shape every catalog config source carries). - **Types** (`src/types.ts`): types inferred from the Zod schemas (`ProvidersConfig`, `ProvidersMap`, `BuiltinProviderBlock`, `CustomProviderEntry`, `ModelsBlock`, `ModelOverride`, `CustomModel`, …) plus resolution outputs (`ResolvedProvider`, `ResolvedConnection`, `ResolvedConnectionProvenance`, `ResolvedModelInfo`) and the branded `CustomProviderId`. `mintCustomProviderId()` is the **only** way to produce a `CustomProviderId`. -- **Defaults** (`src/defaults.ts`): per-provider connection defaults and the `PROVIDER_CONNECTION_DEFAULTS` map. **Bedrock deliberately carries no entry**: `BEDROCK_DEFAULTS` (`us-east-1`) is exported but absent from `PROVIDER_CONNECTION_DEFAULTS`, because layering it into the resolved connection made the baked-in default outrank a user's stored credential region downstream (posit-dev/assistant#2002). Consumers apply the fallback at credential-synthesis time instead; do not "fix" the omission by adding Bedrock to the defaults map. +- **Defaults** (`src/defaults.ts`): per-provider connection defaults and the `PROVIDER_CONNECTION_DEFAULTS` map. **Bedrock deliberately carries no entry**: `BEDROCK_DEFAULTS` (`us-east-1`) is exported but absent from `PROVIDER_CONNECTION_DEFAULTS`, because layering it into the resolved connection made the baked-in default outrank a user's stored credential region downstream (posit-dev/assistant#2002). `BEDROCK_DEFAULTS` remains exported only as the standalone configure form's default region; credential synthesis no longer applies the fallback (synthesis is gated on catalog auth readiness, which requires deliberate region config). Do not "fix" the omission by adding Bedrock to the defaults map — a default-layer region would now pass readiness and make every install fetch Bedrock models. - **Resolution helpers**: `resolveModels()` and `mergeEnforced()` are pure and exported; `resolveEnabled()` / connection resolution are internal helpers used by the catalog builder. - **Config-source contracts** (`src/config-source.ts`): `ProviderConfigSource` (public — the resolver's input) and the internal `ProviderConfigSourceProvider` (loader machinery, not exported). `Disposable` stays public as the return type of `LegacySettingsReader.watch`. - **Structured diagnostics** (`src/config-issue.ts`): `ConfigIssue` is source-agnostic; `SourcedConfigIssue` adds a required normalized `{ kind, label }` identity. Its source kind reuses `ProviderConfigSourceKind` and widens only for the resolver-private `"env"` source. From 618a34b5143088282686f761d5b6c8b25915e31a Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Wed, 26 Aug 2026 18:32:02 -0500 Subject: [PATCH 2/2] Add transformSource load hook for counterfactual catalog queries --- packages/ai-config/src/node/load-catalog.ts | 3 ++- packages/ai-config/src/node/types.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/ai-config/src/node/load-catalog.ts b/packages/ai-config/src/node/load-catalog.ts index 9749d41..ee59901 100644 --- a/packages/ai-config/src/node/load-catalog.ts +++ b/packages/ai-config/src/node/load-catalog.ts @@ -32,7 +32,8 @@ export async function loadProviderCatalogReport( const legacyProviders = createLegacyPositronSourceProviders(opts, env); reports.push(...(await Promise.all(legacyProviders.map((provider) => provider.read())))); - const sources = reports.flatMap((report) => (report.source ? [report.source] : [])); + const loaded = reports.flatMap((report) => (report.source ? [report.source] : [])); + const sources = opts.transformSource ? loaded.map(opts.transformSource) : loaded; const resolver = resolveProviderCatalogReport({ sources, envVars: env, diff --git a/packages/ai-config/src/node/types.ts b/packages/ai-config/src/node/types.ts index 5b4b6fb..85c9303 100644 --- a/packages/ai-config/src/node/types.ts +++ b/packages/ai-config/src/node/types.ts @@ -9,6 +9,7 @@ import type { SourcedConfigIssue } from "../config-issue.js"; import type { Disposable as ConfigDisposable } from "../config-source.js"; import type { LegacySettingsReader } from "../legacy-positron-settings/translate.js"; +import type { ProviderConfigSource } from "../resolve-catalog.js"; import type { LoggerLike, ResolvedProvider } from "../types.js"; // Re-export the pure logger type so node consumers can import it from here. @@ -88,6 +89,16 @@ export interface LoadCatalogOptions { * stale legacy setting the migration copied it from. */ readonly legacyPositronEnforcedSettings?: boolean; + + /** + * Optional transform applied to every loaded source (file, env fragments, + * legacy) before resolution. Supports counterfactual ("what-if") queries — + * e.g. a clear-confirmation flow re-resolving the catalog without the + * user-layer leaves a disconnect would remove — while reusing the exact + * source options (paths, env vars, legacy channels) of the live load. + * Load-path only; watch paths never apply it. + */ + readonly transformSource?: (source: ProviderConfigSource) => ProviderConfigSource; } /**