You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.9 KiB
2.9 KiB
Plugin SDK Boundary
This directory is the public contract between plugins and core. Changes here can affect bundled plugins and third-party plugins.
Source Of Truth
- Docs:
docs/plugins/sdk-overview.mddocs/plugins/sdk-entrypoints.mddocs/plugins/sdk-runtime.mddocs/plugins/sdk-migration.mddocs/plugins/architecture.md
- Definition files:
package.jsonscripts/lib/plugin-sdk-entrypoints.jsonsrc/plugin-sdk/entrypoints.tssrc/plugin-sdk/api-baseline.tssrc/plugin-sdk/plugin-entry.tssrc/plugin-sdk/core.tssrc/plugin-sdk/provider-entry.ts
Boundary Rules
- Prefer narrow, purpose-built subpaths over broad convenience re-exports.
- Do not expose implementation convenience from
src/channels/**,src/agents/**,src/plugins/**, or other internals unless you are intentionally promoting a supported public contract. - Keep public SDK entrypoints cheap at module load. If a helper is only needed
on async paths such as send, monitor, probe, directory-live, login, or setup,
prefer a narrow
*.runtimesubpath over re-exporting it through a broad SDK barrel that hot channel entrypoints import on startup. - Keep SDK facades acyclic. Do not add back-edge re-exports that route a lightweight contract file back through heavier policy or runtime modules.
- Do not mix static and dynamic imports for the same runtime surface when shaping SDK seams. If a surface must stay lazy, keep the eager side on a light contract file and the deferred side on a dedicated runtime subpath.
- Prefer
api.runtimeor a focused SDK facade over telling extensions to reach into host internals directly. - When core or tests need bundled plugin helpers, prefer the plugin package
api.tsorruntime-api.tsplus generic SDK capabilities. Do not add a provider-namedsrc/plugin-sdk/<id>.tsseam just to make core aware of a bundled channel's private helpers.
Verification
- If you touch SDK seams that affect lazy loading, hot channel entrypoints, or
bundled plugin import topology, run
pnpm build. - If the change can alter bundled channel startup cost, also run the isolated
entrypoint profiler for the affected plugin:
OPENCLAW_LOCAL_CHECK=0 node scripts/profile-extension-memory.mjs --extension <id> --skip-combined --concurrency 1
Expanding The Boundary
- Additive, backwards-compatible changes are the default.
- When adding or changing a public subpath, keep these aligned:
- docs in
docs/plugins/* scripts/lib/plugin-sdk-entrypoints.jsonsrc/plugin-sdk/entrypoints.tspackage.jsonexports- API baseline and export checks
- docs in
- If a bundled channel/helper need crosses package boundaries, first ask
whether the need is truly generic. If yes, add a narrow generic subpath. If
not, keep it plugin-local through
api.ts/runtime-api.ts. - Breaking removals or renames are major-version work, not drive-by cleanup.