openclaw/scripts/lib
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
..
ts-topology docs: document repository scripts 2026-06-04 20:52:50 -04:00
android-fastlane.sh android: add play release upload lane 2026-06-16 19:13:44 +02:00
android-version.ts android: derive release notes from changelog 2026-06-17 11:05:53 +02:00
arg-utils.mjs fix(qa): reject duplicate single-value flags 2026-06-23 14:01:29 +02:00
bounded-response.mjs fix(scripts): reject unsafe bounded response lengths 2026-06-20 04:04:40 +08:00
bounded-response.ts fix(scripts): reject unsafe bounded response lengths 2026-06-20 04:04:40 +08:00
budget-number-args.mjs fix(qa): reject duplicate single-value flags 2026-06-23 14:01:29 +02:00
bundled-extension-manifest.ts chore(deadcode): remove unused plugin version validator 2026-06-22 15:37:50 +08:00
bundled-plugin-build-entries-types.d.ts docs: document repository scripts 2026-06-04 20:52:50 -04:00
bundled-plugin-build-entries.d.mts
bundled-plugin-build-entries.mjs docs: document script lib helper contracts 2026-06-04 22:51:08 -04:00
bundled-plugin-paths.mjs docs: document script lib helper contracts 2026-06-04 22:51:08 -04:00
bundled-plugin-source-utils.mjs docs: document script lib scan helpers 2026-06-04 22:52:34 -04:00
bundled-runtime-sidecar-paths.json feat(plugins): externalize additional official plugins (#95683) 2026-06-22 16:12:51 +08:00
callsite-guard.mjs docs: document script lib scan helpers 2026-06-04 22:52:34 -04:00
changed-extensions.mjs docs: document script lib scan helpers 2026-06-04 22:52:34 -04:00
channel-contract-test-plan.mjs refactor(test): share channel contract file discovery 2026-06-07 03:59:03 +02:00
check-timing-summary.mjs docs: document script lib scan helpers 2026-06-04 22:52:34 -04:00
ci-node-test-plan.mjs ci: move tui pty into node ci shard (#95872) 2026-06-22 15:25:20 -07:00
codex-app-server-protocol-source.ts fix(scripts): resolve Windows cmd shim launcher 2026-06-21 11:15:14 +02:00
config-boundary-guard.d.mts
config-boundary-guard.mjs docs: document script lib guard helpers 2026-06-04 22:54:18 -04:00
copy-assets.ts docs: document repository scripts 2026-06-04 20:52:50 -04:00
dependency-ownership.json fix: improve agent runtime correctness from upstream Pi (#99949) 2026-07-04 09:08:37 -04:00
deprecated-config-api-guard.d.mts
deprecated-config-api-guard.mjs docs: document script lib guard helpers 2026-06-04 22:54:18 -04:00
deprecated-plugin-sdk-usage.mjs docs: document script lib guard helpers 2026-06-04 22:54:18 -04:00
dev-tooling-safety.ts docs: document repository scripts 2026-06-04 20:52:50 -04:00
direct-run.mjs docs: document script lib guard helpers 2026-06-04 22:54:18 -04:00
docker-build.sh fix(docker): reduce local build memory pressure 2026-07-01 03:58:21 -07:00
docker-e2e-container.sh fix(e2e): validate docker pids limits 2026-06-19 00:46:17 +02:00
docker-e2e-image.sh fix(test): reject pathological Docker E2E limits 2026-06-23 09:26:54 +02:00
docker-e2e-json-artifacts.mjs fix(scripts): share Docker E2E artifact bounds 2026-06-16 07:39:44 +02:00
docker-e2e-logs.sh fix(e2e): validate docker log limits 2026-06-19 01:02:59 +02:00
docker-e2e-package.sh fix(e2e): validate docker log limits 2026-06-19 01:02:59 +02:00
docker-e2e-plan.mjs Scope agent cron operations to the calling agent (#96883) 2026-06-26 21:41:14 -05:00
docker-e2e-scenarios.mjs fix(test): keep Gemini CLI docker lane advisory 2026-06-22 04:32:34 +02:00
error-format.mjs docs: document script lib extension helpers 2026-06-04 22:56:09 -04:00
extension-import-boundary-checker.mjs fix(tooling): bound extension boundary source reads 2026-06-07 12:36:13 +02:00
extension-package-boundary.ts refactor: extract reusable AI runtime package (#99059) 2026-07-05 01:56:40 -04:00
extension-source-classifier.d.mts
extension-source-classifier.mjs docs: document script lib extension helpers 2026-06-04 22:56:09 -04:00
extension-test-plan.mjs fix(test): route extension tests through scoped paths 2026-06-05 22:59:54 -07:00
extension-vitest-paths.mjs fix(test): route extension tests through scoped paths 2026-06-05 22:59:54 -07:00
format-generated-module.mjs fix(build): respect PATH-less pnpm environments 2026-06-10 18:06:31 +09:00
gateway-bench-child.ts refactor: consolidate async timing helpers (#99721) 2026-07-03 17:58:15 -07:00
gateway-bench-probes.ts refactor(scripts): dedupe gateway bench probes 2026-06-18 12:06:40 +08:00
gateway-ws-client.ts docs: document repository scripts 2026-06-04 20:52:50 -04:00
generated-output-utils.mjs refactor(scripts): remove dead helper exports 2026-06-18 16:29:56 +08:00
guard-inventory-utils.mjs docs: document script lib inventory helpers 2026-06-04 22:57:30 -04:00
host-timeout.sh fix(scripts): honor gtimeout in host setup wrappers 2026-06-20 20:07:50 +02:00
import-cycle-graph.ts docs: document repository scripts 2026-06-04 20:52:50 -04:00
ios-fastlane.sh feat: configure ios app store release upload 2026-06-15 19:27:55 +02:00
ios-version.ts chore(ios): generate release artifacts locally 2026-07-01 22:05:26 -05:00
kova-report-gate.mjs fix(release): unblock beta validation 2026-06-19 10:01:28 +08:00
list-test-files.mjs docs: document script lib inventory helpers 2026-06-04 22:57:30 -04:00
live-docker-auth.sh fix(live): validate docker pids limits 2026-06-19 00:54:57 +02:00
live-docker-stage.sh
local-build-metadata-paths.d.mts
local-build-metadata-paths.mjs docs: document script lib inventory helpers 2026-06-04 22:57:30 -04:00
local-build-metadata.d.mts fix(qqbot): migrate group tool policy config (#91128) 2026-06-07 02:33:06 -07:00
local-build-metadata.mjs docs: document script lib inventory helpers 2026-06-04 22:57:30 -04:00
local-heavy-check-runtime.mjs docs: document script lib process helpers 2026-06-04 22:59:33 -04:00
managed-child-process.mjs fix(scripts): resolve Windows cmd shim launcher 2026-06-21 11:15:14 +02:00
merge-head-diff-base.mjs fix(test): reject diff ref flag values 2026-06-21 19:59:55 +02:00
mintlify-accordion.mjs docs: document script lib process helpers 2026-06-04 22:59:33 -04:00
npm-pack-budget.d.mts
npm-pack-budget.mjs
npm-publish-plan.mjs fix(release): reject unsafe release version numbers 2026-06-16 22:27:20 +02:00
npm-verify-exec.ts docs: document repository scripts 2026-06-04 20:52:50 -04:00
numeric-options.mjs docs: document script lib package helpers 2026-06-04 23:01:02 -04:00
official-external-channel-catalog.json chore(catalog): bump Weixin plugin to 2.4.6 (#96801) 2026-06-27 08:12:12 +08:00
official-external-plugin-catalog.json Refactor external plugin catalog toward feeds (#95846) 2026-06-27 07:41:40 -07:00
official-external-provider-catalog.json Streamline OpenClaw onboarding (#98218) 2026-06-30 11:22:26 -07:00
openclaw-e2e-instance.sh refactor(e2e): remove unused shell wrappers 2026-06-23 05:56:31 +08:00
openclaw-release-clawhub-plan.ts ci: split plugin ClawHub publishing paths 2026-06-12 20:16:06 -07:00
openclaw-test-state.mjs docs: document script lib package helpers 2026-06-04 23:01:02 -04:00
optional-bundled-clusters-types.d.ts docs: document repository scripts 2026-06-04 20:52:50 -04:00
optional-bundled-clusters.d.mts
optional-bundled-clusters.mjs feat(raft): add wake bridge channel 2026-06-22 14:36:12 +08:00
package-dist-imports.mjs fix(release): track CommonJS package dist imports 2026-06-23 10:31:05 +02:00
package-root-args.mjs fix(scripts): reject short flag package roots 2026-06-21 21:27:57 +02:00
pairing-guard-context.mjs docs: document script lib plugin helpers 2026-06-04 23:03:25 -04:00
plain-gh.mjs fix(scripts): bypass gh wrapper shims 2026-06-26 07:51:07 +01:00
plain-gh.sh fix(scripts): bypass gh wrapper shims 2026-06-26 07:51:07 +01:00
plistbuddy.sh
plugin-clawhub-release.ts fix(release): block stale Codex runtime pins (#100015) 2026-07-04 15:13:31 -06:00
plugin-contract-test-plan.mjs docs: document script lib plugin helpers 2026-06-04 23:03:25 -04:00
plugin-gateway-gauntlet.mjs fix(qa): install gauntlet plugin requirements 2026-06-16 06:59:58 +02:00
plugin-npm-package-manifest.mjs fix(release): validate plugin manifest runner args 2026-06-20 22:23:30 +02:00
plugin-npm-release.ts fix(release): block stale Codex runtime pins (#100015) 2026-07-04 15:13:31 -06:00
plugin-npm-runtime-assets.mjs docs: document script lib plugin helpers 2026-06-04 23:03:25 -04:00
plugin-npm-runtime-build.mjs fix(scripts): reject short flag values in helper CLIs 2026-06-21 22:19:54 +02:00
plugin-package-dependencies.mjs fix(test): route plugin dependency helpers 2026-06-21 17:32:43 +02:00
plugin-prerelease-test-plan.mjs docs: document script lib runtime package helpers 2026-06-04 23:05:22 -04:00
plugin-sdk-deprecated-barrel-subpaths.json
plugin-sdk-deprecated-public-subpaths.json
plugin-sdk-doc-metadata.ts refactor(plugin-sdk): consolidate tool result helpers (#99740) 2026-07-04 16:50:44 -07:00
plugin-sdk-entries.d.mts
plugin-sdk-entries.mjs docs: document script lib runtime package helpers 2026-06-04 23:05:22 -04:00
plugin-sdk-entrypoints.json refactor(plugin-sdk): consolidate tool result helpers (#99740) 2026-07-04 16:50:44 -07:00
plugin-sdk-private-local-only-subpaths.json fix(sdk): keep sqlite lifecycle helpers private 2026-06-19 01:20:06 +08:00
policy-config-coverage.jsonc policy: track node deny command coverage 2026-07-04 15:06:10 -07:00
record-shared.mjs docs: document script lib runtime package helpers 2026-06-04 23:05:22 -04:00
regexp.mjs refactor(scripts): share regexp literal escaping (#99778) 2026-07-03 20:20:28 -07:00
release-beta-verifier.ts fix(release): cancel beta verifier status bodies 2026-06-19 07:57:19 +02:00
release-upgrade-baseline.mjs fix(scripts): reject short flag boundary values 2026-06-21 22:26:44 +02:00
report-cli-helpers.mjs fix(qa): reject duplicate report artifacts 2026-06-23 13:38:40 +02:00
restart-mac-gateway.sh
run-extension-oxlint.mjs refactor: store Zalo hosted media in plugin state 2026-06-06 22:56:48 -07:00
sleep.d.mts refactor: consolidate async timing helpers (#99721) 2026-07-03 17:58:15 -07:00
sleep.mjs refactor: consolidate async timing helpers (#99721) 2026-07-03 17:58:15 -07:00
source-file-scan-cache.mjs fix(tooling): bound source scan file reads 2026-06-07 12:14:09 +02:00
stable-release-closeout.mjs refactor(scripts): share regexp literal escaping (#99778) 2026-07-03 20:20:28 -07:00
static-extension-assets.mjs docs: document script lib report helpers 2026-06-04 23:07:12 -04:00
swift-toolchain.sh fix(mac): share Swift packaging preflight 2026-07-04 08:00:15 +02:00
test-group-report.mjs fix(codeql): clean OpenClaw quality findings 2026-06-22 19:11:46 +08:00
ts-guard-utils.mjs refactor: add transcript reader seam (#89121) 2026-06-15 09:41:50 -07:00
tsdown-output-roots.d.mts
tsdown-output-roots.mjs refactor: extract reusable AI runtime package (#99059) 2026-07-05 01:56:40 -04:00
tsgo-sparse-guard.mjs feat: refactor the Control UI architecture 2026-07-04 23:19:38 +01:00
version-script-args.ts Require explicit iOS release versions 2026-07-01 20:24:38 -05:00
vitest-batch-runner.mjs fix(test): clean Vitest runner child groups on signal 2026-06-20 15:35:33 +02:00
vitest-local-scheduling.d.mts
vitest-local-scheduling.mjs fix(test): reject malformed local check limits 2026-06-02 22:48:12 +02:00
vitest-report-cli-utils.mjs docs: document script lib test helpers 2026-06-04 23:08:26 -04:00
vitest-shard-timings.mjs docs: document script lib test helpers 2026-06-04 23:08:26 -04:00
windows-taskkill.d.mts fix(ci): filter ClawSweeper comment dispatches before token minting (#95308) 2026-06-21 19:05:08 +08:00
windows-taskkill.mjs fix(scripts): resolve Windows cmd shim launcher 2026-06-21 11:15:14 +02:00
workspace-bootstrap-smoke.mjs docs: document script lib test helpers 2026-06-04 23:08:26 -04:00