refactor(hooks): use unified internal prompt dispatch
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -3,7 +3,7 @@ import type { MessageData, ResumeConfig } from "./types"
|
||||
import { readParts } from "./storage/parts-reader"
|
||||
import { isSqliteBackend } from "../../shared/opencode-storage-detection"
|
||||
import { normalizeSDKResponse } from "../../shared"
|
||||
import { promptAsyncAfterSessionIdle } from "../shared/prompt-async-gate"
|
||||
import { dispatchInternalPrompt } from "../shared/prompt-async-gate"
|
||||
|
||||
type Client = ReturnType<typeof createOpencodeClient>
|
||||
type ToolResultContent = { type: "text"; text: string }
|
||||
@@ -169,7 +169,8 @@ export async function recoverToolResultMissing(
|
||||
return false
|
||||
}
|
||||
|
||||
const promptResult = await promptAsyncAfterSessionIdle({
|
||||
const promptResult = await dispatchInternalPrompt({
|
||||
mode: "async",
|
||||
client,
|
||||
sessionID,
|
||||
source: options?.source ?? "session-recovery-tool-result-missing",
|
||||
|
||||
@@ -4,7 +4,7 @@ import { readParts } from "./storage"
|
||||
import type { MessageData } from "./types"
|
||||
import { normalizeSDKResponse } from "../../shared"
|
||||
import { isSqliteBackend } from "../../shared/opencode-storage-detection"
|
||||
import { promptAsyncAfterSessionIdle } from "../shared/prompt-async-gate"
|
||||
import { dispatchInternalPrompt } from "../shared/prompt-async-gate"
|
||||
|
||||
type Client = ReturnType<typeof createOpencodeClient>
|
||||
|
||||
@@ -119,7 +119,8 @@ export async function recoverUnavailableTool(
|
||||
return false
|
||||
}
|
||||
|
||||
const promptResult = await promptAsyncAfterSessionIdle<PromptWithToolResultInput>({
|
||||
const promptResult = await dispatchInternalPrompt<PromptWithToolResultInput>({
|
||||
mode: "async",
|
||||
client,
|
||||
sessionID,
|
||||
source: "session-recovery-unavailable-tool",
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
isRealUserMessage,
|
||||
resolveInheritedPromptTools,
|
||||
} from "../../shared"
|
||||
import { promptAsyncAfterSessionIdle } from "../shared/prompt-async-gate"
|
||||
import { dispatchInternalPrompt } from "../shared/prompt-async-gate"
|
||||
import type { MessageData, ResumeConfig } from "./types"
|
||||
|
||||
const RECOVERY_RESUME_TEXT = "[session recovered - continuing previous task]"
|
||||
@@ -38,7 +38,8 @@ export async function resumeSession(client: Client, config: ResumeConfig): Promi
|
||||
: undefined
|
||||
const launchVariant = config.model?.variant
|
||||
|
||||
const promptResult = await promptAsyncAfterSessionIdle({
|
||||
const promptResult = await dispatchInternalPrompt({
|
||||
mode: "async",
|
||||
client,
|
||||
sessionID: config.sessionID,
|
||||
source: "session-recovery",
|
||||
|
||||
Reference in New Issue
Block a user