@michengai/dsh-automation 1.0.4 → 1.0.5

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 CHANGED
@@ -1,9 +1,10 @@
1
1
  window.__ModuleLoader__.load({ id: "@michengai/dsh-automation", factory: (require) => {
2
2
  var module = { exports: {} }; var exports = module.exports;
3
- "use strict";var tr=Object.create;var rn=Object.defineProperty;var sr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var rr=Object.getPrototypeOf,ir=Object.prototype.hasOwnProperty;var ar=(e,n)=>{for(var t in n)rn(e,t,{get:n[t],enumerable:!0})},Tt=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of or(n))!ir.call(e,r)&&r!==t&&rn(e,r,{get:()=>n[r],enumerable:!(s=sr(n,r))||s.enumerable});return e};var an=(e,n,t)=>(t=e!=null?tr(rr(e)):{},Tt(n||!e||!e.__esModule?rn(t,"default",{value:e,enumerable:!0}):t,e)),dr=e=>Tt(rn({},"__esModule",{value:!0}),e);var ki={};ar(ki,{apply:()=>xi,inject:()=>gi,name:()=>hi});module.exports=dr(ki);var He=require("react");var Q=require("react");function At(e,n){return n(`run.trigger.${e}`)}var ue=class extends Error{constructor(t){super(t);this.key=t}},lr=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function cn(e){return`/${lr.test(e.name)?e.name:e.id}`}function cr(e,n,t){let s=n.startsWith("/")?n:`/${n}`,r=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(^|\\s)${r}(?=\\s|$)`).test(e))return{text:e,caret:Math.min(Math.max(t,0),e.length)};let i=Math.min(Math.max(t,0),e.length),o=e.slice(0,i),a=e.slice(i),l=`${o.length>0&&!/\s$/.test(o)?" ":""}${s} `;return{text:o+l+a,caret:o.length+l.length}}function Kn(e,n){let t=Math.min(Math.max(n,0),e.length),s=/(?:^|\s)\/([^\s/]*)$/.exec(e.slice(0,t));if(s===null)return;let r=s[1]??"";return{start:t-r.length-1,query:r}}function It(e,n){let t=n.trim().toLowerCase();return t===""?[...e]:e.filter(s=>s.id.toLowerCase().includes(t)||s.name.toLowerCase().includes(t))}function Nt(e,n,t){let s=Kn(e,n),r=t.startsWith("/")?t:`/${t}`;return s===void 0?cr(e,r,n):{text:`${e.slice(0,s.start)}${r} ${e.slice(n)}`,caret:s.start+r.length+1}}function Ct(e,n){let t=new Set(n.map(o=>cn(o).slice(1))),s=[],r=/(^|\s)(\/[a-z0-9]+(?:-[a-z0-9]+)*)(?=\s|$)/gi,i=0;for(let o of e.matchAll(r)){let a=o[1]??"",c=o[2]??"",l=(o.index??0)+a.length;t.has(c.slice(1))&&(l>i&&s.push({kind:"text",text:e.slice(i,l)}),s.push({kind:"skill",text:c}),i=l+c.length)}return(i<e.length||s.length===0)&&s.push({kind:"text",text:e.slice(i)}),s}function Rt(e=new Date){let n=new Date(e.getTime()+36e5);n.setMinutes(0,0,0);let t=n.getTimezoneOffset()*6e4;return new Date(n.getTime()-t).toISOString().slice(0,16)}function jn(e=new Date,n=[],t,s=""){return{name:"",prompt:"",scheduleKind:"daily",onceAt:Rt(e),everyMinutes:"60",maxConcurrentRuns:"1",intervalAnchor:"",time:"09:00",weekdays:[1,2,3,4,5],hourlyMinute:"00",monthDay:"1",customDays:"2",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai",permission:s,workspaceId:n[0]?.id??"",modelKey:t==null?"default":`${t.provider}::${t.model}`,reasoningEffort:t?.reasoning?.defaultEffort??"none",skills:[]}}function Et(e,n,t,s=new Date,r={}){let i=Number(e.maxConcurrentRuns);if(!Number.isSafeInteger(i)||i<1)throw new ue("form.error.maxConcurrentRuns");let o=e.name.trim(),a=e.prompt.trim();if(o==="")throw new ue("form.error.name");if(a==="")throw new ue("form.error.prompt");let c=n.find(m=>m.id===e.workspaceId);if(c===void 0)throw new ue("form.error.workspace");let l;switch(e.scheduleKind){case"once":{let m=new Date(e.onceAt);if(!Number.isFinite(m.getTime())||r.allowPastOnce!==!0&&m.getTime()<=s.getTime())throw new ue("form.error.once");l={kind:"once",at:m.toISOString(),timeZone:e.timeZone};break}case"interval":{let m=Number(e.everyMinutes);if(!Number.isInteger(m)||m<1||m>43200)throw new ue("form.error.interval");l={kind:"interval",everyMinutes:m,anchor:e.intervalAnchor.trim()||s.toISOString(),timeZone:e.timeZone};break}case"daily":l={kind:"daily",time:e.time,timeZone:e.timeZone};break;case"weekly":if(e.weekdays.length===0)throw new ue("form.error.weekdays");l={kind:"weekly",time:e.time,weekdays:[...e.weekdays].sort((m,k)=>m-k),timeZone:e.timeZone};break;case"hourly":{let m=Number(e.hourlyMinute);if(!Number.isInteger(m)||m<0||m>59)throw new ue("form.error.interval");l={kind:"hourly",minute:m,timeZone:e.timeZone};break}case"monthly":{let m=Number(e.monthDay);if(!Number.isInteger(m)||m<1||m>31)throw new ue("form.error.interval");l={kind:"monthly",day:m,time:e.time,timeZone:e.timeZone};break}case"custom":{let m=Number(e.customDays);if(!Number.isInteger(m)||m<1)throw new ue("form.error.interval");l={kind:"custom",everyDays:m,time:e.time,timeZone:e.timeZone};break}}let h=t.find(m=>`${m.provider}::${m.model}`===e.modelKey);return{name:o,prompt:a,schedule:l,timeZone:e.timeZone,permission:e.permission,maxConcurrentRuns:i,workspaceId:c.id,cwd:c.path,...h===void 0?{provider:null,model:null}:{provider:h.provider,model:h.model},reasoningEffort:e.reasoningEffort==="none"?null:e.reasoningEffort}}function Mt(e,n,t){let s=Date.parse(e);if(!Number.isFinite(s))return e;let r=Math.round((s-n.getTime())/6e4),i=Math.abs(r);if(i<1)return t("time.now");let o=r>0;if(i<60)return t(o?"time.inMinute":"time.minuteAgo",{count:i});let a=Math.round(i/60);if(a<24)return t(o?"time.inHour":"time.hourAgo",{count:a});let c=Math.round(a/24);return t(o?"time.inDay":"time.dayAgo",{count:c})}function un(e,n){switch(e.kind){case"once":return n("schedule.onceAt",{time:new Date(e.at).toLocaleString()});case"interval":return n("schedule.everyMinutes",{count:e.everyMinutes});case"daily":return n("schedule.dailyAt",{time:e.time});case"weekly":{let t=e.weekdays.map(s=>n(`day.${s}`)).join("\u3001");return n("schedule.weeklyAt",{days:t,time:e.time})}case"hourly":return n("schedule.hourlyAt",{minute:String(e.minute).padStart(2,"0")});case"monthly":return n("schedule.monthlyAt",{day:e.day,time:e.time});case"custom":return n("schedule.customAt",{count:e.everyDays,time:e.time})}}function pn(e,n,t){let s=Date.parse(e)-n.getTime();if(!Number.isFinite(s)||s<=0)return t("time.now");let r=Math.max(1,Math.ceil(s/6e4));if(r<60)return t("time.withinMinute",{count:r});let i=Math.ceil(r/60);return i<24?t("time.withinHour",{count:i}):t("time.withinDay",{count:Math.ceil(i/24)})}function Lt(e,n){if(e===void 0||n===void 0)return;let t=(Date.parse(n)-Date.parse(e))/1e3;if(!(!Number.isFinite(t)||t<0))return`${t.toFixed(1)}s`}function Pt(e){let n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}var Dt=["succeeded","failed","interrupted","running","queued","skipped","cancelled"];function dn(e){let n=Date.parse(e);return Number.isFinite(n)?n:0}function mn(e,n,t){let s=t==="asc"?1:-1;return e.slice().sort((r,i)=>{if(n==="planned"){let a=r.nextRunAt,c=i.nextRunAt;if(a===void 0||c===void 0)return a===void 0&&c===void 0?r.name.localeCompare(i.name)||r.id.localeCompare(i.id):a===void 0?1:-1;let l=dn(a)-dn(c);return l!==0?l*s:r.name.localeCompare(i.name)||r.id.localeCompare(i.id)}let o=dn(r.createdAt)-dn(i.createdAt);return o!==0?o*s:r.id.localeCompare(i.id)})}var fn="dsh-automation.sort-default.settings",hn="dsh-automation.sort-default.overview";function Ce(e,n){if(e!==void 0)try{let t=e.getItem(n);if(t===null)return;let s=JSON.parse(t);return s.key!=="created"&&s.key!=="planned"||s.direction!=="asc"&&s.direction!=="desc"?void 0:{key:s.key,direction:s.direction}}catch{return}}function Ot(e,n,t,s){e.setItem(n,JSON.stringify({key:t,direction:s}))}function Ht(e,n,t,s){let r=new Map;for(let i of e){let o=new Date(i.finishedAt??i.startedAt??i.scheduledFor);if(Number.isNaN(o.getTime()))continue;let a;if(n==="month")a=`${o.getFullYear()}-${String(o.getMonth()+1).padStart(2,"0")}`;else if(n==="week"){let l=ur(o);a=ln(l)}else a=ln(o);let c=r.get(a)??[];c.push(i),r.set(a,c)}return[...r.entries()].map(([i,o])=>({key:i,label:o[0]===void 0?i:n==="month"?s("history.month",{month:i.replace("-","/")}):n==="week"?s("history.week",{date:i.slice(5).replace("-","/")}):i===ln(t)?s("history.today"):i===ln(new Date(t.getTime()-864e5))?s("history.yesterday"):s("history.date",{date:i.slice(5).replace("-","/")}),items:o}))}function ln(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function ur(e){let n=new Date(e),t=n.getDay(),s=t===0?6:t-1;return n.setHours(0,0,0,0),n.setDate(n.getDate()-s),n}function Ft(e,n=[],t,s=e.permission){let r=jn(new Date,n,t,s),i=e.schedule,o=e.provider&&e.model?`${e.provider}::${e.model}`:"default",a={...r,name:e.name,prompt:e.prompt,permission:e.permission,maxConcurrentRuns:String(e.maxConcurrentRuns??1),workspaceId:e.workspaceId??r.workspaceId,modelKey:o,reasoningEffort:e.reasoningEffort??"none",timeZone:e.timeZone||i.timeZone||r.timeZone};switch(i.kind){case"once":return{...a,scheduleKind:"once",onceAt:pr(i.at)};case"interval":return{...a,scheduleKind:"interval",everyMinutes:String(i.everyMinutes),intervalAnchor:i.anchor??""};case"hourly":return{...a,scheduleKind:"hourly",hourlyMinute:String(i.minute).padStart(2,"0")};case"daily":return{...a,scheduleKind:"daily",time:i.time};case"weekly":return{...a,scheduleKind:"weekly",time:i.time,weekdays:[...i.weekdays]};case"monthly":return{...a,scheduleKind:"monthly",time:i.time,monthDay:String(i.day)};case"custom":return{...a,scheduleKind:"custom",time:i.time,customDays:String(i.everyDays)}}}function pr(e){let n=new Date(e);if(Number.isNaN(n.getTime()))return Rt();let t=n.getTimezoneOffset()*6e4;return new Date(n.getTime()-t).toISOString().slice(0,16)}var qe=class extends Error{code="workspace/picker-unavailable";constructor(){super("workspace picker unavailable"),this.name="WorkspacePickerUnavailableError"}};function Le(e,n){if(!(e===null||typeof e!="object"&&typeof e!="function"))return Reflect.get(e,n)}function gn(e,n){if(e===null||typeof e!="object")return;let t;try{t=Reflect.get(e,"reflect")}catch{t=void 0}let s=Le(t,"get");if(typeof s=="function")try{let i=s.call(t,n);if(i!==void 0)return i}catch{}let r=Le(e,"get");if(typeof r=="function")try{let i=r.call(e,n);if(i!==void 0)return i}catch{return}if(typeof s!="function")try{return Le(e,n)}catch{return}}function Wt(e){if(typeof e=="string"&&e.trim()!=="")return e;if(e===null||typeof e!="object"||Reflect.get(e,"canceled")===!0)return;let n=Reflect.get(e,"path");if(typeof n=="string"&&n.trim()!=="")return n;let t=Reflect.get(e,"filePaths"),s=Array.isArray(t)?t[0]:void 0;return typeof s=="string"&&s.trim()!==""?s:void 0}async function _t(e){let n=Le(e,"pickDirectory");if(typeof n=="function")return{picked:Wt(await n.call(e))}}async function qn(e,n){let t=gn(e,"workspaces"),s=Le(t,"create");if(typeof s!="function")return!1;try{return await s.call(t,{path:n}),!0}catch{return!1}}async function Zn(e){let n;try{n=Reflect.get(globalThis,"__DSH_DIRECTORY_PICKER__")}catch{n=void 0}let t=Le(n,"pick");if(typeof t=="function")return Wt(await t.call(n));for(let s of["uiWorkspace","dialog","workspaces"]){let r=await _t(gn(e,s));if(r!==void 0)return r.picked}try{let s=await _t(Le(e,"workspaces"));if(s!==void 0)return s.picked}catch{}throw new qe}var mr={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"},zt=new Map;function fr(e){let n=zt.get(e);if(n!==void 0)return n;let t=new Intl.DateTimeFormat("en-CA",{...mr,timeZone:e});return zt.set(e,t),t}function Ze(e,n){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;if(n===void 0){let s=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`,r=`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`;return`${s} ${r}`}try{let s=fr(n).formatToParts(t),r=h=>s.find(m=>m.type===h)?.value,[i,o,a,c,l]=["year","month","day","hour","minute"].map(h=>r(h));return[i,o,a,c,l].some(h=>h===void 0)?e:`${i}-${o}-${a} ${c}:${l}`}catch{return e}}var _e="dsh-automation-session-",Jn="dsh-automation.sidebar-tab";function yn(e,n){let t=new Map,s=new Map;for(let o of e)t.set(o.id,o.name),o.timeZone!==void 0&&s.set(o.id,o.timeZone);for(let o of n){let a=(o.automationName||"").trim();a!==""&&a!==o.automationId&&!t.has(o.automationId)&&t.set(o.automationId,a)}let r=[],i=new Set;for(let o of e)i.has(o.id)||(r.push(o.id),i.add(o.id));for(let o of n)o.sessionId===void 0||o.sessionId===""||i.has(o.automationId)||(r.push(o.automationId),i.add(o.automationId));return r.map(o=>{let a=t.get(o)??o;return{id:o,name:a,sessions:n.filter(c=>c.automationId===o&&c.sessionId!==void 0&&c.sessionId!=="").slice().sort((c,l)=>Date.parse(l.startedAt??l.scheduledFor)-Date.parse(c.startedAt??c.scheduledFor)).map(c=>({id:c.sessionId,running:c.status==="running"||c.status==="queued",label:Ze(c.startedAt??c.scheduledFor,s.get(o))+" - "+a}))}}).filter(o=>o.sessions.length>0)}function vn(e){return e==="active"?"pause":"resume"}function jt(e){return e.map(n=>({id:n.id,name:n.name,status:n.status,...n.nextRunAt===void 0?{}:{nextRunAt:n.nextRunAt}}))}function qt(e,n,t){if(e===void 0||e==="")return!1;let s=n.has(e);return t==="only"?s:t==="show"?!0:!s}function bn(e,n){return e==null||e===""||!e.startsWith(_e)?!1:!(n??[]).some(t=>t.sessionId===e)}function Zt(e){let n=new Set;for(let t of e??[]){let s=t.sessionId;typeof s=="string"&&s!==""&&n.add(s)}return n}var hr=/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}/;function Yn(e,n,t=new Set){if(e.startsWith(_e)||t.has(e))return!0;let s=String(n?.title??n?.displayTitle??"");return hr.test(s)}function Gt(e,n=new Set){if(e===void 0||e.blank===!0||e.origin==="im"||e.origin==="subagent")return!1;let t=e.id??"";return!(t.startsWith("im:")||Yn(t,e,n))}function Xt(e,n,t,s=new Set){let r=e.byId??{},i=new Set(n?.archivedSessionIds??[]),o=new Set,a=[];for(let l of n?.items??[]){let h=(l.sessionIds??[]).map(m=>r[m]).filter(m=>m!==void 0&&m.id!==void 0&&Gt(m,s)&&!i.has(m.id));for(let m of h)m.id!==void 0&&o.add(m.id);h.length>0&&a.push({id:l.workspaceId??l.id??l.path??l.title??"workspace",label:l.title||l.path||t,sessions:h})}let c=(e.ids??[]).map(l=>r[l]).filter(l=>l!==void 0&&l.id!==void 0&&!o.has(l.id)&&Gt(l,s)&&!i.has(l.id));return c.length>0&&a.push({id:"",label:t,sessions:c}),a}function Jt(e){return e==="channels"||e==="schedule"||e==="tasks"?e:"tasks"}function Yt(e,n){let t=e??"",s=n??"";return s!==""&&t!==s}function Qt(e){let n=["tasks"];for(let t of e.extraTabIds)t===""||t==="tasks"||t==="schedule"||n.includes(t)||n.push(t);return e.channelsReady&&!n.includes("channels")&&n.push("channels"),n.push("schedule"),n}function es(e){return e.extraTabIds.includes(e.tab)?e.tab:e.tab==="channels"&&e.channelsReady?"channels":"tasks"}function ns(e,n){if(!(e==null||e===""))return(n!==void 0?n.has(e):e.startsWith(_e))?"schedule":e.startsWith("im:")?"channels":"tasks"}function gr(e){return/dsh-codex-ui|michengai-codex-ui|michengai\.codexUi|codex-ui/i.test(String(e??""))}function yr(e){let n=e;return String(n?.options?.locale??n?.options?.id??n?.options?.name??n?.options?.registrant??n?.component?.displayName??n?.component?.name??n?.id??n?.name??"")}function ts(e){return(e??[]).some(n=>gr(yr(n)))}var Vt=new WeakMap,Bt=new WeakMap;function ss(e){return e.size===0?"":[...e].sort().join("\0")}function os(e,n=new Set){let t=e??{ids:[],byId:{}},s=ss(n);if(typeof t=="object"&&t!==null){let a=Vt.get(t);if(a!==void 0&&a.key===s)return a.result}let r=(t.ids??[]).filter(a=>{let c=String(a);return!c.startsWith("im:")&&!Yn(c,t.byId?.[c],n)}),o=r.length===(t.ids??[]).length?t:{...t,ids:r,byId:Object.fromEntries(r.map(a=>[a,t.byId?.[a]]).filter(a=>a[1]!==void 0))};return typeof t=="object"&&t!==null&&Vt.set(t,{key:s,result:o}),o}function Xe(e){let n=e?.byId??{};for(let[t,s]of Object.entries(n))if((s?.retainedBy?.mainView??0)>0){let r=s.id?.trim();return r!==void 0&&r!==""?r:t}return null}function vr(e){if(e===null||typeof e!="object")return;let n=e.openSession;if(typeof n=="function")return{openSession:t=>{n.call(e,t)}}}function rs(e){let n=vr(gn(e,"uiWorkspace"));return{...n===void 0?{}:{uiWorkspace:n}}}function is(e){return typeof e.uiWorkspace?.openSession=="function"}function as(e,n){if(typeof e.uiWorkspace?.openSession=="function"){e.uiWorkspace.openSession(n);return}throw new Error("no client session opener")}function Ut(e,n,t){if(e==="")return!1;let s=e.startsWith(_e)||e.startsWith("im:")?[n,t]:[t,n];for(let r of s)if(typeof r=="function")try{return r(e),!0}catch{}return!1}async function ds(e){let n=e.id.trim();return n===""?!1:(await e.adopt?.(n).catch(()=>{}),!(e.listed?.(n)===!0)&&e.refresh!==void 0&&await e.refresh().catch(()=>{}),Ut(n,e.openRuntime,e.openHost)?!0:(e.refresh!==void 0&&await e.refresh().catch(()=>{}),Ut(n,e.openRuntime,e.openHost)))}function br(e,n=new Set){return e.startsWith("im:")||Yn(e,void 0,n)}function ls(e,n=new Set){let t=e??{items:[],archivedSessionIds:[]},s=ss(n);if(typeof t=="object"&&t!==null){let a=Bt.get(t);if(a!==void 0&&a.key===s)return a.result}let r=!1,i=(t.items??[]).map(a=>{let c=(a.sessionIds??[]).filter(l=>!br(String(l),n));return c.length!==(a.sessionIds??[]).length?(r=!0,{...a,sessionIds:c}):a}),o=r?{...t,items:i}:t;return typeof t=="object"&&t!==null&&Bt.set(t,{key:s,result:o}),o}function cs(e){return e==null||typeof e!="function"&&typeof e!="object"?{}:e}function wr(e){return cs(e).__dshAutomationWrapped===!0}function us(e){let n=new Set,t=e;for(;t!=null&&!n.has(t);){n.add(t);let s=cs(t),r=s.__dshAutomationOriginal??s.__imConnectOriginal;if(r!==void 0&&r!==t){t=r;continue}return s.__dshAutomationWrapped===!0||s.__imConnectWrapped===!0?void 0:t}}function xr(e){let n=e,t=String(n?.options?.id??""),s=String(n?.component?.displayName??n?.component?.name??"");return t==="dsh-automation-native-switcher"||t==="dsh-automation-wrap-bump"||s==="AutomationNativeWorkspaceShell"||s==="AutomationWrapBump"||wr(n?.component)}function ps(e){for(let n of e)if(n?.component!==void 0&&!xr(n))return n}function Fe(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function $t(e,n){let t=Fe(e),s,r=-1;for(let i of n){let o=Fe(i);o.length>r&&t!==o&&t.startsWith(`${o}/`)&&(s=i,r=o.length)}return s}function ms(e,n,t){let s=new Map;for(let u of n)for(let g of u.sessionIds??[])s.set(g,u);let r=new Map,i=[];for(let u of e){let g=u.id===void 0?void 0:s.get(u.id),v=g?.workspaceId??g?.id??g?.path;if(g===void 0||v===void 0||v===""){i.push(u);continue}let S=r.get(v)??[];S.push(u),r.set(v,S)}let o=new Map;for(let u of n)u.path!==void 0&&u.path!==""&&o.set(Fe(u.path),u);let a=new Map;for(let u of n){let g=u.workspaceId??u.id??u.path;if(g===void 0||g===""||!r.has(g))continue;a.set(g,u);let v=u.path,S=new Set;for(;v!==void 0&&v!==""&&!S.has(v);){S.add(v);let C=$t(v,[...o.keys()]);if(C===void 0)break;let P=o.get(Fe(C)),_=P?.workspaceId??P?.id??P?.path;if(P===void 0||_===void 0||_==="")break;a.set(_,P),v=P.path}}let c=[...a.values()],l=c.map(u=>u.path).filter(u=>u!==void 0&&u!==""),h=u=>u.workspaceId??u.id??u.path??"",m=new Map,k=[];for(let u of c){let g=u.path===void 0?void 0:$t(u.path,l),v=g===void 0?void 0:c.find(C=>C.path!==void 0&&Fe(C.path)===Fe(g)),S=v===void 0?void 0:h(v);if(v===void 0||S===void 0||S==="")k.push(u);else{let C=m.get(S)??[];C.push(u),m.set(S,C)}}let A=(u,g)=>(u.title||u.path||"").localeCompare(g.title||g.path||""),f=[],p=(u,g)=>{let v=h(u),S=r.get(v)??[];f.push({id:v,name:u.title||u.path||t,depth:g,keep:S.length===0,sessions:S});for(let C of(m.get(v)??[]).sort(A))p(C,g+1)};for(let u of k.sort(A))p(u,0);return i.length>0&&f.push({id:"",name:t,depth:0,sessions:i}),f}function fs(e,n,t,s="workspace"){let r=n.trim().toLocaleLowerCase(),i=e.map(o=>{if(r===""||o.name.toLocaleLowerCase().includes(r))return o;let a=o.sessions.filter(c=>`${c.title??""} ${c.label??""}`.toLocaleLowerCase().includes(r));return{...o,sessions:a}}).filter(o=>o.sessions.length>0||r===""&&o.keep===!0||r!==""&&o.name.toLocaleLowerCase().includes(r));if(s==="list"){let o=i.flatMap(a=>[...a.sessions]);return t==="time"&&o.sort((a,c)=>Xn(c)-Xn(a)),o.length===0?[]:[{...i[0],name:"",sessions:o}]}return s==="workspace-tree"||t==="manual"?i:[...i].sort((o,a)=>Kt(a)-Kt(o))}function Xn(e){let n=Date.parse(e.updatedAt??"");return Number.isFinite(n)?n:0}function Kt(e){let n=0;for(let t of e.sessions){let s=Xn(t);s>n&&(n=s)}return n}var se=require("react/jsx-runtime");function Je({children:e,...n}){return(0,se.jsx)("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n,children:e})}function wn(e){return(0,se.jsx)(Je,{...e,children:(0,se.jsx)("path",{d:"M12 5v14M5 12h14"})})}function hs(e){return(0,se.jsxs)(Je,{...e,children:[(0,se.jsx)("path",{d:"M19 7v5h-5"}),(0,se.jsx)("path",{d:"M18.1 15.5A7.5 7.5 0 1 1 19 12"})]})}function gs(e){return(0,se.jsxs)(Je,{...e,children:[(0,se.jsx)("rect",{x:"4",y:"5.5",width:"16",height:"14",rx:"2"}),(0,se.jsx)("path",{d:"M8 3.8v3.4M16 3.8v3.4M4 9.5h16"})]})}function ys(e){return(0,se.jsxs)(Je,{...e,children:[(0,se.jsx)("circle",{cx:"12",cy:"12",r:"8.25"}),(0,se.jsx)("path",{d:"M12 10.4V16"}),(0,se.jsx)("path",{d:"M12 7.6h.01"})]})}function vs(e){return(0,se.jsx)(Je,{...e,children:(0,se.jsx)("path",{d:"M5.5 6.5h13v9.2H9.2L5.5 18.8V6.5Z"})})}function bs(e){return(0,se.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,"aria-hidden":"true",focusable:"false",...e,children:(0,se.jsx)("path",{fill:"currentColor",d:"M8 0a8 8 0 0 0-2.53 15.59c.4.074.547-.173.547-.385 0-.19-.007-.693-.01-1.36-2.226.484-2.695-1.073-2.695-1.073-.364-.924-.89-1.17-.89-1.17-.726-.496.055-.486.055-.486.803.056 1.225.824 1.225.824.714 1.223 1.872.87 2.328.665.072-.517.28-.87.508-1.07-1.777-.202-3.645-.888-3.645-3.956 0-.874.31-1.588.823-2.148-.083-.202-.357-1.017.078-2.12 0 0 .672-.215 2.2.82A7.65 7.65 0 0 1 8 4.8c.68.003 1.365.092 2.004.27 1.527-1.035 2.197-.82 2.197-.82.437 1.103.162 1.918.08 2.12.513.56.822 1.274.822 2.148 0 3.076-1.872 3.752-3.654 3.95.288.248.544.735.544 1.482 0 1.07-.01 1.932-.01 2.195 0 .214.144.463.55.384A8.001 8.001 0 0 0 8 0Z"})})}function ws(e){return(0,se.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...e,children:(0,se.jsx)("path",{d:"M9.5 2.5 13.5 6.5 6 14H2v-4z"})})}var Pe=require("react"),Sr=an(require("@deepseek-ai/dsh-client-ui-primitives"),1);function xn(e,n){return function(s){return e(s)??n(s)}}function X(e,...n){for(let t of n){let s=e[t];if(typeof s=="function")return s}return function(){return null}}var Y=Sr;function kr(){return(0,Pe.createElement)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:"none","aria-hidden":!0},(0,Pe.createElement)("path",{d:"M3 3h4v3H3V3Zm6 1h4M3 10h4v3H3v-3Zm6 1.5h4M7 4.5h2M7 11.5h2",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round"}))}function Tr(){return(0,Pe.createElement)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:"none","aria-hidden":!0},(0,Pe.createElement)("path",{d:"M3 4h10M3 8h10M3 12h10",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round"}))}function Ar(){return(0,Pe.createElement)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:"none","aria-hidden":!0},(0,Pe.createElement)("path",{d:"M3 6.5h10v6H3v-6Zm1.2-2.5h7.6L13 6.5H3L4.2 4Zm2.3 5.2 1.3 1.3 2.6-2.6",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}))}var Ye=X(Y,"IconEllipsisOutlineRegular"),xs=X(Y,"IconSettingsOutlineRegular"),We=X(Y,"IconArchiveOutlineRegular"),Ss=X(Y,"IconBranchOutlineRegular"),ks=X(Y,"IconEditOutlineRegular"),Qn=X(Y,"IconTrashOutlineRegular"),Oi=X(Y,"IconCheckOutlineRegular"),Hi=X(Y,"IconChevronDownOutlineRegular"),Fi=X(Y,"IconListPenOutlineRegular"),Ts=X(Y,"IconSearchOutlineRegular"),As=X(Y,"IconCloseFillRegular"),Sn=X(Y,"IconSlidersTwoOutlineRegular"),ze=X(Y,"IconFolderCloseRegular"),Is=X(Y,"IconFolderOpenRegular"),Ns=X(Y,"IconTriangleRightFillRegular"),et=X(Y,"IconUnarchiveOutlineRegular"),kn=xn(X(Y,"IconWorkspaceTreeOutlineRegular"),kr),Ge=xn(X(Y,"IconFlatListOutlineRegular"),Tr),_i=X(Y,"IconChevronsUpDownOutlineRegular"),Ie=X(Y,"IconClockOutlineRegular"),Cs=X(Y,"IconCopyOutlineRegular"),Rs=X(Y,"IconArchiveOffOutlineRegular"),Es=xn(X(Y,"IconArchiveCheckOutlineRegular"),Ar);var le=require("@deepseek-ai/dsh-client-ui-primitives");var nt=an(require("react"),1),Ms=require("@deepseek-ai/dsh-client-ui-primitives"),tt={width:22,minWidth:22,height:22,padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--dsw-radius-sm, 8px)"},Ls=nt.default.forwardRef(function(n,t){let{className:s,rows:r,...i}=n;return nt.default.createElement("textarea",{...i,ref:t,className:["dsh-st-textarea",s].filter(Boolean).join(" "),rows:r||4})}),Ve=Ms.Input;function Tn(e,n){let t=e.target;if(!(t instanceof Element)||t.getAttribute("aria-hidden")!=="true")return;let s=t.parentElement?.querySelector('[role="dialog"]');!(s instanceof HTMLElement)||!s.classList.contains(n)||e.stopPropagation()}var pe=an(require("react"),1),An=require("@deepseek-ai/dsh-client-ui-primitives");function st(e){return{id:e.value,label:e.label,...e.disabled!==void 0?{disabled:e.disabled}:{},...e.danger!==void 0?{danger:e.danger}:{}}}function he(e){let[n,t]=pe.useState(!1),s=pe.useRef(null),r=e.options??[];pe.useEffect(()=>{if(!n)return;let l=s.current?.getBoundingClientRect().width??0;return l>0&&document.documentElement.style.setProperty("--dsh-st-menu-width",`${Math.round(l)}px`),()=>{document.documentElement.style.removeProperty("--dsh-st-menu-width")}},[n]),pe.useEffect(()=>{if(!n||typeof window>"u")return;let l=h=>{h.key==="Escape"&&(h.stopPropagation(),t(!1))};return window.addEventListener("keydown",l,!0),()=>{window.removeEventListener("keydown",l,!0)}},[n]);let i=pe.useMemo(()=>e.groups!==void 0&&e.groups.length>0?e.groups.flatMap(l=>[{type:"label",id:`label-${l.id}`,text:l.label},...l.options.map(st)]):r.map(st),[r,e.groups]),o=e.footer?.map(st),a=r.find(l=>l.value===e.value)??e.groups?.flatMap(l=>[...l.options]).find(l=>l.value===e.value),c=a?a.label:e.placeholder??e.label??"";return pe.createElement("div",{ref:s,className:["dsh-st-menu-select-wrap",e.compact===!0?"is-compact":"",e.className].filter(Boolean).join(" ")},pe.createElement(An.Menu,{open:n,onClose:()=>{t(!1)},onSelect:l=>{if(e.footer?.some(h=>h.value===l)===!0){e.onFooter?.(l),t(!1);return}e.onChange(l),t(!1)},selectedId:e.value,align:"start",portal:!0,dense:!0,listClassName:["dsh-st-form-menu",e.listClassName].filter(Boolean).join(" "),...o!==void 0?{footer:o}:{},anchor:pe.createElement(An.Button,{variant:"outline",...e.compact===!0?{size:"sm"}:{},role:"combobox","aria-label":e.label??(typeof c=="string"?c:a?.text)??e.placeholder??"","aria-expanded":n,disabled:e.disabled,className:["dsh-st-menu-select-trigger",n?"is-open":""].filter(Boolean).join(" "),onClick:()=>{e.disabled||t(l=>!l)}},pe.createElement("span",{className:"dsh-st-menu-select-label"},c),pe.createElement("svg",{className:"dsh-st-menu-select-arrow",viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:{marginLeft:4,transition:"transform 150ms ease",transform:n?"rotate(180deg)":"none"}},pe.createElement("path",{d:"m4 6 4 4 4-4"}))),items:i}))}var me=require("react");var Ir=new Map([["read-only",["permission.readOnly","Read Only"]],["workspace-write",["permission.workspaceWrite","Workspace Write"]],["danger-full-access",["permission.fullAccess","Full access"]]]);function Ps(e,n){let t=Ir.get(e.value);return t!==void 0&&(e.name===e.value||e.name===t[1])?n(t[0]):e.name||e.value}function Ds(e,n){return e!==n&&n==="danger-full-access"}var be=require("@deepseek-ai/dsh-client-ui-primitives");var b=require("react/jsx-runtime");function Nr(e,n,t,s){if(e==="deepseek-account"){let r=t("provider.account");return r&&r!=="provider.account"?r:s("form.providerAccount")}return n}function Cr(e,n){return(e==="deepseek-account"?0:e==="deepseek-official"?1:2)-(n==="deepseek-account"?0:n==="deepseek-official"?1:2)}function Rr(e){return(e.provider==="deepseek-account"||e.provider==="deepseek-official")&&e.model==="deepseek-flash"?(0,b.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,b.jsx)("span",{children:e.label}),(0,b.jsx)(be.Tag,{tone:"info",children:"1017"})]}):e.label}var Er=[1,2,3,4,5,6,7],Mr=["once","interval","hourly","daily","weekly","monthly","custom"],Lr=Array.from({length:24},(e,n)=>String(n).padStart(2,"0")),Fs=Array.from({length:60},(e,n)=>String(n).padStart(2,"0"));function _s({t:e,permissionT:n,modelT:t,busy:s,workspaces:r,models:i,modelFailures:o,defaultModel:a,skills:c,permissions:l,defaultPermission:h,draft:m,editing:k,onClose:A,onSubmit:f,onAddWorkspace:p}){let[u,g]=(0,me.useState)(()=>({...jn(new Date,r,a,h),...m})),[v,S]=(0,me.useState)(),[C,P]=(0,me.useState)(),[_,oe]=(0,me.useState)(!1),[U,G]=(0,me.useState)(!1),[$,O]=(0,me.useState)(0),[K,B]=(0,me.useState)(0),[J,re]=(0,me.useState)(),ee=(0,me.useRef)(null),ne=(0,me.useRef)(0);(0,me.useEffect)(()=>{let d=W=>{if(W.key==="Escape"&&document.querySelector('[role="menu"]')===null){if(W.preventDefault(),W.stopPropagation(),W.stopImmediatePropagation(),C!==void 0){oe(!1),P(void 0);return}A()}},I=W=>{Tn(W,"dsh-st-create-dialog")};return window.addEventListener("keydown",d,!0),document.addEventListener("click",I,!0),()=>{window.removeEventListener("keydown",d,!0),document.removeEventListener("click",I,!0)}},[C,A]);let x=d=>{g(I=>({...I,...d})),S(void 0)},H=r.some(d=>d.id===u.workspaceId),E=async()=>{if(!(p===void 0||U)){G(!0),S(void 0),document.activeElement instanceof HTMLElement&&document.activeElement.blur();try{let d=await p();d!==void 0&&x({workspaceId:d})}catch(d){d instanceof qe?S(e("form.workspaceUnavailable")):d instanceof Error&&d.message!==""?S(d.message):S(e("form.addWorkspaceFailed"))}finally{G(!1)}}},ae=d=>{if(Ds(u.permission,d)){oe(!1),P(d);return}x({permission:d})},de=async d=>{d?.preventDefault();try{await f(u)}catch(I){if(I instanceof ue){S(e(I.key));return}S(I instanceof Error?I.message:e("error.action"))}},ce=u.onceAt.slice(0,10),ie=u.onceAt.slice(11,16)||"09:00",fe=Pr(new Date),ge=i.find(d=>`${d.provider}::${d.model}`===u.modelKey)?.reasoning,Z=Kn(u.prompt,$),te=Z===void 0||J===Z.query?[]:It(c,Z.query),ye=Math.min(K,Math.max(te.length-1,0)),we=d=>{ne.current=d,O(d)};(0,me.useEffect)(()=>{let d=document.querySelector('.dsh-st-skill-menu [aria-selected="true"]');d instanceof HTMLElement&&d.scrollIntoView({block:"nearest"})},[ye,Z?.query]);let T=d=>{let I=Nt(u.prompt,ne.current,cn(d));x({prompt:I.text}),re(void 0),queueMicrotask(()=>{let W=ee.current;W!=null&&(W.focus(),W.setSelectionRange(I.caret,I.caret),we(I.caret))})};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(be.Modal,{open:!0,className:"dsh-st-create-dialog",contentClassName:"dsh-st-create-content",title:e(k===!0?"modal.edit":"modal.title"),closeLabel:e("form.cancel"),onClose:A,footer:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(be.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:s,onClick:A,children:e("form.cancel")}),(0,b.jsx)(be.Button,{variant:"primary",className:"dsh-st-modal-action",type:"submit",form:"dsh-st-create-form",disabled:s||U||!H,children:e("modal.save")})]}),children:(0,b.jsxs)("form",{id:"dsh-st-create-form",className:"dsh-st-form",onSubmit:d=>{de(d)},children:[(0,b.jsx)("p",{children:e("form.subtitle")}),(0,b.jsxs)("label",{className:"dsh-st-field",children:[e("form.name"),(0,b.jsx)(Ve,{value:u.name,placeholder:e("form.namePlaceholder"),onChange:d=>x({name:d.target.value})})]}),(0,b.jsxs)("div",{className:"dsh-st-plan-row",children:[(0,b.jsxs)("div",{className:"dsh-st-field",children:[e("form.planTime"),(0,b.jsxs)("div",{className:"dsh-st-inline",children:[(0,b.jsx)(he,{value:u.scheduleKind,options:Mr.map(d=>({value:d,label:e(`form.${d}`)})),onChange:d=>x({scheduleKind:d})}),u.scheduleKind==="once"&&(0,b.jsx)(Ve,{type:"date",min:fe,value:ce,onChange:d=>x({onceAt:Hs(`${d.target.value}T${ie}`)})}),(u.scheduleKind==="once"||u.scheduleKind==="daily"||u.scheduleKind==="weekly"||u.scheduleKind==="monthly")&&(0,b.jsx)(Os,{value:u.scheduleKind==="once"?ie:u.time,onChange:d=>{u.scheduleKind==="once"?x({onceAt:Hs(`${ce}T${d}`)}):x({time:d})}}),u.scheduleKind==="interval"&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"dsh-st-suffix",children:e("form.every")}),(0,b.jsxs)("span",{className:"dsh-st-amount",children:[(0,b.jsx)(Ve,{type:"number",min:1,value:u.everyMinutes,onChange:d=>x({everyMinutes:d.target.value})}),(0,b.jsx)("span",{className:"dsh-st-suffix",children:e("form.minutes")})]})]}),u.scheduleKind==="hourly"&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(he,{value:u.hourlyMinute,options:Fs.map(d=>({value:d,label:d})),onChange:d=>x({hourlyMinute:d})}),(0,b.jsx)("span",{className:"dsh-st-suffix",children:e("form.minutesShort")})]}),u.scheduleKind==="monthly"&&(0,b.jsx)(he,{value:u.monthDay,options:Array.from({length:31},(d,I)=>{let W=String(I+1);return{value:W,label:e("form.monthDay",{day:W})}}),onChange:d=>x({monthDay:d})}),u.scheduleKind==="custom"&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"dsh-st-suffix",children:e("form.every")}),(0,b.jsxs)("span",{className:"dsh-st-amount",children:[(0,b.jsx)(Ve,{type:"number",min:1,value:u.customDays,onChange:d=>x({customDays:d.target.value})}),(0,b.jsx)("span",{className:"dsh-st-suffix",children:e("form.daysShort")})]}),(0,b.jsx)("span",{className:"dsh-st-suffix",children:e("form.atTime")}),(0,b.jsx)(Os,{value:u.time,onChange:d=>x({time:d})})]})]}),u.scheduleKind==="interval"&&(0,b.jsx)("span",{className:"dsh-st-plan-hint",children:e("form.intervalHint")}),u.scheduleKind==="custom"&&(0,b.jsx)("span",{className:"dsh-st-plan-hint",children:e("form.customHint")})]}),(0,b.jsxs)("label",{className:"dsh-st-field dsh-st-concurrency",title:e("form.maxConcurrentRunsHint"),children:[e("form.maxConcurrentRuns"),(0,b.jsx)(Ve,{type:"number",min:1,step:1,value:u.maxConcurrentRuns,onChange:d=>x({maxConcurrentRuns:d.target.value})})]})]}),u.scheduleKind==="weekly"&&(0,b.jsx)("div",{className:"dsh-st-weekdays",children:Er.map(d=>(0,b.jsx)(be.Checkbox,{checked:u.weekdays.includes(d),label:e(`day.${d}`),onChange:I=>x({weekdays:I?[...u.weekdays,d]:u.weekdays.filter(W=>W!==d)})},d))}),(0,b.jsxs)("div",{className:"dsh-st-settings",children:[(0,b.jsxs)("label",{className:"dsh-st-picker-field",children:[(0,b.jsx)("span",{children:e("form.fieldWorkspace")}),r.length===0?(0,b.jsxs)("div",{className:"dsh-st-workspace-empty",children:[(0,b.jsx)(be.Button,{variant:"primary",icon:(0,b.jsx)(wn,{width:14,height:14}),disabled:U,onClick:()=>{E()},children:e("form.addWorkspace")}),(0,b.jsx)("span",{className:"dsh-st-workspace-note",children:e("form.workspaceRequired")})]}):(0,b.jsx)(he,{value:u.workspaceId,label:e("form.fieldWorkspace"),placeholder:e("form.workspace"),options:r.map(d=>({value:d.id,label:d.title})),footer:[{value:"add-workspace",label:e("form.addWorkspace"),disabled:U}],onFooter:()=>{E()},onChange:d=>x({workspaceId:d})})]}),(0,b.jsxs)("label",{className:"dsh-st-picker-field",children:[(0,b.jsx)("span",{children:e("form.fieldModel")}),(0,b.jsx)(he,{value:u.modelKey,label:e("form.fieldModel"),groups:Array.from(i.reduce((d,I)=>{let W=Nr(I.provider,I.providerLabel,t,e),Ne=d.get(I.provider)??{label:W,options:[]};return Ne.options.push({value:`${I.provider}::${I.model}`,label:Rr(I),text:I.label}),d.set(I.provider,Ne),d},new Map)).sort(([d],[I])=>Cr(d,I)).map(([d,I])=>({id:d,label:I.label,options:I.options})),onChange:d=>{let I=i.find(W=>`${W.provider}::${W.model}`===d);x({modelKey:d,reasoningEffort:I?.reasoning?.defaultEffort??"none"})}})]}),(0,b.jsxs)("label",{className:"dsh-st-picker-field",children:[(0,b.jsx)("span",{children:e("form.fieldEffort")}),(0,b.jsx)(he,{disabled:ge===void 0,value:ge===void 0?"":u.reasoningEffort,label:e("form.fieldEffort"),placeholder:t("effort.providerDefault"),options:ge===void 0?[]:[...ge.defaultEffort===void 0?[{value:"none",label:t("effort.providerDefault")}]:[],...ge.efforts.map(d=>({value:d.id,label:d.name}))],onChange:d=>x({reasoningEffort:d})})]}),(0,b.jsxs)("label",{className:"dsh-st-picker-field",children:[(0,b.jsx)("span",{children:e("form.fieldPermission")}),(0,b.jsx)(he,{value:u.permission,options:l.map(d=>({value:d.value,label:Ps(d,e)})),onChange:d=>ae(d)})]})]}),(0,b.jsxs)("div",{className:"dsh-st-field",children:[(0,b.jsxs)("span",{className:"dsh-st-prompt-label",children:[e("form.prompt"),(0,b.jsx)("em",{children:e("form.slashHint")})]}),(0,b.jsxs)("div",{className:"dsh-st-prompt-anchor",children:[Z!==void 0&&J!==Z.query&&(0,b.jsx)("div",{className:"dsh-st-skill-menu",role:"listbox",children:te.length===0?(0,b.jsx)("p",{children:e("form.slashEmpty")}):te.map((d,I)=>(0,b.jsxs)("button",{type:"button",role:"option","aria-selected":I===ye,onMouseDown:W=>W.preventDefault(),onClick:()=>T(d),children:[(0,b.jsx)("span",{children:d.name}),(0,b.jsx)("code",{children:cn(d)})]},d.id))}),(0,b.jsxs)("div",{className:"dsh-st-prompt-card",children:[(0,b.jsx)("div",{className:"dsh-st-prompt-backdrop","aria-hidden":"true",children:Ct(u.prompt,c).map((d,I)=>d.kind==="skill"?(0,b.jsx)("span",{className:"dsh-st-skill-token",children:d.text},I):(0,b.jsx)("span",{children:d.text},I))}),(0,b.jsx)(Ls,{ref:ee,spellCheck:!1,className:"dsh-st-prompt-input",value:u.prompt,placeholder:e("form.promptPlaceholder"),rows:4,onChange:d=>{we(d.target.selectionStart),x({prompt:d.target.value}),re(void 0)},onSelect:d=>we(d.currentTarget.selectionStart),onScroll:d=>{let I=d.currentTarget.closest(".dsh-st-prompt-card")?.querySelector(".dsh-st-prompt-backdrop");I instanceof HTMLElement&&(I.scrollTop=d.currentTarget.scrollTop)},onKeyDown:d=>{if(Z!==void 0){if(d.key==="Escape"){d.preventDefault(),re(Z.query);return}if(te.length!==0){if(d.key==="ArrowDown")d.preventDefault(),B(I=>(Math.min(I,te.length-1)+1)%te.length);else if(d.key==="ArrowUp")d.preventDefault(),B(I=>(Math.min(I,te.length-1)+te.length-1)%te.length);else if(d.key==="Enter"||d.key==="Tab"){d.preventDefault();let I=te[ye];I!==void 0&&T(I)}}}}})]})]})]}),o.map(d=>(0,b.jsx)("p",{className:"dsh-st-error",children:t("warning.groupLoad",{name:d.providerLabel,message:d.message})},d.provider)),v!==void 0&&(0,b.jsx)("p",{className:"dsh-st-error",children:v})]})}),(0,b.jsx)(be.RiskConfirmation,{open:C!==void 0,title:n("confirm.title"),description:n("confirm.description"),acknowledgeLabel:n("confirm.acknowledge"),cancelLabel:n("confirm.cancel"),closeLabel:n("confirm.cancel"),confirmLabel:n("confirm.enable"),acknowledged:_,onAcknowledgedChange:oe,onCancel:()=>{oe(!1),P(void 0)},onConfirm:()=>{!_||C===void 0||(x({permission:C}),oe(!1),P(void 0))}})]})}function Os({value:e,onChange:n}){let[t,s]=e.split(":");return(0,b.jsxs)("span",{className:"dsh-st-time",children:[(0,b.jsx)(he,{value:t,options:Lr.map(r=>({value:r,label:r})),onChange:r=>n(`${r}:${s}`)}),(0,b.jsx)("span",{className:"dsh-st-time-sep",children:":"}),(0,b.jsx)(he,{value:s,options:Fs.map(r=>({value:r,label:r})),onChange:r=>n(`${t}:${r}`)})]})}function Pr(e){let n=e.getTimezoneOffset()*6e4;return new Date(e.getTime()-n).toISOString().slice(0,10)}function Hs(e){let n=new Date(e),t=new Date;if(!Number.isFinite(n.getTime())||n.getTime()>t.getTime())return e;let s=new Date(t.getTime()+6e4);s.setSeconds(0,0);let r=s.getTimezoneOffset()*6e4;return new Date(s.getTime()-r).toISOString().slice(0,16)}var Ws=require("react"),Qe=require("@deepseek-ai/dsh-client-ui-primitives");var Re=require("react/jsx-runtime");function zs({target:e,t:n,busy:t,onCancel:s,onConfirm:r}){return(0,Ws.useEffect)(()=>{if(e===void 0)return;let i=a=>{a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),a.stopImmediatePropagation(),s())},o=a=>{Tn(a,"dsh-st-delete-dialog")};return window.addEventListener("keydown",i,!0),document.addEventListener("click",o,!0),()=>{window.removeEventListener("keydown",i,!0),document.removeEventListener("click",o,!0)}},[s,e]),(0,Re.jsx)(Qe.Modal,{open:e!==void 0,className:"dsh-st-delete-dialog",title:n("card.confirmDelete"),...e===void 0?{}:{description:`${e.name} ${n("card.confirmDeleteHint")}`},closeLabel:n("card.cancel"),onClose:s,footer:(0,Re.jsxs)(Re.Fragment,{children:[(0,Re.jsx)(Qe.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:t,onClick:s,children:n("card.cancel")}),(0,Re.jsx)(Qe.Button,{variant:"outline",className:"dsh-st-modal-action dsh-st-btn-danger",disabled:t,onClick:r,children:n("card.confirm")})]})})}var en=null,ot=new Set;function Gs(e){en=e;for(let n of[...ot])n(en)}function rt(){let e=en;return en=null,e}function Vs(){return en}function Bs(e){return ot.add(e),()=>{ot.delete(e)}}function Us(e){let n=document.querySelector("[data-composer-seat] textarea");return n instanceof HTMLTextAreaElement?(Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set?.call(n,e),n.dispatchEvent(new InputEvent("input",{bubbles:!0})),n.focus(),!0):!1}function nn(e){if(typeof e!="object"||e===null||!("ok"in e))throw new Error("\u81EA\u52A8\u5316\u4E3B\u673A\u8FD4\u56DE\u4E86\u65E0\u6548\u54CD\u5E94\u3002");let n=e;if(n.ok===!0&&"value"in n)return n.value;if(n.ok===!1&&"error"in n){let t=n.error;throw new Error(t?.message??"\u81EA\u52A8\u5316\u8BF7\u6C42\u5931\u8D25\u3002")}throw new Error("\u81EA\u52A8\u5316\u4E3B\u673A\u8FD4\u56DE\u4E86\u65E0\u6548\u54CD\u5E94\u3002")}var tn="/dsh-automation",Ks=15e3,Dr=2e3,js=[1,2,4],$s=js.length+1,Or=5*60*1e3,Hr=24*60*60*1e3;function Fr(e){return(e??[]).some(n=>n.status==="running"||n.status==="queued")?Dr:Ks}function it(e,n){return n>0?Fr(e):Ks}function at(e){let n=e instanceof Error?e.message:String(e);return/failed to fetch|networkerror|load failed|network request failed/i.test(n)}function _r(e,n){let t=Date.parse(n),r=(Number.isFinite(t)?t:Date.now())-Hr;return[...new Set(e.filter(i=>{if(i.status==="queued"||i.status==="running")return!0;let o=Date.parse(i.finishedAt??i.startedAt??i.scheduledFor);return Number.isFinite(o)&&o>=r}).map(i=>i.sessionId).filter(i=>i!==void 0&&i!==""))].sort()}function qs(e,n,t={}){let s=!1,r=0,i=e.source.getSnapshot().phase==="loading",o,a,c=0,l=0,h=0,m,k,A=!1,f=v=>{a=v,c=0,l=r,h=0,m=void 0},p=v=>{let S=e.source.getSnapshot().snapshot,C=v?.list?.getSnapshot();if(S===void 0||C===void 0||v?.refresh===void 0)return;let P=new Set([...C.ids??[],...Object.keys(C.byId??{})]);return _r(S.runs,S.serverNow).filter(_=>!P.has(_)).join("\0")},u=()=>{if(s)return;let v=n();v!==o&&(o=v,f());let S=p(v);if(S===void 0)return;if(S===""){f();return}if(S!==a&&f(S),c>=$s){if((t.now??Date.now)()<h)return;f(S)}if(r<l)return;if(k!==void 0){A=!0;return}let C=c;c+=1;let P=js[C];l=P===void 0?Number.POSITIVE_INFINITY:r+P,c>=$s&&(h=(t.now??Date.now)()+Or),k=Promise.resolve().then(async()=>{await v.refresh()}).catch(_=>{!s&&m!==S&&(m=S,console.warn("[dsh-automation] \u5237\u65B0 Host \u4F1A\u8BDD\u5217\u8868\u5931\u8D25",_))}).finally(()=>{k=void 0,!(s||!A)&&(A=!1,u())})},g=e.source.subscribe(()=>{e.source.getSnapshot().phase==="loading"?i=!0:i&&(i=!1,r+=1),u()},{background:!0});return u(),()=>{s=!0,A=!1,g()}}function Zs(e){let n={phase:"idle"},t,s,r=()=>{},i=new Set,o=new Set,a=()=>{if(s!==void 0&&clearInterval(s),i.size===0){s=void 0;return}s=setInterval(()=>{m().catch(()=>{})},it(n.snapshot?.runs,o.size))},c=()=>{if(r(),o.size===0)return;let f=()=>{m().catch(()=>{})},p=()=>{document.visibilityState==="visible"&&f()};typeof window<"u"&&window.addEventListener("focus",f),typeof document<"u"&&document.addEventListener("visibilitychange",p),r=()=>{typeof window<"u"&&window.removeEventListener("focus",f),typeof document<"u"&&document.removeEventListener("visibilitychange",p),r=()=>{}}},l=f=>{let p=it(n.snapshot?.runs,o.size);n=f,i.size>0&&p!==it(n.snapshot?.runs,o.size)&&a();for(let u of[...i])u()},h={getSnapshot:()=>n,subscribe:(f,p={})=>{let u=i.size>0,g=o.size>0;return i.add(f),p.background!==!0&&o.add(f),(!u||p.background!==!0&&!g)&&queueMicrotask(()=>{i.size>0&&m().catch(()=>{})}),a(),o.size>0&&!g&&c(),()=>{i.delete(f),o.delete(f),i.size===0&&s!==void 0?(clearInterval(s),s=void 0):i.size>0&&a(),o.size===0&&r()}}},m=async()=>{if(t!==void 0)return t;let f=n.snapshot;return l(f===void 0?{phase:"loading"}:{phase:"loading",snapshot:f,...n.refreshedAt===void 0?{}:{refreshedAt:n.refreshedAt}}),t=(async()=>{try{let p=await e.call(tn,"snapshot",{sessionId:"settings"}),u=nn(p);l({phase:"ready",snapshot:u,refreshedAt:Date.now()})}catch(p){let u=p instanceof Error?p.message:String(p);throw l(f===void 0?{phase:"error",error:u}:{phase:"error",snapshot:f,error:u,...n.refreshedAt===void 0?{}:{refreshedAt:n.refreshedAt}}),p}finally{t=void 0}})(),t},k=async(f,p)=>{try{return await e.call(tn,f,p)}catch(u){if(!at(u))throw u;return await e.call(tn,f,p)}},A=async(f,p,u)=>{nn(await k(f,p));let g=()=>{u!==void 0&&n.snapshot!==void 0&&l({phase:"ready",snapshot:u(n.snapshot),refreshedAt:Date.now()})},v=t;g(),v!==void 0&&(await v.catch(()=>{}),g());try{await m()}catch{}};return{source:h,refresh:m,async createAutomation(f){await A("create",{sessionId:"settings",input:f})},async mutateAutomation(f,p){await A("mutate",{sessionId:"settings",automationId:f,mutation:p},p==="delete"?g=>({...g,automations:g.automations.filter(v=>v.id!==f)}):g=>({...g,automations:g.automations.map(v=>v.id===f?{...v,status:p==="pause"?"paused":"active"}:v)}))},async updateAutomation(f,p){await A("update",{sessionId:"settings",automationId:f,input:p})},async runNow(f){await A("run-now",{sessionId:"settings",automationId:f})},async markRunRead(f){await A("mark-read",{sessionId:"settings",runId:f})},async registerWorkspace(f){let p=nn(await e.call(tn,"register-workspace",{path:f}));return await m(),p},async adoptSession(f){nn(await e.call(tn,"adopt-session",{sessionId:f}))},async forgetSession(f){await A("forget-session",{sessionId:f},p=>({...p,runs:p.runs.map(u=>{if(u.sessionId!==f)return u;let{sessionId:g,...v}=u;return v})}))},async forgetAutomationSessions(f){await A("forget-automation-sessions",{automationId:f},p=>({...p,runs:p.runs.map(u=>{if(u.automationId!==f)return u;let{sessionId:g,...v}=u;return v})}))}}}var dt=require("react"),Be=require("@deepseek-ai/dsh-client-ui-primitives");var xe=require("react/jsx-runtime"),Wr=[["created","desc"],["created","asc"],["planned","asc"],["planned","desc"]];function In({t:e,storage:n,storageKey:t,sortKey:s,sortDirection:r,onSelect:i,iconOnly:o=!1,className:a}){let[c,l]=(0,dt.useState)(!1),[h,m]=(0,dt.useState)(()=>Ce(n,t)),k=e(s==="planned"?`sort.planned.${r}`:`sort.created.${r}`),A=h?.key===s&&h.direction===r,f=()=>{n===void 0||A||(Ot(n,t,s,r),m({key:s,direction:r}))},p=[...Wr.map(([g,v])=>({id:`${g}-${v}`,label:e(g==="planned"?`sort.planned.${v}`:`sort.created.${v}`)})),...n===void 0?[]:[{type:"separator",id:"sort-default-sep"},{id:"save-default",label:e(A?"sort.default.saved":"sort.default.save")}]],u=o?(0,xe.jsx)(Be.Tooltip,{label:k,side:"bottom",delayMs:500,disabled:c,portal:!0,children:(0,xe.jsx)("button",{type:"button",className:c?"dsh-st-n-head-btn is-on":"dsh-st-n-head-btn","aria-label":k,"aria-expanded":c,onClick:()=>l(g=>!g),children:(0,xe.jsx)(Sn,{size:16})})}):(0,xe.jsxs)(Be.Button,{variant:"outline",size:"sm",role:"combobox","aria-label":k,"aria-expanded":c,className:["dsh-st-menu-select-trigger",c?"is-open":""].filter(Boolean).join(" "),onClick:()=>l(g=>!g),children:[(0,xe.jsx)("span",{className:"dsh-st-menu-select-label",children:k}),(0,xe.jsx)("svg",{className:"dsh-st-menu-select-arrow",viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",style:{marginLeft:4,transition:"transform 150ms ease",transform:c?"rotate(180deg)":"none"},children:(0,xe.jsx)("path",{d:"m4 6 4 4 4-4"})})]});return(0,xe.jsx)("div",{className:["dsh-st-menu-select-wrap",a].filter(Boolean).join(" "),style:{display:"inline-flex",verticalAlign:"middle"},children:(0,xe.jsx)(Be.Menu,{open:c,onClose:()=>l(!1),selectedId:`${s}-${r}`,align:o?"end":"start",portal:!0,dense:!0,anchor:u,items:p,onSelect:g=>{if(g==="save-default"){f(),l(!1);return}let[v,S]=g.split("-");i(v,S),l(!1)}})})}var Nn="dsh-automation:open-task-settings",lt="dsh-automation:pending-task-settings";function ct(e){if(typeof e!="object"||e===null)return;let n=e;if(!(typeof n.name!="string"||n.name.trim()===""||!Array.isArray(n.sessionIds)||n.sessionIds.some(t=>typeof t!="string"))&&!(n.automationId!==void 0&&(typeof n.automationId!="string"||n.automationId.trim()==="")))return{...typeof n.automationId=="string"?{automationId:n.automationId}:{},name:n.name,sessionIds:[...n.sessionIds]}}function zr(e,n){try{e?.setItem(lt,JSON.stringify(n))}catch{}}function ut(e){typeof window>"u"||(zr(window.sessionStorage,e),window.dispatchEvent(new CustomEvent(Nn,{detail:e})))}function Xs(e){if(e!==void 0)try{let n=e.getItem(lt);return n===null?void 0:ct(JSON.parse(n))}catch{return}}function Js(e){try{e?.removeItem(lt)}catch{}}function Ys(e,n,t){if(e.automationId!==void 0){let a=n.find(c=>c.id===e.automationId);if(a!==void 0)return a}let s=new Set(e.sessionIds),r=t.find(a=>a.sessionId!==void 0&&s.has(a.sessionId))?.automationId,i=n.find(a=>a.id===r);if(i!==void 0)return i;let o=n.filter(a=>a.name===e.name);return o.length===1?o[0]:void 0}var w=require("react/jsx-runtime");var Cn=typeof window>"u"?void 0:window.localStorage,Qs=typeof window>"u"?void 0:window.sessionStorage,Gr=[{name:"\u6BCF\u65E5\u56DE\u5F52\u68C0\u67E5",scheduleKind:"daily",time:"09:00",weekdays:[1,2,3,4,5]},{name:"\u6BCF\u5468\u4F9D\u8D56\u5DE1\u68C0",scheduleKind:"weekly",time:"10:00",weekdays:[1]},{name:"\u5DE5\u4F5C\u65E5\u65E9\u62A5",scheduleKind:"weekly",time:"08:00",weekdays:[1,2,3,4,5]}];function eo({t:e,permissionT:n,modelT:t,runtime:s,closeSettings:r,addWorkspace:i}){let o=(0,Q.useSyncExternalStore)(s.source.subscribe,s.source.getSnapshot,s.source.getSnapshot),[a,c]=(0,Q.useState)("mine"),[l,h]=(0,Q.useState)(""),[m,k]=(0,Q.useState)(!1),[A,f]=(0,Q.useState)(),[p,u]=(0,Q.useState)(),[g,v]=(0,Q.useState)(),[S,C]=(0,Q.useState)(!1),[P,_]=(0,Q.useState)(),[oe,U]=(0,Q.useState)("day"),[G,$]=(0,Q.useState)("all"),[O,K]=(0,Q.useState)("all"),[B,J]=(0,Q.useState)(()=>Ce(Cn,fn)?.key??"created"),[re,ee]=(0,Q.useState)(()=>Ce(Cn,fn)?.direction??"desc"),[ne,x]=(0,Q.useState)(()=>Xs(Qs)),H=(0,Q.useMemo)(()=>new Date(o.snapshot?.serverNow??Date.now()),[o.snapshot?.serverNow,o.refreshedAt]),E=o.snapshot,ae=E?.workspaces??[],de=E?.models??[],ce=E?.permissions??[],ie=E?.defaultPermission??"",fe=mn((E?.automations??[]).filter(T=>l.trim()===""||`${T.name} ${T.prompt}`.toLowerCase().includes(l.trim().toLowerCase())),B,re),Se=(E?.runs??[]).filter(T=>!(G!=="all"&&T.automationId!==G||O!=="all"&&T.status!==O)),ge=Ht(Se,oe,H,e),Z=async T=>{C(!0),_(void 0);try{await T()}catch(d){_(d instanceof ue?e(d.key):at(d)?e("error.offline"):d instanceof Error?d.message:e("error.action"))}finally{C(!1)}},te=()=>{k(!1),v(void 0),f(void 0)},ye=T=>{ie===""||ce.length===0||(f(void 0),v(T),k(!0))},we=T=>{f(T.id),v(Ft(T,ae,E?.defaultModel??null,E?.defaultPermission??T.permission)),k(!0)};return(0,Q.useEffect)(()=>{if(typeof window>"u")return;let T=d=>{let I=ct(d.detail);I!==void 0&&x(I)};return window.addEventListener(Nn,T),()=>{window.removeEventListener(Nn,T)}},[]),(0,Q.useEffect)(()=>{if(ne===void 0||E===void 0)return;let T=Ys(ne,E.automations,E.runs);if(Js(Qs),x(void 0),c("mine"),h(""),T===void 0){_(e("error.taskMissing"));return}we(T)},[E,ne,e]),(0,w.jsxs)("div",{className:"dsh-st-shell",children:[(0,w.jsxs)("header",{className:"dsh-st-top",children:[(0,w.jsxs)("div",{className:"dsh-st-heading",children:[(0,w.jsxs)("div",{className:"dsh-st-heading-row",children:[(0,w.jsx)("h1",{children:e("tab")}),(0,w.jsxs)("div",{className:"dsh-st-heading-links",children:[(0,w.jsx)(le.Button,{variant:"outline",size:"sm","aria-label":e("header.githubProject"),icon:(0,w.jsx)(bs,{}),onClick:()=>{window.open("https://github.com/MichengAI/dsh-automation","_blank","noreferrer")},children:e("header.githubProject")}),(0,w.jsx)(le.Button,{variant:"outline",size:"sm","aria-label":e("header.githubFeedback"),icon:(0,w.jsx)(ws,{}),onClick:()=>{window.open("https://github.com/MichengAI/dsh-automation/issues","_blank","noreferrer")},children:e("header.githubFeedback")})]})]}),(0,w.jsx)("p",{children:e("header.lead")})]}),(0,w.jsxs)("div",{className:"dsh-st-toolbar",children:[(0,w.jsx)(le.Input,{className:"dsh-st-search",value:l,placeholder:e("search.placeholder"),onChange:T=>h(T.target.value)}),(0,w.jsx)(le.Button,{variant:"outline",icon:(0,w.jsx)(vs,{}),onClick:()=>{Gs(e("chat.prompt")),r?.()},children:e("action.chatCreate")}),(0,w.jsx)(le.Button,{variant:"primary",icon:(0,w.jsx)(wn,{}),disabled:ie===""||ce.length===0,onClick:()=>ye(),children:e("action.create")}),(0,w.jsx)(le.Button,{className:"dsh-st-row-icon",variant:"outline",size:"sm",icon:(0,w.jsx)(hs,{}),"aria-label":e("section.refresh"),style:tt,onClick:()=>{s.refresh()}})]})]}),(0,w.jsx)("div",{className:"dsh-st-banner",role:"note",children:(0,w.jsxs)("span",{children:[(0,w.jsx)(ys,{}),e("banner.wake")]})}),(0,w.jsxs)("section",{className:"dsh-st-examples",children:[(0,w.jsx)("div",{className:"dsh-st-examples-head",children:(0,w.jsx)("h2",{children:e("examples.title")})}),(0,w.jsx)("div",{className:"dsh-st-example-row",children:Gr.map((T,d)=>(0,w.jsxs)("button",{type:"button",className:"dsh-st-example",disabled:ie===""||ce.length===0,onClick:()=>ye({name:e(`examples.${d+1}.title`),prompt:e(`examples.${d+1}.body`),scheduleKind:T.scheduleKind,time:T.time,weekdays:T.weekdays}),children:[(0,w.jsx)("strong",{children:e(`examples.${d+1}.title`)}),(0,w.jsx)("p",{children:e(`examples.${d+1}.body`)}),(0,w.jsxs)("span",{className:"dsh-st-chip",children:[(0,w.jsx)(Ie,{size:14}),e(`examples.${d+1}.chip`)]})]},T.name))})]}),P!==void 0&&(0,w.jsx)("p",{className:"dsh-st-error",children:P}),(o.phase==="idle"||o.phase==="loading"&&E===void 0)&&(0,w.jsx)("p",{className:"dsh-st-muted",children:e("loading")}),o.phase==="error"&&E===void 0&&(0,w.jsxs)("div",{className:"dsh-st-empty",children:[(0,w.jsx)("h3",{children:e("error.title")}),(0,w.jsx)("p",{children:o.error}),(0,w.jsx)(le.Button,{variant:"primary",onClick:()=>{s.refresh()},children:e("error.retry")})]}),(0,w.jsxs)("div",{className:"dsh-st-tabs",children:[(0,w.jsx)(le.SegmentedTabs,{className:"dsh-st-settings-tabs",label:e("tab"),value:a,items:[{value:"mine",id:"dsh-st-tab-mine",panelId:"dsh-st-panel-mine",label:(0,w.jsxs)("span",{className:"dsh-st-tab-label",children:[(0,w.jsx)(Ie,{size:14}),(0,w.jsx)("span",{children:e("tabs.mine")})]})},{value:"runs",id:"dsh-st-tab-runs",panelId:"dsh-st-panel-runs",label:(0,w.jsxs)("span",{className:"dsh-st-tab-label",children:[(0,w.jsx)(Ge,{size:14}),(0,w.jsx)("span",{children:e("tabs.runs")})]})}],onChange:c}),a==="mine"&&(0,w.jsx)("div",{className:"dsh-st-sort-wrap",children:(0,w.jsx)(In,{t:e,...Cn===void 0?{}:{storage:Cn},storageKey:fn,sortKey:B,sortDirection:re,onSelect:(T,d)=>{J(T),ee(d)}})}),a==="runs"&&(0,w.jsxs)("div",{className:"dsh-st-filters",children:[(0,w.jsx)(he,{compact:!0,className:"dsh-st-filter-range",value:oe,options:["day","week","month"].map(T=>({value:T,label:e(`history.range.${T}`)})),onChange:T=>U(T)}),(0,w.jsx)(he,{compact:!0,className:"dsh-st-filter-task",value:G,options:[{value:"all",label:e("history.allTasks")},...(E?.automations??[]).map(T=>({value:T.id,label:T.name}))],onChange:$}),(0,w.jsx)(he,{compact:!0,className:"dsh-st-filter-status",value:O,options:[{value:"all",label:e("history.allStatus")},...Dt.map(T=>({value:T,label:e(`status.${T}`)}))],onChange:T=>K(T)})]})]}),a==="mine"&&(fe.length===0?(0,w.jsxs)("div",{id:"dsh-st-panel-mine",role:"tabpanel","aria-labelledby":"dsh-st-tab-mine",className:"dsh-st-empty",children:[(0,w.jsx)("h3",{children:e("empty.title")}),(0,w.jsx)("p",{children:e("empty.body")})]}):(0,w.jsx)("div",{id:"dsh-st-panel-mine",role:"tabpanel","aria-labelledby":"dsh-st-tab-mine",className:"dsh-st-grid",children:fe.map(T=>(0,w.jsx)(Vr,{item:T,t:e,now:H,busy:S,onEdit:()=>we(T),onToggle:()=>{Z(()=>s.mutateAutomation(T.id,vn(T.status)))},onRun:()=>{Z(()=>s.runNow(T.id))},onDelete:()=>u(T)},T.id))})),a==="runs"&&(ge.length===0?(0,w.jsx)("div",{id:"dsh-st-panel-runs",role:"tabpanel","aria-labelledby":"dsh-st-tab-runs",className:"dsh-st-empty",children:e("runs.empty")}):(0,w.jsx)("div",{id:"dsh-st-panel-runs",role:"tabpanel","aria-labelledby":"dsh-st-tab-runs",className:"dsh-st-timeline",children:ge.map(T=>(0,w.jsxs)("section",{className:"dsh-st-group",children:[(0,w.jsx)("h3",{children:T.label}),T.items.map(d=>(0,w.jsx)(Br,{run:d,t:e},d.id))]},T.key))})),m&&(0,w.jsx)(_s,{t:e,permissionT:n,modelT:t,busy:S,workspaces:ae,models:de,modelFailures:E?.modelFailures??[],defaultModel:E?.defaultModel??null,skills:E?.skills??[],permissions:ce,defaultPermission:ie,editing:A!==void 0,...g===void 0?{}:{draft:g},onClose:te,...i===void 0?{}:{onAddWorkspace:i},onSubmit:async T=>{let d=Et(T,ae,de,new Date,{allowPastOnce:A!==void 0});await Z(async()=>{A===void 0?await s.createAutomation(d):await s.updateAutomation(A,d),te()})}},A??"create"),(0,w.jsx)(zs,{target:p,t:e,busy:S,onCancel:()=>u(void 0),onConfirm:()=>{let T=p;T!==void 0&&Z(async()=>{await s.mutateAutomation(T.id,"delete"),u(void 0)})}})]})}function Vr({item:e,t:n,now:t,busy:s,onEdit:r,onToggle:i,onRun:o,onDelete:a}){let[c,l]=(0,Q.useState)(!1);return(0,w.jsxs)("article",{className:"dsh-st-card",onClick:r,children:[(0,w.jsxs)("div",{className:"dsh-st-card-head",children:[(0,w.jsx)("span",{onClick:h=>h.stopPropagation(),children:(0,w.jsx)(le.Switch,{checked:e.status==="active",disabled:s,label:e.status==="active"?n("card.pause"):n("card.resume"),onChange:()=>i()})}),(0,w.jsx)("span",{onClick:h=>h.stopPropagation(),children:(0,w.jsx)(le.Menu,{open:c,onClose:()=>l(!1),align:"end",portal:!0,dense:!0,anchor:(0,w.jsx)(le.Tooltip,{label:n("card.more"),side:"bottom",delayMs:500,portal:!0,children:(0,w.jsx)("button",{type:"button",className:"dsh-st-row-icon","aria-label":n("card.more"),style:{...tt,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:"1px solid var(--dsw-alias-border-l2, rgba(255,255,255,.15))",borderRadius:"var(--dsw-radius-sm, 6px)",background:"transparent",color:"var(--dsw-alias-label-secondary)",cursor:"pointer"},onClick:()=>l(h=>!h),children:(0,w.jsx)(Ye,{size:16})})}),items:[{id:"run",label:n("menu.run"),disabled:s},{id:"edit",label:n("menu.edit"),disabled:s},{id:"delete",label:n("menu.delete"),danger:!0,disabled:s}],onSelect:h=>{l(!1),h==="run"&&o(),h==="edit"&&r(),h==="delete"&&a()}})})]}),(0,w.jsx)("h3",{children:e.name}),(0,w.jsx)("p",{children:e.prompt}),(0,w.jsxs)("div",{className:"dsh-st-card-foot",children:[(0,w.jsxs)("span",{className:"dsh-st-chip",children:[(0,w.jsx)(Ie,{size:14}),un(e.schedule,n)]}),(0,w.jsx)("span",{children:e.nextRunAt===void 0?n("stats.noneScheduled"):n("history.nextApprox",{when:pn(e.nextRunAt,t,n)})})]})]})}function Br({run:e,t:n}){let t=Lt(e.startedAt,e.finishedAt);return(0,w.jsxs)("article",{className:`dsh-st-run is-${e.status}`,children:[(0,w.jsx)("strong",{children:e.automationName}),(0,w.jsxs)("p",{children:[(0,w.jsx)("span",{children:Pt(e.startedAt??e.scheduledFor)}),t!==void 0&&(0,w.jsx)("span",{children:t}),(0,w.jsx)("span",{children:At(e.trigger,n)})]})]})}var Ue="dsh-automation",no={tab:"Scheduled tasks","sidebar.tab":"Scheduled","sidebar.tabs":"Workspace views","sidebar.tasksTab":"Tasks","sidebar.channelsTab":"Channels","sidebar.views":"Scheduled views","sidebar.viewOverview":"Task overview","sidebar.runsTab":"Records","sidebar.overviewTab":"Tasks","sidebar.empty":"No scheduled runs yet.","sidebar.tasksEmpty":"No web tasks yet.","sidebar.ungrouped":"Ungrouped","sidebar.section":"Scheduled","sidebar.workspaces":"Workspaces","sidebar.search":"Search","sidebar.sessions":"Sessions","sidebar.searchSessions":"Search session names","sidebar.clearSearch":"Clear search","sidebar.filter":"View options","sidebar.groupBy":"Group by","sidebar.groupWorkspace":"WorkSpace","sidebar.groupWorkspaceTree":"Workspace Tree","sidebar.groupList":"In one list","sidebar.sortBy":"Order by","sidebar.sortManual":"Manual","sidebar.sortTime":"Last updated","sidebar.filterBy":"Filter sessions","sidebar.hideArchived":"Hide archived","sidebar.showArchived":"All conversations (show archived)","sidebar.onlyArchived":"Archived only","header.lead":"Plan automatic tasks, or trigger them by hand. Describe the recurring work in any chat to create it quickly.","header.githubProject":"GitHub","header.githubFeedback":"Issues","examples.title":"Recommended examples","examples.1.title":"Daily regression check","examples.1.body":"Create a scheduled task that runs every day and inspects new test failures.","examples.1.chip":"Every day 09:00","examples.2.title":"Weekly dependency review","examples.2.body":"Create a scheduled task that runs every Monday and reports outdated or risky dependencies.","examples.2.chip":"Monday 10:00","examples.3.title":"Weekday morning briefing","examples.3.body":"Create a scheduled task that runs on weekdays and summarizes overnight changes.","examples.3.chip":"Weekdays 08:00","chat.hint":"In any conversation, describe the recurring work and ask the Agent to call automation_create.","chat.prompt":"I want to create a scheduled task that runs every [interval] and does [the actual task]","menu.run":"Run task","menu.edit":"Edit task","menu.delete":"Delete task","session.rename":"Rename","session.fork":"Fork session","session.archive":"Archive session","session.unarchive":"Restore","session.copySessionId":"Copy Session ID","session.moreActions":"More actions for {title}","session.groupActions":"Actions for {name}","session.taskSettings":"Task settings","session.archiveGroup":"Archive all conversations","session.archiveGroupConfirm":"Archive all","session.archiveGroupDescription":"Archive all {count} conversations for \u201C{name}\u201D. Choose Filter \u2192 Show archived to restore them.","session.archiveGroupPending":"Archiving conversations\u2026","session.archiveGroupFailed":"Some conversations could not be archived: {message}","session.archiveGroupClose":"Close","session.archiveGroupCancel":"Cancel","session.unarchiveGroup":"Restore all conversations","session.unarchiveGroupConfirm":"Restore all","session.unarchiveGroupDescription":"Restore all {count} conversations for \u201C{name}\u201D.","session.unarchiveGroupPending":"Restoring conversations\u2026","session.unarchiveGroupFailed":"Some conversations could not be restored: {message}","session.unarchiveGroupClose":"Close","session.unarchiveGroupCancel":"Cancel","session.deleteSession":"Delete session","session.deleteSessionConfirm":"Delete session","session.deleteSessionDescription":"This permanently deletes session \u201C{name}\u201D, its child agents (including any that are still running), and all of its records (conversation, stats, cache). This cannot be undone.","session.deleteSessionPending":"Deleting session\u2026","session.deleteSessionFailed":"Could not delete the session: {message}","session.deleteSessionClose":"Close","session.deleteSessionCancel":"Cancel","session.idle":"Idle","session.runningStatus":"Running","session.completed":"Completed","session.waitingApproval":"Waiting for approval","session.planReview":"Plan to review","session.waitingAnswer":"Waiting for an answer","session.subagentsRunning":"{count} subagents running","session.archived":"Archived","session.delete":"Remove from Scheduled","session.deleteFolder":"Remove folder","session.confirmDeleteFolder":"Remove this folder from Scheduled?","session.confirmDeleteFolderHint":'This only unlists {count} session(s) in "{name}" from Scheduled. Host sessions are not deleted and they stay hidden from Tasks.',"session.confirmDeleteFolderAction":"Remove from Scheduled","history.range.day":"By day","history.range.week":"By week","history.range.month":"By month","history.allTasks":"All tasks","history.allStatus":"All statuses","history.today":"Today","history.yesterday":"Yesterday","history.date":"{date}","history.week":"Week of {date}","history.month":"{month}","history.nextApprox":"Next run in about {when}","time.withinMinute":"about {count} minutes","time.withinHour":"about {count} hours","time.withinDay":"about {count} days","search.placeholder":"Search scheduled tasks...","action.chatCreate":"Create in chat","action.create":"New scheduled task","banner.wake":"Scheduled tasks run only while this computer stays awake.","tabs.mine":"Tasks","tabs.runs":"Run history","sort.by":"Sort","sort.created.asc":"Created time ascending","sort.created.desc":"Created time descending","sort.planned.asc":"Planned time ascending","sort.planned.desc":"Planned time descending","sort.default.save":"Set as default","sort.default.saved":"Default","form.workspace":"Workspace","form.fieldWorkspace":"Workspace","form.fieldModel":"Model","form.providerAccount":"DeepSeek account","form.fieldEffort":"Reasoning","form.fieldPermission":"Permission","form.slashHint":"Type / to insert a skill","form.slashEmpty":"No matching skills","form.addWorkspace":"Add workspace","form.workspaceRequired":"Add a registered workspace before saving.","form.workspaceUnavailable":"This Host cannot create workspaces.","form.addWorkspaceFailed":"Could not add the workspace.","form.workspacePath":"Folder path","form.workspacePathPlaceholder":"D:\\work\\project","form.model":"Model","form.modelSelect":"Select model","form.effort":"Reasoning","form.effort.none":"Default","form.effort.low":"Low","form.effort.medium":"Medium","form.effort.high":"High","form.error.workspace":"Select a workspace.","modal.title":"New scheduled task","modal.edit":"Edit scheduled task","modal.save":"Save","header.eyebrow":"Unattended coding work","header.title":"Automations","header.subtitle":"Schedule standalone, auditable Agent runs for this workspace.","header.create":"New automation","header.closeCreate":"Hide form","scope.workspace":"Workspace","scope.folder":"Working directory","stats.total":"All","stats.active":"Active","stats.next":"Next run","stats.attention":"Needs attention","stats.noneScheduled":"None scheduled","stats.noAttention":"All clear","section.automations":"Workspace automations","section.automationsHint":"Each trigger starts a fresh DSH Session and keeps its own audit record.","section.runs":"Recent runs","section.runsHint":"Latest outcomes for this workspace.","section.refresh":"Refresh","empty.title":"Let recurring coding work run itself","empty.body":"Save a self-contained task, a schedule, and a permission boundary. Every run starts in a new Session.","empty.action":"Create the first automation","runs.empty":"No runs yet. Run one now, or wait for the next scheduled occurrence.","overview.empty":"No scheduled tasks yet. Create one in Settings.","form.title":"Create automation","form.subtitle":"Write a complete, standalone task. Scheduled runs do not inherit this conversation.","form.name":"Name","form.namePlaceholder":"Daily regression triage","form.prompt":"Task prompt","form.promptPlaceholder":"Inspect new test failures, locate the regression, and propose a verified minimal fix\u2026","form.schedule":"Schedule","form.planTime":"Schedule","form.hourly":"Hourly","form.monthly":"Monthly","form.custom":"Every few days","form.intervalHint":"Runs every this many minutes, starting now.","form.customHint":"Runs every this many days at the selected time.","form.atTime":"at","form.minutesShort":"min","form.daysShort":"days","form.monthDay":"Day {day} of month","form.skills":"Skills","form.skillsEmpty":"No skills available","schedule.hourlyAt":"Every hour at :{minute}","schedule.monthlyAt":"Monthly on day {day} \xB7 {time}","schedule.customAt":"Every {count} days \xB7 {time}","form.once":"Does not repeat","form.interval":"Interval","form.daily":"Daily","form.weekly":"Weekly","form.runAt":"Run at","form.every":"Every","form.minutes":"minutes","form.time":"Time","form.days":"Weekdays","form.timeZone":"Time zone","form.maxConcurrentRuns":"Concurrency","form.maxConcurrentRunsHint":"Queued and running executions share this limit. Defaults to 1; when full, scheduled triggers are skipped and manual runs are rejected.","form.error.maxConcurrentRuns":"Enter a positive whole number for concurrent runs.","form.permission":"Permission boundary","permission.readOnly":"Read Only","permission.workspaceWrite":"Workspace Write","permission.fullAccess":"Full access","form.cancel":"Cancel","form.submit":"Create automation","form.submitting":"Creating\u2026","form.error.name":"Enter a name.","form.error.prompt":"Enter a complete, standalone task prompt.","form.error.once":"Choose a valid future date and time.","form.error.interval":"The interval must be between 1 and 43,200 minutes.","form.error.weekdays":"Select at least one weekday.","day.1":"Mon","day.2":"Tue","day.3":"Wed","day.4":"Thu","day.5":"Fri","day.6":"Sat","day.7":"Sun","status.active":"Active","status.paused":"Paused","status.queued":"Queued","status.running":"Running","status.succeeded":"Succeeded","status.failed":"Failed","status.skipped":"Skipped","status.cancelled":"Cancelled","status.interrupted":"Interrupted","card.nextRun":"Next","card.lastRun":"Last","card.never":"Not yet run","schedule.onceAt":"Once \xB7 {time}","schedule.everyMinutes":"Every {count} minutes","schedule.dailyAt":"Daily \xB7 {time}","schedule.weeklyAt":"{days} \xB7 {time}","card.pause":"Pause","card.resume":"Resume","card.runNow":"Run now","card.more":"More actions","card.delete":"Delete","card.confirmDelete":"Delete this automation?","card.confirmDeleteHint":"Run history is kept for audit.","card.confirm":"Delete","card.cancel":"Cancel","run.trigger.schedule":"Scheduled","run.trigger.manual":"Manual","run.openSession":"Session {id}","run.markRead":"Mark reviewed",loading:"Loading automations\u2026","error.title":"Automations could not be loaded","error.retry":"Try again","error.action":"The action failed. Please try again.","error.taskMissing":"This scheduled task no longer exists.","error.offline":"Could not reach the local automation service. Check that DSH is still running and try again.","time.minutes":"{count}m","time.hours":"{count}h","time.days":"{count}d","time.months":"{count}mo","time.years":"{count}y","time.ago":"{text} ago","time.now":"now","session.copy":"Copy","session.copied":"Copied","session.compactApproval":"Approval","session.compactPlan":"Plan review","session.compactAnswer":"Answer","time.minuteAgo":"{count}m ago","time.hourAgo":"{count}h ago","time.dayAgo":"{count}d ago","time.inMinute":"in {count}m","time.inHour":"in {count}h","time.inDay":"in {count}d"},to={tab:"\u5B9A\u65F6\u4EFB\u52A1","sidebar.tab":"\u5B9A\u65F6","sidebar.tabs":"\u5DE5\u4F5C\u533A\u5206\u7C7B","sidebar.tasksTab":"\u4EFB\u52A1","sidebar.channelsTab":"\u9891\u9053","sidebar.views":"\u5B9A\u65F6\u9875\u89C6\u56FE","sidebar.viewOverview":"\u4EFB\u52A1\u603B\u89C8","sidebar.runsTab":"\u8BB0\u5F55","sidebar.overviewTab":"\u4EFB\u52A1","sidebar.empty":"\u8FD8\u6CA1\u6709\u5B9A\u65F6\u4EFB\u52A1\u6267\u884C\u8BB0\u5F55\u3002","sidebar.tasksEmpty":"\u6682\u65E0\u7F51\u9875\u4EFB\u52A1","sidebar.ungrouped":"\u672A\u5206\u7EC4","sidebar.section":"\u5B9A\u65F6\u4EFB\u52A1","sidebar.workspaces":"\u5DE5\u4F5C\u533A","sidebar.search":"\u641C\u7D22","sidebar.sessions":"\u4F1A\u8BDD","sidebar.searchSessions":"\u641C\u7D22\u4F1A\u8BDD\u540D\u79F0","sidebar.clearSearch":"\u6E05\u9664\u641C\u7D22","sidebar.filter":"\u89C6\u56FE\u9009\u9879","sidebar.groupBy":"\u5206\u7EC4\u65B9\u5F0F","sidebar.groupWorkspace":"\u6309\u5DE5\u4F5C\u533A","sidebar.groupWorkspaceTree":"\u6309\u5DE5\u4F5C\u533A\u6811","sidebar.groupList":"\u5355\u5217\u8868","sidebar.sortBy":"\u6392\u5E8F\u65B9\u5F0F","sidebar.sortManual":"\u624B\u52A8\u6392\u5E8F","sidebar.sortTime":"\u6700\u8FD1\u66F4\u65B0","sidebar.filterBy":"\u7B5B\u9009\u4F1A\u8BDD","sidebar.hideArchived":"\u9690\u85CF\u5DF2\u5F52\u6863","sidebar.showArchived":"\u5168\u90E8\u5BF9\u8BDD\uFF08\u663E\u793A\u5DF2\u5F52\u6863\uFF09","sidebar.onlyArchived":"\u4EC5\u663E\u793A\u5DF2\u5F52\u6863","header.lead":"\u6309\u8BA1\u5212\u81EA\u52A8\u6267\u884C\u4EFB\u52A1\uFF0C\u4E5F\u53EF\u968F\u65F6\u624B\u52A8\u89E6\u53D1\u3002\u5728\u4EFB\u610F\u5BF9\u8BDD\u4E2D\u63CF\u8FF0\u4F60\u60F3\u5B9A\u671F\u505A\u7684\u4E8B\uFF0C\u5373\u53EF\u5FEB\u901F\u521B\u5EFA","header.githubProject":"GitHub","header.githubFeedback":"\u95EE\u9898\u53CD\u9988","examples.title":"\u63A8\u8350\u6848\u4F8B","examples.1.title":"\u6BCF\u65E5\u56DE\u5F52\u68C0\u67E5","examples.1.body":"\u6211\u8981\u521B\u5EFA\u4E00\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u6BCF\u3010\u5929\u3011\u6267\u884C\u3010\u68C0\u67E5\u65B0\u589E\u6D4B\u8BD5\u5931\u8D25\u5E76\u7ED9\u51FA\u6700\u5C0F\u4FEE\u590D\u3011\u3002","examples.1.chip":"\u6BCF\u5929 09:00","examples.2.title":"\u6BCF\u5468\u4F9D\u8D56\u5DE1\u68C0","examples.2.body":"\u6211\u8981\u521B\u5EFA\u4E00\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u6BCF\u3010\u5468\u4E00\u3011\u6267\u884C\u3010\u68C0\u67E5\u8FC7\u671F\u6216\u6709\u98CE\u9669\u7684\u4F9D\u8D56\u5E76\u7ED9\u51FA\u5904\u7406\u5EFA\u8BAE\u3011\u3002","examples.2.chip":"\u6BCF\u5468\u4E00 10:00","examples.3.title":"\u5DE5\u4F5C\u65E5\u65E9\u62A5","examples.3.body":"\u6211\u8981\u521B\u5EFA\u4E00\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u6BCF\u3010\u5DE5\u4F5C\u65E5\u3011\u6267\u884C\u3010\u6C47\u603B\u6628\u591C\u4ED3\u5E93\u53D8\u66F4\u5E76\u7ED9\u51FA\u4ECA\u65E5\u5173\u6CE8\u70B9\u3011\u3002","examples.3.chip":"\u5DE5\u4F5C\u65E5 08:00","chat.hint":"\u5728\u4EFB\u610F\u5BF9\u8BDD\u4E2D\u63CF\u8FF0\u4F60\u60F3\u5B9A\u671F\u505A\u7684\u4E8B\uFF0C\u5E76\u8BA9 Agent \u8C03\u7528 automation_create\u3002","chat.prompt":"\u6211\u8981\u521B\u5EFA\u4E00\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u6BCF\u3010\u65F6\u95F4\u95F4\u9694\u3011\u6267\u884C\u3010\u5177\u4F53\u4EFB\u52A1\u3011","menu.run":"\u6267\u884C\u4EFB\u52A1","menu.edit":"\u7F16\u8F91\u4EFB\u52A1","menu.delete":"\u5220\u9664\u4EFB\u52A1","session.rename":"\u91CD\u547D\u540D","session.fork":"\u5206\u53C9\u4F1A\u8BDD","session.archive":"\u5F52\u6863\u4F1A\u8BDD","session.unarchive":"\u6062\u590D","session.copySessionId":"\u590D\u5236 Session ID","session.moreActions":"\u201C{title}\u201D\u7684\u66F4\u591A\u64CD\u4F5C","session.groupActions":"\u201C{name}\u201D\u7684\u4EFB\u52A1\u64CD\u4F5C","session.taskSettings":"\u4EFB\u52A1\u8BBE\u7F6E","session.archiveGroup":"\u5F52\u6863\u6574\u7EC4\u4F1A\u8BDD","session.archiveGroupConfirm":"\u786E\u8BA4\u5F52\u6863","session.archiveGroupDescription":"\u5C06\u5F52\u6863\u201C{name}\u201D\u4E0B\u7684 {count} \u4E2A\u4F1A\u8BDD\u3002\u53EF\u5728\u7B5B\u9009\u4E2D\u9009\u62E9\u201C\u663E\u793A\u5DF2\u5F52\u6863\u201D\u540E\u6062\u590D\u3002","session.archiveGroupPending":"\u6B63\u5728\u5F52\u6863\u6574\u7EC4\u4F1A\u8BDD\u2026","session.archiveGroupFailed":"\u90E8\u5206\u4F1A\u8BDD\u5F52\u6863\u5931\u8D25\uFF1A{message}","session.archiveGroupClose":"\u5173\u95ED","session.archiveGroupCancel":"\u53D6\u6D88","session.unarchiveGroup":"\u6062\u590D\u6574\u7EC4\u4F1A\u8BDD","session.unarchiveGroupConfirm":"\u786E\u8BA4\u6062\u590D","session.unarchiveGroupDescription":"\u5C06\u6062\u590D\u201C{name}\u201D\u4E0B\u7684 {count} \u4E2A\u4F1A\u8BDD\u3002","session.unarchiveGroupPending":"\u6B63\u5728\u6062\u590D\u6574\u7EC4\u4F1A\u8BDD\u2026","session.unarchiveGroupFailed":"\u90E8\u5206\u4F1A\u8BDD\u6062\u590D\u5931\u8D25\uFF1A{message}","session.unarchiveGroupClose":"\u5173\u95ED","session.unarchiveGroupCancel":"\u53D6\u6D88","session.deleteSession":"\u5220\u9664\u4F1A\u8BDD","session.deleteSessionConfirm":"\u5220\u9664\u4F1A\u8BDD","session.deleteSessionDescription":"\u5C06\u6C38\u4E45\u5220\u9664\u4F1A\u8BDD\u201C{name}\u201D\u53CA\u5176\u5B50\u4EE3\u7406\uFF08\u542B\u6B63\u5728\u8FD0\u884C\u7684\uFF09\u548C\u5168\u90E8\u8BB0\u5F55\uFF08\u5BF9\u8BDD\u5185\u5BB9\u3001\u7EDF\u8BA1\u3001\u7F13\u5B58\uFF09\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002","session.deleteSessionPending":"\u6B63\u5728\u5220\u9664\u4F1A\u8BDD\u2026","session.deleteSessionFailed":"\u5220\u9664\u4F1A\u8BDD\u5931\u8D25\uFF1A{message}","session.deleteSessionClose":"\u5173\u95ED","session.deleteSessionCancel":"\u53D6\u6D88","session.idle":"\u7A7A\u95F2","session.runningStatus":"\u8FDB\u884C\u4E2D","session.completed":"\u5DF2\u5B8C\u6210","session.waitingApproval":"\u7B49\u5F85\u5BA1\u6279","session.planReview":"\u8BA1\u5212\u5F85\u5BA1","session.waitingAnswer":"\u7B49\u5F85\u56DE\u7B54","session.subagentsRunning":"{count} \u4E2A\u5B50\u4EE3\u7406\u8FD0\u884C\u4E2D","session.archived":"\u5DF2\u5F52\u6863","session.delete":"\u4ECE\u5B9A\u65F6\u9875\u79FB\u9664","session.deleteFolder":"\u4ECE\u5B9A\u65F6\u9875\u79FB\u9664\u6587\u4EF6\u5939","session.confirmDeleteFolder":"\u4ECE\u5B9A\u65F6\u9875\u79FB\u9664\u8FD9\u4E2A\u6587\u4EF6\u5939\uFF1F","session.confirmDeleteFolderHint":"\u53EA\u4F1A\u628A\u300C{name}\u300D\u4E0B\u7684 {count} \u6761\u4F1A\u8BDD\u4ECE\u5B9A\u65F6\u9875\u6458\u6389\uFF0C\u4E0D\u4F1A\u5220\u9664\u5BBF\u4E3B Session\u3002\u4EFB\u52A1\u9875\u672C\u6765\u4E5F\u4E0D\u5C55\u793A\u8FD9\u4E9B\u81EA\u52A8\u5316\u4F1A\u8BDD\u3002","session.confirmDeleteFolderAction":"\u4ECE\u5B9A\u65F6\u9875\u79FB\u9664","history.range.day":"\u6309\u5929","history.range.week":"\u6309\u5468","history.range.month":"\u6309\u6708","history.allTasks":"\u5168\u90E8\u4EFB\u52A1","history.allStatus":"\u5168\u90E8\u72B6\u6001","history.today":"\u4ECA\u5929","history.yesterday":"\u6628\u5929","history.date":"{date}","history.week":"{date} \u5F53\u5468","history.month":"{month}","history.nextApprox":"\u4E0B\u6B21\u6267\u884C \u5927\u7EA6 {when}","time.withinMinute":"{count} \u5206\u949F\u5185","time.withinHour":"{count} \u5C0F\u65F6\u5185","time.withinDay":"{count} \u5929\u5185","search.placeholder":"\u641C\u7D22\u5B9A\u65F6\u4EFB\u52A1...","action.chatCreate":"\u901A\u8FC7\u5BF9\u8BDD\u521B\u5EFA","action.create":"\u65B0\u5EFA\u5B9A\u65F6\u4EFB\u52A1","banner.wake":"\u5B9A\u65F6\u4EFB\u52A1\u4EC5\u5728\u7535\u8111\u4FDD\u6301\u5524\u9192\u65F6\u8FD0\u884C","tabs.mine":"\u5B9A\u65F6\u4EFB\u52A1","tabs.runs":"\u6267\u884C\u8BB0\u5F55","sort.by":"\u6392\u5E8F","sort.created.asc":"\u6309\u521B\u5EFA\u65F6\u95F4\u5347\u5E8F","sort.created.desc":"\u6309\u521B\u5EFA\u65F6\u95F4\u5012\u5E8F","sort.planned.asc":"\u6309\u8BA1\u5212\u65F6\u95F4\u5347\u5E8F","sort.planned.desc":"\u6309\u8BA1\u5212\u65F6\u95F4\u5012\u5E8F","sort.default.save":"\u8BBE\u4E3A\u9ED8\u8BA4","sort.default.saved":"\u9ED8\u8BA4","form.workspace":"\u5DE5\u4F5C\u76EE\u5F55","form.fieldWorkspace":"\u5DE5\u4F5C\u533A","form.fieldModel":"\u6A21\u578B","form.providerAccount":"DeepSeek \u8D26\u53F7","form.fieldEffort":"\u63A8\u7406\u7B49\u7EA7","form.fieldPermission":"\u6743\u9650","form.slashHint":"\u8F93\u5165 / \u53EC\u56DE\u6280\u80FD","form.slashEmpty":"\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD","form.addWorkspace":"\u6DFB\u52A0\u5DE5\u4F5C\u533A","form.workspaceRequired":"\u8BF7\u5148\u6DFB\u52A0\u5DF2\u767B\u8BB0\u7684\u5DE5\u4F5C\u533A\uFF0C\u5426\u5219\u65E0\u6CD5\u4FDD\u5B58\u3002","form.workspaceUnavailable":"\u5F53\u524D\u5BBF\u4E3B\u4E0D\u80FD\u65B0\u5EFA\u5DE5\u4F5C\u533A\u3002","form.addWorkspaceFailed":"\u6DFB\u52A0\u5DE5\u4F5C\u533A\u5931\u8D25\u3002","form.workspacePath":"\u76EE\u5F55\u8DEF\u5F84","form.workspacePathPlaceholder":"D:\\work\\project","form.model":"\u6A21\u578B","form.modelSelect":"\u9009\u62E9\u6A21\u578B","form.effort":"\u63A8\u7406\u7B49\u7EA7","form.effort.none":"\u9ED8\u8BA4","form.effort.low":"Low","form.effort.medium":"Medium","form.effort.high":"High","form.error.workspace":"\u8BF7\u9009\u62E9\u5DE5\u4F5C\u533A\u3002","modal.title":"\u65B0\u5EFA\u5B9A\u65F6\u4EFB\u52A1","modal.edit":"\u7F16\u8F91\u5B9A\u65F6\u4EFB\u52A1","modal.save":"\u4FDD\u5B58","header.eyebrow":"\u81EA\u4E3B\u7F16\u7801\u4EFB\u52A1","header.title":"\u81EA\u52A8\u5316","header.subtitle":"\u4E3A\u5F53\u524D\u5DE5\u4F5C\u533A\u5B89\u6392\u72EC\u7ACB\u3001\u53EF\u5BA1\u8BA1\u7684 Agent \u8FD0\u884C\u3002","header.create":"\u65B0\u5EFA\u81EA\u52A8\u5316","header.closeCreate":"\u6536\u8D77\u8868\u5355","scope.workspace":"\u5DE5\u4F5C\u533A","scope.folder":"\u5DE5\u4F5C\u76EE\u5F55","stats.total":"\u5168\u90E8","stats.active":"\u5DF2\u542F\u7528","stats.next":"\u4E0B\u6B21\u8FD0\u884C","stats.attention":"\u9700\u8981\u5173\u6CE8","stats.noneScheduled":"\u6682\u65E0\u8BA1\u5212","stats.noAttention":"\u4E00\u5207\u6B63\u5E38","section.automations":"\u5DE5\u4F5C\u533A\u81EA\u52A8\u5316","section.automationsHint":"\u6BCF\u6B21\u89E6\u53D1\u90FD\u4F1A\u521B\u5EFA\u4E00\u4E2A\u5168\u65B0\u7684 DSH Session\uFF0C\u5E76\u4FDD\u7559\u72EC\u7ACB\u5BA1\u8BA1\u8BB0\u5F55\u3002","section.runs":"\u6700\u8FD1\u8FD0\u884C","section.runsHint":"\u5F53\u524D\u5DE5\u4F5C\u533A\u6700\u8FD1\u7684\u6267\u884C\u72B6\u6001\u3002","section.refresh":"\u5237\u65B0","empty.title":"\u8BA9\u91CD\u590D\u7684\u7F16\u7801\u5DE5\u4F5C\u81EA\u52A8\u8FD0\u884C","empty.body":"\u8BBE\u7F6E\u4E00\u4E2A\u76EE\u6807\u660E\u786E\u7684\u4EFB\u52A1\u3001\u8FD0\u884C\u65F6\u95F4\u548C\u6743\u9650\u8FB9\u754C\u3002\u6BCF\u6B21\u8FD0\u884C\u90FD\u4ECE\u5168\u65B0 Session \u5F00\u59CB\u3002","empty.action":"\u521B\u5EFA\u7B2C\u4E00\u4E2A\u81EA\u52A8\u5316","runs.empty":"\u8FD8\u6CA1\u6709\u8FD0\u884C\u8BB0\u5F55\u3002\u4F60\u53EF\u4EE5\u7ACB\u5373\u8FD0\u884C\u4E00\u6B21\uFF0C\u6216\u7B49\u5F85\u8BA1\u5212\u89E6\u53D1\u3002","overview.empty":"\u6682\u65E0\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u53EF\u5230\u8BBE\u7F6E\u9875\u521B\u5EFA\u3002","form.title":"\u521B\u5EFA\u81EA\u52A8\u5316","form.subtitle":"\u8BF7\u5199\u5B8C\u6574\u3001\u72EC\u7ACB\u7684\u4EFB\u52A1\u8BF4\u660E\uFF1A\u5B9A\u65F6\u8FD0\u884C\u4E0D\u4F1A\u7EE7\u627F\u5F53\u524D\u5BF9\u8BDD\u3002","form.name":"\u540D\u79F0","form.namePlaceholder":"\u6BCF\u65E5\u56DE\u5F52\u6D4B\u8BD5\u5206\u8BCA","form.prompt":"\u4EFB\u52A1\u6307\u4EE4","form.promptPlaceholder":"\u68C0\u67E5\u65B0\u589E\u6D4B\u8BD5\u5931\u8D25\uFF0C\u5B9A\u4F4D\u56DE\u5F52\u539F\u56E0\uFF0C\u5E76\u7ED9\u51FA\u7ECF\u8FC7\u9A8C\u8BC1\u7684\u6700\u5C0F\u4FEE\u590D\u65B9\u6848\u2026\u2026","form.schedule":"\u8FD0\u884C\u8BA1\u5212","form.planTime":"\u8BA1\u5212\u65F6\u95F4","form.hourly":"\u6BCF\u5C0F\u65F6","form.monthly":"\u6BCF\u6708","form.custom":"\u6BCF\u9694\u51E0\u5929","form.intervalHint":"\u4ECE\u73B0\u5728\u8D77\uFF0C\u6BCF\u9694\u8FD9\u4E48\u591A\u5206\u949F\u8FD0\u884C\u4E00\u6B21\u3002","form.customHint":"\u6BCF\u9694\u8FD9\u4E48\u591A\u5929\uFF0C\u5728\u6240\u9009\u65F6\u95F4\u8FD0\u884C\u4E00\u6B21\u3002","form.atTime":"\u4E8E","form.minutesShort":"\u5206","form.daysShort":"\u5929","form.monthDay":"\u6BCF\u6708\u7B2C {day} \u5929","form.skills":"\u6280\u80FD","form.skillsEmpty":"\u6682\u65E0\u53EF\u7528\u6280\u80FD","schedule.hourlyAt":"\u6BCF\u5C0F\u65F6 :{minute}","schedule.monthlyAt":"\u6BCF\u6708 {day} \u65E5 \xB7 {time}","schedule.customAt":"\u6BCF {count} \u5929 \xB7 {time}","form.once":"\u4E0D\u91CD\u590D","form.interval":"\u95F4\u9694","form.daily":"\u6BCF\u5929","form.weekly":"\u6BCF\u5468","form.runAt":"\u8FD0\u884C\u65F6\u95F4","form.every":"\u6BCF\u9694","form.minutes":"\u5206\u949F","form.time":"\u65F6\u95F4","form.days":"\u661F\u671F","form.timeZone":"\u65F6\u533A","form.maxConcurrentRuns":"\u5E76\u53D1\u6570\u91CF","form.maxConcurrentRunsHint":"\u540C\u4E00\u4EFB\u52A1\u7684\u6392\u961F\u53CA\u8FD0\u884C\u6B21\u6570\u5171\u7528\u6B64\u4E0A\u9650\uFF0C\u9ED8\u8BA4 1\uFF1B\u6EE1\u989D\u65F6\u8DF3\u8FC7\u5F53\u6B21\u5B9A\u65F6\u89E6\u53D1\uFF0C\u624B\u52A8\u8FD0\u884C\u5C06\u88AB\u62D2\u7EDD\u3002","form.error.maxConcurrentRuns":"\u5E76\u53D1\u6570\u91CF\u5FC5\u987B\u4E3A\u5927\u4E8E\u7B49\u4E8E 1 \u7684\u6574\u6570\u3002","form.permission":"\u6743\u9650\u8FB9\u754C","permission.readOnly":"\u53EA\u8BFB","permission.workspaceWrite":"\u5DE5\u4F5C\u533A\u5199\u5165","permission.fullAccess":"\u5B8C\u5168\u8BBF\u95EE","form.cancel":"\u53D6\u6D88","form.submit":"\u521B\u5EFA\u81EA\u52A8\u5316","form.submitting":"\u521B\u5EFA\u4E2D\u2026","form.error.name":"\u8BF7\u8F93\u5165\u540D\u79F0\u3002","form.error.prompt":"\u8BF7\u8F93\u5165\u5B8C\u6574\u3001\u72EC\u7ACB\u7684\u4EFB\u52A1\u6307\u4EE4\u3002","form.error.once":"\u8BF7\u9009\u62E9\u6709\u6548\u7684\u672A\u6765\u65E5\u671F\u548C\u65F6\u95F4\u3002","form.error.interval":"\u8FD0\u884C\u95F4\u9694\u5FC5\u987B\u5728 1 \u5230 43,200 \u5206\u949F\u4E4B\u95F4\u3002","form.error.weekdays":"\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u5929\u3002","day.1":"\u5468\u4E00","day.2":"\u5468\u4E8C","day.3":"\u5468\u4E09","day.4":"\u5468\u56DB","day.5":"\u5468\u4E94","day.6":"\u5468\u516D","day.7":"\u5468\u65E5","status.active":"\u5DF2\u542F\u7528","status.paused":"\u5DF2\u6682\u505C","status.queued":"\u6392\u961F\u4E2D","status.running":"\u8FD0\u884C\u4E2D","status.succeeded":"\u5DF2\u5B8C\u6210","status.failed":"\u5931\u8D25","status.skipped":"\u5DF2\u8DF3\u8FC7","status.cancelled":"\u5DF2\u53D6\u6D88","status.interrupted":"\u5DF2\u4E2D\u65AD","card.nextRun":"\u4E0B\u6B21","card.lastRun":"\u6700\u8FD1","card.never":"\u5C1A\u672A\u8FD0\u884C","schedule.onceAt":"\u5355\u6B21 \xB7 {time}","schedule.everyMinutes":"\u6BCF {count} \u5206\u949F","schedule.dailyAt":"\u6BCF\u5929 \xB7 {time}","schedule.weeklyAt":"{days} \xB7 {time}","card.pause":"\u6682\u505C","card.resume":"\u6062\u590D","card.runNow":"\u7ACB\u5373\u8FD0\u884C","card.more":"\u66F4\u591A\u64CD\u4F5C","card.delete":"\u5220\u9664","card.confirmDelete":"\u786E\u8BA4\u5220\u9664\u8FD9\u4E2A\u81EA\u52A8\u5316\uFF1F","card.confirmDeleteHint":"\u8FD0\u884C\u5386\u53F2\u4F1A\u4FDD\u7559\u7528\u4E8E\u5BA1\u8BA1\u3002","card.confirm":"\u786E\u8BA4\u5220\u9664","card.cancel":"\u53D6\u6D88","run.trigger.schedule":"\u5B9A\u65F6\u89E6\u53D1","run.trigger.manual":"\u624B\u52A8\u89E6\u53D1","run.openSession":"Session {id}","run.markRead":"\u6807\u8BB0\u5DF2\u5904\u7406",loading:"\u6B63\u5728\u52A0\u8F7D\u81EA\u52A8\u5316\u2026","error.title":"\u65E0\u6CD5\u52A0\u8F7D\u81EA\u52A8\u5316","error.retry":"\u91CD\u8BD5","error.action":"\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002","error.taskMissing":"\u8BE5\u5B9A\u65F6\u4EFB\u52A1\u5DF2\u4E0D\u5B58\u5728\u3002","error.offline":"\u65E0\u6CD5\u8FDE\u63A5\u672C\u673A\u81EA\u52A8\u5316\u670D\u52A1\uFF0C\u8BF7\u786E\u8BA4 DSH \u4ECD\u5728\u8FD0\u884C\u540E\u91CD\u8BD5\u3002","time.minutes":"{count}\u5206\u949F","time.hours":"{count}\u5C0F\u65F6","time.days":"{count}\u5929","time.months":"{count}\u4E2A\u6708","time.years":"{count}\u5E74","time.ago":"{text}\u524D","time.now":"\u521A\u521A","session.copy":"\u590D\u5236","session.copied":"\u5DF2\u590D\u5236","session.compactApproval":"\u5F85\u5BA1\u6279","session.compactPlan":"\u8BA1\u5212\u5F85\u5BA1","session.compactAnswer":"\u5F85\u56DE\u7B54","time.minuteAgo":"{count} \u5206\u949F\u524D","time.hourAgo":"{count} \u5C0F\u65F6\u524D","time.dayAgo":"{count} \u5929\u524D","time.inMinute":"{count} \u5206\u949F\u540E","time.inHour":"{count} \u5C0F\u65F6\u540E","time.inDay":"{count} \u5929\u540E"};var so="__dshNativeTabs";function oo(e){let n=new Map,t=[],s=new Set,r=[],i=()=>{r=[...n.values()].sort((a,c)=>(a.order??0)-(c.order??0))},o=()=>{for(let a of s)a()};return{version:1,officialTree:e,sessionFilters:t,getTabs(){return r},subscribe(a){return s.add(a),()=>{s.delete(a)}},insert(a){if(a.id==="")return()=>{};let c=n.get(a.id);return n.set(a.id,a),c!==a&&(i(),o()),()=>{n.get(a.id)===a&&(n.delete(a.id),i(),o())}},addSessionFilter(a){return t.push(a),o(),()=>{let c=t.indexOf(a);c>=0&&t.splice(c,1),o()}}}}function ro(e){if(e==null||typeof e!="object"&&typeof e!="function")return;let n=e[so];if(n==null||typeof n!="object")return;let t=n;return t.version===1&&typeof t.getTabs=="function"&&typeof t.subscribe=="function"&&typeof t.insert=="function"?n:void 0}function pt(e,n){try{e[so]=n}catch{}return n}function io(e){if(!(e==null||typeof e!="object"&&typeof e!="function"))return ro("component"in e?e.component:e)}function ao(e){if(e==null)return!1;let n=e;return n.__dshNativeTabHost===!0||n.__imConnectWrapped===!0?!0:ro(e)!==void 0}var Ur="@michengai/dsh-archive-manager";function mt(e){return e?.querySelector(`[data-plugin="${Ur}"]`)!=null}function $e(e){return typeof e=="function"?e:void 0}function Rn(e){let n=e??{},t=$e(n.renameSession),s=$e(n.archiveSession),r=$e(n.unarchiveSession),i=$e(n.deleteSession),o=$e(n.forkSession),a=$e(n.notifyArchivedNotOpenable);return{...t===void 0?{}:{renameSession:t},...s===void 0?{}:{archiveSession:s},...r===void 0?{}:{unarchiveSession:r},...i===void 0?{}:{deleteSession:i},...o===void 0?{}:{forkSession:o},...a===void 0?{}:{notifyArchivedNotOpenable:a}}}function lo(e,n){return e&&n!==void 0}function co(e){let n=["rename","fork"];return e.archived?e.canUnarchive&&n.push("unarchive"):n.push("archive"),e.canDelete&&n.push("delete-session"),n}function uo(e,n){return n!==null&&e.includes(n)}function po(e,n){return e&&!n}async function mo(e,n){for(let t of e)await n(t)}async function fo(e,n){for(let t of e)await n(t)}var L=require("react"),Co=require("react-dom"),V=require("@deepseek-ai/dsh-client-ui-primitives");function go(e,n,t,s){if(e===void 0)return null;try{return e(n,t,s)??null}catch(r){if(!$r(r))throw r;return null}}function $r(e){return typeof e!="object"||e===null?!1:"name"in e&&e.name==="SlotOwnershipError"?!0:(e instanceof Error?e.message:"").includes("not declared by this entry")}function yo(e,n,t){let r=e.right+8,i=e.top+n.height>t.height-8?Math.max(8,t.height-n.height-8):Math.max(8,e.top);return{position:"fixed",zIndex:4100,left:`${Math.round(r)}px`,top:`${Math.round(i)}px`}}function vo(e,n){let t=e.runningSubagentCount??0,s=t===0?void 0:{state:"ongoing",label:n("session.subagentsRunning",{count:t})},r;e.pendingKind==="approval"?r={state:"warning",label:n("session.waitingApproval"),trailing:n("session.compactApproval")}:e.pendingKind==="plan-review"?r={state:"warning",label:n("session.planReview"),trailing:n("session.compactPlan")}:e.pendingKind==="question"&&(r={state:"warning",label:n("session.waitingAnswer"),trailing:n("session.compactAnswer")});let i;r!==void 0?i=s===void 0?[r]:[r,s]:e.running?i=s===void 0?[{state:"ongoing",label:n("session.runningStatus")}]:[{state:"ongoing",label:n("session.runningStatus")},s]:s!==void 0?i=[s]:e.completed===!0?i=[{state:"done",label:n("session.completed")}]:i=[{state:"idle",label:n("session.idle")}];let o=i.filter(a=>!(e.archived&&(a.state==="done"||a.state==="idle")));return e.archived&&o.push({state:"archived",label:n("session.archived")}),o}function bo(e,n){let t=Date.parse(e||"");if(!Number.isFinite(t))return;let s=6e4,r=36e5,i=864e5,o=Math.max(0,n-t);return o<s?{unit:"now",count:0}:o<r?{unit:"minutes",count:Math.floor(o/s)}:o<i?{unit:"hours",count:Math.floor(o/r)}:o<30*i?{unit:"days",count:Math.floor(o/i)}:o<365*i?{unit:"months",count:Math.floor(o/(30*i))}:{unit:"years",count:Math.floor(o/(365*i))}}function wo(e,n){return e.unit==="now"?n("time.now"):e.unit==="minutes"?n("time.minutes",{count:e.count}):e.unit==="hours"?n("time.hours",{count:e.count}):e.unit==="days"?n("time.days",{count:e.count}):e.unit==="months"?n("time.months",{count:e.count}):n("time.years",{count:e.count})}function ho(e,n,t){e.scrollLeft=n,n>0?e.dataset.scrolled="":delete e.dataset.scrolled,n<t?e.dataset.clipped="":delete e.dataset.clipped}function Kr(e){e.scrollLeft=0,delete e.dataset.scrolled,delete e.dataset.clipped}function xo(e,n){if(e===null)return;let t=e.scrollWidth-e.clientWidth;if(t<=8)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){ho(e,t,t);return}cancelAnimationFrame(n.id);let s,r=0,i=o=>{r+=s===void 0?0:(o-s)*.03,s=o,ho(e,Math.min(r,t),t),r<t&&(n.id=requestAnimationFrame(i))};n.id=requestAnimationFrame(i)}function ft(e,n){cancelAnimationFrame(n.id),e!==null&&Kr(e)}function So(e,n,t=Date.now()){let s=bo(e,t);return s===void 0?"":wo(s,n)}function ko(e,n,t=Date.now()){let s=bo(e,t);return s===void 0?"":s.unit==="now"?n("time.now"):n("time.ago",{text:wo(s,n)})}var Ee=require("react");var Mn=require("@deepseek-ai/dsh-client-ui-primitives");var z=require("react/jsx-runtime"),Ke="dsh-st-rail-panel",En=typeof window>"u"?void 0:window.localStorage;function Ln({t:e,view:n,onChange:t}){return(0,z.jsx)(Mn.SegmentedTabs,{className:"dsh-st-rail-views",label:e("sidebar.views"),value:n,items:[{value:"runs",id:"dsh-st-rail-view-runs",panelId:Ke,label:(0,z.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:5},children:[(0,z.jsx)(Ge,{size:14}),(0,z.jsx)("span",{children:e("sidebar.runsTab")})]})},{value:"overview",id:"dsh-st-rail-view-overview",panelId:Ke,label:(0,z.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:5},children:[(0,z.jsx)(kn,{size:14}),(0,z.jsx)("span",{children:e("sidebar.overviewTab")})]})}],onChange:t})}function Pn({t:e,automations:n,serverNow:t,openTaskSettings:s,onToggleAutomation:r}){let[i,o]=(0,Ee.useState)(()=>Ce(En,hn)?.key??"planned"),[a,c]=(0,Ee.useState)(()=>Ce(En,hn)?.direction??"asc"),[l,h]=(0,Ee.useState)(()=>new Set),m=(0,Ee.useMemo)(()=>new Date(t??Date.now()),[t]),k=(0,Ee.useMemo)(()=>{let p=mn(n,i,a);return jt(p)},[n,a,i]),A=(0,Ee.useMemo)(()=>new Map(n.map(p=>[p.id,un(p.schedule,e)])),[n,e]),f=(p,u)=>{r===void 0||l.has(p)||(h(g=>new Set(g).add(p)),Promise.resolve(r(p,u)).catch(g=>{console.warn("[dsh-automation] \u5207\u6362\u4EFB\u52A1\u72B6\u6001\u5931\u8D25",g)}).finally(()=>{h(g=>{let v=new Set(g);return v.delete(p),v})}))};return(0,z.jsxs)("div",{className:"dsh-st-overview",children:[(0,z.jsxs)("div",{className:"dsh-st-overview-head",children:[(0,z.jsxs)("div",{className:"dsh-st-overview-title",children:[(0,z.jsx)("strong",{children:e("sidebar.viewOverview")}),(0,z.jsx)("span",{"aria-label":`${k.length}`,children:k.length})]}),(0,z.jsx)(In,{t:e,iconOnly:!0,className:"dsh-st-overview-sort",...En===void 0?{}:{storage:En},storageKey:hn,sortKey:i,sortDirection:a,onSelect:(p,u)=>{o(p),c(u)}})]}),k.length===0?(0,z.jsx)("div",{className:"dsh-st-rail-empty",children:e("overview.empty")}):k.map(p=>(0,z.jsx)(jr,{t:e,row:p,now:m,scheduleSummary:A.get(p.id)??"",toggleDisabled:r===void 0||l.has(p.id),onToggleAutomation:f,...s===void 0?{}:{openTaskSettings:s}},p.id))]})}function jr({t:e,row:n,now:t,scheduleSummary:s,openTaskSettings:r,toggleDisabled:i,onToggleAutomation:o}){let a=n.status!=="active",c=n.nextRunAt===void 0?e("stats.noneScheduled"):pn(n.nextRunAt,t,e),l=n.nextRunAt===void 0?e("stats.noneScheduled"):Mt(n.nextRunAt,t,e),h=`${e("stats.next")}: ${c}`,m=e(a?"card.resume":"card.pause");return(0,z.jsxs)("div",{className:`dsh-st-overview-row${a?" is-paused":""}`,children:[(0,z.jsxs)("button",{type:"button",className:"dsh-st-overview-open",disabled:r===void 0,onClick:()=>{r?.({automationId:n.id,name:n.name,sessionIds:[]})},children:[(0,z.jsxs)("span",{className:"dsh-st-overview-copy",children:[(0,z.jsx)("span",{className:"dsh-st-overview-name",children:n.name}),s!==""&&(0,z.jsxs)("span",{className:"dsh-st-overview-schedule",children:[(0,z.jsx)(gs,{width:14,height:14}),(0,z.jsx)("span",{children:s})]})]}),(0,z.jsx)("span",{className:"dsh-st-overview-next",title:h,"aria-label":h,children:(0,z.jsx)("strong",{children:l})})]}),(0,z.jsx)("span",{className:"dsh-st-overview-toggle",title:m,children:(0,z.jsx)(Mn.Switch,{checked:!a,disabled:i,label:m,onChange:()=>{o?.(n.id,vn(n.status))}})})]})}var De=require("react"),je=require("@deepseek-ai/dsh-client-ui-primitives");function To(e){return e?11:14}var q=require("react/jsx-runtime");function Ao({t:e,query:n,sort:t,groupMode:s,archivedFilter:r="default",onQueryChange:i,onSortChange:o,onGroupModeChange:a,onArchivedFilterChange:c}){let[l,h]=(0,De.useState)(n.trim()!==""),[m,k]=(0,De.useState)(!1),A=(0,De.useRef)(null),f=To(l);(0,De.useEffect)(()=>{l&&A.current?.focus()},[l]);let p=()=>{k(!1),h(!0)},u=()=>{i(""),h(!1)},g=[{type:"label",id:"group-by",text:e("sidebar.groupBy")},{id:"workspace",label:e("sidebar.groupWorkspace"),icon:(0,q.jsx)(ze,{})},{id:"workspace-tree",label:e("sidebar.groupWorkspaceTree"),icon:(0,q.jsx)(kn,{})},{id:"flat",label:e("sidebar.groupList"),icon:(0,q.jsx)(Ge,{})},{type:"separator",id:"order-by-separator"},{type:"label",id:"order-by",text:e("sidebar.sortBy")},{id:"updated",label:e("sidebar.sortTime"),icon:(0,q.jsx)(Ie,{})},...c!==void 0?[{type:"separator",id:"archived-filter-separator"},{type:"label",id:"filter-by",text:e("sidebar.filterBy")},{id:"hide-archived",label:e("sidebar.hideArchived"),icon:(0,q.jsx)(Rs,{})},{id:"show-archived",label:e("sidebar.showArchived"),icon:(0,q.jsx)(We,{})},{id:"only-archived",label:e("sidebar.onlyArchived"),icon:(0,q.jsx)(Es,{})}]:[]],v=[s==="list"?"flat":s,"updated",r==="show"?"show-archived":r==="only"?"only-archived":"hide-archived"];return(0,q.jsxs)("div",{className:l?"dsh-st-n-toolbar is-search":"dsh-st-n-toolbar",children:[(0,q.jsx)("span",{className:"dsh-st-n-head-label",children:e(s==="list"?"sidebar.sessions":"sidebar.workspaces")}),(0,q.jsx)("div",{className:"dsh-st-n-search-slot",children:(0,q.jsxs)("div",{className:"dsh-st-n-search",onClick:p,children:[(0,q.jsx)(je.Tooltip,{label:e("sidebar.search"),side:"bottom",delayMs:500,disabled:l,children:(0,q.jsx)("button",{type:"button",className:"dsh-st-n-search-btn","aria-label":e("sidebar.search"),"aria-expanded":l,onClick:p,children:(0,q.jsx)(Ts,{size:f})})}),(0,q.jsx)("input",{ref:A,className:"dsh-st-n-search-input",value:n,placeholder:e("sidebar.searchSessions"),"aria-label":e("sidebar.searchSessions"),tabIndex:l?0:-1,"aria-hidden":!l,onChange:S=>i(S.target.value),onKeyDown:S=>{S.key==="Escape"&&u()}}),l&&(0,q.jsx)(je.Tooltip,{label:e("sidebar.clearSearch"),side:"bottom",delayMs:500,children:(0,q.jsx)("button",{type:"button",className:"dsh-st-n-search-clear","aria-label":e("sidebar.clearSearch"),onClick:S=>{S.stopPropagation(),u()},children:(0,q.jsx)(As,{size:14})})})]})}),(0,q.jsx)("div",{className:"dsh-st-n-head-acts",children:(0,q.jsx)(je.Menu,{open:m,onClose:()=>{k(!1)},items:g,selectedIds:v,align:"end",dense:!0,portal:!0,onSelect:S=>{(S==="workspace"||S==="workspace-tree")&&a(S),S==="flat"&&a("list"),S==="updated"&&o("time"),S==="hide-archived"&&c?.("default"),S==="show-archived"&&c?.("show"),S==="only-archived"&&c?.("only"),k(!1)},anchor:(0,q.jsx)(je.Tooltip,{label:e("sidebar.filter"),side:"bottom",delayMs:500,disabled:m,children:(0,q.jsx)("button",{type:"button",className:m?"dsh-st-n-head-btn is-on":"dsh-st-n-head-btn","aria-label":e("sidebar.filter"),"aria-expanded":m,onClick:()=>k(S=>!S),children:(0,q.jsx)(Sn,{size:16})})})})})]})}var y=require("react/jsx-runtime"),Io={},No=[];function Dn(e){let{t:n,runtime:t,openSession:s,useSessions:r,useWorkspaces:i,renameSession:o,archiveSession:a,unarchiveSession:c,deleteSession:l,forkSession:h,notifyArchivedNotOpenable:m,openTaskSettings:k,renderSlot:A,useSessionStatus:f}=e,p=(0,L.useSyncExternalStore)(t.source.subscribe,t.source.getSnapshot,t.source.getSnapshot),u=r?r(N=>Xe(N)):null,g=r?r(N=>N.byId??Io):Io,v=i?i(N=>N.archivedSessionIds??[]):[],S=i?i(N=>N.items??No):No,C=f?f(N=>N):void 0,P=r?r(N=>N.projectionsBySession):void 0,[_,oe]=(0,L.useState)({}),[U,G]=(0,L.useState)(),[$,O]=(0,L.useState)(),[K,B]=(0,L.useState)(),[J,re]=(0,L.useState)(!1),[ee,ne]=(0,L.useState)(),[x,H]=(0,L.useState)(),[E,ae]=(0,L.useState)(!1),[de,ce]=(0,L.useState)(),[ie,fe]=(0,L.useState)(),[Se,ge]=(0,L.useState)(!1),[Z,te]=(0,L.useState)(),[ye,we]=(0,L.useState)(()=>typeof document<"u"&&mt(document)),[T,d]=(0,L.useState)("default"),[I,W]=(0,L.useState)(""),[Ne,$o]=(0,L.useState)("time"),[ke,Ko]=(0,L.useState)("workspace"),[wt,jo]=(0,L.useState)("runs"),Vn=(0,L.useRef)(null),Me=(0,L.useMemo)(()=>new Set(v),[v]),Bn=(0,L.useMemo)(()=>{let N=p.snapshot;if(N===void 0)return[];let j=new Map(N.automations.map(ve=>[ve.id,ve.timeZone]));return yn(N.automations,N.runs).map(ve=>({...ve,sessions:ve.sessions.filter(Te=>qt(Te.id,Me,T)).map(Te=>{let Ae=N.runs.find(sn=>sn.sessionId===Te.id);return{...Te,title:Ze(Ae&&(Ae.startedAt||Ae.scheduledFor)||"",j.get(ve.id)),updatedAt:Ae&&(Ae.startedAt||Ae.scheduledFor)||"",running:Te.running||g[Te.id]?.running===!0}})})).filter(ve=>ve.sessions.length>0)},[Me,T,g,p.snapshot]);(0,L.useEffect)(()=>{if(!bn(u,p.snapshot?.runs)){Vn.current=null;return}Vn.current!==u&&(Vn.current=u,t.refresh().catch(()=>{}))},[t,u,p.snapshot?.runs]);let Un=(0,L.useMemo)(()=>{let N=ke==="workspace-tree"?ms(Bn.flatMap(j=>j.sessions.map(ve=>({...ve,automationId:j.id}))),S,n("sidebar.ungrouped")):Bn;return fs(N.map(j=>({...j,name:j.name})),I,Ne,ke)},[ke,Bn,I,Ne,n,S]);(0,L.useEffect)(()=>{if(typeof document>"u"||typeof MutationObserver>"u")return;let N=()=>{we(mt(document))};N();let j=new MutationObserver(N);return j.observe(document.documentElement,{childList:!0,subtree:!0}),()=>{j.disconnect()}},[]);let qo=ye&&a!==void 0,Zo=lo(ye,l),xt=c!==void 0,Xo=()=>{if(K===void 0||a===void 0||J)return;let N=K;re(!0),ne(void 0),mo(N.sessionIds,a).then(()=>{B(void 0)}).catch(j=>{ne(j instanceof Error?j.message:n("error.action"))}).finally(()=>{re(!1)})},Jo=()=>{if(x===void 0||c===void 0||E)return;let N=x;ae(!0),ce(void 0),fo(N.sessionIds,c).then(()=>{H(void 0)}).catch(j=>{ce(j instanceof Error?j.message:n("error.action"))}).finally(()=>{ae(!1)})},Yo=()=>{if(ie===void 0||l===void 0||Se)return;let N=ie;ge(!0),te(void 0),Promise.resolve(l(N.id)).then(()=>{fe(void 0)}).catch(j=>{te(j instanceof Error?j.message:n("error.action"))}).finally(()=>{ge(!1)})};return(0,y.jsxs)("div",{className:"dsh-st-n",children:[(0,y.jsx)("div",{className:"dsh-st-n-views-wrap",children:(0,y.jsx)(Ln,{t:n,view:wt,onChange:jo})}),(0,y.jsx)("div",{id:Ke,role:"tabpanel",className:"dsh-st-n-view-body",children:wt==="overview"?p.snapshot===void 0?(0,y.jsx)("div",{className:"dsh-st-n-empty",children:p.phase==="loading"?n("loading"):n("overview.empty")}):(0,y.jsx)(Pn,{t:n,automations:p.snapshot.automations,onToggleAutomation:(N,j)=>t.mutateAutomation(N,j),...k===void 0?{}:{openTaskSettings:k},...p.snapshot.serverNow===void 0?{}:{serverNow:p.snapshot.serverNow}}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Ao,{t:n,query:I,sort:Ne,groupMode:ke,archivedFilter:T,onQueryChange:W,onSortChange:$o,onGroupModeChange:Ko,onArchivedFilterChange:d}),(0,y.jsx)("div",{className:"dsh-st-n-list-area",children:(0,y.jsxs)("div",{className:"dsh-st-n-tree",role:"tree",children:[p.phase==="loading"&&Un.length===0&&(0,y.jsx)("div",{className:"dsh-st-n-empty",children:n("loading")}),Un.length===0&&p.phase!=="loading"&&(0,y.jsx)("div",{className:"dsh-st-n-empty",children:n("sidebar.empty")}),Un.map(N=>{let j=_[N.id]!==!0,ve=uo(N.sessions.map(R=>R.id),u),Te="depth"in N?N.depth:0,Ae=[...new Set(N.sessions.flatMap(R=>"automationId"in R&&typeof R.automationId=="string"?[R.automationId]:[]))],sn=ke==="workspace-tree"&&Ae.length===1?p.snapshot?.automations.find(R=>R.id===Ae[0]):void 0,$n=ke==="workspace-tree"?sn?.id:N.id,Qo=ke==="workspace-tree"?sn?.name:N.name,St=N.sessions.filter(R=>!Me.has(R.id)).map(R=>R.id),kt=N.sessions.filter(R=>Me.has(R.id)).map(R=>R.id),er=qo&&St.length>0,nr=xt&&kt.length>0;return(0,y.jsxs)("div",{className:"dsh-st-n-group",style:Te>0?{"--dsh-workspace-indent":`${Te*12}px`}:void 0,children:[ke!=="list"&&(0,y.jsx)(qr,{t:n,id:N.id,name:N.name,sessionIds:N.sessions.map(R=>R.id),expanded:j,hasCurrentSession:ve,menuOpen:$===N.id,canArchiveGroup:er,canUnarchiveGroup:nr,showTaskSettings:$n!==void 0,onToggle:()=>oe(R=>({...R,[N.id]:j})),onMenuChange:R=>{G(void 0),O(R?N.id:void 0)},onTaskSettings:()=>{$n!==void 0&&k?.({automationId:$n,name:Qo??N.name,sessionIds:N.sessions.map(R=>R.id)})},onArchiveGroup:()=>{ne(void 0),B({id:N.id,name:N.name,sessionIds:St})},onUnarchiveGroup:()=>{ce(void 0),H({id:N.id,name:N.name,sessionIds:kt})}}),(ke==="list"||j)&&N.sessions.map(R=>(0,y.jsx)(Zr,{t:n,flat:ke==="list",id:R.id,title:R.title,hoverTitle:String(g[R.id]?.displayTitle??g[R.id]?.title??N.name),updatedAt:R.updatedAt,running:R.running,archived:Me.has(R.id),selected:u===R.id,menuOpen:U===R.id,canDelete:Zo,canUnarchive:xt,hoverStatuses:vo({running:R.running||C?.get(R.id)?.running===!0,archived:Me.has(R.id),completed:C?.get(R.id)?.completionUnread===!0,...C?.get(R.id)?.pendingInteraction?.kind===void 0?{}:{pendingKind:C.get(R.id)?.pendingInteraction?.kind??""},runningSubagentCount:(P?.[R.id]?.values?.subagentCatalog??[]).filter(on=>on.id!==void 0&&C?.get(on.id)?.running===!0).length},n),...A===void 0?{}:{renderSlot:A},onMenuChange:on=>{O(void 0),G(on?R.id:void 0)},onOpen:()=>{if(G(void 0),Me.has(R.id)){m?.();return}s?.(R.id)},onDeleteSession:()=>{te(void 0),fe({id:R.id,title:String(g[R.id]?.displayTitle??g[R.id]?.title??R.title)})},...o===void 0?{}:{renameSession:o},...a===void 0?{}:{archiveSession:a},...c===void 0?{}:{unarchiveSession:c},...h===void 0?{}:{forkSession:h}},R.id))]},N.id===""?"ungrouped":N.id)})]})})]})}),(0,y.jsx)(V.Modal,{open:K!==void 0,onClose:()=>{J||(B(void 0),ne(void 0))},closeLabel:n("session.archiveGroupClose"),title:n("session.archiveGroup"),...K===void 0?{}:{description:n("session.archiveGroupDescription",{name:K.name,count:K.sessionIds.length})},footer:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(V.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:J,onClick:()=>{B(void 0),ne(void 0)},children:n("session.archiveGroupCancel")}),(0,y.jsx)(V.Button,{variant:"outline",className:"dsh-st-modal-action dsh-st-btn-danger",disabled:J,onClick:Xo,children:n("session.archiveGroupConfirm")})]}),children:J||ee!==void 0?(0,y.jsxs)(y.Fragment,{children:[J&&(0,y.jsx)("div",{className:"dsh-st-n-dialog-status",role:"status",children:n("session.archiveGroupPending")}),ee!==void 0&&(0,y.jsx)("div",{className:"dsh-st-n-dialog-error",role:"alert",children:n("session.archiveGroupFailed",{message:ee})})]}):void 0}),(0,y.jsx)(V.Modal,{open:x!==void 0,onClose:()=>{E||(H(void 0),ce(void 0))},closeLabel:n("session.unarchiveGroupClose"),title:n("session.unarchiveGroup"),...x===void 0?{}:{description:n("session.unarchiveGroupDescription",{name:x.name,count:x.sessionIds.length})},footer:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(V.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:E,onClick:()=>{H(void 0),ce(void 0)},children:n("session.unarchiveGroupCancel")}),(0,y.jsx)(V.Button,{variant:"primary",className:"dsh-st-modal-action",disabled:E,onClick:Jo,children:n("session.unarchiveGroupConfirm")})]}),children:E||de!==void 0?(0,y.jsxs)(y.Fragment,{children:[E&&(0,y.jsx)("div",{className:"dsh-st-n-dialog-status",role:"status",children:n("session.unarchiveGroupPending")}),de!==void 0&&(0,y.jsx)("div",{className:"dsh-st-n-dialog-error",role:"alert",children:n("session.unarchiveGroupFailed",{message:de})})]}):void 0}),(0,y.jsx)(V.Modal,{open:ie!==void 0,onClose:()=>{Se||(fe(void 0),te(void 0))},closeLabel:n("session.deleteSessionClose"),title:n("session.deleteSession"),...ie===void 0?{}:{description:n("session.deleteSessionDescription",{name:ie.title})},footer:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(V.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:Se,onClick:()=>{fe(void 0),te(void 0)},children:n("session.deleteSessionCancel")}),(0,y.jsx)(V.Button,{variant:"outline",className:"dsh-st-modal-action dsh-st-btn-danger",disabled:Se,onClick:Yo,children:n("session.deleteSessionConfirm")})]}),children:Se||Z!==void 0?(0,y.jsxs)(y.Fragment,{children:[Se&&(0,y.jsx)("div",{className:"dsh-st-n-dialog-status",role:"status",children:n("session.deleteSessionPending")}),Z!==void 0&&(0,y.jsx)("div",{className:"dsh-st-n-dialog-error",role:"alert",children:n("session.deleteSessionFailed",{message:Z})})]}):void 0})]})}function qr(e){let{t:n,id:t,name:s,expanded:r,hasCurrentSession:i,menuOpen:o,canArchiveGroup:a,canUnarchiveGroup:c,showTaskSettings:l,onToggle:h,onMenuChange:m,onTaskSettings:k,onArchiveGroup:A,onUnarchiveGroup:f}=e,p=[...l?[{id:"task-settings",label:n("session.taskSettings"),icon:(0,y.jsx)(xs,{size:16})}]:[],...a?[...l?[{type:"separator",id:"archive-separator"}]:[],{id:"archive-group",label:n("session.archiveGroup"),icon:(0,y.jsx)(We,{size:16}),danger:!0}]:[],...c?[...l&&!a?[{type:"separator",id:"unarchive-separator"}]:[],{id:"unarchive-group",label:n("session.unarchiveGroup"),icon:(0,y.jsx)(et,{size:16})}]:[]],u="dsh-st-n-row"+(i?" has-current-session":"")+(o?" is-menu":"");return(0,y.jsxs)("div",{className:u,role:"treeitem","aria-expanded":r,"data-n-group":t,onClick:h,children:[(0,y.jsx)("span",{className:"dsh-st-n-slot dsh-st-n-folder",children:r?(0,y.jsx)(Is,{size:16}):(0,y.jsx)(ze,{size:16})}),(0,y.jsx)("span",{className:"dsh-st-n-slot dsh-st-n-chevron",children:(0,y.jsx)(Ns,{size:14,className:"dsh-st-n-arrow"+(r?" is-open":"")})}),(0,y.jsx)("span",{className:"dsh-st-n-project-text",children:(0,y.jsx)("span",{className:"dsh-st-n-title",children:s})}),(0,y.jsx)("span",{className:"dsh-st-n-acts",children:(0,y.jsx)(V.Menu,{open:o,onClose:()=>{m(!1)},items:p,onSelect:g=>{m(!1),g==="task-settings"&&k(),g==="archive-group"&&A(),g==="unarchive-group"&&f?.()},portal:!0,closeOnPointerLeave:!0,anchor:(0,y.jsx)(V.Tooltip,{label:n("session.groupActions",{name:s}),side:"bottom",delayMs:500,portal:!0,children:(0,y.jsx)("button",{type:"button",className:"dsh-st-n-ico","aria-label":n("session.groupActions",{name:s}),onMouseDown:g=>{g.stopPropagation()},onClick:g=>{g.stopPropagation(),m(!o)},children:(0,y.jsx)(Ye,{size:16})})})})})]})}function Zr(e){let{t:n,flat:t,id:s,title:r,hoverTitle:i,updatedAt:o,running:a,archived:c,selected:l,menuOpen:h,canDelete:m,canUnarchive:k,hoverStatuses:A,renderSlot:f,onMenuChange:p,onOpen:u,onDeleteSession:g,renameSession:v,archiveSession:S,unarchiveSession:C,forkSession:P}=e,_=po(t,a),oe=(0,L.useRef)(null),U=(0,L.useRef)(null),[G,$]=(0,L.useState)(!1),[O,K]=(0,L.useState)({}),B=(0,L.useRef)(void 0),J=(0,L.useRef)(null),re=(0,L.useRef)({id:0});(0,L.useEffect)(()=>()=>{ft(J.current,re.current)},[]);let[ee,ne]=(0,L.useState)(!1),[x,H]=(0,L.useState)(r);(0,L.useEffect)(()=>{H(r)},[r]),(0,L.useEffect)(()=>{if(typeof V.HoverCard=="function"||!G||h)return;let d=()=>{let I=oe.current?.getBoundingClientRect(),W=U.current;if(I===void 0)return;let Ne=W===null?{width:220,height:96}:{width:W.offsetWidth,height:W.offsetHeight};K(yo({right:I.right,top:I.top},Ne,{width:window.innerWidth,height:window.innerHeight}))};return d(),window.addEventListener("resize",d),document.addEventListener("scroll",d,!0),()=>{window.removeEventListener("resize",d),document.removeEventListener("scroll",d,!0)}},[G,h,r,o,a]),(0,L.useEffect)(()=>()=>{B.current!==void 0&&window.clearTimeout(B.current)},[]);let E=d=>{Promise.resolve(d()).catch(()=>{})},ae=()=>{typeof V.HoverCard=="function"||h||(B.current!==void 0&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>$(!0),500))},de=()=>{B.current!==void 0&&window.clearTimeout(B.current),$(!1)},ce="dsh-st-n-sess"+(l?" is-on":"")+(h?" is-menu":"")+(_?" is-flat-idle":"")+(c?" is-archived":"");if(ee)return(0,y.jsx)("div",{className:ce,ref:oe,children:(0,y.jsx)("input",{className:"dsh-st-n-rename",value:x,autoFocus:!0,"aria-label":n("session.rename"),onChange:d=>H(d.target.value),onClick:d=>d.stopPropagation(),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),ne(!1),x.trim()!==""&&x.trim()!==r&&E(()=>v?.(s,x.trim()))),d.key==="Escape"&&(d.preventDefault(),ne(!1),H(r))},onBlur:()=>{ne(!1),x.trim()!==""&&x.trim()!==r&&E(()=>v?.(s,x.trim()))}})});let ie=(i??r).trim()||r,fe=f!==void 0?["pin","rename","fork","archive","session-id","archive-manager.delete-session"].map(d=>f("sidebar.workspaces.session.menu.item",{sessionId:s,displayTitle:ie},{hookContext:[h,I=>p(I)],only:d})).filter(Boolean):void 0,ge=fe!==void 0&&fe.some(Boolean)?c&&m?[{id:"delete-session",label:n("session.deleteSession"),icon:(0,y.jsx)(Qn,{}),danger:!0}]:[]:[...co({canDelete:m,archived:c,canUnarchive:k}).map(d=>d==="rename"?{id:d,label:n("session.rename"),icon:(0,y.jsx)(ks,{})}:d==="fork"?{id:d,label:n("session.fork"),icon:(0,y.jsx)(Ss,{})}:d==="archive"?{id:d,label:n("session.archive"),icon:(0,y.jsx)(We,{size:16})}:d==="unarchive"?{id:d,label:n("session.unarchive"),icon:(0,y.jsx)(et,{size:16})}:{id:d,label:n("session.deleteSession"),icon:(0,y.jsx)(Qn,{}),danger:!0}),{id:"session-id",label:n("session.copySessionId"),icon:(0,y.jsx)(Cs,{size:16})}],Z=A.find(d=>d.state!=="archived"),te=!c&&Z!==void 0&&Z.state!=="idle",ye=Z?.trailing,we=(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"dsh-st-n-hover-title",children:ie}),(0,y.jsx)("div",{className:"dsh-st-n-hover-time",children:ko(o,n)}),A.map(d=>(0,y.jsxs)("div",{className:"dsh-st-n-hover-state",children:[d.state==="archived"?(0,y.jsx)(We,{size:14}):(0,y.jsx)(V.StateDot,{state:d.state==="ongoing"?"ongoing":d.state==="warning"?"warning":d.state==="done"?"done":"idle",size:10}),d.label]},d.label))]}),T=(0,y.jsxs)("div",{className:ce,ref:oe,role:"treeitem",tabIndex:0,"aria-selected":l,"data-n-menu-root":s,onClick:u,onMouseEnter:()=>{xo(J.current,re.current),ae()},onMouseLeave:()=>{ft(J.current,re.current),de()},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),u())},onContextMenu:d=>{d.preventDefault(),d.stopPropagation(),de(),p(!0)},children:[!_&&(0,y.jsx)("span",{className:"dsh-st-n-slot",children:te&&Z!==void 0?(0,y.jsx)(V.StateDot,{state:Z.state==="ongoing"?"ongoing":Z.state==="warning"?"warning":"done",size:10}):a?(0,y.jsx)(V.StateDot,{state:"ongoing",size:10}):null}),(0,y.jsx)("span",{ref:J,className:"dsh-st-n-title",onDoubleClick:d=>{v!==void 0&&(d.stopPropagation(),ne(!0))},children:r}),(0,y.jsx)("span",{className:"dsh-st-n-time","aria-hidden":ye===void 0?void 0:!0,children:ye??So(o,n)}),(0,y.jsxs)("span",{className:"dsh-st-n-acts",children:[fe===void 0&&c&&k&&(0,y.jsx)("button",{type:"button",className:"dsh-st-n-restore",onMouseDown:d=>{d.stopPropagation()},onClick:d=>{d.stopPropagation(),E(()=>C?.(s))},children:n("session.unarchive")}),(0,y.jsx)(V.Menu,{open:h,onClose:()=>{p(!1)},items:ge,onSelect:d=>{p(!1),d==="rename"&&ne(!0),d==="fork"&&E(()=>P?.(s)),d==="archive"&&E(()=>S?.(s)),d==="unarchive"&&E(()=>C?.(s)),d==="session-id"&&navigator.clipboard?.writeText(s),d==="delete-session"&&g?.()},portal:!0,closeOnPointerLeave:!0,anchor:(0,y.jsx)(V.Tooltip,{label:n("session.moreActions",{title:r}),side:"bottom",delayMs:500,portal:!0,children:(0,y.jsx)("button",{type:"button",className:"dsh-st-n-ico","aria-label":n("session.moreActions",{title:r}),onMouseDown:d=>{d.stopPropagation()},onClick:d=>{d.stopPropagation(),de(),p(!h)},children:(0,y.jsx)(Ye,{size:16})})}),children:fe}),go(f,"sidebar.workspaces.session.row.action",{sessionId:s,displayTitle:ie},{only:"archive"})]}),typeof V.HoverCard!="function"&&G&&!h&&typeof document<"u"&&(0,Co.createPortal)((0,y.jsx)("div",{ref:U,className:"dsh-st-n-hover",style:O,onMouseEnter:ae,onMouseLeave:de,children:we}),document.body)]});return typeof V.HoverCard!="function"?T:(0,y.jsx)(V.HoverCard,{anchor:T,content:we,openDelayMs:800,disabled:h,copyText:ie,copyLabel:n("session.copy"),copiedLabel:n("session.copied")})}var F=require("react"),Hn=require("@deepseek-ai/dsh-client-ui-primitives");var M=require("react/jsx-runtime"),Ro=[],Xr=e=>()=>{},On="dsh-st-shell-panel",ht=class extends F.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(n){console.warn("[dsh-automation] official workspace tree crashed",n)}render(){return this.state.failed?this.props.fallback:this.props.children}};function Eo({t:e,runtime:n,openSession:t,openTaskSettings:s,view:r,showViewSwitch:i=!0}){let o=(0,F.useSyncExternalStore)(n.source.subscribe,n.source.getSnapshot,n.source.getSnapshot),[a,c]=(0,F.useState)({}),[l,h]=(0,F.useState)("runs"),m=r??l,k=o.snapshot,A=(0,F.useMemo)(()=>k===void 0?[]:yn(k.automations,k.runs),[k]);return(0,M.jsxs)("div",{className:"dsh-st-rail",children:[i&&(0,M.jsx)("div",{className:"dsh-st-n-views-wrap",children:(0,M.jsx)(Ln,{t:e,view:m,onChange:h})}),(0,M.jsx)("div",{id:Ke,role:"tabpanel",className:"dsh-st-rail-panel",children:m==="overview"?k===void 0?(0,M.jsx)("div",{className:"dsh-st-rail-empty",children:o.phase==="loading"?e("loading"):e("overview.empty")}):(0,M.jsx)(Pn,{t:e,automations:k.automations,onToggleAutomation:(f,p)=>n.mutateAutomation(f,p),...s===void 0?{}:{openTaskSettings:s},...k.serverNow===void 0?{}:{serverNow:k.serverNow}}):(0,M.jsxs)(M.Fragment,{children:[o.phase==="loading"&&A.length===0&&(0,M.jsx)("div",{className:"dsh-st-rail-empty",children:e("loading")}),A.length===0&&o.phase!=="loading"&&(0,M.jsx)("div",{className:"dsh-st-rail-empty",children:e("sidebar.empty")}),A.map(f=>(0,M.jsxs)("section",{className:"dsh-st-rail-group",children:[(0,M.jsxs)("button",{type:"button",className:"dsh-st-rail-head",onClick:()=>c(p=>({...p,[f.id]:!p[f.id]})),children:[(0,M.jsx)("span",{className:"dsh-st-rail-folder",children:(0,M.jsx)(Ie,{size:16})}),(0,M.jsx)("span",{className:"dsh-st-rail-title",children:f.name})]}),a[f.id]!==!0&&f.sessions.map(p=>(0,M.jsxs)("button",{type:"button",className:"dsh-st-rail-session",onClick:()=>t?.(p.id),children:[(0,M.jsx)("span",{children:p.label}),p.running&&(0,M.jsx)(Hn.StateDot,{state:"ongoing",size:10})]},p.id))]},f.id))]})})]})}function Mo({t:e,runtime:n,officialTree:t,hostProps:s,openSession:r,openTaskSettings:i,useSessions:o,useWorkspaces:a,renderSlot:c,tabRegistry:l,wide:h}){let m=t,[k,A]=(0,F.useState)(()=>{try{return Jt(window.localStorage.getItem(Jn))}catch{return"tasks"}}),f=(0,F.useSyncExternalStore)(l?.subscribe??Xr,()=>l?.getTabs()??Ro,()=>Ro),p=f.some(x=>x.id==="channels"),u=o?.(x=>Xe(x)),g=(0,F.useSyncExternalStore)(n.source.subscribe,n.source.getSnapshot,n.source.getSnapshot),v=(0,F.useMemo)(()=>Zt(g.snapshot?.runs),[g.snapshot]),S=(0,F.useRef)(null);(0,F.useEffect)(()=>{if(!bn(u,g.snapshot?.runs)){S.current=null;return}S.current!==u&&(S.current=u??null,n.refresh().catch(()=>{}))},[g.snapshot?.runs,u,n]);let C=(0,F.useCallback)((x,H)=>o===void 0?x({ids:[],byId:{}}):o(E=>x(os(E,v)),H),[o,v]),P=(0,F.useCallback)((x,H)=>a===void 0?x({items:[],archivedSessionIds:[]}):a(E=>x(ls(E,v)),H),[a,v]);(0,F.useEffect)(()=>{try{window.localStorage.setItem(Jn,k)}catch{}},[k]),(0,F.useEffect)(()=>{let x=H=>{let E=H.target instanceof Element?H.target.closest("button"):null;if(E===null)return;let ae=`${E.textContent??""} ${E.getAttribute("aria-label")??""}`;/新会话|新建任务|New chat|New session/i.test(ae)&&A("tasks")};return document.addEventListener("click",x,!0),()=>document.removeEventListener("click",x,!0)},[]);let _=(0,F.useRef)(u),oe=(0,F.useRef)(!1);(0,F.useEffect)(()=>{let x=ns(u??void 0,v);if(!oe.current){oe.current=!0,_.current=u,x==="tasks"&&A("tasks");return}let H=_.current;if(_.current=u,!Yt(H,u))return;let E=f.map(de=>de.id);x==="tasks"&&A("tasks"),x==="channels"&&(p||E.includes("channels"))&&A("channels");let ae=f.find(de=>u!=null&&de.matchSession?.(String(u))===!0);ae!==void 0&&ae.id!=="schedule"&&A(ae.id)},[u,p,f,v]);let U={...s??{},...h===void 0?{}:{wide:h}},G={...U,...o===void 0?{}:{useSessions:C},...a===void 0?{}:{useWorkspaces:P}},$=x=>m===void 0?(0,M.jsx)(Jr,{t:e,...r===void 0?{}:{openSession:r},...o===void 0?{}:{useSessions:C},...a===void 0?{}:{useWorkspaces:a}}):(0,M.jsx)(ht,{fallback:(0,F.createElement)(m,U),children:(0,F.createElement)(m,x)});if(h===!1)return(0,M.jsx)(M.Fragment,{children:$(G)});let O=(0,F.useMemo)(()=>f.filter(x=>x.id!=="schedule"),[f]),K=es({tab:k,channelsReady:p,extraTabIds:Qt({extraTabIds:O.map(x=>x.id),channelsReady:p})}),B=f.find(x=>x.id==="schedule"),J=B===void 0?(0,M.jsx)(Dn,{t:e,runtime:n,...r===void 0?{}:{openSession:r},...i===void 0?{}:{openTaskSettings:i},...o===void 0?{}:{useSessions:o},...a===void 0?{}:{useWorkspaces:a},...c===void 0?{}:{renderSlot:c},...Rn(s),...typeof s?.useSessionStatus=="function"?{useSessionStatus:s.useSessionStatus}:{}}):B.render({...s??{},openSession:r,open:r,useSessions:o,wide:!0}),re=(0,F.useMemo)(()=>{let x=[{value:"tasks",id:"dsh-st-tab-tasks",panelId:On,label:(0,M.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[(0,M.jsx)(ze,{size:14}),(0,M.jsx)("span",{children:e("sidebar.tasksTab")})]})}];for(let H of O){if(H.id==="tasks")continue;let E=H.id==="channels"?(0,M.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[(0,M.jsx)("svg",{viewBox:"0 0 16 16",width:14,height:14,fill:"none","aria-hidden":"true",children:(0,M.jsx)("path",{fill:"currentColor",d:"M2.15 2.9h11.7v8.2H6.42L2.15 13.85V2.9Zm1.4 1.4v6.62l1.78-1.12h7.12V4.3H3.55Z"})}),(0,M.jsx)("span",{children:H.label})]}):H.label;x.push({value:H.id,id:"dsh-st-tab-"+H.id,panelId:On,label:E})}return x.push({value:"schedule",id:"dsh-st-tab-schedule",panelId:On,label:(0,M.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[(0,M.jsx)(Ie,{size:14}),(0,M.jsx)("span",{children:e("sidebar.tab")})]})}),x},[p,O,e]),ee=K==="schedule"||K==="tasks"?void 0:O.find(x=>x.id===K),ne=ee!==void 0||K==="schedule"||K==="channels"?"dsh-st-shell-body":"dsh-st-official-tree";return(0,M.jsxs)("div",{className:"dsh-st-shell-rail",children:[(0,M.jsx)("div",{className:"dsh-st-shell-tabs-wrap",children:(0,M.jsx)(Hn.SegmentedTabs,{className:"dsh-st-shell-segmented-tabs",label:e("sidebar.tabs"),value:K,onChange:x=>A(x),items:re})}),(0,M.jsx)("div",{id:On,role:"tabpanel",className:ne,children:K==="schedule"?J:ee!==void 0?ee.render({...s??{},openSession:r,open:r,useSessions:o,wide:!0}):$(G)})]})}function Jr({t:e,openSession:n,useSessions:t,useWorkspaces:s}){let r=t===void 0?{ids:[],byId:{}}:t(c=>c??{ids:[],byId:{}}),i=s===void 0?void 0:s(c=>c??{items:[],archivedSessionIds:[]}),o=Xt(r,i,e("sidebar.ungrouped")),a=Xe(r);return o.length===0?(0,M.jsx)("div",{className:"dsh-st-rail-empty",children:e("sidebar.tasksEmpty")}):(0,M.jsx)("div",{className:"dsh-st-rail",children:o.map(c=>(0,M.jsxs)("section",{className:"dsh-st-rail-group",children:[(0,M.jsx)("div",{className:"dsh-st-rail-head is-static",children:(0,M.jsx)("span",{className:"dsh-st-rail-title",children:c.label})}),c.sessions.map(l=>(0,M.jsx)("button",{type:"button",className:`dsh-st-rail-session${a===l.id?" is-on":""}`,onClick:()=>{l.id!==void 0&&n?.(l.id)},children:(0,M.jsx)("span",{children:l.title||l.id})},l.id))]},c.id||"ungrouped"))})}var Lo="dsh-automation-styles",Fn="@michengai/dsh-automation",Po=`
4
- /* \u8BBE\u7F6E\u5BFC\u822A\u56FE\u6807\uFF1A\u9690\u85CF\u5BBF\u4E3B svg\uFF0C\u6539\u7528\u72EC\u7ACB mask \u5143\u7D20\uFF0C\u907F\u514D\u6539\u5199\u5BBF\u4E3B\u56FE\u6807\u5185\u5BB9\u3002 */
3
+ "use strict";var gr=Object.create;var We=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var br=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,vr=Object.prototype.hasOwnProperty;var kr=(e,t)=>{for(var n in t)We(e,n,{get:t[n],enumerable:!0})},nn=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of br(t))!vr.call(e,r)&&r!==n&&We(e,r,{get:()=>t[r],enumerable:!(o=yr(t,r))||o.enumerable});return e};var Fe=(e,t,n)=>(n=e!=null?gr(wr(e)):{},nn(t||!e||!e.__esModule?We(n,"default",{value:e,enumerable:!0}):n,e)),Sr=e=>nn(We({},"__esModule",{value:!0}),e);var $s={};kr($s,{apply:()=>js,inject:()=>Hs,name:()=>Ls});module.exports=Sr($s);var re=require("react");var q=require("react");function on(e,t){return t(`run.trigger.${e}`)}var J=class extends Error{constructor(n){super(n);this.key=n}},xr=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function je(e){return`/${xr.test(e.name)?e.name:e.id}`}function Tr(e,t,n){let o=t.startsWith("/")?t:`/${t}`,r=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(^|\\s)${r}(?=\\s|$)`).test(e))return{text:e,caret:Math.min(Math.max(n,0),e.length)};let i=Math.min(Math.max(n,0),e.length),s=e.slice(0,i),l=e.slice(i),a=`${s.length>0&&!/\s$/.test(s)?" ":""}${o} `;return{text:s+a+l,caret:s.length+a.length}}function wt(e,t){let n=Math.min(Math.max(t,0),e.length),o=/(?:^|\s)\/([^\s/]*)$/.exec(e.slice(0,n));if(o===null)return;let r=o[1]??"";return{start:n-r.length-1,query:r}}function rn(e,t){let n=t.trim().toLowerCase();return n===""?[...e]:e.filter(o=>o.id.toLowerCase().includes(n)||o.name.toLowerCase().includes(n))}function sn(e,t,n){let o=wt(e,t),r=n.startsWith("/")?n:`/${n}`;return o===void 0?Tr(e,r,t):{text:`${e.slice(0,o.start)}${r} ${e.slice(t)}`,caret:o.start+r.length+1}}function an(e,t){let n=new Set(t.map(s=>je(s).slice(1))),o=[],r=/(^|\s)(\/[a-z0-9]+(?:-[a-z0-9]+)*)(?=\s|$)/gi,i=0;for(let s of e.matchAll(r)){let l=s[1]??"",d=s[2]??"",a=(s.index??0)+l.length;n.has(d.slice(1))&&(a>i&&o.push({kind:"text",text:e.slice(i,a)}),o.push({kind:"skill",text:d}),i=a+d.length)}return(i<e.length||o.length===0)&&o.push({kind:"text",text:e.slice(i)}),o}function dn(e=new Date){let t=new Date(e.getTime()+36e5);t.setMinutes(0,0,0);let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function vt(e=new Date,t=[],n,o=""){return{name:"",prompt:"",scheduleKind:"daily",onceAt:dn(e),everyMinutes:"60",maxConcurrentRuns:"1",intervalAnchor:"",time:"09:00",weekdays:[1,2,3,4,5],hourlyMinute:"00",monthDay:"1",customDays:"2",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone||"Asia/Shanghai",permission:o,workspaceId:t[0]?.id??"",modelKey:n==null?"default":`${n.provider}::${n.model}`,reasoningEffort:n?.reasoning?.defaultEffort??"none",skills:[]}}function ln(e,t,n,o=new Date,r={}){let i=Number(e.maxConcurrentRuns);if(!Number.isSafeInteger(i)||i<1)throw new J("form.error.maxConcurrentRuns");let s=e.name.trim(),l=e.prompt.trim();if(s==="")throw new J("form.error.name");if(l==="")throw new J("form.error.prompt");let d=t.find(p=>p.id===e.workspaceId);if(d===void 0)throw new J("form.error.workspace");let a;switch(e.scheduleKind){case"once":{let p=new Date(e.onceAt);if(!Number.isFinite(p.getTime())||r.allowPastOnce!==!0&&p.getTime()<=o.getTime())throw new J("form.error.once");a={kind:"once",at:p.toISOString(),timeZone:e.timeZone};break}case"interval":{let p=Number(e.everyMinutes);if(!Number.isInteger(p)||p<1||p>43200)throw new J("form.error.interval");a={kind:"interval",everyMinutes:p,anchor:e.intervalAnchor.trim()||o.toISOString(),timeZone:e.timeZone};break}case"daily":a={kind:"daily",time:e.time,timeZone:e.timeZone};break;case"weekly":if(e.weekdays.length===0)throw new J("form.error.weekdays");a={kind:"weekly",time:e.time,weekdays:[...e.weekdays].sort((p,T)=>p-T),timeZone:e.timeZone};break;case"hourly":{let p=Number(e.hourlyMinute);if(!Number.isInteger(p)||p<0||p>59)throw new J("form.error.interval");a={kind:"hourly",minute:p,timeZone:e.timeZone};break}case"monthly":{let p=Number(e.monthDay);if(!Number.isInteger(p)||p<1||p>31)throw new J("form.error.interval");a={kind:"monthly",day:p,time:e.time,timeZone:e.timeZone};break}case"custom":{let p=Number(e.customDays);if(!Number.isInteger(p)||p<1)throw new J("form.error.interval");a={kind:"custom",everyDays:p,time:e.time,timeZone:e.timeZone};break}}let f=n.find(p=>`${p.provider}::${p.model}`===e.modelKey);return{name:s,prompt:l,schedule:a,timeZone:e.timeZone,permission:e.permission,maxConcurrentRuns:i,workspaceId:d.id,cwd:d.path,...f===void 0?{provider:null,model:null}:{provider:f.provider,model:f.model},reasoningEffort:e.reasoningEffort==="none"?null:e.reasoningEffort}}function cn(e,t,n){let o=Date.parse(e);if(!Number.isFinite(o))return e;let r=Math.round((o-t.getTime())/6e4),i=Math.abs(r);if(i<1)return n("time.now");let s=r>0;if(i<60)return n(s?"time.inMinute":"time.minuteAgo",{count:i});let l=Math.round(i/60);if(l<24)return n(s?"time.inHour":"time.hourAgo",{count:l});let d=Math.round(l/24);return n(s?"time.inDay":"time.dayAgo",{count:d})}function qe(e,t){switch(e.kind){case"once":return t("schedule.onceAt",{time:new Date(e.at).toLocaleString()});case"interval":return t("schedule.everyMinutes",{count:e.everyMinutes});case"daily":return t("schedule.dailyAt",{time:e.time});case"weekly":{let n=e.weekdays.map(o=>t(`day.${o}`)).join("\u3001");return t("schedule.weeklyAt",{days:n,time:e.time})}case"hourly":return t("schedule.hourlyAt",{minute:String(e.minute).padStart(2,"0")});case"monthly":return t("schedule.monthlyAt",{day:e.day,time:e.time});case"custom":return t("schedule.customAt",{count:e.everyDays,time:e.time})}}function $e(e,t,n){let o=Date.parse(e)-t.getTime();if(!Number.isFinite(o)||o<=0)return n("time.now");let r=Math.max(1,Math.ceil(o/6e4));if(r<60)return n("time.withinMinute",{count:r});let i=Math.ceil(r/60);return i<24?n("time.withinHour",{count:i}):n("time.withinDay",{count:Math.ceil(i/24)})}function un(e,t){if(e===void 0||t===void 0)return;let n=(Date.parse(t)-Date.parse(e))/1e3;if(!(!Number.isFinite(n)||n<0))return`${n.toFixed(1)}s`}function pn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}var mn=["succeeded","failed","interrupted","running","queued","skipped","cancelled"];function Be(e){let t=Date.parse(e);return Number.isFinite(t)?t:0}function Ke(e,t,n){let o=n==="asc"?1:-1;return e.slice().sort((r,i)=>{if(t==="planned"){let l=r.nextRunAt,d=i.nextRunAt;if(l===void 0||d===void 0)return l===void 0&&d===void 0?r.name.localeCompare(i.name)||r.id.localeCompare(i.id):l===void 0?1:-1;let a=Be(l)-Be(d);return a!==0?a*o:r.name.localeCompare(i.name)||r.id.localeCompare(i.id)}let s=Be(r.createdAt)-Be(i.createdAt);return s!==0?s*o:r.id.localeCompare(i.id)})}var Ve="dsh-automation.sort-default.settings",Ue="dsh-automation.sort-default.overview";function be(e,t){if(e!==void 0)try{let n=e.getItem(t);if(n===null)return;let o=JSON.parse(n);return o.key!=="created"&&o.key!=="planned"||o.direction!=="asc"&&o.direction!=="desc"?void 0:{key:o.key,direction:o.direction}}catch{return}}function fn(e,t,n,o){e.setItem(t,JSON.stringify({key:n,direction:o}))}function hn(e,t,n,o){let r=new Map;for(let i of e){let s=new Date(i.finishedAt??i.startedAt??i.scheduledFor);if(Number.isNaN(s.getTime()))continue;let l;if(t==="month")l=`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}`;else if(t==="week"){let a=Ar(s);l=ze(a)}else l=ze(s);let d=r.get(l)??[];d.push(i),r.set(l,d)}return[...r.entries()].map(([i,s])=>({key:i,label:s[0]===void 0?i:t==="month"?o("history.month",{month:i.replace("-","/")}):t==="week"?o("history.week",{date:i.slice(5).replace("-","/")}):i===ze(n)?o("history.today"):i===ze(new Date(n.getTime()-864e5))?o("history.yesterday"):o("history.date",{date:i.slice(5).replace("-","/")}),items:s}))}function ze(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Ar(e){let t=new Date(e),n=t.getDay(),o=n===0?6:n-1;return t.setHours(0,0,0,0),t.setDate(t.getDate()-o),t}function gn(e,t=[],n,o=e.permission){let r=vt(new Date,t,n,o),i=e.schedule,s=e.provider&&e.model?`${e.provider}::${e.model}`:"default",l={...r,name:e.name,prompt:e.prompt,permission:e.permission,maxConcurrentRuns:String(e.maxConcurrentRuns??1),workspaceId:e.workspaceId??r.workspaceId,modelKey:s,reasoningEffort:e.reasoningEffort??"none",timeZone:e.timeZone||i.timeZone||r.timeZone};switch(i.kind){case"once":return{...l,scheduleKind:"once",onceAt:Er(i.at)};case"interval":return{...l,scheduleKind:"interval",everyMinutes:String(i.everyMinutes),intervalAnchor:i.anchor??""};case"hourly":return{...l,scheduleKind:"hourly",hourlyMinute:String(i.minute).padStart(2,"0")};case"daily":return{...l,scheduleKind:"daily",time:i.time};case"weekly":return{...l,scheduleKind:"weekly",time:i.time,weekdays:[...i.weekdays]};case"monthly":return{...l,scheduleKind:"monthly",time:i.time,monthDay:String(i.day)};case"custom":return{...l,scheduleKind:"custom",time:i.time,customDays:String(i.everyDays)}}}function Er(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return dn();let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}var Oe=class extends Error{code="workspace/picker-unavailable";constructor(){super("workspace picker unavailable"),this.name="WorkspacePickerUnavailableError"}};function Se(e,t){if(!(e===null||typeof e!="object"&&typeof e!="function"))try{return Reflect.get(e,t)}catch{return}}function Ge(e,t){if(e===null||typeof e!="object")return;let n;try{n=Reflect.get(e,"reflect")}catch{n=void 0}let o=Se(n,"get");if(typeof o=="function")try{let i=o.call(n,t);if(i!==void 0)return i}catch{}let r=Se(e,"get");if(typeof r=="function")try{let i=r.call(e,t);if(i!==void 0)return i}catch{return}if(typeof o!="function")try{return Se(e,t)}catch{return}}function bn(e){if(typeof e=="string"&&e.trim()!=="")return e;if(e===null||typeof e!="object"||Reflect.get(e,"canceled")===!0)return;let t=Reflect.get(e,"path");if(typeof t=="string"&&t.trim()!=="")return t;let n=Reflect.get(e,"filePaths"),o=Array.isArray(n)?n[0]:void 0;return typeof o=="string"&&o.trim()!==""?o:void 0}async function yn(e){let t=Se(e,"pickDirectory");if(typeof t=="function")return{picked:bn(await t.call(e))}}async function kt(e,t){let n=Ge(e,"workspaces"),o=Se(n,"create");if(typeof o!="function")return!1;try{return await o.call(n,{path:t}),!0}catch{return!1}}async function St(e){let t;try{t=Reflect.get(globalThis,"__DSH_DIRECTORY_PICKER__")}catch{t=void 0}let n=Se(t,"pick");if(typeof n=="function")return bn(await n.call(t));for(let o of["uiWorkspace","dialog","workspaces"]){let r=await yn(Ge(e,o));if(r!==void 0)return r.picked}try{let o=await yn(Se(e,"workspaces"));if(o!==void 0)return o.picked}catch{}throw new Oe}var Rr={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"},wn=new Map;function Ir(e){let t=wn.get(e);if(t!==void 0)return t;let n=new Intl.DateTimeFormat("en-CA",{...Rr,timeZone:e});return wn.set(e,n),n}function vn(e,t){let n=new Date(e);if(Number.isNaN(n.getTime()))return e;if(t===void 0){let o=`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`,r=`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`;return`${o} ${r}`}try{let o=Ir(t).formatToParts(n),r=f=>o.find(p=>p.type===f)?.value,[i,s,l,d,a]=["year","month","day","hour","minute"].map(f=>r(f));return[i,s,l,d,a].some(f=>f===void 0)?e:`${i}-${s}-${l} ${d}:${a}`}catch{return e}}var Ae="dsh-automation-session-",xt="dsh-automation-task:",Ze="dsh-native-sidebar.tab";function Tt(e,t){let n=new Map,o=new Map;for(let s of e)n.set(s.id,s.name),s.timeZone!==void 0&&o.set(s.id,s.timeZone);for(let s of t){let l=(s.automationName||"").trim();l!==""&&l!==s.automationId&&!n.has(s.automationId)&&n.set(s.automationId,l)}let r=[],i=new Set;for(let s of e)i.has(s.id)||(r.push(s.id),i.add(s.id));for(let s of t)s.sessionId===void 0||s.sessionId===""||i.has(s.automationId)||(r.push(s.automationId),i.add(s.automationId));return r.map(s=>{let l=n.get(s)??s;return{id:s,name:l,sessions:t.filter(d=>d.automationId===s&&d.sessionId!==void 0&&d.sessionId!=="").slice().sort((d,a)=>Date.parse(a.startedAt??a.scheduledFor)-Date.parse(d.startedAt??d.scheduledFor)).map(d=>({id:d.sessionId,running:d.status==="running"||d.status==="queued",label:vn(d.startedAt??d.scheduledFor,o.get(s))+" - "+l}))}}).filter(s=>s.sessions.length>0)}function Ye(e){return e==="active"?"pause":"resume"}function Rn(e){return e.map(t=>({id:t.id,name:t.name,status:t.status,...t.nextRunAt===void 0?{}:{nextRunAt:t.nextRunAt}}))}function At(e,t,n){if(e===void 0||e==="")return!1;let o=t.has(e);return n==="only"?o:n==="show"?!0:!o}function In(e,t){return e==null||e===""||!e.startsWith(Ae)?!1:!(t??[]).some(n=>n.sessionId===e)}function Me(e){let t=new Set;for(let n of e??[]){let o=n.sessionId;typeof o=="string"&&o!==""&&t.add(o)}return t}function Nr(e){return e==="channels"||e==="schedule"||e==="tasks"?e:"tasks"}var kn="dsh-automation.sidebar-tab",Cr="dsh-im-connect.sidebar-tab";function Nn(e){if(e===void 0)return"tasks";let t;try{t=e.getItem(Ze)??e.getItem(kn)??e.getItem(Cr)}catch{return"tasks"}let n=Nr(t);try{e.setItem(Ze,n),e.removeItem(kn)}catch{}return n}function Cn(e){return/^(新会话|新建任务|New chat|New session)(?:\s+(?:Ctrl|Alt|Shift|Meta)(?:\+[^\s+]+)*)?$/i.test(e.trim())}function On(e,t){let n=e??"",o=t??"";return o!==""&&n!==o}function Mn(e){let t=["tasks"];for(let n of e.extraTabIds)n===""||n==="tasks"||n==="schedule"||t.includes(n)||t.push(n);return e.channelsReady&&!t.includes("channels")&&t.push("channels"),t.push("schedule"),t}function Pn(e){return e.extraTabIds.includes(e.tab)?e.tab:e.tab==="channels"&&e.channelsReady?"channels":"tasks"}function Dn(e,t,n={}){return e==null||e===""?void 0:(t!==void 0?t.has(e):e.startsWith(Ae))?n.followSchedule===!1?void 0:"schedule":e.startsWith("im:")?n.followChannels===!1?void 0:"channels":"tasks"}function Or(e){return/dsh-codex-ui|michengai-codex-ui|michengai\.codexUi|codex-ui/i.test(String(e??""))}function Mr(e){let t=e;return String(t?.options?.locale??t?.options?.id??t?.options?.name??t?.options?.registrant??t?.component?.displayName??t?.component?.name??t?.id??t?.name??"")}function _n(e){return(e??[]).some(t=>Or(Mr(t)))}var Sn=new WeakMap,xn=new WeakMap,Tn=new WeakMap;function Pr(e,t){if(e===null||typeof e!="object"||!(t in e))return;let n=Reflect.get(e,t);return n!==null&&typeof n=="object"?n:void 0}function Ln(e){return e.size===0?"":[...e].sort().join("\0")}function Hn(e,t){let n=e??{ids:[],byId:{}},o=Ln(t);if(typeof n=="object"&&n!==null){let d=Sn.get(n);if(d!==void 0&&d.key===o)return d.result}let r=(n.ids??[]).filter(d=>t.has(String(d))),i=Object.fromEntries(r.map(d=>[d,n.byId?.[d]]).filter(d=>d[1]!==void 0)),s=Pr(n,"projectionsBySession"),l={...n,ids:r,byId:i,...s===void 0?{}:{projectionsBySession:Object.fromEntries(r.filter(d=>s[d]!==void 0).map(d=>[d,s[d]]))}};return typeof n=="object"&&n!==null&&Sn.set(n,{key:o,result:l}),l}function Et(e){return`${xt}${e}`}function Ee(e){if(e===void 0||!e.startsWith(xt))return;let t=e.slice(xt.length);return t===""?void 0:t}function Wn(e,t){let n=e??{items:[],archivedSessionIds:[]},o=t.map(s=>`${s.id}\0${s.name}\0${s.createdAt}\0${s.sessionIds.join(",")}`).join("\0\0");if(typeof n=="object"&&n!==null){let s=xn.get(n);if(s!==void 0&&s.key===o)return s.result}let r=t.map(s=>{let l=Et(s.id);return{workspaceId:l,id:l,title:s.name,path:"",sessionIds:[...s.sessionIds],createdAt:s.createdAt,updatedAt:s.createdAt}}),i={...n,items:r};return typeof n=="object"&&n!==null&&xn.set(n,{key:o,result:i}),i}function Rt(e,t,n){let o=e??{items:[],archivedSessionIds:[]},r=`${Ln(t)}\0${n}`;if(typeof o=="object"&&o!==null){let d=Tn.get(o);if(d!==void 0&&d.key===r)return d.result}let i=new Set(o.archivedSessionIds??[]),s=(o.items??[]).map(d=>{let a=(d.sessionIds??[]).filter(f=>{let p=String(f);return t.has(p)&&At(p,i,n)});return a.length===(d.sessionIds??[]).length?d:{...d,sessionIds:a}}),l={...o,items:s};return typeof o=="object"&&o!==null&&Tn.set(o,{key:r,result:l}),l}function Fn(e){let t=e?.byId??{};for(let[n,o]of Object.entries(t))if((o?.retainedBy?.mainView??0)>0){let r=o.id?.trim();return r!==void 0&&r!==""?r:n}return null}function Dr(e){if(e===null||typeof e!="object")return;let t=e.openSession;if(typeof t=="function")return{openSession:n=>{t.call(e,n)}}}function Bn(e){let t=Dr(Ge(e,"uiWorkspace"));return{...t===void 0?{}:{uiWorkspace:t}}}function zn(e){return typeof e.uiWorkspace?.openSession=="function"}function jn(e,t){if(typeof e.uiWorkspace?.openSession=="function"){e.uiWorkspace.openSession(t);return}throw new Error("no client session opener")}function An(e,t,n){if(e==="")return!1;let o=e.startsWith(Ae)||e.startsWith("im:")?[t,n]:[n,t];for(let r of o)if(typeof r=="function")try{return r(e),!0}catch{}return!1}async function qn(e){let t=e.id.trim();return t===""?!1:(await e.adopt?.(t).catch(()=>{}),!(e.listed?.(t)===!0)&&e.refresh!==void 0&&await e.refresh().catch(()=>{}),An(t,e.openRuntime,e.openHost)?!0:(e.refresh!==void 0&&await e.refresh().catch(()=>{}),An(t,e.openRuntime,e.openHost)))}function $n(e){return e==null||typeof e!="function"&&typeof e!="object"?{}:e}function En(e){let t=$n(e);return t.__dshAutomationWrapped===!0||t.__dshNativeTabWrapped===!0&&t.__dshNativeTabOwner==="automation"}function Kn(e){let t=new Set,n=e;for(;n!=null&&!t.has(n);){t.add(n);let o=$n(n),r=o.__dshNativeTabOriginal??o.__dshAutomationOriginal??o.__imConnectOriginal;if(r!==void 0&&r!==n){n=r;continue}return o.__dshNativeTabWrapped===!0||o.__dshAutomationWrapped===!0||o.__imConnectWrapped===!0?void 0:n}}function _r(e){let t=e,n=String(t?.options?.id??""),o=String(t?.component?.displayName??t?.component?.name??"");return n==="dsh-automation-native-switcher"||n==="dsh-automation-wrap-bump"||o==="DshNativeTabWorkspaceShell"&&En(t?.component)||o==="AutomationNativeWorkspaceShell"||o==="AutomationWrapBump"||En(t?.component)}function Vn(e){for(let t of e)if(t?.component!==void 0&&!_r(t))return t}var It=require("react/jsx-runtime");function Un(e){return(0,It.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,"aria-hidden":"true",focusable:"false",...e,children:(0,It.jsx)("path",{fill:"currentColor",d:"M8 0a8 8 0 0 0-2.53 15.59c.4.074.547-.173.547-.385 0-.19-.007-.693-.01-1.36-2.226.484-2.695-1.073-2.695-1.073-.364-.924-.89-1.17-.89-1.17-.726-.496.055-.486.055-.486.803.056 1.225.824 1.225.824.714 1.223 1.872.87 2.328.665.072-.517.28-.87.508-1.07-1.777-.202-3.645-.888-3.645-3.956 0-.874.31-1.588.823-2.148-.083-.202-.357-1.017.078-2.12 0 0 .672-.215 2.2.82A7.65 7.65 0 0 1 8 4.8c.68.003 1.365.092 2.004.27 1.527-1.035 2.197-.82 2.197-.82.437 1.103.162 1.918.08 2.12.513.56.822 1.274.822 2.148 0 3.076-1.872 3.752-3.654 3.95.288.248.544.735.544 1.482 0 1.07-.01 1.932-.01 2.195 0 .214.144.463.55.384A8.001 8.001 0 0 0 8 0Z"})})}var Lr=Fe(require("@deepseek-ai/dsh-client-ui-primitives"),1);function V(e,...t){for(let n of t){let o=e[n];if(typeof o=="function")return o}throw new Error(`Missing host icon export: ${t.join(", ")}`)}var Z=Lr,Gn=V(Z,"IconEllipsisOutlineRegular"),Nt=V(Z,"IconSearchOutlineRegular"),Zn=V(Z,"IconProjectAddOutlineRegular"),Ct=V(Z,"IconCloseFillRegular"),Yn=V(Z,"IconSlidersTwoOutlineRegular"),Xn=V(Z,"IconFolderCloseRegular"),Jn=V(Z,"IconWorkspaceTreeOutlineRegular"),Xe=V(Z,"IconFlatListOutlineRegular"),ue=V(Z,"IconClockOutlineRegular"),Je=V(Z,"IconPlusOutlineRegular"),Qn=V(Z,"IconRefreshOutlineRegular"),eo=V(Z,"IconInfoOutlineRegular"),to=V(Z,"IconNewChatOutlineRegular"),no=V(Z,"IconEditOutlineRegular"),Qe=V(Z,"IconChevronDownOutlineRegular"),oo=V(Z,"IconSettingsOutlineRegular"),ro=V(Z,"IconListPenOutlineRegular"),so=V(Z,"IconCheckOutlineRegular"),io=V(Z,"IconQueueOutlineRegular");var X=require("@deepseek-ai/dsh-client-ui-primitives");var Ot=Fe(require("react"),1),ao=require("@deepseek-ai/dsh-client-ui-primitives"),Mt={width:22,minWidth:22,height:22,padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"var(--dsw-radius-sm, 8px)"},lo=Ot.default.forwardRef(function(t,n){let{className:o,rows:r,...i}=t;return Ot.default.createElement("textarea",{...i,ref:n,className:["dsh-st-textarea",o].filter(Boolean).join(" "),rows:r||4})}),Re=ao.Input;function et(e,t){let n=e.target;if(!(n instanceof Element)||n.getAttribute("aria-hidden")!=="true")return;let o=n.parentElement?.querySelector('[role="dialog"]');!(o instanceof HTMLElement)||!o.classList.contains(t)||e.stopPropagation()}var te=Fe(require("react"),1),tt=require("@deepseek-ai/dsh-client-ui-primitives");function Pt(e){return{id:e.value,label:e.label,...e.disabled!==void 0?{disabled:e.disabled}:{},...e.danger!==void 0?{danger:e.danger}:{}}}function oe(e){let[t,n]=te.useState(!1),o=te.useRef(null),r=e.options??[];te.useEffect(()=>{if(!t)return;let a=o.current?.getBoundingClientRect().width??0;return a>0&&document.documentElement.style.setProperty("--dsh-st-menu-width",`${Math.round(a)}px`),()=>{document.documentElement.style.removeProperty("--dsh-st-menu-width")}},[t]),te.useEffect(()=>{if(!t||typeof window>"u")return;let a=f=>{f.key==="Escape"&&(f.stopPropagation(),n(!1))};return window.addEventListener("keydown",a,!0),()=>{window.removeEventListener("keydown",a,!0)}},[t]);let i=te.useMemo(()=>e.groups!==void 0&&e.groups.length>0?e.groups.flatMap(a=>[{type:"label",id:`label-${a.id}`,text:a.label},...a.options.map(Pt)]):r.map(Pt),[r,e.groups]),s=e.footer?.map(Pt),l=r.find(a=>a.value===e.value)??e.groups?.flatMap(a=>[...a.options]).find(a=>a.value===e.value),d=l?l.label:e.placeholder??e.label??"";return te.createElement("div",{ref:o,className:["dsh-st-menu-select-wrap",e.compact===!0?"is-compact":"",e.className].filter(Boolean).join(" ")},te.createElement(tt.Menu,{open:t,onClose:()=>{n(!1)},onSelect:a=>{if(e.footer?.some(f=>f.value===a)===!0){e.onFooter?.(a),n(!1);return}e.onChange(a),n(!1)},selectedId:e.value,align:"start",portal:!0,dense:!0,listClassName:["dsh-st-form-menu",e.listClassName].filter(Boolean).join(" "),...s!==void 0?{footer:s}:{},anchor:te.createElement(tt.Button,{variant:"outline",...e.compact===!0?{size:"sm"}:{},role:"combobox","aria-label":e.label??(typeof d=="string"?d:l?.text)??e.placeholder??"","aria-expanded":t,disabled:e.disabled,className:["dsh-st-menu-select-trigger",t?"is-open":""].filter(Boolean).join(" "),onClick:()=>{e.disabled||n(a=>!a)}},te.createElement("span",{className:"dsh-st-menu-select-label"},d),te.createElement(Qe,{className:"dsh-st-menu-select-arrow",size:12})),items:i}))}var ne=require("react");var Hr=new Map([["read-only",["permission.readOnly","Read Only"]],["workspace-write",["permission.workspaceWrite","Workspace Write"]],["danger-full-access",["permission.fullAccess","Full access"]]]);function co(e,t){let n=Hr.get(e.value);return n!==void 0&&(e.name===e.value||e.name===n[1])?t(n[0]):e.name||e.value}function uo(e,t){return e!==t&&t==="danger-full-access"}var de=require("@deepseek-ai/dsh-client-ui-primitives");var y=require("react/jsx-runtime");function Wr(e,t,n,o){if(e==="deepseek-account"){let r=n("provider.account");return r&&r!=="provider.account"?r:o("form.providerAccount")}return t}function Fr(e,t){return(e==="deepseek-account"?0:e==="deepseek-official"?1:2)-(t==="deepseek-account"?0:t==="deepseek-official"?1:2)}function Br(e){return(e.provider==="deepseek-account"||e.provider==="deepseek-official")&&e.model==="deepseek-flash"?(0,y.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[(0,y.jsx)("span",{children:e.label}),(0,y.jsx)(de.Tag,{tone:"info",children:"1017"})]}):e.label}var zr=[1,2,3,4,5,6,7],jr=["once","interval","hourly","daily","weekly","monthly","custom"],qr=Array.from({length:24},(e,t)=>String(t).padStart(2,"0")),fo=Array.from({length:60},(e,t)=>String(t).padStart(2,"0"));function ho({t:e,permissionT:t,modelT:n,busy:o,workspaces:r,models:i,modelFailures:s,defaultModel:l,skills:d,permissions:a,defaultPermission:f,draft:p,editing:T,onClose:w,onSubmit:h,onAddWorkspace:v}){let[u,k]=(0,ne.useState)(()=>({...vt(new Date,r,l,f),...p})),[g,A]=(0,ne.useState)(),[R,D]=(0,ne.useState)(),[I,H]=(0,ne.useState)(!1),[B,U]=(0,ne.useState)(!1),[ie,z]=(0,ne.useState)(0),[L,C]=(0,ne.useState)(0),[j,G]=(0,ne.useState)(),Y=(0,ne.useRef)(null),Q=(0,ne.useRef)(0);(0,ne.useEffect)(()=>{let c=x=>{if(x.key==="Escape"&&document.querySelector('[role="menu"]')===null){if(x.preventDefault(),x.stopPropagation(),x.stopImmediatePropagation(),R!==void 0){H(!1),D(void 0);return}w()}},m=x=>{et(x,"dsh-st-create-dialog")};return window.addEventListener("keydown",c,!0),document.addEventListener("click",m,!0),()=>{window.removeEventListener("keydown",c,!0),document.removeEventListener("click",m,!0)}},[R,w]);let O=c=>{k(m=>({...m,...c})),A(void 0)},le=r.some(c=>c.id===u.workspaceId),E=async()=>{if(!(v===void 0||B)){U(!0),A(void 0),document.activeElement instanceof HTMLElement&&document.activeElement.blur();try{let c=await v();c!==void 0&&O({workspaceId:c})}catch(c){c instanceof Oe?A(e("form.workspaceUnavailable")):c instanceof Error&&c.message!==""?A(c.message):A(e("form.addWorkspaceFailed"))}finally{U(!1)}}},K=c=>{if(uo(u.permission,c)){H(!1),D(c);return}O({permission:c})},_=async c=>{c?.preventDefault();try{await h(u)}catch(m){if(m instanceof J){A(e(m.key));return}A(m instanceof Error?m.message:e("error.action"))}},ae=u.onceAt.slice(0,10),ve=u.onceAt.slice(11,16)||"09:00",ge=$r(new Date),pe=i.find(c=>`${c.provider}::${c.model}`===u.modelKey)?.reasoning,se=wt(u.prompt,ie),ee=se===void 0||j===se.query?[]:rn(d,se.query),S=Math.min(L,Math.max(ee.length-1,0)),F=c=>{Q.current=c,z(c)};(0,ne.useEffect)(()=>{let c=document.querySelector('.dsh-st-skill-menu [aria-selected="true"]');c instanceof HTMLElement&&c.scrollIntoView({block:"nearest"})},[S,se?.query]);let $=c=>{let m=sn(u.prompt,Q.current,je(c));O({prompt:m.text}),G(void 0),queueMicrotask(()=>{let x=Y.current;x!=null&&(x.focus(),x.setSelectionRange(m.caret,m.caret),F(m.caret))})};return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(de.Modal,{open:!0,className:"dsh-st-create-dialog",contentClassName:"dsh-st-create-content",title:e(T===!0?"modal.edit":"modal.title"),closeLabel:e("form.cancel"),onClose:w,footer:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(de.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:o,onClick:w,children:e("form.cancel")}),(0,y.jsx)(de.Button,{variant:"primary",className:"dsh-st-modal-action",type:"submit",form:"dsh-st-create-form",disabled:o||B||!le,children:e("modal.save")})]}),children:(0,y.jsxs)("form",{id:"dsh-st-create-form",className:"dsh-st-form",onSubmit:c=>{_(c)},children:[(0,y.jsx)("p",{children:e("form.subtitle")}),(0,y.jsxs)("label",{className:"dsh-st-field",children:[e("form.name"),(0,y.jsx)(Re,{value:u.name,placeholder:e("form.namePlaceholder"),onChange:c=>O({name:c.target.value})})]}),(0,y.jsxs)("div",{className:"dsh-st-plan-row",children:[(0,y.jsxs)("div",{className:"dsh-st-field",children:[e("form.planTime"),(0,y.jsxs)("div",{className:"dsh-st-inline",children:[(0,y.jsx)(oe,{value:u.scheduleKind,options:jr.map(c=>({value:c,label:e(`form.${c}`)})),onChange:c=>O({scheduleKind:c})}),u.scheduleKind==="once"&&(0,y.jsx)(Re,{type:"date",min:ge,value:ae,onChange:c=>O({onceAt:mo(`${c.target.value}T${ve}`)})}),(u.scheduleKind==="once"||u.scheduleKind==="daily"||u.scheduleKind==="weekly"||u.scheduleKind==="monthly")&&(0,y.jsx)(po,{value:u.scheduleKind==="once"?ve:u.time,onChange:c=>{u.scheduleKind==="once"?O({onceAt:mo(`${ae}T${c}`)}):O({time:c})}}),u.scheduleKind==="interval"&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{className:"dsh-st-suffix",children:e("form.every")}),(0,y.jsxs)("span",{className:"dsh-st-amount",children:[(0,y.jsx)(Re,{type:"number",min:1,value:u.everyMinutes,onChange:c=>O({everyMinutes:c.target.value})}),(0,y.jsx)("span",{className:"dsh-st-suffix",children:e("form.minutes")})]})]}),u.scheduleKind==="hourly"&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(oe,{value:u.hourlyMinute,options:fo.map(c=>({value:c,label:c})),onChange:c=>O({hourlyMinute:c})}),(0,y.jsx)("span",{className:"dsh-st-suffix",children:e("form.minutesShort")})]}),u.scheduleKind==="monthly"&&(0,y.jsx)(oe,{value:u.monthDay,options:Array.from({length:31},(c,m)=>{let x=String(m+1);return{value:x,label:e("form.monthDay",{day:x})}}),onChange:c=>O({monthDay:c})}),u.scheduleKind==="custom"&&(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{className:"dsh-st-suffix",children:e("form.every")}),(0,y.jsxs)("span",{className:"dsh-st-amount",children:[(0,y.jsx)(Re,{type:"number",min:1,value:u.customDays,onChange:c=>O({customDays:c.target.value})}),(0,y.jsx)("span",{className:"dsh-st-suffix",children:e("form.daysShort")})]}),(0,y.jsx)("span",{className:"dsh-st-suffix",children:e("form.atTime")}),(0,y.jsx)(po,{value:u.time,onChange:c=>O({time:c})})]})]}),u.scheduleKind==="interval"&&(0,y.jsx)("span",{className:"dsh-st-plan-hint",children:e("form.intervalHint")}),u.scheduleKind==="custom"&&(0,y.jsx)("span",{className:"dsh-st-plan-hint",children:e("form.customHint")})]}),(0,y.jsxs)("label",{className:"dsh-st-field dsh-st-concurrency",title:e("form.maxConcurrentRunsHint"),children:[e("form.maxConcurrentRuns"),(0,y.jsx)(Re,{type:"number",min:1,step:1,value:u.maxConcurrentRuns,onChange:c=>O({maxConcurrentRuns:c.target.value})})]})]}),u.scheduleKind==="weekly"&&(0,y.jsx)("div",{className:"dsh-st-weekdays",children:zr.map(c=>(0,y.jsx)(de.Checkbox,{checked:u.weekdays.includes(c),label:e(`day.${c}`),onChange:m=>O({weekdays:m?[...u.weekdays,c]:u.weekdays.filter(x=>x!==c)})},c))}),(0,y.jsxs)("div",{className:"dsh-st-settings",children:[(0,y.jsxs)("label",{className:"dsh-st-picker-field",children:[(0,y.jsx)("span",{children:e("form.fieldWorkspace")}),r.length===0?(0,y.jsxs)("div",{className:"dsh-st-workspace-empty",children:[(0,y.jsx)(de.Button,{variant:"primary",icon:(0,y.jsx)(Je,{size:14}),disabled:B,onClick:()=>{E()},children:e("form.addWorkspace")}),(0,y.jsx)("span",{className:"dsh-st-workspace-note",children:e("form.workspaceRequired")})]}):(0,y.jsx)(oe,{value:u.workspaceId,label:e("form.fieldWorkspace"),placeholder:e("form.workspace"),options:r.map(c=>({value:c.id,label:c.title})),footer:[{value:"add-workspace",label:e("form.addWorkspace"),disabled:B}],onFooter:()=>{E()},onChange:c=>O({workspaceId:c})})]}),(0,y.jsxs)("label",{className:"dsh-st-picker-field",children:[(0,y.jsx)("span",{children:e("form.fieldModel")}),(0,y.jsx)(oe,{value:u.modelKey,label:e("form.fieldModel"),groups:Array.from(i.reduce((c,m)=>{let x=Wr(m.provider,m.providerLabel,n,e),ce=c.get(m.provider)??{label:x,options:[]};return ce.options.push({value:`${m.provider}::${m.model}`,label:Br(m),text:m.label}),c.set(m.provider,ce),c},new Map)).sort(([c],[m])=>Fr(c,m)).map(([c,m])=>({id:c,label:m.label,options:m.options})),onChange:c=>{let m=i.find(x=>`${x.provider}::${x.model}`===c);O({modelKey:c,reasoningEffort:m?.reasoning?.defaultEffort??"none"})}})]}),(0,y.jsxs)("label",{className:"dsh-st-picker-field",children:[(0,y.jsx)("span",{children:e("form.fieldEffort")}),(0,y.jsx)(oe,{disabled:pe===void 0,value:pe===void 0?"":u.reasoningEffort,label:e("form.fieldEffort"),placeholder:n("effort.providerDefault"),options:pe===void 0?[]:[...pe.defaultEffort===void 0?[{value:"none",label:n("effort.providerDefault")}]:[],...pe.efforts.map(c=>({value:c.id,label:c.name}))],onChange:c=>O({reasoningEffort:c})})]}),(0,y.jsxs)("label",{className:"dsh-st-picker-field",children:[(0,y.jsx)("span",{children:e("form.fieldPermission")}),(0,y.jsx)(oe,{value:u.permission,options:a.map(c=>({value:c.value,label:co(c,e)})),onChange:c=>K(c)})]})]}),(0,y.jsxs)("div",{className:"dsh-st-field",children:[(0,y.jsxs)("span",{className:"dsh-st-prompt-label",children:[e("form.prompt"),(0,y.jsx)("em",{children:e("form.slashHint")})]}),(0,y.jsxs)("div",{className:"dsh-st-prompt-anchor",children:[se!==void 0&&j!==se.query&&(0,y.jsx)("div",{className:"dsh-st-skill-menu",role:"listbox",children:ee.length===0?(0,y.jsx)("p",{children:e("form.slashEmpty")}):ee.map((c,m)=>(0,y.jsxs)("button",{type:"button",role:"option","aria-selected":m===S,onMouseDown:x=>x.preventDefault(),onClick:()=>$(c),children:[(0,y.jsx)("span",{children:c.name}),(0,y.jsx)("code",{children:je(c)})]},c.id))}),(0,y.jsxs)("div",{className:"dsh-st-prompt-card",children:[(0,y.jsx)("div",{className:"dsh-st-prompt-backdrop","aria-hidden":"true",children:an(u.prompt,d).map((c,m)=>c.kind==="skill"?(0,y.jsx)("span",{className:"dsh-st-skill-token",children:c.text},m):(0,y.jsx)("span",{children:c.text},m))}),(0,y.jsx)(lo,{ref:Y,spellCheck:!1,className:"dsh-st-prompt-input",value:u.prompt,placeholder:e("form.promptPlaceholder"),rows:4,onChange:c=>{F(c.target.selectionStart),O({prompt:c.target.value}),G(void 0)},onSelect:c=>F(c.currentTarget.selectionStart),onScroll:c=>{let m=c.currentTarget.closest(".dsh-st-prompt-card")?.querySelector(".dsh-st-prompt-backdrop");m instanceof HTMLElement&&(m.scrollTop=c.currentTarget.scrollTop)},onKeyDown:c=>{if(se!==void 0){if(c.key==="Escape"){c.preventDefault(),G(se.query);return}if(ee.length!==0){if(c.key==="ArrowDown")c.preventDefault(),C(m=>(Math.min(m,ee.length-1)+1)%ee.length);else if(c.key==="ArrowUp")c.preventDefault(),C(m=>(Math.min(m,ee.length-1)+ee.length-1)%ee.length);else if(c.key==="Enter"||c.key==="Tab"){c.preventDefault();let m=ee[S];m!==void 0&&$(m)}}}}})]})]})]}),s.map(c=>(0,y.jsx)("p",{className:"dsh-st-error",children:n("warning.groupLoad",{name:c.providerLabel,message:c.message})},c.provider)),g!==void 0&&(0,y.jsx)("p",{className:"dsh-st-error",children:g})]})}),(0,y.jsx)(de.RiskConfirmation,{open:R!==void 0,title:t("confirm.title"),description:t("confirm.description"),acknowledgeLabel:t("confirm.acknowledge"),cancelLabel:t("confirm.cancel"),closeLabel:t("confirm.cancel"),confirmLabel:t("confirm.enable"),acknowledged:I,onAcknowledgedChange:H,onCancel:()=>{H(!1),D(void 0)},onConfirm:()=>{!I||R===void 0||(O({permission:R}),H(!1),D(void 0))}})]})}function po({value:e,onChange:t}){let[n,o]=e.split(":");return(0,y.jsxs)("span",{className:"dsh-st-time",children:[(0,y.jsx)(oe,{value:n,options:qr.map(r=>({value:r,label:r})),onChange:r=>t(`${r}:${o}`)}),(0,y.jsx)("span",{className:"dsh-st-time-sep",children:":"}),(0,y.jsx)(oe,{value:o,options:fo.map(r=>({value:r,label:r})),onChange:r=>t(`${n}:${r}`)})]})}function $r(e){let t=e.getTimezoneOffset()*6e4;return new Date(e.getTime()-t).toISOString().slice(0,10)}function mo(e){let t=new Date(e),n=new Date;if(!Number.isFinite(t.getTime())||t.getTime()>n.getTime())return e;let o=new Date(n.getTime()+6e4);o.setSeconds(0,0);let r=o.getTimezoneOffset()*6e4;return new Date(o.getTime()-r).toISOString().slice(0,16)}var go=require("react"),Pe=require("@deepseek-ai/dsh-client-ui-primitives");var we=require("react/jsx-runtime");function yo({target:e,t,busy:n,onCancel:o,onConfirm:r}){return(0,go.useEffect)(()=>{if(e===void 0)return;let i=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation(),o())},s=l=>{et(l,"dsh-st-delete-dialog")};return window.addEventListener("keydown",i,!0),document.addEventListener("click",s,!0),()=>{window.removeEventListener("keydown",i,!0),document.removeEventListener("click",s,!0)}},[o,e]),(0,we.jsx)(Pe.Modal,{open:e!==void 0,className:"dsh-st-delete-dialog",title:t("card.confirmDelete"),...e===void 0?{}:{description:`${e.name} ${t("card.confirmDeleteHint")}`},closeLabel:t("card.cancel"),onClose:o,footer:(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(Pe.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:n,onClick:o,children:t("card.cancel")}),(0,we.jsx)(Pe.Button,{variant:"outline",className:"dsh-st-modal-action dsh-st-btn-danger",disabled:n,onClick:r,children:t("card.confirm")})]})})}var De=null,Dt=new Set;function bo(e){De=e;for(let t of[...Dt])t(De)}function _t(){let e=De;return De=null,e}function wo(){return De}function vo(e){return Dt.add(e),()=>{Dt.delete(e)}}function ko(e){let t=document.querySelector("[data-composer-seat] textarea");return t instanceof HTMLTextAreaElement?(Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set?.call(t,e),t.dispatchEvent(new InputEvent("input",{bubbles:!0})),t.focus(),!0):!1}function _e(e){if(typeof e!="object"||e===null||!("ok"in e))throw new Error("\u81EA\u52A8\u5316\u4E3B\u673A\u8FD4\u56DE\u4E86\u65E0\u6548\u54CD\u5E94\u3002");let t=e;if(t.ok===!0&&"value"in t)return t.value;if(t.ok===!1&&"error"in t){let n=t.error;throw new Error(n?.message??"\u81EA\u52A8\u5316\u8BF7\u6C42\u5931\u8D25\u3002")}throw new Error("\u81EA\u52A8\u5316\u4E3B\u673A\u8FD4\u56DE\u4E86\u65E0\u6548\u54CD\u5E94\u3002")}var Le="/dsh-automation",xo=15e3,Kr=2e3,To=[1,2,4],So=To.length+1,Vr=5*60*1e3,Ur=24*60*60*1e3;function Gr(e){return(e??[]).some(t=>t.status==="running"||t.status==="queued")?Kr:xo}function Lt(e,t){return t>0?Gr(e):xo}function Ht(e){let t=e instanceof Error?e.message:String(e);return/failed to fetch|networkerror|load failed|network request failed/i.test(t)}function Zr(e,t){let n=Date.parse(t),r=(Number.isFinite(n)?n:Date.now())-Ur;return[...new Set(e.filter(i=>{if(i.status==="queued"||i.status==="running")return!0;let s=Date.parse(i.finishedAt??i.startedAt??i.scheduledFor);return Number.isFinite(s)&&s>=r}).map(i=>i.sessionId).filter(i=>i!==void 0&&i!==""))].sort()}function Ao(e,t,n={}){let o=!1,r=0,i=e.source.getSnapshot().phase==="loading",s,l,d=0,a=0,f=0,p,T,w=!1,h=g=>{l=g,d=0,a=r,f=0,p=void 0},v=g=>{let A=e.source.getSnapshot().snapshot,R=g?.list?.getSnapshot();if(A===void 0||R===void 0||g?.refresh===void 0)return;let D=new Set([...R.ids??[],...Object.keys(R.byId??{})]);return Zr(A.runs,A.serverNow).filter(I=>!D.has(I)).join("\0")},u=()=>{if(o)return;let g=t();g!==s&&(s=g,h());let A=v(g);if(A===void 0)return;if(A===""){h();return}if(A!==l&&h(A),d>=So){if((n.now??Date.now)()<f)return;h(A)}if(r<a)return;if(T!==void 0){w=!0;return}let R=d;d+=1;let D=To[R];a=D===void 0?Number.POSITIVE_INFINITY:r+D,d>=So&&(f=(n.now??Date.now)()+Vr),T=Promise.resolve().then(async()=>{await g.refresh()}).catch(I=>{!o&&p!==A&&(p=A,console.warn("[dsh-automation] \u5237\u65B0 Host \u4F1A\u8BDD\u5217\u8868\u5931\u8D25",I))}).finally(()=>{T=void 0,!(o||!w)&&(w=!1,u())})},k=e.source.subscribe(()=>{e.source.getSnapshot().phase==="loading"?i=!0:i&&(i=!1,r+=1),u()},{background:!0});return u(),()=>{o=!0,w=!1,k()}}function Eo(e){let t={phase:"idle"},n,o,r=()=>{},i=new Set,s=new Set,l=()=>{if(o!==void 0&&clearInterval(o),i.size===0){o=void 0;return}o=setInterval(()=>{p().catch(()=>{})},Lt(t.snapshot?.runs,s.size))},d=()=>{if(r(),s.size===0)return;let h=()=>{p().catch(()=>{})},v=()=>{document.visibilityState==="visible"&&h()};typeof window<"u"&&window.addEventListener("focus",h),typeof document<"u"&&document.addEventListener("visibilitychange",v),r=()=>{typeof window<"u"&&window.removeEventListener("focus",h),typeof document<"u"&&document.removeEventListener("visibilitychange",v),r=()=>{}}},a=h=>{let v=Lt(t.snapshot?.runs,s.size);t=h,i.size>0&&v!==Lt(t.snapshot?.runs,s.size)&&l();for(let u of[...i])u()},f={getSnapshot:()=>t,subscribe:(h,v={})=>{let u=i.size>0,k=s.size>0;return i.add(h),v.background!==!0&&s.add(h),(!u||v.background!==!0&&!k)&&queueMicrotask(()=>{i.size>0&&p().catch(()=>{})}),l(),s.size>0&&!k&&d(),()=>{i.delete(h),s.delete(h),i.size===0&&o!==void 0?(clearInterval(o),o=void 0):i.size>0&&l(),s.size===0&&r()}}},p=async()=>{if(n!==void 0)return n;let h=t.snapshot;return a(h===void 0?{phase:"loading"}:{phase:"loading",snapshot:h,...t.refreshedAt===void 0?{}:{refreshedAt:t.refreshedAt}}),n=(async()=>{try{let v=await e.call(Le,"snapshot",{sessionId:"settings"}),u=_e(v);a({phase:"ready",snapshot:u,refreshedAt:Date.now()})}catch(v){let u=v instanceof Error?v.message:String(v);throw a(h===void 0?{phase:"error",error:u}:{phase:"error",snapshot:h,error:u,...t.refreshedAt===void 0?{}:{refreshedAt:t.refreshedAt}}),v}finally{n=void 0}})(),n},T=async(h,v)=>{try{return await e.call(Le,h,v)}catch(u){if(!Ht(u))throw u;return await e.call(Le,h,v)}},w=async(h,v,u)=>{_e(await T(h,v));let k=()=>{u!==void 0&&t.snapshot!==void 0&&a({phase:"ready",snapshot:u(t.snapshot),refreshedAt:Date.now()})},g=n;k(),g!==void 0&&(await g.catch(()=>{}),k());try{await p()}catch{}};return{source:f,refresh:p,async createAutomation(h){await w("create",{sessionId:"settings",input:h})},async mutateAutomation(h,v){await w("mutate",{sessionId:"settings",automationId:h,mutation:v},v==="delete"?k=>({...k,automations:k.automations.filter(g=>g.id!==h)}):k=>({...k,automations:k.automations.map(g=>g.id===h?{...g,status:v==="pause"?"paused":"active"}:g)}))},async updateAutomation(h,v){await w("update",{sessionId:"settings",automationId:h,input:v})},async runNow(h){await w("run-now",{sessionId:"settings",automationId:h})},async markRunRead(h){await w("mark-read",{sessionId:"settings",runId:h})},async registerWorkspace(h){let v=_e(await e.call(Le,"register-workspace",{path:h}));return await p(),v},async adoptSession(h){_e(await e.call(Le,"adopt-session",{sessionId:h}))},async forgetSession(h){await w("forget-session",{sessionId:h},v=>({...v,runs:v.runs.map(u=>{if(u.sessionId!==h)return u;let{sessionId:k,...g}=u;return g})}))},async forgetAutomationSessions(h){await w("forget-automation-sessions",{automationId:h},v=>({...v,runs:v.runs.map(u=>{if(u.automationId!==h)return u;let{sessionId:k,...g}=u;return g})}))}}}var Wt=require("react"),Ie=require("@deepseek-ai/dsh-client-ui-primitives");var me=require("react/jsx-runtime"),Yr=[["created","desc"],["created","asc"],["planned","asc"],["planned","desc"]];function nt({t:e,storage:t,storageKey:n,sortKey:o,sortDirection:r,onSelect:i,iconOnly:s=!1,className:l}){let[d,a]=(0,Wt.useState)(!1),[f,p]=(0,Wt.useState)(()=>be(t,n)),T=e(o==="planned"?`sort.planned.${r}`:`sort.created.${r}`),w=f?.key===o&&f.direction===r,h=()=>{t===void 0||w||(fn(t,n,o,r),p({key:o,direction:r}))},v=[...Yr.map(([k,g])=>({id:`${k}-${g}`,label:e(k==="planned"?`sort.planned.${g}`:`sort.created.${g}`)})),...t===void 0?[]:[{type:"separator",id:"sort-default-sep"},{id:"save-default",label:e(w?"sort.default.saved":"sort.default.save")}]],u=s?(0,me.jsx)(Ie.Tooltip,{label:T,side:"bottom",delayMs:500,disabled:d,portal:!0,children:(0,me.jsx)("button",{type:"button",className:d?"dsh-st-n-head-btn is-on":"dsh-st-n-head-btn","aria-label":T,"aria-expanded":d,onClick:()=>a(k=>!k),children:(0,me.jsx)(Yn,{size:16})})}):(0,me.jsxs)(Ie.Button,{variant:"outline",size:"sm",role:"combobox","aria-label":T,"aria-expanded":d,className:["dsh-st-menu-select-trigger",d?"is-open":""].filter(Boolean).join(" "),onClick:()=>a(k=>!k),children:[(0,me.jsx)("span",{className:"dsh-st-menu-select-label",children:T}),(0,me.jsx)(Qe,{className:"dsh-st-menu-select-arrow",size:12})]});return(0,me.jsx)("div",{className:["dsh-st-menu-select-wrap",l].filter(Boolean).join(" "),style:{display:"inline-flex",verticalAlign:"middle"},children:(0,me.jsx)(Ie.Menu,{open:d,onClose:()=>a(!1),selectedId:`${o}-${r}`,align:s?"end":"start",portal:!0,dense:!0,anchor:u,items:v,onSelect:k=>{if(k==="save-default"){h(),a(!1);return}let[g,A]=k.split("-");i(g,A),a(!1)}})})}var ot="dsh-automation:open-task-settings",Ft="dsh-automation:pending-task-settings";function Bt(e){if(typeof e!="object"||e===null)return;let t=e;if(!(typeof t.name!="string"||t.name.trim()===""||!Array.isArray(t.sessionIds)||t.sessionIds.some(n=>typeof n!="string"))&&!(t.automationId!==void 0&&(typeof t.automationId!="string"||t.automationId.trim()==="")))return{...typeof t.automationId=="string"?{automationId:t.automationId}:{},name:t.name,sessionIds:[...t.sessionIds]}}function Xr(e,t){try{e?.setItem(Ft,JSON.stringify(t))}catch{}}function zt(e){typeof window>"u"||(Xr(window.sessionStorage,e),window.dispatchEvent(new CustomEvent(ot,{detail:e})))}function Ro(e){if(e!==void 0)try{let t=e.getItem(Ft);return t===null?void 0:Bt(JSON.parse(t))}catch{return}}function rt(e){try{e?.removeItem(Ft)}catch{}}function Io(e,t,n){if(e.automationId!==void 0){let l=t.find(d=>d.id===e.automationId);if(l!==void 0)return l}let o=new Set(e.sessionIds),r=n.find(l=>l.sessionId!==void 0&&o.has(l.sessionId))?.automationId,i=t.find(l=>l.id===r);if(i!==void 0)return i;let s=t.filter(l=>l.name===e.name);return s.length===1?s[0]:void 0}var st="dsh-automation:create-task",jt="dsh-automation:pending-create-task";function qt(){if(!(typeof window>"u")){try{window.sessionStorage.setItem(jt,"1")}catch{}window.dispatchEvent(new Event(st))}}function No(e){if(e===void 0)return!1;try{return e.getItem(jt)==="1"}catch{return!1}}function it(e){try{e?.removeItem(jt)}catch{}}var b=require("react/jsx-runtime"),at=typeof window>"u"?void 0:window.localStorage,Co=typeof window>"u"?void 0:window.sessionStorage,Oo=typeof window>"u"?void 0:window.sessionStorage,Jr=[{name:"\u6BCF\u65E5\u56DE\u5F52\u68C0\u67E5",scheduleKind:"daily",time:"09:00",weekdays:[1,2,3,4,5]},{name:"\u6BCF\u5468\u4F9D\u8D56\u5DE1\u68C0",scheduleKind:"weekly",time:"10:00",weekdays:[1]},{name:"\u5DE5\u4F5C\u65E5\u65E9\u62A5",scheduleKind:"weekly",time:"08:00",weekdays:[1,2,3,4,5]}];function Mo({t:e,permissionT:t,modelT:n,runtime:o,closeSettings:r,addWorkspace:i}){let s=(0,q.useSyncExternalStore)(o.source.subscribe,o.source.getSnapshot,o.source.getSnapshot),[l,d]=(0,q.useState)("mine"),[a,f]=(0,q.useState)(""),[p,T]=(0,q.useState)(!1),[w,h]=(0,q.useState)(),[v,u]=(0,q.useState)(),[k,g]=(0,q.useState)(),[A,R]=(0,q.useState)(!1),[D,I]=(0,q.useState)(),[H,B]=(0,q.useState)("day"),[U,ie]=(0,q.useState)("all"),[z,L]=(0,q.useState)("all"),[C,j]=(0,q.useState)(()=>be(at,Ve)?.key??"created"),[G,Y]=(0,q.useState)(()=>be(at,Ve)?.direction??"desc"),[Q,O]=(0,q.useState)(()=>Ro(Co)),[le,E]=(0,q.useState)(()=>No(Oo)),K=(0,q.useMemo)(()=>new Date(s.snapshot?.serverNow??Date.now()),[s.snapshot?.serverNow,s.refreshedAt]),_=s.snapshot,ae=_?.workspaces??[],ve=_?.models??[],ge=_?.permissions??[],ke=_?.defaultPermission??"",pe=Ke((_?.automations??[]).filter(m=>a.trim()===""||`${m.name} ${m.prompt}`.toLowerCase().includes(a.trim().toLowerCase())),C,G),se=(_?.runs??[]).filter(m=>!(U!=="all"&&m.automationId!==U||z!=="all"&&m.status!==z)),ee=hn(se,H,K,e),S=async m=>{R(!0),I(void 0);try{await m()}catch(x){I(x instanceof J?e(x.key):Ht(x)?e("error.offline"):x instanceof Error?x.message:e("error.action"))}finally{R(!1)}},F=()=>{T(!1),g(void 0),h(void 0)},$=m=>{ke===""||ge.length===0||(h(void 0),g(m),T(!0))},c=m=>{h(m.id),g(gn(m,ae,_?.defaultModel??null,_?.defaultPermission??m.permission)),T(!0)};return(0,q.useEffect)(()=>{if(typeof window>"u")return;let m=ce=>{let ye=Bt(ce.detail);ye!==void 0&&O(ye)},x=()=>{E(!0)};return window.addEventListener(ot,m),window.addEventListener(st,x),()=>{window.removeEventListener(ot,m),window.removeEventListener(st,x)}},[]),(0,q.useEffect)(()=>{!le||_===void 0||(it(Oo),E(!1),d("mine"),f(""),$())},[le,_,e]),(0,q.useEffect)(()=>{if(Q===void 0||_===void 0)return;let m=Io(Q,_.automations,_.runs);if(rt(Co),O(void 0),d("mine"),f(""),m===void 0){I(e("error.taskMissing"));return}c(m)},[_,Q,e]),(0,b.jsxs)("div",{className:"dsh-st-shell",children:[(0,b.jsxs)("header",{className:"dsh-st-top",children:[(0,b.jsxs)("div",{className:"dsh-st-heading",children:[(0,b.jsxs)("div",{className:"dsh-st-heading-row",children:[(0,b.jsx)("h1",{children:e("tab")}),(0,b.jsxs)("div",{className:"dsh-st-heading-links",children:[(0,b.jsx)(X.Button,{variant:"outline",size:"sm","aria-label":e("header.githubProject"),icon:(0,b.jsx)(Un,{}),onClick:()=>{window.open("https://github.com/MichengAI/dsh-automation","_blank","noreferrer")},children:e("header.githubProject")}),(0,b.jsx)(X.Button,{variant:"outline",size:"sm","aria-label":e("header.githubFeedback"),icon:(0,b.jsx)(no,{size:16}),onClick:()=>{window.open("https://github.com/MichengAI/dsh-automation/issues","_blank","noreferrer")},children:e("header.githubFeedback")})]})]}),(0,b.jsx)("p",{children:e("header.lead")})]}),(0,b.jsxs)("div",{className:"dsh-st-toolbar",children:[(0,b.jsx)(X.Input,{className:"dsh-st-search",value:a,placeholder:e("search.placeholder"),onChange:m=>f(m.target.value)}),(0,b.jsx)(X.Button,{variant:"outline",icon:(0,b.jsx)(to,{size:18}),onClick:()=>{bo(e("chat.prompt")),r?.()},children:e("action.chatCreate")}),(0,b.jsx)(X.Button,{variant:"primary",icon:(0,b.jsx)(Je,{size:18}),disabled:ke===""||ge.length===0,onClick:()=>$(),children:e("action.create")}),(0,b.jsx)(X.Button,{className:"dsh-st-row-icon",variant:"outline",size:"sm",icon:(0,b.jsx)(Qn,{size:16}),"aria-label":e("section.refresh"),style:Mt,onClick:()=>{o.refresh()}})]})]}),(0,b.jsx)("div",{className:"dsh-st-banner",role:"note",children:(0,b.jsxs)("span",{children:[(0,b.jsx)(eo,{size:18}),e("banner.wake")]})}),(0,b.jsxs)("section",{className:"dsh-st-examples",children:[(0,b.jsx)("div",{className:"dsh-st-examples-head",children:(0,b.jsx)("h2",{children:e("examples.title")})}),(0,b.jsx)("div",{className:"dsh-st-example-row",children:Jr.map((m,x)=>(0,b.jsxs)("button",{type:"button",className:"dsh-st-example",disabled:ke===""||ge.length===0,onClick:()=>$({name:e(`examples.${x+1}.title`),prompt:e(`examples.${x+1}.body`),scheduleKind:m.scheduleKind,time:m.time,weekdays:m.weekdays}),children:[(0,b.jsx)("strong",{children:e(`examples.${x+1}.title`)}),(0,b.jsx)("p",{children:e(`examples.${x+1}.body`)}),(0,b.jsxs)("span",{className:"dsh-st-chip",children:[(0,b.jsx)(ue,{size:14}),e(`examples.${x+1}.chip`)]})]},m.name))})]}),D!==void 0&&(0,b.jsx)("p",{className:"dsh-st-error",children:D}),(s.phase==="idle"||s.phase==="loading"&&_===void 0)&&(0,b.jsx)("p",{className:"dsh-st-muted",children:e("loading")}),s.phase==="error"&&_===void 0&&(0,b.jsxs)("div",{className:"dsh-st-empty",children:[(0,b.jsx)("h3",{children:e("error.title")}),(0,b.jsx)("p",{children:s.error}),(0,b.jsx)(X.Button,{variant:"primary",onClick:()=>{o.refresh()},children:e("error.retry")})]}),(0,b.jsxs)("div",{className:"dsh-st-tabs",children:[(0,b.jsx)(X.SegmentedTabs,{className:"dsh-st-settings-tabs",label:e("tab"),value:l,items:[{value:"mine",id:"dsh-st-tab-mine",panelId:"dsh-st-panel-mine",label:(0,b.jsxs)("span",{className:"dsh-st-tab-label",children:[(0,b.jsx)(ue,{size:14}),(0,b.jsx)("span",{children:e("tabs.mine")})]})},{value:"runs",id:"dsh-st-tab-runs",panelId:"dsh-st-panel-runs",label:(0,b.jsxs)("span",{className:"dsh-st-tab-label",children:[(0,b.jsx)(Xe,{size:14}),(0,b.jsx)("span",{children:e("tabs.runs")})]})}],onChange:d}),l==="mine"&&(0,b.jsx)("div",{className:"dsh-st-sort-wrap",children:(0,b.jsx)(nt,{t:e,...at===void 0?{}:{storage:at},storageKey:Ve,sortKey:C,sortDirection:G,onSelect:(m,x)=>{j(m),Y(x)}})}),l==="runs"&&(0,b.jsxs)("div",{className:"dsh-st-filters",children:[(0,b.jsx)(oe,{compact:!0,className:"dsh-st-filter-range",value:H,options:["day","week","month"].map(m=>({value:m,label:e(`history.range.${m}`)})),onChange:m=>B(m)}),(0,b.jsx)(oe,{compact:!0,className:"dsh-st-filter-task",value:U,options:[{value:"all",label:e("history.allTasks")},...(_?.automations??[]).map(m=>({value:m.id,label:m.name}))],onChange:ie}),(0,b.jsx)(oe,{compact:!0,className:"dsh-st-filter-status",value:z,options:[{value:"all",label:e("history.allStatus")},...mn.map(m=>({value:m,label:e(`status.${m}`)}))],onChange:m=>L(m)})]})]}),l==="mine"&&(pe.length===0?(0,b.jsxs)("div",{id:"dsh-st-panel-mine",role:"tabpanel","aria-labelledby":"dsh-st-tab-mine",className:"dsh-st-empty",children:[(0,b.jsx)("h3",{children:e("empty.title")}),(0,b.jsx)("p",{children:e("empty.body")})]}):(0,b.jsx)("div",{id:"dsh-st-panel-mine",role:"tabpanel","aria-labelledby":"dsh-st-tab-mine",className:"dsh-st-grid",children:pe.map(m=>(0,b.jsx)(Qr,{item:m,t:e,now:K,busy:A,onEdit:()=>c(m),onToggle:()=>{S(()=>o.mutateAutomation(m.id,Ye(m.status)))},onRun:()=>{S(()=>o.runNow(m.id))},onDelete:()=>u(m)},m.id))})),l==="runs"&&(ee.length===0?(0,b.jsx)("div",{id:"dsh-st-panel-runs",role:"tabpanel","aria-labelledby":"dsh-st-tab-runs",className:"dsh-st-empty",children:e("runs.empty")}):(0,b.jsx)("div",{id:"dsh-st-panel-runs",role:"tabpanel","aria-labelledby":"dsh-st-tab-runs",className:"dsh-st-timeline",children:ee.map(m=>(0,b.jsxs)("section",{className:"dsh-st-group",children:[(0,b.jsx)("h3",{children:m.label}),m.items.map(x=>(0,b.jsx)(es,{run:x,t:e},x.id))]},m.key))})),p&&(0,b.jsx)(ho,{t:e,permissionT:t,modelT:n,busy:A,workspaces:ae,models:ve,modelFailures:_?.modelFailures??[],defaultModel:_?.defaultModel??null,skills:_?.skills??[],permissions:ge,defaultPermission:ke,editing:w!==void 0,...k===void 0?{}:{draft:k},onClose:F,...i===void 0?{}:{onAddWorkspace:i},onSubmit:async m=>{let x=ln(m,ae,ve,new Date,{allowPastOnce:w!==void 0});await S(async()=>{w===void 0?await o.createAutomation(x):await o.updateAutomation(w,x),F()})}},w??"create"),(0,b.jsx)(yo,{target:v,t:e,busy:A,onCancel:()=>u(void 0),onConfirm:()=>{let m=v;m!==void 0&&S(async()=>{await o.mutateAutomation(m.id,"delete"),u(void 0)})}})]})}function Qr({item:e,t,now:n,busy:o,onEdit:r,onToggle:i,onRun:s,onDelete:l}){let[d,a]=(0,q.useState)(!1);return(0,b.jsxs)("article",{className:"dsh-st-card",onClick:r,children:[(0,b.jsxs)("div",{className:"dsh-st-card-head",children:[(0,b.jsx)("span",{onClick:f=>f.stopPropagation(),children:(0,b.jsx)(X.Switch,{checked:e.status==="active",disabled:o,label:e.status==="active"?t("card.pause"):t("card.resume"),onChange:()=>i()})}),(0,b.jsx)("span",{onClick:f=>f.stopPropagation(),children:(0,b.jsx)(X.Menu,{open:d,onClose:()=>a(!1),align:"end",portal:!0,dense:!0,anchor:(0,b.jsx)(X.Tooltip,{label:t("card.more"),side:"bottom",delayMs:500,portal:!0,children:(0,b.jsx)("button",{type:"button",className:"dsh-st-row-icon","aria-label":t("card.more"),style:{...Mt,display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0,border:"1px solid var(--dsw-alias-border-l2, rgba(255,255,255,.15))",borderRadius:"var(--dsw-radius-sm, 6px)",background:"transparent",color:"var(--dsw-alias-label-secondary)",cursor:"pointer"},onClick:()=>a(f=>!f),children:(0,b.jsx)(Gn,{size:16})})}),items:[{id:"run",label:t("menu.run"),disabled:o},{id:"edit",label:t("menu.edit"),disabled:o},{id:"delete",label:t("menu.delete"),danger:!0,disabled:o}],onSelect:f=>{a(!1),f==="run"&&s(),f==="edit"&&r(),f==="delete"&&l()}})})]}),(0,b.jsx)("h3",{children:e.name}),(0,b.jsx)("p",{children:e.prompt}),(0,b.jsxs)("div",{className:"dsh-st-card-foot",children:[(0,b.jsxs)("span",{className:"dsh-st-chip",children:[(0,b.jsx)(ue,{size:14}),qe(e.schedule,t)]}),(0,b.jsx)("span",{children:e.nextRunAt===void 0?t("stats.noneScheduled"):t("history.nextApprox",{when:$e(e.nextRunAt,n,t)})})]})]})}function es({run:e,t}){let n=un(e.startedAt,e.finishedAt);return(0,b.jsxs)("article",{className:`dsh-st-run is-${e.status}`,children:[(0,b.jsx)("strong",{children:e.automationName}),(0,b.jsxs)("p",{children:[(0,b.jsx)("span",{children:pn(e.startedAt??e.scheduledFor)}),n!==void 0&&(0,b.jsx)("span",{children:n}),(0,b.jsx)("span",{children:on(e.trigger,t)})]})]})}var Ne="dsh-automation",Po={tab:"Scheduled tasks","sidebar.tab":"Scheduled","sidebar.tabs":"Workspace views","sidebar.tasksTab":"Tasks","sidebar.views":"Scheduled views","sidebar.viewOverview":"Task overview","sidebar.runsTab":"Records","sidebar.overviewTab":"Tasks","records.groupReadOnly":"Scheduled task groups cannot be renamed or deleted here.","records.groupByTask":"By task","records.sectionTasks":"Tasks","sidebar.treeUnavailable":"The official task tree is unavailable in this Host.","sidebar.workspaces":"Workspaces","sidebar.search":"Search","sidebar.clearSearch":"Clear search","header.lead":"Plan automatic tasks, or trigger them by hand. Describe the recurring work in any chat to create it quickly.","header.githubProject":"GitHub","header.githubFeedback":"Issues","examples.title":"Recommended examples","examples.1.title":"Daily regression check","examples.1.body":"Create a scheduled task that runs every day and inspects new test failures.","examples.1.chip":"Every day 09:00","examples.2.title":"Weekly dependency review","examples.2.body":"Create a scheduled task that runs every Monday and reports outdated or risky dependencies.","examples.2.chip":"Monday 10:00","examples.3.title":"Weekday morning briefing","examples.3.body":"Create a scheduled task that runs on weekdays and summarizes overnight changes.","examples.3.chip":"Weekdays 08:00","chat.prompt":"I want to create a scheduled task that runs every [interval] and does [the actual task]","menu.run":"Run task","menu.edit":"Edit task","menu.delete":"Delete task","session.taskSettings":"Task settings","history.range.day":"By day","history.range.week":"By week","history.range.month":"By month","history.allTasks":"All tasks","history.allStatus":"All statuses","history.today":"Today","history.yesterday":"Yesterday","history.date":"{date}","history.week":"Week of {date}","history.month":"{month}","history.nextApprox":"Next run in about {when}","time.withinMinute":"about {count} minutes","time.withinHour":"about {count} hours","time.withinDay":"about {count} days","search.placeholder":"Search scheduled tasks...","action.chatCreate":"Create in chat","action.create":"New scheduled task","banner.wake":"Scheduled tasks run only while this computer stays awake.","tabs.mine":"Tasks","tabs.runs":"Run history","sort.created.asc":"Created time ascending","sort.created.desc":"Created time descending","sort.planned.asc":"Planned time ascending","sort.planned.desc":"Planned time descending","sort.default.save":"Set as default","sort.default.saved":"Default","form.workspace":"Workspace","form.fieldWorkspace":"Workspace","form.fieldModel":"Model","form.providerAccount":"DeepSeek account","form.fieldEffort":"Reasoning","form.fieldPermission":"Permission","form.slashHint":"Type / to insert a skill","form.slashEmpty":"No matching skills","form.addWorkspace":"Add workspace","form.workspaceRequired":"Add a registered workspace before saving.","form.workspaceUnavailable":"This Host cannot create workspaces.","form.addWorkspaceFailed":"Could not add the workspace.","form.workspacePath":"Folder path","form.workspacePathPlaceholder":"D:\\work\\project","form.model":"Model","form.modelSelect":"Select model","form.effort":"Reasoning","form.effort.none":"Default","form.effort.low":"Low","form.effort.medium":"Medium","form.effort.high":"High","form.error.workspace":"Select a workspace.","modal.title":"New scheduled task","modal.edit":"Edit scheduled task","modal.save":"Save","stats.next":"Next run","stats.noneScheduled":"None scheduled","section.refresh":"Refresh","empty.title":"Let recurring coding work run itself","empty.body":"Save a self-contained task, a schedule, and a permission boundary. Every run starts in a new Session.","runs.empty":"No runs yet. Run one now, or wait for the next scheduled occurrence.","overview.empty":"No scheduled tasks yet. Create one in Settings.","form.title":"Create automation","form.subtitle":"Write a complete, standalone task. Scheduled runs do not inherit this conversation.","form.name":"Name","form.namePlaceholder":"Daily regression triage","form.prompt":"Task prompt","form.promptPlaceholder":"Inspect new test failures, locate the regression, and propose a verified minimal fix\u2026","form.schedule":"Schedule","form.planTime":"Schedule","form.hourly":"Hourly","form.monthly":"Monthly","form.custom":"Every few days","form.intervalHint":"Runs every this many minutes, starting now.","form.customHint":"Runs every this many days at the selected time.","form.atTime":"at","form.minutesShort":"min","form.daysShort":"days","form.monthDay":"Day {day} of month","form.skills":"Skills","form.skillsEmpty":"No skills available","schedule.hourlyAt":"Every hour at :{minute}","schedule.monthlyAt":"Monthly on day {day} \xB7 {time}","schedule.customAt":"Every {count} days \xB7 {time}","form.once":"Does not repeat","form.interval":"Interval","form.daily":"Daily","form.weekly":"Weekly","form.runAt":"Run at","form.every":"Every","form.minutes":"minutes","form.time":"Time","form.days":"Weekdays","form.timeZone":"Time zone","form.maxConcurrentRuns":"Concurrency","form.maxConcurrentRunsHint":"Queued and running executions share this limit. Defaults to 1; when full, scheduled triggers are skipped and manual runs are rejected.","form.error.maxConcurrentRuns":"Enter a positive whole number for concurrent runs.","form.permission":"Permission boundary","permission.readOnly":"Read Only","permission.workspaceWrite":"Workspace Write","permission.fullAccess":"Full access","form.cancel":"Cancel","form.submit":"Create automation","form.submitting":"Creating\u2026","form.error.name":"Enter a name.","form.error.prompt":"Enter a complete, standalone task prompt.","form.error.once":"Choose a valid future date and time.","form.error.interval":"The interval must be between 1 and 43,200 minutes.","form.error.weekdays":"Select at least one weekday.","day.1":"Mon","day.2":"Tue","day.3":"Wed","day.4":"Thu","day.5":"Fri","day.6":"Sat","day.7":"Sun","status.active":"Active","status.paused":"Paused","status.queued":"Queued","status.running":"Running","status.succeeded":"Succeeded","status.failed":"Failed","status.skipped":"Skipped","status.cancelled":"Cancelled","status.interrupted":"Interrupted","schedule.onceAt":"Once \xB7 {time}","schedule.everyMinutes":"Every {count} minutes","schedule.dailyAt":"Daily \xB7 {time}","schedule.weeklyAt":"{days} \xB7 {time}","card.pause":"Pause","card.resume":"Resume","card.more":"More actions","card.confirmDelete":"Delete this automation?","card.confirmDeleteHint":"Run history is kept for audit.","card.confirm":"Delete","card.cancel":"Cancel","run.trigger.schedule":"Scheduled","run.trigger.manual":"Manual",loading:"Loading automations\u2026","error.title":"Automations could not be loaded","error.retry":"Try again","error.action":"The action failed. Please try again.","error.taskMissing":"This scheduled task no longer exists.","error.offline":"Could not reach the local automation service. Check that DSH is still running and try again.","time.minutes":"{count}m","time.hours":"{count}h","time.days":"{count}d","time.months":"{count}mo","time.years":"{count}y","time.ago":"{text} ago","time.now":"now","time.minuteAgo":"{count}m ago","time.hourAgo":"{count}h ago","time.dayAgo":"{count}d ago","time.inMinute":"in {count}m","time.inHour":"in {count}h","time.inDay":"in {count}d"},Do={tab:"\u5B9A\u65F6\u4EFB\u52A1","sidebar.tab":"\u5B9A\u65F6","sidebar.tabs":"\u5DE5\u4F5C\u533A\u5206\u7C7B","sidebar.tasksTab":"\u4EFB\u52A1","sidebar.views":"\u5B9A\u65F6\u9875\u89C6\u56FE","sidebar.viewOverview":"\u4EFB\u52A1\u603B\u89C8","sidebar.runsTab":"\u8BB0\u5F55","sidebar.overviewTab":"\u4EFB\u52A1","records.groupReadOnly":"\u5B9A\u65F6\u4EFB\u52A1\u5206\u7EC4\u4E0D\u80FD\u5728\u8FD9\u91CC\u91CD\u547D\u540D\u6216\u5220\u9664\u3002","records.groupByTask":"\u6309\u4EFB\u52A1","records.sectionTasks":"\u4EFB\u52A1","sidebar.treeUnavailable":"\u5F53\u524D\u5BBF\u4E3B\u672A\u63D0\u4F9B\u5B98\u65B9\u4EFB\u52A1\u6811\u3002","sidebar.workspaces":"\u5DE5\u4F5C\u533A","sidebar.search":"\u641C\u7D22","sidebar.clearSearch":"\u6E05\u9664\u641C\u7D22","header.lead":"\u6309\u8BA1\u5212\u81EA\u52A8\u6267\u884C\u4EFB\u52A1\uFF0C\u4E5F\u53EF\u968F\u65F6\u624B\u52A8\u89E6\u53D1\u3002\u5728\u4EFB\u610F\u5BF9\u8BDD\u4E2D\u63CF\u8FF0\u4F60\u60F3\u5B9A\u671F\u505A\u7684\u4E8B\uFF0C\u5373\u53EF\u5FEB\u901F\u521B\u5EFA","header.githubProject":"GitHub","header.githubFeedback":"\u95EE\u9898\u53CD\u9988","examples.title":"\u63A8\u8350\u6848\u4F8B","examples.1.title":"\u6BCF\u65E5\u56DE\u5F52\u68C0\u67E5","examples.1.body":"\u6211\u8981\u521B\u5EFA\u4E00\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u6BCF\u3010\u5929\u3011\u6267\u884C\u3010\u68C0\u67E5\u65B0\u589E\u6D4B\u8BD5\u5931\u8D25\u5E76\u7ED9\u51FA\u6700\u5C0F\u4FEE\u590D\u3011\u3002","examples.1.chip":"\u6BCF\u5929 09:00","examples.2.title":"\u6BCF\u5468\u4F9D\u8D56\u5DE1\u68C0","examples.2.body":"\u6211\u8981\u521B\u5EFA\u4E00\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u6BCF\u3010\u5468\u4E00\u3011\u6267\u884C\u3010\u68C0\u67E5\u8FC7\u671F\u6216\u6709\u98CE\u9669\u7684\u4F9D\u8D56\u5E76\u7ED9\u51FA\u5904\u7406\u5EFA\u8BAE\u3011\u3002","examples.2.chip":"\u6BCF\u5468\u4E00 10:00","examples.3.title":"\u5DE5\u4F5C\u65E5\u65E9\u62A5","examples.3.body":"\u6211\u8981\u521B\u5EFA\u4E00\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u6BCF\u3010\u5DE5\u4F5C\u65E5\u3011\u6267\u884C\u3010\u6C47\u603B\u6628\u591C\u4ED3\u5E93\u53D8\u66F4\u5E76\u7ED9\u51FA\u4ECA\u65E5\u5173\u6CE8\u70B9\u3011\u3002","examples.3.chip":"\u5DE5\u4F5C\u65E5 08:00","chat.prompt":"\u6211\u8981\u521B\u5EFA\u4E00\u4E2A\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u6BCF\u3010\u65F6\u95F4\u95F4\u9694\u3011\u6267\u884C\u3010\u5177\u4F53\u4EFB\u52A1\u3011","menu.run":"\u6267\u884C\u4EFB\u52A1","menu.edit":"\u7F16\u8F91\u4EFB\u52A1","menu.delete":"\u5220\u9664\u4EFB\u52A1","session.taskSettings":"\u4EFB\u52A1\u8BBE\u7F6E","history.range.day":"\u6309\u5929","history.range.week":"\u6309\u5468","history.range.month":"\u6309\u6708","history.allTasks":"\u5168\u90E8\u4EFB\u52A1","history.allStatus":"\u5168\u90E8\u72B6\u6001","history.today":"\u4ECA\u5929","history.yesterday":"\u6628\u5929","history.date":"{date}","history.week":"{date} \u5F53\u5468","history.month":"{month}","history.nextApprox":"\u4E0B\u6B21\u6267\u884C \u5927\u7EA6 {when}","time.withinMinute":"{count} \u5206\u949F\u5185","time.withinHour":"{count} \u5C0F\u65F6\u5185","time.withinDay":"{count} \u5929\u5185","search.placeholder":"\u641C\u7D22\u5B9A\u65F6\u4EFB\u52A1...","action.chatCreate":"\u901A\u8FC7\u5BF9\u8BDD\u521B\u5EFA","action.create":"\u65B0\u5EFA\u5B9A\u65F6\u4EFB\u52A1","banner.wake":"\u5B9A\u65F6\u4EFB\u52A1\u4EC5\u5728\u7535\u8111\u4FDD\u6301\u5524\u9192\u65F6\u8FD0\u884C","tabs.mine":"\u5B9A\u65F6\u4EFB\u52A1","tabs.runs":"\u6267\u884C\u8BB0\u5F55","sort.created.asc":"\u6309\u521B\u5EFA\u65F6\u95F4\u5347\u5E8F","sort.created.desc":"\u6309\u521B\u5EFA\u65F6\u95F4\u5012\u5E8F","sort.planned.asc":"\u6309\u8BA1\u5212\u65F6\u95F4\u5347\u5E8F","sort.planned.desc":"\u6309\u8BA1\u5212\u65F6\u95F4\u5012\u5E8F","sort.default.save":"\u8BBE\u4E3A\u9ED8\u8BA4","sort.default.saved":"\u9ED8\u8BA4","form.workspace":"\u5DE5\u4F5C\u76EE\u5F55","form.fieldWorkspace":"\u5DE5\u4F5C\u533A","form.fieldModel":"\u6A21\u578B","form.providerAccount":"DeepSeek \u8D26\u53F7","form.fieldEffort":"\u63A8\u7406\u7B49\u7EA7","form.fieldPermission":"\u6743\u9650","form.slashHint":"\u8F93\u5165 / \u53EC\u56DE\u6280\u80FD","form.slashEmpty":"\u6CA1\u6709\u5339\u914D\u7684\u6280\u80FD","form.addWorkspace":"\u6DFB\u52A0\u5DE5\u4F5C\u533A","form.workspaceRequired":"\u8BF7\u5148\u6DFB\u52A0\u5DF2\u767B\u8BB0\u7684\u5DE5\u4F5C\u533A\uFF0C\u5426\u5219\u65E0\u6CD5\u4FDD\u5B58\u3002","form.workspaceUnavailable":"\u5F53\u524D\u5BBF\u4E3B\u4E0D\u80FD\u65B0\u5EFA\u5DE5\u4F5C\u533A\u3002","form.addWorkspaceFailed":"\u6DFB\u52A0\u5DE5\u4F5C\u533A\u5931\u8D25\u3002","form.workspacePath":"\u76EE\u5F55\u8DEF\u5F84","form.workspacePathPlaceholder":"D:\\work\\project","form.model":"\u6A21\u578B","form.modelSelect":"\u9009\u62E9\u6A21\u578B","form.effort":"\u63A8\u7406\u7B49\u7EA7","form.effort.none":"\u9ED8\u8BA4","form.effort.low":"Low","form.effort.medium":"Medium","form.effort.high":"High","form.error.workspace":"\u8BF7\u9009\u62E9\u5DE5\u4F5C\u533A\u3002","modal.title":"\u65B0\u5EFA\u5B9A\u65F6\u4EFB\u52A1","modal.edit":"\u7F16\u8F91\u5B9A\u65F6\u4EFB\u52A1","modal.save":"\u4FDD\u5B58","stats.next":"\u4E0B\u6B21\u8FD0\u884C","stats.noneScheduled":"\u6682\u65E0\u8BA1\u5212","section.refresh":"\u5237\u65B0","empty.title":"\u8BA9\u91CD\u590D\u7684\u7F16\u7801\u5DE5\u4F5C\u81EA\u52A8\u8FD0\u884C","empty.body":"\u8BBE\u7F6E\u4E00\u4E2A\u76EE\u6807\u660E\u786E\u7684\u4EFB\u52A1\u3001\u8FD0\u884C\u65F6\u95F4\u548C\u6743\u9650\u8FB9\u754C\u3002\u6BCF\u6B21\u8FD0\u884C\u90FD\u4ECE\u5168\u65B0 Session \u5F00\u59CB\u3002","runs.empty":"\u8FD8\u6CA1\u6709\u8FD0\u884C\u8BB0\u5F55\u3002\u4F60\u53EF\u4EE5\u7ACB\u5373\u8FD0\u884C\u4E00\u6B21\uFF0C\u6216\u7B49\u5F85\u8BA1\u5212\u89E6\u53D1\u3002","overview.empty":"\u6682\u65E0\u5B9A\u65F6\u4EFB\u52A1\uFF0C\u53EF\u5230\u8BBE\u7F6E\u9875\u521B\u5EFA\u3002","form.title":"\u521B\u5EFA\u81EA\u52A8\u5316","form.subtitle":"\u8BF7\u5199\u5B8C\u6574\u3001\u72EC\u7ACB\u7684\u4EFB\u52A1\u8BF4\u660E\uFF1A\u5B9A\u65F6\u8FD0\u884C\u4E0D\u4F1A\u7EE7\u627F\u5F53\u524D\u5BF9\u8BDD\u3002","form.name":"\u540D\u79F0","form.namePlaceholder":"\u6BCF\u65E5\u56DE\u5F52\u6D4B\u8BD5\u5206\u8BCA","form.prompt":"\u4EFB\u52A1\u6307\u4EE4","form.promptPlaceholder":"\u68C0\u67E5\u65B0\u589E\u6D4B\u8BD5\u5931\u8D25\uFF0C\u5B9A\u4F4D\u56DE\u5F52\u539F\u56E0\uFF0C\u5E76\u7ED9\u51FA\u7ECF\u8FC7\u9A8C\u8BC1\u7684\u6700\u5C0F\u4FEE\u590D\u65B9\u6848\u2026\u2026","form.schedule":"\u8FD0\u884C\u8BA1\u5212","form.planTime":"\u8BA1\u5212\u65F6\u95F4","form.hourly":"\u6BCF\u5C0F\u65F6","form.monthly":"\u6BCF\u6708","form.custom":"\u6BCF\u9694\u51E0\u5929","form.intervalHint":"\u4ECE\u73B0\u5728\u8D77\uFF0C\u6BCF\u9694\u8FD9\u4E48\u591A\u5206\u949F\u8FD0\u884C\u4E00\u6B21\u3002","form.customHint":"\u6BCF\u9694\u8FD9\u4E48\u591A\u5929\uFF0C\u5728\u6240\u9009\u65F6\u95F4\u8FD0\u884C\u4E00\u6B21\u3002","form.atTime":"\u4E8E","form.minutesShort":"\u5206","form.daysShort":"\u5929","form.monthDay":"\u6BCF\u6708\u7B2C {day} \u5929","form.skills":"\u6280\u80FD","form.skillsEmpty":"\u6682\u65E0\u53EF\u7528\u6280\u80FD","schedule.hourlyAt":"\u6BCF\u5C0F\u65F6 :{minute}","schedule.monthlyAt":"\u6BCF\u6708 {day} \u65E5 \xB7 {time}","schedule.customAt":"\u6BCF {count} \u5929 \xB7 {time}","form.once":"\u4E0D\u91CD\u590D","form.interval":"\u95F4\u9694","form.daily":"\u6BCF\u5929","form.weekly":"\u6BCF\u5468","form.runAt":"\u8FD0\u884C\u65F6\u95F4","form.every":"\u6BCF\u9694","form.minutes":"\u5206\u949F","form.time":"\u65F6\u95F4","form.days":"\u661F\u671F","form.timeZone":"\u65F6\u533A","form.maxConcurrentRuns":"\u5E76\u53D1\u6570\u91CF","form.maxConcurrentRunsHint":"\u540C\u4E00\u4EFB\u52A1\u7684\u6392\u961F\u53CA\u8FD0\u884C\u6B21\u6570\u5171\u7528\u6B64\u4E0A\u9650\uFF0C\u9ED8\u8BA4 1\uFF1B\u6EE1\u989D\u65F6\u8DF3\u8FC7\u5F53\u6B21\u5B9A\u65F6\u89E6\u53D1\uFF0C\u624B\u52A8\u8FD0\u884C\u5C06\u88AB\u62D2\u7EDD\u3002","form.error.maxConcurrentRuns":"\u5E76\u53D1\u6570\u91CF\u5FC5\u987B\u4E3A\u5927\u4E8E\u7B49\u4E8E 1 \u7684\u6574\u6570\u3002","form.permission":"\u6743\u9650\u8FB9\u754C","permission.readOnly":"\u53EA\u8BFB","permission.workspaceWrite":"\u5DE5\u4F5C\u533A\u5199\u5165","permission.fullAccess":"\u5B8C\u5168\u8BBF\u95EE","form.cancel":"\u53D6\u6D88","form.submit":"\u521B\u5EFA\u81EA\u52A8\u5316","form.submitting":"\u521B\u5EFA\u4E2D\u2026","form.error.name":"\u8BF7\u8F93\u5165\u540D\u79F0\u3002","form.error.prompt":"\u8BF7\u8F93\u5165\u5B8C\u6574\u3001\u72EC\u7ACB\u7684\u4EFB\u52A1\u6307\u4EE4\u3002","form.error.once":"\u8BF7\u9009\u62E9\u6709\u6548\u7684\u672A\u6765\u65E5\u671F\u548C\u65F6\u95F4\u3002","form.error.interval":"\u8FD0\u884C\u95F4\u9694\u5FC5\u987B\u5728 1 \u5230 43,200 \u5206\u949F\u4E4B\u95F4\u3002","form.error.weekdays":"\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u5929\u3002","day.1":"\u5468\u4E00","day.2":"\u5468\u4E8C","day.3":"\u5468\u4E09","day.4":"\u5468\u56DB","day.5":"\u5468\u4E94","day.6":"\u5468\u516D","day.7":"\u5468\u65E5","status.active":"\u5DF2\u542F\u7528","status.paused":"\u5DF2\u6682\u505C","status.queued":"\u6392\u961F\u4E2D","status.running":"\u8FD0\u884C\u4E2D","status.succeeded":"\u5DF2\u5B8C\u6210","status.failed":"\u5931\u8D25","status.skipped":"\u5DF2\u8DF3\u8FC7","status.cancelled":"\u5DF2\u53D6\u6D88","status.interrupted":"\u5DF2\u4E2D\u65AD","schedule.onceAt":"\u5355\u6B21 \xB7 {time}","schedule.everyMinutes":"\u6BCF {count} \u5206\u949F","schedule.dailyAt":"\u6BCF\u5929 \xB7 {time}","schedule.weeklyAt":"{days} \xB7 {time}","card.pause":"\u6682\u505C","card.resume":"\u6062\u590D","card.more":"\u66F4\u591A\u64CD\u4F5C","card.confirmDelete":"\u786E\u8BA4\u5220\u9664\u8FD9\u4E2A\u81EA\u52A8\u5316\uFF1F","card.confirmDeleteHint":"\u8FD0\u884C\u5386\u53F2\u4F1A\u4FDD\u7559\u7528\u4E8E\u5BA1\u8BA1\u3002","card.confirm":"\u786E\u8BA4\u5220\u9664","card.cancel":"\u53D6\u6D88","run.trigger.schedule":"\u5B9A\u65F6\u89E6\u53D1","run.trigger.manual":"\u624B\u52A8\u89E6\u53D1",loading:"\u6B63\u5728\u52A0\u8F7D\u81EA\u52A8\u5316\u2026","error.title":"\u65E0\u6CD5\u52A0\u8F7D\u81EA\u52A8\u5316","error.retry":"\u91CD\u8BD5","error.action":"\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002","error.taskMissing":"\u8BE5\u5B9A\u65F6\u4EFB\u52A1\u5DF2\u4E0D\u5B58\u5728\u3002","error.offline":"\u65E0\u6CD5\u8FDE\u63A5\u672C\u673A\u81EA\u52A8\u5316\u670D\u52A1\uFF0C\u8BF7\u786E\u8BA4 DSH \u4ECD\u5728\u8FD0\u884C\u540E\u91CD\u8BD5\u3002","time.minutes":"{count}\u5206\u949F","time.hours":"{count}\u5C0F\u65F6","time.days":"{count}\u5929","time.months":"{count}\u4E2A\u6708","time.years":"{count}\u5E74","time.ago":"{text}\u524D","time.now":"\u521A\u521A","time.minuteAgo":"{count} \u5206\u949F\u524D","time.hourAgo":"{count} \u5C0F\u65F6\u524D","time.dayAgo":"{count} \u5929\u524D","time.inMinute":"{count} \u5206\u949F\u540E","time.inHour":"{count} \u5C0F\u65F6\u540E","time.inDay":"{count} \u5929\u540E"};var Lo="__dshNativeTabs";function Ho(e,t,n){let o=t?.sessionOpeners?.slice().sort((r,i)=>(r.order??0)-(i.order??0)).find(r=>r!==null&&typeof r?.matchSession=="function"&&r.matchSession(e));if(o===void 0){n?.(e);return}try{o.open(e,n)}catch{n?.(e)}}var _o=new WeakMap;function Wo(e,t){if(e===null||typeof e!="object")return e;let n=t?.sessionFilters??[];if(n.length===0)return e;let o=typeof t?.getRevision=="function"?t.getRevision():null,r=t===void 0?void 0:_o.get(t);if(o!==null&&t!==void 0&&r===void 0&&(r=new WeakMap,_o.set(t,r)),o!==null){let d=r?.get(e);if(d!==void 0&&d.revision===o)return d.result}let i=(e.ids??[]).filter(d=>n.every(a=>a(String(d))));if(i.length===(e.ids??[]).length)return o!==null&&r?.set(e,{revision:o,result:e}),e;let s={};for(let d of i){let a=e.byId?.[d];a!==void 0&&(s[d]=a)}let l={...e,ids:i,byId:s};return o!==null&&r?.set(e,{revision:o,result:l}),l}function Fo(e){let t=new Map,n=[],o=[],r=new Set,i=[],s=0,l=()=>{i=[...t.values()].sort((a,f)=>(a.order??0)-(f.order??0))},d=()=>{s+=1;for(let a of r)a()};return{version:1,officialTree:e,sessionFilters:n,sessionOpeners:o,getTabs(){return i},getRevision(){return s},subscribe(a){return r.add(a),()=>{r.delete(a)}},insert(a){if(a.id==="")return()=>{};let f=t.get(a.id);return t.set(a.id,a),f!==a&&(l(),d()),()=>{t.get(a.id)===a&&(t.delete(a.id),l(),d())}},addSessionFilter(a){return n.push(a),d(),()=>{let f=n.indexOf(a);f>=0&&n.splice(f,1),d()}},addSessionOpener(a){return o.push(a),d(),()=>{let f=o.indexOf(a);f>=0&&o.splice(f,1),d()}}}}function Bo(e){if(e==null||typeof e!="object"&&typeof e!="function")return;let t=e[Lo];if(t==null||typeof t!="object")return;let n=t;return n.version===1&&typeof n.getTabs=="function"&&typeof n.subscribe=="function"&&typeof n.insert=="function"?t:void 0}function $t(e,t){try{e[Lo]=t}catch{}return t}function zo(e){if(!(e==null||typeof e!="object"&&typeof e!="function"))return Bo("component"in e?e.component:e)}function jo(e){if(e==null)return!1;let t=e;return t.__dshNativeTabHost===!0||t.__dshNativeTabWrapped===!0||t.__imConnectWrapped===!0?!0:Bo(e)!==void 0}var N=require("react"),tr=require("@deepseek-ai/dsh-client-ui-primitives");var fe=require("react");var xe=require("@deepseek-ai/dsh-client-ui-primitives");var M=require("react/jsx-runtime"),lt="dsh-st-rail-panel",dt=typeof window>"u"?void 0:window.localStorage;function qo({t:e,view:t,onChange:n}){return(0,M.jsx)(xe.SegmentedTabs,{className:"dsh-st-rail-views",label:e("sidebar.views"),value:t,items:[{value:"runs",id:"dsh-st-rail-view-runs",panelId:lt,label:(0,M.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:5},children:[(0,M.jsx)(Xe,{size:14}),(0,M.jsx)("span",{children:e("sidebar.runsTab")})]})},{value:"overview",id:"dsh-st-rail-view-overview",panelId:lt,label:(0,M.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:5},children:[(0,M.jsx)(Jn,{size:14}),(0,M.jsx)("span",{children:e("sidebar.overviewTab")})]})}],onChange:n})}function ct({t:e,automations:t,serverNow:n,openTaskSettings:o,openCreateTask:r,onToggleAutomation:i}){let[s,l]=(0,fe.useState)(()=>be(dt,Ue)?.key??"planned"),[d,a]=(0,fe.useState)(()=>be(dt,Ue)?.direction??"asc"),[f,p]=(0,fe.useState)(()=>new Set),[T,w]=(0,fe.useState)(""),[h,v]=(0,fe.useState)(!1),u=(0,fe.useMemo)(()=>new Date(n??Date.now()),[n]),k=(0,fe.useMemo)(()=>{let I=Ke(t,s,d);return Rn(I)},[t,d,s]),g=T.trim().toLowerCase(),A=g===""?k:k.filter(I=>I.name.toLowerCase().includes(g)),R=(0,fe.useMemo)(()=>new Map(t.map(I=>[I.id,qe(I.schedule,e)])),[t,e]),D=(I,H)=>{i===void 0||f.has(I)||(p(B=>new Set(B).add(I)),Promise.resolve(i(I,H)).catch(B=>{console.warn("[dsh-automation] \u5207\u6362\u4EFB\u52A1\u72B6\u6001\u5931\u8D25",B)}).finally(()=>{p(B=>{let U=new Set(B);return U.delete(I),U})}))};return(0,M.jsxs)("div",{className:"dsh-st-overview",children:[(0,M.jsxs)("div",{className:"dsh-st-overview-head",children:[(0,M.jsxs)("div",{className:"dsh-st-overview-title",children:[(0,M.jsx)("strong",{children:e("sidebar.viewOverview")}),(0,M.jsx)("span",{"aria-label":`${A.length}`,children:A.length})]}),(0,M.jsxs)("div",{className:"dsh-st-overview-actions",children:[(0,M.jsx)(xe.Tooltip,{label:e(h?"sidebar.clearSearch":"sidebar.search"),side:"bottom",delayMs:500,children:(0,M.jsx)("button",{type:"button",className:h?"dsh-st-n-head-btn is-on":"dsh-st-n-head-btn","aria-label":e(h?"sidebar.clearSearch":"sidebar.search"),"aria-expanded":h,onClick:()=>{h&&w(""),v(I=>!I)},children:h?(0,M.jsx)(Ct,{size:12}):(0,M.jsx)(Nt,{size:14})})}),(0,M.jsx)(nt,{t:e,iconOnly:!0,className:"dsh-st-overview-sort",...dt===void 0?{}:{storage:dt},storageKey:Ue,sortKey:s,sortDirection:d,onSelect:(I,H)=>{l(I),a(H)}}),r===void 0?null:(0,M.jsx)(xe.Tooltip,{label:e("action.create"),side:"bottom",delayMs:500,children:(0,M.jsx)("button",{type:"button",className:"dsh-st-n-head-btn","aria-label":e("action.create"),onClick:r,children:(0,M.jsx)(Zn,{size:16})})})]})]}),h?(0,M.jsxs)("div",{className:"dsh-st-overview-search",children:[(0,M.jsx)(Nt,{size:11}),(0,M.jsx)("input",{autoFocus:!0,value:T,"aria-label":e("search.placeholder"),placeholder:e("search.placeholder"),onChange:I=>w(I.target.value)}),T===""?null:(0,M.jsx)("button",{type:"button","aria-label":e("sidebar.clearSearch"),onClick:()=>w(""),children:(0,M.jsx)(Ct,{size:12})})]}):null,A.length===0?(0,M.jsx)("div",{className:"dsh-st-rail-empty",children:e("overview.empty")}):A.map(I=>(0,M.jsx)(ts,{t:e,row:I,now:u,scheduleSummary:R.get(I.id)??"",toggleDisabled:i===void 0||f.has(I.id),onToggleAutomation:D,...o===void 0?{}:{openTaskSettings:o}},I.id))]})}function ts({t:e,row:t,now:n,scheduleSummary:o,openTaskSettings:r,toggleDisabled:i,onToggleAutomation:s}){let l=t.status!=="active",d=t.nextRunAt===void 0?e("stats.noneScheduled"):$e(t.nextRunAt,n,e),a=t.nextRunAt===void 0?e("stats.noneScheduled"):cn(t.nextRunAt,n,e),f=`${e("stats.next")}: ${d}`,p=e(l?"card.resume":"card.pause");return(0,M.jsxs)("div",{className:`dsh-st-overview-row${l?" is-paused":""}`,children:[(0,M.jsxs)("button",{type:"button",className:"dsh-st-overview-open",disabled:r===void 0,onClick:()=>{r?.({automationId:t.id,name:t.name,sessionIds:[]})},children:[(0,M.jsxs)("span",{className:"dsh-st-overview-copy",children:[(0,M.jsx)("span",{className:"dsh-st-overview-name",children:t.name}),o!==""&&(0,M.jsxs)("span",{className:"dsh-st-overview-schedule",children:[(0,M.jsx)(ue,{size:14}),(0,M.jsx)("span",{children:o})]})]}),(0,M.jsx)("span",{className:"dsh-st-overview-next",title:f,"aria-label":f,children:(0,M.jsx)("strong",{children:a})})]}),(0,M.jsx)("span",{className:"dsh-st-overview-toggle",title:p,children:(0,M.jsx)(xe.Switch,{checked:!l,disabled:i,label:p,onChange:()=>{s?.(t.id,Ye(t.status))}})})]})}function Kt(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,[...n]]))}function ns(){let e={groupBy:"task",orderBy:"updated",groupExpansion:{},sessionOrderByAccount:{},archivedFilter:"default"},t=new Set,n=r=>{e=r;for(let i of t)i()};return{getSnapshot:()=>e,subscribe(r){return t.add(r),()=>t.delete(r)},actions:{setGroupBy(r){r!==e.groupBy&&n({...e,groupBy:r})},setOrderBy(r,i){r!==e.orderBy&&n({...e,orderBy:r,sessionOrderByAccount:r==="manual"?Kt(i):{}})},setGroupExpanded(r,i){e.groupExpansion[r]!==i&&n({...e,groupExpansion:{...e.groupExpansion,[r]:i}})},retainAccountKeys(r){let i=new Set(r),s=Object.fromEntries(Object.entries(e.groupExpansion).filter(([d])=>i.has(d))),l=Object.fromEntries(Object.entries(e.sessionOrderByAccount).filter(([d])=>i.has(d)));Object.keys(s).length===Object.keys(e.groupExpansion).length&&Object.keys(l).length===Object.keys(e.sessionOrderByAccount).length||n({...e,groupExpansion:s,sessionOrderByAccount:l})},setSessionOrder(r,i,s){let l=e.orderBy==="manual"?{...e.sessionOrderByAccount,[r]:[...i]}:{...Kt(s),[r]:[...i]};n({...e,orderBy:"manual",sessionOrderByAccount:l})},syncSessionOrders(r){e.orderBy==="manual"&&n({...e,sessionOrderByAccount:{...e.sessionOrderByAccount,...Kt(r)}})},pinSessionOrder(r,i,s){let l=new Set(i),d=Object.fromEntries(Object.entries(s.members).map(([a,f])=>{let p=e.sessionOrderByAccount[a]??f,T=l.has(a)?[r,...p.filter(w=>w!==r)]:[...p];return[a,T]}));n({...e,sessionOrderByAccount:d})},setArchivedFilter(r){r!==e.archivedFilter&&n({...e,archivedFilter:r})},ensureExpanded(r){let i=!1,s={...e.groupExpansion};for(let l of r)l===""||s[l]!==void 0||(s[l]=!0,i=!0);i&&n({...e,groupExpansion:s})}}}}var $o;function Ko(){return $o??=ns(),$o}var Vo=require("react"),Uo=require("react-dom"),Go=require("react-dom/client");function Ce(e,t=14){let n=document.createElement("div"),o=(0,Go.createRoot)(n);(0,Uo.flushSync)(()=>{o.render((0,Vo.createElement)(e,{size:t}))});let r=n.innerHTML;return o.unmount(),r}var Vt="data-dsh-automation-task-settings",os='[data-row-key^="workspace:"]',Gt='[role="menu"]',He='button[role="menuitem"]',rs,ss,is;function as(){return rs??=Ce(oo)}function ds(){return ss??=Ce(ro)}function ls(){return is??=Ce(so)}function Zo(e,t,n){for(let o of e.querySelectorAll(He))o!==t&&(!o.hasAttribute("data-dsham-archive-workspace")&&!/^(重命名|Rename|删除工作区|Delete workspace)$/i.test((o.textContent??"").trim())||(n.has(o)||n.set(o,{display:o.style.display,ariaHidden:o.getAttribute("aria-hidden")}),o.style.display="none",o.setAttribute("aria-hidden","true")))}function Yo(e){if(typeof document>"u"||typeof MutationObserver>"u")return()=>{};let t,n=0,o,r=new Map,i=p=>{let T=p.target instanceof Element?p.target:void 0;if(T===void 0)return;let w=T.closest(os);if(w!==null){t=(w.getAttribute("data-row-key")??"").slice(10),n=performance.now();return}T.closest(Gt)===null&&(t=void 0)},s=()=>{document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0}))},l=(p,T)=>{let w=p.querySelector(`[${Vt}="true"]`);if(w!==null){Zo(p,w,r);return}let h=[...p.querySelectorAll(He)],[v]=h;if(v===void 0)return;let u=h.map(H=>H.textContent??"").join(" ");if(!/(删除工作区|Delete workspace)/i.test(u))return;let g=(h.find(H=>/^(重命名|Rename)$/i.test((H.textContent??"").trim()))??h.find(H=>!H.disabled&&!/(danger|删除|Delete)/i.test(H.textContent??""))??v).parentElement;if(g===null||g===p||g.parentElement===null)return;let A=g.cloneNode(!0),R=A.querySelector(He);if(R===null)return;A.removeAttribute("data-dsham-archive-workspace"),R.removeAttribute("data-dsham-archive-workspace"),R.removeAttribute("aria-disabled"),R.removeAttribute("disabled"),R.disabled=!1,R.style.display="",R.removeAttribute("aria-hidden"),R.style.opacity="",R.style.cursor="",R.setAttribute(Vt,"true"),R.classList.remove("danger");let D=typeof e.label=="function"?e.label():e.label,I=R.querySelectorAll("span");I[0]!==void 0&&(I[0].innerHTML=as()),I[1]!==void 0?I[1].textContent=D:R.textContent=D,R.addEventListener("click",H=>{H.preventDefault(),H.stopPropagation(),s();let B={automationId:T.id,name:T.name,sessionIds:[...T.sessionIds]};window.setTimeout(()=>{try{e.openTaskSettings(B)}catch(U){console.warn("[dsh-automation] open task settings from workspace menu failed",U)}},0)}),g.parentElement?.insertBefore(A,g),Zo(p,R,r)},d=()=>{if(o=void 0,t===void 0||performance.now()-n>2e3)return;let p=e.resolveTask(t);if(p!==void 0)for(let T of document.querySelectorAll(Gt))l(T,p)},a=()=>{o===void 0&&(o=window.requestAnimationFrame(d))};document.addEventListener("pointerdown",i,!0),document.addEventListener("click",i,!0);let f=new MutationObserver(a);return f.observe(document.body,{childList:!0,subtree:!0}),()=>{o!==void 0&&window.cancelAnimationFrame(o),f.disconnect(),document.removeEventListener("pointerdown",i,!0),document.removeEventListener("click",i,!0);for(let p of document.querySelectorAll(`[${Vt}="true"]`))p.parentElement?.remove();for(let[p,T]of r)p.style.display=T.display,T.ariaHidden===null?p.removeAttribute("aria-hidden"):p.setAttribute("aria-hidden",T.ariaHidden)}}var Ut="data-dsh-automation-group-task";function Xo(e){if(typeof document>"u"||typeof MutationObserver>"u")return()=>{};let t,n=()=>{document.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0}))},o=l=>{let d=l.textContent??"";if(e.groupLabel===""||e.workspaceLabel===""||!d.includes(e.groupLabel)||!d.includes(e.workspaceLabel)||l.querySelector(`[${Ut}="true"]`)!==null)return;let a=[...l.querySelectorAll(He)],[f]=a;if(f===void 0)return;let p=f.parentElement;if(p===null||p===l||p.parentElement===null)return;let T=p.cloneNode(!0),w=T.querySelector(He);if(w===null)return;w.setAttribute(Ut,"true"),w.removeAttribute("aria-disabled"),w.removeAttribute("disabled"),w.disabled=!1,w.classList.remove("danger");for(let v of w.querySelectorAll(":scope > svg"))v.remove();let h=w.querySelectorAll("span");if(h[0]!==void 0&&(h[0].innerHTML=ds()),h[1]!==void 0?h[1].textContent=e.label:w.textContent=e.label,e.checked){let v=document.createElement("span");v.innerHTML=ls();let u=v.firstElementChild;u!==null&&(u instanceof SVGElement&&(u.style.marginLeft="auto"),w.append(u))}w.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),n(),window.setTimeout(e.onSelect,0)}),p.parentElement?.insertBefore(T,p)},r=()=>{t=void 0;for(let l of document.querySelectorAll(Gt))o(l)},i=()=>{t===void 0&&(t=window.requestAnimationFrame(r))},s=new MutationObserver(i);return s.observe(document.body,{childList:!0,subtree:!0}),()=>{t!==void 0&&window.cancelAnimationFrame(t),s.disconnect();for(let l of document.querySelectorAll(`[${Ut}="true"]`))l.parentElement?.remove()}}var W=require("react/jsx-runtime"),Jo=[],Qo=e=>()=>{},ut="dsh-st-shell-panel",cs={ids:[],byId:{}},us={items:[],archivedSessionIds:[]},er=[],ps=[];function ms(e){return e(!1)}function he(e,t){let n=e?.[t];return typeof n=="function"?n:void 0}var fs=()=>{},pt=class extends N.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.warn("[dsh-automation] official workspace tree crashed",t)}render(){return this.state.failed?this.props.fallback:this.props.children}};function Zt({t:e}){return(0,W.jsx)("div",{className:"dsh-st-rail-empty",children:e("sidebar.treeUnavailable")})}function Yt({t:e,runtime:t,officialTree:n,hostProps:o,openSession:r,openTaskSettings:i,openCreateTask:s,useSessions:l,useWorkspaces:d,wide:a}){let f=n,[p,T]=(0,N.useState)("runs"),w=(0,N.useSyncExternalStore)(t.source.subscribe,t.source.getSnapshot,t.source.getSnapshot),h=(0,N.useMemo)(()=>Me(w.snapshot?.runs),[w.snapshot]),v=d===void 0?er:d(S=>S.archivedSessionIds??er),u=Ko(),k=S=>{let F=(0,N.useSyncExternalStore)(u.subscribe,u.getSnapshot,u.getSnapshot);return S(F)},g=k(S=>S.groupBy),A=k(S=>S.archivedFilter),R=(0,N.useMemo)(()=>{let S=w.snapshot;if(S===void 0)return[];let F=new Set(v),$=new Map;for(let x of S.automations)typeof x.createdAt=="string"&&x.createdAt!==""&&$.set(x.id,x.createdAt);let c=new Map;for(let x of S.runs){if(x.sessionId===void 0||x.sessionId===""||$.has(x.automationId))continue;let ce=x.startedAt??x.scheduledFor;if(Number.isNaN(Date.parse(ce)))continue;let ye=c.get(x.automationId);(ye===void 0||Date.parse(ce)<Date.parse(ye))&&c.set(x.automationId,ce)}let m=[];for(let x of Tt(S.automations,S.runs)){let ce=x.sessions.filter(bt=>At(bt.id,F,A)).map(bt=>bt.id),ye=$.get(x.id)??c.get(x.id);ye===void 0||ce.length===0||m.push({id:x.id,name:x.name,sessionIds:ce,createdAt:ye})}return m},[A,v,w.snapshot]),D=(0,N.useCallback)((S,F)=>l===void 0?S(cs):l($=>S(Hn($,h)),F),[l,h]),I=d===void 0?void 0:d(S=>S),H=(0,N.useMemo)(()=>Rt(I,h,A),[A,h,I]),B=(0,N.useCallback)((S,F)=>d===void 0?S(us):d($=>S(g==="task"?Wn($,R):Rt($,h,A)),F),[A,g,R,h,d]),U={...o??{},...a===void 0?{}:{wide:a}},ie=he(o,"useShortcuts"),z=(0,N.useCallback)((S,F)=>ie===void 0?S(ps):ie($=>S(($??[]).filter(c=>c.id!=="workspace.add")),F),[ie]),L=he(o,"t")??(S=>S),C=(0,N.useCallback)((S,F)=>S==="section.workspaces"&&g==="task"?e("records.sectionTasks"):S==="workspace.add"||S==="menu.addWorkspace"?e("action.create"):L(S,F),[g,L,e]),j=r??he(o,"open"),G=he(o,"searchSessions"),Y=he(o,"startSession"),Q=he(o,"renameWorkspace"),O=he(o,"deleteWorkspace"),le=he(o,"insertWorkspaceBefore"),E=(0,N.useCallback)(S=>{let F=Ee(S),$=t.source.getSnapshot().snapshot;if(F===void 0||$===void 0)return;let c=Tt($.automations,$.runs).find(m=>m.id===F);return c===void 0?void 0:{id:c.id,name:c.name,sessionIds:c.sessions.map(m=>m.id)}},[t]);(0,N.useEffect)(()=>{if(!(p!=="runs"||g!=="task"||i===void 0))return Yo({label:()=>e("session.taskSettings"),resolveTask:E,openTaskSettings:i})},[g,i,E,e,p]);let K=(0,N.useCallback)(async(S,F)=>{if(G===void 0)return{items:[],hasMore:!1};let $=await G(S,F);return{items:$.items.filter(c=>c.id!==void 0&&h.has(c.id)),hasMore:$.hasMore}},[G,h]),_=(0,N.useCallback)((S,F)=>{g!=="task"||Ee(S)!==void 0||Y?.(S,F)},[g,Y]),ae=(0,N.useCallback)(async(S,F)=>{if(g!=="task"||Ee(S)!==void 0)throw new Error(e("records.groupReadOnly"));await Q?.(S,F)},[g,Q,e]),ve=(0,N.useCallback)(async S=>{if(g!=="task"||Ee(S)!==void 0)throw new Error(e("records.groupReadOnly"));await O?.(S)},[g,O,e]),ge=(0,N.useCallback)(async(S,F)=>{g!=="task"||Ee(S)!==void 0||await le?.(S,F)},[g,le]),ke=(0,N.useCallback)(S=>S(!0),[]),pe={...U,useStore:k,actions:u.actions,t:C,...j===void 0?{}:{open:j},...l===void 0?{}:{useSessions:D},...d===void 0?{}:{useWorkspaces:B},...ie===void 0?{}:{useShortcuts:z},useDirectoryFlow:s===void 0?ms:ke,requestAddWorkspace:s??fs,startSession:_,renameWorkspace:ae,deleteWorkspace:ve,insertWorkspaceBefore:ge,...G===void 0?{}:{searchSessions:K}},se=(0,N.useMemo)(()=>g==="task"?R.map(S=>Et(S.id)):g==="flat"?[]:(H.items??[]).map(S=>String(S.workspaceId??S.id??"")).filter(S=>S!==""),[g,H.items,R]);(0,N.useEffect)(()=>{u.actions.ensureExpanded(se)},[se,u]),(0,N.useEffect)(()=>Xo({label:e("records.groupByTask"),groupLabel:C("groupBy.label"),workspaceLabel:C("groupBy.workspace"),checked:g==="task",onSelect:()=>u.actions.setGroupBy("task")}),[g,u,C,e]);let ee=f===void 0?(0,W.jsx)(Zt,{t:e}):(0,W.jsx)("div",{className:"dsh-st-schedule-tree","data-mode":g,children:(0,W.jsx)(pt,{fallback:(0,W.jsx)(Zt,{t:e}),children:(0,N.createElement)(f,pe)})});return(0,W.jsxs)("div",{className:"dsh-st-n",children:[(0,W.jsx)("div",{className:"dsh-st-n-views-wrap",children:(0,W.jsx)(qo,{t:e,view:p,onChange:T})}),(0,W.jsx)("div",{id:lt,role:"tabpanel",className:"dsh-st-n-view-body",children:p==="overview"?w.snapshot===void 0?(0,W.jsx)("div",{className:"dsh-st-n-empty",children:w.phase==="loading"?e("loading"):e("overview.empty")}):(0,W.jsx)(ct,{t:e,automations:w.snapshot.automations,onToggleAutomation:(S,F)=>t.mutateAutomation(S,F),...i===void 0?{}:{openTaskSettings:i},...s===void 0?{}:{openCreateTask:s},...w.snapshot.serverNow===void 0?{}:{serverNow:w.snapshot.serverNow}}):ee})]})}function nr({t:e,runtime:t,officialTree:n,hostProps:o,openSession:r,openTaskSettings:i,openCreateTask:s,useSessions:l,useWorkspaces:d,tabRegistry:a,wide:f}){let p=n,[T,w]=(0,N.useState)(()=>typeof window>"u"?"tasks":Nn(window.localStorage)),h=(0,N.useSyncExternalStore)(a?.subscribe??Qo,()=>a?.getTabs()??Jo,()=>Jo),v=(0,N.useSyncExternalStore)(a?.subscribe??Qo,()=>typeof a?.getRevision=="function"?a.getRevision():0,()=>0),u=h.some(E=>E.id==="channels"),k=l?.(E=>Fn(E)),g=(0,N.useSyncExternalStore)(t.source.subscribe,t.source.getSnapshot,t.source.getSnapshot),A=(0,N.useMemo)(()=>Me(g.snapshot?.runs),[g.snapshot]),R=(0,N.useRef)(null);(0,N.useEffect)(()=>{if(!In(k,g.snapshot?.runs)){R.current=null;return}R.current!==k&&(R.current=k??null,t.refresh().catch(()=>{}))},[g.snapshot?.runs,k,t]),(0,N.useEffect)(()=>{try{window.localStorage.setItem(Ze,T)}catch{}},[T]),(0,N.useEffect)(()=>{let E=K=>{let _=K.target instanceof Element?K.target.closest("button"):null;if(_===null||_.closest("[data-row-key]")!==null)return;let ae=(_.getAttribute("aria-label")??_.textContent??"").trim();Cn(ae)&&w("tasks")};return document.addEventListener("click",E,!0),()=>document.removeEventListener("click",E,!0)},[]);let D=(0,N.useRef)(k),I=(0,N.useRef)(!1);(0,N.useEffect)(()=>{let E=Dn(k??void 0,A,{followSchedule:!1,followChannels:!1});if(!I.current){D.current=k,I.current=k!=null;return}let K=D.current;if(D.current=k,!On(K,k))return;E==="tasks"&&w("tasks");let _=h.find(ae=>k!=null&&ae.matchSession?.(String(k))===!0);_!==void 0&&_.id!=="schedule"&&_.id!=="channels"&&w(_.id)},[k,h,A]);let H={...o??{},...f===void 0?{}:{wide:f}},B=he(o,"open"),U=(0,N.useCallback)(E=>{if(a!==void 0&&Array.isArray(a.sessionOpeners)&&a.sessionOpeners.length>0){Ho(E,a,B);return}if(A.has(E)&&r!==void 0){r(E);return}B?.(E)},[r,B,A,a,v]),ie=(0,N.useCallback)((E,K)=>l===void 0?E({ids:[],byId:{}}):l(_=>E(Wo(_,a)),K),[l,a,v]),z={...H,open:U,...l===void 0?{}:{useSessions:ie}},L=E=>p===void 0?(0,W.jsx)(Zt,{t:e}):(0,W.jsx)(pt,{fallback:(0,N.createElement)(p,H),children:(0,N.createElement)(p,E)}),C=(0,N.useMemo)(()=>h.filter(E=>E.id!=="schedule"),[h]),j=Pn({tab:T,channelsReady:u,extraTabIds:Mn({extraTabIds:C.map(E=>E.id),channelsReady:u})}),G=h.find(E=>E.id==="schedule"),Y=G===void 0?(0,W.jsx)(Yt,{t:e,runtime:t,...p===void 0?{}:{officialTree:p},...o===void 0?{}:{hostProps:o},...r===void 0?{}:{openSession:r},...i===void 0?{}:{openTaskSettings:i},...s===void 0?{}:{openCreateTask:s},...l===void 0?{}:{useSessions:l},...d===void 0?{}:{useWorkspaces:d},...f===void 0?{}:{wide:f}}):G.render({...o??{},openSession:r,open:r,useSessions:l,wide:!0}),Q=(0,N.useMemo)(()=>{let E=[{value:"tasks",id:"dsh-st-tab-tasks",panelId:ut,label:(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[(0,W.jsx)(Xn,{size:14}),(0,W.jsx)("span",{children:e("sidebar.tasksTab")})]})}];for(let K of C){if(K.id==="tasks")continue;let _=K.id==="channels"?(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[(0,W.jsx)(io,{size:14}),(0,W.jsx)("span",{children:K.label})]}):K.label;E.push({value:K.id,id:"dsh-st-tab-"+K.id,panelId:ut,label:_})}return E.push({value:"schedule",id:"dsh-st-tab-schedule",panelId:ut,label:(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[(0,W.jsx)(ue,{size:14}),(0,W.jsx)("span",{children:e("sidebar.tab")})]})}),E},[u,C,e]);if(f===!1)return(0,W.jsx)(W.Fragment,{children:L(z)});let O=j==="schedule"||j==="tasks"?void 0:C.find(E=>E.id===j),le=O!==void 0||j==="schedule"||j==="channels"?"dsh-st-shell-body":"dsh-st-official-tree";return(0,W.jsxs)("div",{className:"dsh-st-shell-rail",children:[(0,W.jsx)("div",{className:"dsh-st-shell-tabs-wrap",style:{"--dsh-st-tab-count":String(Q.length)},children:(0,W.jsx)(tr.SegmentedTabs,{className:"dsh-st-shell-segmented-tabs",label:e("sidebar.tabs"),value:j,onChange:E=>w(E),items:Q})}),(0,W.jsx)("div",{id:ut,role:"tabpanel",className:le,children:j==="schedule"?Y:O!==void 0?O.render({...o??{},openSession:U,open:U,useSessions:l,wide:!0}):L(z)})]})}var or="dsh-automation-styles",mt="@michengai/dsh-automation",rr=`
4
+ /* \u8BBE\u7F6E\u5BFC\u822A\u56FE\u6807\uFF1A\u9690\u85CF\u5BBF\u4E3B svg\uFF0C\u6539\u7528\u72EC\u7ACB\u5BBF\u4E3B\u56FE\u6807\u5143\u7D20\uFF0C\u907F\u514D\u6539\u5199\u5BBF\u4E3B\u56FE\u6807\u5185\u5BB9\u3002 */
5
5
  [data-dsh-schedule-nav="1"]>svg{display:none!important}
6
- .dsh-st-nav-icon-schedule{--dsh-st-schedule-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14Z'/%3E%3Cpath d='M8 4.667V8l2.333 2.333'/%3E%3C/svg%3E");display:inline-block;flex:none;width:16px;height:16px;background:currentColor;-webkit-mask:var(--dsh-st-schedule-mask) center/contain no-repeat;mask:var(--dsh-st-schedule-mask) center/contain no-repeat}
6
+ .dsh-st-nav-icon-schedule{display:inline-flex;align-items:center;justify-content:center;flex:none;width:16px;height:16px}
7
+ .dsh-st-nav-icon-schedule svg{display:block}
7
8
  .dsh-st-shell{container-type:inline-size;min-width:0;box-sizing:border-box;width:100%;padding:0 0 32px;color:var(--dsw-alias-label-primary);font-family:var(--dsw-font-family,system-ui)}
8
9
  .dsh-st-top{display:flex;flex-direction:column;align-items:stretch;gap:12px;margin-bottom:12px}
9
10
  .dsh-st-heading h1,.dsh-st-top h1{margin:0;font-size:24px;line-height:32px;font-weight:600;letter-spacing:-.4px;white-space:nowrap}
@@ -39,10 +40,6 @@ var module = { exports: {} }; var exports = module.exports;
39
40
  .dsh-st-sort-wrap{display:flex;align-items:center;align-self:center;justify-content:flex-end;gap:8px;height:32px;margin:0 0 0 auto;min-width:0;flex:0 0 auto;flex-wrap:nowrap}
40
41
  .dsh-st-filters{display:flex;align-items:center;align-self:center;justify-content:flex-end;gap:8px;height:32px;margin:0 0 0 auto;min-width:0;flex:0 0 auto;flex-wrap:nowrap}
41
42
  .dsh-st-filters>*{margin:0 !important}
42
- .dsh-st-sort-select{width:168px;max-width:100%}
43
- .dsh-st-sort-default{display:block;width:100%;margin:4px 0 0;padding:6px 12px;border:0;border-top:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.12));background:transparent;color:inherit;text-align:left;cursor:pointer}
44
- .dsh-st-sort-default:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
45
- .dsh-st-sort-default:disabled{opacity:.55;cursor:default}
46
43
  .dsh-st-filters .dsh-st-menu-select-wrap{width:auto !important;flex:0 0 auto !important;margin:0 !important}
47
44
  .dsh-st-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
48
45
  .dsh-st-card,.dsh-st-empty{position:relative;padding:16px;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md,12px);background:var(--dsw-alias-bg-layer-2);transition:border-color .15s ease,background .15s ease}
@@ -57,7 +54,9 @@ var module = { exports: {} }; var exports = module.exports;
57
54
  .dsh-st-menu-select-trigger.is-open{border-color:var(--dsw-alias-state-business-primary,#4c8dff)}
58
55
  .dsh-st-menu-select-trigger:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4c8dff);outline-offset:2px}
59
56
  .dsh-st-menu-select-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
60
- .dsh-st-menu-select-arrow{flex:none;color:var(--dsw-alias-label-tertiary)}
57
+ /* \u5BBF\u4E3B\u56FE\u6807\u7EC4\u4EF6\u53EA\u89E3\u6784 size/className/strokeWidth\uFF0C\u4F20\u5165\u7684 style \u4F1A\u88AB\u4E22\u5F03\uFF1B\u65CB\u8F6C\u5FC5\u987B\u7531\u6837\u5F0F\u8868\u9A71\u52A8\u3002 */
58
+ .dsh-st-menu-select-arrow{flex:none;margin-left:4px;color:var(--dsw-alias-label-tertiary);transition:transform 150ms ease}
59
+ .dsh-st-menu-select-trigger.is-open .dsh-st-menu-select-arrow{transform:rotate(180deg)}
61
60
  .dsh-st-card-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-top:12px;border-top:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);font-size:12px}
62
61
  .dsh-st-chip{display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:var(--dsw-radius-xs,4px);background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.06))}
63
62
  .dsh-st-timeline{display:flex;flex-direction:column;gap:22px;padding-left:10px}
@@ -105,28 +104,29 @@ var module = { exports: {} }; var exports = module.exports;
105
104
  .dsh-st-prompt-card textarea::selection{color:transparent;background:color-mix(in srgb,var(--dsw-alias-state-business-primary,#4b7cff) 28%,transparent)}
106
105
  .dsh-st-prompt-backdrop{position:absolute;z-index:0;inset:0;overflow:hidden;padding:14px 16px 8px;font-size:14px;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;pointer-events:none;color:inherit}
107
106
  .dsh-st-skill-token{margin:0 -4px;padding:0 4px;border-radius:var(--dsw-radius-sm,4px);color:var(--dsw-alias-state-business-primary,#4b7cff);background:var(--dsw-alias-state-business-tertiary,color-mix(in srgb,var(--dsw-alias-state-business-primary,#4b7cff) 14%,transparent));font-weight:500;box-decoration-break:clone;-webkit-box-decoration-break:clone}
108
- .dsh-st-composer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 8px 6px}
109
- .dsh-st-composer-left,.dsh-st-composer-right{display:flex;align-items:center;gap:2px;min-width:0}
110
- .dsh-st-composer-left{flex:1}.dsh-st-composer-right{flex:none}
111
107
  @media(max-width:860px){.dsh-st-toolbar{flex-wrap:wrap}.dsh-st-search{flex-basis:100%;max-width:none}.dsh-st-grid,.dsh-st-example-row{grid-template-columns:1fr}.dsh-st-filters{width:100%;margin:8px 0}}
112
- .dsh-st-n-views-wrap{display:flex;flex:none;margin:2px 0 8px;padding:0;width:100%}
108
+ .dsh-st-n-views-wrap{display:flex;flex:none;margin:2px 0 8px;padding:0 var(--dsh-session-list-edge-inset,12px) 0 0;width:100%;box-sizing:border-box}
113
109
  .dsh-st-n-views-wrap .dsh-st-rail-views{margin:0!important;width:100%!important}
114
110
  .dsh-st-n-view-body{display:flex;flex:1;min-width:0;min-height:0;flex-direction:column}
115
111
  /* \u4EE5\u4E0B\u4E24\u6BB5\u8986\u76D6\u5BBF\u4E3B SegmentedTabs \u7684\u80F6\u56CA\u5916\u89C2\u3002\u9009\u62E9\u5668\u4F9D\u8D56\u539F\u8BED\u6E32\u67D3\u51FA\u7684\u7ED3\u6784\uFF1A
116
112
  \u5BB9\u5668 [role=tablist] \u7684\u9996\u4E2A\u5B50\u5143\u7D20\u662F aria-hidden \u7684\u6ED1\u52A8\u6307\u793A\u5668\uFF0C\u5176\u540E\u624D\u662F\u5404 [role=tab]\u3002
117
113
  \u5347\u7EA7 @deepseek-ai/dsh-client-ui-primitives \u65F6\u5FC5\u987B\u590D\u6838\u8BE5\u7ED3\u6784\uFF0C\u5426\u5219\u8FD9\u4E9B\u89C4\u5219\u4F1A\u9759\u9ED8\u5931\u6548\u3002 */
118
- .dsh-st-rail-views{display:grid!important;width:100%;margin:0!important;padding:2px!important;background:color-mix(in srgb,var(--dsw-alias-label-primary,currentColor) 3%,transparent)!important;border-radius:8px!important;border:0.5px solid var(--dsw-alias-border-l1,rgba(255,255,255,.05))!important;box-sizing:border-box}
119
- .dsh-st-rail-views>span[aria-hidden="true"]{inset:2px auto 2px 2px!important;border-radius:6px!important;border:0.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.08))!important;background:color-mix(in srgb,var(--dsw-alias-label-primary,currentColor) 8%,transparent)!important;border-color:color-mix(in srgb,var(--dsw-alias-label-primary,currentColor) 12%,transparent)!important;box-shadow:none!important}
120
- .dsh-st-rail-views [role=tab]{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:5px!important;width:100%!important;height:26px!important;padding:0 6px!important;font-size:13px!important;line-height:18px!important;border-radius:6px!important;color:var(--dsw-alias-label-secondary,#8b8f98);font-weight:500;text-align:center!important}
114
+ .dsh-st-rail-views{display:grid!important;box-sizing:border-box!important;height:32px!important;min-height:32px!important;max-height:32px!important;margin:0!important;padding:2px!important;border:0!important;border-radius:var(--dsw-radius-sm,8px)!important;box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l2,rgba(255,255,255,.08))!important;background:var(--dsw-alias-bg-layer-1,rgba(255,255,255,.02))!important;width:100%!important}
115
+ .dsh-st-rail-views>span[aria-hidden="true"]{inset:2px auto 2px 2px!important;width:calc((100% - 4px)/2)!important;border-radius:6px!important;border:0.5px solid var(--dsw-alias-border-l3,rgba(255,255,255,.12))!important;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.08))!important;box-shadow:none!important}
116
+ .dsh-st-rail-views [role=tab]{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:6px!important;height:28px!important;padding:0 clamp(6px,calc(100% - 60px),12px)!important;font-size:13px!important;line-height:20px!important;border-radius:6px!important;color:var(--dsw-alias-label-secondary,#8b8f98)!important;text-align:center!important;white-space:nowrap!important;box-sizing:border-box!important;transition:color 150ms ease!important}
121
117
  .dsh-st-rail-views [role=tab]>*{display:inline-flex!important;align-items:center!important;justify-content:center!important}
122
- .dsh-st-rail-views [role=tab]:hover{color:var(--dsw-alias-label-primary,inherit)}
123
- .dsh-st-rail-views [role=tab][aria-selected=true]{color:var(--dsw-alias-label-primary,inherit)!important;font-weight:600}
124
- .dsh-st-overview{display:flex;flex-direction:column;flex:1;min-height:0;overflow-y:auto;padding:2px 0 14px}
118
+ .dsh-st-rail-views [role=tab]:hover{color:var(--dsw-alias-label-primary,inherit)!important}
119
+ .dsh-st-rail-views [role=tab][aria-selected=true]{color:var(--dsw-alias-label-primary,inherit)!important;font-weight:600!important}
120
+ .dsh-st-overview{display:flex;flex-direction:column;flex:1;min-height:0;overflow-y:auto;padding:2px var(--dsh-session-list-edge-inset,12px) 14px 0}
125
121
  .dsh-st-overview-head{display:flex;flex:none;align-items:center;justify-content:space-between;gap:8px;height:36px;min-height:36px;margin-bottom:4px;padding:6px 0}
126
122
  .dsh-st-overview-title{display:flex;align-items:baseline;min-width:0;gap:6px;color:var(--dsw-alias-label-tertiary,#81858C)}
127
123
  .dsh-st-overview-title strong{font-size:14px;font-weight:400;line-height:20px}
128
124
  .dsh-st-overview-title span{display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.1));color:var(--dsw-alias-label-tertiary,#8b8f98);font-size:11px;line-height:18px}
129
- .dsh-st-overview-sort{display:flex;align-items:center}
125
+ .dsh-st-overview-actions{display:flex;flex:none;align-items:center;gap:4px}.dsh-st-overview-sort{display:flex;align-items:center}
126
+ .dsh-st-overview-search{display:flex;flex:none;align-items:center;gap:6px;height:30px;margin:0 0 8px;padding:0 8px;border:.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.08));border-radius:8px;background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.035));color:var(--dsw-alias-label-secondary,#8b8f98)}
127
+ .dsh-st-overview-search input{flex:1;min-width:0;border:0;outline:none;background:transparent;color:var(--dsw-alias-label-primary,inherit);font:14px/20px inherit}
128
+ .dsh-st-overview-search button{display:inline-flex;align-items:center;justify-content:center;flex:none;width:20px;height:20px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-tertiary,#8b8f98);cursor:pointer}
129
+ .dsh-st-overview-search button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));color:var(--dsw-alias-label-primary,inherit)}
130
130
  .dsh-st-overview-row{position:relative;width:100%;min-height:56px;margin:0 0 8px;border:1px solid var(--dsw-alias-border-l2,rgba(255,255,255,.1));border-radius:var(--dsw-radius-sm,8px);background:var(--dsw-alias-bg-layer-2,rgba(255,255,255,.035));color:var(--dsw-alias-label-primary,inherit);box-shadow:inset 0 1px rgba(255,255,255,.025);transition:background .14s ease,border-color .14s ease;overflow:hidden}
131
131
  .dsh-st-overview-row:hover{border-color:var(--dsw-alias-border-inverted,rgba(255,255,255,.18));background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.06))}
132
132
  .dsh-st-overview-open{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:18px 18px;align-items:center;gap:4px 8px;width:100%;min-height:56px;padding:8px 9px;border:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
@@ -141,57 +141,35 @@ var module = { exports: {} }; var exports = module.exports;
141
141
  .dsh-st-overview-next strong{color:var(--dsw-alias-label-secondary,#b6bac2);font-size:12px;font-weight:600;line-height:16px;white-space:nowrap}
142
142
  .dsh-st-overview-row:not(.is-paused) .dsh-st-overview-next strong{color:#45d483}
143
143
  .dsh-st-overview-toggle{position:absolute;top:4px;right:6px;z-index:1;display:inline-flex;align-items:center}
144
- .dsh-st-rail{box-sizing:border-box;height:100%;overflow:auto;padding:4px var(--dsh-sidebar-inline-padding,12px) 18px 8px;color:inherit;scrollbar-gutter:stable}
145
144
  .dsh-st-rail-empty{padding:16px 10px;color:var(--dsw-alias-label-tertiary,#8b8f98);font-size:12px}
146
- .dsh-st-rail-group{margin:0 0 8px}
147
- .dsh-st-rail-head,.dsh-st-rail-session{display:flex;align-items:center;gap:8px;width:100%;border:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
148
- .dsh-st-rail-head{min-height:32px;padding:4px 8px;border-radius:8px;font-size:13px;font-weight:600}
149
- .dsh-st-rail-session{min-height:28px;padding:3px 8px 3px 28px;border-radius:8px;color:var(--dsw-alias-label-secondary,#9ca39f);font-size:12px}
150
- .dsh-st-rail-head:hover,.dsh-st-rail-session:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
151
- .dsh-st-rail-folder{display:grid;place-items:center;width:16px;height:20px;flex:none;opacity:.8}
152
- .dsh-st-rail-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
153
- .dsh-st-rail-session span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
154
- .dsh-st-run-dot{flex:none;color:var(--dsw-static-deepseek-450,#4c8dff)}.dsh-st-run-dot-cell{fill:currentColor;opacity:.15;animation:dsh-st-run-chase 1s infinite}@keyframes dsh-st-run-chase{0%,12.4%{opacity:1}12.5%,24.9%{opacity:.6}25%,37.4%{opacity:.35}37.5%,100%{opacity:.15}}
155
145
  .dsh-st-shell-rail{display:flex;flex-direction:column;min-height:0;flex:1;height:100%;overflow:hidden}
156
146
  .dsh-st-shell-tabs-wrap{display:flex;margin:2px var(--dsh-sidebar-inline-padding,12px) 8px 0;padding:0;width:auto}
157
- .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs{width:100%;background:color-mix(in srgb,var(--dsw-alias-label-primary,currentColor) 3%,transparent)!important;border-radius:8px!important;border:0.5px solid var(--dsw-alias-border-l1,rgba(255,255,255,.05))!important;box-sizing:border-box;padding:2px!important}
158
- .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs>span[aria-hidden="true"]{inset:2px auto 2px 2px!important;border-radius:6px!important;border:0.5px solid var(--dsw-alias-border-l2,rgba(255,255,255,.08))!important;background:color-mix(in srgb,var(--dsw-alias-label-primary,currentColor) 8%,transparent)!important;border-color:color-mix(in srgb,var(--dsw-alias-label-primary,currentColor) 12%,transparent)!important;box-shadow:none!important}
159
- .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs [role=tab]{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:5px!important;width:100%!important;height:26px!important;padding:0 6px!important;font-size:13px!important;line-height:18px!important;border-radius:6px!important;color:var(--dsw-alias-label-secondary,#8b8f98);text-align:center!important}
147
+ .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs{display:grid!important;width:100%!important;box-sizing:border-box!important;height:32px!important;min-height:32px!important;max-height:32px!important;padding:2px!important;border:0!important;border-radius:var(--dsw-radius-sm,8px)!important;box-shadow:inset 0 0 0 .5px var(--dsw-alias-border-l2,rgba(255,255,255,.08))!important;background:var(--dsw-alias-bg-layer-1,rgba(255,255,255,.02))!important}
148
+ .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs>span[aria-hidden="true"]{inset:2px auto 2px 2px!important;width:calc((100% - 4px)/var(--dsh-st-tab-count,3))!important;border-radius:6px!important;border:0.5px solid var(--dsw-alias-border-l3,rgba(255,255,255,.12))!important;background:var(--dsw-alias-bg-layer-3,rgba(255,255,255,.08))!important;box-shadow:none!important}
149
+ .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs [role=tab]{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:6px!important;height:28px!important;padding:0 clamp(6px,calc(100% - 60px),12px)!important;font-size:13px!important;line-height:20px!important;border-radius:6px!important;color:var(--dsw-alias-label-secondary,#8b8f98)!important;text-align:center!important;white-space:nowrap!important;box-sizing:border-box!important;transition:color 150ms ease!important}
160
150
  .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs [role=tab]>*{display:inline-flex!important;align-items:center!important;justify-content:center!important}
161
- .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs [role=tab]:hover{color:var(--dsw-alias-label-primary,inherit)}
162
- .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs [role=tab][aria-selected=true]{color:var(--dsw-alias-label-primary,inherit)!important;font-weight:600}
151
+ .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs [role=tab]:hover{color:var(--dsw-alias-label-primary,inherit)!important}
152
+ .dsh-st-shell-tabs-wrap .dsh-st-shell-segmented-tabs [role=tab][aria-selected=true]{color:var(--dsw-alias-label-primary,inherit)!important;font-weight:600!important}
163
153
  .dsh-st-shell-body{display:flex;min-height:0;flex:1;overflow:hidden}
164
154
  .dsh-st-shell-body>*{min-width:0;flex:1}.dsh-st-official-tree{display:flex;min-height:0;flex:1;overflow:hidden}.dsh-st-official-tree>*{min-width:0;flex:1}
165
- .dsh-st-rail-head.is-static{cursor:default;font-weight:600}
166
- .dsh-st-rail-session.is-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
167
- .dsh-st-n,.dsh-st-n *{box-sizing:border-box}.dsh-st-n{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding,12px);--dsh-session-list-scrollbar-width:5px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;display:flex;flex:1;min-width:0;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-session-list-edge-inset);color:var(--dsw-alias-label-primary,inherit);font:14px/20px inherit;overflow:hidden}.dsh-st-n-toolbar{box-sizing:border-box;flex:none;height:36px;margin:2px -4px 4px 0;padding-left:4px;display:flex;justify-content:flex-end;align-items:center;gap:4px;overflow:visible;position:relative;z-index:2;color:var(--dsw-alias-label-tertiary,#81858C);border-radius:12px}.dsh-st-n-head-label{white-space:nowrap;min-width:0;max-width:45%;flex:none;line-height:20px;font-size:14px;overflow:hidden;transition:max-width .18s var(--ds-ease-in-out,ease),margin-right .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear}.dsh-st-n-toolbar.is-search .dsh-st-n-head-label{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transform:translate(-4px);transition-delay:0s,0s,0s,0s,.18s}.dsh-st-n-search-slot{box-sizing:border-box;min-width:28px;max-width:28px;transition:max-width .18s var(--ds-ease-in-out,ease);flex:none;align-items:center;margin-left:auto;display:flex;position:relative;z-index:2}.dsh-st-n-toolbar.is-search .dsh-st-n-search-slot{flex:1;min-width:0;max-width:100%}.dsh-st-n-search{box-sizing:border-box;cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out,ease),padding .18s var(--ds-ease-in-out,ease),border-color .18s var(--ds-ease-in-out,ease);background:transparent;border:none;border-radius:50%;flex:none;align-items:center;margin:0;padding:0;display:flex;overflow:hidden}.dsh-st-n-toolbar.is-search .dsh-st-n-search{border:.5px solid var(--dsw-alias-border-l4);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);border-radius:10px;margin-inline:-2px;padding:0 4px 0 0}.dsh-st-n-search-btn,.dsh-st-n-head-btn{cursor:pointer;width:28px;height:28px;min-width:28px;min-height:28px;position:relative;z-index:1;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.dsh-st-n-toolbar.is-search .dsh-st-n-search-btn{width:28px;height:30px}.dsh-st-n-search-btn:hover,.dsh-st-n-head-btn:hover,.dsh-st-n-head-btn.is-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));color:var(--dsw-alias-label-primary,inherit)}.dsh-st-n-toolbar.is-search .dsh-st-n-search-btn:hover{background:transparent}.dsh-st-n-head-acts{opacity:1;visibility:visible;max-width:32px;transition:max-width .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:visible;position:relative}.dsh-st-n-toolbar.is-search .dsh-st-n-head-acts{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transform:translate(4px);transition-delay:0s,0s,0s,.18s}.dsh-st-n-search-input{display:none;opacity:0;pointer-events:none;width:0;min-width:0;flex:none;color:var(--dsw-alias-label-primary,inherit);transition:opacity .12s var(--ds-ease-in-out,ease);background:transparent;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.dsh-st-n-toolbar.is-search .dsh-st-n-search-input{display:block;opacity:1;pointer-events:auto;margin-left:-2px;width:auto;flex:1;min-width:0}.dsh-st-n-search-input::placeholder{color:var(--dsw-alias-label-tertiary,#81858C)}.dsh-st-n-search-clear{cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.dsh-st-n-search-clear:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}@media (prefers-reduced-motion:reduce){.dsh-st-n-head-label,.dsh-st-n-search-slot,.dsh-st-n-search,.dsh-st-n-head-acts,.dsh-st-n-search-input{transition:none}}.dsh-st-n-list-area{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.dsh-st-n-tree{flex:1;min-width:0;min-height:0;overflow-x:hidden;overflow-y:auto;user-select:none;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-top:0;padding-bottom:16px;padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable}.dsh-st-n-empty{padding:16px 12px;color:var(--dsw-alias-label-tertiary,#8b8f98);font-size:13px}.dsh-st-n-group{position:relative;min-width:0;max-width:100%}.dsh-st-n-row,.dsh-st-n-sess{display:flex;align-items:center;max-width:100%;border-radius:8px;padding:0 8px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));cursor:pointer;user-select:none;border:0;background:transparent;color:var(--dsw-alias-label-primary,inherit);text-align:left;font:14px/20px inherit;gap:6px}.dsh-st-n-row{height:34px;gap:6px}.dsh-st-n-sess{height:32px;gap:0;position:relative;width:100%;appearance:none}.dsh-st-n-row:hover,.dsh-st-n-sess:hover,.dsh-st-n-sess.is-on,.dsh-st-n-sess.is-menu{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}.dsh-st-n-slot{flex:none;width:16px;height:20px;color:var(--dsw-alias-label-tertiary,#81858C);display:inline-flex;align-items:center;justify-content:center}.dsh-st-n-folder{color:inherit}.dsh-st-n-title{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px}.dsh-st-n-sess .dsh-st-n-title{margin:0 6px 0 4px;flex:1}.dsh-st-n-sess.is-flat-idle .dsh-st-n-title{margin-left:0}@media (hover:hover){.dsh-st-n-sess:hover .dsh-st-n-title,.dsh-st-n-sess.is-menu .dsh-st-n-title{text-overflow:clip}}.dsh-st-n-time{flex:none;font-size:10px;line-height:16px;color:var(--dsw-alias-label-caption,#ADB2B8);white-space:nowrap}.dsh-st-n-acts{flex:none;display:none;align-items:center;gap:10px}.dsh-st-n-row:hover .dsh-st-n-acts,.dsh-st-n-sess:hover .dsh-st-n-acts,.dsh-st-n-row.is-menu .dsh-st-n-acts,.dsh-st-n-sess.is-menu .dsh-st-n-acts{display:inline-flex}.dsh-st-n-sess:hover .dsh-st-n-time,.dsh-st-n-sess.is-menu .dsh-st-n-time{display:none}.dsh-st-n-ico{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-tertiary,#81858C);padding:0;cursor:pointer}.dsh-st-n-ico:hover{color:var(--dsw-alias-label-primary,inherit)}.dsh-st-n-hover{position:fixed;z-index:4100;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;width:244px;padding:12px 16px;border:0;border-radius:12px;background:#2C2C2E;box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36));color:#fff}.dsh-st-n-hover-title{overflow-wrap:break-word;font-size:14px;line-height:20px;font-weight:400;color:#fff}.dsh-st-n-hover-time{font-size:12px;line-height:16px;color:#cfd3d6}.dsh-st-n-hover-state{display:flex;align-items:center;gap:8px;font-size:12px;line-height:20px;color:#adb2b8}.dsh-st-n-rename{flex:1;min-width:0;margin:0 6px 0 4px;border:.5px solid var(--dsw-alias-border-l4);border-radius:4px;outline:none;background:var(--dsw-alias-button-elevated-fill,rgba(255,255,255,.04));color:inherit;padding:0 2px;font-size:14px;line-height:20px}
168
- .dsh-st-n-group>*+*{margin-top:2px}
169
- .dsh-st-n-group+.dsh-st-n-group{margin-top:4px}
170
- .dsh-st-n-row{box-sizing:border-box}
171
- .dsh-st-n-row .dsh-st-n-acts{height:20px}
172
- .dsh-st-n-row.is-menu{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
173
- .dsh-st-n-row.has-current-session .dsh-st-n-folder{color:var(--dsw-alias-state-business-primary,#4c8dff)}
174
- .dsh-st-n-chevron{display:none;color:var(--dsw-alias-label-caption,#ADB2B8)}
175
- .dsh-st-n-row:hover .dsh-st-n-chevron{display:inline-flex}
176
- .dsh-st-n-row:hover .dsh-st-n-folder{display:none}
177
- .dsh-st-n-arrow{transition:transform .15s var(--ds-ease-in-out,ease)}
178
- .dsh-st-n-arrow.is-open{transform:rotate(90deg)}
179
- .dsh-st-n-project-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}
180
- .dsh-st-n-sess:focus{outline:none}.dsh-st-n-sess:focus-visible:not(.is-on){box-shadow:inset 0 0 0 2px var(--dsw-alias-state-business-primary,#4c8dff)}
181
- .dsh-st-n-dialog-copy{margin:0;color:var(--dsw-alias-label-secondary);font-size:14px;line-height:22px}
182
- .dsh-st-n-dialog-status{margin-top:12px;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
183
- .dsh-st-n-dialog-error{margin-top:12px;color:var(--dsw-alias-state-error-primary,#f85149);font-size:13px;line-height:20px}
155
+ .dsh-st-schedule-tree{display:flex;min-height:0;flex:1;overflow:hidden}
156
+ .dsh-st-schedule-tree>*{min-width:0;flex:1}
157
+ /* \u8BB0\u5F55\u89C6\u56FE\u7684\u5206\u7EC4\u662F\u81EA\u52A8\u5316\u4EFB\u52A1\uFF1A\u4FDD\u7559 \u2026 \u83DC\u5355\u4F9B\u6CE8\u5165\u300C\u4EFB\u52A1\u8BBE\u7F6E\u300D\uFF0C\u53EA\u9690\u85CF\u7EC4\u5934\u65B0\u5EFA\u6309\u94AE\u3002 */
158
+ .dsh-st-schedule-tree [data-row-key^="workspace:dsh-automation-task:"] > span:last-child > :last-child{display:none}
159
+ /* \u6309\u5DE5\u4F5C\u533A/\u5DE5\u4F5C\u533A\u6811\u6A21\u5F0F\u9690\u85CF\u5206\u7EC4\u64CD\u4F5C\u6761\uFF0C\u907F\u514D\u5BF9\u771F\u5B9E\u5DE5\u4F5C\u533A\u91CD\u547D\u540D\u3001\u5220\u9664\u6216\u5F52\u6863\u5168\u90E8\u4F1A\u8BDD\u3002 */
160
+ .dsh-st-schedule-tree[data-mode="workspace"] [data-row-key^="workspace:"] > span:last-child,
161
+ .dsh-st-schedule-tree[data-mode="workspace-tree"] [data-row-key^="workspace:"] > span:last-child{display:none}
162
+ .dsh-st-session-clock{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:var(--dsw-alias-label-tertiary,#8b8f98)}
163
+ .dsh-st-n,.dsh-st-n *{box-sizing:border-box}.dsh-st-n{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding,12px);box-sizing:border-box;display:flex;flex:1;min-width:0;min-height:0;flex-direction:column;padding:0;color:var(--dsw-alias-label-primary,inherit);font:14px/20px inherit;overflow:hidden}
164
+ .dsh-st-n-empty{padding:16px 12px;color:var(--dsw-alias-label-tertiary,#8b8f98);font-size:13px}
165
+ .dsh-st-n-head-btn{cursor:pointer;width:28px;height:28px;min-width:28px;min-height:28px;position:relative;z-index:1;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}
166
+ .dsh-st-n-head-btn:hover,.dsh-st-n-head-btn.is-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));color:var(--dsw-alias-label-primary,inherit)}
184
167
  .dsh-st-modal-action{min-width:72px}
185
168
  .dsh-st-btn-danger:not(:disabled){color:var(--dsw-alias-state-error-primary,#ef7272)}
186
- .dsh-st-n-restore{flex:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#c9cdd4);font:12px/16px inherit;padding:2px 4px;cursor:pointer}
187
- .dsh-st-n-sess.is-archived .dsh-st-n-title,.dsh-st-n-sess.is-archived .dsh-st-n-time{color:var(--dsw-alias-label-caption,#ADB2B8)}
188
- .dsh-st-n-sess .dsh-st-n-title[data-scrolled]{mask-image:linear-gradient(90deg,#0000,#000 12px)}
189
- .dsh-st-n-sess .dsh-st-n-title[data-clipped]{mask-image:linear-gradient(270deg,#0000,#000 12px)}
190
- .dsh-st-n-sess .dsh-st-n-title[data-scrolled][data-clipped]{mask-image:linear-gradient(90deg,#0000,#000 12px calc(100% - 12px),#0000)}
191
169
  .dsh-st-create-dialog{width:min(720px,100%) !important;max-height:100%}
192
170
  .dsh-st-create-content{flex:1;min-height:0;overflow:hidden}
193
171
  .dsh-st-create-content>div:last-child{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
194
- `;function Oo(){let e=document.getElementById(Lo);if(e instanceof HTMLStyleElement)return e.textContent=Po,e.setAttribute("data-plugin",Fn),()=>{};let n=document.createElement("style");return n.id=Lo,n.textContent=Po,n.setAttribute("data-plugin",Fn),document.head.append(n),()=>{n.remove()}}var Do="michengai-plugin-update-ui";function Ho(e){let n=document.getElementById(Do);if(n instanceof HTMLStyleElement){n.getAttribute("data-plugin")===null&&n.setAttribute("data-plugin",Fn);return}let t=document.createElement("style");t.id=Do,t.textContent=e,t.setAttribute("data-plugin",Fn),(document.head??document.documentElement).append(t)}function Yr(e,n){for(let t of n){let s=t.trim();if(s==="")continue;let r=e.find(i=>i.textContent?.replace(/\s+/g," ").trim()===s);if(r!==void 0)return r}}function Qr(e){return e.find(t=>{let s=`${t.textContent??""} ${t.getAttribute("aria-label")??""}`.trim();return/(^|\s)(设置|settings)(\s|$)/i.test(s)})??(e.length===1?e[0]:void 0)}var _n,_o="[data-dcu-settings-trigger]",Fo="[data-dcu-settings-page]",ei="dcu-settings-open-section";function ni(e){let n=document.querySelector(_o);if(n===null)return!1;let t=new CustomEvent(ei,{detail:{labels:[...e]},cancelable:!0});return!n.dispatchEvent(t)}function Wo(e,n,t){if(typeof document>"u"||typeof window>"u"){t?.();return}if(ni(e)){n?.();return}let s=[...document.querySelectorAll('button[aria-haspopup="dialog"]')],r=Qr(s),i=document.querySelector(_o),o=document.querySelector('[role="dialog"]')!==null,a=document.querySelector(Fo)!==null;if(!o&&!a&&r===void 0&&i===null){t?.();return}_n?.(),!o&&!a&&(i??r)?.click();let c,l=!1,h=new MutationObserver(()=>{A()}),m=()=>{l||(l=!0,h.disconnect(),window.clearTimeout(f),c!==void 0&&window.cancelAnimationFrame(c),_n===m&&(_n=void 0))},k=()=>{let p=[...document.querySelectorAll('[role="dialog"] nav button'),...document.querySelectorAll(`${Fo} nav button`)],u=Yr(p,e);return u===void 0?!1:(m(),u.click(),n?.(),!0)},A=()=>{l||c!==void 0||(c=window.requestAnimationFrame(()=>{c=void 0,k()}))},f=window.setTimeout(()=>{k()||(m(),t?.())},1500);h.observe(document.body,{childList:!0,subtree:!0}),_n=m,A()}var Wn="dsh-st-nav-icon-schedule",zn="data-dsh-schedule-nav",gt='[role="dialog"] nav button';function ti(e){return new Set(e().map(n=>n.trim()).filter(n=>n!==""))}function si(e,n){let t=(e.textContent??"").replace(/\s+/g," ").trim();if(!ti(n).has(t)||e.querySelector(":scope > svg")===null||e.getAttribute(zn)==="1"&&e.querySelector(`.${Wn}`)!==null)return!1;if(e.setAttribute(zn,"1"),e.querySelector(`.${Wn}`)===null){let s=document.createElement("span");s.className=Wn,s.setAttribute("aria-hidden","true"),e.prepend(s)}return!0}function oi(e){let n=e.hasAttribute(zn),t=e.querySelector(`.${Wn}`);return!n&&t===null?!1:(e.removeAttribute(zn),t?.remove(),!0)}function zo(e){let n=new Set,t=i=>{si(i,e)&&n.add(i)},s=i=>{if(i instanceof HTMLButtonElement){i.matches(gt)&&t(i);return}for(let o of i.querySelectorAll?.(gt)??[])t(o)};s(document);let r=new MutationObserver(i=>{for(let o of i){let c=(o.target instanceof Element?o.target:o.target.parentElement)?.closest(gt);c instanceof HTMLButtonElement&&t(c);for(let l of o.addedNodes)l instanceof Element&&s(l)}});return r.observe(document.documentElement,{childList:!0,characterData:!0,subtree:!0}),()=>{r.disconnect();for(let i of n)oi(i);n.clear()}}var D=an(require("react"),1),yt=require("react-dom/client"),Oe=require("@deepseek-ai/dsh-client-ui-primitives");function Go(e,n,t){return`dsh plugin${e.trim()===""?"":` --profile ${e.trim()}`} add ${n}@${t} --registry=https://registry.npmjs.org/`}function Vo(e,n){return e.key!=="Escape"?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),n(),!0)}var ri="x-michengai-plugin-update",ii=`
172
+ `;function ir(){let e=document.getElementById(or);if(e instanceof HTMLStyleElement)return e.textContent=rr,e.setAttribute("data-plugin",mt),()=>{};let t=document.createElement("style");return t.id=or,t.textContent=rr,t.setAttribute("data-plugin",mt),document.head.append(t),()=>{t.remove()}}var sr="michengai-plugin-update-ui";function ar(e){let t=document.getElementById(sr);if(t instanceof HTMLStyleElement){t.getAttribute("data-plugin")===null&&t.setAttribute("data-plugin",mt);return}let n=document.createElement("style");n.id=sr,n.textContent=e,n.setAttribute("data-plugin",mt),(document.head??document.documentElement).append(n)}function lr(e){return(e.textContent??"").replace(/\s+/g," ").trim()}function dr(e,t){for(let n of t){let o=n.trim();if(o==="")continue;let r=e.find(i=>lr(i)===o);if(r!==void 0)return r}}function hs(e){return e.find(n=>{let o=`${n.textContent??""} ${n.getAttribute("aria-label")??""}`.trim();return/(^|\s)(设置|settings)(\s|$)/i.test(o)})??(e.length===1?e[0]:void 0)}var ft,cr="[data-dcu-settings-trigger]",gs="[data-dcu-settings-page]",ys="dcu-settings-open-section";function bs(e){let t=document.querySelector(cr);if(t===null)return!1;let n=new CustomEvent(ys,{detail:{labels:[...e]},cancelable:!0});return!t.dispatchEvent(n)}function ws(){return[...document.querySelectorAll('[role="menu"] button')].find(e=>{let t=lr(e);return t.startsWith("\u8BBE\u7F6E")||/^Settings(\s|$)/i.test(t)})}function vs(){return[...document.querySelectorAll('button[aria-haspopup="menu"]')].find(e=>{let t=`${e.getAttribute("aria-label")??""} ${e.textContent??""}`;return/账号|账户|account|user/i.test(t)})}function ks(e){let t=[...document.querySelectorAll('[role="dialog"] nav button'),...document.querySelectorAll(`${gs} nav button`)],n=dr(t,e);return n!==void 0?n:dr([...document.querySelectorAll("nav button")],e)}function Ss(){document.dispatchEvent(new KeyboardEvent("keydown",{key:",",code:"Comma",ctrlKey:!0,altKey:!0,bubbles:!0,cancelable:!0}))}function Xt(e,t,n){if(typeof document>"u"||typeof window>"u"){n?.();return}if(bs(e)){t?.();return}ft?.();let o,r=!1,i=!1,s=!1,l=!1,d=!1,a=!1,f=()=>{r||(r=!0,h.disconnect(),window.clearTimeout(v),o!==void 0&&window.cancelAnimationFrame(o),ft===f&&(ft=void 0))},p=()=>{let u=ks(e);return u===void 0?!1:(f(),u.click(),t?.(),!0)},T=()=>{let u=ws();if(u!==void 0){if(i)return;i=!0,u.click();return}let k=document.querySelector(cr);if(k!==null){if(s)return;s=!0,k.click();return}let g=[...document.querySelectorAll('button[aria-haspopup="dialog"]')].filter(D=>/设置|settings/i.test(`${D.textContent??""} ${D.getAttribute("aria-label")??""}`)),A=hs(g);if(A!==void 0){if(l)return;l=!0,A.click();return}let R=vs();if(R!==void 0){if(d)return;d=!0,R.click();return}a||(a=!0,Ss())},w=()=>{r||o!==void 0||(o=window.requestAnimationFrame(()=>{o=void 0,!p()&&T()}))},h=new MutationObserver(()=>{w()}),v=window.setTimeout(()=>{p()||(f(),n?.())},3e3);h.observe(document.body,{childList:!0,subtree:!0}),ft=f,p()||T(),w()}var ht="dsh-st-nav-icon-schedule",gt="data-dsh-schedule-nav",Jt='[role="dialog"] nav button';function xs(e){return new Set(e().map(t=>t.trim()).filter(t=>t!==""))}function Ts(e,t,n){let o=(e.textContent??"").replace(/\s+/g," ").trim();if(!xs(t).has(o)||e.querySelector(":scope > svg")===null||e.getAttribute(gt)==="1"&&e.querySelector(`.${ht}`)!==null)return!1;if(e.setAttribute(gt,"1"),e.querySelector(`.${ht}`)===null){let r=document.createElement("span");r.className=ht,r.setAttribute("aria-hidden","true"),n!==void 0&&(r.innerHTML=n()),e.prepend(r)}return!0}function As(e){let t=e.hasAttribute(gt),n=e.querySelector(`.${ht}`);return!t&&n===null?!1:(e.removeAttribute(gt),n?.remove(),!0)}function ur(e,t){let n=new Set,o=s=>{Ts(s,e,t)&&n.add(s)},r=s=>{if(s instanceof HTMLButtonElement){s.matches(Jt)&&o(s);return}for(let l of s.querySelectorAll?.(Jt)??[])o(l)};r(document);let i=new MutationObserver(s=>{for(let l of s){let a=(l.target instanceof Element?l.target:l.target.parentElement)?.closest(Jt);a instanceof HTMLButtonElement&&o(a);for(let f of l.addedNodes)f instanceof Element&&r(f)}});return i.observe(document.documentElement,{childList:!0,characterData:!0,subtree:!0}),()=>{i.disconnect();for(let s of n)As(s);n.clear()}}var P=Fe(require("react"),1),Qt=require("react-dom/client"),Te=require("@deepseek-ai/dsh-client-ui-primitives");function pr(e,t,n){return`dsh plugin${e.trim()===""?"":` --profile ${e.trim()}`} add ${t}@${n} --registry=https://registry.npmjs.org/`}function mr(e,t){return e.key!=="Escape"?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),t(),!0)}var Es="x-michengai-plugin-update",Rs=`
195
173
  .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}
196
174
  .dsh-st-modal-action{min-width:72px}
197
175
  .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:0.5px 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:0.5px solid var(--dsw-alias-border-l2,#494949);border-radius:var(--dsw-radius-lg,16px);padding:10px;background:var(--dsw-alias-bg-layer-1,var(--dsw-alias-interactive-bg-hover,transparent))}.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}
@@ -200,6 +178,6 @@ var module = { exports: {} }; var exports = module.exports;
200
178
  @keyframes dsh-st-progress-slide{0%{transform:translateX(-100%)}100%{transform:translateX(300%)}}
201
179
  @media (prefers-reduced-motion:reduce){.dsh-st-update-progress-bar{animation:none;width:100%;opacity:.6}}
202
180
  @media(max-width:560px){.mpi-meta{grid-template-columns:1fr;gap:2px}.mpi-meta dd{margin-bottom:6px}}
203
- `,ai={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"},di={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 Gn(e){return e.toLowerCase().startsWith("en")?di:ai}function li(e,n,t,s){let r=Gn(e),o=n?.profileName==="desktop"?{...r,manualHint:r.manualHintDesktop,restart:r.restartDesktop}:r,a=t!=="idle",c=o.checking,l="";return t==="checking"?c=o.checking:t==="updating"?c=o.updating:s.type==="error"?(c=s.message||o.failed,l="error"):s.type==="restart"?(c=o.restart,l="success"):s.type==="restarting"?(c=o.restarting,l="success"):n===void 0?c=o.checking:n.latestCheckFailed?(c=o.failed,l="error"):!n.canAutoUpdate&&n.updateAvailable?(c=o.unavailable,l="update"):n.updateAvailable?(c=`${o.found}: v${n.latestVersion??o.unknown}`,l="update"):(c=o.latest,l="success"),{copy:o,busy:a,message:c,kind:l,loading:t==="updating",updateLabel:t==="updating"?o.updating:o.auto,disabled:a||n?.canAutoUpdate!==!0||n.updateAvailable!==!0,currentVersion:n===void 0?o.unknown:`v${n.currentVersion}`,latestVersion:n?.latestVersion===void 0?o.unknown:`v${n.latestVersion}`,profileName:n?.profileName??o.unknown,profileRaw:n?.profileName??"",latestRaw:n?.latestVersion??"latest"}}function ci(e,n,t){let s="idle",r=n,i={type:"status"},o=new Set,a=()=>{for(let l of o)l()},c=l=>{r=l,t?.(l)};return{subscribe(l){return o.add(l),()=>{o.delete(l)}},view(l){return li(l,r,s,i)},async check(){if(s==="idle"){s="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{s="idle",a()}}},async update(){if(s==="idle"){s="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{s="idle",a()}}}}}function ui(){Ho(ii)}function pi(e){if(e===null||typeof e!="object")return!1;let n=e;return typeof n.packageName=="string"&&typeof n.currentVersion=="string"&&typeof n.updateAvailable=="boolean"&&typeof n.profileName=="string"&&typeof n.canAutoUpdate=="boolean"&&typeof n.latestCheckFailed=="boolean"&&(n.latestVersion===void 0||typeof n.latestVersion=="string")}async function Bo(e,n,t){let s=t===void 0?{}:{signal:t},r=await fetch(e,n==="GET"?{cache:"no-store",...s}:{method:"POST",headers:{"content-type":"application/json",[ri]:"1"},body:"{}",...s}),i=await r.json();if(!r.ok||!pi(i))throw new Error(i!==null&&typeof i=="object"&&"error"in i&&typeof i.error=="string"?i.error:Gn(document.documentElement.lang).failed);return i}function mi(e){let n=D.default.useRef(null);return D.default.useLayoutEffect(()=>{n.current?.replaceChildren(e.node)},[e.node]),D.default.createElement("span",{ref:n,className:"mpi-icon","aria-hidden":!0})}function fi(e){let n=D.default.useRef(null),[,t]=D.default.useState(0),[s,r]=D.default.useState("idle");D.default.useEffect(()=>e.flow.subscribe(()=>t(h=>h+1)),[e.flow]),D.default.useEffect(()=>{let h=document.documentElement,m=new MutationObserver(()=>t(k=>k+1));return m.observe(h,{attributes:!0,attributeFilter:["lang"]}),()=>m.disconnect()},[]),D.default.useEffect(()=>{e.flow.check()},[e.flow]),D.default.useEffect(()=>{let h=m=>{Vo(m,e.onClose)};return document.addEventListener("keydown",h,!0),()=>document.removeEventListener("keydown",h,!0)},[e.onClose]);let i=document.documentElement.lang,o=e.flow.view(i),a=i.toLowerCase().startsWith("en")?e.enName:e.zhName,c=Go(o.profileRaw,e.packageName,o.latestRaw),l=s==="copied"?o.copy.copied:s==="failed"?o.copy.copyFailed:o.copy.copy;return D.default.createElement(Oe.Modal,{open:!0,className:"dsh-st-update-dialog",title:`${a} ${o.copy.update}`,closeLabel:o.copy.close,onClose:e.onClose,footer:D.default.createElement(D.default.Fragment,null,D.default.createElement(Oe.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:o.busy,onClick:()=>{e.flow.check()}},o.copy.recheck),D.default.createElement(Oe.Button,{variant:"primary",className:"dsh-st-modal-action",disabled:o.disabled,onClick:()=>{e.flow.update()}},o.updateLabel))},D.default.createElement("div",{ref:n},D.default.createElement("p",{className:"mpi-intro"},o.copy.intro),D.default.createElement("dl",{className:"mpi-meta"},D.default.createElement("dt",null,o.copy.current),D.default.createElement("dd",null,D.default.createElement("span",{className:"mpi-mono"},o.currentVersion)),D.default.createElement("dt",null,o.copy.latestLabel),D.default.createElement("dd",{className:"mpi-latest"},D.default.createElement("span",{className:"mpi-mono"},o.latestVersion),D.default.createElement("span",{className:"mpi-status",role:"status","data-kind":o.kind,...o.kind==="update"?{style:{color:"#e8b15a"}}:{}},o.message)),D.default.createElement("dt",null,o.copy.profile),D.default.createElement("dd",null,D.default.createElement("span",{className:"mpi-mono"},o.profileName))),o.busy?D.default.createElement("div",{className:"dsh-st-update-progress",role:"progressbar","aria-busy":"true"},D.default.createElement("div",{className:"dsh-st-update-progress-bar"})):null,D.default.createElement("section",{className:"mpi-manual"},D.default.createElement("h3",null,o.copy.manual),D.default.createElement("p",null,o.copy.manualHint),D.default.createElement("div",{className:"mpi-command"},D.default.createElement("code",null,c),D.default.createElement(Oe.Button,{variant:"outline",size:"sm",disabled:o.busy,onClick:()=>{let h=navigator.clipboard?.writeText(c);if(h===void 0){r("failed");return}h.then(()=>{r("copied"),window.setTimeout(()=>r("idle"),1400)}).catch(()=>r("failed"))}},l)))))}function Uo(e){if(typeof document>"u"||document.body===null)return()=>{};ui();let n=new AbortController,t,s,r,i,o,a,c,l=()=>{r?.unmount(),r=void 0,s=void 0,i=void 0},h=()=>{if(r===void 0)return;i===void 0&&(i=e.createIcon("refresh"));let u=i;r.render(D.default.createElement(Oe.Button,{variant:"outline",size:"sm",onClick:k,icon:D.default.createElement(mi,{node:u})},D.default.createElement("span",{"data-mpi-label":""},Gn(document.documentElement.lang).check)))},m=()=>{a?.unmount(),a=void 0,o?.remove(),o=void 0};function k(){m();let u=document.createElement("div");u.className="mpi-dialog-root",document.body.append(u),o=u;let g=(0,yt.createRoot)(u);a=g,g.render(D.default.createElement(fi,{flow:ci(v=>Bo(e.endpoint,v,n.signal),t,v=>{t=v,A()}),packageName:e.packageName,zhName:e.zhName,enName:e.enName,onClose:m}))}let A=()=>{let u=document.querySelector(e.titleRowSelector);if(u===null)return;let g=u.querySelector("h1,h2");if(g!==null&&t!==void 0){let P=g.querySelector(`.mpi-version[data-package="${e.packageName}"]`);P===null&&(P=document.createElement("span"),P.className="mpi-version",P.dataset.package=e.packageName,g.append(P));let _=`v${t.currentVersion}`;P.textContent!==_&&(P.textContent=_)}s!==void 0&&!s.isConnected&&l();let v=u.querySelector(e.linksSelector);if(v===null)return;let S=v.querySelector(`[data-mpi-check="${e.packageName}"]`);if(S!==null){let P=S.querySelector("[data-mpi-label]");(P===null||P.textContent!==Gn(document.documentElement.lang).check)&&h();return}let C=document.createElement("span");C.dataset.mpiCheck=e.packageName,C.className="mpi-check-host",v.append(C),s=C,r=(0,yt.createRoot)(C),h()},f=async()=>(t=await Bo(e.endpoint,"GET",n.signal),A(),t),p=new MutationObserver(()=>{c===void 0&&(c=window.requestAnimationFrame(()=>{c=void 0,A()}))});return p.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["lang"]}),A(),f().catch(()=>{}),()=>{n.abort(),p.disconnect(),m(),l(),c!==void 0&&window.cancelAnimationFrame(c),document.querySelectorAll(`[data-mpi-check="${e.packageName}"],.mpi-version[data-package="${e.packageName}"]`).forEach(u=>u.remove())}}var hi="dsh-automation-client",gi=["slots","locale","connection","sessions"],yi={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 vi(e){let n=document.createElement("span"),t=document.createElementNS("http://www.w3.org/2000/svg","svg");t.setAttribute("viewBox","0 0 16 16"),t.setAttribute("width","16"),t.setAttribute("height","16"),t.setAttribute("fill","none"),t.setAttribute("stroke","currentColor"),t.setAttribute("stroke-width","1.5"),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round"),t.setAttribute("aria-hidden","true");for(let s of yi[e]){let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",s),t.append(r)}return n.append(t),n}function bi(e){return typeof e=="function"}function wi(e){return typeof e=="function"}function xi(e){e.effect(()=>Oo(),"dsh-automation: styles"),e.effect(()=>e.locale.register(Ue,{zh:to,en:no}),"dsh-automation: locale"),e.effect(()=>Uo({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:vi}),"dsh-automation: plugin update ui");let n=e.locale.bind(Ue),t=e.locale.bind("permission.access"),s=e.locale.bind("model"),r=Zs(e.connection.rpc),i=async()=>{let a=await Zn(e);return a===void 0?void 0:(await qn(e,a),(await r.registerWorkspace(a)).id)},o=a=>{ut(a),Wo([n("tab"),"Scheduled tasks","\u5B9A\u65F6\u4EFB\u52A1"],()=>{ut(a)})};e.effect(()=>qs(r,()=>e.sessions),"dsh-automation: session sync"),e.effect(()=>zo(()=>[n("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:Ue,label:()=>n("tab"),icon:"schedule",inject:()=>({createWorkspace:a=>qn(e,a.path),pickDirectory:()=>Zn(e),permissionT:t,modelT:s})},function(c){return(0,He.createElement)(eo,{t:n,permissionT:t,modelT:s,runtime:r,...c.close===void 0?{}:{closeSettings:c.close},addWorkspace:i})})),e.slots.inject("sidebar.schedule",()=>e.slots.register({name:"sidebar.schedule",id:"dsh-automation-schedule",order:10,locale:Ue,label:()=>n("sidebar.tab")},function(c){return(0,He.createElement)(Eo,{t:n,runtime:r,openSession:vt(e,r,c.openSession),openTaskSettings:o,...c.view===void 0?{}:{view:c.view},...c.showViewSwitch===void 0?{}:{showViewSwitch:c.showViewSwitch}})})),e.slots.inject("sidebar.workspaces",()=>{let a,c,l,h,m,k=()=>{},A=!1,f,p=()=>{queueMicrotask(()=>window.dispatchEvent(new Event("dsh-native-sidebar-change")))},u=()=>{f!==void 0&&(window.clearInterval(f),f=void 0)},g=()=>{if(u(),k(),k=()=>{},m=void 0,a!==void 0){c!==void 0&&a.component===l&&(a.component=c);let U=a;U.__dshNativeTabs===h&&delete U.__dshNativeTabs,p()}a=void 0,c=void 0,l=void 0,h=void 0},v=(U,G)=>{let $=io(U);return $===void 0?!1:(m!==$&&(k(),k=()=>{},m=$),$.getTabs().some(O=>O.id==="schedule")||(k=$.insert({id:"schedule",label:n("sidebar.tab"),order:30,matchSession:O=>O.startsWith(_e),render:O=>{let K=typeof O.openSession=="function"?O.openSession:typeof O.open=="function"?O.open:G,B=vt(e,r,K);return(0,He.createElement)(Dn,{t:n,runtime:r,openSession:B,...bi(O.useSessions)?{useSessions:O.useSessions}:{},...wi(O.useWorkspaces)?{useWorkspaces:O.useWorkspaces}:{},...typeof O.renderSlot=="function"?{renderSlot:O.renderSlot}:{},...typeof O.useSessionStatus=="function"?{useSessionStatus:O.useSessionStatus}:{},...Rn(O),openTaskSettings:o})}})),!0)},S=()=>{let U=bt(e,"sidebar.workspaces");for(let G of U){let $=G;if(v(G)||v($.component))return!0}return k(),k=()=>{},m=void 0,!1},C=()=>{if(S()){u();return}if(f!==void 0)return;let U=0;f=window.setInterval(()=>{U+=1,(S()||U>=20)&&u()},250)},P=()=>{if(!A){A=!0;try{let re=function(x){let H=vt(e,r,x.openSession??x.open);return(0,He.createElement)(Mo,{t:n,runtime:r,hostProps:x,openSession:H,openTaskSettings:o,tabRegistry:J,...x.wide===void 0?{}:{wide:x.wide},...x.useSessions===void 0?{}:{useSessions:x.useSessions},...x.useWorkspaces===void 0?{}:{useWorkspaces:x.useWorkspaces},...x.renderSlot===void 0?{}:{renderSlot:x.renderSlot},officialTree:ne})};var U=re;if(ts(bt(e,"sidebar"))){g();return}let G=bt(e,"sidebar.workspaces"),$=G.find(x=>x?.component!==void 0);if(a!==void 0&&($!==a||$.component!==l)&&g(),$===a&&$?.component===l&&l!==void 0){C();return}if($===void 0){g();return}let O=ps(G),K=O?.component;if(K!==void 0&&ao(K)){C();return}if(O?.component===void 0)return;let B=us(O.component);if(B===void 0)return;c=B;let J=oo(c);h=J,pt(O,J);let ee=re;ee.displayName="AutomationNativeWorkspaceShell",ee.__dshNativeTabHost=!0,ee.__dshAutomationWrapped=!0,ee.__dshAutomationOriginal=c;let ne=c;pt(ee,J),O.component=ee,l=ee,a=O,C(),p()}catch(G){console.warn("[dsh-automation] \u5305\u88F9\u5B98\u65B9\u4EFB\u52A1\u6811\u5931\u8D25",G)}finally{A=!1}}};P();let _=typeof e.slots.subscribe=="function"?e.slots.subscribe("sidebar.workspaces",P):()=>{},oe=e.slots.subscribe?.("sidebar",P)??(()=>{});return window.addEventListener("dsh-native-sidebar-change",P),C(),()=>{_(),oe(),window.removeEventListener("dsh-native-sidebar-change",P),g()}}),e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-automation-prefill",order:80,locale:Ue},Si))}function vt(e,n,t){return s=>{let r=rs(e);ds({id:s,adopt:i=>n.adoptSession(i),listed:i=>{let o=e.sessions?.list?.getSnapshot();return(o?.ids??[]).includes(i)||o?.byId?.[i]!==void 0},...e.sessions?.refresh===void 0?{}:{refresh:()=>e.sessions.refresh()},...is(r)?{openRuntime:i=>{as(r,i)}}:{},...t===void 0?{}:{openHost:t}})}}function Si(e){return(0,He.useEffect)(()=>{let n=t=>{if(!(t===null||t==="")){if(e.inputActions!==void 0){e.inputActions.setDraft(t),rt();return}Us(t)&&rt()}};return n(Vs()),Bs(n)},[e.inputActions]),null}function bt(e,n){try{return(e.slots.entriesOfSlot??e.slots.entries)?.call(e.slots,n)??[]}catch{return[]}}
181
+ `,Is={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"},Ns={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 yt(e){return e.toLowerCase().startsWith("en")?Ns:Is}function Cs(e,t,n,o){let r=yt(e),s=t?.profileName==="desktop"?{...r,manualHint:r.manualHintDesktop,restart:r.restartDesktop}:r,l=n!=="idle",d=s.checking,a="";return n==="checking"?d=s.checking:n==="updating"?d=s.updating:o.type==="error"?(d=o.message||s.failed,a="error"):o.type==="restart"?(d=s.restart,a="success"):o.type==="restarting"?(d=s.restarting,a="success"):t===void 0?d=s.checking:t.latestCheckFailed?(d=s.failed,a="error"):!t.canAutoUpdate&&t.updateAvailable?(d=s.unavailable,a="update"):t.updateAvailable?(d=`${s.found}: v${t.latestVersion??s.unknown}`,a="update"):(d=s.latest,a="success"),{copy:s,busy:l,message:d,kind:a,loading:n==="updating",updateLabel:n==="updating"?s.updating:s.auto,disabled:l||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 Os(e,t,n){let o="idle",r=t,i={type:"status"},s=new Set,l=()=>{for(let a of s)a()},d=a=>{r=a,n?.(a)};return{subscribe(a){return s.add(a),()=>{s.delete(a)}},view(a){return Cs(a,r,o,i)},async check(){if(o==="idle"){o="checking",i={type:"status"},l();try{d(await e("GET")),i={type:"status"}}catch(a){i={type:"error",message:a instanceof Error?a.message:""}}finally{o="idle",l()}}},async update(){if(o==="idle"){o="updating",i={type:"status"},l();try{let a=await e("POST");d(a),i={type:a.autoReload===!0?"restarting":"restart"}}catch(a){i={type:"error",message:a instanceof Error?a.message:""}}finally{o="idle",l()}}}}}function Ms(){ar(Rs)}function Ps(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 fr(e,t,n){let o=n===void 0?{}:{signal:n},r=await fetch(e,t==="GET"?{cache:"no-store",...o}:{method:"POST",headers:{"content-type":"application/json",[Es]:"1"},body:"{}",...o}),i=await r.json();if(!r.ok||!Ps(i))throw new Error(i!==null&&typeof i=="object"&&"error"in i&&typeof i.error=="string"?i.error:yt(document.documentElement.lang).failed);return i}function Ds(e){let t=P.default.useRef(null);return P.default.useLayoutEffect(()=>{t.current?.replaceChildren(e.node)},[e.node]),P.default.createElement("span",{ref:t,className:"mpi-icon","aria-hidden":!0})}function _s(e){let t=P.default.useRef(null),[,n]=P.default.useState(0),[o,r]=P.default.useState("idle");P.default.useEffect(()=>e.flow.subscribe(()=>n(f=>f+1)),[e.flow]),P.default.useEffect(()=>{let f=document.documentElement,p=new MutationObserver(()=>n(T=>T+1));return p.observe(f,{attributes:!0,attributeFilter:["lang"]}),()=>p.disconnect()},[]),P.default.useEffect(()=>{e.flow.check()},[e.flow]),P.default.useEffect(()=>{let f=p=>{mr(p,e.onClose)};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[e.onClose]);let i=document.documentElement.lang,s=e.flow.view(i),l=i.toLowerCase().startsWith("en")?e.enName:e.zhName,d=pr(s.profileRaw,e.packageName,s.latestRaw),a=o==="copied"?s.copy.copied:o==="failed"?s.copy.copyFailed:s.copy.copy;return P.default.createElement(Te.Modal,{open:!0,className:"dsh-st-update-dialog",title:`${l} ${s.copy.update}`,closeLabel:s.copy.close,onClose:e.onClose,footer:P.default.createElement(P.default.Fragment,null,P.default.createElement(Te.Button,{variant:"outline",className:"dsh-st-modal-action",disabled:s.busy,onClick:()=>{e.flow.check()}},s.copy.recheck),P.default.createElement(Te.Button,{variant:"primary",className:"dsh-st-modal-action",disabled:s.disabled,onClick:()=>{e.flow.update()}},s.updateLabel))},P.default.createElement("div",{ref:t},P.default.createElement("p",{className:"mpi-intro"},s.copy.intro),P.default.createElement("dl",{className:"mpi-meta"},P.default.createElement("dt",null,s.copy.current),P.default.createElement("dd",null,P.default.createElement("span",{className:"mpi-mono"},s.currentVersion)),P.default.createElement("dt",null,s.copy.latestLabel),P.default.createElement("dd",{className:"mpi-latest"},P.default.createElement("span",{className:"mpi-mono"},s.latestVersion),P.default.createElement("span",{className:"mpi-status",role:"status","data-kind":s.kind,...s.kind==="update"?{style:{color:"#e8b15a"}}:{}},s.message)),P.default.createElement("dt",null,s.copy.profile),P.default.createElement("dd",null,P.default.createElement("span",{className:"mpi-mono"},s.profileName))),s.busy?P.default.createElement("div",{className:"dsh-st-update-progress",role:"progressbar","aria-busy":"true"},P.default.createElement("div",{className:"dsh-st-update-progress-bar"})):null,P.default.createElement("section",{className:"mpi-manual"},P.default.createElement("h3",null,s.copy.manual),P.default.createElement("p",null,s.copy.manualHint),P.default.createElement("div",{className:"mpi-command"},P.default.createElement("code",null,d),P.default.createElement(Te.Button,{variant:"outline",size:"sm",disabled:s.busy,onClick:()=>{let f=navigator.clipboard?.writeText(d);if(f===void 0){r("failed");return}f.then(()=>{r("copied"),window.setTimeout(()=>r("idle"),1400)}).catch(()=>r("failed"))}},a)))))}function hr(e){if(typeof document>"u"||document.body===null)return()=>{};Ms();let t=new AbortController,n,o,r,i,s,l,d,a=()=>{r?.unmount(),r=void 0,o=void 0,i=void 0},f=()=>{if(r===void 0)return;i===void 0&&(i=e.createIcon("refresh"));let u=i;r.render(P.default.createElement(Te.Button,{variant:"outline",size:"sm",onClick:T,icon:P.default.createElement(Ds,{node:u})},P.default.createElement("span",{"data-mpi-label":""},yt(document.documentElement.lang).check)))},p=()=>{l?.unmount(),l=void 0,s?.remove(),s=void 0};function T(){p();let u=document.createElement("div");u.className="mpi-dialog-root",document.body.append(u),s=u;let k=(0,Qt.createRoot)(u);l=k,k.render(P.default.createElement(_s,{flow:Os(g=>fr(e.endpoint,g,t.signal),n,g=>{n=g,w()}),packageName:e.packageName,zhName:e.zhName,enName:e.enName,onClose:p}))}let w=()=>{let u=document.querySelector(e.titleRowSelector);if(u===null)return;let k=u.querySelector("h1,h2");if(k!==null&&n!==void 0){let D=k.querySelector(`.mpi-version[data-package="${e.packageName}"]`);D===null&&(D=document.createElement("span"),D.className="mpi-version",D.dataset.package=e.packageName,k.append(D));let I=`v${n.currentVersion}`;D.textContent!==I&&(D.textContent=I)}o!==void 0&&!o.isConnected&&a();let g=u.querySelector(e.linksSelector);if(g===null)return;let A=g.querySelector(`[data-mpi-check="${e.packageName}"]`);if(A!==null){let D=A.querySelector("[data-mpi-label]");(D===null||D.textContent!==yt(document.documentElement.lang).check)&&f();return}let R=document.createElement("span");R.dataset.mpiCheck=e.packageName,R.className="mpi-check-host",g.append(R),o=R,r=(0,Qt.createRoot)(R),f()},h=async()=>(n=await fr(e.endpoint,"GET",t.signal),w(),n),v=new MutationObserver(()=>{d===void 0&&(d=window.requestAnimationFrame(()=>{d=void 0,w()}))});return v.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["lang"]}),w(),h().catch(()=>{}),()=>{t.abort(),v.disconnect(),p(),a(),d!==void 0&&window.cancelAnimationFrame(d),document.querySelectorAll(`[data-mpi-check="${e.packageName}"],.mpi-version[data-package="${e.packageName}"]`).forEach(u=>u.remove())}}var Ls="dsh-automation-client",Hs=["slots","locale","connection","sessions"],Ws={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 Fs(e){let t=document.createElement("span"),n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","16"),n.setAttribute("height","16"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.5"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true");for(let o of Ws[e]){let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",o),n.append(r)}return t.append(n),t}function Bs(e){return typeof e=="function"}function zs(e){return typeof e=="function"}function js(e){e.effect(()=>ir(),"dsh-automation: styles"),e.effect(()=>e.locale.register(Ne,{zh:Do,en:Po}),"dsh-automation: locale"),e.effect(()=>hr({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:Fs}),"dsh-automation: plugin update ui");let t=e.locale.bind(Ne),n=e.locale.bind("permission.access"),o=e.locale.bind("model"),r=Eo(e.connection.rpc),i=async()=>{let d=await St(e);return d===void 0?void 0:(await kt(e,d),(await r.registerWorkspace(d)).id)},s=d=>{zt(d),Xt([t("tab"),"Scheduled tasks","\u5B9A\u65F6\u4EFB\u52A1"],()=>{zt(d)},()=>{rt(window.sessionStorage)})},l=()=>{qt(),Xt([t("tab"),"Scheduled tasks","\u5B9A\u65F6\u4EFB\u52A1"],()=>{qt()},()=>{it(window.sessionStorage)})};e.effect(()=>Ao(r,()=>e.sessions),"dsh-automation: session sync"),e.effect(()=>ur(()=>[t("tab"),"Scheduled tasks","\u5B9A\u65F6\u4EFB\u52A1"],()=>Ce(ue,16)),"dsh-automation: settings icon"),e.slots.inject("sidebar.session.row.leading",()=>e.slots.register({name:"sidebar.session.row.leading",id:"dsh-automation-session-clock",order:20},function(a){let f=(0,re.useSyncExternalStore)(r.source.subscribe,()=>r.source.getSnapshot().snapshot?.runs,()=>{}),p=(0,re.useMemo)(()=>Me(f),[f]);return a.sessionId===void 0||!p.has(a.sessionId)?null:(0,re.createElement)("span",{className:"dsh-st-session-clock","aria-hidden":"true"},(0,re.createElement)(ue,{size:16}))})),e.slots.inject("settings.section",()=>e.slots.register({name:"settings.section",id:"scheduled-tasks",order:35,locale:Ne,label:()=>t("tab"),icon:"schedule",inject:()=>({createWorkspace:d=>kt(e,d.path),pickDirectory:()=>St(e),permissionT:n,modelT:o})},function(a){return(0,re.createElement)(Mo,{t,permissionT:n,modelT:o,runtime:r,...a.close===void 0?{}:{closeSettings:a.close},addWorkspace:i})})),e.slots.inject("sidebar.schedule",()=>e.slots.register({name:"sidebar.schedule",id:"dsh-automation-schedule-overview",order:10,locale:Ne,inject:()=>({openTaskSettings:s,openCreateTask:l})},function(a){let f=(0,re.useSyncExternalStore)(r.source.subscribe,r.source.getSnapshot,r.source.getSnapshot);return(0,re.createElement)(ct,{t,automations:f.snapshot?.automations??[],...f.snapshot?.serverNow===void 0?{}:{serverNow:f.snapshot.serverNow},openTaskSettings:a.openTaskSettings??s,openCreateTask:a.openCreateTask??l,onToggleAutomation:(p,T)=>r.mutateAutomation(p,T)})})),e.slots.inject("sidebar.workspaces",()=>{let d,a,f,p,T,w=()=>{},h=()=>{},v=!1,u,k=()=>{queueMicrotask(()=>window.dispatchEvent(new Event("dsh-native-sidebar-change")))},g=()=>{u!==void 0&&(window.clearInterval(u),u=void 0)},A=()=>{if(g(),w(),w=()=>{},h(),h=()=>{},T=void 0,d!==void 0){a!==void 0&&d.component===f&&(d.component=a);let z=d;z.__dshNativeTabs===p&&delete z.__dshNativeTabs,k()}d=void 0,a=void 0,f=void 0,p=void 0},R=z=>!Array.isArray(z.sessionOpeners)||typeof z.addSessionOpener!="function"?()=>{}:z.sessionOpeners.some(L=>L.id==="automation")?()=>{}:z.addSessionOpener({id:"automation",order:10,matchSession:L=>L.startsWith(Ae)?!0:r.source.getSnapshot().snapshot?.runs?.some(j=>j.sessionId===L)===!0,open:(L,C)=>{en(e,r,C)(L)}}),D=z=>{let L=zo(z);return L===void 0?!1:(T!==L&&(w(),w=()=>{},h(),h=()=>{},T=L),Array.isArray(L.sessionOpeners)&&!L.sessionOpeners.some(C=>C.id==="automation")&&(h=R(L)),L.getTabs().some(C=>C.id==="schedule")||(w=L.insert({id:"schedule",label:t("sidebar.tab"),order:30,matchSession:C=>C.startsWith(Ae),render:C=>{let j=typeof C.openSession=="function"?C.openSession:typeof C.open=="function"?C.open:void 0,G=en(e,r,j),Y=typeof L.officialTree=="function"?L.officialTree:void 0;return(0,re.createElement)(Yt,{t,runtime:r,...Y===void 0?{}:{officialTree:Y},hostProps:C,openSession:G,...s===void 0?{}:{openTaskSettings:s},...l===void 0?{}:{openCreateTask:l},...Bs(C.useSessions)?{useSessions:C.useSessions}:{},...zs(C.useWorkspaces)?{useWorkspaces:C.useWorkspaces}:{},...typeof C.wide=="boolean"?{wide:C.wide}:{}})}})),!0)},I=()=>{let z=tn(e,"sidebar.workspaces");for(let L of z){let C=L;if(D(L)||D(C.component))return!0}return w(),w=()=>{},h(),h=()=>{},T=void 0,!1},H=()=>{if(I()){g();return}if(u!==void 0)return;let z=0;u=window.setInterval(()=>{z+=1,(I()||z>=20)&&g()},250)},B=()=>{if(!v){v=!0;try{let Q=function(E){let K=en(e,r,E.openSession??E.open);return(0,re.createElement)(nr,{t,runtime:r,hostProps:E,openSession:K,openTaskSettings:s,openCreateTask:l,tabRegistry:Y,...E.wide===void 0?{}:{wide:E.wide},...E.useSessions===void 0?{}:{useSessions:E.useSessions},...E.useWorkspaces===void 0?{}:{useWorkspaces:E.useWorkspaces},officialTree:le})};var z=Q;if(_n(tn(e,"sidebar"))){A();return}let L=tn(e,"sidebar.workspaces"),C=L.find(E=>E?.component!==void 0);if(d!==void 0&&(C!==d||C.component!==f)&&A(),C===d&&C?.component===f&&f!==void 0){H();return}if(C===void 0){A();return}if(C.component!==f&&jo(C.component)){H();return}let j=Vn(L);if(j?.component===void 0)return;let G=Kn(j.component);if(G===void 0)return;a=G;let Y=Fo(a);p=Y,$t(j,Y);let O=Q;O.displayName="DshNativeTabWorkspaceShell",O.__dshNativeTabHost=!0,O.__dshNativeTabWrapped=!0,O.__dshNativeTabOriginal=a,O.__dshNativeTabOwner="automation",O.__dshAutomationWrapped=!0,O.__dshAutomationOriginal=a;let le=a;$t(O,Y),j.component=O,f=O,d=j,H(),k()}catch(L){console.warn("[dsh-automation] \u5305\u88F9\u5B98\u65B9\u4EFB\u52A1\u6811\u5931\u8D25",L)}finally{v=!1}}};B();let U=typeof e.slots.subscribe=="function"?e.slots.subscribe("sidebar.workspaces",B):()=>{},ie=e.slots.subscribe?.("sidebar",B)??(()=>{});return window.addEventListener("dsh-native-sidebar-change",B),H(),()=>{U(),ie(),window.removeEventListener("dsh-native-sidebar-change",B),A()}}),e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-automation-prefill",order:80,locale:Ne},qs))}function en(e,t,n){let o;return r=>{let i=o??=Bn(e);qn({id:r,adopt:s=>t.adoptSession(s),listed:s=>{let l=e.sessions?.list?.getSnapshot();return(l?.ids??[]).includes(s)||l?.byId?.[s]!==void 0},...e.sessions?.refresh===void 0?{}:{refresh:()=>e.sessions.refresh()},...zn(i)?{openRuntime:s=>{jn(i,s)}}:{},...n===void 0?{}:{openHost:n}})}}function qs(e){return(0,re.useEffect)(()=>{let t=n=>{if(!(n===null||n==="")){if(e.inputActions!==void 0){e.inputActions.setDraft(n),_t();return}ko(n)&&_t()}};return t(wo()),vo(t)},[e.inputActions]),null}function tn(e,t){try{return(e.slots.entriesOfSlot??e.slots.entries)?.call(e.slots,t)??[]}catch{return[]}}
204
182
  return module.exports; } });
205
183
  //# sourceMappingURL=client.js.map