- 帧壳 `turnId` 在 socket 层不再被丢(`lib/ws.ts` 的 dispatchFrame 补 turnId/seq)—— 按路分桶的前提 - 并行帧组接入:`turn_begin` / `steer_ack` / `pending_ack` / `pending_drain` / `pending_full` / `chat_duplicate` ⇒ 六态 + 灰态 + `(sessionId, turnId)` 两级分桶;`appendChunk` 不再永远写尾气泡 - 多路忙态:`session_interrupted` 不再无条件当空闲(看 mode/activeTurns);`stream_end` 不再只按会话过滤 - `documents` 渲染(含 status/chars/truncated 与**逐字中文 reason**);`turnId` 历史行分组小标 - `System.tsx` 键名改正(真键 HOST/PORT/ADMIN_USERNAME/ADMIN_PASSWORD,避免照抄静默失效) - 主人档案**按平台分组** + 平台下拉 + 账号候选;**写盘仍展平数组**(后端契约不变) - 验证:tsc --noEmit ✅、npm run build ✅、22 个前端测试文件全通过(本次新增 3 文件 108 条断言) - 未做(如实):握手 history handler 与断线补拉、上行 interrupt 按钮、proactive_message/subagent_result 等帧落点、文档上传入口与图片预检、voice 管线、System 的 env 读端点
127 lines
3.2 KiB
TypeScript
127 lines
3.2 KiB
TypeScript
/**
|
|
* Public REST surface for the Cyrene v2 gateway, kept as a single import path
|
|
* (`lib/api`) so call sites never change. The implementation is split by domain
|
|
* under `lib/api/`:
|
|
*
|
|
* core.ts transport (request/ApiError) + token/role/API-key state
|
|
* auth.ts /auth/login, /health
|
|
* chat.ts /chat (sync + streaming)
|
|
* sessions.ts /sessions (list/create/delete, message history)
|
|
* messages.ts /messages/{id} (PATCH edit / DELETE)
|
|
* personas.ts /personas
|
|
* admin.ts /admin/* CRUD (personas, users, llm, rag, iot, automations…)
|
|
* adminChannels.ts /admin/channels/* (adapters, config, platform views, login)
|
|
* adminSystem.ts /admin/observability|notifications|backthink|system/*
|
|
*
|
|
* Everything below is a verbatim re-export — behaviour is unchanged.
|
|
*/
|
|
|
|
export {
|
|
ApiError,
|
|
decodeJwtRole,
|
|
getApiKey,
|
|
getAuthToken,
|
|
getStoredRole,
|
|
isNotImplemented,
|
|
isTokenExpired,
|
|
onAuthExpired,
|
|
setApiKey,
|
|
setAuthToken,
|
|
setStoredRole,
|
|
} from "./api/core";
|
|
|
|
export { health, login } from "./api/auth";
|
|
|
|
export { fetchEnums } from "./api/meta";
|
|
export type { MetaEnums } from "./api/meta";
|
|
|
|
export { chatStream, chatSync } from "./api/chat";
|
|
export type { ChatTriggerResult } from "./api/chat";
|
|
|
|
export {
|
|
createSubSession,
|
|
deleteSession,
|
|
fetchMessages,
|
|
fetchSessions,
|
|
markSessionRead,
|
|
patchSession,
|
|
} from "./api/sessions";
|
|
export type { CreateSessionResult, MessageDto, SessionPatch } from "./api/sessions";
|
|
|
|
export { deleteMessage, patchMessage } from "./api/messages";
|
|
|
|
export { fetchPersonas } from "./api/personas";
|
|
|
|
export {
|
|
adminAddLlmProvider,
|
|
adminAddMemory,
|
|
adminCreateAutomation,
|
|
adminCreatePersona,
|
|
adminCreateUser,
|
|
adminDeleteAutomation,
|
|
adminDeleteRag,
|
|
adminExportSession,
|
|
adminGetLlm,
|
|
adminGetLlmCatalog,
|
|
adminGetOwnerProfile,
|
|
adminIndexRag,
|
|
adminIoTControl,
|
|
adminIoTRule,
|
|
adminIoTScenario,
|
|
adminIssueApiKey,
|
|
adminListAutomations,
|
|
adminListChannels,
|
|
adminListInstalledPlugins,
|
|
adminListIoT,
|
|
adminListMemories,
|
|
adminListPersonas,
|
|
adminListPlugins,
|
|
adminListRag,
|
|
adminListSessions,
|
|
adminListUsers,
|
|
adminLlmUsage,
|
|
adminMemorySearch,
|
|
adminPluginInstall,
|
|
adminPluginUninstall,
|
|
adminRevokeApiKey,
|
|
adminResetLlmFromEnv,
|
|
adminRunAutomation,
|
|
adminSaveOwnerProfile,
|
|
adminSearchRag,
|
|
adminSetPluginPolicy,
|
|
adminTestLlm,
|
|
adminUpdatePersona,
|
|
} from "./api/admin";
|
|
|
|
export {
|
|
adminChannelClose,
|
|
adminChannelFriendHandle,
|
|
adminChannelLogOverview,
|
|
adminChannelMessageTest,
|
|
adminChannelMessages,
|
|
adminChannelOpen,
|
|
adminChannelPlatformFriends,
|
|
adminChannelPlatformView,
|
|
adminChannelTest,
|
|
adminDeleteChannelAccount,
|
|
adminDeleteEmptyChannelAccounts,
|
|
adminSaveChannelConfig,
|
|
adminWeixinLoginQR,
|
|
adminWeixinLoginStatus,
|
|
} from "./api/adminChannels";
|
|
export type { ChannelActionResult, ChannelConfigSaveResult } from "./api/adminChannels";
|
|
|
|
export {
|
|
adminBackthink,
|
|
adminListNotifications,
|
|
adminObservabilityAudit,
|
|
adminObservabilityLogs,
|
|
adminObservabilityMetrics,
|
|
adminObservabilityTrace,
|
|
adminSystemBackup,
|
|
adminSystemRestore,
|
|
adminSystemRevokeKeys,
|
|
adminSystemRotateJWT,
|
|
adminSystemStorage,
|
|
} from "./api/adminSystem";
|