mirror of
https://github.com/sst/opencode.git
synced 2025-07-22 23:35:01 +00:00
fix(hooks): prevent session_complete hook from firing on subagent sessions (#1149)
This commit is contained in:
parent
4316edaf43
commit
a524fc545c
1 changed files with 5 additions and 1 deletions
|
@ -31,9 +31,13 @@ export namespace ConfigHooks {
|
|||
}
|
||||
})
|
||||
|
||||
Bus.subscribe(Session.Event.Idle, async () => {
|
||||
Bus.subscribe(Session.Event.Idle, async (payload) => {
|
||||
const cfg = await Config.get()
|
||||
if (cfg.experimental?.hook?.session_completed) {
|
||||
const session = await Session.get(payload.properties.sessionID)
|
||||
// Only fire hook for top-level sessions (not subagent sessions)
|
||||
if (session.parentID) return
|
||||
|
||||
for (const item of cfg.experimental.hook.session_completed) {
|
||||
log.info("session_completed", {
|
||||
command: item.command,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue