Files
Peter Steinberger 062f88e3e3 refactor: extract reusable AI runtime package (#99059)
* refactor: extract reusable AI runtime package

* refactor: complete AI provider relocation

* refactor: keep llm core internal

* refactor(ai): make @openclaw/ai self-contained with host policy ports

Move pure transport helpers (tool projections, strict-schema normalization,
prompt-cache boundary, stream guards, anthropic/openai compat, request
activity) from src into packages/ai; move utf16-slice into
normalization-core. Inject host policy (guarded fetch, redaction,
strict-tool defaults, diagnostics logging) through AiTransportHost with
inert library defaults installed by src/llm/stream.ts. Narrow the public
barrel to instance-scoped createApiRegistry/createLlmRuntime; the
process-default runtime moves behind internal/ and
registerBuiltInApiProviders takes an explicit registry. Delete the
src/llm/api-registry re-export facade.

* fix(ai): teach node, jiti, and vite resolvers the @openclaw/ai and utf16-slice subpaths

The workspace alias tables in root-alias.cjs, plugin-sdk-native-resolver,
sdk-alias, the shared vitest config, and the Control UI vite config only
knew @openclaw/llm-core; Node-side plugin loading resolved @openclaw/ai
through the pnpm symlink to the unbuilt dist (checks-node-compact CI
failures), and the Control UI build broke on the new
normalization-core/utf16-slice subpath.

* chore(ui): drop leftover service-worker debug logging

* build(release): ship @openclaw/ai with its own shrinkwrap and honest dependency set

packages/ai declares only its six real runtime deps (kysely, chalk, json5,
tslog, zod, fs-safe, and proxyline were never imported); orphaned root deps
removed. generate-npm-shrinkwrap now treats publishable packages/* like
publishable plugins so the AI tarball pins its transitive tree even though
workspace deps are omitted from the root shrinkwrap. knip learns the
package entry points; the tsdown dts neverBundle option moves to its
documented deps.dts home; the README documents the no-semver internal/*
contract and host ports.

* docs(ai): add minimal external-consumer example app

examples/ai-chat consumes only the public @openclaw/ai surface (built dist
via the workspace link): isolated runtime, built-in provider registration,
one streamed completion. Supports Anthropic/OpenAI via env keys and a
keyless local Ollama target; live-verified against Ollama.

* docs(ai): document the @openclaw/ai package and workspace shrinkwrap boundary

* chore(check): include examples/ in duplicate-scan targets

* fix: emit normalization package subpaths

* fix: complete AI package boundary artifacts

* fix: align AI package boundary contracts

* fix(ci): stabilize package release contracts

* test: align documentation contract checks

* test: keep cron docs guard aligned

* test: align restored docs contract guards

* test: follow upstream docs contracts

* docs: drop superseded talk wording
2026-07-05 01:56:40 -04:00

102 lines
2.9 KiB
JSON

{
"name": "@openclaw/agent-core",
"version": "0.0.0-private",
"private": true,
"files": [
"dist"
],
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./agent": {
"types": "./dist/agent.d.ts",
"default": "./dist/agent.js"
},
"./agent-loop": {
"types": "./dist/agent-loop.d.ts",
"default": "./dist/agent-loop.js"
},
"./llm": {
"types": "./dist/llm.d.ts",
"default": "./dist/llm.js"
},
"./node": {
"types": "./dist/node.d.ts",
"default": "./dist/node.js"
},
"./runtime-deps": {
"types": "./dist/runtime-deps.d.ts",
"default": "./dist/runtime-deps.js"
},
"./validation": {
"types": "./dist/validation.d.ts",
"default": "./dist/validation.js"
},
"./types": {
"types": "./dist/types.d.ts",
"default": "./dist/types.js"
},
"./harness/agent-harness": {
"types": "./dist/harness/agent-harness.d.ts",
"default": "./dist/harness/agent-harness.js"
},
"./harness/types": {
"types": "./dist/harness/types.d.ts",
"default": "./dist/harness/types.js"
},
"./harness/messages": {
"types": "./dist/harness/messages.d.ts",
"default": "./dist/harness/messages.js"
},
"./harness/env/kill-tree": {
"types": "./dist/harness/env/kill-tree.d.ts",
"default": "./dist/harness/env/kill-tree.js"
},
"./harness/session": {
"types": "./dist/harness/session.d.ts",
"default": "./dist/harness/session.js"
},
"./harness/session/jsonl-storage": {
"types": "./dist/harness/session/jsonl-storage.d.ts",
"default": "./dist/harness/session/jsonl-storage.js"
},
"./harness/session/memory-storage": {
"types": "./dist/harness/session/memory-storage.d.ts",
"default": "./dist/harness/session/memory-storage.js"
},
"./harness/session/uuid": {
"types": "./dist/harness/session/uuid.d.ts",
"default": "./dist/harness/session/uuid.js"
},
"./harness/compaction": {
"types": "./dist/harness/compaction.d.ts",
"default": "./dist/harness/compaction.js"
},
"./harness/branch-summarization": {
"types": "./dist/harness/branch-summarization.d.ts",
"default": "./dist/harness/branch-summarization.js"
},
"./harness/prompt-template-arguments": {
"types": "./dist/harness/prompt-template-arguments.d.ts",
"default": "./dist/harness/prompt-template-arguments.js"
},
"./harness/skills": {
"types": "./dist/harness/skills.d.ts",
"default": "./dist/harness/skills.js"
},
"./harness/utils/truncate": {
"types": "./dist/harness/utils/truncate.d.ts",
"default": "./dist/harness/utils/truncate.js"
}
},
"dependencies": {
"@openclaw/ai": "workspace:*",
"typebox": "1.3.3"
}
}