@myclaw163/diagnostics-dsh 0.0.0-stage → 0.2.2-rc.5-alpha.6
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/cordis.patch.yml +5 -0
- package/icon.svg +23 -0
- package/lib/client.js +3 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +664 -0
- package/lib/types/account-scopes.d.ts +20 -0
- package/lib/types/account-scopes.d.ts.map +1 -0
- package/lib/types/account-scopes.js.map +1 -0
- package/lib/types/client/DiagnosticsDialog.d.ts +14 -0
- package/lib/types/client/DiagnosticsDialog.d.ts.map +1 -0
- package/lib/types/client/DiagnosticsDialog.js.map +1 -0
- package/lib/types/client/Entry.d.ts +8 -0
- package/lib/types/client/Entry.d.ts.map +1 -0
- package/lib/types/client/Entry.js.map +1 -0
- package/lib/types/client/diagnostics-controller.d.ts +39 -0
- package/lib/types/client/diagnostics-controller.d.ts.map +1 -0
- package/lib/types/client/diagnostics-controller.js.map +1 -0
- package/lib/types/client/download.d.ts +8 -0
- package/lib/types/client/download.d.ts.map +1 -0
- package/lib/types/client/download.js.map +1 -0
- package/lib/types/client/index.d.ts +13 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/client/locales.d.ts +147 -0
- package/lib/types/client/locales.d.ts.map +1 -0
- package/lib/types/client/locales.js.map +1 -0
- package/lib/types/diagnostic-journal.d.ts +42 -0
- package/lib/types/diagnostic-journal.d.ts.map +1 -0
- package/lib/types/diagnostic-journal.js.map +1 -0
- package/lib/types/diagnostics-host.d.ts +24 -0
- package/lib/types/diagnostics-host.d.ts.map +1 -0
- package/lib/types/diagnostics-host.js.map +1 -0
- package/lib/types/diagnostics.d.ts +84 -0
- package/lib/types/diagnostics.d.ts.map +1 -0
- package/lib/types/diagnostics.js.map +1 -0
- package/lib/types/index.d.ts +38 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/release-info.d.ts +16 -0
- package/lib/types/release-info.d.ts.map +1 -0
- package/lib/types/release-info.js.map +1 -0
- package/locale/de.json +6 -0
- package/locale/en.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +65 -3
- package/README.md +0 -3
package/cordis.patch.yml
ADDED
package/icon.svg
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g mask="url(#data-lens-cutout)">
|
|
3
|
+
<rect x="11" y="7" width="16" height="16" rx="2" fill="#7FB7FC" fill-opacity="0.55" />
|
|
4
|
+
<rect x="7" y="11" width="17" height="15" rx="2" fill="url(#data-panel)" />
|
|
5
|
+
<path d="M10 15H18M10 18H15" stroke="#FFFFFF" stroke-width="1.5" />
|
|
6
|
+
</g>
|
|
7
|
+
<path d="M26 26L30 30" stroke="#658EFF" stroke-width="3" />
|
|
8
|
+
<circle cx="23" cy="23" r="4.5" stroke="url(#data-lens)" stroke-width="2.5" />
|
|
9
|
+
<defs>
|
|
10
|
+
<mask id="data-lens-cutout" maskUnits="userSpaceOnUse" x="0" y="0" width="36" height="36">
|
|
11
|
+
<rect width="36" height="36" fill="#FFFFFF" />
|
|
12
|
+
<circle cx="23" cy="23" r="3.25" fill="#000000" />
|
|
13
|
+
</mask>
|
|
14
|
+
<linearGradient id="data-panel" x1="9" y1="11" x2="23" y2="26" gradientUnits="userSpaceOnUse">
|
|
15
|
+
<stop stop-color="#6DB9FB" />
|
|
16
|
+
<stop offset="1" stop-color="#3650DE" />
|
|
17
|
+
</linearGradient>
|
|
18
|
+
<linearGradient id="data-lens" x1="19" y1="19" x2="27" y2="27" gradientUnits="userSpaceOnUse">
|
|
19
|
+
<stop stop-color="#45D9E7" />
|
|
20
|
+
<stop offset="1" stop-color="#67C7FE" />
|
|
21
|
+
</linearGradient>
|
|
22
|
+
</defs>
|
|
23
|
+
</svg>
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
window.__ModuleLoader__.load({id:`@myclaw163/diagnostics-dsh`,factory:require=>{var module={exports:{}};var exports=module.exports;Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let _deepseek_ai_dsh_client_ui_primitives=require("@deepseek-ai/dsh-client-ui-primitives");let _deepseek_ai_dsh_client_store=require("@deepseek-ai/dsh-client-store");let react_jsx_runtime=require("react/jsx-runtime");let react=require("react");function downloadUrl(url,filename){const anchor=document.createElement(`a`);anchor.href=url;anchor.download=filename;anchor.click()}var DiagnosticDownloadController=class{store=(0,_deepseek_ai_dsh_client_store.createSnapshotStore)({open:false,phase:`select`});active;objectUrl;open(sessionId){if(this.active)return;this.store.set({open:true,phase:`select`,...sessionId===void 0?{}:{sessionId}})}close(){this.active?.abort();this.active=void 0;if(this.objectUrl)URL.revokeObjectURL(this.objectUrl);this.objectUrl=void 0;this.store.set({open:false,phase:`select`})}async download(selection){if(this.active)return;const state=this.store.getSnapshot(),abort=new AbortController;this.active=abort;this.store.set({...state,phase:`collecting`});try{const query=new URLSearchParams({hours:`8`,sessions:String(selection.sessions),plugins:String(selection.plugins)});if(state.sessionId)query.set(`sessionId`,state.sessionId);const response=await fetch(`api/diagnostics.export?${query}`,{signal:abort.signal});if(!response.ok)throw new Error(`Diagnostic download failed`);const blob=await response.blob();abort.signal.throwIfAborted();this.objectUrl=URL.createObjectURL(blob);downloadUrl(this.objectUrl,`dsh-diagnostics-${new Date().toISOString().replace(/[:.]/g,`-`)}.zip`);this.store.set({...state,phase:`saved`})}catch(_error){if(!abort.signal.aborted)this.store.set({...state,phase:`failed`})}finally{if(this.active===abort)this.active=void 0}}};const css=`._3WpeTW_content{flex-direction:column;gap:12px;display:flex}._3WpeTW_content label{align-items:center;gap:8px;display:flex}._3WpeTW_content select{font:inherit;color:inherit;background:0 0}._3WpeTW_content p{margin:0}`;const tagId=`@myclaw163/diagnostics-dsh/DiagnosticsDialog.module.css`;if(typeof document!==`undefined`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(tagId)+`]`)===null){const tag=document.createElement(`style`);tag.dataset.plugin=`@myclaw163/diagnostics-dsh`;tag.dataset.pluginCss=tagId;tag.textContent=css;document.head.appendChild(tag)}var DiagnosticsDialog_module_css_default={"content":`_3WpeTW_content`};function DiagnosticsDialog({useDiagnosticDialog,close,download,t}){const state=useDiagnosticDialog(value=>value);const[sessions,setSessions]=(0,react.useState)(true);const[plugins,setPlugins]=(0,react.useState)(true);const selecting=state.phase===`select`;return(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal,{open:state.open,onClose:close,title:t(`diagnostics.title`),closeLabel:t(`dialog.close`),description:t(state.sessionId?`diagnostics.session`:`diagnostics.global`),footer:(0,react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment,{children:[(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button,{onClick:close,children:t(state.phase===`collecting`?`diagnostics.cancel`:`dialog.close`)}),selecting&&(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button,{variant:`primary`,disabled:!sessions&&!plugins,onClick:()=>{download({sessions,plugins})},children:t(`diagnostics.download`)})]}),children:(0,react_jsx_runtime.jsx)(`div`,{className:DiagnosticsDialog_module_css_default.content,children:selecting?(0,react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment,{children:[(0,react_jsx_runtime.jsx)(`p`,{children:t(`diagnostics.eightHours`)}),(0,react_jsx_runtime.jsxs)(`label`,{children:[(0,react_jsx_runtime.jsx)(`input`,{type:`checkbox`,checked:sessions,onChange:event=>{setSessions(event.target.checked)}}),t(`diagnostics.sessions`)]}),(0,react_jsx_runtime.jsxs)(`label`,{children:[(0,react_jsx_runtime.jsx)(`input`,{type:`checkbox`,checked:plugins,onChange:event=>{setPlugins(event.target.checked)}}),t(`diagnostics.plugins`)]}),(0,react_jsx_runtime.jsx)(`p`,{children:t(`diagnostics.privacy`)})]}):(0,react_jsx_runtime.jsx)(`p`,{role:`status`,"aria-live":`polite`,children:t(state.phase===`collecting`?`diagnostics.collecting`:state.phase===`saved`?`diagnostics.saved`:`diagnostics.failed`)})})})}function DiagnosticEntry({open,sessionId,t}){return(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button,{onClick:()=>{open(sessionId)},children:t(sessionId?`diagnostics.sessionMenu`:`diagnostics.title`)})}const NS=`diagnostics`;const zh={"diagnostics.title":`导出诊断日志`,"diagnostics.sessionMenu":`导出此会话诊断日志`,"diagnostics.session":`范围:当前会话`,"diagnostics.global":`范围:宿主可提供的会话及运行日志`,"diagnostics.range":`时间范围`,"diagnostics.eightHours":`最近 8 小时(不限制导出大小)`,"diagnostics.day":`最近 24 小时`,"diagnostics.week":`最近 7 天`,"diagnostics.sessions":`会话与模型、工具调用记录`,"diagnostics.plugins":`插件运行日志`,"diagnostics.privacy":`仅下载到本机,不自动上传。凭据将脱敏;对话内容仍可能包含私人信息。`,"diagnostics.download":`导出 ZIP`,"diagnostics.cancel":`取消导出`,"diagnostics.collecting":`正在采集并压缩日志…`,"diagnostics.saved":`已开始下载。请查看 ZIP 内 manifest.json 的完整性和缺失来源记录。`,"diagnostics.failed":`导出失败,请重试。`,"dialog.close":`关闭`};const en={"diagnostics.title":`Export diagnostics`,"diagnostics.sessionMenu":`Export diagnostics for this session`,"diagnostics.session":`Scope: current session`,"diagnostics.global":`Scope: sessions and runtime logs available from this host`,"diagnostics.range":`Time range`,"diagnostics.eightHours":`Last 8 hours (no export size limit)`,"diagnostics.day":`Last 24 hours`,"diagnostics.week":`Last 7 days`,"diagnostics.sessions":`Session, model, and tool records`,"diagnostics.plugins":`Plugin runtime logs`,"diagnostics.privacy":`Downloaded locally without uploading. Credentials are redacted; conversations may still contain private information.`,"diagnostics.download":`Export ZIP`,"diagnostics.cancel":`Cancel export`,"diagnostics.collecting":`Collecting and compressing logs…`,"diagnostics.saved":`Download started. Check manifest.json in the ZIP for completeness and missing sources.`,"diagnostics.failed":`Export failed. Please retry.`,"dialog.close":`Close`};const ja={...en,"dialog.close":`閉じる`};const es={...en,"dialog.close":`Cerrar`};const fr={...en,"dialog.close":`Fermer`};const de={...en,"dialog.close":`Schließen`};const ru={...en,"dialog.close":`Закрыть`};const pt={...en,"dialog.close":`Fechar`};const inject=[`slots`,`locale`];function apply(ctx){const diagnostics=new DiagnosticDownloadController;ctx.provide(`diagnosticDownload`,diagnostics);ctx.effect(()=>()=>{diagnostics.close()},`diagnostics: client lifecycle`);ctx.effect(()=>ctx.locale.register(NS,{zh,en,ja,es,fr,de,ru,pt}),`diagnostics: dictionaries`);ctx.slots.inject(`shell.overlay`,()=>ctx.slots.register({name:`shell.overlay`,id:`diagnostics.dialog`,locale:NS,inject:()=>({hooks:{diagnosticDialog:diagnostics.store},close:()=>{diagnostics.close()},download:selection=>diagnostics.download(selection)})},DiagnosticsDialog));const t=ctx.locale.bind(NS);ctx.slots.inject(`settings.section`,()=>ctx.slots.register({name:`settings.section`,id:`diagnostics`,locale:NS,label:()=>t(`diagnostics.title`),inject:()=>({open:()=>{diagnostics.open()}})},DiagnosticEntry));ctx.inject([`contextMenus`],scope=>{scope.slots.inject(`contextMenu.icon`,()=>scope.slots.register({name:`contextMenu.icon`,key:`diagnostics.download`},_deepseek_ai_dsh_client_ui_primitives.IconDownloadOutlineRegular));scope.effect(()=>scope.contextMenus.register({id:`diagnostics.export`,target:`sessionHeader`,order:50,observe:()=>[scope.locale],resolve:({sessionId})=>[{id:`diagnostics`,label:t(`diagnostics.sessionMenu`),icon:{key:`diagnostics.download`},run:()=>{diagnostics.open(sessionId)}}]}),`diagnostics: session action`)})}exports.apply=apply;exports.inject=inject;return module.exports}});
|
|
3
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../../packages/session-query/diagnostics/src/client/download.ts","../../../packages/session-query/diagnostics/src/client/diagnostics-controller.ts","../../../packages/session-query/diagnostics/src/client/DiagnosticsDialog.tsx","../../../packages/session-query/diagnostics/src/client/Entry.tsx","../../../packages/session-query/diagnostics/src/client/locales.ts","../../../packages/session-query/diagnostics/src/client/index.ts"],"sourcesContent":["/** 浏览器拥有下载位置。 */\n/**\n * 触发浏览器下载;对象 URL 的释放由调用方负责。\n * @param url 已准备的下载地址。\n * @param filename 建议的本地文件名。\n */\nexport function downloadUrl(url: string, filename: string): void {\n const anchor = document.createElement('a')\n anchor.href = url\n anchor.download = filename\n anchor.click()\n}\n","/** Diagnostic dialog and cancellable local download. */\nimport { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport type { SessionId } from '@deepseek-ai/dsh-session/types'\nimport { downloadUrl } from './download.ts'\n\n/** User-selected export contents and time window. */\nexport interface DiagnosticSelection { sessions: boolean; plugins: boolean }\n/** One global dialog, optionally scoped to a session. */\nexport interface DiagnosticDialogState {\n open: boolean\n sessionId?: SessionId\n phase: 'select' | 'collecting' | 'saved' | 'failed'\n}\n/** Controller is shared by the global and session menus. */\nexport class DiagnosticDownloadController {\n /** 导出弹窗的当前阶段与可选会话范围。 */\n readonly store: SnapshotStore<DiagnosticDialogState> = createSnapshotStore({ open: false, phase: 'select' })\n private active: AbortController | undefined\n private objectUrl: string | undefined\n /** 打开导出选项;已有导出任务运行时保持原状态。\n * @param sessionId - Omit for the global time window.\n */\n open(sessionId?: SessionId): void {\n if (this.active) return\n this.store.set({ open: true, phase: 'select', ...(sessionId === undefined ? {} : { sessionId }) })\n }\n /** Cancel work and dismiss the dialog; no download starts after cancellation. */\n close(): void {\n this.active?.abort()\n this.active = undefined\n if (this.objectUrl) URL.revokeObjectURL(this.objectUrl)\n this.objectUrl = undefined\n this.store.set({ open: false, phase: 'select' })\n }\n /**\n * Collect and download the selected diagnostic contents.\n * @param selection - User-confirmed window and sources.\n * @returns after download admission, cancellation, or visible failure.\n */\n async download(selection: DiagnosticSelection): Promise<void> {\n if (this.active) return\n const state = this.store.getSnapshot(), abort = new AbortController()\n this.active = abort\n this.store.set({ ...state, phase: 'collecting' })\n try {\n const query = new URLSearchParams({\n hours: '8', sessions: String(selection.sessions), plugins: String(selection.plugins),\n })\n if (state.sessionId) query.set('sessionId', state.sessionId)\n const response = await fetch(`api/diagnostics.export?${query}`, { signal: abort.signal })\n if (!response.ok) throw new Error('Diagnostic download failed')\n const blob = await response.blob()\n abort.signal.throwIfAborted()\n this.objectUrl = URL.createObjectURL(blob)\n downloadUrl(this.objectUrl, `dsh-diagnostics-${new Date().toISOString().replace(/[:.]/g, '-')}.zip`)\n this.store.set({ ...state, phase: 'saved' })\n } catch (_error) {\n if (!abort.signal.aborted) this.store.set({ ...state, phase: 'failed' })\n } finally {\n if (this.active === abort) this.active = undefined\n }\n }\n}\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context { diagnosticDownload: DiagnosticDownloadController }\n}\n","/** Shared diagnostic export dialog. */\nimport { useState } from 'react'\nimport type { ObservableSnapshot } from '@deepseek-ai/dsh-client-store'\nimport type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport { Button, Modal } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { DiagnosticDialogState, DiagnosticSelection } from './diagnostics-controller.ts'\nimport css from './DiagnosticsDialog.module.css'\n\n/** Injected state and actions; collectors remain on the host. */\nexport interface DiagnosticsDialogInjected {\n hooks: { diagnosticDialog: ObservableSnapshot<DiagnosticDialogState> }\n close: () => void\n download: (selection: DiagnosticSelection) => Promise<void>\n}\n/** @param props - Shared dialog state, download operations, and localized copy. @returns the export modal. */\nexport function DiagnosticsDialog({ useDiagnosticDialog, close, download, t }: InjectFace<DiagnosticsDialogInjected> & PropsLocale<'diagnostics'>) {\n const state = useDiagnosticDialog(value => value)\n const [sessions, setSessions] = useState(true)\n const [plugins, setPlugins] = useState(true)\n const selecting = state.phase === 'select'\n return <Modal open={state.open} onClose={close} title={t('diagnostics.title')} closeLabel={t('dialog.close')}\n description={t(state.sessionId ? 'diagnostics.session' : 'diagnostics.global')}\n footer={<>\n <Button onClick={close}>{t(state.phase === 'collecting' ? 'diagnostics.cancel' : 'dialog.close')}</Button>\n {selecting && <Button variant=\"primary\" disabled={!sessions && !plugins} onClick={() => { void download({ sessions, plugins }) }}>{t('diagnostics.download')}</Button>}\n </>}>\n <div className={css.content}>\n {selecting ? <>\n <p>{t('diagnostics.eightHours')}</p>\n <label><input type=\"checkbox\" checked={sessions} onChange={(event) => { setSessions(event.target.checked) }} />{t('diagnostics.sessions')}</label>\n <label><input type=\"checkbox\" checked={plugins} onChange={(event) => { setPlugins(event.target.checked) }} />{t('diagnostics.plugins')}</label>\n <p>{t('diagnostics.privacy')}</p>\n </> : <p role=\"status\" aria-live=\"polite\">{t(state.phase === 'collecting' ? 'diagnostics.collecting' : state.phase === 'saved' ? 'diagnostics.saved' : 'diagnostics.failed')}</p>}\n </div>\n </Modal>\n}\n","/** 独立诊断入口,兼容官方设置与旧版会话顶部插槽。 */\nimport { Button } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { SessionId } from '@deepseek-ai/dsh-session/types'\n\n/** @param props 打开诊断弹窗的操作与可选会话。 @returns 本地化导出按钮。 */\nexport function DiagnosticEntry({ open, sessionId, t }: PropsLocale<'diagnostics'> & {\n open: (sessionId?: SessionId) => void\n sessionId?: SessionId\n}) {\n return <Button onClick={() => { open(sessionId) }}>{t(sessionId ? 'diagnostics.sessionMenu' : 'diagnostics.title')}</Button>\n}\n","/** 诊断导出文案。 */\nexport const NS = 'diagnostics'\n/** zh 诊断导出文案。 */\nexport const zh = {\n 'diagnostics.title': '导出诊断日志',\n 'diagnostics.sessionMenu': '导出此会话诊断日志',\n 'diagnostics.session': '范围:当前会话',\n 'diagnostics.global': '范围:宿主可提供的会话及运行日志',\n 'diagnostics.range': '时间范围',\n 'diagnostics.eightHours': '最近 8 小时(不限制导出大小)',\n 'diagnostics.day': '最近 24 小时',\n 'diagnostics.week': '最近 7 天',\n 'diagnostics.sessions': '会话与模型、工具调用记录',\n 'diagnostics.plugins': '插件运行日志',\n 'diagnostics.privacy': '仅下载到本机,不自动上传。凭据将脱敏;对话内容仍可能包含私人信息。',\n 'diagnostics.download': '导出 ZIP',\n 'diagnostics.cancel': '取消导出',\n 'diagnostics.collecting': '正在采集并压缩日志…',\n 'diagnostics.saved': '已开始下载。请查看 ZIP 内 manifest.json 的完整性和缺失来源记录。',\n 'diagnostics.failed': '导出失败,请重试。',\n 'dialog.close': '关闭',\n} as const\n/** 英文诊断导出文案及其他语言的默认文案。 */\nexport const en: Record<keyof typeof zh, string> = {\n 'diagnostics.title': 'Export diagnostics',\n 'diagnostics.sessionMenu': 'Export diagnostics for this session',\n 'diagnostics.session': 'Scope: current session',\n 'diagnostics.global': 'Scope: sessions and runtime logs available from this host',\n 'diagnostics.range': 'Time range',\n 'diagnostics.eightHours': 'Last 8 hours (no export size limit)',\n 'diagnostics.day': 'Last 24 hours',\n 'diagnostics.week': 'Last 7 days',\n 'diagnostics.sessions': 'Session, model, and tool records',\n 'diagnostics.plugins': 'Plugin runtime logs',\n 'diagnostics.privacy': 'Downloaded locally without uploading. Credentials are redacted; conversations may still contain private information.',\n 'diagnostics.download': 'Export ZIP',\n 'diagnostics.cancel': 'Cancel export',\n 'diagnostics.collecting': 'Collecting and compressing logs…',\n 'diagnostics.saved': 'Download started. Check manifest.json in the ZIP for completeness and missing sources.',\n 'diagnostics.failed': 'Export failed. Please retry.',\n 'dialog.close': 'Close',\n}\n/** ja 诊断导出文案。 */\nexport const ja = {\n ...en,\n 'dialog.close': '閉じる',\n} satisfies Record<keyof typeof en, string>\n/** es 诊断导出文案。 */\nexport const es = {\n ...en,\n 'dialog.close': 'Cerrar',\n} satisfies Record<keyof typeof en, string>\n/** fr 诊断导出文案。 */\nexport const fr = {\n ...en,\n 'dialog.close': 'Fermer',\n} satisfies Record<keyof typeof en, string>\n/** de 诊断导出文案。 */\nexport const de = {\n ...en,\n 'dialog.close': 'Schließen',\n} satisfies Record<keyof typeof en, string>\n/** ru 诊断导出文案。 */\nexport const ru = {\n ...en,\n 'dialog.close': 'Закрыть',\n} satisfies Record<keyof typeof en, string>\n/** pt 诊断导出文案。 */\nexport const pt = {\n ...en,\n 'dialog.close': 'Fechar',\n} satisfies Record<keyof typeof en, string>\n/** 诊断导出文案键。 */\nexport type DiagnosticsKey = keyof typeof en\n","/** 诊断弹窗及宿主适配入口。 */\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-layout/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-context-menu/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport { IconDownloadOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'\nimport { DiagnosticDownloadController } from './diagnostics-controller.ts'\nimport { DiagnosticsDialog, type DiagnosticsDialogInjected } from './DiagnosticsDialog.tsx'\nimport { DiagnosticEntry } from './Entry.tsx'\nimport { NS, zh, en, ja, es, fr, de, ru, pt, type DiagnosticsKey } from './locales.ts'\n\nexport type { DiagnosticDownloadController } from './diagnostics-controller.ts'\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap { diagnostics: DiagnosticsKey }\n}\ndeclare const __DIAGNOSTICS_TARGET__: string\nconst target = typeof __DIAGNOSTICS_TARGET__ === 'undefined' ? 'clawclaw' : __DIAGNOSTICS_TARGET__\nexport const inject = ['slots', 'locale']\n\n/** @param ctx 浏览器上下文。 */\nexport function apply(ctx: Context): void {\n const diagnostics = new DiagnosticDownloadController()\n ctx.provide('diagnosticDownload', diagnostics)\n ctx.effect(() => () => { diagnostics.close() }, 'diagnostics: client lifecycle')\n ctx.effect(() => ctx.locale.register(NS, { zh, en, ja, es, fr, de, ru, pt }), 'diagnostics: dictionaries')\n ctx.slots.inject('shell.overlay', () => ctx.slots.register({\n name: 'shell.overlay', id: 'diagnostics.dialog', locale: NS,\n inject: (): DiagnosticsDialogInjected => ({\n hooks: { diagnosticDialog: diagnostics.store }, close: () => { diagnostics.close() },\n download: selection => diagnostics.download(selection),\n }),\n }, DiagnosticsDialog))\n const t = ctx.locale.bind(NS)\n if (target !== 'clawclaw') ctx.slots.inject('settings.section', () => ctx.slots.register({\n name: 'settings.section', id: 'diagnostics', locale: NS, label: () => t('diagnostics.title'),\n inject: () => ({ open: () => { diagnostics.open() } }),\n }, DiagnosticEntry))\n ctx.inject(['contextMenus'], (scope) => {\n scope.slots.inject('contextMenu.icon', () => scope.slots.register({\n name: 'contextMenu.icon', key: 'diagnostics.download',\n }, IconDownloadOutlineRegular))\n scope.effect(() => scope.contextMenus.register({\n id: 'diagnostics.export', target: 'sessionHeader', order: 50,\n observe: () => [scope.locale],\n resolve: ({ sessionId }) => [{ id: 'diagnostics', label: t('diagnostics.sessionMenu'),\n icon: { key: 'diagnostics.download' }, run: () => { diagnostics.open(sessionId) } }],\n }), 'diagnostics: session action')\n })\n}\n"],"mappings":";4bAMA,SAAgB,YAAY,IAAa,SAAgB,CACvD,MAAM,OAAS,SAAS,cAAc,GAAG,EACzC,OAAO,KAAO,IACd,OAAO,SAAW,SAClB,OAAO,MAAK,CACd,CCGA,IAAa,6BAAb,KAAyC,CAE9B,OAAA,EAAA,8BAAA,oBAAA,AAAA,CAAkE,CAAE,KAAM,MAAO,MAAO,QAAQ,CAAE,EACnG,OACA,UAIR,KAAK,UAAqB,CACxB,GAAI,KAAK,OAAQ,OACjB,KAAK,MAAM,IAAI,CAAE,KAAM,KAAM,MAAO,SAAU,GAAI,YAAc,IAAA,GAAY,CAAA,EAAK,CAAE,SAAS,CAAG,CAAE,CACnG,CAEA,OAAK,CAC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