fix(hooks): switch session.prompt to promptAsync in all hooks

This commit is contained in:
Peïo Thibault
2026-02-07 13:42:24 +01:00
parent 5f21ddf473
commit 46e02b9457
8 changed files with 190 additions and 44 deletions
+1 -1
View File
@@ -484,7 +484,7 @@ export function createAtlasHook(
: undefined
}
await ctx.client.session.prompt({
await ctx.client.session.promptAsync({
path: { id: sessionID },
body: {
agent: agent ?? "atlas",
+1 -1
View File
@@ -364,7 +364,7 @@ export function createRalphLoopHook(
: undefined
}
await ctx.client.session.prompt({
await ctx.client.session.promptAsync({
path: { id: sessionID },
body: {
...(agent !== undefined ? { agent } : {}),
+2 -2
View File
@@ -75,7 +75,7 @@ function extractResumeConfig(userMessage: MessageData | undefined, sessionID: st
async function resumeSession(client: Client, config: ResumeConfig): Promise<boolean> {
try {
await client.session.prompt({
await client.session.promptAsync({
path: { id: config.sessionID },
body: {
parts: [{ type: "text", text: RECOVERY_RESUME_TEXT }],
@@ -185,7 +185,7 @@ async function recoverToolResultMissing(
}))
try {
await client.session.prompt({
await client.session.promptAsync({
path: { id: sessionID },
// @ts-expect-error - SDK types may not include tool_result parts
body: { parts: toolResultParts },
+1 -1
View File
@@ -245,7 +245,7 @@ ${todoList}`
try {
log(`[${HOOK_NAME}] Injecting continuation`, { sessionID, agent: agentName, model, incompleteCount: freshIncompleteCount })
await ctx.client.session.prompt({
await ctx.client.session.promptAsync({
path: { id: sessionID },
body: {
agent: agentName,
+10 -1
View File
@@ -25,6 +25,15 @@ type BabysitterContext = {
}
query?: { directory?: string }
}) => Promise<unknown>
promptAsync: (args: {
path: { id: string }
body: {
parts: Array<{ type: "text"; text: string }>
agent?: string
model?: { providerID: string; modelID: string }
}
query?: { directory?: string }
}) => Promise<unknown>
}
}
}
@@ -218,7 +227,7 @@ export function createUnstableAgentBabysitterHook(ctx: BabysitterContext, option
const { agent, model } = await resolveMainSessionTarget(ctx, mainSessionID)
try {
await ctx.client.session.prompt({
await ctx.client.session.promptAsync({
path: { id: mainSessionID },
body: {
...(agent ? { agent } : {}),