Skip to content

Commit 3465338

Browse files
author
Eva (agent)
committed
docs(plugin-sdk): refresh host-hook recipes
1 parent 3dd8bcb commit 3465338

5 files changed

Lines changed: 2930 additions & 12 deletions

File tree

docs/.i18n/glossary.zh-CN.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,14 @@
743743
"source": "Plugin hooks",
744744
"target": "插件钩子"
745745
},
746+
{
747+
"source": "Host-hook examples and recipes",
748+
"target": "宿主钩子示例与配方"
749+
},
750+
{
751+
"source": "Host-hook examples",
752+
"target": "宿主钩子示例"
753+
},
746754
{
747755
"source": "Internal hooks",
748756
"target": "内部钩子"
@@ -998,5 +1006,89 @@
9981006
{
9991007
"source": "ds4 (local DeepSeek V4)",
10001008
"target": "ds4(本地 DeepSeek V4)"
1009+
},
1010+
{
1011+
"source": "Ambient room events",
1012+
"target": "环境房间事件"
1013+
},
1014+
{
1015+
"source": "Groups",
1016+
"target": "群组"
1017+
},
1018+
{
1019+
"source": "Channel troubleshooting",
1020+
"target": "频道故障排除"
1021+
},
1022+
{
1023+
"source": "Channel configuration reference",
1024+
"target": "频道配置参考"
1025+
},
1026+
{
1027+
"source": "Bot loop protection",
1028+
"target": "机器人循环保护"
1029+
},
1030+
{
1031+
"source": "TaskFlow",
1032+
"target": "TaskFlow"
1033+
},
1034+
{
1035+
"source": "Onboarding (CLI)",
1036+
"target": "Onboarding (CLI)"
1037+
},
1038+
{
1039+
"source": "Gmail Pub/Sub",
1040+
"target": "Gmail Pub/Sub"
1041+
},
1042+
{
1043+
"source": "Personal agent benchmark pack",
1044+
"target": "个人 Agent 基准包"
1045+
},
1046+
{
1047+
"source": "Local model services",
1048+
"target": "本地模型服务"
1049+
},
1050+
{
1051+
"source": "Camera nodes",
1052+
"target": "摄像头节点"
1053+
},
1054+
{
1055+
"source": "Location command",
1056+
"target": "位置命令"
1057+
},
1058+
{
1059+
"source": "Gateway pairing",
1060+
"target": "Gateway 配对"
1061+
},
1062+
{
1063+
"source": "Admin HTTP RPC plugin",
1064+
"target": "Admin HTTP RPC 插件"
1065+
},
1066+
{
1067+
"source": "Operator scopes",
1068+
"target": "操作员作用域"
1069+
},
1070+
{
1071+
"source": "Gateway security",
1072+
"target": "Gateway 安全"
1073+
},
1074+
{
1075+
"source": "Remote access",
1076+
"target": "远程访问"
1077+
},
1078+
{
1079+
"source": "SDK subpaths",
1080+
"target": "SDK 子路径"
1081+
},
1082+
{
1083+
"source": "Admin Http Rpc plugin",
1084+
"target": "Admin Http Rpc 插件"
1085+
},
1086+
{
1087+
"source": "admin-http-rpc",
1088+
"target": "admin-http-rpc"
1089+
},
1090+
{
1091+
"source": "ds4",
1092+
"target": "ds4"
10011093
}
10021094
]

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@
12251225
"plugins/sdk-provider-plugins",
12261226
"plugins/cli-backend-plugins",
12271227
"plugins/hooks",
1228+
"plugins/host-hooks-examples",
12281229
"plugins/adding-capabilities"
12291230
]
12301231
},

docs/plugins/hooks.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -342,17 +342,19 @@ with `plugins.entries.<id>.hooks.allowPromptInjection=false`.
342342
### Session extensions and next-turn injections
343343

344344
Workflow plugins can persist small JSON-compatible session state with
345-
`api.registerSessionExtension(...)` and update it through the Gateway
346-
`sessions.pluginPatch` method. Session rows project registered extension state
347-
through `pluginExtensions`, letting Control UI and other clients render
348-
plugin-owned status without learning plugin internals.
349-
350-
Use `api.enqueueNextTurnInjection(...)` when a plugin needs durable context to
351-
reach the next model turn exactly once. OpenClaw drains queued injections before
352-
prompt hooks, drops expired injections, and deduplicates by `idempotencyKey`
353-
per plugin. This is the right seam for approval resumes, policy summaries,
354-
background monitor deltas, and command continuations that should be visible to
355-
the model on the next turn but should not become permanent system prompt text.
345+
`api.session.state.registerSessionExtension(...)` and update it through the
346+
Gateway `sessions.pluginPatch` method. Session rows project registered
347+
extension state through `pluginExtensions`, letting Control UI and other clients
348+
render plugin-owned status without learning plugin internals.
349+
350+
Use `api.session.workflow.enqueueNextTurnInjection(...)` when a plugin needs
351+
durable context to reach the next model turn exactly once. OpenClaw drains
352+
queued injections before prompt hooks, drops expired injections, and deduplicates
353+
by `idempotencyKey` per plugin. This is the right seam for approval resumes,
354+
policy summaries, background monitor deltas, and command continuations that
355+
should be visible to the model on the next turn but should not become permanent
356+
system prompt text. See [Host-hook examples](/plugins/host-hooks-examples) for
357+
worked workflow recipes.
356358

357359
Cleanup semantics are part of the contract. Session extension cleanup and
358360
runtime lifecycle cleanup callbacks receive `reset`, `delete`, `disable`, or
@@ -454,6 +456,7 @@ accessors, and the `command-auth` → `command-status` rename - see
454456
- [Plugin SDK migration](/plugins/sdk-migration) - active deprecations and removal timeline
455457
- [Building plugins](/plugins/building-plugins)
456458
- [Plugin SDK overview](/plugins/sdk-overview)
459+
- [Host-hook examples](/plugins/host-hooks-examples)
457460
- [Plugin entry points](/plugins/sdk-entrypoints)
458461
- [Internal hooks](/automation/hooks)
459462
- [Plugin architecture internals](/plugins/architecture-internals)

0 commit comments

Comments
 (0)