feat(ai): compat entrypoint, core-only root barrel (phase 5)
The root barrel is now core-only and side-effect free: types, createModels/createProvider, auth substrate, lazyStream/lazyApi, faux, utils. Generated catalogs, api-registry, env-api-keys, images, global stream functions, and per-API lazy wrappers leave the root. New @earendil-works/pi-ai/compat preserves the old surface verbatim as a strict superset of the root: api-dispatch stream/complete with env key injection, the builtin registration side effect (skip-if-present so it cannot clobber earlier overrides), deprecated getModel/getModels/ getProviders aliases of the new getBuiltin* reads in providers/all, lazy api wrappers + setBedrockProviderModule, and image generation. Compat dies with the coding-agent ModelManager migration. Packaging: exports map gains ./compat, ./providers/*, ./api/*; sideEffects array lists only the effectful modules. Old-global imports across agent/coding-agent/examples and pi-ai tests switch to /compat (path-only; compat is a superset). The coding-agent extension loader resolves the pi-ai ROOT specifier to compat, so existing user extensions using the old global API keep working at runtime until compat is removed. vitest configs alias /compat to src; browser smoke imports old globals from /compat.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* pi --extension examples/extensions/custom-compaction.ts
|
||||
*/
|
||||
|
||||
import { complete } from "@earendil-works/pi-ai";
|
||||
import { complete } from "@earendil-works/pi-ai/compat";
|
||||
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
||||
import { convertToLlm, serializeConversation } from "@earendil-works/pi-coding-agent";
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
openAIResponsesApi,
|
||||
type SimpleStreamOptions,
|
||||
type ThinkingLevelMap,
|
||||
} from "@earendil-works/pi-ai";
|
||||
} from "@earendil-works/pi-ai/compat";
|
||||
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
||||
|
||||
// =============================================================================
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* npx tsx test.ts claude-sonnet-4-5-20250929 --thinking
|
||||
*/
|
||||
|
||||
import { type Api, type Context, type Model, registerApiProvider, streamSimple } from "@earendil-works/pi-ai";
|
||||
import { type Api, type Context, type Model, registerApiProvider, streamSimple } from "@earendil-works/pi-ai/compat";
|
||||
import { readFileSync } from "fs";
|
||||
import { getAgentDir } from "packages/coding-agent/src/config.js";
|
||||
import { join } from "path";
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
|
||||
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
||||
import { complete, type Message } from "@earendil-works/pi-ai";
|
||||
import { complete, type Message } from "@earendil-works/pi-ai/compat";
|
||||
import type { ExtensionAPI, SessionEntry } from "@earendil-works/pi-coding-agent";
|
||||
import { BorderedLoader, convertToLlm, serializeConversation } from "@earendil-works/pi-coding-agent";
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* 3. Loads the result into the editor for user to fill in answers
|
||||
*/
|
||||
|
||||
import { complete, type UserMessage } from "@earendil-works/pi-ai";
|
||||
import { complete, type UserMessage } from "@earendil-works/pi-ai/compat";
|
||||
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
||||
import { BorderedLoader } from "@earendil-works/pi-coding-agent";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { complete, getModel } from "@earendil-works/pi-ai";
|
||||
import { complete, getModel } from "@earendil-works/pi-ai/compat";
|
||||
import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
||||
import { DynamicBorder, getMarkdownTheme } from "@earendil-works/pi-coding-agent";
|
||||
import { Container, Markdown, matchesKey, Text } from "@earendil-works/pi-tui";
|
||||
|
||||
Reference in New Issue
Block a user