完善客户端模块与工作区能力
This commit is contained in:
15
shared/agent-session.ts
Normal file
15
shared/agent-session.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export type AgentSessionMessageRole = 'user' | 'assistant';
|
||||
|
||||
export type AgentSessionMessage = {
|
||||
id?: string;
|
||||
role: AgentSessionMessageRole;
|
||||
created_at?: string;
|
||||
text: string;
|
||||
};
|
||||
|
||||
export type AgentSessionData = {
|
||||
project_id: string;
|
||||
session_id: string;
|
||||
updated_at: string;
|
||||
messages: AgentSessionMessage[];
|
||||
};
|
||||
@@ -61,6 +61,8 @@ export type DesignConversationSummary = {
|
||||
conversationId: string;
|
||||
workspaceId: string;
|
||||
title: string;
|
||||
/** A compact preview for history navigation; full messages are loaded on selection. */
|
||||
latestMessagePreview?: string | null;
|
||||
turnRevision: number;
|
||||
phase: DesignWorkspacePhase;
|
||||
brief: DesignBrief;
|
||||
|
||||
@@ -19,6 +19,7 @@ export type ProjectAgentResponsibility = {
|
||||
export type ProjectAgentConfig = {
|
||||
id: string;
|
||||
avatarId: string;
|
||||
avatarDataUrl?: string;
|
||||
roleName: string;
|
||||
name: string;
|
||||
builtIn: boolean;
|
||||
@@ -33,6 +34,16 @@ export type ProjectAgentConfig = {
|
||||
updatedAt?: string;
|
||||
};
|
||||
|
||||
export const MAX_PROJECT_AGENT_AVATAR_DATA_URL_LENGTH = 800_000;
|
||||
|
||||
const PROJECT_AGENT_AVATAR_DATA_URL_PATTERN = /^data:image\/(?:webp|png|jpeg);base64,[A-Za-z0-9+/]+={0,2}$/u;
|
||||
|
||||
export function isProjectAgentAvatarDataUrl(value: unknown): value is string {
|
||||
return typeof value === 'string'
|
||||
&& value.length <= MAX_PROJECT_AGENT_AVATAR_DATA_URL_LENGTH
|
||||
&& PROJECT_AGENT_AVATAR_DATA_URL_PATTERN.test(value);
|
||||
}
|
||||
|
||||
export type ProjectConfig = {
|
||||
schemaVersion: 1;
|
||||
projectType: ProjectType;
|
||||
|
||||
Reference in New Issue
Block a user