mirror of
https://github.com/warmbly/warmbly.git
synced 2026-10-27 16:02:28 +00:00
feat: add the agent transcript client and hydrated turn and block types used to rehydrate a reopened assistant conversation
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import type { AgentTranscript } from "@/lib/api/models/app/agent/Agent";
|
||||
import Request from "../../Request";
|
||||
|
||||
// Loads a session's hydrated transcript so a reopened workspace tab rehydrates
|
||||
// its conversation (and any pending approval) from the server.
|
||||
export default async function getAgentMessages(
|
||||
sessionId: string,
|
||||
): Promise<AgentTranscript> {
|
||||
return await Request<AgentTranscript>({
|
||||
method: "GET",
|
||||
url: `/ai/sessions/${sessionId}/messages`,
|
||||
authorization: true,
|
||||
});
|
||||
}
|
||||
@@ -27,6 +27,33 @@ export interface AgentSessionsPage {
|
||||
pagination: { next_cursor: string | null; has_more: boolean };
|
||||
}
|
||||
|
||||
// A persisted transcript block, hydrated server-side into the same shape the
|
||||
// live stream renders (see internal/app/aiagent HydratedBlock).
|
||||
export interface AgentHydratedBlock {
|
||||
kind: "text" | "tool";
|
||||
text?: string;
|
||||
tool?: string;
|
||||
args_summary?: string;
|
||||
result?: string;
|
||||
entity_type?: string;
|
||||
entity_id?: string;
|
||||
open_url?: string;
|
||||
done: boolean;
|
||||
}
|
||||
|
||||
export interface AgentHydratedTurn {
|
||||
role: "user" | "assistant";
|
||||
blocks: AgentHydratedBlock[];
|
||||
}
|
||||
|
||||
// GET /ai/sessions/:id/messages — a reopened session's history + any pending
|
||||
// approval, so a tab rehydrates identically to a live run.
|
||||
export interface AgentTranscript {
|
||||
title: string;
|
||||
turns: AgentHydratedTurn[];
|
||||
pending: PendingAgentTool | null;
|
||||
}
|
||||
|
||||
// AgentStreamEvent is one SSE step from a message/approval run.
|
||||
export interface AgentStreamEvent {
|
||||
type:
|
||||
|
||||
Reference in New Issue
Block a user