| ... | ... | @@ -267,7 +267,6 @@ interface ClaudeTurnState { |
| 267 | 267 | * steered instead (the queued message continues the same turn). |
| 268 | 268 | */ |
| 269 | 269 | readonly synthetic?: boolean; |
| 270 | | readonly items: Array<unknown>; |
| 271 | 270 | readonly assistantTextBlocks: Map<number, AssistantTextBlockState>; |
| 272 | 271 | readonly assistantTextBlockOrder: Array<AssistantTextBlockState>; |
| 273 | 272 | readonly capturedProposedPlanKeys: Set<string>; |
| ... | ... | @@ -422,10 +421,11 @@ interface ClaudeSessionContext { |
| 422 | 421 | resumeSessionId: string | undefined; |
| 423 | 422 | readonly pendingApprovals: Map<ApprovalRequestId, PendingApproval>; |
| 424 | 423 | readonly pendingUserInputs: Map<ApprovalRequestId, PendingUserInput>; |
| 425 | | readonly turns: Array<{ |
| 426 | | id: TurnId; |
| 427 | | items: Array<unknown>; |
| 428 | | }>; |
| 424 | /** Completed turn ids, reported by readThread and trimmed on rollback. |
| 425 | * SDK messages are not kept: rollback reads Claude's own history through |
| 426 | * turnStartMessageIds, and a long-lived session would otherwise hold every |
| 427 | * message it ever produced. */ |
| 428 | readonly turns: Array<{ readonly id: TurnId }>; |
| 429 | 429 | readonly inFlightTools: Map<number, ToolInFlight>; |
| 430 | 430 | readonly claudeTasks: Map<string, ClaudeTaskState>; |
| 431 | 431 | readonly taskAgents: Map<string, ClaudeTaskAgentState>; |
| ... | ... | @@ -2176,10 +2176,7 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* ( |
| 2176 | 2176 | } |
| 2177 | 2177 | return { |
| 2178 | 2178 | threadId, |
| 2179 | | turns: context.turns.map((turn) => ({ |
| 2180 | | id: turn.id, |
| 2181 | | items: [...turn.items], |
| 2182 | | })), |
| 2179 | turns: context.turns.map((turn) => ({ id: turn.id, items: [] })), |
| 2183 | 2180 | }; |
| 2184 | 2181 | }); |
| 2185 | 2182 | |
| ... | ... | @@ -2808,10 +2805,7 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* ( |
| 2808 | 2805 | }); |
| 2809 | 2806 | } |
| 2810 | 2807 | |
| 2811 | | context.turns.push({ |
| 2812 | | id: turnState.turnId, |
| 2813 | | items: [...turnState.items], |
| 2814 | | }); |
| 2808 | context.turns.push({ id: turnState.turnId }); |
| 2815 | 2809 | |
| 2816 | 2810 | yield* emitThreadTokenUsage(context, usageSnapshot, { |
| 2817 | 2811 | rawMethod: "claude/result", |
| ... | ... | @@ -3175,10 +3169,6 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* ( |
| 3175 | 3169 | return; |
| 3176 | 3170 | } |
| 3177 | 3171 | |
| 3178 | | if (context.turnState) { |
| 3179 | | context.turnState.items.push(message.message); |
| 3180 | | } |
| 3181 | | |
| 3182 | 3172 | for (const toolResult of toolResultBlocksFromUserMessage(message)) { |
| 3183 | 3173 | const toolEntry = Array.from(context.inFlightTools.entries()).find( |
| 3184 | 3174 | ([, tool]) => tool.itemId === toolResult.toolUseId, |
| ... | ... | @@ -3378,7 +3368,6 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* ( |
| 3378 | 3368 | turnId, |
| 3379 | 3369 | startedAt, |
| 3380 | 3370 | synthetic: true, |
| 3381 | | items: [], |
| 3382 | 3371 | assistantTextBlocks: new Map(), |
| 3383 | 3372 | assistantTextBlockOrder: [], |
| 3384 | 3373 | capturedProposedPlanKeys: new Set(), |
| ... | ... | @@ -3461,7 +3450,6 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* ( |
| 3461 | 3450 | cwd: path.resolve(context.session.cwd ?? "."), |
| 3462 | 3451 | }); |
| 3463 | 3452 | } |
| 3464 | | context.turnState.items.push(message.message); |
| 3465 | 3453 | if ( |
| 3466 | 3454 | normalizeClaudeActiveTokenUsage( |
| 3467 | 3455 | message.message.usage, |
| ... | ... | @@ -5205,7 +5193,6 @@ export const makeClaudeAdapter = Effect.fn("makeClaudeAdapter")(function* ( |
| 5205 | 5193 | const turnState: ClaudeTurnState = { |
| 5206 | 5194 | turnId, |
| 5207 | 5195 | startedAt: yield* nowIso, |
| 5208 | | items: [], |
| 5209 | 5196 | assistantTextBlocks: new Map(), |
| 5210 | 5197 | assistantTextBlockOrder: [], |
| 5211 | 5198 | capturedProposedPlanKeys: new Set(), |