mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 01:29:56 +00:00
* fix(agents): initialize transport hooks at execution boundaries Keep catalog compatibility on a narrow internal import and install the existing transport host before session dispatch or completion preparation. Direct SDK completions now apply provider stream wrappers before sending a request, with owner and cancellation checks after initialization. * build(ai): emit the model compatibility entrypoint * perf: isolate catalog workers from unused execution code Use explicit catalog plugin owners without automatic agent slots. Load Ollama payload helpers when their streams run and acquire the TypeScript compiler only when a typed module is actually compiled. * test(agents): exercise admitted compaction cancellation Cancel the manual compaction after its provider is admitted so its exact rejection remains observable. Assert that cancellation before dispatch never calls the provider again.
52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
// Builds the reusable AI package separately to keep provider bundling out of
|
|
// the already-parallel main package graph.
|
|
import type { UserConfig } from "tsdown";
|
|
import { createDeclarationBoundaryHooks } from "./scripts/lib/tsdown-declaration-boundary.mts";
|
|
|
|
const externalDependencies = [
|
|
"@anthropic-ai/sdk",
|
|
"@google/genai",
|
|
"@mistralai/mistralai",
|
|
"openai",
|
|
"typebox",
|
|
] as const;
|
|
|
|
const config = {
|
|
clean: true,
|
|
dts: process.env.OPENCLAW_RUN_NODE_SKIP_DTS_BUILD !== "1",
|
|
hooks: createDeclarationBoundaryHooks(),
|
|
entry: {
|
|
index: "packages/ai/src/index.ts",
|
|
providers: "packages/ai/src/providers.ts",
|
|
transports: "packages/ai/src/transports.ts",
|
|
diagnostics: "packages/ai/src/utils/diagnostics.ts",
|
|
"event-stream": "packages/ai/src/utils/event-stream.ts",
|
|
types: "packages/ai/src/types.ts",
|
|
"provider-types": "packages/ai/src/provider-types.ts",
|
|
validation: "packages/ai/src/validation.ts",
|
|
"internal/anthropic": "packages/ai/src/internal/anthropic.ts",
|
|
"internal/google-model-family": "packages/ai/src/internal/google-model-family.ts",
|
|
"internal/openai": "packages/ai/src/internal/openai.ts",
|
|
"internal/openai-completions-compat": "packages/ai/src/internal/openai-completions-compat.ts",
|
|
"internal/openai-responses-payload-policy":
|
|
"packages/ai/src/internal/openai-responses-payload-policy.ts",
|
|
"internal/retry-after": "packages/ai/src/internal/retry-after.ts",
|
|
"internal/runtime": "packages/ai/src/internal/runtime.ts",
|
|
"internal/shared": "packages/ai/src/internal/shared.ts",
|
|
"internal/tool-schema": "packages/ai/src/internal/tool-schema.ts",
|
|
},
|
|
env: { NODE_ENV: "production" },
|
|
format: "esm",
|
|
outDir: "packages/ai/dist",
|
|
platform: "node",
|
|
target: "node22",
|
|
deps: {
|
|
neverBundle(id) {
|
|
return externalDependencies.some(
|
|
(dependency) => id === dependency || id.startsWith(`${dependency}/`),
|
|
);
|
|
},
|
|
},
|
|
} satisfies UserConfig;
|
|
|
|
export default config;
|