Broadcast submitted user prompts

This commit is contained in:
Federico Jaramillo Martinez
2026-05-08 16:17:22 +02:00
parent 7847858143
commit a0338ab6a7
5 changed files with 8 additions and 2 deletions
+1
View File
@@ -4,6 +4,7 @@ import { appendShellChunk, finalizeShellMessage, shellStartMessage } from "./she
import type { SessionUiEvent } from "./sessionSocket";
export function applyTranscriptEvent(messages: ChatLine[], event: SessionUiEvent): ChatLine[] | undefined {
if (event.type === "message.append") return appendNormalized(messages, event.message);
if (event.type === "assistant.delta") return appendText(messages, "assistant", event.text);
if (event.type === "tool.start") return appendNormalized(messages, { role: "assistant", content: [{ type: "toolCall", name: event.toolName, arguments: event.args }] });
if (event.type === "tool.end") return appendNormalized(messages, { role: "toolResult", toolName: event.toolName, content: event.content ?? [{ type: "text", text: event.text }], isError: event.isError });
@@ -110,7 +110,6 @@ export class SessionController {
if (isShellInput(text)) return this.runShell(text);
const session = this.getState().selectedSession;
if (!session || session.archived === true) return;
this.setState({ messages: [...this.getState().messages, textMessage("user", text)] });
try {
await api.prompt(session.id, text, streamingBehavior);
} catch (error) {
+1 -1
View File
@@ -114,7 +114,7 @@ export class GlobalSessionSocket {
function isSessionUiEvent(event: unknown): event is SessionUiEvent {
const type = eventType(event);
return ["assistant.delta", "tool.start", "tool.end", "shell.start", "shell.chunk", "shell.end", "agent.start", "agent.end", "message.end", "status.update", "activity.update", "command.output", "session.error", "session.name", "pi.event"].includes(type);
return ["message.append", "assistant.delta", "tool.start", "tool.end", "shell.start", "shell.chunk", "shell.end", "agent.start", "agent.end", "message.end", "status.update", "activity.update", "command.output", "session.error", "session.name", "pi.event"].includes(type);
}
function isGlobalSessionEvent(event: unknown): event is GlobalSessionEvent {