namespace ClawdDotNet.Core.Transcripts; /// What a transcript entry is. public static class TranscriptEntryKind { /// The task or message the run started with. public const string User = "user"; /// A follow-up the engine itself sent (empty answer, missing result line). public const string EngineNote = "engine"; /// One model response: text and/or tool calls, with the tokens of this step. public const string Assistant = "assistant"; /// The result of one tool call. public const string ToolResult = "tool_result"; /// Something that happened to the context, e.g. compaction. public const string Event = "event"; } /// One tool call as the model issued it. public sealed record TranscriptToolCall(string Id, string Name, string Arguments); /// /// One entry of a run transcript. Texts are stored as the model saw or wrote them, after /// secret scrubbing and clipping (). /// public sealed record TranscriptEntry { public string Kind { get; init; } = ""; public DateTime At { get; init; } public string? Text { get; init; } public IReadOnlyList? ToolCalls { get; init; } /// For : which call and tool. public string? ToolCallId { get; init; } public string? ToolName { get; init; } /// For : usage of this single step. public int? PromptTokens { get; init; } public int? CompletionTokens { get; init; } public int? CachedTokens { get; init; } public decimal? CostUsd { get; init; } public string? FinishReason { get; init; } /// The text was shortened to stay within the limits. public bool Clipped { get; init; } } /// /// Prompt and response of one run (#660), joined to receipts and audit via /// . The system prompt is stored once per distinct text and referenced /// by . /// public sealed record RunTranscript { public string RunId { get; init; } = ""; public string AgentId { get; init; } = ""; public string Model { get; init; } = ""; public string Source { get; init; } = ""; public string? TaskId { get; init; } public DateTime StartedAt { get; init; } public DateTime? CompletedAt { get; init; } public string Status { get; init; } = ""; public string? SystemPromptHash { get; init; } /// The task or message as written, for lists. Falls back to the first user entry. public string? PromptPreview { get; init; } public IReadOnlyList Entries { get; init; } = []; /// Characters stored, after clipping. public int SizeChars { get; init; } /// The run exceeded the size limit; later entries are shortened or omitted. public bool Truncated { get; init; } } /// A transcript without its entries — for lists. public sealed record RunTranscriptSummary( string RunId, string AgentId, string Model, string Source, string? TaskId, DateTime StartedAt, DateTime? CompletedAt, string Status, string Prompt, string Response, int SizeChars, bool Truncated); /// Filter for . public sealed record TranscriptQuery { public string? AgentId { get; init; } public DateTime? From { get; init; } public DateTime? To { get; init; } /// Full text over the whole transcript. public string? Search { get; init; } public int Limit { get; init; } = 50; public int Offset { get; init; } }