fix(session-notification): skip notification for subagent sessions (#70)
- Import subagentSessions from claude-code-session-state in both manager.ts and session-notification.ts - Add sessionID to subagentSessions Set when creating background task session - Remove sessionID from subagentSessions when background task session is deleted - Check if session is in subagentSessions before triggering notification Fixes #70: Notification hook no longer triggers for subagent idle events 🤖 Generated with assistance of [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
findNearestMessageWithFields,
|
||||
MESSAGE_STORAGE,
|
||||
} from "../hook-message-injector"
|
||||
import { subagentSessions } from "../claude-code-session-state"
|
||||
|
||||
type OpencodeClient = PluginInput["client"]
|
||||
|
||||
@@ -82,6 +83,7 @@ export class BackgroundManager {
|
||||
}
|
||||
|
||||
const sessionID = createResult.data.id
|
||||
subagentSessions.add(sessionID)
|
||||
|
||||
const task: BackgroundTask = {
|
||||
id: `bg_${crypto.randomUUID().slice(0, 8)}`,
|
||||
@@ -236,6 +238,7 @@ export class BackgroundManager {
|
||||
|
||||
this.tasks.delete(task.id)
|
||||
this.clearNotificationsForTask(task.id)
|
||||
subagentSessions.delete(sessionID)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import { platform } from "os"
|
||||
import { subagentSessions } from "../features/claude-code-session-state"
|
||||
|
||||
interface Todo {
|
||||
content: string
|
||||
@@ -219,6 +220,8 @@ export function createSessionNotification(
|
||||
const sessionID = props?.sessionID as string | undefined
|
||||
if (!sessionID) return
|
||||
|
||||
if (subagentSessions.has(sessionID)) return
|
||||
|
||||
if (notifiedSessions.has(sessionID)) return
|
||||
if (pendingTimers.has(sessionID)) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user