@myclaw163/diagnostics 0.2.2-rc.5-alpha.8 → 0.2.2-rc.5-alpha.9
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/lib/client.js +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
window.__ModuleLoader__.load({id:`@myclaw163/diagnostics`,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=`.
|
|
2
|
+
window.__ModuleLoader__.load({id:`@myclaw163/diagnostics`,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/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`;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`)})})})}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.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
3
|
//# sourceMappingURL=client.js.map
|