@@ -1769,6 +1769,8 @@ interface ActiveClaudeSubagent {
17691769 readonly turnItemId : OrchestrationV2TurnItem [ "id" ] ;
17701770 readonly turnItemOrdinal : number ;
17711771 nextChildItemOrdinal : number ;
1772+ progressItemOrdinal : number | null ;
1773+ progressStartedAt : DateTime . Utc | null ;
17721774 resultItemOrdinal : number | null ;
17731775}
17741776
@@ -2038,6 +2040,7 @@ export function makeClaudeAdapterV2(
20382040 readonly toolUseId ?: string ;
20392041 readonly prompt ?: string ;
20402042 readonly title ?: string ;
2043+ readonly progress ?: string ;
20412044 readonly result ?: string ;
20422045 readonly status : Extract <
20432046 OrchestrationV2ExecutionNode [ "status" ] ,
@@ -2052,6 +2055,8 @@ export function makeClaudeAdapterV2(
20522055 if ( existingSubagent === undefined && input . status !== "running" ) {
20532056 return ;
20542057 }
2058+ const lifecycleChanged =
2059+ existingSubagent === undefined || existingSubagent . task . status !== input . status ;
20552060
20562061 const now = yield * DateTime . now ;
20572062 const nativeItemId = `task:${ input . taskId } ` ;
@@ -2105,6 +2110,7 @@ export function makeClaudeAdapterV2(
21052110 status : input . status ,
21062111 ...( input . prompt === undefined ? { } : { prompt : input . prompt } ) ,
21072112 ...( input . title === undefined ? { } : { title : input . title } ) ,
2113+ ...( input . progress === undefined ? { } : { progress : input . progress } ) ,
21082114 ...( input . result === undefined ? { } : { result : input . result } ) ,
21092115 completedAt : input . status === "running" ? null : now ,
21102116 updatedAt : now ,
@@ -2121,6 +2127,8 @@ export function makeClaudeAdapterV2(
21212127 } ) ,
21222128 turnItemOrdinal,
21232129 nextChildItemOrdinal : existingSubagent ?. nextChildItemOrdinal ?? 100 ,
2130+ progressItemOrdinal : existingSubagent ?. progressItemOrdinal ?? null ,
2131+ progressStartedAt : existingSubagent ?. progressStartedAt ?? null ,
21242132 resultItemOrdinal : existingSubagent ?. resultItemOrdinal ?? null ,
21252133 } satisfies ActiveClaudeSubagent ;
21262134 input . context . subagentsByTaskId . set ( input . taskId , subagent ) ;
@@ -2153,52 +2161,54 @@ export function makeClaudeAdapterV2(
21532161 } ) ;
21542162 }
21552163
2156- yield * emitProviderEvent ( {
2157- type : "node.updated" ,
2158- driver : CLAUDE_PROVIDER ,
2159- node : {
2160- id : nodeId ,
2161- threadId : input . context . input . threadId ,
2162- runId : input . context . input . runId ,
2163- parentNodeId : input . context . input . rootNodeId ,
2164- rootNodeId : input . context . input . rootNodeId ,
2165- kind : "subagent" ,
2166- status : input . status ,
2167- countsForRun : false ,
2168- providerThreadId : input . context . input . providerThread . id ,
2169- providerTurnId : input . context . providerTurnId ,
2170- nativeItemRef : {
2171- driver : CLAUDE_PROVIDER ,
2172- nativeId : input . taskId ,
2173- strength : "strong" ,
2164+ if ( lifecycleChanged ) {
2165+ yield * emitProviderEvent ( {
2166+ type : "node.updated" ,
2167+ driver : CLAUDE_PROVIDER ,
2168+ node : {
2169+ id : nodeId ,
2170+ threadId : input . context . input . threadId ,
2171+ runId : input . context . input . runId ,
2172+ parentNodeId : input . context . input . rootNodeId ,
2173+ rootNodeId : input . context . input . rootNodeId ,
2174+ kind : "subagent" ,
2175+ status : input . status ,
2176+ countsForRun : false ,
2177+ providerThreadId : input . context . input . providerThread . id ,
2178+ providerTurnId : input . context . providerTurnId ,
2179+ nativeItemRef : {
2180+ driver : CLAUDE_PROVIDER ,
2181+ nativeId : input . taskId ,
2182+ strength : "strong" ,
2183+ } ,
2184+ runtimeRequestId : null ,
2185+ checkpointScopeId : null ,
2186+ startedAt : task . startedAt ,
2187+ completedAt : input . status === "running" ? null : now ,
21742188 } ,
2175- runtimeRequestId : null ,
2176- checkpointScopeId : null ,
2177- startedAt : task . startedAt ,
2178- completedAt : input . status === "running" ? null : now ,
2179- } ,
2180- } ) ;
2181- yield * emitProviderEvent ( {
2182- type : "node.updated" ,
2183- driver : CLAUDE_PROVIDER ,
2184- node : {
2185- id : childRootNodeId ,
2186- threadId : childThreadId ,
2187- runId : null ,
2188- parentNodeId : null ,
2189- rootNodeId : childRootNodeId ,
2190- kind : "root_turn" ,
2191- status : input . status ,
2192- countsForRun : false ,
2193- providerThreadId : null ,
2194- providerTurnId : null ,
2195- nativeItemRef : task . nativeTaskRef ,
2196- runtimeRequestId : null ,
2197- checkpointScopeId : null ,
2198- startedAt : task . startedAt ,
2199- completedAt : input . status === "running" ? null : now ,
2200- } ,
2201- } ) ;
2189+ } ) ;
2190+ yield * emitProviderEvent ( {
2191+ type : "node.updated" ,
2192+ driver : CLAUDE_PROVIDER ,
2193+ node : {
2194+ id : childRootNodeId ,
2195+ threadId : childThreadId ,
2196+ runId : null ,
2197+ parentNodeId : null ,
2198+ rootNodeId : childRootNodeId ,
2199+ kind : "root_turn" ,
2200+ status : input . status ,
2201+ countsForRun : false ,
2202+ providerThreadId : null ,
2203+ providerTurnId : null ,
2204+ nativeItemRef : task . nativeTaskRef ,
2205+ runtimeRequestId : null ,
2206+ checkpointScopeId : null ,
2207+ startedAt : task . startedAt ,
2208+ completedAt : input . status === "running" ? null : now ,
2209+ } ,
2210+ } ) ;
2211+ }
22022212 if ( existingSubagent === undefined ) {
22032213 const promptNativeItemId = `${ nativeItemId } :prompt` ;
22042214 const promptArtifacts = makeSubagentConversationArtifacts ( {
@@ -2265,10 +2275,55 @@ export function makeClaudeAdapterV2(
22652275 providerInstanceId : task . providerInstanceId ,
22662276 childThreadId : task . childThreadId ,
22672277 prompt : task . prompt ,
2278+ ...( task . progress === undefined ? { } : { progress : task . progress } ) ,
22682279 result : task . result ,
22692280 } ,
22702281 } ) ;
22712282
2283+ const progress = task . progress ?. trim ( ) ;
2284+ if (
2285+ progress !== undefined &&
2286+ progress . length > 0 &&
2287+ ( input . progress !== undefined || ( lifecycleChanged && input . status !== "running" ) )
2288+ ) {
2289+ const progressNativeItemId = `${ nativeItemId } :progress` ;
2290+ const progressItemOrdinal =
2291+ subagent . progressItemOrdinal ?? ++ subagent . nextChildItemOrdinal ;
2292+ const progressStartedAt = subagent . progressStartedAt ?? now ;
2293+ subagent . progressItemOrdinal = progressItemOrdinal ;
2294+ subagent . progressStartedAt = progressStartedAt ;
2295+ yield * emitProviderEvent ( {
2296+ type : "turn_item.updated" ,
2297+ driver : CLAUDE_PROVIDER ,
2298+ turnItem : {
2299+ id : idAllocator . derive . turnItemFromProviderItem ( {
2300+ driver : CLAUDE_PROVIDER ,
2301+ nativeItemId : progressNativeItemId ,
2302+ } ) ,
2303+ threadId : childThreadId ,
2304+ runId : null ,
2305+ nodeId : childRootNodeId ,
2306+ providerThreadId : null ,
2307+ providerTurnId : null ,
2308+ nativeItemRef : {
2309+ driver : CLAUDE_PROVIDER ,
2310+ nativeId : progressNativeItemId ,
2311+ strength : "strong" ,
2312+ } ,
2313+ parentItemId : null ,
2314+ ordinal : progressItemOrdinal ,
2315+ status : input . status ,
2316+ title : "Subagent progress" ,
2317+ startedAt : progressStartedAt ,
2318+ completedAt : input . status === "running" ? null : now ,
2319+ updatedAt : now ,
2320+ type : "reasoning" ,
2321+ text : progress ,
2322+ streaming : input . status === "running" ,
2323+ } ,
2324+ } ) ;
2325+ }
2326+
22722327 if (
22732328 input . result !== undefined &&
22742329 input . result . trim ( ) . length > 0 &&
@@ -2670,6 +2725,19 @@ export function makeClaudeAdapterV2(
26702725 } ) ;
26712726 }
26722727
2728+ if ( message . type === "system" && message . subtype === "task_progress" ) {
2729+ const progress = message . description . trim ( ) ;
2730+ if ( progress . length > 0 ) {
2731+ yield * updateClaudeSubagentNode ( {
2732+ context,
2733+ taskId : message . task_id ,
2734+ ...( message . tool_use_id === undefined ? { } : { toolUseId : message . tool_use_id } ) ,
2735+ progress,
2736+ status : "running" ,
2737+ } ) ;
2738+ }
2739+ }
2740+
26732741 if ( message . type === "system" && message . subtype === "task_notification" ) {
26742742 yield * updateClaudeSubagentNode ( {
26752743 context,
0 commit comments