@michengai/dsh-automation 0.1.63 → 0.1.64
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/CHANGELOG.md +4 -0
- package/CHANGELOG.zh-CN.md +4 -0
- package/lib/client.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ Upcoming changes and recent published versions are listed below. Git tags and Gi
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 0.1.64 - 2026-10-14
|
|
10
|
+
|
|
11
|
+
- Adjust settings navigation section order to ensure stable placement and avoid conflicts with other plugins.
|
|
12
|
+
|
|
9
13
|
## 0.1.63 - 2026-10-12
|
|
10
14
|
|
|
11
15
|
- Fix Web startup on DSH `0.2.1-alpha.2` while retaining compatibility with the previously supported Host versions.
|
package/CHANGELOG.zh-CN.md
CHANGED
package/lib/client.js
CHANGED
|
@@ -426,7 +426,7 @@ ${i}
|
|
|
426
426
|
`;function WO(){let e=document.getElementById(BO);if(e instanceof HTMLStyleElement)return e.textContent=HO,e.setAttribute("data-plugin",Jg),()=>{};let t=document.createElement("style");return t.id=BO,t.textContent=HO,t.setAttribute("data-plugin",Jg),document.head.append(t),()=>{t.remove()}}var VO="michengai-plugin-update-ui";function jO(e){let t=document.getElementById(VO);if(t instanceof HTMLStyleElement){t.getAttribute("data-plugin")===null&&t.setAttribute("data-plugin",Jg);return}let o=document.createElement("style");o.id=VO,o.textContent=e,o.setAttribute("data-plugin",Jg),(document.head??document.documentElement).append(o)}function $H(e,t){for(let o of t){let n=o.trim();if(n==="")continue;let r=e.find(i=>i.textContent?.replace(/\s+/g," ").trim()===n);if(r!==void 0)return r}}function IH(e){return e.find(o=>{let n=`${o.textContent??""} ${o.getAttribute("aria-label")??""}`.trim();return/(^|\s)(设置|settings)(\s|$)/i.test(n)})??(e.length===1?e[0]:void 0)}var eh,KO="[data-dcu-settings-trigger]",UO="[data-dcu-settings-page]",NH="dcu-settings-open-section";function PH(e){let t=document.querySelector(KO);if(t===null)return!1;let o=new CustomEvent(NH,{detail:{labels:[...e]},cancelable:!0});return!t.dispatchEvent(o)}function qO(e,t,o){if(typeof document>"u"||typeof window>"u"){o?.();return}if(PH(e)){t?.();return}let n=[...document.querySelectorAll('button[aria-haspopup="dialog"]')],r=IH(n),i=document.querySelector(KO),s=document.querySelector('[role="dialog"]')!==null,a=document.querySelector(UO)!==null;if(!s&&!a&&r===void 0&&i===null){o?.();return}eh?.(),!s&&!a&&(i??r)?.click();let c,l=!1,d=new MutationObserver(()=>{p()}),u=()=>{l||(l=!0,d.disconnect(),window.clearTimeout(g),c!==void 0&&window.cancelAnimationFrame(c),eh===u&&(eh=void 0))},m=()=>{let f=[...document.querySelectorAll('[role="dialog"] nav button'),...document.querySelectorAll(`${UO} nav button`)],h=$H(f,e);return h===void 0?!1:(u(),h.click(),t?.(),!0)},p=()=>{l||c!==void 0||(c=window.requestAnimationFrame(()=>{c=void 0,m()}))},g=window.setTimeout(()=>{m()||(u(),o?.())},1500);d.observe(document.body,{childList:!0,subtree:!0}),eh=u,p()}var lt=M(require("react"),1),ZS=require("react-dom/client");function GO(e,t,o){return`dsh plugin${e.trim()===""?"":` --profile ${e.trim()}`} add ${t}@${o} --registry=https://registry.npmjs.org/`}function XO(e,t){return e.key!=="Escape"?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t(),!0)}var TH="x-michengai-plugin-update",MH=`
|
|
427
427
|
.mpi-version{margin-left:8px;color:var(--dsw-alias-label-tertiary,#a0a0a0);font-family:inherit;font-size:12px;font-weight:500;line-height:18px;letter-spacing:0;white-space:nowrap;vertical-align:baseline}.mpi-check-host{display:inline-flex;align-items:center}.mpi-icon{display:inline-flex;flex:0 0 auto;width:16px;height:16px;align-items:center;justify-content:center;pointer-events:none}.mpi-icon svg{display:block;width:16px;height:16px}
|
|
428
428
|
.mpi-intro{margin:0 0 16px;color:var(--dsw-alias-label-secondary,#b9b9b9);font-size:13px;line-height:20px}.mpi-meta{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:8px 18px;margin:0 0 16px;font-size:12px;line-height:18px}.mpi-meta dt{color:var(--dsw-alias-label-secondary,#b9b9b9)}.mpi-meta dd{margin:0}.mpi-mono{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.mpi-latest{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 10px}.mpi-status{font-size:13px;font-weight:600;line-height:18px}.mpi-status[data-kind=error]{color:var(--dsw-alias-state-error-primary,#ef7272)}.mpi-status[data-kind=success]{color:var(--dsw-alias-state-success-primary,#51b976)}.mpi-status[data-kind=update]{color:#e8b15a !important}.mpi-manual{border-top:1px solid var(--dsw-alias-border-l2,#494949);padding-top:16px}.mpi-manual h3{margin:0 0 6px;font-size:14px;line-height:20px}.mpi-manual p{margin:0 0 10px;color:var(--dsw-alias-label-secondary,#b9b9b9);font-size:12px;line-height:18px}.mpi-command{display:flex;align-items:flex-start;gap:8px;border:1px solid var(--dsw-alias-border-l2,#494949);border-radius:7px;padding:10px;background:var(--dsw-alias-bg-layer-3,var(--dsw-specific-menu-item-hover,#353638))}.mpi-command code{min-width:0;flex:1;overflow:visible;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;line-height:18px;white-space:pre-wrap;overflow-wrap:anywhere}@media(max-width:560px){.mpi-meta{grid-template-columns:1fr;gap:2px}.mpi-meta dd{margin-bottom:6px}}
|
|
429
|
-
`,kH={check:"\u68C0\u67E5\u66F4\u65B0",update:"\u66F4\u65B0",close:"\u5173\u95ED",recheck:"\u91CD\u65B0\u68C0\u67E5",auto:"\u81EA\u52A8\u66F4\u65B0",updating:"\u6B63\u5728\u66F4\u65B0\u2026",copy:"\u590D\u5236\u547D\u4EE4",copied:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25",checking:"\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026",latest:"\u5DF2\u662F\u6700\u65B0\u7248\u672C",found:"\u53D1\u73B0\u65B0\u7248\u672C",failed:"\u68C0\u67E5\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",current:"\u8FD0\u884C\u7248\u672C",latestLabel:"\u6700\u65B0\u7248\u672C",profile:"\u76EE\u6807 profile",unknown:"\u672A\u77E5",manual:"\u624B\u5DE5\u66F4\u65B0",manualHint:"\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u53EF\u5728\u5F53\u524D DSH \u7EC8\u7AEF\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF0C\u5B8C\u6210\u540E\u91CD\u542F DSH Web\u3002",manualHintDesktop:"\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u8BF7\u5148\u5B8C\u5168\u9000\u51FA DSH Desktop\uFF0C\u518D\u7528 Desktop \u81EA\u5E26\u7684 dsh \u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\u3002\u666E\u901A dsh \u4F1A\u62D2\u7EDD desktop profile\u3002",intro:"\u4EC5\u68C0\u67E5\u5E76\u66F4\u65B0\u5F53\u524D\u63D2\u4EF6\uFF0C\u4E0D\u4F1A\u8054\u52A8\u5B89\u88C5\u5176\u4ED6\u63D2\u4EF6\u3002",restart:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u91CD\u542F DSH Web\u3002",restartDesktop:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u65B0\u6253\u5F00 DSH Desktop\u3002",restarting:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u6B63\u5728\u91CD\u542F DSH Desktop\u2026",unavailable:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u81EA\u52A8\u66F4\u65B0\uFF0C\u8BF7\u4F7F\u7528\u624B\u5DE5\u66F4\u65B0\u547D\u4EE4\u3002"},OH={check:"Check for updates",update:"Update",close:"Close",recheck:"Check again",auto:"Update automatically",updating:"Updating\u2026",copy:"Copy command",copied:"Copied",copyFailed:"Copy failed",checking:"Checking for updates\u2026",latest:"You are up to date",found:"New version available",failed:"Could not check for updates. Try again later.",current:"Running version",latestLabel:"Latest version",profile:"Target profile",unknown:"Unknown",manual:"Manual update",manualHint:"If automatic update fails, run this command in the current DSH terminal, then restart DSH Web.",manualHintDesktop:"If automatic update fails, fully quit DSH Desktop, then run this command with Desktop's own dsh. A regular dsh rejects the desktop profile.",intro:"Only this plugin is checked and updated. Other plugins are not changed.",restart:"Update complete. Restart DSH Web.",restartDesktop:"Update complete. Fully quit and reopen DSH Desktop.",restarting:"Update complete. Restarting DSH Desktop\u2026",unavailable:"Automatic update is unavailable. Use the manual command."};function th(e){return e.toLowerCase().startsWith("en")?OH:kH}function AH(e,t,o,n){let r=th(e),s=t?.profileName==="desktop"?{...r,manualHint:r.manualHintDesktop,restart:r.restartDesktop}:r,a=o!=="idle",c=s.checking,l="";return o==="checking"?c=s.checking:o==="updating"?c=s.updating:n.type==="error"?(c=n.message||s.failed,l="error"):n.type==="restart"?(c=s.restart,l="success"):n.type==="restarting"?(c=s.restarting,l="success"):t===void 0?c=s.checking:t.latestCheckFailed?(c=s.failed,l="error"):!t.canAutoUpdate&&t.updateAvailable?(c=s.unavailable,l="update"):t.updateAvailable?(c=`${s.found}: v${t.latestVersion??s.unknown}`,l="update"):(c=s.latest,l="success"),{copy:s,busy:a,message:c,kind:l,loading:o==="updating",updateLabel:o==="updating"?s.updating:s.auto,disabled:a||t?.canAutoUpdate!==!0||t.updateAvailable!==!0,currentVersion:t===void 0?s.unknown:`v${t.currentVersion}`,latestVersion:t?.latestVersion===void 0?s.unknown:`v${t.latestVersion}`,profileName:t?.profileName??s.unknown,profileRaw:t?.profileName??"",latestRaw:t?.latestVersion??"latest"}}function LH(e,t,o){let n="idle",r=t,i={type:"status"},s=new Set,a=()=>{for(let l of s)l()},c=l=>{r=l,o?.(l)};return{subscribe(l){return s.add(l),()=>{s.delete(l)}},view(l){return AH(l,r,n,i)},async check(){if(n==="idle"){n="checking",i={type:"status"},a();try{c(await e("GET")),i={type:"status"}}catch(l){i={type:"error",message:l instanceof Error?l.message:""}}finally{n="idle",a()}}},async update(){if(n==="idle"){n="updating",i={type:"status"},a();try{let l=await e("POST");c(l),i={type:l.autoReload===!0?"restarting":"restart"}}catch(l){i={type:"error",message:l instanceof Error?l.message:""}}finally{n="idle",a()}}}}}function DH(){jO(MH)}function _H(e){if(e===null||typeof e!="object")return!1;let t=e;return typeof t.packageName=="string"&&typeof t.currentVersion=="string"&&typeof t.updateAvailable=="boolean"&&typeof t.profileName=="string"&&typeof t.canAutoUpdate=="boolean"&&typeof t.latestCheckFailed=="boolean"&&(t.latestVersion===void 0||typeof t.latestVersion=="string")}async function YO(e,t,o){let n=o===void 0?{}:{signal:o},r=await fetch(e,t==="GET"?{cache:"no-store",...n}:{method:"POST",headers:{"content-type":"application/json",[TH]:"1"},body:"{}",...n}),i=await r.json();if(!r.ok||!_H(i))throw new Error(i!==null&&typeof i=="object"&&"error"in i&&typeof i.error=="string"?i.error:th(document.documentElement.lang).failed);return i}function FH(e){let t=lt.default.useRef(null);return lt.default.useLayoutEffect(()=>{t.current?.replaceChildren(e.node)},[e.node]),lt.default.createElement("span",{ref:t,className:"mpi-icon","aria-hidden":!0})}function zH(e){let t=lt.default.useRef(null),[,o]=lt.default.useState(0),[n,r]=lt.default.useState("idle");lt.default.useEffect(()=>e.flow.subscribe(()=>o(d=>d+1)),[e.flow]),lt.default.useEffect(()=>{let d=document.documentElement,u=new MutationObserver(()=>o(m=>m+1));return u.observe(d,{attributes:!0,attributeFilter:["lang"]}),()=>u.disconnect()},[]),lt.default.useEffect(()=>{e.flow.check()},[e.flow]),lt.default.useEffect(()=>{let d=u=>{XO(u,e.onClose)};return document.addEventListener("keydown",d,!0),()=>document.removeEventListener("keydown",d,!0)},[e.onClose]);let i=document.documentElement.lang,s=e.flow.view(i),a=i.toLowerCase().startsWith("en")?e.enName:e.zhName,c=GO(s.profileRaw,e.packageName,s.latestRaw),l=n==="copied"?s.copy.copied:n==="failed"?s.copy.copyFailed:s.copy.copy;return lt.default.createElement(Rn,null,lt.default.createElement(Da,{open:!0,className:"mpi-dialog",width:680,zIndex:1200,title:`${a} ${s.copy.update}`,keyboard:!1,destroyOnHidden:!0,onCancel:e.onClose,afterOpenChange:d=>{d&&t.current&&(t.current.tabIndex=-1,t.current.focus())},footer:[lt.default.createElement(mo,{key:"check",disabled:s.busy,loading:s.busy&&!s.loading,onClick:()=>{e.flow.check()}},s.copy.recheck),lt.default.createElement(mo,{key:"update",type:"primary",disabled:s.disabled,loading:s.loading,onClick:()=>{e.flow.update()}},s.updateLabel)]},lt.default.createElement("div",{ref:t},lt.default.createElement("p",{className:"mpi-intro"},s.copy.intro),lt.default.createElement("dl",{className:"mpi-meta"},lt.default.createElement("dt",null,s.copy.current),lt.default.createElement("dd",null,lt.default.createElement("span",{className:"mpi-mono"},s.currentVersion)),lt.default.createElement("dt",null,s.copy.latestLabel),lt.default.createElement("dd",{className:"mpi-latest"},lt.default.createElement("span",{className:"mpi-mono"},s.latestVersion),lt.default.createElement("span",{className:"mpi-status",role:"status","data-kind":s.kind,...s.kind==="update"?{style:{color:"#e8b15a"}}:{}},s.message)),lt.default.createElement("dt",null,s.copy.profile),lt.default.createElement("dd",null,lt.default.createElement("span",{className:"mpi-mono"},s.profileName))),s.busy?lt.default.createElement(Ok,{percent:100,showInfo:!1,status:"active"}):null,lt.default.createElement("section",{className:"mpi-manual"},lt.default.createElement("h3",null,s.copy.manual),lt.default.createElement("p",null,s.copy.manualHint),lt.default.createElement("div",{className:"mpi-command"},lt.default.createElement("code",null,c),lt.default.createElement(mo,{disabled:s.busy,onClick:()=>{let d=navigator.clipboard?.writeText(c);if(d===void 0){r("failed");return}d.then(()=>{r("copied"),window.setTimeout(()=>r("idle"),1400)}).catch(()=>r("failed"))}},l))))))}function ZO(e){if(typeof document>"u"||document.body===null)return()=>{};DH();let t=new AbortController,o,n,r,i,s,a,c,l=()=>{r?.unmount(),r=void 0,n=void 0,i=void 0},d=()=>{if(r===void 0)return;i===void 0&&(i=e.createIcon("refresh"));let h=i;r.render(lt.default.createElement(Rn,null,lt.default.createElement(mo,{size:"small",shape:"default",onClick:m,icon:lt.default.createElement(FH,{node:h})},lt.default.createElement("span",{"data-mpi-label":""},th(document.documentElement.lang).check))))},u=()=>{a?.unmount(),a=void 0,s?.remove(),s=void 0};function m(){u();let h=document.createElement("div");h.className="mpi-dialog-root",document.body.append(h),s=h;let b=(0,ZS.createRoot)(h);a=b,b.render(lt.default.createElement(zH,{flow:LH(x=>YO(e.endpoint,x,t.signal),o,x=>{o=x,p()}),packageName:e.packageName,zhName:e.zhName,enName:e.enName,onClose:u}))}let p=()=>{let h=document.querySelector(e.titleRowSelector);if(h===null)return;let b=h.querySelector("h1,h2");if(b!==null&&o!==void 0){let v=b.querySelector(`.mpi-version[data-package="${e.packageName}"]`);v===null&&(v=document.createElement("span"),v.className="mpi-version",v.dataset.package=e.packageName,b.append(v));let C=`v${o.currentVersion}`;v.textContent!==C&&(v.textContent=C)}n!==void 0&&!n.isConnected&&l();let x=h.querySelector(e.linksSelector);if(x===null)return;let y=x.querySelector(`[data-mpi-check="${e.packageName}"]`);if(y!==null){let v=y.querySelector("[data-mpi-label]");(v===null||v.textContent!==th(document.documentElement.lang).check)&&d();return}let S=document.createElement("span");S.dataset.mpiCheck=e.packageName,S.className="mpi-check-host",x.append(S),n=S,r=(0,ZS.createRoot)(S),d()},g=async()=>(o=await YO(e.endpoint,"GET",t.signal),p(),o),f=new MutationObserver(()=>{c===void 0&&(c=window.requestAnimationFrame(()=>{c=void 0,p()}))});return f.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["lang"]}),p(),g().catch(()=>{}),()=>{t.abort(),f.disconnect(),u(),l(),c!==void 0&&window.cancelAnimationFrame(c),document.querySelectorAll(`[data-mpi-check="${e.packageName}"],.mpi-version[data-package="${e.packageName}"]`).forEach(h=>h.remove())}}var BH="dsh-automation-client",HH=["slots","locale","connection","sessions"],VH={refresh:["M13.5 5.5V2.5m0 0h-3m3 0-2.1 2.1A5.5 5.5 0 1 0 13.2 12"],download:["M8 2v8m0 0 3-3m-3 3-3-3M3 13v2h10v-2"],copy:["M5 5h8v8H5z","M3 3h8"],close:["m4 4 8 8M12 4 4 12"]};function WH(e){let t=document.createElement("span"),o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 16 16"),o.setAttribute("width","16"),o.setAttribute("height","16"),o.setAttribute("fill","none"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","1.5"),o.setAttribute("stroke-linecap","round"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("aria-hidden","true");for(let n of VH[e]){let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",n),o.append(r)}return t.append(o),t}var jH='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" aria-hidden="true" data-dsh-schedule-icon="1"><path fill="currentColor" d="M8 1.15A6.85 6.85 0 1 0 8 14.85 6.85 6.85 0 0 0 8 1.15Zm0 1.4a5.45 5.45 0 1 1 0 10.9 5.45 5.45 0 0 1 0-10.9Z"/><path fill="currentColor" d="M8.62 4.35H7.28v4.2l3.02 1.78.67-1.13-2.35-1.39V4.35Z"/></svg>';function UH(e){return typeof e=="function"}function KH(e){return typeof e=="function"}function qH(e){let t=new Set(e().map(i=>i.trim()).filter(i=>i!=="")),o=i=>{let s=(i.textContent??"").replace(/\s+/g," ").trim();if(!t.has(s))return;let a=i.querySelector("svg");a===null||a.getAttribute("data-dsh-schedule-icon")==="1"||(a.outerHTML=jH)},n=i=>{i instanceof HTMLButtonElement&&o(i);for(let s of i.querySelectorAll?.("button")??[])o(s)};n(document);let r=new MutationObserver(i=>{for(let s of i){let c=(s.target instanceof Element?s.target:s.target.parentElement)?.closest("button");c instanceof HTMLButtonElement&&o(c);for(let l of s.addedNodes)l instanceof Element&&n(l)}});return r.observe(document.documentElement,{childList:!0,characterData:!0,subtree:!0}),()=>{r.disconnect()}}function GH(e){e.effect(()=>WO(),"dsh-automation: styles"),e.effect(()=>e.locale.register(dc,{zh:uO,en:dO}),"dsh-automation: locale"),e.effect(()=>ZO({endpoint:"/api/michengai/dsh-automation/update",packageName:"@michengai/dsh-automation",titleRowSelector:".dsh-st-heading-row",linksSelector:".dsh-st-heading-links",zhName:"\u5B9A\u65F6\u4EFB\u52A1",enName:"Scheduled tasks",createIcon:WH}),"dsh-automation: plugin update ui");let t=e.locale.bind(dc),o=e.locale.bind("permission.access"),n=e.locale.bind("model"),r=oO(e.connection.rpc),i=Hk(e),s=async()=>{let c=i===void 0?void 0:await i.pickDirectory();if(c===void 0){if(i===void 0)throw new Error("picker-unavailable");return}return(await r.registerWorkspace(c)).id},a=c=>{US(c),qO([t("tab"),"Scheduled tasks","\u5B9A\u65F6\u4EFB\u52A1"],()=>{US(c)})};e.effect(()=>tO(r,()=>e.sessions),"dsh-automation: session sync"),e.effect(()=>qH(()=>[t("tab"),"Scheduled tasks","\u5B9A\u65F6\u4EFB\u52A1"]),"dsh-automation: settings icon"),e.slots.inject("settings.section",()=>e.slots.register({name:"settings.section",id:"scheduled-tasks",order:28,locale:dc,label:()=>t("tab"),icon:"schedule"},function(l){return(0,Fa.createElement)(cO,{t,permissionT:o,modelT:n,runtime:r,...l.close===void 0?{}:{closeSettings:l.close},addWorkspace:s})})),e.slots.inject("sidebar.schedule",()=>e.slots.register({name:"sidebar.schedule",id:"dsh-automation-schedule",order:10,locale:dc,label:()=>t("sidebar.tab")},function(l){return(0,Fa.createElement)(FO,{t,runtime:r,openSession:QS(e,r,l.openSession),openTaskSettings:a,...l.view===void 0?{}:{view:l.view},...l.showViewSwitch===void 0?{}:{showViewSwitch:l.showViewSwitch}})})),e.slots.inject("sidebar.workspaces",()=>{let c,l,d,u,m,p=()=>{},g=!1,f,h=()=>{queueMicrotask(()=>window.dispatchEvent(new Event("dsh-native-sidebar-change")))},b=N=>e.slots.subscribe?.("sidebar.channels",N)??(()=>{}),x=()=>{f!==void 0&&(window.clearInterval(f),f=void 0)},y=()=>{if(x(),p(),p=()=>{},m=void 0,c!==void 0){l!==void 0&&c.component===d&&(c.component=l);let N=c;N.__dshNativeTabs===u&&delete N.__dshNativeTabs,h()}c=void 0,l=void 0,d=void 0,u=void 0},S=(N,I)=>{let E=fO(N);return E===void 0?!1:(m!==E&&(p(),p=()=>{},m=E),E.getTabs().some(k=>k.id==="schedule")||(p=E.insert({id:"schedule",label:t("sidebar.tab"),order:30,matchSession:k=>k.startsWith(Ha),render:k=>{let F=typeof k.openSession=="function"?k.openSession:typeof k.open=="function"?k.open:I,A=QS(e,r,F);return(0,Fa.createElement)(Qg,{t,runtime:r,openSession:A,...UH(k.useSessions)?{useSessions:k.useSessions}:{},...KH(k.useWorkspaces)?{useWorkspaces:k.useWorkspaces}:{},...typeof k.renderSlot=="function"?{renderSlot:k.renderSlot}:{},...typeof k.useSessionStatus=="function"?{useSessionStatus:k.useSessionStatus}:{},...Gg(k),openTaskSettings:a})}})),!0)},v=()=>{let N=oh(e,"sidebar.workspaces");for(let I of N){let E=I;if(S(I)||S(E.component))return!0}return!1},C=()=>{if(v()){x();return}if(f!==void 0)return;let N=0;f=window.setInterval(()=>{N+=1,(v()||N>=20)&&x()},250)},w=()=>{if(!g){g=!0;try{let D=function(L){let G=QS(e,r,L.openSession??L.open);return(0,Fa.createElement)(zO,{t,runtime:r,hostProps:L,openSession:G,openTaskSettings:a,tabRegistry:z,...L.wide===void 0?{}:{wide:L.wide},hasChannels:()=>YH(e,"sidebar.channels"),subscribeChannels:b,...L.useSessions===void 0?{}:{useSessions:L.useSessions},...L.useWorkspaces===void 0?{}:{useWorkspaces:L.useWorkspaces},...L.renderSlot===void 0?{}:{renderSlot:L.renderSlot},officialTree:V})};var N=D;if(KC(oh(e,"sidebar"))){y();return}let I=oh(e,"sidebar.workspaces"),E=I.find(L=>L?.component!==void 0);if(c!==void 0&&(E!==c||E.component!==d)&&y(),E===c&&E?.component===d&&d!==void 0){C();return}if(E===void 0){y();return}let k=o0(I),F=k?.component;if(F!==void 0&&gO(F)){C();return}if(k?.component===void 0)return;let A=t0(k.component);if(A===void 0)return;l=A;let z=pO(l);u=z,qS(k,z);let _=D;_.displayName="AutomationNativeWorkspaceShell",_.__dshNativeTabHost=!0,_.__dshAutomationWrapped=!0,_.__dshAutomationOriginal=l;let V=l;qS(_,z),k.component=_,d=_,c=k,C(),h()}catch(I){console.warn("[dsh-automation] \u5305\u88F9\u5B98\u65B9\u4EFB\u52A1\u6811\u5931\u8D25",I)}finally{g=!1}}};w();let R=typeof e.slots.subscribe=="function"?e.slots.subscribe("sidebar.workspaces",w):()=>{},T=e.slots.subscribe?.("sidebar",w)??(()=>{});return window.addEventListener("dsh-native-sidebar-change",w),C(),()=>{R(),T(),window.removeEventListener("dsh-native-sidebar-change",w),y()}}),e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-automation-prefill",order:80,locale:dc},XH))}function QS(e,t,o){return n=>{let r=XC(e);QC({id:n,adopt:i=>t.adoptSession(i),listed:i=>{let s=e.sessions?.list?.getSnapshot();return(s?.ids??[]).includes(i)||s?.byId?.[i]!==void 0},...e.sessions?.refresh===void 0?{}:{refresh:()=>e.sessions.refresh()},...YC(r)?{openRuntime:i=>{ZC(r,i)}}:{},...o===void 0?{}:{openHost:o}})}}function XH(e){return(0,Fa.useEffect)(()=>{let t=o=>{if(!(o===null||o==="")){if(e.inputActions!==void 0){e.inputActions.setDraft(o),BS();return}Zk(o)&&BS()}};return t(Xk()),Yk(t)},[e.inputActions]),null}function oh(e,t){try{return(e.slots.entriesOfSlot??e.slots.entries)?.call(e.slots,t)??[]}catch{return[]}}function YH(e,t){return oh(e,t).length>0}
|
|
429
|
+
`,kH={check:"\u68C0\u67E5\u66F4\u65B0",update:"\u66F4\u65B0",close:"\u5173\u95ED",recheck:"\u91CD\u65B0\u68C0\u67E5",auto:"\u81EA\u52A8\u66F4\u65B0",updating:"\u6B63\u5728\u66F4\u65B0\u2026",copy:"\u590D\u5236\u547D\u4EE4",copied:"\u5DF2\u590D\u5236",copyFailed:"\u590D\u5236\u5931\u8D25",checking:"\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026",latest:"\u5DF2\u662F\u6700\u65B0\u7248\u672C",found:"\u53D1\u73B0\u65B0\u7248\u672C",failed:"\u68C0\u67E5\u66F4\u65B0\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",current:"\u8FD0\u884C\u7248\u672C",latestLabel:"\u6700\u65B0\u7248\u672C",profile:"\u76EE\u6807 profile",unknown:"\u672A\u77E5",manual:"\u624B\u5DE5\u66F4\u65B0",manualHint:"\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u53EF\u5728\u5F53\u524D DSH \u7EC8\u7AEF\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\uFF0C\u5B8C\u6210\u540E\u91CD\u542F DSH Web\u3002",manualHintDesktop:"\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u65F6\uFF0C\u8BF7\u5148\u5B8C\u5168\u9000\u51FA DSH Desktop\uFF0C\u518D\u7528 Desktop \u81EA\u5E26\u7684 dsh \u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\u3002\u666E\u901A dsh \u4F1A\u62D2\u7EDD desktop profile\u3002",intro:"\u4EC5\u68C0\u67E5\u5E76\u66F4\u65B0\u5F53\u524D\u63D2\u4EF6\uFF0C\u4E0D\u4F1A\u8054\u52A8\u5B89\u88C5\u5176\u4ED6\u63D2\u4EF6\u3002",restart:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u91CD\u542F DSH Web\u3002",restartDesktop:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u8BF7\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u65B0\u6253\u5F00 DSH Desktop\u3002",restarting:"\u66F4\u65B0\u5B8C\u6210\uFF0C\u6B63\u5728\u91CD\u542F DSH Desktop\u2026",unavailable:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u81EA\u52A8\u66F4\u65B0\uFF0C\u8BF7\u4F7F\u7528\u624B\u5DE5\u66F4\u65B0\u547D\u4EE4\u3002"},OH={check:"Check for updates",update:"Update",close:"Close",recheck:"Check again",auto:"Update automatically",updating:"Updating\u2026",copy:"Copy command",copied:"Copied",copyFailed:"Copy failed",checking:"Checking for updates\u2026",latest:"You are up to date",found:"New version available",failed:"Could not check for updates. Try again later.",current:"Running version",latestLabel:"Latest version",profile:"Target profile",unknown:"Unknown",manual:"Manual update",manualHint:"If automatic update fails, run this command in the current DSH terminal, then restart DSH Web.",manualHintDesktop:"If automatic update fails, fully quit DSH Desktop, then run this command with Desktop's own dsh. A regular dsh rejects the desktop profile.",intro:"Only this plugin is checked and updated. Other plugins are not changed.",restart:"Update complete. Restart DSH Web.",restartDesktop:"Update complete. Fully quit and reopen DSH Desktop.",restarting:"Update complete. Restarting DSH Desktop\u2026",unavailable:"Automatic update is unavailable. Use the manual command."};function th(e){return e.toLowerCase().startsWith("en")?OH:kH}function AH(e,t,o,n){let r=th(e),s=t?.profileName==="desktop"?{...r,manualHint:r.manualHintDesktop,restart:r.restartDesktop}:r,a=o!=="idle",c=s.checking,l="";return o==="checking"?c=s.checking:o==="updating"?c=s.updating:n.type==="error"?(c=n.message||s.failed,l="error"):n.type==="restart"?(c=s.restart,l="success"):n.type==="restarting"?(c=s.restarting,l="success"):t===void 0?c=s.checking:t.latestCheckFailed?(c=s.failed,l="error"):!t.canAutoUpdate&&t.updateAvailable?(c=s.unavailable,l="update"):t.updateAvailable?(c=`${s.found}: v${t.latestVersion??s.unknown}`,l="update"):(c=s.latest,l="success"),{copy:s,busy:a,message:c,kind:l,loading:o==="updating",updateLabel:o==="updating"?s.updating:s.auto,disabled:a||t?.canAutoUpdate!==!0||t.updateAvailable!==!0,currentVersion:t===void 0?s.unknown:`v${t.currentVersion}`,latestVersion:t?.latestVersion===void 0?s.unknown:`v${t.latestVersion}`,profileName:t?.profileName??s.unknown,profileRaw:t?.profileName??"",latestRaw:t?.latestVersion??"latest"}}function LH(e,t,o){let n="idle",r=t,i={type:"status"},s=new Set,a=()=>{for(let l of s)l()},c=l=>{r=l,o?.(l)};return{subscribe(l){return s.add(l),()=>{s.delete(l)}},view(l){return AH(l,r,n,i)},async check(){if(n==="idle"){n="checking",i={type:"status"},a();try{c(await e("GET")),i={type:"status"}}catch(l){i={type:"error",message:l instanceof Error?l.message:""}}finally{n="idle",a()}}},async update(){if(n==="idle"){n="updating",i={type:"status"},a();try{let l=await e("POST");c(l),i={type:l.autoReload===!0?"restarting":"restart"}}catch(l){i={type:"error",message:l instanceof Error?l.message:""}}finally{n="idle",a()}}}}}function DH(){jO(MH)}function _H(e){if(e===null||typeof e!="object")return!1;let t=e;return typeof t.packageName=="string"&&typeof t.currentVersion=="string"&&typeof t.updateAvailable=="boolean"&&typeof t.profileName=="string"&&typeof t.canAutoUpdate=="boolean"&&typeof t.latestCheckFailed=="boolean"&&(t.latestVersion===void 0||typeof t.latestVersion=="string")}async function YO(e,t,o){let n=o===void 0?{}:{signal:o},r=await fetch(e,t==="GET"?{cache:"no-store",...n}:{method:"POST",headers:{"content-type":"application/json",[TH]:"1"},body:"{}",...n}),i=await r.json();if(!r.ok||!_H(i))throw new Error(i!==null&&typeof i=="object"&&"error"in i&&typeof i.error=="string"?i.error:th(document.documentElement.lang).failed);return i}function FH(e){let t=lt.default.useRef(null);return lt.default.useLayoutEffect(()=>{t.current?.replaceChildren(e.node)},[e.node]),lt.default.createElement("span",{ref:t,className:"mpi-icon","aria-hidden":!0})}function zH(e){let t=lt.default.useRef(null),[,o]=lt.default.useState(0),[n,r]=lt.default.useState("idle");lt.default.useEffect(()=>e.flow.subscribe(()=>o(d=>d+1)),[e.flow]),lt.default.useEffect(()=>{let d=document.documentElement,u=new MutationObserver(()=>o(m=>m+1));return u.observe(d,{attributes:!0,attributeFilter:["lang"]}),()=>u.disconnect()},[]),lt.default.useEffect(()=>{e.flow.check()},[e.flow]),lt.default.useEffect(()=>{let d=u=>{XO(u,e.onClose)};return document.addEventListener("keydown",d,!0),()=>document.removeEventListener("keydown",d,!0)},[e.onClose]);let i=document.documentElement.lang,s=e.flow.view(i),a=i.toLowerCase().startsWith("en")?e.enName:e.zhName,c=GO(s.profileRaw,e.packageName,s.latestRaw),l=n==="copied"?s.copy.copied:n==="failed"?s.copy.copyFailed:s.copy.copy;return lt.default.createElement(Rn,null,lt.default.createElement(Da,{open:!0,className:"mpi-dialog",width:680,zIndex:1200,title:`${a} ${s.copy.update}`,keyboard:!1,destroyOnHidden:!0,onCancel:e.onClose,afterOpenChange:d=>{d&&t.current&&(t.current.tabIndex=-1,t.current.focus())},footer:[lt.default.createElement(mo,{key:"check",disabled:s.busy,loading:s.busy&&!s.loading,onClick:()=>{e.flow.check()}},s.copy.recheck),lt.default.createElement(mo,{key:"update",type:"primary",disabled:s.disabled,loading:s.loading,onClick:()=>{e.flow.update()}},s.updateLabel)]},lt.default.createElement("div",{ref:t},lt.default.createElement("p",{className:"mpi-intro"},s.copy.intro),lt.default.createElement("dl",{className:"mpi-meta"},lt.default.createElement("dt",null,s.copy.current),lt.default.createElement("dd",null,lt.default.createElement("span",{className:"mpi-mono"},s.currentVersion)),lt.default.createElement("dt",null,s.copy.latestLabel),lt.default.createElement("dd",{className:"mpi-latest"},lt.default.createElement("span",{className:"mpi-mono"},s.latestVersion),lt.default.createElement("span",{className:"mpi-status",role:"status","data-kind":s.kind,...s.kind==="update"?{style:{color:"#e8b15a"}}:{}},s.message)),lt.default.createElement("dt",null,s.copy.profile),lt.default.createElement("dd",null,lt.default.createElement("span",{className:"mpi-mono"},s.profileName))),s.busy?lt.default.createElement(Ok,{percent:100,showInfo:!1,status:"active"}):null,lt.default.createElement("section",{className:"mpi-manual"},lt.default.createElement("h3",null,s.copy.manual),lt.default.createElement("p",null,s.copy.manualHint),lt.default.createElement("div",{className:"mpi-command"},lt.default.createElement("code",null,c),lt.default.createElement(mo,{disabled:s.busy,onClick:()=>{let d=navigator.clipboard?.writeText(c);if(d===void 0){r("failed");return}d.then(()=>{r("copied"),window.setTimeout(()=>r("idle"),1400)}).catch(()=>r("failed"))}},l))))))}function ZO(e){if(typeof document>"u"||document.body===null)return()=>{};DH();let t=new AbortController,o,n,r,i,s,a,c,l=()=>{r?.unmount(),r=void 0,n=void 0,i=void 0},d=()=>{if(r===void 0)return;i===void 0&&(i=e.createIcon("refresh"));let h=i;r.render(lt.default.createElement(Rn,null,lt.default.createElement(mo,{size:"small",shape:"default",onClick:m,icon:lt.default.createElement(FH,{node:h})},lt.default.createElement("span",{"data-mpi-label":""},th(document.documentElement.lang).check))))},u=()=>{a?.unmount(),a=void 0,s?.remove(),s=void 0};function m(){u();let h=document.createElement("div");h.className="mpi-dialog-root",document.body.append(h),s=h;let b=(0,ZS.createRoot)(h);a=b,b.render(lt.default.createElement(zH,{flow:LH(x=>YO(e.endpoint,x,t.signal),o,x=>{o=x,p()}),packageName:e.packageName,zhName:e.zhName,enName:e.enName,onClose:u}))}let p=()=>{let h=document.querySelector(e.titleRowSelector);if(h===null)return;let b=h.querySelector("h1,h2");if(b!==null&&o!==void 0){let v=b.querySelector(`.mpi-version[data-package="${e.packageName}"]`);v===null&&(v=document.createElement("span"),v.className="mpi-version",v.dataset.package=e.packageName,b.append(v));let C=`v${o.currentVersion}`;v.textContent!==C&&(v.textContent=C)}n!==void 0&&!n.isConnected&&l();let x=h.querySelector(e.linksSelector);if(x===null)return;let y=x.querySelector(`[data-mpi-check="${e.packageName}"]`);if(y!==null){let v=y.querySelector("[data-mpi-label]");(v===null||v.textContent!==th(document.documentElement.lang).check)&&d();return}let S=document.createElement("span");S.dataset.mpiCheck=e.packageName,S.className="mpi-check-host",x.append(S),n=S,r=(0,ZS.createRoot)(S),d()},g=async()=>(o=await YO(e.endpoint,"GET",t.signal),p(),o),f=new MutationObserver(()=>{c===void 0&&(c=window.requestAnimationFrame(()=>{c=void 0,p()}))});return f.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["lang"]}),p(),g().catch(()=>{}),()=>{t.abort(),f.disconnect(),u(),l(),c!==void 0&&window.cancelAnimationFrame(c),document.querySelectorAll(`[data-mpi-check="${e.packageName}"],.mpi-version[data-package="${e.packageName}"]`).forEach(h=>h.remove())}}var BH="dsh-automation-client",HH=["slots","locale","connection","sessions"],VH={refresh:["M13.5 5.5V2.5m0 0h-3m3 0-2.1 2.1A5.5 5.5 0 1 0 13.2 12"],download:["M8 2v8m0 0 3-3m-3 3-3-3M3 13v2h10v-2"],copy:["M5 5h8v8H5z","M3 3h8"],close:["m4 4 8 8M12 4 4 12"]};function WH(e){let t=document.createElement("span"),o=document.createElementNS("http://www.w3.org/2000/svg","svg");o.setAttribute("viewBox","0 0 16 16"),o.setAttribute("width","16"),o.setAttribute("height","16"),o.setAttribute("fill","none"),o.setAttribute("stroke","currentColor"),o.setAttribute("stroke-width","1.5"),o.setAttribute("stroke-linecap","round"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("aria-hidden","true");for(let n of VH[e]){let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",n),o.append(r)}return t.append(o),t}var jH='<svg viewBox="0 0 16 16" width="16" height="16" fill="none" aria-hidden="true" data-dsh-schedule-icon="1"><path fill="currentColor" d="M8 1.15A6.85 6.85 0 1 0 8 14.85 6.85 6.85 0 0 0 8 1.15Zm0 1.4a5.45 5.45 0 1 1 0 10.9 5.45 5.45 0 0 1 0-10.9Z"/><path fill="currentColor" d="M8.62 4.35H7.28v4.2l3.02 1.78.67-1.13-2.35-1.39V4.35Z"/></svg>';function UH(e){return typeof e=="function"}function KH(e){return typeof e=="function"}function qH(e){let t=new Set(e().map(i=>i.trim()).filter(i=>i!=="")),o=i=>{let s=(i.textContent??"").replace(/\s+/g," ").trim();if(!t.has(s))return;let a=i.querySelector("svg");a===null||a.getAttribute("data-dsh-schedule-icon")==="1"||(a.outerHTML=jH)},n=i=>{i instanceof HTMLButtonElement&&o(i);for(let s of i.querySelectorAll?.("button")??[])o(s)};n(document);let r=new MutationObserver(i=>{for(let s of i){let c=(s.target instanceof Element?s.target:s.target.parentElement)?.closest("button");c instanceof HTMLButtonElement&&o(c);for(let l of s.addedNodes)l instanceof Element&&n(l)}});return r.observe(document.documentElement,{childList:!0,characterData:!0,subtree:!0}),()=>{r.disconnect()}}function GH(e){e.effect(()=>WO(),"dsh-automation: styles"),e.effect(()=>e.locale.register(dc,{zh:uO,en:dO}),"dsh-automation: locale"),e.effect(()=>ZO({endpoint:"/api/michengai/dsh-automation/update",packageName:"@michengai/dsh-automation",titleRowSelector:".dsh-st-heading-row",linksSelector:".dsh-st-heading-links",zhName:"\u5B9A\u65F6\u4EFB\u52A1",enName:"Scheduled tasks",createIcon:WH}),"dsh-automation: plugin update ui");let t=e.locale.bind(dc),o=e.locale.bind("permission.access"),n=e.locale.bind("model"),r=oO(e.connection.rpc),i=Hk(e),s=async()=>{let c=i===void 0?void 0:await i.pickDirectory();if(c===void 0){if(i===void 0)throw new Error("picker-unavailable");return}return(await r.registerWorkspace(c)).id},a=c=>{US(c),qO([t("tab"),"Scheduled tasks","\u5B9A\u65F6\u4EFB\u52A1"],()=>{US(c)})};e.effect(()=>tO(r,()=>e.sessions),"dsh-automation: session sync"),e.effect(()=>qH(()=>[t("tab"),"Scheduled tasks","\u5B9A\u65F6\u4EFB\u52A1"]),"dsh-automation: settings icon"),e.slots.inject("settings.section",()=>e.slots.register({name:"settings.section",id:"scheduled-tasks",order:35,locale:dc,label:()=>t("tab"),icon:"schedule"},function(l){return(0,Fa.createElement)(cO,{t,permissionT:o,modelT:n,runtime:r,...l.close===void 0?{}:{closeSettings:l.close},addWorkspace:s})})),e.slots.inject("sidebar.schedule",()=>e.slots.register({name:"sidebar.schedule",id:"dsh-automation-schedule",order:10,locale:dc,label:()=>t("sidebar.tab")},function(l){return(0,Fa.createElement)(FO,{t,runtime:r,openSession:QS(e,r,l.openSession),openTaskSettings:a,...l.view===void 0?{}:{view:l.view},...l.showViewSwitch===void 0?{}:{showViewSwitch:l.showViewSwitch}})})),e.slots.inject("sidebar.workspaces",()=>{let c,l,d,u,m,p=()=>{},g=!1,f,h=()=>{queueMicrotask(()=>window.dispatchEvent(new Event("dsh-native-sidebar-change")))},b=N=>e.slots.subscribe?.("sidebar.channels",N)??(()=>{}),x=()=>{f!==void 0&&(window.clearInterval(f),f=void 0)},y=()=>{if(x(),p(),p=()=>{},m=void 0,c!==void 0){l!==void 0&&c.component===d&&(c.component=l);let N=c;N.__dshNativeTabs===u&&delete N.__dshNativeTabs,h()}c=void 0,l=void 0,d=void 0,u=void 0},S=(N,I)=>{let E=fO(N);return E===void 0?!1:(m!==E&&(p(),p=()=>{},m=E),E.getTabs().some(k=>k.id==="schedule")||(p=E.insert({id:"schedule",label:t("sidebar.tab"),order:30,matchSession:k=>k.startsWith(Ha),render:k=>{let F=typeof k.openSession=="function"?k.openSession:typeof k.open=="function"?k.open:I,A=QS(e,r,F);return(0,Fa.createElement)(Qg,{t,runtime:r,openSession:A,...UH(k.useSessions)?{useSessions:k.useSessions}:{},...KH(k.useWorkspaces)?{useWorkspaces:k.useWorkspaces}:{},...typeof k.renderSlot=="function"?{renderSlot:k.renderSlot}:{},...typeof k.useSessionStatus=="function"?{useSessionStatus:k.useSessionStatus}:{},...Gg(k),openTaskSettings:a})}})),!0)},v=()=>{let N=oh(e,"sidebar.workspaces");for(let I of N){let E=I;if(S(I)||S(E.component))return!0}return!1},C=()=>{if(v()){x();return}if(f!==void 0)return;let N=0;f=window.setInterval(()=>{N+=1,(v()||N>=20)&&x()},250)},w=()=>{if(!g){g=!0;try{let D=function(L){let G=QS(e,r,L.openSession??L.open);return(0,Fa.createElement)(zO,{t,runtime:r,hostProps:L,openSession:G,openTaskSettings:a,tabRegistry:z,...L.wide===void 0?{}:{wide:L.wide},hasChannels:()=>YH(e,"sidebar.channels"),subscribeChannels:b,...L.useSessions===void 0?{}:{useSessions:L.useSessions},...L.useWorkspaces===void 0?{}:{useWorkspaces:L.useWorkspaces},...L.renderSlot===void 0?{}:{renderSlot:L.renderSlot},officialTree:V})};var N=D;if(KC(oh(e,"sidebar"))){y();return}let I=oh(e,"sidebar.workspaces"),E=I.find(L=>L?.component!==void 0);if(c!==void 0&&(E!==c||E.component!==d)&&y(),E===c&&E?.component===d&&d!==void 0){C();return}if(E===void 0){y();return}let k=o0(I),F=k?.component;if(F!==void 0&&gO(F)){C();return}if(k?.component===void 0)return;let A=t0(k.component);if(A===void 0)return;l=A;let z=pO(l);u=z,qS(k,z);let _=D;_.displayName="AutomationNativeWorkspaceShell",_.__dshNativeTabHost=!0,_.__dshAutomationWrapped=!0,_.__dshAutomationOriginal=l;let V=l;qS(_,z),k.component=_,d=_,c=k,C(),h()}catch(I){console.warn("[dsh-automation] \u5305\u88F9\u5B98\u65B9\u4EFB\u52A1\u6811\u5931\u8D25",I)}finally{g=!1}}};w();let R=typeof e.slots.subscribe=="function"?e.slots.subscribe("sidebar.workspaces",w):()=>{},T=e.slots.subscribe?.("sidebar",w)??(()=>{});return window.addEventListener("dsh-native-sidebar-change",w),C(),()=>{R(),T(),window.removeEventListener("dsh-native-sidebar-change",w),y()}}),e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-automation-prefill",order:80,locale:dc},XH))}function QS(e,t,o){return n=>{let r=XC(e);QC({id:n,adopt:i=>t.adoptSession(i),listed:i=>{let s=e.sessions?.list?.getSnapshot();return(s?.ids??[]).includes(i)||s?.byId?.[i]!==void 0},...e.sessions?.refresh===void 0?{}:{refresh:()=>e.sessions.refresh()},...YC(r)?{openRuntime:i=>{ZC(r,i)}}:{},...o===void 0?{}:{openHost:o}})}}function XH(e){return(0,Fa.useEffect)(()=>{let t=o=>{if(!(o===null||o==="")){if(e.inputActions!==void 0){e.inputActions.setDraft(o),BS();return}Zk(o)&&BS()}};return t(Xk()),Yk(t)},[e.inputActions]),null}function oh(e,t){try{return(e.slots.entriesOfSlot??e.slots.entries)?.call(e.slots,t)??[]}catch{return[]}}function YH(e,t){return oh(e,t).length>0}
|
|
430
430
|
/*! Bundled license information:
|
|
431
431
|
|
|
432
432
|
react-is/cjs/react-is.production.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michengai/dsh-automation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.64",
|
|
4
4
|
"description": "DSH Automation — 在独立 DSH Session 中按计划执行和管理编码任务 · Schedule and manage coding tasks in isolated DSH sessions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@11.22.0",
|