Files
next-tjwater-drainage-frontend/features/agent/types.ts
T

120 lines
2.4 KiB
TypeScript

export type AgentChatMessage = {
id: string;
role: "user" | "assistant";
content: string;
progress?: AgentChatProgress[];
permissions?: AgentPermissionRequest[];
questions?: AgentQuestionRequest[];
todos?: AgentTodoUpdate;
};
export type AgentStreamRenderChunk = {
id: number;
text: string;
};
export type AgentStreamRenderMessageState = {
chunks: AgentStreamRenderChunk[];
done: boolean;
};
export type AgentStreamRenderState = Record<string, AgentStreamRenderMessageState>;
export type AgentChatProgress = {
id: string;
phase: string;
status: "running" | "completed" | "error";
title: string;
detail?: string;
startedAt?: number;
endedAt?: number;
elapsedMs?: number;
elapsedSnapshotAt?: number;
durationMs?: number;
};
export type AgentPermissionStatus =
| "pending"
| "submitting"
| "approved_once"
| "approved_always"
| "rejected"
| "aborted"
| "error";
export type AgentPermissionReply = "once" | "always" | "reject";
export type AgentModelOption = {
id: string;
label: string;
description: string;
icon: "bolt" | "sparkle";
};
export type AgentPermissionRequest = {
requestId: string;
sessionId: string;
permission: string;
patterns: string[];
target?: string;
always: string[];
tool?: AgentInteractionToolRef;
createdAt: number;
repliedAt?: number;
status: AgentPermissionStatus;
error?: string;
};
export type AgentQuestionOption = {
label: string;
description: string;
};
export type AgentQuestionInfo = {
header: string;
question: string;
options: AgentQuestionOption[];
multiple?: boolean;
custom?: boolean;
};
export type AgentQuestionRequest = {
requestId: string;
sessionId: string;
questions: AgentQuestionInfo[];
tool?: AgentInteractionToolRef;
createdAt: number;
repliedAt?: number;
status: "pending" | "submitting" | "answered" | "rejected" | "error";
answers?: string[][];
error?: string;
};
export type AgentTodoItem = {
id: string;
content: string;
status: "pending" | "in_progress" | "completed" | "cancelled";
priority?: "low" | "medium" | "high";
createdAt?: number;
updatedAt?: number;
};
export type AgentTodoUpdate = {
sessionId: string;
messageId?: string;
todos: AgentTodoItem[];
createdAt: number;
};
export type AgentInteractionToolRef = {
messageID: string;
callID: string;
};
export type AgentUiResult = {
id: string;
sessionId: string;
createdAt: number;
envelope: import("./ui-envelope").UIEnvelope;
};