(ctx context.Context, state *AgentState)
| 719 | if turn.OutputTruncated { |
| 720 | recovery := HandleOutputTruncation(state, &outputRecovery, turn.ToolCalls, turn.ThinkingContent, turn.FullText, turn.MessageID, turn.InputTokens, turn.OutputTokens) |
| 721 | if recovery.ShouldContinue() { |
| 722 | continue |
| 723 | } |
| 724 | if recovery.ShouldReturn() { |
| 725 | if recovery.Event != nil { |
| 726 | sendStream(ctx, out, *recovery.Event) |
| 727 | } |
| 728 | e.LastState = state |
| 729 | sendStream(ctx, out, NewStreamEvent("done", "", nil)) |
| 730 | return |
| 731 | } |
| 732 | } |
| 733 | |
| 734 | outputRecovery.ResetRetries() |
| 735 | CommitAssistantTurn(state, turn.ThinkingContent, turn.FullText, turn.ToolCalls, turn.MessageID, turn.InputTokens, turn.OutputTokens) |
| 736 | if len(turn.ToolCalls) == 0 { |
| 737 | e.RecordSessionMemory(ctx, state, false) |
| 738 | if e.extraction != nil && |
| 739 | e.Config.LongTermMemoryEnabled && |
| 740 | isFabricMemoryBackend(e.Config) && |
| 741 | state.LastQuery != "" { |
| 742 | e.extraction.Config = e.Config |
| 743 | e.extraction.SourceSessionID = e.SessionID |
| 744 | e.extraction.SourceAgentID = e.memoryAgentType() |
| 745 | e.extraction.SourceTeamSessionID = e.TeamSessionID |
| 746 | e.extraction.SourceTeamName = e.TeamName |
| 747 | e.extraction.SourceTeamAgentID = e.TeamAgentID |
| 748 | e.extraction.Schedule(ctx, state, "") |
| 749 | } |
| 750 | e.LastState = state |
| 751 | sendStream(ctx, out, NewStreamEvent("done", "", nil)) |
no test coverage detected