fix(hooks): respect previous message's agent mode in message sending hooks
Message hooks like todo-continuation-enforcer and background-notification now preserve the agent mode from the previous message when sending follow-up prompts. This ensures that continuation messages and task completion notifications use the same agent that was active in the conversation. - Export findNearestMessageWithFields and MESSAGE_STORAGE from hook-message-injector - Add getMessageDir helper to locate session message directories - Pass agent field to session.prompt in todo-continuation-enforcer - Pass agent field to session.prompt in BackgroundManager.notifyParentSession Closes #59 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
export { injectHookMessage } from "./injector"
|
||||
export { injectHookMessage, findNearestMessageWithFields } from "./injector"
|
||||
export type { StoredMessage } from "./injector"
|
||||
export type { MessageMeta, OriginalMessageContext, TextPart } from "./types"
|
||||
export { MESSAGE_STORAGE } from "./constants"
|
||||
|
||||
@@ -3,13 +3,13 @@ import { join } from "node:path"
|
||||
import { MESSAGE_STORAGE, PART_STORAGE } from "./constants"
|
||||
import type { MessageMeta, OriginalMessageContext, TextPart } from "./types"
|
||||
|
||||
interface StoredMessage {
|
||||
export interface StoredMessage {
|
||||
agent?: string
|
||||
model?: { providerID?: string; modelID?: string }
|
||||
tools?: Record<string, boolean>
|
||||
}
|
||||
|
||||
function findNearestMessageWithFields(messageDir: string): StoredMessage | null {
|
||||
export function findNearestMessageWithFields(messageDir: string): StoredMessage | null {
|
||||
try {
|
||||
const files = readdirSync(messageDir)
|
||||
.filter((f) => f.endsWith(".json"))
|
||||
|
||||
Reference in New Issue
Block a user