Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ai-config/scripts/generate-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { fileURLToPath } from "url";

import * as z from "zod/v4";

import { providersConfigSchema } from "../src/schema";
import { providersConfigSchema } from "../src/schema.js";

// ---------------------------------------------------------------------------
// Schema post-processing utilities
Expand Down
6 changes: 3 additions & 3 deletions packages/ai-config/src/__tests__/build-catalog-custom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import { describe, expect, it } from "vitest";

import { buildCatalog } from "../build-catalog";
import type { EnablementLayer } from "../resolve-enabled";
import type { PlatformBaseline, ProvidersConfig } from "../types";
import { buildCatalog } from "../build-catalog.js";
import type { EnablementLayer } from "../resolve-enabled.js";
import type { PlatformBaseline, ProvidersConfig } from "../types.js";

/** Build the highest-first enablement layer stack from a config's providers map. */
function layersOf(config: ProvidersConfig): EnablementLayer[] {
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-config/src/__tests__/defaults.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
BEDROCK_DEFAULTS,
GOOGLE_VERTEX_DEFAULTS,
PROVIDER_CONNECTION_DEFAULTS,
} from "../defaults";
} from "../defaults.js";

describe("provider connection defaults", () => {
it("POSIT_AI_DEFAULTS has expected shape", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-config/src/__tests__/enforce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import { describe, it, expect } from "vitest";

import { mergeEnforced } from "../enforce";
import type { ProvidersConfig } from "../types";
import { mergeEnforced } from "../enforce.js";
import type { ProvidersConfig } from "../types.js";

describe("mergeEnforced", () => {
it("returns user config when enforced is empty", () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/ai-config/src/__tests__/load-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import * as path from "path";

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

import { loadResolvedProviderCatalog } from "../node/load-catalog";
import { mutateProvidersConfig } from "../node/mutate-config";
import type { ProvidersConfig, ResolvedProvider } from "../types";
import type { PlatformBaseline } from "../types";
import { loadResolvedProviderCatalog } from "../node/load-catalog.js";
import { mutateProvidersConfig } from "../node/mutate-config.js";
import type { ProvidersConfig, ResolvedProvider } from "../types.js";
import type { PlatformBaseline } from "../types.js";

// ---------------------------------------------------------------------------
// Helpers
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-config/src/__tests__/positron-source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
buildAuthenticationFragment,
type PositronAuthSettingDescriptor,
type PositronAuthSettingReader,
} from "../positron/authentication-fragment";
} from "../positron/authentication-fragment.js";

function fakeReader(
overrides: {
Expand Down
6 changes: 3 additions & 3 deletions packages/ai-config/src/__tests__/resolve-catalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import { describe, expect, it, vi } from "vitest";

import type { ProviderConfigSource } from "../resolve-catalog";
import { recoverValidStack, resolveProviderCatalog } from "../resolve-catalog";
import type { PlatformBaseline, ResolvedProvider } from "../types";
import type { ProviderConfigSource } from "../resolve-catalog.js";
import { recoverValidStack, resolveProviderCatalog } from "../resolve-catalog.js";
import type { PlatformBaseline, ResolvedProvider } from "../types.js";

const STANDALONE: PlatformBaseline = { defaultEnabled: true };

Expand Down
6 changes: 3 additions & 3 deletions packages/ai-config/src/__tests__/resolve-enabled.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import { describe, it, expect } from "vitest";

import type { EnablementLayer } from "../resolve-enabled";
import { resolveEnabled } from "../resolve-enabled";
import type { PlatformBaseline, ProvidersMap } from "../types";
import type { EnablementLayer } from "../resolve-enabled.js";
import { resolveEnabled } from "../resolve-enabled.js";
import type { PlatformBaseline, ProvidersMap } from "../types.js";

const standaloneBaseline: PlatformBaseline = { defaultEnabled: true };
const rstudioBaseline: PlatformBaseline = {
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-config/src/__tests__/resolve-models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import { describe, it, expect } from "vitest";

import { resolveModels } from "../resolve-models";
import type { ModelInfoLike, ModelsBlock, ResolvedConnection } from "../types";
import { resolveModels } from "../resolve-models.js";
import type { ModelInfoLike, ModelsBlock, ResolvedConnection } from "../types.js";

function makeModel(id: string, overrides?: Partial<ModelInfoLike>): ModelInfoLike {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-config/src/__tests__/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { describe, it, expect } from "vitest";

import { enforcedProvidersConfigSchema, providersConfigSchema } from "../schema";
import { enforcedProvidersConfigSchema, providersConfigSchema } from "../schema.js";

describe("providersConfigSchema", () => {
it("accepts an empty config", () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-config/src/__tests__/seed-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import * as path from "path";

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

import { PROVIDERS_CONFIG_VERSION } from "../index";
import { mutateProvidersConfig } from "../node/mutate-config";
import { PROVIDERS_CONFIG_VERSION } from "../index.js";
import { mutateProvidersConfig } from "../node/mutate-config.js";

const mockLogger = {
debug: vi.fn(),
Expand Down
6 changes: 3 additions & 3 deletions packages/ai-config/src/__tests__/smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

import { describe, it, expect } from "vitest";

import { mintCustomProviderId } from "../types";
import { mintCustomProviderId } from "../types.js";

describe("ai-config", () => {
it("pure entry module loads", async () => {
const mod = await import("../index");
const mod = await import("../index.js");
expect(mod).toBeDefined();
});

it("node entry module loads", async () => {
const mod = await import("../node/index");
const mod = await import("../node/index.js");
expect(mod).toBeDefined();
});
});
Expand Down
8 changes: 4 additions & 4 deletions packages/ai-config/src/__tests__/watch-catalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import * as path from "path";

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

import type { ProviderCatalogChange, ProviderConfigSourceProvider } from "../node/types";
import { watchResolvedProviderCatalog } from "../node/watch-catalog";
import type { ProviderConfigSource } from "../resolve-catalog";
import type { PlatformBaseline, ProvidersConfig } from "../types";
import type { ProviderCatalogChange, ProviderConfigSourceProvider } from "../node/types.js";
import { watchResolvedProviderCatalog } from "../node/watch-catalog.js";
import type { ProviderConfigSource } from "../resolve-catalog.js";
import type { PlatformBaseline, ProvidersConfig } from "../types.js";

const mockLogger = {
debug: vi.fn(),
Expand Down
14 changes: 7 additions & 7 deletions packages/ai-config/src/build-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
* models (those need credentials + a runtime fetcher ai-config cannot hold).
*/

import { PROVIDER_CONNECTION_DEFAULTS } from "./defaults";
import type { EnablementLayer } from "./resolve-enabled";
import { resolveEnabled } from "./resolve-enabled";
import { PROVIDER_CONNECTION_DEFAULTS } from "./defaults.js";
import type { EnablementLayer } from "./resolve-enabled.js";
import { resolveEnabled } from "./resolve-enabled.js";
import type {
BuiltinProviderBlock,
CustomProviderEntry,
Expand All @@ -22,10 +22,10 @@ import type {
ProvidersMap,
ResolvedConnection,
ResolvedProvider,
} from "./types";
import { mintCustomProviderId } from "./types";
import { BUILTIN_PROVIDER_IDS } from "./vocabulary";
import type { BuiltinProviderId, ClientKind } from "./vocabulary";
} from "./types.js";
import { mintCustomProviderId } from "./types.js";
import { BUILTIN_PROVIDER_IDS } from "./vocabulary.js";
import type { BuiltinProviderId, ClientKind } from "./vocabulary.js";

// ---------------------------------------------------------------------------
// Non-secret connection env var mappings
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-config/src/config-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* (`fs`) entry. The node entry re-exports both for back-compat.
*/

import type { ProviderConfigSource } from "./resolve-catalog";
import type { ProviderConfigSource } from "./resolve-catalog.js";

/**
* A resource that can be disposed.
Expand Down
4 changes: 2 additions & 2 deletions packages/ai-config/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* configMapper and schema validation.
*/

import type { ResolvedConnection } from "./types";
import type { BuiltinProviderId } from "./vocabulary";
import type { ResolvedConnection } from "./types.js";
import type { BuiltinProviderId } from "./vocabulary.js";

/** Posit AI gateway defaults. */
export const POSIT_AI_DEFAULTS = {
Expand Down
2 changes: 1 addition & 1 deletion packages/ai-config/src/enforce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* - Primitives: enforced wins.
*/

import type { EnforcedProvidersConfig, ProvidersConfig } from "./types";
import type { EnforcedProvidersConfig, ProvidersConfig } from "./types.js";

/**
* Deep-merge `enforced` over `user`, returning a new config object.
Expand Down
22 changes: 11 additions & 11 deletions packages/ai-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ export {
PROTOCOL_VALUES,
RESERVED_PROVIDER_KEYS,
SUPPORTED_CUSTOM_CLIENT_KIND_VALUES,
} from "./vocabulary";
} from "./vocabulary.js";
export type {
BuiltinProviderId,
ClientKind,
Protocol,
ReservedProviderKey,
SupportedCustomClientKind,
} from "./vocabulary";
} from "./vocabulary.js";

// --- Schema ----------------------------------------------------------------
export { enforcedProvidersConfigSchema, providersConfigSchema } from "./schema";
export { enforcedProvidersConfigSchema, providersConfigSchema } from "./schema.js";

// --- Types (inferred + catalog) --------------------------------------------
export {
mintCustomProviderId,
MODEL_METADATA_FIELD_NAMES,
MODEL_ROUTING_FIELD_NAMES,
} from "./types";
} from "./types.js";
export type {
BuiltinProviderBlock,
CustomModel,
Expand All @@ -61,7 +61,7 @@ export type {
ResolvedModelInfo,
ResolvedProvider,
ResolvedProviderId,
} from "./types";
} from "./types.js";

// --- Defaults --------------------------------------------------------------
export {
Expand All @@ -71,23 +71,23 @@ export {
OLLAMA_DEFAULTS,
POSIT_AI_DEFAULTS,
PROVIDER_CONNECTION_DEFAULTS,
} from "./defaults";
} from "./defaults.js";

// --- Resolution helpers (public) -------------------------------------------
export { resolveModels } from "./resolve-models";
export { resolveModels } from "./resolve-models.js";

// --- Deep resolver seam (owns the precedence stack) ------------------------
export { resolveProviderCatalog } from "./resolve-catalog";
export { resolveProviderCatalog } from "./resolve-catalog.js";
export type {
ProviderConfigSource,
ProviderConfigSourceKind,
ResolveProviderCatalogOptions,
} from "./resolve-catalog";
} from "./resolve-catalog.js";

// --- Watchable config-source contracts (pure) ------------------------------
// The seam types a host source implements. Kept in the pure entry so
// `ai-config/positron` can build a source without depending on `ai-config/node`.
export type { Disposable, ProviderConfigSourceProvider } from "./config-source";
export type { Disposable, ProviderConfigSourceProvider } from "./config-source.js";

// --- Enforcement merge -----------------------------------------------------
export { mergeConfigFragments, mergeEnforced } from "./enforce";
export { mergeConfigFragments, mergeEnforced } from "./enforce.js";
2 changes: 1 addition & 1 deletion packages/ai-config/src/node/__tests__/paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as path from "path";

import { describe, expect, it } from "vitest";

import { AI_CONFIG_DIR, PROVIDERS_CONFIG_PATH, PROVIDERS_LOCKFILE_PATH } from "../paths";
import { AI_CONFIG_DIR, PROVIDERS_CONFIG_PATH, PROVIDERS_LOCKFILE_PATH } from "../paths.js";

describe("ai-config path constants", () => {
const home = os.homedir();
Expand Down
16 changes: 8 additions & 8 deletions packages/ai-config/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,26 @@
*/

// Re-export everything from the pure entry
export * from "../index";
export * from "../index.js";

// --- Paths -----------------------------------------------------------------
export { AI_CONFIG_DIR, PROVIDERS_CONFIG_PATH } from "./paths";
export { AI_CONFIG_DIR, PROVIDERS_CONFIG_PATH } from "./paths.js";

// --- Read seam (the single deep read seam) ---------------------------------
export { loadResolvedProviderCatalog } from "./load-catalog";
export { loadResolvedProviderCatalog } from "./load-catalog.js";

// --- Source assembly (file + env fragments → ProviderConfigSource[]) -------
// The deep seam is `loadConfigSources` + `resolveProviderCatalog`; the raw
// file/env readers stay internal so callers can't recreate source-assembly or
// fallback policy outside ai-config.
export { loadConfigSources } from "./load-config";
export type { LoadConfigSourcesOptions } from "./load-config";
export { loadConfigSources } from "./load-config.js";
export type { LoadConfigSourcesOptions } from "./load-config.js";

// --- Write seam ------------------------------------------------------------
export { mutateProvidersConfig } from "./mutate-config";
export { mutateProvidersConfig } from "./mutate-config.js";

// --- Watch seam (the single, source-aware watch seam) ----------------------
export { watchResolvedProviderCatalog } from "./watch-catalog";
export { watchResolvedProviderCatalog } from "./watch-catalog.js";

// --- Types -----------------------------------------------------------------
export type {
Expand All @@ -68,4 +68,4 @@ export type {
ProviderCatalogChange,
ProviderConfigSourceProvider,
WatchCatalogOptions,
} from "./types";
} from "./types.js";
8 changes: 4 additions & 4 deletions packages/ai-config/src/node/load-catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* seam; this function only reads the default node sources and delegates.
*/

import { resolveProviderCatalog } from "../resolve-catalog";
import type { ResolvedProvider } from "../types";
import { loadConfigSources } from "./load-config";
import type { LoadCatalogOptions } from "./types";
import { resolveProviderCatalog } from "../resolve-catalog.js";
import type { ResolvedProvider } from "../types.js";
import { loadConfigSources } from "./load-config.js";
import type { LoadCatalogOptions } from "./types.js";

/**
* Load ~/.posit/ai/providers.json, read the enforced/default env overlays,
Expand Down
8 changes: 4 additions & 4 deletions packages/ai-config/src/node/load-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

import { promises as fs } from "fs";

import type { ProviderConfigSource } from "../resolve-catalog";
import { enforcedProvidersConfigSchema, providersConfigSchema } from "../schema";
import type { EnforcedProvidersConfig, LoggerLike, ProvidersConfig } from "../types";
import { DEFAULT_ENV_VAR, ENFORCED_ENV_VAR, PROVIDERS_CONFIG_PATH } from "./paths";
import type { ProviderConfigSource } from "../resolve-catalog.js";
import { enforcedProvidersConfigSchema, providersConfigSchema } from "../schema.js";
import type { EnforcedProvidersConfig, LoggerLike, ProvidersConfig } from "../types.js";
import { DEFAULT_ENV_VAR, ENFORCED_ENV_VAR, PROVIDERS_CONFIG_PATH } from "./paths.js";

/** Options for assembling the default config sources. */
export interface LoadConfigSourcesOptions {
Expand Down
10 changes: 5 additions & 5 deletions packages/ai-config/src/node/mutate-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import * as path from "path";

import lockfile from "proper-lockfile";

import { PROVIDERS_CONFIG_VERSION } from "../index";
import { providersConfigSchema } from "../schema";
import type { ProvidersConfig } from "../types";
import { PROVIDERS_CONFIG_PATH } from "./paths";
import type { LoggerLike, MutateConfigOptions } from "./types";
import { PROVIDERS_CONFIG_VERSION } from "../index.js";
import { providersConfigSchema } from "../schema.js";
import type { ProvidersConfig } from "../types.js";
import { PROVIDERS_CONFIG_PATH } from "./paths.js";
import type { LoggerLike, MutateConfigOptions } from "./types.js";

// ---------------------------------------------------------------------------
// Lock options
Expand Down
Loading