@jingyi0605/codingns4dsh 0.2.1-beta.7 → 0.2.1-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +3 -3
- package/README.md +5 -3
- package/data/build/dist/client/avatar/desktop-bridge.js +1 -1
- package/data/build/dist/client/avatar/desktop-bridge.js.map +1 -1
- package/data/build/dist/client/avatar/desktop-view.d.ts +4 -2
- package/data/build/dist/client/avatar/desktop-view.d.ts.map +1 -1
- package/data/build/dist/client/avatar/desktop-view.js +25 -9
- package/data/build/dist/client/avatar/desktop-view.js.map +1 -1
- package/data/build/dist/client/avatar/floating.d.ts +5 -2
- package/data/build/dist/client/avatar/floating.d.ts.map +1 -1
- package/data/build/dist/client/avatar/floating.js +16 -5
- package/data/build/dist/client/avatar/floating.js.map +1 -1
- package/data/build/dist/client/avatar/notification-bubble.d.ts +18 -5
- package/data/build/dist/client/avatar/notification-bubble.d.ts.map +1 -1
- package/data/build/dist/client/avatar/notification-bubble.js +208 -56
- package/data/build/dist/client/avatar/notification-bubble.js.map +1 -1
- package/data/build/dist/client/avatar/notification-surface.d.ts +16 -0
- package/data/build/dist/client/avatar/notification-surface.d.ts.map +1 -0
- package/data/build/dist/client/avatar/notification-surface.js +54 -0
- package/data/build/dist/client/avatar/notification-surface.js.map +1 -0
- package/data/build/dist/client/avatar/reaction-badge.d.ts.map +1 -1
- package/data/build/dist/client/avatar/reaction-badge.js +11 -2
- package/data/build/dist/client/avatar/reaction-badge.js.map +1 -1
- package/data/build/dist/client/bundle.js +1131 -392
- package/data/build/dist/client/bundle.js.map +1 -1
- package/data/build/dist/client/client.assistant-notifications.js.map +1 -1
- package/data/build/dist/client/client.assistant-workbench.js +235 -109
- package/data/build/dist/client/client.assistant-workbench.js.map +1 -1
- package/data/build/dist/client/client.manager.js +46 -9
- package/data/build/dist/client/client.manager.js.map +1 -1
- package/data/build/dist/client/client.native-workspace-store.js +1 -1
- package/data/build/dist/client/client.native-workspace-store.js.map +1 -1
- package/data/build/dist/client/client.theme.js +2 -0
- package/data/build/dist/client/client.theme.js.map +1 -1
- package/data/build/dist/client/client.transport.js +37 -9
- package/data/build/dist/client/client.transport.js.map +1 -1
- package/data/build/dist/client/desktop-assistant.js +57743 -359
- package/data/build/dist/client/features/assistant-conversation-message.d.ts +2 -1
- package/data/build/dist/client/features/assistant-conversation-message.d.ts.map +1 -1
- package/data/build/dist/client/features/assistant-conversation-message.js +59 -24
- package/data/build/dist/client/features/assistant-conversation-message.js.map +1 -1
- package/data/build/dist/client/features/assistant-notification-store.d.ts +7 -1
- package/data/build/dist/client/features/assistant-notification-store.d.ts.map +1 -1
- package/data/build/dist/client/features/assistant-notification-store.js +44 -0
- package/data/build/dist/client/features/assistant-notification-store.js.map +1 -1
- package/data/build/dist/client/features/assistant-record-style.js +11 -4
- package/data/build/dist/client/features/assistant-record-style.js.map +1 -1
- package/data/build/dist/client/features/assistant-workbench.d.ts +4 -0
- package/data/build/dist/client/features/assistant-workbench.d.ts.map +1 -1
- package/data/build/dist/client/features/assistant-workbench.js +27 -1
- package/data/build/dist/client/features/assistant-workbench.js.map +1 -1
- package/data/build/dist/client/features/global-voice-assistant.d.ts.map +1 -1
- package/data/build/dist/client/features/global-voice-assistant.js +36 -4
- package/data/build/dist/client/features/global-voice-assistant.js.map +1 -1
- package/data/build/dist/client/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/client/features/peer-host.js +33 -2
- package/data/build/dist/client/features/peer-host.js.map +1 -1
- package/data/build/dist/client/locales/assistantWorkbench.d.ts +17 -3
- package/data/build/dist/client/locales/assistantWorkbench.d.ts.map +1 -1
- package/data/build/dist/client/locales/assistantWorkbench.js +15 -11
- package/data/build/dist/client/locales/assistantWorkbench.js.map +1 -1
- package/data/build/dist/client/peer-host-native-projection.d.ts +4 -0
- package/data/build/dist/client/peer-host-native-projection.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-native-projection.js +40 -1
- package/data/build/dist/client/peer-host-native-projection.js.map +1 -1
- package/data/build/dist/client/peer-host-remote-events.d.ts +14 -0
- package/data/build/dist/client/peer-host-remote-events.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-remote-events.js +92 -3
- package/data/build/dist/client/peer-host-remote-events.js.map +1 -1
- package/data/build/dist/client/style.css +2561 -0
- package/data/build/dist/client/subscription-slot.d.ts.map +1 -1
- package/data/build/dist/client/subscription-slot.js +5 -1
- package/data/build/dist/client/subscription-slot.js.map +1 -1
- package/data/build/dist/client/theme.d.ts +2 -0
- package/data/build/dist/client/theme.d.ts.map +1 -1
- package/data/build/dist/client/theme.js +3 -0
- package/data/build/dist/client/theme.js.map +1 -1
- package/data/build/dist/client/workspace-session-visibility-dom.d.ts.map +1 -1
- package/data/build/dist/client/workspace-session-visibility-dom.js +22 -10
- package/data/build/dist/client/workspace-session-visibility-dom.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/assistant-session-navigation-adapter.d.ts +9 -1
- package/data/build/dist/dsh-capabilities/client/assistant-session-navigation-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/assistant-session-navigation-adapter.js +39 -0
- package/data/build/dist/dsh-capabilities/client/assistant-session-navigation-adapter.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts +1 -0
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.js +7 -0
- package/data/build/dist/host/cli-adapters/codex-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-file-citations.d.ts +13 -0
- package/data/build/dist/host/cli-adapters/codex-file-citations.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/codex-file-citations.js +271 -0
- package/data/build/dist/host/cli-adapters/codex-file-citations.js.map +1 -0
- package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts +2 -1
- package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js +16 -5
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.js +1 -0
- package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.js +20 -3
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.js.map +1 -1
- package/data/build/dist/host/desktop-assistant/controller.d.ts +2 -0
- package/data/build/dist/host/desktop-assistant/controller.d.ts.map +1 -1
- package/data/build/dist/host/desktop-assistant/controller.js +28 -1
- package/data/build/dist/host/desktop-assistant/controller.js.map +1 -1
- package/data/build/dist/host/features/assistant-management-tools.d.ts +2 -1
- package/data/build/dist/host/features/assistant-management-tools.d.ts.map +1 -1
- package/data/build/dist/host/features/assistant-management-tools.js +10 -3
- package/data/build/dist/host/features/assistant-management-tools.js.map +1 -1
- package/data/build/dist/host/features/assistant-notification-events.js +1 -1
- package/data/build/dist/host/features/assistant-notification-events.js.map +1 -1
- package/data/build/dist/host/features/assistant-notifications.d.ts +8 -1
- package/data/build/dist/host/features/assistant-notifications.d.ts.map +1 -1
- package/data/build/dist/host/features/assistant-notifications.js +105 -11
- package/data/build/dist/host/features/assistant-notifications.js.map +1 -1
- package/data/build/dist/host/features/global-voice-rpc.d.ts +2 -2
- package/data/build/dist/host/features/global-voice-rpc.d.ts.map +1 -1
- package/data/build/dist/host/features/global-voice-rpc.js +89 -2
- package/data/build/dist/host/features/global-voice-rpc.js.map +1 -1
- package/data/build/dist/host/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/host/features/peer-host.js +34 -5
- package/data/build/dist/host/features/peer-host.js.map +1 -1
- package/data/build/dist/host/features/types.d.ts +3 -1
- package/data/build/dist/host/features/types.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.d.ts +7 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.js +23 -4
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.js.map +1 -1
- package/data/build/dist/host/native-session-bridge.d.ts.map +1 -1
- package/data/build/dist/host/native-session-bridge.js +22 -9
- package/data/build/dist/host/native-session-bridge.js.map +1 -1
- package/data/build/dist/host/rpc.js +1 -1
- package/data/build/dist/host/rpc.js.map +1 -1
- package/data/build/dist/shared/assistant-message-timeline.d.ts +11 -0
- package/data/build/dist/shared/assistant-message-timeline.d.ts.map +1 -1
- package/data/build/dist/shared/assistant-message-timeline.js +19 -0
- package/data/build/dist/shared/assistant-message-timeline.js.map +1 -1
- package/data/build/dist/shared/assistant-notifications.d.ts +34 -0
- package/data/build/dist/shared/assistant-notifications.d.ts.map +1 -1
- package/data/build/dist/shared/assistant-notifications.js +8 -0
- package/data/build/dist/shared/assistant-notifications.js.map +1 -1
- package/data/build/dist/shared/assistant-session-messages.d.ts +13 -0
- package/data/build/dist/shared/assistant-session-messages.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-session-messages.js +155 -0
- package/data/build/dist/shared/assistant-session-messages.js.map +1 -0
- package/data/build/dist/shared/contracts/assistant.d.ts +13 -0
- package/data/build/dist/shared/contracts/assistant.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/version.d.ts +1 -1
- package/data/build/dist/shared/contracts/version.js +1 -1
- package/data/build/dist/shared/desktop-assistant.d.ts +2 -1
- package/data/build/dist/shared/desktop-assistant.d.ts.map +1 -1
- package/data/build/dist/shared/desktop-assistant.js +21 -9
- package/data/build/dist/shared/desktop-assistant.js.map +1 -1
- package/package.json +16 -14
- package/profile/README.md +2 -2
- package/profile/package.json +2 -2
- package/profile/version.json +1 -1
- package/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.assistant-notifications.js","names":[],"sources":["../../../../src/shared/assistant-prompts.ts","../../../../src/shared/assistant-notifications.ts"],"sourcesContent":["/** 两个阶段独立保存提示词;缺省或清空时使用面向语音的默认值。 */\nexport interface AssistantPromptSettings {\n readonly index: string\n readonly chat: string\n}\n\nexport const ASSISTANT_PROMPT_MAX_CHARS = 8000\n\n// 旧默认值会随设置持久化;只升级完整匹配的默认文本,保留用户自行编辑的提示词。\nconst LEGACY_DEFAULT_CHAT_PROMPTS = new Set([\n '请用简洁的中文口语回答,适合直接朗读。先直接回应用户的问题,通常用一到四个短句;用户明确要求细节时再适当展开。不要使用标题、编号、列表、表格、Markdown、排比或套话,不要机械复述整份索引。提到项目时使用容易理解的名称,优先说明当前进展、实际阻碍和需要用户处理的下一步。',\n '请用简短的中文口语回答,适合直接朗读。默认只说一到两个短句,总长度控制在100字以内,每句只表达一个重点。先给结论,再说最重要的处理动作;用户明确要求全部事项或细节时才展开。只回答当前问题,不复述背景、完整日志或附加建议。不要使用标题、编号、列表、表格、Markdown、排比或套话。项目多时优先说明最紧急的事项,用简短名称定位。',\n])\n\nexport const DEFAULT_ASSISTANT_PROMPTS: AssistantPromptSettings = {\n index: '请按固定结构提取每个会话的目标、进展、阻碍、待办、下一步和信息缺口,供全局助理后续问答使用。每个字段用具体、简短的中文口语,不要排比、套话或复述整段日志。严格区分已有任务与新建议,所有事实和行动附来源证据;不确定时保留信息缺口,不虚构完成结果、负责人或截止时间。',\n chat: '请用自然、简短的中文口语交流,适合直接朗读。默认一到两个短句,总长度控制在100字以内,每句只表达一个重点;用户明确要求细节时再展开。陪伴聊天时温柔倾听、顺着话题回应,不急着给建议或处理动作;工作问题先给结论,再说最重要的下一步。不要复述背景、完整日志或附加建议,不用标题、编号、列表、表格、Markdown、排比或套话。项目多时先说最紧急的事项,用简短名称定位。',\n}\n\nexport function readAssistantPrompts(value: Partial<AssistantPromptSettings> | undefined): AssistantPromptSettings {\n const chat = value?.chat?.trim()\n return {\n index: value?.index?.trim() || DEFAULT_ASSISTANT_PROMPTS.index,\n chat: !chat || LEGACY_DEFAULT_CHAT_PROMPTS.has(chat) ? DEFAULT_ASSISTANT_PROMPTS.chat : chat,\n }\n}\n\n/** 写入时验证类型与长度,避免通过旧设置提供器绕过原生 schema。 */\nexport function validateAssistantPrompt(value: unknown): asserts value is string {\n if (typeof value !== 'string' || value.length > ASSISTANT_PROMPT_MAX_CHARS) throw new Error('助理前置提示词必须是最多 8000 字符的文字')\n}\n\nexport function validateAssistantPrompts(value: unknown): void {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) throw new Error('助理前置提示词设置无效')\n for (const [key, text] of Object.entries(value)) {\n if (key !== 'index' && key !== 'chat') throw new Error('未知的助理前置提示词字段')\n validateAssistantPrompt(text)\n }\n}\n","/** 通知与语音动作分离;伴随页只能获得下列安全展示字段。 */\nexport type AssistantNotificationKind = 'completed' | 'error' | 'question' | 'approval'\nexport type AssistantNotificationAction = 'presented' | 'read' | 'dismiss'\nexport const ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS = [15, 30, 45, 60] as const\nexport type AssistantNotificationAutoCloseSeconds = typeof ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS[number]\nexport const DEFAULT_ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS: AssistantNotificationAutoCloseSeconds = 30\nexport interface AssistantNotificationSettings {\n enabled: boolean\n completed: boolean\n error: boolean\n question: boolean\n approval: boolean\n /** 开启后,通知实际呈现达到设定时长后自动收起,未读记录仍保留。 */\n autoClose: boolean\n autoCloseSeconds: AssistantNotificationAutoCloseSeconds\n}\nexport const DEFAULT_ASSISTANT_NOTIFICATION_SETTINGS: AssistantNotificationSettings = {\n enabled: true, completed: true, error: true, question: true, approval: true, autoClose: false,\n autoCloseSeconds: DEFAULT_ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS,\n}\n/** 旧配置回填通知开关和自动关闭时长,非法值不关闭用户原有通知。 */\nexport function normalizeAssistantNotificationSettings(value: unknown): AssistantNotificationSettings {\n const record = typeof value === 'object' && value !== null ? value as Record<string, unknown> : {}\n const readBoolean = (key: keyof Omit<AssistantNotificationSettings, 'autoCloseSeconds'>): boolean =>\n typeof record[key] === 'boolean' ? record[key] as boolean : DEFAULT_ASSISTANT_NOTIFICATION_SETTINGS[key] as boolean\n const rawSeconds = record.autoCloseSeconds\n const autoCloseSeconds = ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS.includes(rawSeconds as AssistantNotificationAutoCloseSeconds)\n ? rawSeconds as AssistantNotificationAutoCloseSeconds\n : DEFAULT_ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS\n return {\n enabled: readBoolean('enabled'), completed: readBoolean('completed'), error: readBoolean('error'),\n question: readBoolean('question'), approval: readBoolean('approval'), autoClose: readBoolean('autoClose'), autoCloseSeconds,\n }\n}\n/** 完整目标只通过主页面的认证查询返回,不放进通知快照。 */\nexport interface AssistantNotificationTarget {\n /** 认证接口提供的入口 Host,避免客户端把当前选中的远端当成本机。 */\n readonly localHostId?: string\n readonly hostId: string\n readonly workspaceId: string\n readonly sessionId: string\n readonly connectionGeneration?: number\n readonly requestId?: string\n readonly requestKind?: 'question' | 'approval'\n readonly actualRequestTarget?: { readonly hostId: string; readonly sessionId: string; readonly requestId: string }\n}\nexport interface AssistantNotification {\n readonly noticeId: string\n readonly kind: AssistantNotificationKind\n readonly hostLabel: string\n readonly workspaceLabel: string\n readonly sessionTitle: string\n readonly text: string\n readonly createdAt: number\n readonly presentedAt?: number\n readonly deadline?: number\n readonly errorExcerpt?: string\n readonly read: boolean\n readonly presentation: 'queued' | 'shown' | 'collapsed'\n readonly lifecycle: 'active' | 'resolved' | 'invalidated'\n readonly availability: 'ready' | 'disconnected' | 'expired'\n readonly connectionGeneration?: number\n}\nexport interface AssistantNotificationCapabilities {\n readonly hostId: string\n readonly completed: boolean\n readonly error: boolean\n readonly requests: boolean\n readonly resolve: boolean\n readonly navigation: boolean\n readonly recovery: boolean\n readonly reason?: string\n}\nexport interface AssistantNotificationSnapshot {\n readonly generation: number\n readonly revision: number\n readonly serverNow: number\n readonly primary: AssistantNotification | null\n readonly items: readonly AssistantNotification[]\n readonly unreadCount: number\n readonly pendingCount: number\n readonly cursor: string | null\n readonly capabilities: readonly AssistantNotificationCapabilities[]\n readonly unchanged?: boolean\n readonly reset?: boolean\n}\n\n/** 通知长连接帧:首次连接给完整快照,后续只按 revision 推送最新快照。 */\nexport interface AssistantNotificationStreamFrame {\n readonly type: 'snapshot' | 'delta'\n readonly snapshot: AssistantNotificationSnapshot\n}\n\nexport interface AssistantNotificationReadRequest { readonly revision?: number; readonly cursor?: string; readonly limit?: number }\nexport interface AssistantNotificationAckRequest {\n readonly noticeId: string\n readonly generation: number\n readonly action: AssistantNotificationAction\n /** 展示确认携带所见类型,阻止完成帧的迟到确认替升级后的错误启动计时。 */\n readonly kind?: AssistantNotificationKind\n /** 新客户端保留点击帧的连接代次;旧确认载荷可继续省略。 */\n readonly connectionGeneration?: number\n}\nexport interface AssistantNotificationTargetRequest { readonly noticeId: string; readonly generation: number; readonly connectionGeneration?: number }\nexport interface AssistantNotificationAckResult { readonly generation: number; readonly revision: number; readonly notification: AssistantNotification }\n/** 所有外部文本统一删除控制符并限制长度,不能携带 HTML 或工具参数。 */\nexport function assistantNotificationText(value: unknown, max = 240, fallback = ''): string {\n return typeof value === 'string' ? value.replace(/[\\u0000-\\u001f\\u007f]/gu, ' ').trim().slice(0, max) || fallback : fallback\n}\n"],"mappings":";;;;;;;EAMA,MAAa,6BAA6B;EAG1C,MAAM,8CAA8B,IAAI,IAAI,CAC1C,6IACA,uKACF,CAAC;EAED,MAAa,4BAAqD;GAChE,OAAO;GACP,MAAM;EACR;EAEA,SAAgB,qBAAqB,OAA8E;GACjH,MAAM,OAAO,OAAO,MAAM,KAAK;GAC/B,OAAO;IACL,OAAO,OAAO,OAAO,KAAK,KAAK,0BAA0B;IACzD,MAAM,CAAC,QAAQ,4BAA4B,IAAI,IAAI,IAAI,0BAA0B,OAAO;GAC1F;EACF;;;ECtBA,MAAa,4CAA4C;GAAC;GAAI;GAAI;GAAI;EAAE;
|
|
1
|
+
{"version":3,"file":"client.assistant-notifications.js","names":[],"sources":["../../../../src/shared/assistant-prompts.ts","../../../../src/shared/assistant-notifications.ts"],"sourcesContent":["/** 两个阶段独立保存提示词;缺省或清空时使用面向语音的默认值。 */\nexport interface AssistantPromptSettings {\n readonly index: string\n readonly chat: string\n}\n\nexport const ASSISTANT_PROMPT_MAX_CHARS = 8000\n\n// 旧默认值会随设置持久化;只升级完整匹配的默认文本,保留用户自行编辑的提示词。\nconst LEGACY_DEFAULT_CHAT_PROMPTS = new Set([\n '请用简洁的中文口语回答,适合直接朗读。先直接回应用户的问题,通常用一到四个短句;用户明确要求细节时再适当展开。不要使用标题、编号、列表、表格、Markdown、排比或套话,不要机械复述整份索引。提到项目时使用容易理解的名称,优先说明当前进展、实际阻碍和需要用户处理的下一步。',\n '请用简短的中文口语回答,适合直接朗读。默认只说一到两个短句,总长度控制在100字以内,每句只表达一个重点。先给结论,再说最重要的处理动作;用户明确要求全部事项或细节时才展开。只回答当前问题,不复述背景、完整日志或附加建议。不要使用标题、编号、列表、表格、Markdown、排比或套话。项目多时优先说明最紧急的事项,用简短名称定位。',\n])\n\nexport const DEFAULT_ASSISTANT_PROMPTS: AssistantPromptSettings = {\n index: '请按固定结构提取每个会话的目标、进展、阻碍、待办、下一步和信息缺口,供全局助理后续问答使用。每个字段用具体、简短的中文口语,不要排比、套话或复述整段日志。严格区分已有任务与新建议,所有事实和行动附来源证据;不确定时保留信息缺口,不虚构完成结果、负责人或截止时间。',\n chat: '请用自然、简短的中文口语交流,适合直接朗读。默认一到两个短句,总长度控制在100字以内,每句只表达一个重点;用户明确要求细节时再展开。陪伴聊天时温柔倾听、顺着话题回应,不急着给建议或处理动作;工作问题先给结论,再说最重要的下一步。不要复述背景、完整日志或附加建议,不用标题、编号、列表、表格、Markdown、排比或套话。项目多时先说最紧急的事项,用简短名称定位。',\n}\n\nexport function readAssistantPrompts(value: Partial<AssistantPromptSettings> | undefined): AssistantPromptSettings {\n const chat = value?.chat?.trim()\n return {\n index: value?.index?.trim() || DEFAULT_ASSISTANT_PROMPTS.index,\n chat: !chat || LEGACY_DEFAULT_CHAT_PROMPTS.has(chat) ? DEFAULT_ASSISTANT_PROMPTS.chat : chat,\n }\n}\n\n/** 写入时验证类型与长度,避免通过旧设置提供器绕过原生 schema。 */\nexport function validateAssistantPrompt(value: unknown): asserts value is string {\n if (typeof value !== 'string' || value.length > ASSISTANT_PROMPT_MAX_CHARS) throw new Error('助理前置提示词必须是最多 8000 字符的文字')\n}\n\nexport function validateAssistantPrompts(value: unknown): void {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) throw new Error('助理前置提示词设置无效')\n for (const [key, text] of Object.entries(value)) {\n if (key !== 'index' && key !== 'chat') throw new Error('未知的助理前置提示词字段')\n validateAssistantPrompt(text)\n }\n}\n","/** 通知与语音动作分离;伴随页只能获得下列安全展示字段。 */\nexport type AssistantNotificationKind = 'completed' | 'error' | 'question' | 'approval'\nexport type AssistantNotificationAction = 'presented' | 'read' | 'dismiss'\nexport const ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS = [15, 30, 45, 60] as const\nexport type AssistantNotificationAutoCloseSeconds = typeof ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS[number]\nexport const DEFAULT_ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS: AssistantNotificationAutoCloseSeconds = 30\n/** 尾巴贴在哪条气泡边上;网页与原生布局共用同一组几何,避免气泡压住形象。 */\nexport type AssistantNotificationTailSide = 'top' | 'bottom' | 'left' | 'right'\n/** 尾巴沿气泡边缘的跨度、伸出长度,以及尖端与形象之间的最小间隙。 */\nexport const ASSISTANT_NOTIFICATION_TAIL_WIDTH = 56\nexport const ASSISTANT_NOTIFICATION_TAIL_HEIGHT = 24\n/** 尾巴根部向气泡底板内收的距离,避免旋转时露出应被底板遮住的拼接线。 */\nexport const ASSISTANT_NOTIFICATION_TAIL_OVERLAP = 12\nexport const ASSISTANT_NOTIFICATION_TAIL_GAP = 6\n/** 气泡边缘到形象的完整避让距离:尾巴伸出后仍留出尖端间隙。 */\nexport const ASSISTANT_NOTIFICATION_TAIL_CLEARANCE = ASSISTANT_NOTIFICATION_TAIL_HEIGHT + ASSISTANT_NOTIFICATION_TAIL_GAP\nexport interface AssistantNotificationSettings {\n enabled: boolean\n completed: boolean\n error: boolean\n question: boolean\n approval: boolean\n /** 开启后,通知实际呈现达到设定时长后自动收起,未读记录仍保留。 */\n autoClose: boolean\n autoCloseSeconds: AssistantNotificationAutoCloseSeconds\n}\nexport const DEFAULT_ASSISTANT_NOTIFICATION_SETTINGS: AssistantNotificationSettings = {\n enabled: true, completed: true, error: true, question: true, approval: true, autoClose: false,\n autoCloseSeconds: DEFAULT_ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS,\n}\n/** 旧配置回填通知开关和自动关闭时长,非法值不关闭用户原有通知。 */\nexport function normalizeAssistantNotificationSettings(value: unknown): AssistantNotificationSettings {\n const record = typeof value === 'object' && value !== null ? value as Record<string, unknown> : {}\n const readBoolean = (key: keyof Omit<AssistantNotificationSettings, 'autoCloseSeconds'>): boolean =>\n typeof record[key] === 'boolean' ? record[key] as boolean : DEFAULT_ASSISTANT_NOTIFICATION_SETTINGS[key] as boolean\n const rawSeconds = record.autoCloseSeconds\n const autoCloseSeconds = ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS.includes(rawSeconds as AssistantNotificationAutoCloseSeconds)\n ? rawSeconds as AssistantNotificationAutoCloseSeconds\n : DEFAULT_ASSISTANT_NOTIFICATION_AUTO_CLOSE_SECONDS\n return {\n enabled: readBoolean('enabled'), completed: readBoolean('completed'), error: readBoolean('error'),\n question: readBoolean('question'), approval: readBoolean('approval'), autoClose: readBoolean('autoClose'), autoCloseSeconds,\n }\n}\n/** 完整目标只通过主页面的认证查询返回,不放进通知快照。 */\nexport interface AssistantNotificationTarget {\n /** 认证接口提供的入口 Host,避免客户端把当前选中的远端当成本机。 */\n readonly localHostId?: string\n readonly hostId: string\n readonly workspaceId: string\n readonly sessionId: string\n readonly connectionGeneration?: number\n readonly requestId?: string\n readonly requestKind?: 'question' | 'approval'\n readonly actualRequestTarget?: { readonly hostId: string; readonly sessionId: string; readonly requestId: string }\n}\n/** 当前前台会话的安全身份;Host 用三元组匹配通知,不依赖标题或客户端通知 ID。 */\nexport interface AssistantNotificationSessionTarget {\n readonly hostId: string\n readonly workspaceId: string\n readonly sessionId: string\n}\nexport interface AssistantNotificationReadSessionRequest extends AssistantNotificationSessionTarget {\n readonly generation: number\n}\nexport interface AssistantNotificationReadSessionResult {\n readonly generation: number\n readonly revision: number\n readonly read: number\n}\nexport interface AssistantNotification {\n readonly noticeId: string\n readonly kind: AssistantNotificationKind\n readonly hostLabel: string\n readonly workspaceLabel: string\n readonly sessionTitle: string\n readonly text: string\n readonly createdAt: number\n readonly presentedAt?: number\n readonly deadline?: number\n readonly errorExcerpt?: string\n readonly read: boolean\n readonly presentation: 'queued' | 'shown' | 'collapsed'\n readonly lifecycle: 'active' | 'resolved' | 'invalidated'\n readonly availability: 'ready' | 'disconnected' | 'expired'\n readonly connectionGeneration?: number\n}\nexport interface AssistantNotificationCapabilities {\n readonly hostId: string\n readonly completed: boolean\n readonly error: boolean\n readonly requests: boolean\n readonly resolve: boolean\n readonly navigation: boolean\n readonly recovery: boolean\n readonly reason?: string\n}\n/** 只描述气泡里尚未清理的提醒:一键清理过的记录不进入主气泡、条目与两个计数。 */\nexport interface AssistantNotificationSnapshot {\n readonly generation: number\n readonly revision: number\n readonly serverNow: number\n readonly primary: AssistantNotification | null\n readonly items: readonly AssistantNotification[]\n readonly unreadCount: number\n readonly pendingCount: number\n readonly cursor: string | null\n readonly capabilities: readonly AssistantNotificationCapabilities[]\n readonly unchanged?: boolean\n readonly reset?: boolean\n}\n\n/** 通知长连接帧:首次连接给完整快照,后续只按 revision 推送最新快照。 */\nexport interface AssistantNotificationStreamFrame {\n readonly type: 'snapshot' | 'delta'\n readonly snapshot: AssistantNotificationSnapshot\n}\n\nexport interface AssistantNotificationReadRequest { readonly revision?: number; readonly cursor?: string; readonly limit?: number }\nexport interface AssistantNotificationAckRequest {\n readonly noticeId: string\n readonly generation: number\n readonly action: AssistantNotificationAction\n /** 展示确认携带所见类型,阻止完成帧的迟到确认替升级后的错误启动计时。 */\n readonly kind?: AssistantNotificationKind\n /** 新客户端保留点击帧的连接代次;旧确认载荷可继续省略。 */\n readonly connectionGeneration?: number\n}\nexport interface AssistantNotificationTargetRequest { readonly noticeId: string; readonly generation: number; readonly connectionGeneration?: number }\nexport interface AssistantNotificationAckResult { readonly generation: number; readonly revision: number; readonly notification: AssistantNotification }\n/** 一键清理只接受当前代次,不携带单条身份;Host 负责把全部气泡提醒移出展示。 */\nexport interface AssistantNotificationClearAllRequest { readonly generation: number }\nexport interface AssistantNotificationClearAllResult { readonly generation: number; readonly revision: number; readonly cleared: number }\n/** 所有外部文本统一删除控制符并限制长度,不能携带 HTML 或工具参数。 */\nexport function assistantNotificationText(value: unknown, max = 240, fallback = ''): string {\n return typeof value === 'string' ? value.replace(/[\\u0000-\\u001f\\u007f]/gu, ' ').trim().slice(0, max) || fallback : fallback\n}\n"],"mappings":";;;;;;;EAMA,MAAa,6BAA6B;EAG1C,MAAM,8CAA8B,IAAI,IAAI,CAC1C,6IACA,uKACF,CAAC;EAED,MAAa,4BAAqD;GAChE,OAAO;GACP,MAAM;EACR;EAEA,SAAgB,qBAAqB,OAA8E;GACjH,MAAM,OAAO,OAAO,MAAM,KAAK;GAC/B,OAAO;IACL,OAAO,OAAO,OAAO,KAAK,KAAK,0BAA0B;IACzD,MAAM,CAAC,QAAQ,4BAA4B,IAAI,IAAI,IAAI,0BAA0B,OAAO;GAC1F;EACF;;;ECtBA,MAAa,4CAA4C;GAAC;GAAI;GAAI;GAAI;EAAE;EAuBxE,MAAa,0CAAyE;GACpF,SAAS;GAAM,WAAW;GAAM,OAAO;GAAM,UAAU;GAAM,UAAU;GAAM,WAAW;GACxF,kBAAA;EACF;;EAEA,SAAgB,uCAAuC,OAA+C;GACpG,MAAM,SAAS,OAAO,UAAU,YAAY,UAAU,OAAO,QAAmC,CAAC;GACjG,MAAM,eAAe,QACnB,OAAO,OAAO,SAAS,YAAY,OAAO,OAAkB,wCAAwC;GACtG,MAAM,aAAa,OAAO;GAC1B,MAAM,mBAAmB,0CAA0C,SAAS,UAAmD,IAC3H,aAAA;GAEJ,OAAO;IACL,SAAS,YAAY,SAAS;IAAG,WAAW,YAAY,WAAW;IAAG,OAAO,YAAY,OAAO;IAChG,UAAU,YAAY,UAAU;IAAG,UAAU,YAAY,UAAU;IAAG,WAAW,YAAY,WAAW;IAAG;GAC7G;EACF;;EA2FA,SAAgB,0BAA0B,OAAgB,MAAM,KAAK,WAAW,IAAY;GAC1F,OAAO,OAAO,UAAU,WAAW,MAAM,QAAQ,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,GAAG,KAAK,WAAW;EACtH"}
|
|
@@ -1245,6 +1245,28 @@ window.__ModuleLoader__.load({
|
|
|
1245
1245
|
});
|
|
1246
1246
|
return parts;
|
|
1247
1247
|
}
|
|
1248
|
+
/** 将同一正文位置连续发生的工具归入一个 DSH 风格 step;正文仍保持原有穿插位置。 */
|
|
1249
|
+
function assistantMessageStepTimeline(text, calls = []) {
|
|
1250
|
+
const parts = assistantMessageTimeline(text, calls);
|
|
1251
|
+
const grouped = [];
|
|
1252
|
+
for (const part of parts) {
|
|
1253
|
+
if (part.kind === "text") {
|
|
1254
|
+
grouped.push(part);
|
|
1255
|
+
continue;
|
|
1256
|
+
}
|
|
1257
|
+
const previous = grouped.at(-1);
|
|
1258
|
+
if (previous?.kind === "tool-step") grouped[grouped.length - 1] = {
|
|
1259
|
+
...previous,
|
|
1260
|
+
calls: [...previous.calls, part.call]
|
|
1261
|
+
};
|
|
1262
|
+
else grouped.push({
|
|
1263
|
+
kind: "tool-step",
|
|
1264
|
+
key: `tool-step-${part.call.id}`,
|
|
1265
|
+
calls: [part.call]
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
return grouped;
|
|
1269
|
+
}
|
|
1248
1270
|
//#endregion
|
|
1249
1271
|
//#region src/client/features/assistant-record-style.ts
|
|
1250
1272
|
/** 工具记录和通话记录共享交互反馈,选择器只作用于这两类组件。 */
|
|
@@ -1270,14 +1292,21 @@ window.__ModuleLoader__.load({
|
|
|
1270
1292
|
}, (0, react.createElement)("path", { d: "m9 5 7 7-7 7" }));
|
|
1271
1293
|
}
|
|
1272
1294
|
const recordCss = `
|
|
1273
|
-
.codingns-assistant-tool-summary{list-style:none;cursor:pointer
|
|
1295
|
+
.codingns-assistant-tool-summary{list-style:none;cursor:pointer}
|
|
1274
1296
|
.codingns-assistant-tool-summary::-webkit-details-marker{display:none}
|
|
1275
|
-
.codingns-assistant-tool-summary:hover,.codingns-assistant-record-button:hover{
|
|
1276
|
-
.codingns-assistant-tool-summary:active,.codingns-assistant-record-button:active{
|
|
1297
|
+
.codingns-assistant-tool-summary:hover,.codingns-assistant-record-button:hover{color:${require_theme.dshThemeColor.labelPrimary}!important}
|
|
1298
|
+
.codingns-assistant-tool-summary:active,.codingns-assistant-record-button:active{color:${require_theme.dshThemeColor.labelPrimary}!important}
|
|
1277
1299
|
.codingns-assistant-tool-summary:focus-visible,.codingns-assistant-record-button:focus-visible{outline:2px solid ${require_theme.dshThemeColor.accent};outline-offset:2px}
|
|
1278
|
-
.codingns-assistant-tool-details[open]>.codingns-assistant-tool-summary{border-radius:9px 9px 0 0}
|
|
1279
1300
|
.codingns-assistant-tool-details[open] .codingns-assistant-tool-name{white-space:normal!important;overflow-wrap:anywhere}
|
|
1280
1301
|
.codingns-assistant-tool-details[open]>.codingns-assistant-tool-summary .codingns-assistant-record-chevron{transform:rotate(90deg)}
|
|
1302
|
+
.codingns-assistant-tool-step-summary{list-style:none;cursor:pointer}
|
|
1303
|
+
.codingns-assistant-tool-step-summary::-webkit-details-marker{display:none}
|
|
1304
|
+
.codingns-assistant-tool-step-summary:hover{color:${require_theme.dshThemeColor.labelPrimary}!important}
|
|
1305
|
+
.codingns-assistant-tool-step-summary:active{color:${require_theme.dshThemeColor.labelPrimary}!important}
|
|
1306
|
+
.codingns-assistant-tool-step-summary:focus-visible{outline:2px solid ${require_theme.dshThemeColor.accent};outline-offset:2px}
|
|
1307
|
+
.codingns-assistant-tool-step-details[open]>.codingns-assistant-tool-step-summary .codingns-assistant-step-chevron{transform:rotate(180deg)}
|
|
1308
|
+
.codingns-assistant-tool-step-details[open] .codingns-assistant-tool-step-body{padding-inline:4px}
|
|
1309
|
+
.codingns-assistant-tool-step-details[open] .codingns-assistant-tool-step-preview{white-space:normal;overflow-wrap:anywhere}
|
|
1281
1310
|
.codingns-assistant-voice-dialog[open]{display:flex;flex-direction:column}
|
|
1282
1311
|
.codingns-assistant-voice-dialog::backdrop{background:${require_theme.dshThemeColor.overlay}}
|
|
1283
1312
|
`;
|
|
@@ -1336,9 +1365,9 @@ window.__ModuleLoader__.load({
|
|
|
1336
1365
|
}
|
|
1337
1366
|
/** 文字聊天、实时字幕与通话历史共用同一时间线,不额外生成工具汇总区。 */
|
|
1338
1367
|
function AssistantMessageContentView({ text, calls, t }) {
|
|
1339
|
-
return (0, react.createElement)(react.Fragment, null, ...
|
|
1368
|
+
return (0, react.createElement)(react.Fragment, null, ...assistantMessageStepTimeline(text, calls).map((part) => part.kind === "tool-step" ? (0, react.createElement)(AssistantToolStepView, {
|
|
1340
1369
|
key: part.key,
|
|
1341
|
-
calls:
|
|
1370
|
+
calls: part.calls,
|
|
1342
1371
|
t
|
|
1343
1372
|
}) : (0, react.createElement)("div", {
|
|
1344
1373
|
key: part.key,
|
|
@@ -1350,14 +1379,15 @@ window.__ModuleLoader__.load({
|
|
|
1350
1379
|
}, part.text)));
|
|
1351
1380
|
}
|
|
1352
1381
|
/** 工具信息单独展示,不拼入消息正文,字幕与语音合成都只使用原始 text。 */
|
|
1353
|
-
function AssistantToolCallsView({ calls, t }) {
|
|
1382
|
+
function AssistantToolCallsView({ calls, t, compact = false }) {
|
|
1354
1383
|
if (!calls?.length) return null;
|
|
1355
1384
|
return (0, react.createElement)("div", {
|
|
1356
1385
|
"data-codingns-assistant-tools": true,
|
|
1386
|
+
"data-codingns-assistant-tools-compact": compact,
|
|
1357
1387
|
style: {
|
|
1358
1388
|
display: "grid",
|
|
1359
|
-
gap:
|
|
1360
|
-
marginBlock: 6,
|
|
1389
|
+
gap: 2,
|
|
1390
|
+
marginBlock: compact ? 0 : 6,
|
|
1361
1391
|
textAlign: "left",
|
|
1362
1392
|
whiteSpace: "normal",
|
|
1363
1393
|
minWidth: 0
|
|
@@ -1365,26 +1395,113 @@ window.__ModuleLoader__.load({
|
|
|
1365
1395
|
}, (0, react.createElement)(AssistantRecordStyle), ...calls.map((call) => (0, react.createElement)(AssistantToolCallView, {
|
|
1366
1396
|
key: call.id,
|
|
1367
1397
|
call,
|
|
1368
|
-
t
|
|
1398
|
+
t,
|
|
1399
|
+
compact
|
|
1369
1400
|
})));
|
|
1370
1401
|
}
|
|
1402
|
+
/** 一个 step 只显示摘要;展开后才加载其中的工具调用明细。 */
|
|
1403
|
+
function AssistantToolStepView({ calls, t }) {
|
|
1404
|
+
if (calls.length === 0) return null;
|
|
1405
|
+
const running = calls.some((call) => call.state === "running");
|
|
1406
|
+
const failed = calls.some((call) => call.state === "failed");
|
|
1407
|
+
const status = running ? "running" : failed ? "failed" : calls.every((call) => call.state === "cancelled") ? "cancelled" : "completed";
|
|
1408
|
+
const latestCall = calls[calls.length - 1];
|
|
1409
|
+
const latestArguments = assistantToolArgumentPreview(latestCall, t);
|
|
1410
|
+
const summary = calls.map((call) => assistantToolStepPreview(call, t)).filter((value, index, all) => all.indexOf(value) === index).join(t("awb.call.separator"));
|
|
1411
|
+
return (0, react.createElement)("div", {
|
|
1412
|
+
"data-codingns-assistant-tool-step": true,
|
|
1413
|
+
style: {
|
|
1414
|
+
marginBlock: 6,
|
|
1415
|
+
textAlign: "left",
|
|
1416
|
+
whiteSpace: "normal",
|
|
1417
|
+
minWidth: 0,
|
|
1418
|
+
color: require_theme.dshThemeColor.labelSecondary,
|
|
1419
|
+
fontSize: require_theme.uiFontSize(13),
|
|
1420
|
+
lineHeight: 1.6
|
|
1421
|
+
}
|
|
1422
|
+
}, (0, react.createElement)(AssistantRecordStyle), (0, react.createElement)("details", { className: "codingns-assistant-tool-step-details" }, (0, react.createElement)("summary", {
|
|
1423
|
+
className: "codingns-assistant-tool-step-summary",
|
|
1424
|
+
title: t("awb.call.stepDetails"),
|
|
1425
|
+
"aria-label": `${t("awb.call.step")} · ${summary} · ${t(`awb.call.tool.${status}`)}`,
|
|
1426
|
+
style: {
|
|
1427
|
+
display: "flex",
|
|
1428
|
+
alignItems: "center",
|
|
1429
|
+
gap: 8,
|
|
1430
|
+
minWidth: 0,
|
|
1431
|
+
padding: "2px 0",
|
|
1432
|
+
color: require_theme.dshThemeColor.labelSecondary
|
|
1433
|
+
}
|
|
1434
|
+
}, (0, react.createElement)(AssistantStepChevron), (0, react.createElement)("span", {
|
|
1435
|
+
className: "codingns-assistant-tool-step-preview",
|
|
1436
|
+
"data-latest-tool": latestCall.name,
|
|
1437
|
+
title: latestCall.name,
|
|
1438
|
+
style: {
|
|
1439
|
+
minWidth: 0,
|
|
1440
|
+
overflow: "hidden",
|
|
1441
|
+
textOverflow: "ellipsis",
|
|
1442
|
+
whiteSpace: "nowrap"
|
|
1443
|
+
}
|
|
1444
|
+
}, summary, " · ", (0, react.createElement)("code", { style: {
|
|
1445
|
+
color: require_theme.dshThemeColor.labelPrimary,
|
|
1446
|
+
fontFamily: require_theme.dshThemeColor.codeFont,
|
|
1447
|
+
fontSize: "0.92em"
|
|
1448
|
+
} }, latestCall.name), latestArguments ? ` · ${latestArguments}` : "")), (0, react.createElement)("div", {
|
|
1449
|
+
className: "codingns-assistant-tool-step-body",
|
|
1450
|
+
style: {
|
|
1451
|
+
display: "grid",
|
|
1452
|
+
gap: 1,
|
|
1453
|
+
padding: "4px 0 5px 21px"
|
|
1454
|
+
}
|
|
1455
|
+
}, (0, react.createElement)(AssistantToolCallsView, {
|
|
1456
|
+
calls,
|
|
1457
|
+
t,
|
|
1458
|
+
compact: true
|
|
1459
|
+
}))));
|
|
1460
|
+
}
|
|
1461
|
+
function assistantToolStepPreview(call, t) {
|
|
1462
|
+
if (call.name.includes("read") || call.kind === "attachment") return t("awb.call.stepRead");
|
|
1463
|
+
if (call.name.includes("search") || call.kind === "web-search") return t("awb.call.stepSearch");
|
|
1464
|
+
if (call.name.includes("workspace") || call.kind === "workspace") return t("awb.call.stepWorkspace");
|
|
1465
|
+
return t("awb.call.stepTool");
|
|
1466
|
+
}
|
|
1467
|
+
function assistantToolArgumentPreview(call, t) {
|
|
1468
|
+
try {
|
|
1469
|
+
const args = JSON.parse(call.arguments);
|
|
1470
|
+
if (args === null || typeof args !== "object" || Array.isArray(args)) return "";
|
|
1471
|
+
const record = args;
|
|
1472
|
+
for (const key of [
|
|
1473
|
+
"query",
|
|
1474
|
+
"queries",
|
|
1475
|
+
"text",
|
|
1476
|
+
"url",
|
|
1477
|
+
"fileName",
|
|
1478
|
+
"filename",
|
|
1479
|
+
"file",
|
|
1480
|
+
"title",
|
|
1481
|
+
"message"
|
|
1482
|
+
]) {
|
|
1483
|
+
const value = record[key];
|
|
1484
|
+
const preview = typeof value === "string" ? value : Array.isArray(value) ? value.filter((item) => typeof item === "string").join(t("awb.call.separator")) : "";
|
|
1485
|
+
if (preview.trim()) return preview.trim().slice(0, 120);
|
|
1486
|
+
}
|
|
1487
|
+
} catch {}
|
|
1488
|
+
return "";
|
|
1489
|
+
}
|
|
1371
1490
|
/** 整个标题栏就是展开入口;实时状态更新不替换 details,保留用户的展开状态。 */
|
|
1372
|
-
function AssistantToolCallView({ call, t }) {
|
|
1491
|
+
function AssistantToolCallView({ call, t, compact = false }) {
|
|
1373
1492
|
const label = t(call.kind === "web-search" ? "awb.call.webSearch" : call.kind === "attachment" ? "awb.call.attachment" : "awb.call.workspace");
|
|
1374
1493
|
const status = t(`awb.call.tool.${call.state}`);
|
|
1375
|
-
const
|
|
1376
|
-
const
|
|
1377
|
-
return (0, react.createElement)("
|
|
1494
|
+
const argumentPreview = compact ? assistantToolArgumentPreview(call, t) : "";
|
|
1495
|
+
const rowColor = call.state === "failed" ? require_theme.dshThemeColor.error : require_theme.dshThemeColor.labelSecondary;
|
|
1496
|
+
return (0, react.createElement)("div", {
|
|
1497
|
+
"data-codingns-assistant-tool-row": call.name,
|
|
1378
1498
|
"data-codingns-assistant-tool": call.name,
|
|
1379
1499
|
"data-state": call.state,
|
|
1380
1500
|
style: {
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
fontSize: require_theme.uiFontSize(12),
|
|
1386
|
-
lineHeight: 1.4,
|
|
1387
|
-
minWidth: 0
|
|
1501
|
+
minWidth: 0,
|
|
1502
|
+
color: rowColor,
|
|
1503
|
+
fontSize: require_theme.uiFontSize(13),
|
|
1504
|
+
lineHeight: 1.65
|
|
1388
1505
|
}
|
|
1389
1506
|
}, (0, react.createElement)("details", { className: "codingns-assistant-tool-details" }, (0, react.createElement)("summary", {
|
|
1390
1507
|
className: "codingns-assistant-tool-summary",
|
|
@@ -1394,98 +1511,53 @@ window.__ModuleLoader__.load({
|
|
|
1394
1511
|
display: "flex",
|
|
1395
1512
|
alignItems: "center",
|
|
1396
1513
|
gap: 8,
|
|
1397
|
-
|
|
1398
|
-
|
|
1514
|
+
minWidth: 0,
|
|
1515
|
+
padding: "1px 0"
|
|
1399
1516
|
}
|
|
1400
|
-
}, (0, react.createElement)("span", { style: {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
width: 28,
|
|
1405
|
-
height: 28,
|
|
1406
|
-
borderRadius: 8,
|
|
1407
|
-
color,
|
|
1408
|
-
background: `color-mix(in srgb, ${color} 9%, transparent)`
|
|
1409
|
-
} }, (0, react.createElement)(AssistantToolIcon, { kind: call.kind })), (0, react.createElement)("span", { style: {
|
|
1410
|
-
flex: "1 1 auto",
|
|
1411
|
-
minWidth: 0,
|
|
1412
|
-
display: "grid",
|
|
1413
|
-
gap: 1
|
|
1414
|
-
} }, (0, react.createElement)("strong", { style: {
|
|
1415
|
-
fontSize: require_theme.uiFontSize(12),
|
|
1416
|
-
fontWeight: 600
|
|
1417
|
-
} }, label), (0, react.createElement)("span", {
|
|
1418
|
-
className: "codingns-assistant-tool-name",
|
|
1517
|
+
}, (0, react.createElement)(AssistantRecordChevron), (0, react.createElement)("span", { style: { flexShrink: 0 } }, label), (0, react.createElement)("span", { style: {
|
|
1518
|
+
color: require_theme.dshThemeColor.labelTertiary,
|
|
1519
|
+
flexShrink: 0
|
|
1520
|
+
} }, "·"), (0, react.createElement)("span", {
|
|
1419
1521
|
title: call.name,
|
|
1420
1522
|
style: {
|
|
1421
|
-
|
|
1422
|
-
fontFamily: require_theme.dshThemeColor.codeFont,
|
|
1423
|
-
fontSize: require_theme.uiFontSize(11),
|
|
1523
|
+
minWidth: 0,
|
|
1424
1524
|
overflow: "hidden",
|
|
1425
1525
|
textOverflow: "ellipsis",
|
|
1426
|
-
whiteSpace: "nowrap"
|
|
1427
|
-
|
|
1428
|
-
}, call.name)), (0, react.createElement)("span", { style: {
|
|
1429
|
-
display: "grid",
|
|
1430
|
-
justifyItems: "end",
|
|
1431
|
-
gap: 3,
|
|
1432
|
-
flexShrink: 0
|
|
1433
|
-
} }, (0, react.createElement)("span", {
|
|
1434
|
-
role: "status",
|
|
1435
|
-
style: {
|
|
1436
|
-
display: "inline-flex",
|
|
1437
|
-
alignItems: "center",
|
|
1438
|
-
gap: 4,
|
|
1439
|
-
color,
|
|
1440
|
-
padding: "1px 6px",
|
|
1441
|
-
borderRadius: 5,
|
|
1442
|
-
background: `color-mix(in srgb, ${color} 9%, transparent)`,
|
|
1443
|
-
fontSize: require_theme.uiFontSize(11),
|
|
1444
|
-
whiteSpace: "nowrap"
|
|
1526
|
+
whiteSpace: "nowrap",
|
|
1527
|
+
fontFamily: require_theme.dshThemeColor.codeFont
|
|
1445
1528
|
}
|
|
1446
|
-
}, (0, react.createElement)("
|
|
1447
|
-
"
|
|
1529
|
+
}, call.name, argumentPreview ? ` · ${argumentPreview}` : "")), (0, react.createElement)("div", {
|
|
1530
|
+
className: "codingns-assistant-tool-body",
|
|
1448
1531
|
style: {
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1532
|
+
display: "grid",
|
|
1533
|
+
gap: 0,
|
|
1534
|
+
margin: "2px 0 4px 22px",
|
|
1535
|
+
border: `0.5px solid ${require_theme.dshThemeColor.border}`,
|
|
1536
|
+
borderRadius: 6,
|
|
1537
|
+
overflow: "hidden",
|
|
1538
|
+
minWidth: 0
|
|
1453
1539
|
}
|
|
1454
|
-
}),
|
|
1455
|
-
|
|
1456
|
-
title: startedAt.toLocaleString(),
|
|
1540
|
+
}, ...[[t("awb.call.arguments"), call.arguments], [t("awb.call.result"), call.result]].map(([heading, value], index) => (0, react.createElement)("div", {
|
|
1541
|
+
key: heading,
|
|
1457
1542
|
style: {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1543
|
+
display: "grid",
|
|
1544
|
+
gridTemplateColumns: "max-content minmax(0, 1fr)",
|
|
1545
|
+
gap: 12,
|
|
1546
|
+
alignItems: "baseline",
|
|
1547
|
+
padding: "7px 10px",
|
|
1548
|
+
minWidth: 0,
|
|
1549
|
+
...index === 0 ? {} : { borderTop: `0.5px solid ${require_theme.dshThemeColor.border}` }
|
|
1462
1550
|
}
|
|
1463
|
-
}, startedAt.toLocaleTimeString([], {
|
|
1464
|
-
hour: "2-digit",
|
|
1465
|
-
minute: "2-digit",
|
|
1466
|
-
second: "2-digit",
|
|
1467
|
-
hour12: false
|
|
1468
|
-
}))), (0, react.createElement)(AssistantRecordChevron)), (0, react.createElement)("div", { style: {
|
|
1469
|
-
display: "grid",
|
|
1470
|
-
gap: 8,
|
|
1471
|
-
padding: "9px 10px 10px",
|
|
1472
|
-
borderTop: `1px solid ${require_theme.dshThemeColor.border}`,
|
|
1473
|
-
minWidth: 0
|
|
1474
|
-
} }, ...[[t("awb.call.arguments"), call.arguments], [t("awb.call.result"), call.result]].map(([heading, value]) => (0, react.createElement)("div", {
|
|
1475
|
-
key: heading,
|
|
1476
|
-
style: { minWidth: 0 }
|
|
1477
1551
|
}, (0, react.createElement)("small", { style: {
|
|
1478
|
-
color: require_theme.dshThemeColor.
|
|
1552
|
+
color: require_theme.dshThemeColor.labelTertiary,
|
|
1479
1553
|
fontSize: require_theme.uiFontSize(11),
|
|
1480
|
-
|
|
1554
|
+
whiteSpace: "nowrap"
|
|
1481
1555
|
} }, heading), (0, react.createElement)("pre", {
|
|
1482
1556
|
tabIndex: 0,
|
|
1483
1557
|
"aria-label": heading,
|
|
1484
1558
|
style: {
|
|
1485
|
-
margin:
|
|
1486
|
-
|
|
1487
|
-
borderRadius: 6,
|
|
1488
|
-
background: require_theme.dshThemeColor.cardBackground,
|
|
1559
|
+
margin: 0,
|
|
1560
|
+
color: require_theme.dshThemeColor.labelSecondary,
|
|
1489
1561
|
maxHeight: 160,
|
|
1490
1562
|
overflowY: "auto",
|
|
1491
1563
|
overscrollBehavior: "contain",
|
|
@@ -1498,18 +1570,23 @@ window.__ModuleLoader__.load({
|
|
|
1498
1570
|
}
|
|
1499
1571
|
}, value || "—"))))));
|
|
1500
1572
|
}
|
|
1501
|
-
function
|
|
1573
|
+
function AssistantStepChevron() {
|
|
1502
1574
|
return (0, react.createElement)("svg", {
|
|
1503
|
-
|
|
1504
|
-
|
|
1575
|
+
className: "codingns-assistant-step-chevron",
|
|
1576
|
+
width: 14,
|
|
1577
|
+
height: 14,
|
|
1505
1578
|
viewBox: "0 0 24 24",
|
|
1506
1579
|
fill: "none",
|
|
1507
1580
|
stroke: "currentColor",
|
|
1508
|
-
strokeWidth: 1.
|
|
1581
|
+
strokeWidth: 1.8,
|
|
1509
1582
|
strokeLinecap: "round",
|
|
1510
1583
|
strokeLinejoin: "round",
|
|
1511
|
-
"aria-hidden": true
|
|
1512
|
-
|
|
1584
|
+
"aria-hidden": true,
|
|
1585
|
+
style: {
|
|
1586
|
+
flexShrink: 0,
|
|
1587
|
+
color: require_theme.dshThemeColor.labelTertiary
|
|
1588
|
+
}
|
|
1589
|
+
}, (0, react.createElement)("path", { d: "m6 9 6 6 6-6" }));
|
|
1513
1590
|
}
|
|
1514
1591
|
//#endregion
|
|
1515
1592
|
//#region src/client/features/assistant-realtime-call.ts
|
|
@@ -2644,12 +2721,7 @@ window.__ModuleLoader__.load({
|
|
|
2644
2721
|
flexDirection: "column",
|
|
2645
2722
|
gap: configuring ? 11 : 16
|
|
2646
2723
|
}
|
|
2647
|
-
}, !loaded ? (0, react.createElement)("div", {
|
|
2648
|
-
role: "status",
|
|
2649
|
-
style: require_theme.dshSettingsHelpStyle
|
|
2650
|
-
}, t("awb.loading"), " ", button(t("awb.retry"), () => {
|
|
2651
|
-
refresh().catch((cause) => setError(message(cause)));
|
|
2652
|
-
})) : null, noticeText ? (0, react.createElement)("div", {
|
|
2724
|
+
}, !loaded ? (0, react.createElement)(AssistantLoadingView, { t }) : null, noticeText ? (0, react.createElement)("div", {
|
|
2653
2725
|
role: "alert",
|
|
2654
2726
|
style: {
|
|
2655
2727
|
color: require_theme.dshThemeColor.error,
|
|
@@ -2852,6 +2924,19 @@ window.__ModuleLoader__.load({
|
|
|
2852
2924
|
model
|
|
2853
2925
|
}));
|
|
2854
2926
|
}
|
|
2927
|
+
/** 首次读取期间使用居中的动态状态,避免把正常等待误显示成失败或重试入口。 */
|
|
2928
|
+
function AssistantLoadingView({ t }) {
|
|
2929
|
+
return (0, react.createElement)("div", {
|
|
2930
|
+
"data-codingns-assistant-loading": true,
|
|
2931
|
+
role: "status",
|
|
2932
|
+
"aria-live": "polite",
|
|
2933
|
+
"aria-label": t("awb.loading"),
|
|
2934
|
+
style: assistantLoadingStyle
|
|
2935
|
+
}, (0, react.createElement)("style", null, assistantLoadingCss), (0, react.createElement)("div", {
|
|
2936
|
+
"aria-hidden": true,
|
|
2937
|
+
style: assistantLoadingOrbStyle
|
|
2938
|
+
}, (0, react.createElement)("span", { className: "codingns-assistant-loading-ring" }), (0, react.createElement)("span", { className: "codingns-assistant-loading-core" }), (0, react.createElement)("span", { className: "codingns-assistant-loading-dot codingns-assistant-loading-dot-one" }), (0, react.createElement)("span", { className: "codingns-assistant-loading-dot codingns-assistant-loading-dot-two" }), (0, react.createElement)("span", { className: "codingns-assistant-loading-dot codingns-assistant-loading-dot-three" })), (0, react.createElement)("div", { style: assistantLoadingLabelStyle }, t("awb.loadingHint")));
|
|
2939
|
+
}
|
|
2855
2940
|
/** 内层菜单先消费 Escape,外层窗口只处理尚未消费的关闭按键。 */
|
|
2856
2941
|
function handleAssistantWorkbenchEscape(event, onClose) {
|
|
2857
2942
|
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
@@ -2886,6 +2971,47 @@ window.__ModuleLoader__.load({
|
|
|
2886
2971
|
gap: 8,
|
|
2887
2972
|
justifyItems: "center"
|
|
2888
2973
|
};
|
|
2974
|
+
const assistantLoadingStyle = {
|
|
2975
|
+
flex: "1 1 auto",
|
|
2976
|
+
minHeight: "min(420px, 45vh)",
|
|
2977
|
+
display: "flex",
|
|
2978
|
+
flexDirection: "column",
|
|
2979
|
+
alignItems: "center",
|
|
2980
|
+
justifyContent: "center",
|
|
2981
|
+
gap: 18,
|
|
2982
|
+
color: require_theme.dshThemeColor.labelSecondary
|
|
2983
|
+
};
|
|
2984
|
+
const assistantLoadingOrbStyle = {
|
|
2985
|
+
position: "relative",
|
|
2986
|
+
width: 76,
|
|
2987
|
+
height: 76,
|
|
2988
|
+
borderRadius: "50%",
|
|
2989
|
+
background: `radial-gradient(circle at 35% 28%, ${require_theme.dshThemeColor.accent}33, transparent 58%)`,
|
|
2990
|
+
boxShadow: `0 0 0 1px ${require_theme.dshThemeColor.border}, 0 0 42px ${require_theme.dshThemeColor.accent}24`
|
|
2991
|
+
};
|
|
2992
|
+
const assistantLoadingLabelStyle = {
|
|
2993
|
+
fontSize: require_theme.uiFontSize(13),
|
|
2994
|
+
letterSpacing: "0.04em"
|
|
2995
|
+
};
|
|
2996
|
+
const assistantLoadingCss = `
|
|
2997
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-ring,
|
|
2998
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-core,
|
|
2999
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-dot{position:absolute;display:block;border-radius:50%}
|
|
3000
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-ring{inset:7px;border:1px solid ${require_theme.dshThemeColor.accent}88;border-top-color:transparent;border-left-color:${require_theme.dshThemeColor.accent};animation:codingns-assistant-loading-spin 2.8s linear infinite}
|
|
3001
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-core{inset:22px;background:${require_theme.dshThemeColor.accent};box-shadow:0 0 18px ${require_theme.dshThemeColor.accent}aa;animation:codingns-assistant-loading-breathe 1.8s ease-in-out infinite}
|
|
3002
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-dot{width:6px;height:6px;background:${require_theme.dshThemeColor.labelPrimary};box-shadow:0 0 10px ${require_theme.dshThemeColor.accent};animation:codingns-assistant-loading-pulse 1.8s ease-in-out infinite}
|
|
3003
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-dot-one{top:4px;left:35px}
|
|
3004
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-dot-two{right:7px;bottom:20px;animation-delay:.22s}
|
|
3005
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-dot-three{left:7px;bottom:20px;animation-delay:.44s}
|
|
3006
|
+
@keyframes codingns-assistant-loading-spin{to{transform:rotate(360deg)}}
|
|
3007
|
+
@keyframes codingns-assistant-loading-breathe{0%,100%{transform:scale(.82);opacity:.72}50%{transform:scale(1.08);opacity:1}}
|
|
3008
|
+
@keyframes codingns-assistant-loading-pulse{0%,100%{transform:scale(.65);opacity:.36}50%{transform:scale(1.15);opacity:1}}
|
|
3009
|
+
@media (prefers-reduced-motion:reduce){
|
|
3010
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-ring,
|
|
3011
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-core,
|
|
3012
|
+
[data-codingns-assistant-loading] .codingns-assistant-loading-dot{animation:none}
|
|
3013
|
+
}
|
|
3014
|
+
`;
|
|
2889
3015
|
const backdrop = {
|
|
2890
3016
|
position: "fixed",
|
|
2891
3017
|
inset: 0,
|