





















@@ -127,6 +127,10 @@ export default defineChannelPluginEntry({
127127 Use it as the canonical place for channel-owned CLI descriptors so root help
128128 stays non-activating, discovery snapshots include static command metadata, and
129129 normal CLI command registration remains compatible with full plugin loads.
130+- Discovery registration is non-activating, not import-free. OpenClaw may
131+ evaluate the trusted plugin entry and channel plugin module to build the
132+ snapshot, so keep top-level imports side-effect-free and put sockets,
133+ clients, workers, and services behind `"full"`-only paths.
130134- `registerFull` only runs when `api.registrationMode === "full"`. It is skipped
131135 during setup-only loading.
132136- Like `definePluginEntry`, `configSchema` can be a lazy factory and OpenClaw
@@ -198,13 +202,13 @@ setter before the full channel entry loads.
198202199203`api.registrationMode` tells your plugin how it was loaded:
200204201-| Mode | When | What to register |
202-| ----------------- | --------------------------------- | ---------------------------------------------------------------------------------------------- |
203-| `"full"` | Normal gateway startup | Everything |
204-| `"discovery"` | Read-only capability discovery | Channel registration plus static CLI descriptors; skip sockets, workers, clients, and services |
205-| `"setup-only"` | Disabled/unconfigured channel | Channel registration only |
206-| `"setup-runtime"` | Setup flow with runtime available | Channel registration plus only the lightweight runtime needed before the full entry loads |
207-| `"cli-metadata"` | Root help / CLI metadata capture | CLI descriptors only |
205+| Mode | When | What to register |
206+| ----------------- | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
207+| `"full"` | Normal gateway startup | Everything |
208+| `"discovery"` | Read-only capability discovery | Channel registration plus static CLI descriptors; entry code may load, but skip sockets, workers, clients, and services |
209+| `"setup-only"` | Disabled/unconfigured channel | Channel registration only |
210+| `"setup-runtime"` | Setup flow with runtime available | Channel registration plus only the lightweight runtime needed before the full entry loads |
211+| `"cli-metadata"` | Root help / CLI metadata capture | CLI descriptors only |
208212209213`defineChannelPluginEntry` handles this split automatically. If you use
210214`definePluginEntry` directly for a channel, check mode yourself:
@@ -228,6 +232,13 @@ register(api) {
228232}
229233```
230234235+Discovery mode builds a non-activating registry snapshot. It may still evaluate
236+the plugin entry and the channel plugin object so OpenClaw can register channel
237+capabilities and static CLI descriptors. Treat module evaluation in discovery as
238+trusted but lightweight: no network clients, subprocesses, listeners, database
239+connections, background workers, credential reads, or other live runtime side
240+effects at top level.
241+231242Treat `"setup-runtime"` as the window where setup-only startup surfaces must
232243exist without re-entering the full bundled channel runtime. Good fits are
233244channel registration, setup-safe HTTP routes, setup-safe gateway methods, and
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。