Merge remote main preserving project chats and reply recovery
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-09-28 20:51:33 +08:00
54 changed files with 3189 additions and 1713 deletions

View File

@@ -8,7 +8,7 @@ import {
} from '../route-utils';
import { TeacherError } from '../../coding-teacher/config-client';
import type { TeacherScope } from '../../coding-teacher/service';
import type { TeacherCheckInInput, TeacherDiscussionAction, TeacherSend } from '../../../shared/coding-teacher';
import type { TeacherCheckInInput, TeacherSend } from '../../../shared/coding-teacher';
import { takeTeacherPreviewRevision } from '../../main/app-deep-link';
export async function handleCodingTeacherRoutes(
@@ -18,15 +18,15 @@ export async function handleCodingTeacherRoutes(
ctx: HostApiContext
): Promise<boolean> {
const legacy = url.pathname.match(/^\/api\/coding\/projects\/([^/]+)\/agent-history(?:\/([^/]+))?$/);
const conversation = url.pathname.match(/^\/api\/coding\/projects\/([^/]+)\/agent-conversations\/([^/]+)(?:\/(messages|events|save|seen|discussion|requests\/([^/]+)\/cancel))?$/);
const conversation = url.pathname.match(/^\/api\/coding\/projects\/([^/]+)\/agent-conversations\/([^/]+)(?:\/(messages|events|save|seen|requests\/([^/]+)\/cancel))?$/);
const source = url.pathname.match(
/^\/api\/coding\/projects\/([^/]+)\/conversations\/([^/]+)\/teacher-topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/projects\/([^/]+)\/conversations\/([^/]+)\/teacher-topics(?:\/([^/]+))?(?:\/(messages|events|save|requests\/([^/]+)\/cancel))?$/
);
const preview = url.pathname.match(
/^\/api\/coding\/teacher-preview\/topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/teacher-preview\/topics(?:\/([^/]+))?(?:\/(messages|events|save|requests\/([^/]+)\/cancel))?$/
);
const projectTopics = url.pathname.match(
/^\/api\/coding\/projects\/([^/]+)\/(agent|teacher|friend)-topics(?:\/([^/]+))?(?:\/(messages|events|save|discussion|requests\/([^/]+)\/cancel))?$/
/^\/api\/coding\/projects\/([^/]+)\/(agent|teacher|friend)-topics(?:\/([^/]+))?(?:\/(messages|events|save|requests\/([^/]+)\/cancel))?$/
);
const checkIn = url.pathname.match(/^\/api\/coding\/projects\/([^/]+)\/teacher-check-in$/);
const role = projectTopics?.[2] === 'friend' ? 'friend' : undefined;
@@ -124,10 +124,6 @@ export async function handleCodingTeacherRoutes(
sendJson(res, 202, await service.send(scope, id, await parseJsonBody<TeacherSend>(req)));
return true;
}
if (id && action === 'discussion' && req.method === 'POST') {
sendJson(res, 200, await service.updateDiscussion(scope, id, await parseJsonBody<TeacherDiscussionAction>(req)));
return true;
}
if (id && action === 'save' && req.method === 'POST') {
sendJson(res, 200, await service.save(scope, id));
return true;