feat(consultation): unify server-distributed agents without fixed roles

This commit is contained in:
2026-09-24 11:56:42 +08:00
parent 248776d855
commit 8a157be4f6
35 changed files with 625 additions and 668 deletions

View File

@@ -1,7 +1,8 @@
import type { TeacherDiscussion, TeacherDiscussionContent } from './teacher-discussion';
import type { PublicUsage } from './coding-conversation-contracts';
export type ConsultationRole = 'teacher' | 'friend';
/** Only retained for locating conversations created by older clients. */
export type LegacyConsultationRole = 'teacher' | 'friend';
export const TEACHER_CHECK_IN_INTERVAL_MS = 5 * 60 * 1000;
export const TEACHER_UNCHANGED_CHECK_IN_INTERVAL_MS = 15 * 60 * 1000;
export type TeacherRequestIntent = 'question' | 'suggestions' | 'guided-help' | 'check-in';
@@ -11,7 +12,7 @@ export interface TeacherDefinition {
runtime?: 'local' | 'yuxi';
yuxi?: { agent_slug: string; agent_version: number };
schema_version: 1;
teacher_id: 'coding-teacher' | 'coding-friend';
teacher_id: string;
name: string;
description: string;
avatar_id: string;
@@ -106,7 +107,7 @@ export interface TeacherRequest {
}
export interface TeacherTopic {
discussion?: TeacherDiscussion;
role?: ConsultationRole;
role?: LegacyConsultationRole;
revision: number;
schemaVersion: 1;
id: string;
@@ -122,7 +123,7 @@ export interface TeacherTopic {
unsaved?: boolean;
}
export interface TeacherTopicList {
items: Array<{ id: string; title: string; updatedAt: string; version: number }>;
items: Array<{ id: string; title: string; updatedAt: string; version: number; legacyRole?: 'friend' }>;
lastSelectedTopicId: string | null;
}
export interface TeacherSend {