Lifecycle hooks documented in AgentConfig appear to be unwired in v0.1.2
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- api, backend, documentation
Línea de trabajo
Start with src/runtime/agent-builder.ts and src/public/types.ts, then trace the createAgent → session.send → runClaudeQuery → buildClaudeQueryOptions path described in the issue. Compare the README hooks configuration with the generated SDK options and custom-tool wrapper. Done requires agreed trigger timing and error behavior, runtime tests for the six callbacks, and documentation that matches the supported behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
你好,我在接入 OAK 时希望通过生命周期回调记录工具执行情况,发现 README、公开类型声明与当前运行时实现似乎存在不一致。想请维护者确认,这是尚未接入的功能,还是我遗漏了正确的使用方式。
检查版本
- npm 包:
@cloudbase/[email protected] - 源码提交:
b413484550097f697a0f2ac0a52583e020afa292 - 下方链接均固定到该提交。
文档和类型声明
README 配置示例 列出了以下配置:
hooks: {
onSessionStart,
onUserMessage,
onToolStart,
onToolEnd,
onAgentMessage,
onSessionEnd,
}
AgentHooks 类型 也声明了这些回调,AgentConfig 接受 hooks?: AgentHooks。因此,使用者会预期配置这些回调后,可以在相应阶段收到通知。
源码检查结果
检查完整 src/,并沿下面的路径追踪配置后:
createAgent
→ session.send
→ runClaudeQuery
→ buildClaudeQueryOptions
→ Claude SDK query
观察到:
- 配置归一化保留了
hooks,但没有找到这些生命周期回调的实际调用点。 agent-builder.ts构造 SDK hooks 时,注册的是内部审批及客户端工具流程使用的PreToolUse,没有将公开的生命周期回调映射过去。- 自定义工具包装 调用
t.execute(...)前后,也没有发现onToolStart/onToolEnd的调用。 agent-builder.ts文件头 仍将“hooks 业务旁路”列为尚未支持。
这里讨论的是公开的生命周期回调;内部审批使用的 SDK PreToolUse 已经有实现。
离线验证及其范围
针对已安装的 0.1.2 构建产物,离线调用内部 buildClaudeQueryOptions,传入上述六个回调,用 Proxy 记录回调属性的读取情况,并检查生成的 SDK options:
| 检查项 | 结果 |
|---|---|
| 仅配置生命周期回调 | options.hooks 为 undefined |
| 构造 options 时读取这些回调属性的次数 | 0 |
增加 permissions.requireApproval 配置 |
SDK hooks 中包含 PreToolUse |
| 手动调用生成的审批 hook | 审批判断函数正常执行 |
该验证没有调用模型,只覆盖参数构造及审批 hook 对照,尚未进行真实模型的端到端回调测试。
仅凭 options.hooks 未包含回调,不能独立证明功能未实现,因为 OAK 也可能在 SDK 外直接调用它们;这里的判断还结合了完整运行时调用链的源码检查。
期望行为与待确认问题
如果这些回调已经支持,希望能提供正确接入方式及触发时机;如果尚未接入,希望 README 明确标注当前状态,避免使用者配置后无效果。
想请教:
- 当前版本的
AgentHooks是否确实尚未接入运行时?是否存在我遗漏的调用路径? - 是否接受补齐生命周期回调、测试和文档的 PR?如果接受,是否已有约定的触发时机及异常处理规则?
我的使用场景包括工具调用计数和失败重试统计。进一步的“执行前拒绝工具调用”需要单独讨论接口设计:当前 onToolStart 返回类型是 void,因此我没有将阻断执行视为现有接口已经承诺的能力。具体次数和重试额度会留在应用层处理。
感谢维护者确认。
- Lenguaje dominante
- TypeScript
- Estrellas
- 28
- Forks
- 3
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
danielmiessler/LifeOS#3028 ·
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
iOS: last line of a long UITextView text is sometimes not drawn (frame a fraction of a point short)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
Koenkk/zigbee2mqtt#33855 ·
Los mantenedores suelen responder en 1 día