diff --git a/docs/plugins/sdk-provider-plugins.md b/docs/plugins/sdk-provider-plugins.md index 6477b6c2db0..2582e726e4f 100644 --- a/docs/plugins/sdk-provider-plugins.md +++ b/docs/plugins/sdk-provider-plugins.md @@ -274,7 +274,7 @@ API key auth, and dynamic model resolution. - + OpenClaw calls hooks in this order. Most providers only use 2-3: | # | Hook | When to use | @@ -283,7 +283,7 @@ API key auth, and dynamic model resolution. | 2 | `resolveDynamicModel` | Accept arbitrary upstream model IDs | | 3 | `prepareDynamicModel` | Async metadata fetch before resolving | | 4 | `normalizeResolvedModel` | Transport rewrites before the runner | - | 5 | `capabilities` | Transcript/tooling metadata | + | 5 | `capabilities` | Transcript/tooling metadata (data, not callable) | | 6 | `prepareExtraParams` | Default request params | | 7 | `wrapStreamFn` | Custom headers/body wrappers | | 8 | `formatApiKey` | Custom runtime token shape | @@ -300,6 +300,7 @@ API key auth, and dynamic model resolution. | 19 | `prepareRuntimeAuth` | Token exchange before inference | | 20 | `resolveUsageAuth` | Custom usage credential parsing | | 21 | `fetchUsageSnapshot` | Custom usage endpoint | + | 22 | `onModelSelected` | Post-selection callback (e.g. telemetry) | For detailed descriptions and real-world examples, see [Internals: Provider Runtime Hooks](/plugins/architecture#provider-runtime-hooks). diff --git a/docs/plugins/sdk-runtime.md b/docs/plugins/sdk-runtime.md index 10e7cb4353e..b8c6081cba6 100644 --- a/docs/plugins/sdk-runtime.md +++ b/docs/plugins/sdk-runtime.md @@ -50,13 +50,15 @@ const timeoutMs = api.runtime.agent.resolveAgentTimeoutMs(cfg); // Ensure workspace exists await api.runtime.agent.ensureAgentWorkspace(cfg); -// Run an embedded Pi agent (requires sessionFile + workspaceDir at minimum) +// Run an embedded Pi agent const agentDir = api.runtime.agent.resolveAgentDir(cfg); const result = await api.runtime.agent.runEmbeddedPiAgent({ sessionId: "my-plugin:task-1", + runId: crypto.randomUUID(), sessionFile: path.join(agentDir, "sessions", "my-plugin-task-1.jsonl"), workspaceDir: api.runtime.agent.resolveAgentWorkspaceDir(cfg), prompt: "Summarize the latest changes", + timeoutMs: api.runtime.agent.resolveAgentTimeoutMs(cfg), }); ```