Commit 062f88e
authored
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 wording1 parent 9133118 commit 062f88e
230 files changed
Lines changed: 3123 additions & 1249 deletions
File tree
- .github
- codeql
- workflows
- config
- docs
- gateway/security
- reference
- examples/ai-chat
- extensions
- xai
- packages
- agent-core
- src
- ai
- src
- internal
- providers
- utils
- oauth
- llm-runtime
- src
- normalization-core
- src
- plugin-sdk
- scripts
- lib
- src
- agents
- cli-runner
- embedded-agent-helpers
- embedded-agent-runner
- run
- runtime
- sessions
- tools
- tools
- auto-reply/reply
- commands/models
- context-engine
- cron/service
- infra
- llm
- providers
- stream-wrappers
- utils
- plugin-sdk
- plugins
- contracts
- scripts
- test
- e2e/qa-lab/runtime
- scripts
- vitest
- ui
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
173 | 190 | | |
174 | 191 | | |
175 | 192 | | |
| |||
233 | 250 | | |
234 | 251 | | |
235 | 252 | | |
| 253 | + | |
236 | 254 | | |
237 | 255 | | |
238 | 256 | | |
239 | | - | |
| 257 | + | |
240 | 258 | | |
241 | 259 | | |
242 | 260 | | |
243 | 261 | | |
244 | 262 | | |
245 | 263 | | |
246 | 264 | | |
| 265 | + | |
247 | 266 | | |
248 | 267 | | |
249 | 268 | | |
250 | 269 | | |
251 | | - | |
| 270 | + | |
| 271 | + | |
252 | 272 | | |
253 | 273 | | |
254 | 274 | | |
255 | 275 | | |
256 | | - | |
| 276 | + | |
257 | 277 | | |
258 | 278 | | |
259 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
260 | 282 | | |
261 | 283 | | |
262 | 284 | | |
| |||
274 | 296 | | |
275 | 297 | | |
276 | 298 | | |
277 | | - | |
| 299 | + | |
278 | 300 | | |
279 | | - | |
| 301 | + | |
280 | 302 | | |
281 | 303 | | |
282 | 304 | | |
| |||
286 | 308 | | |
287 | 309 | | |
288 | 310 | | |
289 | | - | |
| 311 | + | |
290 | 312 | | |
291 | | - | |
| 313 | + | |
292 | 314 | | |
293 | 315 | | |
294 | 316 | | |
295 | 317 | | |
296 | 318 | | |
297 | | - | |
| 319 | + | |
298 | 320 | | |
299 | 321 | | |
300 | 322 | | |
| |||
326 | 348 | | |
327 | 349 | | |
328 | 350 | | |
| 351 | + | |
| 352 | + | |
329 | 353 | | |
330 | 354 | | |
331 | 355 | | |
| |||
358 | 382 | | |
359 | 383 | | |
360 | 384 | | |
361 | | - | |
| 385 | + | |
362 | 386 | | |
363 | 387 | | |
364 | 388 | | |
365 | 389 | | |
366 | 390 | | |
367 | 391 | | |
368 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
369 | 395 | | |
370 | 396 | | |
371 | 397 | | |
| |||
716 | 742 | | |
717 | 743 | | |
718 | 744 | | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
719 | 750 | | |
720 | 751 | | |
721 | 752 | | |
| |||
779 | 810 | | |
780 | 811 | | |
781 | 812 | | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
782 | 829 | | |
783 | 830 | | |
784 | 831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
| 147 | + | |
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
| |||
164 | 168 | | |
165 | 169 | | |
166 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
167 | 184 | | |
168 | 185 | | |
169 | 186 | | |
| |||
0 commit comments