mirror of
https://github.com/harivansh-afk/clanker-agent.git
synced 2026-04-16 18:03:53 +00:00
feat: add structured part events to gateway for teamActivity, media, and error parts
Extends GatewayEvent union with structured_part variants, adds matching HistoryPart types, wires SSE emission in runtime handleChat, and maps agent-core content parts to history in session-state.
This commit is contained in:
parent
a5d70ce55e
commit
4dc5e1b376
5 changed files with 165 additions and 2 deletions
|
|
@ -85,6 +85,41 @@ export function messageContentToHistoryParts(msg: AgentMessage): HistoryPart[] {
|
|||
args: toolCall.arguments,
|
||||
state: "call",
|
||||
});
|
||||
} else if (contentPart.type === "teamActivity") {
|
||||
const activity = contentPart as {
|
||||
type: "teamActivity";
|
||||
teamId: string;
|
||||
status: string;
|
||||
members?: Array<{ id: string; name: string; role?: string; status: string; message?: string }>;
|
||||
};
|
||||
parts.push({
|
||||
type: "teamActivity",
|
||||
teamId: activity.teamId,
|
||||
status: activity.status,
|
||||
members: Array.isArray(activity.members) ? activity.members : [],
|
||||
});
|
||||
} else if (contentPart.type === "image") {
|
||||
const image = contentPart as {
|
||||
type: "image";
|
||||
url: string;
|
||||
mimeType?: string;
|
||||
};
|
||||
parts.push({
|
||||
type: "media",
|
||||
url: image.url,
|
||||
mimeType: image.mimeType,
|
||||
});
|
||||
} else if (contentPart.type === "error") {
|
||||
const error = contentPart as {
|
||||
type: "error";
|
||||
code?: string;
|
||||
message: string;
|
||||
};
|
||||
parts.push({
|
||||
type: "error",
|
||||
code: typeof error.code === "string" ? error.code : "unknown",
|
||||
message: error.message,
|
||||
});
|
||||
}
|
||||
}
|
||||
return parts;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue