trajectorySourceBlock function
Projects one content block into a details-panel source block.
Implementation
TrajectorySourceBlock trajectorySourceBlock(ContentBlock block) {
return switch (block) {
TextContent(:final text) => TrajectorySourceBlock(
type: 'text',
content: text,
),
ThinkingContent(:final thinking) => TrajectorySourceBlock(
type: 'thinking',
content: thinking,
),
ToolCall(
:final id,
:final name,
:final arguments,
:final partialArguments,
) =>
TrajectorySourceBlock(
type: 'tool-call',
content: partialArguments ?? jsonEncode(arguments),
callId: id,
toolName: name,
),
ImageContent(:final mimeType) => TrajectorySourceBlock(
type: 'image',
content: '',
attachmentName: mimeType,
),
};
}