mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-10 02:15:02 +00:00
Paseo tool rows put the variable part first ("QA messenger finished"), so
truncation hid the fixed part, and MCP calls showed only the humanized tool
name with no context. Every Paseo tool now has one catalog entry in
protocol/paseo-tool-presentation owning its fixed label, the input field
shown as context, and its detail layout. Agent-message events read
noun-first ("Agent finished" + sender) and use the Paseo icon; the app
ignored it before because the wire detail's legacy "bot" icon won.
Summaries are capped in code at 120 characters because prompts can be one
enormous line; the renderer is not trusted to clip them.
The activity curator behind `paseo logs` and get_agent_activity printed a
bare "[Agent message]" because the server tool-call type never declared the
agentMessage field the projection sets; it now prints the event, sender,
and body.
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import type { AgentMessage } from "../agent-message.js";
|
|
import type { ToolCallDetail } from "../agent-types.js";
|
|
import { toSummaryText } from "./summary-text.js";
|
|
|
|
export interface AgentMessageDisplay {
|
|
displayName: string;
|
|
summary?: string;
|
|
detail: ToolCallDetail;
|
|
}
|
|
|
|
/** Events read noun-first ("Agent finished"); the sender goes in the summary. */
|
|
const EVENT_LABELS: Record<AgentMessage["event"], string> = {
|
|
message: "Message received",
|
|
finished: "Agent finished",
|
|
errored: "Agent errored",
|
|
"permission-required": "Agent needs permission",
|
|
closed: "Agent closed",
|
|
};
|
|
|
|
/** Presentation shared by clients; never used to encode provider prompts. */
|
|
export function buildAgentMessageDisplay(message: AgentMessage): AgentMessageDisplay {
|
|
const summary = toSummaryText(message.sender.title ?? message.sender.id);
|
|
return {
|
|
displayName: EVENT_LABELS[message.event],
|
|
...(summary ? { summary } : {}),
|
|
detail: {
|
|
type: "plain_text",
|
|
text: `From agent: ${message.sender.id}\n\n${message.text}`,
|
|
},
|
|
};
|
|
}
|