mirror of https://github.com/openclaw/openclaw.git
2.8 KiB
2.8 KiB
Extensions Boundary
This directory contains bundled plugins. Treat it as the same boundary that third-party plugins see.
Public Contracts
- Docs:
docs/plugins/building-plugins.mddocs/plugins/architecture.mddocs/plugins/sdk-overview.mddocs/plugins/sdk-entrypoints.mddocs/plugins/sdk-runtime.mddocs/plugins/sdk-channel-plugins.mddocs/plugins/sdk-provider-plugins.mddocs/plugins/manifest.md
- Definition files:
src/plugin-sdk/plugin-entry.tssrc/plugin-sdk/core.tssrc/plugin-sdk/provider-entry.tssrc/plugin-sdk/channel-contract.tsscripts/lib/plugin-sdk-entrypoints.jsonpackage.json
Boundary Rules
- Extension production code should import from
openclaw/plugin-sdk/*and its own local barrels such as./api.tsand./runtime-api.ts. - Do not import core internals from
src/**,src/channels/**,src/plugin-sdk-internal/**, or another extension'ssrc/**. - Do not use relative imports that escape the current extension package root.
- Keep plugin metadata accurate in
openclaw.plugin.jsonand the packageopenclawblock so discovery and setup work without executing plugin code. - Treat files like
src/**,onboard.ts, and other local helpers as private unless you intentionally promote them throughapi.tsand, if needed, a matchingsrc/plugin-sdk/<id>.tsfacade. - If core or core tests need a bundled plugin helper, export it from
api.tsfirst instead of letting them deep-import extension internals. - For provider plugins, keep auth, onboarding, catalog selection, and vendor-only product behavior local to the plugin. Do not move those into core just because two providers look similar.
- Before adding a new provider-local
wrapStreamFn,buildReplayPolicy,normalizeToolSchemas,inspectToolSchemas, or compat patch helper, check whether the same behavior already exists throughopenclaw/plugin-sdk/*. Reuse shared family helpers first. - If two bundled providers share the same replay policy shape, tool-schema compat rewrite, payload patch, or stream-wrapper chain, stop copying the logic. Extract one shared helper and migrate both call sites in the same change.
- Prefer named provider-family helpers over repeating raw option bags. If a provider needs OpenAI-style Anthropic tool payload compat, Gemini schema cleanup, or an XAI compat patch, use a named shared helper instead of inlining the policy knobs again.
Expanding The Boundary
- If an extension needs a new seam, add a typed Plugin SDK subpath or additive export instead of reaching into core.
- Keep new plugin-facing seams backwards-compatible and versioned. Third-party plugins consume this surface.
- When intentionally expanding the contract, update the docs, exported subpath list, package exports, and API/contract checks in the same change.