@@ -1003,6 +1003,7 @@ function trimmedString(value: unknown): string | undefined {
10031003const CLAUDE_START_FRESH_AGENT_ANSWER = "Start fresh agent" ;
10041004const CLAUDE_RESUME_EXISTING_AGENT_ANSWER = "Resume existing agent" ;
10051005const CLAUDE_STOPPED_SUBAGENT_CAP = 128 ;
1006+ const CLAUDE_INTERACTIVE_HOOK_TIMEOUT_SECONDS = 60 * 60 * 24 * 7 ;
10061007
10071008function recordFromUnknown ( value : unknown ) : Record < string , unknown > | undefined {
10081009 return typeof value === "object" && value !== null && ! Array . isArray ( value )
@@ -1879,6 +1880,29 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (
18791880 } ;
18801881 } ) ;
18811882
1883+ const emitResumeCursorUpdate = Effect . fn ( "emitResumeCursorUpdate" ) ( function * (
1884+ context : ClaudeSessionContext ,
1885+ ) {
1886+ yield * updateResumeCursor ( context ) ;
1887+ if ( context . session . resumeCursor === undefined ) {
1888+ return ;
1889+ }
1890+
1891+ const configuredStamp = yield * makeEventStamp ( ) ;
1892+ yield * offerRuntimeEvent ( {
1893+ type : "session.configured" ,
1894+ eventId : configuredStamp . eventId ,
1895+ provider : PROVIDER ,
1896+ createdAt : configuredStamp . createdAt ,
1897+ threadId : context . session . threadId ,
1898+ payload : {
1899+ config : { } ,
1900+ resumeCursor : context . session . resumeCursor ,
1901+ } ,
1902+ providerRefs : { } ,
1903+ } ) ;
1904+ } ) ;
1905+
18821906 const ensureAssistantTextBlock = Effect . fn ( "ensureAssistantTextBlock" ) ( function * (
18831907 context : ClaudeSessionContext ,
18841908 blockIndex : number ,
@@ -4152,7 +4176,7 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (
41524176 }
41534177 const context = yield * Ref . get ( contextRef ) ;
41544178 if ( context ?. stoppedSubagents . delete ( hookInput . agent_id ) ) {
4155- yield * updateResumeCursor ( context ) ;
4179+ yield * emitResumeCursorUpdate ( context ) ;
41564180 }
41574181 return { } ;
41584182 } ) ;
@@ -4169,7 +4193,7 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (
41694193 agentId : hookInput . agent_id ,
41704194 agentType : trimmedString ( hookInput . agent_type ) ,
41714195 } ) ;
4172- yield * updateResumeCursor ( context ) ;
4196+ yield * emitResumeCursorUpdate ( context ) ;
41734197 }
41744198 return { } ;
41754199 } ) ;
@@ -4249,7 +4273,7 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (
42494273 : undefined ;
42504274 if ( selection === CLAUDE_RESUME_EXISTING_AGENT_ANSWER ) {
42514275 context . stoppedSubagents . delete ( stoppedSubagent . agentId ) ;
4252- yield * updateResumeCursor ( context ) ;
4276+ yield * emitResumeCursorUpdate ( context ) ;
42534277 return {
42544278 hookSpecificOutput : {
42554279 hookEventName : "PreToolUse" as const ,
@@ -4537,7 +4561,17 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* (
45374561 hooks : {
45384562 SubagentStart : [ { hooks : [ subagentStartHook ] } ] ,
45394563 SubagentStop : [ { hooks : [ subagentStopHook ] } ] ,
4540- PreToolUse : [ { matcher : "SendMessage" , hooks : [ completedSubagentMessageHook ] } ] ,
4564+ PreToolUse : [
4565+ {
4566+ matcher : "SendMessage" ,
4567+ hooks : [ completedSubagentMessageHook ] ,
4568+ // The callback waits on T3's cross-client user-input flow. The
4569+ // turn abort signal cancels it when the session closes; this
4570+ // longer backstop keeps an idle UI from silently allowing the
4571+ // SDK's ten-minute default to cancel the guard first.
4572+ timeout : CLAUDE_INTERACTIVE_HOOK_TIMEOUT_SECONDS ,
4573+ } ,
4574+ ] ,
45414575 } ,
45424576 onUserDialog,
45434577 supportedDialogKinds : [ "resume_return" ] ,
0 commit comments