@michengai/dsh-automation 0.1.62 → 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 CHANGED
@@ -6,6 +6,16 @@ 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
+
13
+ ## 0.1.63 - 2026-10-12
14
+
15
+ - Fix Web startup on DSH `0.2.1-alpha.2` while retaining compatibility with the previously supported Host versions.
16
+ - Preserve the Host’s trusted-address configuration and register scheduled-task requests in the automation plugin’s own scope.
17
+ - Restart DSH and refresh the page after upgrading.
18
+
9
19
  ## 0.1.62 - 2026-10-12
10
20
 
11
21
  - Support DSH `0.2.1-alpha.2` while retaining all existing supported versions.
@@ -6,6 +6,16 @@
6
6
 
7
7
  ## 未发布
8
8
 
9
+ ## 0.1.64 - 2026-10-14
10
+
11
+ - 调整定时任务在设置中的导航排序序号,避免与其他插件同级竞争导致菜单位置跳动。
12
+
13
+ ## 0.1.63 - 2026-10-12
14
+
15
+ - 修复 DSH `0.2.1-alpha.2` 下的 Web 启动失败,继续兼容此前支持的宿主版本。
16
+ - 保留宿主的可信地址配置,定时任务请求在自动化插件自身作用域注册。
17
+ - 升级后请重启 DSH 并刷新页面。
18
+
9
19
  ## 0.1.62 - 2026-10-12
10
20
 
11
21
  - 支持 DSH `0.2.1-alpha.2`,继续兼容既有已支持版本。
package/README.md CHANGED
@@ -73,10 +73,10 @@ For a desktop workbench, download [DSH Codex Desktop](https://github.com/Micheng
73
73
 
74
74
  ## Prerequisites
75
75
 
76
- - The current source uses DSH `0.2.0-rc.2` for development and real Host compatibility tests, and declares support through `0.2.0-rc.2`. Back up automation storage and sessions in the Profile before upgrading the Host. `0.1.7` and `0.2.0` write V4 sessions, and V4 sessions cannot be read after downgrading.
77
- - Official DSH peerDependencies are exactly `0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2`. The `0.1.6` line is absent because it will not get a release candidate; hosts still on `0.1.6-alpha.1` or `0.1.6-alpha.2` need `0.1.7-rc.1` or later for the next plugin release. `@deepseek-ai/dsh-agent-presets` and `@deepseek-ai/dsh-agent-preset-registry` are not peers: the host install gate checks every `@deepseek-ai/dsh-*` peer against the running version and ignores `optional`. The old package has no `0.1.7` or `0.2.0` release, and the renamed package does not exist on older hosts. Scheduled tasks still use the host `agentPresets` service. Development dependencies are pinned to `0.2.0-rc.2`. Use one consistent official package version within each Host.
76
+ - The current source uses DSH `0.2.0-rc.2` for development and real Host compatibility tests, and declares support through `0.2.1-alpha.2`. Back up automation storage and sessions in the Profile before upgrading the Host. `0.1.7` and `0.2.0` write V4 sessions, and V4 sessions cannot be read after downgrading.
77
+ - Official DSH peerDependencies are exactly `0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2`. The `0.1.6` line is absent because it will not get a release candidate; hosts still on `0.1.6-alpha.1` or `0.1.6-alpha.2` need `0.1.7-rc.1` or later for the next plugin release. `@deepseek-ai/dsh-agent-presets` and `@deepseek-ai/dsh-agent-preset-registry` are not peers: the host install gate checks every `@deepseek-ai/dsh-*` peer against the running version and ignores `optional`. The old package has no `0.1.7` or `0.2.0` release, and the renamed package does not exist on older hosts. Scheduled tasks still use the host `agentPresets` service. Development dependencies are pinned to `0.2.0-rc.2`. Use one consistent official package version within each Host.
78
78
  - Other versions are outside the declared compatibility range. Installers may warn, and strict peer validation rejects them. Extend and pass the version matrix before adding a new rc.
79
- - The Connection patch replaces the Web bundle's configured injection list with `[webServer, webRuntime]`; Loader still merges dependencies declared by the plugin source. Custom Hosts with additional configured injections must retain these two entries and their extra dependencies in a later Profile patch. This patch does not automatically merge other bundles' lists.
79
+ - The automation bundle does not override the official Connection entry. Each Host keeps its own startup dependencies, trusted-host expressions, and custom configuration; automation registers its RPC channel in its own plugin scope.
80
80
  - A working DeepSeek Harness Web installation with `dsh` available in PowerShell.
81
81
  - Examples use the `web` profile; replace it with the target profile.
82
82
  - Source installation and development require Node.js 22.19+. npm installation does not require running `npm install` in an arbitrary directory.
package/README.zh-CN.md CHANGED
@@ -73,10 +73,10 @@
73
73
 
74
74
  ## 前置条件
75
75
 
76
- - 当前源码以 DSH `0.2.0-rc.2` 为开发和真实宿主测试基线,并声明支持到 `0.2.0-rc.2`。升级宿主前备份 Profile 中的自动化存储和会话目录。`0.1.7` 和 `0.2.0` 写入 V4 会话,V4 会话不支持降级读取。
77
- - 官方 DSH peerDependencies 精确限定为 `0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2`。`0.1.6` 这条线不会再有候选版,所以不在名单里;仍停在 `0.1.6-alpha.1`、`0.1.6-alpha.2` 的宿主,安装下一版前需要升到 `0.1.7-rc.1` 或更新。`@deepseek-ai/dsh-agent-presets` 和 `@deepseek-ai/dsh-agent-preset-registry` 都不写入 peer:宿主安装门会拿每一个 `@deepseek-ai/dsh-*` peer 去对当前版本,并且不看 `optional`。旧包没有 `0.1.7` 或 `0.2.0` 发布版,改名后的包在旧宿主上也不存在。定时任务仍使用宿主的 `agentPresets` 服务。开发依赖固定为 `0.2.0-rc.2`。同一宿主中的官方包应使用一致版本。
76
+ - 当前源码以 DSH `0.2.0-rc.2` 为开发和真实宿主测试基线,并声明支持到 `0.2.1-alpha.2`。升级宿主前备份 Profile 中的自动化存储和会话目录。`0.1.7` 和 `0.2.0` 写入 V4 会话,V4 会话不支持降级读取。
77
+ - 官方 DSH peerDependencies 精确限定为 `0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2`。`0.1.6` 这条线不会再有候选版,所以不在名单里;仍停在 `0.1.6-alpha.1`、`0.1.6-alpha.2` 的宿主,安装下一版前需要升到 `0.1.7-rc.1` 或更新。`@deepseek-ai/dsh-agent-presets` 和 `@deepseek-ai/dsh-agent-preset-registry` 都不写入 peer:宿主安装门会拿每一个 `@deepseek-ai/dsh-*` peer 去对当前版本,并且不看 `optional`。旧包没有 `0.1.7` 或 `0.2.0` 发布版,改名后的包在旧宿主上也不存在。定时任务仍使用宿主的 `agentPresets` 服务。开发依赖固定为 `0.2.0-rc.2`。同一宿主中的官方包应使用一致版本。
78
78
  - 其他版本不在声明兼容范围内;安装器可能提示 peer 警告,启用严格 peer 校验时会失败。支持新 rc 前需扩展版本矩阵并通过验证。
79
- - Connection 补丁替换 Web bundle 的配置注入列表为 `[webServer, webRuntime]`,Loader 仍会合并插件源码声明的依赖。自定义宿主若增加了其他配置注入,需在后置 Profile 补丁中保留这两项并补齐自定义依赖;本补丁不自动合并其他 bundle 的列表。
79
+ - 自动化 bundle 不覆盖官方 Connection 条目,各版宿主保留自己的启动依赖、可信地址表达式和自定义配置;自动化在自身插件作用域注册 RPC 路由。
80
80
  - 已可正常运行 DeepSeek Harness Web,且可在 PowerShell 中使用 `dsh`。
81
81
  - 以下示例使用 `web` profile;请替换为实际目标 profile。
82
82
  - 从源码安装或二次开发需要 Node.js 22.19+;仅从 npm 安装无需在任意目录执行 `npm install`。
package/cordis.patch.yml CHANGED
@@ -1,11 +1,5 @@
1
1
  # 一次安装同时挂载 Host 服务并发布 Web 客户端。
2
- # 新版 Connection 的独立 RPC 注册在自身作用域读取 webServer,需显式注入。
3
- # 此列表替换官方 Web bundle 的 [webRuntime];插件源码声明的依赖仍由 Loader 合并。
4
- - id: connection
5
- name: '@deepseek-ai/dsh-client-connection'
6
- inject:
7
- - webServer
8
- - webRuntime
2
+ # 不覆盖官方 Connection;各版宿主自行管理启动服务和可信地址配置。
9
3
  - insert:
10
4
  - id: dsh-automation
11
5
  name: '@michengai/dsh-automation'
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/lib/index.js CHANGED
@@ -22999,7 +22999,19 @@ async function snapshotValue(service, payload, signal) {
22999
22999
  };
23000
23000
  }
23001
23001
  function registerAutomationRpc(ctx, service) {
23002
- return ctx.connection.rpc.handle("/dsh-automation", async (endpoint, rawPayload, signal) => {
23002
+ const connection = ctx.connection;
23003
+ let prototype = connection;
23004
+ let rpc;
23005
+ while (prototype !== null) {
23006
+ const descriptor = Object.getOwnPropertyDescriptor(prototype, "rpc");
23007
+ if (descriptor !== void 0) {
23008
+ rpc = descriptor.get === void 0 ? connection.rpc : descriptor.get.call(connection);
23009
+ break;
23010
+ }
23011
+ prototype = Object.getPrototypeOf(prototype);
23012
+ }
23013
+ rpc ??= connection.rpc;
23014
+ return rpc.handle("/dsh-automation", async (endpoint, rawPayload, signal) => {
23003
23015
  try {
23004
23016
  const payload = record2(rawPayload, "payload");
23005
23017
  switch (endpoint) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michengai/dsh-automation",
3
- "version": "0.1.62",
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",
@@ -63,7 +63,7 @@
63
63
  "typecheck": "tsc --noEmit -p tsconfig.json",
64
64
  "test": "node --import ./tests/register-dsh-stubs.mjs --import tsx --test tests/*.test.ts",
65
65
  "check": "pnpm typecheck && pnpm test && pnpm test:host && pnpm build",
66
- "test:host": "node --import tsx --test tests/host-compatibility.test.mjs",
66
+ "test:host": "node --import tsx --test tests/host-compatibility.test.mjs tests/connection-loader.test.mjs",
67
67
  "test:composition": "node --import tsx scripts/verify-sidebar-composition.mjs",
68
68
  "test:matrix": "pnpm build && node scripts/test-version-matrix.mjs"
69
69
  },
@@ -73,7 +73,7 @@
73
73
  "zod": "^4.1.5"
74
74
  },
75
75
  "peerDependencies": {
76
- "@deepseek-ai/cordis": ">=4.0.1 <5.0.0",
76
+ "@deepseek-ai/cordis": ">=4.0.1 <5.0.0 || 4.0.5-alpha.1",
77
77
  "@deepseek-ai/dsh-agent": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2",
78
78
  "@deepseek-ai/dsh-agent-default-model": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2",
79
79
  "@deepseek-ai/dsh-client-connection": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2",
@@ -89,7 +89,7 @@
89
89
  "@deepseek-ai/dsh-tools": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2",
90
90
  "@deepseek-ai/dsh-user-approval": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2",
91
91
  "@deepseek-ai/dsh-workspace": "0.1.2-rc.1 || 0.1.5-rc.1 || 0.1.5-rc.2 || 0.1.5-rc.3 || 0.1.7-rc.1 || 0.1.7-rc.2 || 0.2.0-rc.1 || 0.2.0-rc.2 || 0.2.1-alpha.2",
92
- "@deepseek-ai/schemastery": ">=3.18.1 <4.0.0",
92
+ "@deepseek-ai/schemastery": ">=3.18.1 <4.0.0 || 3.18.5-alpha.1",
93
93
  "react": "^18.2.0"
94
94
  },
95
95
  "peerDependenciesMeta": {