feat(plugins): add sanitized model call hooks

This commit is contained in:
Vincent Koc
2026-04-25 10:56:18 -07:00
parent 9ffe764416
commit 275c128e99
8 changed files with 321 additions and 44 deletions

View File

@@ -1,2 +1,2 @@
f6d9588737310773031e744b6726ba80a9ca742205db335aae95fbd1e2925dc8 plugin-sdk-api-baseline.json
a4c86fe92b7bea538f33139e9b57cfada766b7d504323c2e20a7ca205994be44 plugin-sdk-api-baseline.jsonl
fae367b052828a57feab3bfcd10a58ebeacd6c858b337d0aab72726863952946 plugin-sdk-api-baseline.json
1bb8995e1486f7d900928aaace87421a8297fe41264197f9bf849f07c65c8f2b plugin-sdk-api-baseline.jsonl

View File

@@ -68,6 +68,7 @@ observation-only.
**Conversation observation**
- `model_call_started` / `model_call_ended` — observe sanitized provider/model call metadata, timing, outcome, and bounded request-id hashes without prompt or response content
- `llm_input` — observe provider input (system prompt, prompt, history)
- `llm_output` — observe provider output
@@ -162,6 +163,13 @@ so your plugin does not depend on a legacy combined phase.
`before_agent_start` and `agent_end` include `event.runId` when OpenClaw can
identify the active run. The same value is also available on `ctx.runId`.
Use `model_call_started` and `model_call_ended` for provider-call telemetry
that should not receive raw prompts, history, responses, headers, request
bodies, or provider request IDs. These hooks include stable metadata such as
`runId`, `callId`, `provider`, `model`, optional `api`/`transport`, terminal
`durationMs`/`outcome`, and `upstreamRequestIdHash` when OpenClaw can derive a
bounded provider request-id hash.
Non-bundled plugins that need `llm_input`, `llm_output`, or `agent_end` must set:
```json