(span: Span, output: CopilotAgentOutputMessages)
| 182 | } |
| 183 | |
| 184 | function setAgentOutputMessages(span: Span, output: CopilotAgentOutputMessages): void { |
| 185 | if (!isGenAIMessageCaptureEnabled()) return |
| 186 | const parts: GenAIAgentPart[] = [] |
| 187 | if (output.assistantText) { |
| 188 | parts.push({ type: 'text', content: output.assistantText }) |
| 189 | } |
| 190 | for (const tc of output.toolCalls ?? []) { |
| 191 | parts.push({ |
| 192 | type: 'tool_call', |
| 193 | id: tc.id, |
| 194 | name: tc.name, |
| 195 | ...(tc.arguments ? { arguments: tc.arguments } : {}), |
| 196 | }) |
| 197 | } |
| 198 | if (parts.length === 0) return |
| 199 | const serialized = marshalAgentMessages([{ role: 'assistant', parts }]) |
| 200 | if (serialized) { |
| 201 | span.setAttribute(TraceAttr.GenAiOutputMessages, serialized) |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | export type CopilotLifecycleOutcome = |
| 206 | (typeof RequestTraceV1Outcome)[keyof typeof RequestTraceV1Outcome] |
no test coverage detected