清理: 业务域名注释清零与垫片生产隔离
6 处域名注释改语义化描述,src 下业务域名零残留 垫片 PROD 构建零携带,消息纪年对齐 2026-09,补 ai_list_tools 空返 分离窗口错误文案入 i18n
This commit is contained in:
+19
-11
@@ -8,7 +8,8 @@
|
||||
//! (生产 devflow.db 与开发 devflow-dev.db 均不接触),无文件系统与网络访问。
|
||||
//!
|
||||
//! 桌面壳影响面:Tauri 壳内 __TAURI_INTERNALS__ 已由宿主注入,整个模块立即返回,
|
||||
//! 桌面应用零行为变化。
|
||||
//! 桌面应用零行为变化。生产构建同样零影响:install() 首行判 PROD 直接返回,
|
||||
//! 线上包不携带假数据注入(垫片仅供 dev/e2e 浏览器环境)。
|
||||
|
||||
// 对齐 @tauri-apps/api v2.11 实际访问面(mocks.js 官方 mock 同款字段集)
|
||||
interface TauriInternals {
|
||||
@@ -37,6 +38,10 @@ interface AiConversationSummaryFixture {
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
// 消息时间戳纪年基准,与会话摘要(2026-09/10)对齐;相邻消息以毫秒偏移保持原时序
|
||||
const T_CONV1 = Date.parse('2026-09-30T09:00:00Z')
|
||||
const T_CONV2 = Date.parse('2026-09-29T09:00:00Z')
|
||||
|
||||
// 会话摘要假数据(新到旧排序,一条置顶,标题区分业务场景便于 UI 截图辨认)
|
||||
const CONVERSATIONS: AiConversationSummaryFixture[] = [
|
||||
{
|
||||
@@ -85,13 +90,13 @@ const CONV1_MESSAGES = [
|
||||
id: 'msg-mock-u1',
|
||||
role: 'user',
|
||||
content: '汇总一下进行中的任务,并看看相关项目状态',
|
||||
timestamp: 1759274400000,
|
||||
timestamp: T_CONV1,
|
||||
},
|
||||
{
|
||||
id: 'msg-mock-a1',
|
||||
role: 'assistant',
|
||||
content: '',
|
||||
timestamp: 1759274402000,
|
||||
timestamp: T_CONV1 + 2000,
|
||||
tool_calls: [
|
||||
{
|
||||
id: 'tc-mock-1',
|
||||
@@ -115,28 +120,28 @@ const CONV1_MESSAGES = [
|
||||
role: 'tool',
|
||||
tool_call_id: 'tc-mock-1',
|
||||
content: '[{"id":"task-mock-1","title":"编写无头测试基建","status":"in_progress"}]',
|
||||
timestamp: 1759274403000,
|
||||
timestamp: T_CONV1 + 3000,
|
||||
},
|
||||
{
|
||||
id: 'msg-mock-t2',
|
||||
role: 'tool',
|
||||
tool_call_id: 'tc-mock-2',
|
||||
content: '[{"id":"proj-mock-1","name":"DevFlow","status":"in_progress"}]',
|
||||
timestamp: 1759274404000,
|
||||
timestamp: T_CONV1 + 4000,
|
||||
},
|
||||
{
|
||||
id: 'msg-mock-t3',
|
||||
role: 'tool',
|
||||
tool_call_id: 'tc-mock-3',
|
||||
content: '3',
|
||||
timestamp: 1759274405000,
|
||||
timestamp: T_CONV1 + 5000,
|
||||
},
|
||||
{
|
||||
id: 'msg-mock-a2',
|
||||
role: 'assistant',
|
||||
content: '进行中的任务共 3 个,均归属 DevFlow 项目。其中「编写无头测试基建」已进入自验阶段,其余两个阻塞在依赖安装上。',
|
||||
model: 'mock-model',
|
||||
timestamp: 1759274410000,
|
||||
timestamp: T_CONV1 + 10000,
|
||||
prompt_tokens: 128,
|
||||
completion_tokens: 96,
|
||||
prompt_cache_hit_tokens: 0,
|
||||
@@ -147,14 +152,14 @@ const CONV1_MESSAGES = [
|
||||
id: 'msg-mock-u2',
|
||||
role: 'user',
|
||||
content: '把结论整理成三行以内的摘要',
|
||||
timestamp: 1759274420000,
|
||||
timestamp: T_CONV1 + 20000,
|
||||
},
|
||||
{
|
||||
id: 'msg-mock-a3',
|
||||
role: 'assistant',
|
||||
content: '1. 进行中任务 3 个,全部属于 DevFlow。\n2. 测试基建项进展最快。\n3. 其余任务等依赖安装完成即可推进。',
|
||||
model: 'mock-model',
|
||||
timestamp: 1759274425000,
|
||||
timestamp: T_CONV1 + 25000,
|
||||
prompt_tokens: 96,
|
||||
completion_tokens: 48,
|
||||
prompt_cache_hit_tokens: 64,
|
||||
@@ -168,14 +173,14 @@ const OTHER_CONV_MESSAGES = [
|
||||
id: 'msg-mock-b1',
|
||||
role: 'user',
|
||||
content: '这是一条演示用的历史消息',
|
||||
timestamp: 1759180000000,
|
||||
timestamp: T_CONV2,
|
||||
},
|
||||
{
|
||||
id: 'msg-mock-b2',
|
||||
role: 'assistant',
|
||||
content: '收到,这是浏览器测试环境的固定回复。',
|
||||
model: 'mock-model',
|
||||
timestamp: 1759180005000,
|
||||
timestamp: T_CONV2 + 5000,
|
||||
prompt_tokens: 32,
|
||||
completion_tokens: 16,
|
||||
prompt_cache_hit_tokens: 0,
|
||||
@@ -238,6 +243,7 @@ const LIST_COMMANDS = new Set([
|
||||
'knowledge_events',
|
||||
'ai_get_allowed_dirs',
|
||||
'ai_pending_tool_calls',
|
||||
'ai_list_tools',
|
||||
])
|
||||
|
||||
// 返回固定标量的命令
|
||||
@@ -291,6 +297,8 @@ function buildHandlers(): Record<string, (args: Record<string, unknown>) => unkn
|
||||
}
|
||||
|
||||
function install(): void {
|
||||
// 生产包不注入:假数据仅服务 dev/e2e 浏览器环境,线上零携带
|
||||
if (import.meta.env.PROD) return
|
||||
const internals = window as unknown as Record<string, unknown>
|
||||
|
||||
// 壳内已有宿主注入,立即退出保证桌面零影响;防重复注入(热更新场景幂等)
|
||||
|
||||
Reference in New Issue
Block a user