dsh-taskboard 0.6.4 → 0.6.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/README.md +7 -0
- package/lib/client.js +10 -1
- package/package.json +4 -2
- package/src/client/styles.ts +9 -0
- package/src/shared/version.ts +1 -1
package/README.md
CHANGED
|
@@ -210,6 +210,9 @@ agent:
|
|
|
210
210
|
**GitHub 源安装报 prepare 被阻止?**
|
|
211
211
|
pnpm 的构建授权——按报错把 key 加进 profile 的 `pnpm-workspace.yaml` `allowBuilds` 后重跑;或改用 npm 源(预构建,无此步骤)。
|
|
212
212
|
|
|
213
|
+
**和 dsh-better-sidebar 并存,看板顶栏右侧按钮被遮住?**
|
|
214
|
+
0.6.5 起已自动避让:better-sidebar 收起时其右上角常驻按钮簇(展开底部面板 / 展开侧边栏)占据视口右上 10~70px,看板激活时会为工具条右侧预留这块区域(镜像 better-sidebar 对 DSH 原生会话头的避让契约),任何窗口宽度都不再重叠;未安装 better-sidebar 或其侧栏展开时无任何影响([#19](https://github.com/cloader/dsh-taskboard/issues/19))。
|
|
215
|
+
|
|
213
216
|
## 开发
|
|
214
217
|
|
|
215
218
|
```bash
|
|
@@ -223,6 +226,10 @@ node scripts/screenshot.mjs # 重新生成 img/ 截图(需本机 Edge)
|
|
|
223
226
|
|
|
224
227
|
## 升级日志
|
|
225
228
|
|
|
229
|
+
### 0.6.5
|
|
230
|
+
|
|
231
|
+
- **修复:与 dsh-better-sidebar 并存时看板顶栏右侧按钮被其右上角常驻按钮簇遮挡([#19](https://github.com/cloader/dsh-taskboard/issues/19))**:看板激活且 better-sidebar 右栏收起时,工具条右侧预留 62px 让出其「展开底部面板 / 展开侧边栏」按钮簇所占的视口右上角(10~70px),作用于全部换行行,任何窗口宽度不再重叠;未装 better-sidebar 或其右栏展开时规则零生效,纯 CSS 修复
|
|
232
|
+
|
|
226
233
|
### 0.6.4
|
|
227
234
|
|
|
228
235
|
- **修复:界面语言可能被永久定型为英文([#16](https://github.com/cloader/dsh-taskboard/issues/16))**:client 激活早于 locale 服务时,一次性回退检测读到服务端渲染的静态 `<html lang="en">` 后不再重试——现在会监听 `<html lang>` 变化即时跟随,并短暂轮询 locale 服务、出现即接管
|
package/lib/client.js
CHANGED
|
@@ -79,6 +79,15 @@ window.__ModuleLoader__.load({
|
|
|
79
79
|
|
|
80
80
|
.dsh-atb-board { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 12px 16px; gap: 10px; box-sizing: border-box; }
|
|
81
81
|
.dsh-atb-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
|
82
|
+
/* 0.6.5 / #19: dsh-better-sidebar 钉在视口右上角的常驻按钮簇(2×28px + 4px
|
|
83
|
+
* gap,right:10px → 占视口右边 10~70px)。它对 DSH 原生会话头的避让契约是
|
|
84
|
+
* body[data-dsh-sidebar-collapsed] 下给 header padding-right:78px(其
|
|
85
|
+
* layout.css);看板隐藏该会话头并占据同一条顶带,工具条右端便沉到簇下面。
|
|
86
|
+
* 镜像避让:面板收起(body 属性存在)且看板激活时,工具条右侧预留
|
|
87
|
+
* 70px 足迹 + 8px 间隙 − 16px(.dsh-atb-board 自身 padding)= 62px;
|
|
88
|
+
* padding 作用于容器所有换行行,配合 flex-wrap,任何宽度都不进簇区。
|
|
89
|
+
* 未装 better-sidebar 或面板展开时属性不存在,规则零生效。 */
|
|
90
|
+
html[data-dsh-atb-active] body[data-dsh-sidebar-collapsed] .dsh-atb-toolbar { padding-right: 62px; }
|
|
82
91
|
.dsh-atb-title { font-size: 15px; font-weight: 600; margin: 0; }
|
|
83
92
|
.dsh-atb-count { font-size: 12px; color: var(--dsw-text-secondary, gray); }
|
|
84
93
|
.dsh-atb-ver {
|
|
@@ -914,7 +923,7 @@ window.__ModuleLoader__.load({
|
|
|
914
923
|
.dsh-atb-prompt-tip code { font-size: 10.5px; padding: 1px 4px; border-radius: 4px; background: rgba(128,128,128,.14); }
|
|
915
924
|
`,document.head.append(e)),e.dataset.plugin=`dsh-taskboard`,e.dataset.pluginCss=`dsh-taskboard/styles`}function se(){let e=document.querySelector(`[data-pane="sidebar"], [class*="sidebarCol"], .dshDesktopUpstreamSidebar, .dshDesktopSidebarSurface`);if(e!==null)return e.querySelector(`[class*="logoRow"]`)?.parentElement??e.firstElementChild}function ce(e){let t=e.querySelector(`button[class*="newSession"]`);if(t!==null)return t;for(let t of e.children)if(t instanceof HTMLButtonElement&&!t.matches(`[data-dsh-atb-entry]`))return t;let n=e.querySelector(`button[aria-label="新建会话"], button[aria-label="New Session"], button[aria-label*="新会话"], button[aria-label*="new session" i]`);return n===null?Array.from(e.querySelectorAll(`button`)).find(e=>!e.matches(`[data-dsh-atb-entry]`)&&/新会话|新建会话|new session/i.test(e.textContent??``)):n}function B(e){let t=document.createElement(`button`);return t.type=`button`,t.dataset.dshAtbEntry=``,t.className=`dsh-atb-entry`,t.setAttribute(`aria-label`,L(`shared.entry.aria`)),t.innerHTML=`<span class="dsh-atb-entry-icon"><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="2" width="12" height="12" rx="2"/><path d="M6 2v12M10 2v12"/></svg></span><span class="dsh-atb-entry-label">${L(`shared.entry.label`)}</span><span class="dsh-atb-entry-stats"></span>`,t.addEventListener(`click`,()=>{e.toggleBoard()}),t}function V(e){let t=0,n=0,r=0;for(let i of e.getSnapshot().ledger.tasks)i.trashedAt===void 0&&(i.status===`todo`?t++:i.status===`in_progress`?n++:i.status===`in_review`&&r++);return[t,n,r]}function H(e,t){let n=String(t);if(e.dataset.value===n)return;let r=e.dataset.value;if(e.dataset.value=n,e.style.minWidth=`${n.length}ch`,r===void 0){e.textContent=n;return}e.dataset.busy===`1`&&(e.dataset.busy=``,e.dataset.anim=``);let i=document.createElement(`span`);i.className=`dsh-atb-rn`,i.textContent=r;let a=document.createElement(`span`);a.className=`dsh-atb-rn dsh-atb-rn-next`,a.textContent=n,e.replaceChildren(i,a),e.dataset.dir=t>Number(r)?`up`:`down`,e.dataset.busy=`1`,requestAnimationFrame(()=>{e.dataset.anim=`1`});let o=()=>{e.dataset.busy===`1`&&(e.dataset.busy=``,e.dataset.anim=``,e.textContent=e.dataset.value??``)};e.addEventListener(`transitionend`,o,{once:!0}),setTimeout(o,400)}function U(e,t){let n=e.querySelector(`.dsh-atb-entry-stats`);if(n===null)return()=>{};let r=[`todo`,`in_progress`,`in_review`],i=[];for(let e=0;e<3;e++){if(e>0){let e=document.createElement(`span`);e.className=`dsh-atb-entry-sep`,e.textContent=`|`,n.append(e)}let t=document.createElement(`span`);t.className=`dsh-atb-roll`,t.dataset.stat=r[e],n.append(t),i.push(t)}return()=>{let[e,r,a]=V(t);H(i[0],e),H(i[1],r),H(i[2],a),n.title=L(`shared.stats.title`,{todo:e,doing:r,review:a})}}function le(e,t){let n=ce(e);if(n===void 0)return!1;if(t.parentElement!==e){let r=n.closest(`[class*="logoRow"]`),i=r!==null&&r.parentElement===e?r:n,a=Array.from(e.children).filter(e=>e instanceof HTMLElement&&e.matches(`[data-dsh-atb-entry], [data-dsh-taskboard-entry], [data-dsh-ssh-entry]`)),o=a.length>0?a[0]??null:i.nextElementSibling??null;e.insertBefore(t,o)}return!0}function W(e){let t=B(e),n={attempts:0,found:!1,placed:!1},r=globalThis.location?.hostname;(r===`localhost`||r===`127.0.0.1`)&&(window.__atbDebug=n);let i,a=!1,o=()=>{if(n.attempts++,i!==void 0&&!i.isConnected&&(c.disconnect(),i=void 0,a=!1),a){if(document.body.contains(t))return;c.disconnect(),i=void 0,a=!1}i??=se(),i!==void 0&&(n.found=ce(i)!==void 0,a=le(i,t),n.placed=a,a&&c.observe(i,{childList:!0,subtree:!0}))},s=new MutationObserver(()=>{o()});s.observe(document.body,{childList:!0,subtree:!0});let c=new MutationObserver(()=>{if(i===void 0||!i.isConnected){a=!1,o();return}i.contains(t)||(a=le(i,t))}),l=setInterval(()=>{o()},2e3),u=U(t,e),d=()=>{e.getSnapshot().boardOpen?t.dataset.active=`true`:delete t.dataset.active,u()},f=e.subscribe(d),p=I.subscribe(()=>{t.setAttribute(`aria-label`,L(`shared.entry.aria`));let e=t.querySelector(`.dsh-atb-entry-label`);e!==null&&(e.textContent=L(`shared.entry.label`)),u()});return d(),o(),()=>{clearInterval(l),s.disconnect(),c.disconnect(),p(),f(),t.remove()}}const G={backlog:`status.column.backlog`,todo:`status.column.todo`,in_progress:`status.column.in_progress`,in_review:`status.column.in_review`,done:`status.column.done`,canceled:`status.column.canceled`,archived:`status.column.archived`},K={backlog:`status.pill.backlog`,todo:`status.pill.todo`,in_progress:`status.pill.in_progress`,in_review:`status.pill.in_review`,done:`status.pill.done`,canceled:`status.pill.canceled`,archived:`status.pill.archived`},q={backlog:`status.move.backlog`,todo:`status.move.todo`,in_progress:`status.move.in_progress`,in_review:`status.move.in_review`,done:`status.move.done`,canceled:`status.move.canceled`,archived:`status.move.archived`},ue={urgent:`urgency.urgent`,normal:`urgency.normal`,relaxed:`urgency.relaxed`},de={running:`outcome.running`,succeeded:`outcome.succeeded`,failed:`outcome.failed`,cancelled:`outcome.cancelled`};function J(e){if(e===void 0)return``;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function fe(e,t){return e.status===`in_progress`&&e.claimedAt!==void 0&&t-e.claimedAt>18e5}const pe=`application/x-dsh-atb-task`;function me(e){return e===void 0?``:e.replace(/^session-(taskboard-)?/,``).slice(0,8)}function Y({task:t,controller:r,draggable:i=!1,now:a,onAlert:o}){let s=R(),[c,l]=(0,e.useState)(!1),[u,d]=(0,e.useState)(``),f=t.executions.length>0?t.executions[t.executions.length-1]:void 0,p=t.executions.find(e=>e.outcome===`running`),m=a!==void 0&&fe(t,a),h=t.status===`in_review`&&t.trashedAt===void 0,g=[...t.executions].reverse().find(e=>e.sessionId!==void 0),_=p?.sessionId??g?.sessionId??(t.claimedBy?.startsWith(`session-`)?t.claimedBy:void 0),v=()=>{r.reject(t.id,t.version,u).then(e=>{e&&(l(!1),d(``))})};return(0,n.jsxs)(`div`,{role:`button`,tabIndex:0,className:`dsh-atb-card`,"data-urgency":t.urgency,draggable:i&&!c,onDragStart:e=>{if(p!==void 0){e.preventDefault();let n=s(`card.drag.running`,{title:t.title});o===void 0?alert(n):o(n);return}e.dataTransfer.setData(pe,t.id),e.dataTransfer.effectAllowed=`move`,e.currentTarget.dataset.dragging=`true`},onDragEnd:e=>{delete e.currentTarget.dataset.dragging},onClick:()=>r.select(t.id),onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r.select(t.id))},children:[(0,n.jsx)(`div`,{className:`dsh-atb-card-title`,children:t.title}),(0,n.jsxs)(`div`,{className:`dsh-atb-card-meta`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-badge`,children:s(ue[t.urgency])}),t.blocked&&(0,n.jsx)(`span`,{className:`dsh-atb-badge`,"data-kind":`blocked`,children:s(`shared.blocked`)}),m&&(0,n.jsx)(`span`,{className:`dsh-atb-badge`,"data-kind":`stale`,children:s(`card.badge.stale`)}),t.execution.mode===`scheduled`&&(0,n.jsxs)(`span`,{className:`dsh-atb-badge`,"data-kind":`scheduled`,children:[`⏰ `,J(t.execution.nextRunAt)]}),t.model!==void 0&&(0,n.jsxs)(`span`,{className:`dsh-atb-badge`,title:s(`card.badge.modelTitle`,{model:t.model.provider+`/`+t.model.model})+(t.model.reasoningEffort===void 0?``:s(`card.badge.modelEffort`,{effort:t.model.reasoningEffort})),children:[t.model.model,t.model.reasoningEffort===void 0?``:` (${t.model.reasoningEffort})`]}),t.permission===`read-only`&&(0,n.jsx)(`span`,{className:`dsh-atb-badge`,"data-kind":`blocked`,title:s(`card.badge.permReadOnlyTitle`),children:s(`card.badge.permReadOnly`)}),t.permission===`danger-full-access`&&(0,n.jsx)(`span`,{className:`dsh-atb-badge`,"data-kind":`urgent`,title:s(`card.badge.permFullTitle`),children:s(`card.badge.permFull`)}),t.checklist!==void 0&&t.checklist.length>0&&(0,n.jsxs)(`span`,{className:`dsh-atb-badge`,"data-kind":t.status===`in_review`&&t.checklist.some(e=>!e.checked)?`blocked`:`checklist`,title:t.status===`in_review`&&t.checklist.some(e=>!e.checked)?s(`card.badge.checklistReview`):s(`card.badge.checklist`),children:[`☑ `,t.checklist.filter(e=>e.checked).length,`/`,t.checklist.length]}),t.status===`done`&&(0,n.jsx)(`span`,{className:`dsh-atb-badge`,"data-kind":`done`,children:s(`status.pill.done`)}),f!==void 0&&(0,n.jsx)(`span`,{className:`dsh-atb-badge`,"data-kind":f.outcome===`running`?`running`:f.outcome,children:s(de[f.outcome]??f.outcome)}),_!==void 0&&(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-card-session`,title:s(`card.session.jumpTitle`,{id:_}),onClick:e=>{e.stopPropagation(),r.openSession(_).then(e=>{if(e===`missing`){let e=s(`card.session.missing`,{id:me(_)});o===void 0?alert(e):o(e)}else if(e===`archived`){let e=s(`card.session.archived`,{id:me(_)});o===void 0?alert(e):o(e)}else if(e===`unavailable`){let e=s(`card.session.unavailable`,{id:_});o===void 0?alert(e):o(e)}})},children:[`🤖 `,me(_),` ↗`]}),t.comments.length>0&&(0,n.jsxs)(`span`,{children:[`💬 `,t.comments.length]}),t.trashedAt!==void 0&&(0,n.jsx)(`span`,{className:`dsh-atb-badge`,"data-kind":`trashed`,children:s(`card.badge.pendingPurge`)}),(0,n.jsx)(`span`,{style:{marginLeft:`auto`},children:J(t.updatedAt)})]}),h&&(c?(0,n.jsxs)(`div`,{className:`dsh-atb-quick-reject`,onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(`input`,{className:`dsh-atb-input dsh-atb-quick-note`,value:u,placeholder:s(`card.reject.placeholder`),autoFocus:!0,spellCheck:!1,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`?v():e.key===`Escape`&&(l(!1),d(``))}}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-quickbtn`,"data-act":`reject-confirm`,onClick:v,children:s(`card.reject.confirm`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-quickbtn`,"data-act":`reject-cancel`,onClick:()=>{l(!1),d(``)},children:s(`shared.cancel`)})]}):(0,n.jsxs)(`div`,{className:`dsh-atb-quick`,onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-quickbtn`,"data-act":`done`,title:s(`card.action.doneTitle`),onClick:()=>void r.move(t.id,t.version,`done`),children:s(`card.action.done`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-quickbtn`,"data-act":`reject`,title:s(`card.action.rejectTitle`),onClick:()=>l(!0),children:s(`card.action.reject`)})]}))]})}function X(){let[t,r]=(0,e.useState)(null);return{alert:e=>r(e),el:t===null?null:(0,n.jsx)(he,{message:t,onClose:()=>r(null)})}}function he({message:t,onClose:r}){let i=R();return(0,e.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]),(0,n.jsx)(`div`,{className:`dsh-atb-alert-backdrop`,onClick:r,children:(0,n.jsxs)(`div`,{className:`dsh-atb-alert`,onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(`div`,{className:`dsh-atb-alert-icon`,children:`⛔`}),(0,n.jsx)(`div`,{className:`dsh-atb-alert-msg`,children:t}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,onClick:r,children:i(`alert.ok`)})]})})}function ge(e){return[`backlog`,`todo`,`in_progress`,`in_review`,`done`,`canceled`,`archived`].filter(t=>f(e.status,t))}function Z(e){return e===void 0?``:e.replace(/^session-(taskboard-)?/,``).slice(0,8)}function _e(e,t){if(e===void 0||t===void 0)return``;let n=Math.max(0,Math.round((t-e)/1e3));return n<60?`${n}s`:n<3600?`${Math.floor(n/60)}m${n%60}s`:`${Math.floor(n/3600)}h${Math.floor(n%3600/60)}m`}function Q({icon:e,children:t,tone:r,title:i}){return(0,n.jsxs)(`span`,{className:`dsh-atb-chip2`,"data-tone":r,title:i,children:[e!==void 0&&(0,n.jsx)(`span`,{className:`dsh-atb-chip2-icon`,children:e}),t]})}function ve({text:t}){let r=R(),[i,a]=(0,e.useState)(null),o=/!\[(.*?)\]\(((?:data:image\/[^)]+)|(?:https?:\/\/[^)]+)|(?:[^)]+\.(?:png|jpg|jpeg|gif|webp|svg)))\)/gi,s=[],c=0,l,u=0;for(;(l=o.exec(t))!==null;){l.index>c&&s.push((0,n.jsx)(`span`,{children:t.slice(c,l.index)},`txt-${c}`));let e=l[1]||r(`md.imageAlt`,{n:++u}),i=l[2]??``;s.push((0,n.jsxs)(`div`,{className:`dsh-atb-detail-img-wrap`,children:[(0,n.jsx)(`img`,{src:i,alt:e,className:`dsh-atb-detail-img`,onClick:()=>a(i),title:r(`md.imageTitle`,{alt:e})}),(0,n.jsx)(`span`,{className:`dsh-atb-detail-img-caption`,children:e})]},`img-${l.index}`)),c=o.lastIndex}return c<t.length&&s.push((0,n.jsx)(`span`,{children:t.slice(c)},`txt-${c}`)),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`dsh-atb-markdown-body`,children:s}),i!==null&&(0,n.jsx)(`div`,{className:`dsh-atb-lightbox-backdrop`,onClick:()=>a(null),children:(0,n.jsxs)(`div`,{className:`dsh-atb-lightbox-content`,onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(`img`,{src:i,alt:r(`md.lightboxAlt`),className:`dsh-atb-lightbox-img`}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-lightbox-close`,title:r(`md.closePreview`),onClick:()=>a(null),children:`✕`})]})})]})}function ye(e){return[...e.executions].reverse().find(e=>e.isolation!==void 0||e.worktreePath!==void 0||e.isolationNote!==void 0)}function be(e){return e===void 0?``:e.slice(0,8)}function xe(e){let t=e.slice(3),n=t.indexOf(` -> `);return n>=0&&(t=t.slice(n+4)),t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>1&&(t=t.slice(1,-1)),t}function Se({controller:t,task:r,execution:i,commit:a,path:o,repo:s}){let c=R(),[l,u]=(0,e.useState)({loading:!0});return(0,e.useEffect)(()=>{let e=!0;return u({loading:!0}),t.fetchDiff(r.id,{execution:i.id,...a===void 0?{path:o??``}:{commit:a},...s===void 0?{}:{repo:s}}).then(t=>{e&&u(t===void 0?{loading:!1,failed:!0}:{loading:!1,diff:t.diff,truncated:t.truncated})}),()=>{e=!1}},[t,r.id,i.id,a,o,s]),(0,n.jsxs)(`div`,{className:`dsh-atb-diffview`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-diffview-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-diffview-title`,children:a===void 0?c(`diff.file`,{path:o??``}):c(`diff.commit`,{hash:be(a)})}),l.loading&&(0,n.jsx)(`span`,{className:`dsh-atb-diffview-hint`,children:c(`shared.loading`)}),l.truncated===!0&&(0,n.jsx)(`span`,{className:`dsh-atb-diffview-hint`,children:c(`diff.truncated`)})]}),l.failed===!0?(0,n.jsx)(`div`,{className:`dsh-atb-diffview-error`,children:c(`diff.failed`)}):(0,n.jsx)(`pre`,{className:`dsh-atb-diffview-pre`,children:l.diff??``})]})}function Ce({task:e,controller:t}){let r=R(),i=e.checklist??[];if(i.length===0)return null;let{done:a,total:o}=x(e),s=o-a,c=e.status===`in_review`;return(0,n.jsxs)(`div`,{className:`dsh-atb-fieldcard`,"data-kind":`checklist`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-fieldcard-label`,children:[r(`checklist.title`),(0,n.jsxs)(`span`,{className:`dsh-atb-cl-progress`,"data-tone":c&&s>0?`bad`:void 0,children:[`☑ `,a,`/`,o,c&&s>0?r(`checklist.unchecked`,{n:s}):a===o?r(`checklist.allDone`):``]})]}),(0,n.jsx)(`div`,{className:`dsh-atb-cl-items`,children:i.map(i=>(0,n.jsxs)(`label`,{className:`dsh-atb-cl-item`,"data-checked":i.checked?`true`:void 0,"data-alert":c&&!i.checked?`true`:void 0,children:[(0,n.jsx)(`input`,{type:`checkbox`,checked:i.checked,onChange:()=>void t.toggleChecklistItem(e,i.id)}),(0,n.jsx)(`span`,{className:`dsh-atb-cl-text`,children:i.text}),(0,n.jsxs)(`span`,{className:`dsh-atb-cl-meta`,children:[i.checked?`${i.checkedBy===`user`?r(`checklist.byUser`):`🤖 ${Z(i.checkedBy)}`} · ${J(i.checkedAt)}`:r(`checklist.uncheckedItem`),i.note!==void 0&&i.note.length>0&&(0,n.jsx)(`span`,{className:`dsh-atb-cl-note`,title:i.note,children:r(`checklist.evidence`,{note:i.note})})]})]},i.id))})]})}function we({task:e}){let t=R(),r=[...e.executions].reverse().find(e=>e.report!==void 0),i=r?.report;if(r===void 0||i===void 0)return null;let a=(e,t)=>t!==void 0&&t.length>0?(0,n.jsxs)(`div`,{className:`dsh-atb-rpt-sec`,children:[(0,n.jsx)(`div`,{className:`dsh-atb-rpt-label`,children:e}),(0,n.jsx)(`ul`,{className:`dsh-atb-rpt-list`,children:t.map((e,t)=>(0,n.jsx)(`li`,{children:e},t))})]}):null;return(0,n.jsxs)(`div`,{className:`dsh-atb-fieldcard`,"data-kind":`report`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-fieldcard-label`,children:[t(`report.title`),(0,n.jsx)(`span`,{className:`dsh-atb-cl-progress`,children:t(`report.submitted`,{time:J(r.endedAt??r.startedAt)})})]}),(0,n.jsx)(`div`,{className:`dsh-atb-rpt-summary`,children:i.summary}),a(t(`report.changedFiles`),i.changedFiles),a(t(`report.checks`),i.checks),a(t(`report.artifacts`),i.artifacts),i.risk.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-rpt-sec`,children:[(0,n.jsx)(`div`,{className:`dsh-atb-rpt-label`,children:t(`report.risk`)}),(0,n.jsx)(`div`,{className:`dsh-atb-rpt-risk`,children:i.risk})]})]})}function Te({task:t,controller:r}){let i=R(),{alert:a,el:o}=X(),[s,c]=(0,e.useState)(!1),[l,u]=(0,e.useState)(null),[d,f]=(0,e.useState)(!1),[p,m]=(0,e.useState)(null),[h,g]=(0,e.useState)(!1),_=ye(t),v=t.executions.some(e=>e.outcome===`running`);if(_===void 0)return null;let y=()=>{f(!0),r.mergeBranch(t.id).then(e=>{if(f(!1),c(!1),!e.ok)a(i(`iso.merge.failed`,{error:e.error}));else if(e.results!==void 0){let t=e=>e===``?i(`iso.repo.root`):e,n=e.results.map(e=>`${t(e.repo)} ${e.outcome===`merged`?`✓`:e.outcome===`noop`?`⟲`:`✗`}`).join(` · `),r=e.results.some(e=>e.outcome===`failed`),o=e.results.find(e=>e.outcome===`failed`)?.error;a(r?i(`iso.merge.partial`,{summary:n,error:o??``}):i(`iso.merge.done`,{summary:n}))}else e.noop===!0&&a(i(`iso.merge.noop`))})},b=e=>{f(!0),r.removeWorktree(t.id,e).then(e=>{f(!1),u(null),e.ok?e.branchError!==void 0&&a(i(`iso.remove.branchFailed`,{error:e.branchError})):a(i(`iso.remove.failed`,{error:e.error}))})};if(_.isolation!==`worktree`||_.worktreePath===void 0)return(0,n.jsxs)(`div`,{className:`dsh-atb-fieldcard`,"data-kind":`isolation`,children:[(0,n.jsx)(`div`,{className:`dsh-atb-fieldcard-label`,children:i(`iso.title`)}),(0,n.jsxs)(`div`,{className:`dsh-atb-iso-none`,children:[i(`iso.none`),_.isolationNote===void 0?``:` · ${_.isolationNote}`]}),o]});let x=_.repos!==void 0&&_.repos.length>0,S=x?(_.repos??[]).map(e=>({repo:e.repo,label:e.repo===``?i(`iso.repo.root`):e.repo,branch:e.branch,worktreePath:e.worktreePath,baseCommit:e.baseCommit,headCommit:e.headCommit,commits:e.commits??[],commitTotal:e.commitsTotal??(e.commits??[]).length,dirty:e.dirtyFiles??[],dirtyTotal:e.dirtyFilesTotal??(e.dirtyFiles??[]).length,...e.diffStat===void 0?{}:{diffStat:e.diffStat},...e.changedFiles===void 0?{}:{changedFiles:e.changedFiles}})):[{label:i(`iso.repo.root`),branch:_.branch??t.branch,worktreePath:_.worktreePath,baseCommit:_.baseCommit,headCommit:_.headCommit,commits:_.commits??[],commitTotal:_.commitsTotal??(_.commits??[]).length,dirty:_.dirtyFiles??[],dirtyTotal:_.dirtyFilesTotal??(_.dirtyFiles??[]).length,..._.diffStat===void 0?{}:{diffStat:_.diffStat},..._.changedFiles===void 0?{}:{changedFiles:_.changedFiles}}];return(0,n.jsxs)(`div`,{className:`dsh-atb-fieldcard`,"data-kind":`isolation`,children:[(0,n.jsx)(`div`,{className:`dsh-atb-fieldcard-label`,children:i(`iso.worktreeTitle`)}),S.map(e=>(0,n.jsxs)(`section`,{className:`dsh-atb-iso-repo`,"data-multi":x?`true`:void 0,children:[x&&(0,n.jsxs)(`div`,{className:`dsh-atb-iso-repohead`,title:e.worktreePath,children:[(0,n.jsx)(`code`,{children:e.label}),(0,n.jsxs)(`span`,{className:`dsh-atb-iso-fact`,children:[i(`iso.branch`),` `,(0,n.jsx)(`b`,{children:e.branch})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-iso-facts`,children:[!x&&(0,n.jsxs)(`span`,{className:`dsh-atb-iso-fact`,title:e.worktreePath,children:[i(`iso.branch`),` `,(0,n.jsx)(`b`,{children:e.branch})]}),(0,n.jsx)(`span`,{className:`dsh-atb-iso-fact`,children:i(`iso.baseline`,{base:be(e.baseCommit),head:be(e.headCommit)})}),e.changedFiles!==void 0&&e.changedFiles>0&&(0,n.jsx)(`span`,{className:`dsh-atb-iso-fact`,children:i(`iso.changed`,{n:e.changedFiles})}),e.diffStat!==void 0&&(0,n.jsx)(`span`,{className:`dsh-atb-iso-fact`,title:e.diffStat,children:e.diffStat})]}),e.commits.length>0?(0,n.jsxs)(`div`,{className:`dsh-atb-iso-commits`,children:[e.commits.slice(0,10).map(a=>(0,n.jsxs)(`div`,{className:`dsh-atb-iso-commit`,"data-open":p?.commit===a.hash&&p?.repo===e.repo?`true`:void 0,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-iso-commit-btn`,title:i(`iso.commit.openTitle`),onClick:()=>m(p?.commit===a.hash&&p?.repo===e.repo?null:{commit:a.hash,...e.repo===void 0?{}:{repo:e.repo}}),children:[(0,n.jsx)(`code`,{children:be(a.hash)}),(0,n.jsx)(`span`,{children:a.subject})]}),p?.commit===a.hash&&p?.repo===e.repo&&(0,n.jsx)(Se,{controller:r,task:t,execution:_,commit:a.hash,repo:e.repo})]},a.hash)),e.commitTotal>10&&(0,n.jsx)(`div`,{className:`dsh-atb-iso-more`,children:i(`iso.commits.more`,{n:e.commitTotal})})]}):(0,n.jsx)(`div`,{className:`dsh-atb-iso-nocommit`,children:i(`iso.nocommit`)}),e.dirtyTotal>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-iso-dirty`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-iso-dirty-toggle`,onClick:()=>g(!h),children:[i(`iso.dirty.toggle`,{n:e.dirtyTotal}),i(h?`iso.dirty.collapse`:`iso.dirty.expand`)]}),h&&(0,n.jsxs)(`div`,{className:`dsh-atb-iso-dirty-files`,children:[e.dirty.slice(0,30).map((t,r)=>{let a=xe(t);return(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-iso-dirty-file`,title:i(`iso.dirty.openTitle`),onClick:()=>m(p?.path===a&&p?.repo===e.repo?null:{path:a,...e.repo===void 0?{}:{repo:e.repo}}),children:[(0,n.jsx)(`code`,{children:t.slice(0,2)}),` `,a]},`${t}-${r}`)}),e.dirtyTotal>30&&(0,n.jsx)(`div`,{className:`dsh-atb-iso-more`,children:i(`iso.dirty.more`,{n:e.dirtyTotal})})]}),p?.path!==void 0&&p?.repo===e.repo&&h&&(0,n.jsx)(Se,{controller:r,task:t,execution:_,path:p.path,repo:e.repo})]})]},e.repo??`root`)),(0,n.jsxs)(`div`,{className:`dsh-atb-iso-actions`,children:[v?(0,n.jsx)(`span`,{className:`dsh-atb-iso-hint`,children:i(`iso.hint.running`)}):s?(0,n.jsxs)(`span`,{className:`dsh-atb-confirm`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-confirm-label`,children:i(`iso.merge.confirm`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,disabled:d,onClick:y,children:i(`iso.merge.go`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>c(!1),children:i(`shared.cancel`)})]}):(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,disabled:d,title:i(`iso.merge.title`),onClick:()=>c(!0),children:i(`iso.merge.button`)}),!v&&(l===null?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,disabled:d,title:i(`iso.remove.wtTitle`),onClick:()=>u(`wt`),children:i(`iso.remove.wt`)}),t.branch!==void 0&&(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,disabled:d,title:i(`iso.remove.wtbTitle`),onClick:()=>u(`wtb`),children:i(`iso.remove.wtb`)})]}):(0,n.jsxs)(`span`,{className:`dsh-atb-confirm`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-confirm-label`,children:i(l===`wtb`?`iso.remove.confirmWtb`:`iso.remove.confirmWt`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,disabled:d,onClick:()=>b(l===`wtb`),children:i(`shared.confirmDelete`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>u(null),children:i(`shared.cancel`)})]})),!v&&l===null&&!s&&(0,n.jsx)(`span`,{className:`dsh-atb-iso-hint`,children:i(`iso.hint.keep`)})]}),o]})}function Ee({task:t,controller:r,now:i}){let a=R(),[o,s]=(0,e.useState)(``),[c,l]=(0,e.useState)(!1),[u,d]=(0,e.useState)(!1),[f,p]=(0,e.useState)(!1),[m,h]=(0,e.useState)(!1),{alert:g,el:_}=X(),v=r.getSnapshot().workspaces.find(e=>e.id===t.workspaceId),y=t.status!==`in_progress`&&t.status!==`done`&&t.status!==`archived`,b=t.executions.find(e=>e.outcome===`running`),S=t.status===`in_progress`?t.claimedBy:void 0,C=i!==void 0&&fe(t,i),w=(t.checklist??[]).filter(e=>!e.checked).length,T=[...t.executions].reverse().find(e=>e.sessionId!==void 0),E=b?.sessionId??T?.sessionId??(t.claimedBy?.startsWith(`session-`)?t.claimedBy:void 0),D=e=>{m||(h(!0),e().catch(()=>void 0).finally(()=>h(!1)))},O=e=>{r.openSession(e).then(t=>{t===`missing`?g(a(`card.session.missing`,{id:Z(e)})):t===`archived`?g(a(`card.session.archived`,{id:Z(e)})):t===`unavailable`&&g(a(`card.session.unavailable`,{id:e}))})};return(0,n.jsxs)(`div`,{className:`dsh-atb-detail`,"data-urgency":t.urgency,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-detail-head`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-detail-titlewrap`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-detail-titlebar`,children:[(0,n.jsx)(`h3`,{children:t.title}),(0,n.jsx)(`span`,{className:`dsh-atb-statuspill`,"data-status":t.status,children:a(K[t.status]??t.status)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-detail-chips`,children:[(0,n.jsxs)(Q,{tone:t.urgency,children:[`● `,a(ue[t.urgency]??t.urgency)]}),(0,n.jsx)(Q,{icon:`📁`,children:v?.title??Z(t.workspaceId)}),t.model!==void 0&&(0,n.jsxs)(Q,{icon:`✦`,title:a(`card.badge.modelTitle`,{model:t.model.provider+`/`+t.model.model})+(t.model.reasoningEffort===void 0?``:a(`card.badge.modelEffort`,{effort:t.model.reasoningEffort})),children:[t.model.model,t.model.reasoningEffort===void 0?``:` · ${t.model.reasoningEffort}`]}),t.presetId!==void 0&&(0,n.jsx)(Q,{icon:`🎛`,children:t.presetId}),t.execution.mode===`scheduled`&&(0,n.jsx)(Q,{icon:`⏰`,children:a(`detail.chip.nextRun`,{cron:t.execution.cron??``,time:J(t.execution.nextRunAt)})}),t.blocked&&(0,n.jsx)(Q,{icon:`⛔`,tone:`urgent`,children:a(`shared.blocked`)}),t.checklist!==void 0&&t.checklist.length>0&&(0,n.jsx)(Q,{icon:`☑`,tone:t.status===`in_review`&&t.checklist.some(e=>!e.checked)?`urgent`:void 0,children:a(`detail.chip.checklist`,{done:x(t).done,total:t.checklist.length})}),t.branch!==void 0&&(0,n.jsxs)(Q,{icon:`🌿`,tone:void 0,children:[`Worktree · `,t.branch.length>28?`${t.branch.slice(0,28)}…`:t.branch]}),(t.isolation===void 0||t.isolation===`worktree`)&&t.branch===void 0&&(0,n.jsx)(Q,{icon:`🌿`,children:a(`detail.chip.isolated`)}),t.permission===`read-only`&&(0,n.jsx)(Q,{icon:`🔒`,tone:`urgent`,children:a(`detail.chip.permReadOnly`)}),t.permission===`danger-full-access`&&(0,n.jsx)(Q,{icon:`⚡`,tone:`urgent`,children:a(`detail.chip.permFull`)}),(t.permission===`workspace-write`||t.permission===void 0)&&(0,n.jsx)(Q,{icon:`📁`,children:a(`detail.chip.permWrite`)}),S!==void 0&&(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-chip2 dsh-atb-chip-btn`,"data-tone":C?`urgent`:void 0,title:a(`detail.chip.holderTitle`,{id:S}),onClick:()=>O(S),children:[(0,n.jsx)(`span`,{className:`dsh-atb-chip2-icon`,children:C?`⏱`:`🤖`}),a(C?`detail.chip.holderStale`:`detail.chip.holderBy`),Z(S),a(`detail.chip.holderSuffix`)]}),t.trashedAt!==void 0&&(0,n.jsx)(Q,{icon:`🗑`,tone:`urgent`,children:a(`detail.chip.trashed`)}),(0,n.jsxs)(Q,{children:[`v`,t.version]})]}),(0,n.jsx)(`div`,{className:`dsh-atb-detail-sub`,children:a(`detail.sub.line`,{time:J(t.updatedAt),who:t.updatedBy.kind===`agent`?`🤖 ${Z(t.updatedBy.sessionId)}`:t.updatedBy.kind===`system`?a(`detail.updatedBy.system`):a(`detail.updatedBy.user`)})})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-detail-topbtns`,children:[E!==void 0&&(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-detail-session`,title:a(`detail.session.jumpTitle`,{id:E}),onClick:()=>O(E),children:a(`detail.session.jump`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-detail-edit`,onClick:()=>r.openEditor(t.id),children:a(`detail.action.edit`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-detail-edit`,title:a(`detail.action.duplicateTitle`),disabled:m,onClick:()=>D(()=>r.duplicate(t)),children:a(`detail.action.duplicate`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-detail-edit`,title:a(`detail.action.saveTplTitle`),disabled:m,onClick:()=>D(async()=>{await r.saveAsTemplate(t)&&g(a(`detail.action.saveTplDone`))}),children:a(`detail.action.saveTpl`)}),y&&t.branch!==void 0&&(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-detail-run`,title:a(`detail.action.reuseTitle`),disabled:m,onClick:()=>D(()=>r.run(t.id,!0)),children:a(`detail.action.reuse`)}),y&&(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-detail-run`,title:t.model===void 0?a(`detail.action.runTitleDefault`):a(`detail.action.runTitleModel`,{model:t.model.model}),disabled:m,onClick:()=>D(()=>r.run(t.id)),children:a(`detail.action.run`)}),b!==void 0&&(f?(0,n.jsxs)(`span`,{className:`dsh-atb-confirm`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-confirm-label`,children:a(`detail.action.stopConfirm`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,onClick:()=>{r.cancel(t.id),p(!1)},children:a(`detail.action.stop`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>p(!1),children:a(`shared.cancel`)})]}):(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-detail-run`,"data-danger":`true`,title:a(`detail.action.stopTitle`,{id:b.sessionId??``}),onClick:()=>p(!0),children:a(`detail.action.stopExec`)})),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-detail-close`,"aria-label":a(`shared.close`),onClick:()=>r.select(void 0),children:`✕`})]})]}),t.description.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-fieldcard`,children:[(0,n.jsx)(`div`,{className:`dsh-atb-fieldcard-label`,children:a(`detail.field.description`)}),(0,n.jsx)(`div`,{className:`dsh-atb-desc`,children:(0,n.jsx)(ve,{text:t.description})})]}),t.prompt.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-fieldcard`,"data-kind":`prompt`,children:[(0,n.jsx)(`div`,{className:`dsh-atb-fieldcard-label`,children:a(`detail.field.prompt`)}),(0,n.jsx)(`div`,{className:`dsh-atb-promptbox`,children:(0,n.jsx)(ve,{text:t.prompt})})]}),(0,n.jsx)(Te,{task:t,controller:r}),(0,n.jsx)(we,{task:t}),(0,n.jsx)(Ce,{task:t,controller:r}),(0,n.jsx)(`div`,{className:`dsh-atb-detail-actions`,children:(0,n.jsxs)(`div`,{className:`dsh-atb-movebtns`,children:[ge(t).map(e=>e===`done`?c?(0,n.jsxs)(`span`,{className:`dsh-atb-confirm`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-confirm-label`,"data-tone":w>0?`bad`:void 0,children:w>0?a(`detail.move.confirmDoneUnchecked`,{n:w}):a(`detail.move.confirmDone`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,onClick:()=>{r.move(t.id,t.version,`done`),l(!1)},children:a(`detail.move.confirm`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>l(!1),children:a(`shared.cancel`)})]},e):(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-movebtn`,"data-to":e,onClick:()=>l(!0),children:a(`detail.move.to`,{status:a(q[e])})},e):(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-movebtn`,"data-to":e,onClick:()=>void r.move(t.id,t.version,e),children:a(`detail.move.to`,{status:a(q[e])})},e)),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-movebtn`,"data-to":`blocked`,onClick:()=>void r.toggleBlocked(t),children:t.blocked?a(`detail.blocked.unmark`):a(`detail.blocked.mark`)}),S!==void 0&&(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-movebtn`,"data-to":`release`,title:a(`detail.release.title`,{id:S}),onClick:()=>void r.move(t.id,t.version,`todo`),children:a(`detail.release.button`)})]})}),(0,n.jsxs)(`div`,{className:`dsh-atb-section`,children:[(0,n.jsxs)(`h4`,{children:[a(`detail.comments.title`),t.comments.length>0&&(0,n.jsx)(`span`,{className:`dsh-atb-count2`,children:t.comments.length})]}),t.comments.length===0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:a(`detail.comments.empty`)}):(0,n.jsx)(`div`,{className:`dsh-atb-commentlist`,children:t.comments.map(e=>(0,n.jsxs)(`div`,{className:`dsh-atb-bubble`,"data-from":e.threadId===void 0?`user`:`agent`,children:[(0,n.jsx)(`div`,{className:`dsh-atb-bubble-avatar`,children:e.threadId===void 0?`👤`:`🤖`}),(0,n.jsxs)(`div`,{className:`dsh-atb-bubble-main`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-bubble-meta`,children:[(0,n.jsx)(`b`,{children:e.threadId===void 0?a(`detail.comments.user`):`agent ${Z(e.threadId)}`}),(0,n.jsx)(`span`,{children:J(e.createdAt)})]}),(0,n.jsx)(`div`,{className:`dsh-atb-bubble-body`,children:e.body})]})]},e.id))}),(0,n.jsxs)(`div`,{className:`dsh-atb-composer`,children:[(0,n.jsx)(`textarea`,{className:`dsh-atb-composer-input`,value:o,placeholder:a(`detail.composer.placeholder`),onChange:e=>s(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&o.trim().length>0&&r.comment(t.id,o).then(e=>{e&&s(``)})}}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-composer-send`,disabled:o.trim().length===0,onClick:()=>{r.comment(t.id,o).then(e=>{e&&s(``)})},children:a(`detail.composer.send`)})]})]}),t.executions.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-section`,children:[(0,n.jsxs)(`h4`,{children:[a(`detail.exec.title`),(0,n.jsx)(`span`,{className:`dsh-atb-count2`,children:t.executions.length}),t.executionsPruned!==void 0&&t.executionsPruned>0&&(0,n.jsx)(`span`,{className:`dsh-atb-count2`,title:a(`detail.exec.prunedTitle`,{n:t.executionsPruned}),children:a(`detail.exec.pruned`,{n:t.executionsPruned})})]}),(0,n.jsx)(`div`,{className:`dsh-atb-execlist`,children:[...t.executions].reverse().map(e=>(0,n.jsxs)(`div`,{className:`dsh-atb-exec-row`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-exec-dot`,"data-outcome":e.outcome}),(0,n.jsx)(`span`,{className:`dsh-atb-exec-trigger`,children:e.trigger===`manual`?a(`detail.exec.trigger.manual`):a(`detail.exec.trigger.scheduled`)}),(0,n.jsx)(`span`,{className:`dsh-atb-exec-outcome`,"data-outcome":e.outcome,children:a(de[e.outcome]??e.outcome)}),(0,n.jsxs)(`span`,{className:`dsh-atb-exec-time`,children:[J(e.startedAt),e.endedAt!==void 0&&` · ${_e(e.startedAt,e.endedAt)}`]}),e.sessionId!==void 0&&(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-exec-session`,title:a(`detail.exec.openTitle`,{id:e.sessionId}),onClick:()=>O(e.sessionId),children:[`🤖 `,Z(e.sessionId),` ↗`]}),e.error!==void 0&&(0,n.jsxs)(`span`,{className:`dsh-atb-exec-error`,title:e.error,children:[e.error.slice(0,80),e.error.length>80?`…`:``]})]},e.id))})]}),(0,n.jsx)(`div`,{className:`dsh-atb-dangerzone`,children:t.trashedAt===void 0?(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,onClick:()=>void r.remove(t.id,t.version,!1),children:a(`detail.danger.delete`)}):u?(0,n.jsxs)(`span`,{className:`dsh-atb-confirm`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-confirm-label`,children:a(`detail.danger.purgeConfirm`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,onClick:()=>{r.remove(t.id,t.version,!0),d(!1)},children:a(`detail.danger.purgeGo`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>d(!1),children:a(`shared.cancel`)})]}):(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,onClick:()=>d(!0),children:a(`detail.danger.purge`)})}),_]})}const De=e=>[{name:`goal`,kind:`command`,description:e(`slash.cmd.goal.desc`),hint:e(`slash.cmd.goal.hint`)},{name:`schedule`,kind:`command`,description:e(`slash.cmd.schedule.desc`),hint:e(`slash.cmd.schedule.hint`)},{name:`plan`,kind:`command`,description:e(`slash.cmd.plan.desc`)},{name:`browser`,kind:`command`,description:e(`slash.cmd.browser.desc`)},{name:`grill-me`,kind:`command`,description:e(`slash.cmd.grill-me.desc`)},{name:`teamwork-preview`,kind:`command`,description:e(`slash.cmd.teamwork-preview.desc`)},{name:`learn`,kind:`command`,description:e(`slash.cmd.learn.desc`)},{name:`review`,kind:`command`,description:e(`slash.cmd.review.desc`)},{name:`security`,kind:`command`,description:e(`slash.cmd.security.desc`)},{name:`permission`,kind:`command`,description:e(`slash.cmd.permission.desc`),hint:e(`slash.cmd.permission.hint`)}],Oe=e=>[{name:`frontend-ui-engineering`,kind:`skill`,description:e(`slash.skill.frontend-ui-engineering`)},{name:`api-and-interface-design`,kind:`skill`,description:e(`slash.skill.api-and-interface-design`)},{name:`test-driven-development`,kind:`skill`,description:e(`slash.skill.test-driven-development`)},{name:`debugging-and-error-recovery`,kind:`skill`,description:e(`slash.skill.debugging-and-error-recovery`)},{name:`performance-optimization`,kind:`skill`,description:e(`slash.skill.performance-optimization`)},{name:`ci-cd-and-automation`,kind:`skill`,description:e(`slash.skill.ci-cd-and-automation`)},{name:`code-review-and-quality`,kind:`skill`,description:e(`slash.skill.code-review-and-quality`)},{name:`code-simplification`,kind:`skill`,description:e(`slash.skill.code-simplification`)},{name:`context-engineering`,kind:`skill`,description:e(`slash.skill.context-engineering`)},{name:`doubt-driven-development`,kind:`skill`,description:e(`slash.skill.doubt-driven-development`)},{name:`git-workflow-and-versioning`,kind:`skill`,description:e(`slash.skill.git-workflow-and-versioning`)},{name:`idea-refine`,kind:`skill`,description:e(`slash.skill.idea-refine`)},{name:`incremental-implementation`,kind:`skill`,description:e(`slash.skill.incremental-implementation`)},{name:`interview-me`,kind:`skill`,description:e(`slash.skill.interview-me`)},{name:`memory-leak-debugging`,kind:`skill`,description:e(`slash.skill.memory-leak-debugging`)},{name:`observability-and-instrumentation`,kind:`skill`,description:e(`slash.skill.observability-and-instrumentation`)},{name:`planning-and-task-breakdown`,kind:`skill`,description:e(`slash.skill.planning-and-task-breakdown`)},{name:`security-and-hardening`,kind:`skill`,description:e(`slash.skill.security-and-hardening`)},{name:`shipping-and-launch`,kind:`skill`,description:e(`slash.skill.shipping-and-launch`)},{name:`source-driven-development`,kind:`skill`,description:e(`slash.skill.source-driven-development`)},{name:`spec-driven-development`,kind:`skill`,description:e(`slash.skill.spec-driven-development`)},{name:`using-agent-skills`,kind:`skill`,description:e(`slash.skill.using-agent-skills`)}];function ke({value:t,onChange:i,controller:a,placeholder:o,rows:s=4,maxLength:c=8e3,disabled:l=!1,autoFocus:u=!1,className:d,ariaLabel:f}){let p=R(),m=(0,e.useRef)(null),h=(0,e.useRef)(null),g=(0,e.useRef)(null),[_,v]=(0,e.useState)({}),[y,b]=(0,e.useState)(void 0),x=(0,e.useMemo)(()=>{let e=(e,t)=>{let n=new Map;for(let t of e)n.set(t.name,t);for(let e of t??[])n.set(e.name,e);return Array.from(n.values())};return{commands:e(De(p),y?.commands),skills:e(Oe(p),y?.skills)}},[p,y]),[S,C]=(0,e.useState)(!1),[w,T]=(0,e.useState)(``),[E,D]=(0,e.useState)(-1),[O,k]=(0,e.useState)(0);(0,e.useEffect)(()=>{if(a===void 0)return;let e=!0;return a.fetchPromptCompletions().then(t=>{!e||t===void 0||b({commands:t.commands.map(e=>({...e,kind:`command`})),skills:t.skills.map(e=>({...e,kind:`skill`}))})}),()=>{e=!1}},[a]);let A=(0,e.useMemo)(()=>{let e=w.toLowerCase().trim(),t=[...x.commands,...x.skills];return e.length===0?t:t.filter(t=>t.name.toLowerCase().includes(e)||t.description!==void 0&&t.description.toLowerCase().includes(e))},[x,w]);(0,e.useEffect)(()=>{O>=A.length&&k(Math.max(0,A.length-1))},[A.length,O]),(0,e.useLayoutEffect)(()=>{if(!S)return;let e=g.current,t=e?.children[O];if(e===null||!(t instanceof HTMLElement))return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.top<n.top?e.scrollTop-=n.top-r.top:r.bottom>n.bottom&&(e.scrollTop+=r.bottom-n.bottom)},[S,O,A]);let j=()=>{let e=m.current;if(e===null)return;let t=e.selectionStart,n=e.value.slice(0,t),r=n.lastIndexOf(`/`);if(r>=0){let e=r>0?n[r-1]??`
|
|
916
925
|
`:`
|
|
917
|
-
`,t=/\s/.test(e)||r===0,i=n.slice(r+1),a=!/\s/.test(i);if(t&&a){D(r),T(i),C(!0);return}}C(!1)},M=e=>{let n=m.current;if(n===null||E<0)return;let r=n.selectionStart,a=t.slice(0,E),o=t.slice(r),s=`/${e.name} `;i(a+s+o),C(!1),setTimeout(()=>{if(m.current!==null){let e=E+s.length;m.current.focus(),m.current.setSelectionRange(e,e)}},0)},N=e=>{if(S&&A.length>0){if(e.key===`ArrowDown`){e.preventDefault(),k(e=>(e+1)%A.length);return}if(e.key===`ArrowUp`){e.preventDefault(),k(e=>(e-1+A.length)%A.length);return}if(e.key===`Enter`||e.key===`Tab`){let t=A[O];if(t!==void 0){e.preventDefault(),M(t);return}}if(e.key===`Escape`){e.preventDefault(),C(!1);return}}},P=(0,e.useCallback)(()=>{let e=m.current;if(e===null)return;let t=e.getBoundingClientRect(),n=window.innerHeight,r=h.current?.offsetHeight??0,i=r>0?r:240,a=t.top-6-8,o=n-8-(t.bottom+6),s=o>a,c=Math.min(i,Math.max(s?o:a,120)),l=s?t.bottom+6:t.top-6-c;v(e=>e.left===t.left&&e.top===l&&e.width===t.width&&e.maxHeight===c?e:{position:`fixed`,left:t.left,top:l,width:t.width,maxHeight:c,zIndex:100})},[]);return(0,e.useLayoutEffect)(()=>{S&&P()}),(0,e.useEffect)(()=>{if(S)return window.addEventListener(`scroll`,P,!0),window.addEventListener(`resize`,P),()=>{window.removeEventListener(`scroll`,P,!0),window.removeEventListener(`resize`,P)}},[S,P]),(0,n.jsxs)(`div`,{className:`dsh-atb-prompt-wrap ${d??``}`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-prompt-inner`,children:[(0,n.jsx)(`textarea`,{ref:m,className:`dsh-atb-prompt-input`,value:t,rows:s,maxLength:c,disabled:l,autoFocus:u,placeholder:o,"aria-label":f,onChange:e=>{i(e.target.value),j()},onKeyUp:j,onClick:j,onKeyDown:N}),S&&A.length>0&&(0,r.createPortal)((0,n.jsxs)(`div`,{ref:h,className:`dsh-atb-slash-popup`,style:_,role:`listbox`,"aria-label":p(`slash.aria`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-slash-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-slash-title`,children:p(`slash.title`)}),(0,n.jsx)(`span`,{className:`dsh-atb-slash-hint`,children:p(`slash.hint`)})]}),(0,n.jsx)(`div`,{ref:g,className:`dsh-atb-slash-list`,children:A.map((e,t)=>(0,n.jsxs)(`div`,{role:`option`,"aria-selected":t===O,className:`dsh-atb-slash-item`,"data-active":t===O?`true`:void 0,"data-kind":e.kind,onClick:()=>M(e),onMouseEnter:()=>k(t),children:[(0,n.jsx)(`span`,{className:`dsh-atb-slash-badge`,"data-kind":e.kind,children:e.kind===`command`?p(`slash.badge.command`):p(`slash.badge.skill`)}),(0,n.jsxs)(`span`,{className:`dsh-atb-slash-name`,children:[`/`,e.name]}),e.hint&&(0,n.jsx)(`span`,{className:`dsh-atb-slash-param`,children:e.hint}),e.description&&(0,n.jsx)(`span`,{className:`dsh-atb-slash-desc`,children:e.description})]},`${e.kind}-${e.name}`))})]}),document.body)]}),(0,n.jsx)(`div`,{className:`dsh-atb-prompt-foot`,children:(0,n.jsxs)(`span`,{className:`dsh-atb-prompt-tip`,children:[p(`slash.tipA`),` `,(0,n.jsx)(`code`,{children:`/`}),` `,p(`slash.tipB`)]})})]})}const Ae=`dsh-taskboard-last-model-v1`;function je(){try{let e=localStorage.getItem(Ae);if(e===null)return;let t=JSON.parse(e);if(typeof t==`object`&&t){let{provider:e,model:n,reasoningEffort:r}=t;if(typeof e==`string`&&typeof n==`string`&&e.trim().length>0&&n.trim().length>0)return{provider:e.trim(),model:n.trim(),...typeof r==`string`&&r.trim().length>0?{reasoningEffort:r.trim()}:{}}}return}catch{return}}function Me(e){try{e===void 0?localStorage.removeItem(Ae):localStorage.setItem(Ae,JSON.stringify(e))}catch{}}const Ne=e=>[{value:`urgent`,label:e(`form.urgency.urgent`),hint:e(`form.urgency.urgentHint`)},{value:`normal`,label:e(`form.urgency.normal`),hint:e(`form.urgency.normalHint`)},{value:`relaxed`,label:e(`form.urgency.relaxed`),hint:e(`form.urgency.relaxedHint`)}],Pe=e=>[{label:e(`form.cron.daily`),cron:`0 9 * * *`},{label:e(`form.cron.hourly`),cron:`0 * * * *`},{label:e(`form.cron.every10min`),cron:`*/10 * * * *`},{label:e(`form.cron.weekly`),cron:`0 9 * * 1`}],Fe=e=>[{value:`workspace-write`,label:e(`form.perm.write`),hint:e(`form.perm.writeHint`),icon:`📁`},{value:`read-only`,label:e(`form.perm.readOnly`),hint:e(`form.perm.readOnlyHint`),icon:`🔒`},{value:`danger-full-access`,label:e(`form.perm.fullAccess`),hint:e(`form.perm.fullAccessHint`),icon:`⚡`}];function $({label:e,required:t=!1,full:r=!1,children:i}){return(0,n.jsxs)(`label`,{className:`dsh-atb-field`,"data-span":r?`full`:void 0,children:[(0,n.jsxs)(`span`,{className:`dsh-atb-field-label`,children:[e,t&&(0,n.jsx)(`em`,{className:`dsh-atb-req`,children:`*`})]}),i]})}function Ie({rows:e,onChange:t,editing:r}){let i=R(),a=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))},o=e.filter(e=>e.checked).length;return(0,n.jsxs)(`div`,{className:`dsh-atb-cke`,children:[e.map((o,s)=>(0,n.jsxs)(`div`,{className:`dsh-atb-cke-row`,children:[r&&(0,n.jsx)(`input`,{type:`checkbox`,className:`dsh-atb-cke-box`,checked:o.checked,title:i(`form.check.checkedTitle`,{who:o.checkedBy??i(`form.check.notCheckedYet`)}),onChange:e=>a(s,{checked:e.target.checked})}),(0,n.jsx)(`input`,{className:`dsh-atb-cke-text`,value:o.text,maxLength:200,placeholder:i(`form.check.itemPlaceholder`,{n:s+1}),spellCheck:!1,onChange:e=>a(s,{text:e.target.value})}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-cke-del`,title:i(`form.check.removeTitle`),onClick:()=>t(e.filter((e,t)=>t!==s)),children:`✕`})]},o.id??`new-${s}`)),e.length<30&&(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-cke-add`,onClick:()=>t([...e,{text:``,checked:!1}]),children:i(`form.check.add`)}),e.length>0&&(0,n.jsx)(`span`,{className:`dsh-atb-cke-hint`,children:r?i(`form.check.hintEdit`,{checked:o,total:e.length}):i(`form.check.hintCreate`,{n:e.length})})]})}function Le({controller:t,task:r}){let i=R(),a=t.getSnapshot(),o=a.templatePrefill,s=r!==void 0,[c,l]=(0,e.useState)(r?.title??o?.title??``),[u,d]=(0,e.useState)(r?.description??o?.description??``),[f,h]=(0,e.useState)(r?.prompt??o?.prompt??``),[v,b]=(0,e.useState)(r?.workspaceId??a.filters.workspaceId??a.workspaces[0]?.id??``),[x,S]=(0,e.useState)(r?.urgency??(o?.urgency===`urgent`||o?.urgency===`relaxed`?o.urgency:`normal`)),[C,w]=(0,e.useState)(r?.execution.mode===`scheduled`||o?.execution?.mode===`scheduled`?`scheduled`:`claim`),[T,E]=(0,e.useState)(r?.execution.cron??o?.execution?.cron??`0 9 * * *`),[D,O]=(0,e.useState)([]),k=r?.model??o?.model??(s?void 0:je()),[A,j]=(0,e.useState)(k===void 0?``:JSON.stringify({provider:k.provider,model:k.model})),[M,N]=(0,e.useState)(k?.reasoningEffort??``),P=r?.presetId??o?.presetId??``,[F,ee]=(0,e.useState)(P),[I,te]=(0,e.useState)([]),[L,ne]=(0,e.useState)(void 0),[z,re]=(0,e.useState)(r?.permission??(o?.permission?p(o.permission):g(a.ledger.settings))),[ie,ae]=(0,e.useState)(r?.isolation??(o?.isolation===`none`?`none`:o?.isolation===`worktree`?`worktree`:m(a.ledger.settings))),[oe,se]=(0,e.useState)(r?.checklist!==void 0&&r.checklist.length>0?r.checklist.map(e=>({...e})):(o?.checklist??[]).map(e=>({text:e,checked:!1}))),ce=(0,e.useRef)(null),[B,V]=(0,e.useState)(!1);(0,e.useEffect)(()=>{ce.current?.focus();let e=e=>{e.key===`Escape`&&t.closeForm()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),(0,e.useEffect)(()=>{t.fetchModelCatalog().then(O).catch(()=>O([]))},[t]),(0,e.useEffect)(()=>{t.fetchPresetCatalog().then(e=>{te(e.presets),ne(e.defaultId),!s&&P===``&&e.defaultId!==void 0&&ee(e.defaultId)}).catch(()=>te([]))},[t,s,r?.presetId,P]);let H=C===`scheduled`?_(T.trim()):null,U=H===null?null:y(H,Date.now()),le=C===`scheduled`&&(H===null||U===null),W=c.trim().length>0&&v!==``&&!le,G=s&&r.status===`in_progress`,K=s&&((r.executions?.length??0)>0||r.status===`in_progress`),q=t.gitAvailable(v),ue=t.repoCount(v),de=K||!q,fe=()=>{if(q)return ie},pe=()=>F.trim().length>0?F.trim():void 0,me=()=>oe.map(e=>({...e,text:e.text.trim()})).filter(e=>e.text.length>0),Y=A===``?void 0:JSON.parse(A),X=(Y===void 0?void 0:D.find(e=>e.provider===Y.provider&&e.model===Y.model))?.reasoning,he=()=>{if(Y===void 0)return;let e=M.trim();return{provider:Y.provider,model:Y.model,...e.length>0?{reasoningEffort:e}:{}}},ge=()=>{if(!W||B)return;let e=he();s||Me(e);let n=fe(),i=pe(),a=me();V(!0),(s?t.update(r.id,r.version,{title:c,description:u,prompt:f,urgency:x,workspaceId:v,execution:C===`scheduled`?{mode:C,cron:T.trim()}:{mode:C},model:e??null,...n!==void 0&&!K?{isolation:n}:{},presetId:i??null,permission:z,checklist:a.length>0?a:null}):t.create({title:c,workspaceId:v,urgency:x,description:u.length>0?u:void 0,prompt:f.length>0?f:void 0,execution:C===`scheduled`?{mode:C,cron:T.trim()}:{mode:C},model:e,...n===void 0?{}:{isolation:n},...i===void 0?{}:{presetId:i},permission:z,...a.length>0?{checklist:a.map(e=>e.text)}:{}})).catch(()=>void 0).finally(()=>V(!1))},Z=()=>{if(!W||G||B)return;let e=he();s||Me(e);let n=fe(),i=pe(),a=me();V(!0),(async()=>{if(s)await t.update(r.id,r.version,{title:c,description:u,prompt:f,urgency:x,workspaceId:v,execution:C===`scheduled`?{mode:C,cron:T.trim()}:{mode:C},model:e??null,...n!==void 0&&!K?{isolation:n}:{},presetId:i??null,permission:z,checklist:a.length>0?a:null})&&await t.run(r.id);else{let r=await t.create({title:c,workspaceId:v,urgency:x,description:u.length>0?u:void 0,prompt:f.length>0?f:void 0,execution:C===`scheduled`?{mode:C,cron:T.trim()}:{mode:C},model:e,...n===void 0?{}:{isolation:n},...i===void 0?{}:{presetId:i},permission:z,...a.length>0?{checklist:a.map(e=>e.text)}:{}});r!==void 0&&await t.run(r)}})().catch(()=>void 0).finally(()=>V(!1))},_e=W?C===`scheduled`&&U!==null?i(`form.hint.nextRun`,{time:J(U)}):s?i(`form.hint.saveVersion`,{v:r.version,next:r.version+1}):i(`form.hint.createClaim`):c.trim().length===0?i(`form.hint.needTitle`):i(v===``?`form.hint.needProject`:`form.hint.cronBad`);return(0,n.jsx)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:e=>{e.target===e.currentTarget&&t.closeForm()},children:(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-taskform-modal`,"data-mode":s?`edit`:`create`,role:`dialog`,"aria-modal":`true`,"aria-label":i(s?`form.title.edit`:`form.title.create`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:s?`✎`:`✚`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:i(s?`form.title.edit`:`form.title.create`)}),(0,n.jsx)(`p`,{children:i(s?`form.subtitle.edit`:`form.subtitle.create`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":i(`shared.close`),onClick:()=>t.closeForm(),children:`✕`})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-body dsh-atb-taskform-body`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-form-col dsh-atb-form-left`,children:[(0,n.jsx)($,{label:i(`form.field.title`),required:!0,full:!0,children:(0,n.jsx)(`input`,{ref:ce,value:c,onChange:e=>l(e.target.value),placeholder:i(`form.field.titlePlaceholder`),maxLength:200})}),(0,n.jsxs)(`div`,{className:`dsh-atb-form-subgrid`,children:[(0,n.jsx)($,{label:i(`form.field.project`),required:!0,children:(0,n.jsx)(`select`,{value:v,onChange:e=>b(e.target.value),children:a.workspaces.map(e=>(0,n.jsx)(`option`,{value:e.id,children:e.title||e.path},e.id))})}),(0,n.jsx)($,{label:i(`form.field.model`),children:(0,n.jsxs)(`select`,{value:A,onChange:e=>{let t=e.target.value;if(j(t),t===``)N(``);else{let e=JSON.parse(t),n=D.find(t=>t.provider===e.provider&&t.model===e.model);n?.reasoning?.defaultEffort===void 0?N(``):N(n.reasoning.defaultEffort)}},children:[(0,n.jsx)(`option`,{value:``,children:i(`form.field.modelDefault`)}),D.map(e=>(0,n.jsx)(`option`,{value:JSON.stringify({provider:e.provider,model:e.model}),children:i(`form.model.option`,{name:e.name??e.model,provider:e.provider})},`${e.provider}/${e.model}`))]})}),Y!==void 0&&(0,n.jsx)($,{label:i(`form.field.effort`),children:(0,n.jsxs)(`select`,{value:M,onChange:e=>N(e.target.value),title:i(`form.field.effortTitle`),children:[(0,n.jsxs)(`option`,{value:``,children:[i(`form.effort.follow`),X?.defaultEffort===void 0?``:i(`shared.current`,{name:X.efforts.find(e=>e.id===X.defaultEffort)?.name??X.defaultEffort})]}),X!==void 0&&X.efforts.length>0?X.efforts.map(e=>(0,n.jsxs)(`option`,{value:e.id,children:[e.name,e.description?` (${e.description})`:``]},e.id)):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`option`,{value:`low`,children:i(`form.effort.low`)}),(0,n.jsx)(`option`,{value:`medium`,children:i(`form.effort.medium`)}),(0,n.jsx)(`option`,{value:`high`,children:i(`form.effort.high`)}),(0,n.jsx)(`option`,{value:`none`,children:i(`form.effort.none`)})]})]})}),I.length>0&&(0,n.jsx)($,{label:i(`form.field.preset`),children:(0,n.jsxs)(`select`,{value:F,onChange:e=>ee(e.target.value),title:i(`form.field.presetTitle`),children:[(0,n.jsxs)(`option`,{value:``,children:[i(`form.preset.follow`),L===void 0?``:i(`shared.current`,{name:I.find(e=>e.id===L)?.name??L})]}),I.map(e=>(0,n.jsxs)(`option`,{value:e.id,children:[e.name??e.id,e.id===L?i(`form.preset.defaultTag`):``]},e.id))]})})]}),(0,n.jsx)($,{label:i(`form.field.urgency`),full:!0,children:(0,n.jsx)(`div`,{className:`dsh-atb-urgency-picker`,children:Ne(i).map(e=>(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-urgency-opt`,"data-urgency":e.value,"data-on":x===e.value,onClick:()=>S(e.value),children:[(0,n.jsxs)(`span`,{className:`dsh-atb-urgency-name`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-dot`,"data-urgency":e.value}),e.label]}),(0,n.jsx)(`span`,{className:`dsh-atb-urgency-hint`,children:e.hint})]},e.value))})}),(0,n.jsx)($,{label:i(`form.field.permission`),full:!0,children:(0,n.jsx)(`div`,{className:`dsh-atb-perm-picker`,children:Fe(i).map(e=>(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-perm-opt`,"data-on":z===e.value,onClick:()=>re(e.value),children:[(0,n.jsxs)(`span`,{className:`dsh-atb-perm-name`,children:[e.icon,` `,e.label,e.value===`workspace-write`?i(`form.perm.defaultTag`):``]}),(0,n.jsx)(`span`,{className:`dsh-atb-perm-hint`,children:e.hint})]},e.value))})}),(0,n.jsx)($,{label:i(`form.field.mode`),full:!0,children:(0,n.jsxs)(`div`,{className:`dsh-atb-mode-picker`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":C===`claim`,onClick:()=>w(`claim`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:i(`form.mode.claim`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:i(`form.mode.claimHint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":C===`scheduled`,onClick:()=>w(`scheduled`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:i(`form.mode.scheduled`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:i(`form.mode.scheduledHint`)})]})]})}),C===`scheduled`&&(0,n.jsxs)($,{label:i(`form.field.cron`),required:!0,full:!0,children:[(0,n.jsx)(`input`,{className:le?`dsh-atb-input-bad`:void 0,value:T,onChange:e=>E(e.target.value),placeholder:i(`form.cron.placeholder`),spellCheck:!1}),(0,n.jsxs)(`span`,{className:`dsh-atb-cron-presets`,children:[Pe(i).map(e=>(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-cron-preset`,"data-on":T.trim()===e.cron,onClick:()=>E(e.cron),children:e.label},e.cron)),!le&&U!==null&&(0,n.jsx)(`span`,{className:`dsh-atb-cron-next`,children:i(`form.cron.next`,{time:J(U)})})]})]}),(0,n.jsxs)($,{label:i(`form.field.isolation`),full:!0,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-mode-picker`,"data-disabled":de?`true`:void 0,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":ie===`worktree`,disabled:de,title:i(K?`form.iso.locked`:q?`form.iso.worktreeTitle`:`form.iso.nonGit`),onClick:()=>ae(`worktree`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:i(`form.iso.worktree`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:i(K?`form.iso.lockedShort`:q?`form.iso.worktreeHint`:`form.iso.nonGit`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":ie===`none`,disabled:de,title:i(K?`form.iso.locked`:`form.iso.noneTitle`),onClick:()=>ae(`none`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:i(`form.iso.none`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:i(K?`form.iso.lockedShort`:q?`form.iso.noneHint`:`form.iso.noneHintNonGit`)})]})]}),!q&&!K&&(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,children:i(`form.iso.nonGitNote`)}),q&&!K&&ue>1&&(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,"data-mirror":`true`,children:i(`form.iso.mirrorNote`,{n:ue})})]}),(0,n.jsx)($,{label:i(s?`form.field.checklist`:`form.field.checklistOptional`),full:!0,children:(0,n.jsx)(Ie,{rows:oe,onChange:se,editing:s})})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-form-col dsh-atb-form-right`,children:[(0,n.jsx)($,{label:i(s?`form.field.description`:`form.field.descriptionOptional`),full:!0,children:(0,n.jsx)(ke,{value:u,onChange:d,controller:t,rows:7,placeholder:i(`form.desc.placeholder`)})}),(0,n.jsx)($,{label:i(s?`form.field.prompt`:`form.field.promptOptional`),full:!0,children:(0,n.jsx)(ke,{value:f,onChange:h,controller:t,rows:7,placeholder:i(`form.prompt.placeholder`)})})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-foot`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-hint`,"data-tone":W?void 0:`bad`,children:_e}),(0,n.jsxs)(`span`,{className:`dsh-atb-modal-footbtns`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>t.closeForm(),children:i(`shared.cancel`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,disabled:!W||G||B,title:i(G?`form.action.runBlockedTitle`:B?`form.action.runBusyTitle`:`form.action.runTitle`),onClick:Z,children:i(`form.action.run`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,disabled:!W||B,onClick:ge,children:i(s?`form.action.save`:`form.action.create`)})]})]})]})})}const Re=e=>[{value:`none`,name:e(`form.iso.none`),hint:e(`set.iso.noneHint`)},{value:`worktree`,name:e(`form.iso.worktree`),hint:e(`set.iso.worktreeHint`)}];function ze({controller:t}){let r=R(),i=t.getSnapshot(),a=i.ledger.settings?.defaultIsolation??`none`,o=h(i.ledger.settings),s=g(i.ledger.settings),[c,l]=(0,e.useState)(a),[u,d]=(0,e.useState)(o),[f,p]=(0,e.useState)(s),m=c!==a||u!==o||f!==s;return(0,n.jsx)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:e=>{e.target===e.currentTarget&&t.closeSettings()},children:(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-set`,role:`dialog`,"aria-modal":`true`,"aria-label":r(`set.aria`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:`🛠`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:r(`set.title`)}),(0,n.jsx)(`p`,{children:r(`set.subtitle`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":r(`shared.close`),onClick:()=>t.closeSettings(),children:`✕`})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-body`,children:[(0,n.jsxs)(`section`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:r(`set.iso.heading`)}),(0,n.jsx)(`div`,{className:`dsh-atb-mode-picker`,children:Re(r).map(e=>(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":c===e.value,title:e.hint,onClick:()=>l(e.value),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:e.name}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:e.hint})]},e.value))}),(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,children:r(`set.iso.current`,{current:r(a===`worktree`?`form.iso.worktree`:`form.iso.none`)})})]}),(0,n.jsxs)(`section`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:r(`set.sync.heading`)}),(0,n.jsxs)(`div`,{className:`dsh-atb-mode-picker`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":!u,title:r(`set.sync.off.title`),onClick:()=>d(!1),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:r(`set.sync.off.name`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:r(`set.sync.off.hint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":u,title:r(`set.sync.on.title`),onClick:()=>d(!0),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:r(`set.sync.on.name`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:r(`set.sync.on.hint`)})]})]}),(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,children:r(o?`set.sync.stateOn`:`set.sync.stateOff`)})]}),(0,n.jsxs)(`section`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:r(`set.perm.heading`)}),(0,n.jsxs)(`div`,{className:`dsh-atb-perm-picker`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-perm-opt`,"data-on":f===`workspace-write`,onClick:()=>p(`workspace-write`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-perm-name`,children:r(`set.perm.writeName`)}),(0,n.jsx)(`span`,{className:`dsh-atb-perm-hint`,children:r(`set.perm.writeHint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-perm-opt`,"data-on":f===`read-only`,onClick:()=>p(`read-only`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-perm-name`,children:r(`set.perm.readOnlyName`)}),(0,n.jsx)(`span`,{className:`dsh-atb-perm-hint`,children:r(`set.perm.readOnlyHint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-perm-opt`,"data-on":f===`danger-full-access`,onClick:()=>p(`danger-full-access`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-perm-name`,children:r(`set.perm.fullName`)}),(0,n.jsx)(`span`,{className:`dsh-atb-perm-hint`,children:r(`set.perm.fullHint`)})]})]}),(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,children:r(`set.perm.current`,{current:r(s===`read-only`?`set.perm.readOnlyName`:s===`danger-full-access`?`set.perm.fullName`:`set.perm.writeName`)})})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-foot`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-hint`,children:r(m?`set.foot.dirty`:`set.foot.clean`)}),(0,n.jsxs)(`span`,{className:`dsh-atb-modal-footbtns`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>t.closeSettings(),children:r(`shared.cancel`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,disabled:!m,onClick:()=>{t.updateSettings({defaultIsolation:c,syncExternalSessions:u,defaultPermission:f}).then(e=>{e&&t.closeSettings()})},children:r(`set.action.save`)})]})]})]})})}function Be({row:e}){return(0,n.jsxs)(`div`,{className:`dsh-atb-imp-row`,title:e.id,children:[(0,n.jsx)(`span`,{className:`dsh-atb-imp-row-title`,children:e.title}),(0,n.jsx)(`span`,{className:`dsh-atb-imp-row-status`,children:e.status})]})}function Ve({controller:t}){let r=R(),[i,a]=(0,e.useState)(``),[o,s]=(0,e.useState)(null),[c,l]=(0,e.useState)(void 0),[u,d]=(0,e.useState)(void 0),[f,p]=(0,e.useState)(`merge`),[m,h]=(0,e.useState)(!1),[g,_]=(0,e.useState)(void 0),[v,y]=(0,e.useState)(!1),b=(0,e.useRef)(null),{alert:x,el:S}=X(),C=e=>{d(void 0),l(void 0),_(void 0),y(!1),a(``),s(null),e!==void 0&&e.text().then(n=>{try{let r=JSON.parse(n);s(r),a(e.name),t.importPreview(r).then(e=>{e!==void 0&&d(e)})}catch{l(r(`imp.parseError`))}})},w=()=>{if(!(o===null||u===void 0||m)){if(f===`replace`&&!v){y(!0);return}h(!0),t.importCommit(f,o).then(e=>{h(!1),y(!1),e!==void 0&&_(e.mode===`replace`?r(`imp.result.replace`,{n:e.created+e.overwritten,total:e.replacedTotal??0}):r(`imp.result.merge`,{n:e.created,m:e.overwritten}))})}},T=()=>t.closeImport();return(0,n.jsxs)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:e=>{e.target===e.currentTarget&&T()},children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-imp`,role:`dialog`,"aria-modal":`true`,"aria-label":r(`imp.aria`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:`⬆`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:r(`imp.title`)}),(0,n.jsx)(`p`,{children:r(`imp.subtitle`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":r(`shared.close`),onClick:T,children:`✕`})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-body`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-imp-picker`,children:[(0,n.jsx)(`input`,{ref:b,type:`file`,accept:`.json,application/json`,onChange:e=>C(e.target.files?.[0])}),i.length>0&&(0,n.jsx)(`span`,{className:`dsh-atb-imp-filename`,children:i})]}),(0,n.jsx)(`div`,{className:`dsh-atb-imp-note`,children:r(`imp.note`)}),c!==void 0&&(0,n.jsx)(`div`,{className:`dsh-atb-imp-error`,children:c}),u===void 0&&c===void 0&&i.length>0&&(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:r(`imp.previewing`)}),u!==void 0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`div`,{className:`dsh-atb-imp-stats`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-imp-stat`,"data-tone":`ok`,children:[(0,n.jsx)(`b`,{children:u.create.length}),(0,n.jsx)(`span`,{children:r(`imp.stat.create`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-imp-stat`,"data-tone":`warn`,children:[(0,n.jsx)(`b`,{children:u.overwrite.length}),(0,n.jsx)(`span`,{children:r(`imp.stat.overwrite`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-imp-stat`,"data-tone":u.invalid.length>0?`bad`:void 0,children:[(0,n.jsx)(`b`,{children:u.invalid.length}),(0,n.jsx)(`span`,{children:r(`imp.stat.invalid`)})]})]}),u.create.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-imp-sec`,children:[(0,n.jsx)(`h4`,{children:r(`imp.sec.create`)}),(0,n.jsx)(`div`,{className:`dsh-atb-imp-list`,children:u.create.map(e=>(0,n.jsx)(Be,{row:e},e.id))})]}),u.overwrite.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-imp-sec`,children:[(0,n.jsx)(`h4`,{children:r(`imp.sec.overwrite`)}),(0,n.jsx)(`div`,{className:`dsh-atb-imp-list`,children:u.overwrite.map(e=>(0,n.jsx)(Be,{row:e},e.id))})]}),u.invalid.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-imp-sec`,children:[(0,n.jsx)(`h4`,{children:r(`imp.sec.invalid`)}),(0,n.jsx)(`div`,{className:`dsh-atb-imp-list`,children:u.invalid.map((e,t)=>(0,n.jsxs)(`div`,{className:`dsh-atb-imp-row`,"data-tone":`bad`,title:e.id??``,children:[(0,n.jsx)(`span`,{className:`dsh-atb-imp-row-title`,children:e.id??r(`imp.noId`)}),(0,n.jsx)(`span`,{className:`dsh-atb-imp-row-status`,children:e.reason})]},e.id??`invalid-${t}`))})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-mode-picker`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":f===`merge`,onClick:()=>{p(`merge`),y(!1)},children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:r(`imp.mode.merge`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:r(`imp.mode.mergeHint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":f===`replace`,onClick:()=>p(`replace`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:r(`imp.mode.replace`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:r(`imp.mode.replaceHint`)})]})]}),g!==void 0&&(0,n.jsx)(`div`,{className:`dsh-atb-imp-result`,children:g})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-foot`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-hint`,children:r(f===`replace`?v?`imp.foot.replaceConfirm`:`imp.foot.replaceNeedConfirm`:`imp.foot.mergeHint`)}),(0,n.jsxs)(`span`,{className:`dsh-atb-modal-footbtns`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:T,children:r(g===void 0?`shared.cancel`:`shared.close`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,"data-danger":f===`replace`&&v?`true`:void 0,disabled:u===void 0||m,onClick:w,children:r(f===`replace`&&v?`imp.action.confirmReplace`:`imp.action.run`)})]})]})]}),S]})}function He({controller:t}){let r=R(),i=t.getSnapshot(),[a,o]=(0,e.useState)({}),[s,c]=(0,e.useState)(void 0),{alert:l,el:u}=X(),d=()=>t.closeTemplateManager(),f=(e,t)=>a[e]??t,p=(e,n)=>{let a=i.templates.find(t=>t.id===e);a===void 0||n===a.name||t.upsertTemplate({id:e,name:n,task:a.task}).then(t=>{t&&(o(t=>{let n={...t};return delete n[e],n}),l(r(`tpl.renamed`)))})};return(0,n.jsxs)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:e=>{e.target===e.currentTarget&&d()},children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-tplm`,role:`dialog`,"aria-modal":`true`,"aria-label":r(`tpl.aria`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:`⌗`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:r(`tpl.title`)}),(0,n.jsx)(`p`,{children:r(`tpl.subtitle`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":r(`shared.close`),onClick:d,children:`✕`})]}),(0,n.jsx)(`div`,{className:`dsh-atb-modal-body`,children:i.templates.length===0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:r(`tpl.empty`)}):(0,n.jsx)(`div`,{className:`dsh-atb-tplm-list`,children:i.templates.map(e=>(0,n.jsxs)(`div`,{className:`dsh-atb-tplm-row`,children:[(0,n.jsx)(`input`,{className:`dsh-atb-tplm-name`,value:f(e.id,e.name),maxLength:60,spellCheck:!1,"aria-label":r(`tpl.name.aria`,{name:e.name}),onChange:t=>o(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{t.key===`Enter`&&p(e.id,f(e.id,e.name))}}),(0,n.jsxs)(`span`,{className:`dsh-atb-tplm-meta`,title:`${e.builtin===!0?r(`tpl.builtin`):r(`tpl.custom`)}${e.task.checklist!==void 0&&e.task.checklist.length>0?r(`tpl.meta.checklist`,{n:e.task.checklist.length}):``}${e.task.urgency===void 0?``:` · ${e.task.urgency}`}${e.task.permission===void 0?``:` · ${r(`shared.permission`)}: ${e.task.permission}`}`,children:[e.builtin===!0?r(`tpl.builtin`):r(`tpl.custom`),e.task.checklist!==void 0&&e.task.checklist.length>0?r(`tpl.meta.checklist`,{n:e.task.checklist.length}):``,e.task.urgency===void 0?``:` · ${e.task.urgency}`,e.task.permission!==void 0&&e.task.permission!==`workspace-write`?` · ${e.task.permission===`read-only`?r(`tpl.meta.permReadOnly`):r(`tpl.meta.permFull`)}`:``]}),(0,n.jsxs)(`span`,{className:`dsh-atb-tplm-btns`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,disabled:f(e.id,e.name)===e.name||f(e.id,e.name).trim().length===0,title:r(`tpl.rename.title`),onClick:()=>p(e.id,f(e.id,e.name)),children:r(`tpl.rename.button`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`tpl.use.title`),onClick:()=>{d(),t.newFromTemplate(e.task)},children:r(`tpl.use.button`)}),s===e.id?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,onClick:()=>{t.deleteTemplate(e.id),c(void 0)},children:r(`shared.confirmDelete`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>c(void 0),children:r(`shared.cancel`)})]}):(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,title:r(`tpl.delete.title`),onClick:()=>c(e.id),children:`🗑`})]})]},e.id))})}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-foot`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-hint`,children:r(`tpl.foot.hint`)}),(0,n.jsx)(`span`,{className:`dsh-atb-modal-footbtns`,children:(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:d,children:r(`shared.close`)})})]})]}),u]})}const Ue={urgent:0,normal:1,relaxed:2};function We(e,t){let n=e.search.trim().toLowerCase(),r=t.filter(t=>(e.filters.workspaceId===void 0||t.workspaceId===e.filters.workspaceId)&&(e.filters.urgencies.length===0||e.filters.urgencies.includes(t.urgency))&&(n.length===0||t.title.toLowerCase().includes(n)||t.id.toLowerCase().includes(n)));if(e.sortBy==="default")return r;let i=[...r];return e.sortBy===`updated`?i.sort((e,t)=>t.updatedAt-e.updatedAt):e.sortBy===`created`?i.sort((e,t)=>t.createdAt-e.createdAt):e.sortBy===`urgency`?i.sort((e,t)=>Ue[e.urgency]-Ue[t.urgency]||t.updatedAt-e.updatedAt):e.sortBy===`title`&&i.sort((e,t)=>e.title.localeCompare(t.title,void 0,{numeric:!0})),i}function Ge({controller:t}){let r=R(),i=(0,e.useSyncExternalStore)(e=>t.subscribe(e),()=>t.getSnapshot()),[a,o]=(0,e.useState)(()=>Date.now());(0,e.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),6e4);return()=>clearInterval(e)},[]);let s=We(i,i.ledger.tasks.filter(e=>e.trashedAt===void 0)),c=i.selectedId===void 0?void 0:i.ledger.tasks.find(e=>e.id===i.selectedId),{alert:u,el:d}=X(),[p,m]=(0,e.useState)(!1),h=()=>m(!1),[g,_]=(0,e.useState)(!1),v=()=>_(!1);return(0,n.jsxs)(`div`,{className:`dsh-atb-board`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-toolbar`,children:[(0,n.jsx)(`h2`,{className:`dsh-atb-title`,children:r(`board.title`)}),(0,n.jsx)(`span`,{className:`dsh-atb-count`,children:r(`board.count.tasks`,{n:s.length,rev:i.ledger.revision})}),(0,n.jsxs)(`div`,{className:`dsh-atb-newmenu`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,onClick:()=>{let e=!p;m(e),e&&t.prepareTemplateMenu()},children:r(`board.action.newTask`)}),p&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`dsh-atb-newmenu-backdrop`,onClick:h}),(0,n.jsxs)(`div`,{className:`dsh-atb-newmenu-list`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,onClick:()=>{h(),t.setComposer(!0)},children:r(`board.action.blankTask`)}),i.templates.map(e=>(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,title:e.task.description!==void 0&&e.task.description.length>0?e.task.description.slice(0,120):e.name,onClick:()=>{h(),t.newFromTemplate(e.task)},children:e.name},e.id)),(0,n.jsx)(`div`,{className:`dsh-atb-newmenu-sep`}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,onClick:()=>{h(),t.openTemplateManager()},children:r(`board.action.manageTemplates`)})]})]})]}),(0,n.jsx)(`div`,{className:`dsh-atb-spacer`}),(0,n.jsx)(`input`,{className:`dsh-atb-input dsh-atb-search`,value:i.search,placeholder:r(`board.search.placeholder`),spellCheck:!1,onChange:e=>t.setSearch(e.target.value)}),(0,n.jsxs)(`select`,{className:`dsh-atb-select`,value:i.filters.workspaceId??``,onChange:e=>t.setWorkspaceFilter(e.target.value===``?void 0:e.target.value),children:[(0,n.jsx)(`option`,{value:``,children:r(`board.filter.allProjects`)}),i.workspaces.map(e=>(0,n.jsx)(`option`,{value:e.id,children:e.title||e.path},e.id))]}),(0,n.jsxs)(`select`,{className:`dsh-atb-select`,value:i.sortBy,title:r(`board.sort.title`),onChange:e=>t.setSortBy(e.target.value),children:[(0,n.jsx)(`option`,{value:`default`,children:r(`board.sort.default`)}),(0,n.jsx)(`option`,{value:`updated`,children:r(`board.sort.updated`)}),(0,n.jsx)(`option`,{value:`urgency`,children:r(`board.sort.urgency`)}),(0,n.jsx)(`option`,{value:`created`,children:r(`board.sort.created`)}),(0,n.jsx)(`option`,{value:`title`,children:r(`board.sort.byTitle`)})]}),[`urgent`,`normal`,`relaxed`].map(e=>(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-chip`,"data-urgency":e,"data-on":i.filters.urgencies.includes(e),onClick:()=>t.toggleUrgency(e),children:[(0,n.jsx)(`span`,{className:`dsh-atb-dot`,"data-urgency":e}),r(ue[e])]},e)),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>t.toggleSecondary(),children:i.secondaryOpen?r(`board.action.backToBoard`):r(`board.action.otherTasks`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`board.action.settingsTitle`),onClick:()=>t.openSettings(),children:r(`board.action.settings`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`board.action.diagTitle`),onClick:()=>t.openDiagnostics(),children:r(`board.action.diag`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`board.action.importTitle`),onClick:()=>t.openImport(),children:r(`board.action.import`)}),(0,n.jsxs)(`div`,{className:`dsh-atb-newmenu`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`board.action.exportTitle`),onClick:()=>_(!g),children:r(`board.action.export`)}),g&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`dsh-atb-newmenu-backdrop`,onClick:v}),(0,n.jsxs)(`div`,{className:`dsh-atb-newmenu-list`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,title:r(`board.export.jsonTitle`),onClick:()=>{v(),t.exportJson()},children:r(`board.export.json`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,title:r(`board.export.csvTitle`),onClick:()=>{v(),t.exportCsv()},children:r(`board.export.csv`)})]})]})]}),(0,n.jsxs)(`a`,{className:`dsh-atb-ver`,href:`https://github.com/cloader/dsh-taskboard`,target:`_blank`,rel:`noopener noreferrer`,children:[`V`,`0.6.4`]})]}),i.error!==void 0&&(0,n.jsx)(`div`,{className:`dsh-atb-error`,children:i.error}),i.secondaryOpen?(0,n.jsx)(qe,{controller:t,tasks:We(i,i.ledger.tasks)}):(0,n.jsx)(`div`,{className:`dsh-atb-columns`,children:l.map(e=>{let o=s.filter(t=>t.status===e);return(0,n.jsxs)(`div`,{className:`dsh-atb-column`,onDragOver:e=>{e.dataTransfer.types.includes(`application/x-dsh-atb-task`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,e.currentTarget.dataset.dragover=`true`)},onDragLeave:e=>{delete e.currentTarget.dataset.dragover},onDrop:n=>{n.preventDefault(),delete n.currentTarget.dataset.dragover;let a=n.dataTransfer.getData(pe);if(a.length===0)return;let o=i.ledger.tasks.find(e=>e.id===a);if(!(o===void 0||o.status===e)){if(!f(o.status,e)){u(r(`board.drag.forbidden`,{from:r(G[o.status]),to:r(G[e])}));return}t.move(a,o.version,e)}},children:[(0,n.jsxs)(`div`,{className:`dsh-atb-colhead`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-dot`,"data-status":e}),r(G[e]),(0,n.jsx)(`span`,{className:`dsh-atb-colcount`,children:o.length})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-cards`,children:[o.map(e=>(0,n.jsx)(Y,{task:e,controller:t,draggable:!0,now:a,onAlert:u},e.id)),o.length===0&&(0,n.jsx)(`div`,{className:`dsh-atb-empty`,children:r(`board.empty`)})]})]},e)})}),c!==void 0&&(0,n.jsx)(`div`,{className:`dsh-atb-detailpanel`,children:(0,n.jsx)(Ee,{task:c,controller:t,now:a},c.id)}),i.composerOpen&&(0,n.jsx)(Le,{controller:t,task:i.editingId===void 0?void 0:i.ledger.tasks.find(e=>e.id===i.editingId)}),i.diagOpen&&(0,n.jsx)(Ke,{controller:t}),i.settingsOpen&&(0,n.jsx)(ze,{controller:t}),i.importOpen&&(0,n.jsx)(Ve,{controller:t}),i.tplManagerOpen&&(0,n.jsx)(He,{controller:t}),d]})}function Ke({controller:e}){let t=R(),r=e.getSnapshot(),i=r.diagnostics,a=e=>{let t=r.workspaces.find(t=>t.id===e);return t?.title??t?.path??e.slice(0,8)};return(0,n.jsx)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:t=>{t.target===t.currentTarget&&e.closeDiagnostics()},children:(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-diag`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`diag.title`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:`⚙`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:t(`diag.title`)}),(0,n.jsx)(`p`,{children:t(`diag.subtitle`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":t(`shared.close`),onClick:()=>e.closeDiagnostics(),children:`✕`})]}),(0,n.jsx)(`div`,{className:`dsh-atb-modal-body`,children:i===void 0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:t(`shared.loading`)}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`div`,{className:`dsh-atb-diag-grid`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-diag-item`,children:[(0,n.jsx)(`b`,{children:i.revision}),(0,n.jsx)(`span`,{children:t(`diag.revision`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-item`,children:[(0,n.jsx)(`b`,{children:i.tasks}),(0,n.jsx)(`span`,{children:t(`diag.tasks`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-item`,"data-bad":i.staleRunning>0?`true`:void 0,children:[(0,n.jsx)(`b`,{children:i.staleRunning}),(0,n.jsx)(`span`,{children:t(`diag.running`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-item`,"data-bad":i.orphanWorktrees.length>0?`true`:void 0,children:[(0,n.jsx)(`b`,{children:i.orphanWorktrees.length}),(0,n.jsx)(`span`,{children:t(`diag.orphans`)})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:t(`diag.orphans.heading`)}),i.orphanWorktrees.length===0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:t(`diag.orphans.none`)}):(0,n.jsx)(`div`,{className:`dsh-atb-diag-orphans`,children:i.orphanWorktrees.map(r=>(0,n.jsxs)(`div`,{className:`dsh-atb-diag-orphan`,children:[(0,n.jsxs)(`span`,{className:`dsh-atb-diag-orphan-path`,title:r.path,children:[a(r.workspaceId),` · `,r.taskId]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,onClick:()=>void e.cleanupOrphan(r.workspaceId,r.taskId),children:t(`diag.orphans.cleanup`)})]},r.path))}),(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:t(`diag.orphans.hint`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:t(`diag.gitignore.heading`)}),(i.gitIgnoreSuggestions??[]).length===0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:t(`diag.gitignore.none`)}):(0,n.jsx)(`div`,{className:`dsh-atb-diag-orphans`,children:i.gitIgnoreSuggestions.map(e=>(0,n.jsx)(`div`,{className:`dsh-atb-diag-orphan`,children:(0,n.jsxs)(`span`,{className:`dsh-atb-diag-orphan-path`,title:e.workspacePath,children:[a(e.workspaceId),` · `,t(`diag.gitignore.suggestA`),` `,(0,n.jsx)(`code`,{children:`.dsh-worktrees/`}),t(`diag.gitignore.suggestB`)]})},e.workspaceId))})]})]})})]})})}function qe({controller:e,tasks:t}){let r=R(),i=t.filter(e=>e.trashedAt!==void 0),a=t.filter(e=>e.trashedAt===void 0&&e.status===`archived`),o=t.filter(e=>e.trashedAt===void 0&&e.status===`canceled`),s=[{label:r(`status.column.canceled`),dot:`canceled`,rows:o},{label:r(`status.column.archived`),dot:`archived`,rows:a},{label:r(`board.group.trashed`),dot:`trashed`,rows:i}];return i.length+a.length+o.length===0?(0,n.jsx)(`div`,{className:`dsh-atb-secondary`,children:(0,n.jsx)(`div`,{className:`dsh-atb-empty`,children:r(`board.secondary.empty`)})}):(0,n.jsx)(`div`,{className:`dsh-atb-columns`,children:s.map(t=>(0,n.jsxs)(`div`,{className:`dsh-atb-column`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-colhead`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-dot`,"data-status":t.dot}),t.label,(0,n.jsx)(`span`,{className:`dsh-atb-colcount`,children:t.rows.length})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-cards`,children:[t.rows.map(t=>(0,n.jsx)(Y,{task:t,controller:e},t.id)),t.rows.length===0&&(0,n.jsx)(`div`,{className:`dsh-atb-empty`,children:r(`board.empty`)})]})]},t.label))})}const Je=`data-dsh-atb-active`,Ye=[`data-dsh-taskboard-active`,`data-dsh-ssh-active`],Xe=`dsh-panel-activate`,Ze=`dsh-taskboard`;function Qe(){return document.querySelector(`[data-pane="conversation"], [class*="centerCol"], .dshDesktopConversationSurface`)??void 0}function $e(e){let r,i,a=()=>{if(i!==void 0)return;let a=Qe();a!==void 0&&(i=document.createElement(`div`),i.dataset.dshAtbView=``,i.className=`dsh-atb-view`,a.appendChild(i),r=(0,t.createRoot)(i),r.render((0,n.jsx)(Ge,{controller:e})))},o=new MutationObserver(()=>{a()});o.observe(document.body,{childList:!0,subtree:!0});let s=()=>{if(e.getSnapshot().boardOpen){for(let e of Ye)document.documentElement.removeAttribute(e);document.documentElement.setAttribute(Je,``),document.dispatchEvent(new CustomEvent(Xe,{detail:Ze}))}else document.documentElement.removeAttribute(Je)},c=t=>{t.detail!==Ze&&e.getSnapshot().boardOpen&&e.closeBoard()},l=t=>{if(!e.getSnapshot().boardOpen)return;let n=t.target;n!==null&&n.closest(`[data-dsh-atb-entry]`)===null&&n.closest(`[class*="sessionRow"], [class*="projectRow"], [class*="searchResultRow"], [class*="searchResultWorkspace"], [class*="newSession"]`)!==null&&e.closeBoard()};document.addEventListener(`click`,l,!0),document.addEventListener(Xe,c);let u=e.subscribe(s);return s(),a(),()=>{document.removeEventListener(`click`,l,!0),document.removeEventListener(Xe,c),o.disconnect(),u(),document.documentElement.removeAttribute(Je),r?.unmount(),i?.remove()}}function et(e){let t=(e,t,n)=>e.list.getSnapshot().byId[n]===void 0?`absent`:t?.list.getSnapshot().archivedSessionIds.includes(n)??!1?`archived`:`openable`;return async n=>{let r=e.getSessions();if(r===void 0)return`unavailable`;try{let i=t(r,e.getWorkspaces(),n);if(i===`absent`){try{await r.refresh()}catch{}i=t(r,e.getWorkspaces(),n)}return i===`archived`?`archived`:i===`absent`?`missing`:(r.open(n),`opened`)}catch{return`unavailable`}}}const tt=[`connection`];function nt(e){try{oe(),F(e.get?.(`locale`),()=>e.get?.(`locale`));let t=c(),n=new ie(t);n.installModelCatalog(async()=>{try{let t=e.get?.(`modelDirectories`)??e.modelDirectories;if(t?.catalog?.load!==void 0){let e=await t.catalog.load();if(e?.groups!==void 0&&e.groups.length>0){let t=[];for(let n of e.groups)for(let e of n.models)t.push({provider:n.id,model:e.id,name:e.name,...e.description===void 0?{}:{description:e.description},...e.reasoning===void 0?{}:{reasoning:e.reasoning}});if(t.length>0)return t}}}catch{}try{let t=e.get?.(`remote`)??e.remote;if(t?.session?.modelCatalog!==void 0){let e=await t.session.modelCatalog();if(e.ok&&e.value?.groups!==void 0&&e.value.groups.length>0){let t=[];for(let n of e.value.groups)for(let e of n.models)t.push({provider:n.id,model:e.id,name:e.name,...e.description===void 0?{}:{description:e.description},...e.reasoning===void 0?{}:{reasoning:e.reasoning}});if(t.length>0)return t}}if(t?.llm?.models!==void 0){let e=await t.llm.models({});if(e.result.ok&&e.result.value?.groups!==void 0&&e.result.value.groups.length>0){let t=[];for(let n of e.result.value.groups)for(let e of n.models)t.push({provider:n.id,model:e.id,name:e.name,...e.description===void 0?{}:{description:e.description},...e.reasoning===void 0?{}:{reasoning:e.reasoning}});if(t.length>0)return t}}}catch{}try{let t=e.get?.(`connection`)??e.connection;if(t?.api?.llm?.models!==void 0){let e=await t.api.llm.models({});if(e.result.ok&&e.result.value?.groups!==void 0&&e.result.value.groups.length>0){let t=[];for(let n of e.result.value.groups)for(let e of n.models)t.push({provider:n.id,model:e.id,name:e.name,...e.description===void 0?{}:{description:e.description},...e.reasoning===void 0?{}:{reasoning:e.reasoning}});if(t.length>0)return t}}}catch{}try{let e=await t.modelCatalog();if(e.models!==void 0&&e.models.length>0)return e.models}catch{}return[]}),n.installPresetRoster(async()=>{try{let t=e.get?.(`remote`)??e.remote;if(t?.agentPresets?.list!==void 0){let e=await t.agentPresets.list(),n=e.ok===!0?e.value.presets:e.result?.ok===!0?e.result.value.presets:void 0;if(n!==void 0&&n.length>0){let e=n.map(e=>({id:e.id,name:e.name})),t=n.find(e=>e.isDefault);return{presets:e,...t===void 0?{}:{defaultId:t.id}}}}}catch{}try{let t=e.get?.(`connection`)??e.connection;if(t?.api?.agentPresets?.list!==void 0){let e=await t.api.agentPresets.list({});if(e.result.ok&&e.result.value?.presets!==void 0&&e.result.value.presets.length>0){let t=e.result.value.presets.map(e=>({id:e.id,name:e.name})),n=e.result.value.presets.find(e=>e.isDefault);return{presets:t,...n===void 0?{}:{defaultId:n.id}}}}}catch{}try{let e=await t.modelCatalog();if(e.presets!==void 0&&e.presets.length>0)return{presets:e.presets,...e.defaultPresetId===void 0?{}:{defaultId:e.defaultPresetId}}}catch{}return{presets:[]}}),n.installSessionJumper(et({getSessions:()=>e.get?.(`sessions`),getWorkspaces:()=>e.get?.(`workspaces`)})),n.start();let r=[];try{r.push(W(n)),r.push($e(n))}catch(e){console.error(`[dsh-taskboard] mount failed:`,e)}e.effect?.(()=>()=>{for(let e of r.splice(0))e();n.dispose(),ee()},`dsh-taskboard: client mount`)}catch(e){console.error(`[dsh-taskboard] client half failed to start:`,e)}}exports.apply=nt,exports.inject=tt,exports.name=`dsh-taskboard/client`;
|
|
926
|
+
`,t=/\s/.test(e)||r===0,i=n.slice(r+1),a=!/\s/.test(i);if(t&&a){D(r),T(i),C(!0);return}}C(!1)},M=e=>{let n=m.current;if(n===null||E<0)return;let r=n.selectionStart,a=t.slice(0,E),o=t.slice(r),s=`/${e.name} `;i(a+s+o),C(!1),setTimeout(()=>{if(m.current!==null){let e=E+s.length;m.current.focus(),m.current.setSelectionRange(e,e)}},0)},N=e=>{if(S&&A.length>0){if(e.key===`ArrowDown`){e.preventDefault(),k(e=>(e+1)%A.length);return}if(e.key===`ArrowUp`){e.preventDefault(),k(e=>(e-1+A.length)%A.length);return}if(e.key===`Enter`||e.key===`Tab`){let t=A[O];if(t!==void 0){e.preventDefault(),M(t);return}}if(e.key===`Escape`){e.preventDefault(),C(!1);return}}},P=(0,e.useCallback)(()=>{let e=m.current;if(e===null)return;let t=e.getBoundingClientRect(),n=window.innerHeight,r=h.current?.offsetHeight??0,i=r>0?r:240,a=t.top-6-8,o=n-8-(t.bottom+6),s=o>a,c=Math.min(i,Math.max(s?o:a,120)),l=s?t.bottom+6:t.top-6-c;v(e=>e.left===t.left&&e.top===l&&e.width===t.width&&e.maxHeight===c?e:{position:`fixed`,left:t.left,top:l,width:t.width,maxHeight:c,zIndex:100})},[]);return(0,e.useLayoutEffect)(()=>{S&&P()}),(0,e.useEffect)(()=>{if(S)return window.addEventListener(`scroll`,P,!0),window.addEventListener(`resize`,P),()=>{window.removeEventListener(`scroll`,P,!0),window.removeEventListener(`resize`,P)}},[S,P]),(0,n.jsxs)(`div`,{className:`dsh-atb-prompt-wrap ${d??``}`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-prompt-inner`,children:[(0,n.jsx)(`textarea`,{ref:m,className:`dsh-atb-prompt-input`,value:t,rows:s,maxLength:c,disabled:l,autoFocus:u,placeholder:o,"aria-label":f,onChange:e=>{i(e.target.value),j()},onKeyUp:j,onClick:j,onKeyDown:N}),S&&A.length>0&&(0,r.createPortal)((0,n.jsxs)(`div`,{ref:h,className:`dsh-atb-slash-popup`,style:_,role:`listbox`,"aria-label":p(`slash.aria`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-slash-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-slash-title`,children:p(`slash.title`)}),(0,n.jsx)(`span`,{className:`dsh-atb-slash-hint`,children:p(`slash.hint`)})]}),(0,n.jsx)(`div`,{ref:g,className:`dsh-atb-slash-list`,children:A.map((e,t)=>(0,n.jsxs)(`div`,{role:`option`,"aria-selected":t===O,className:`dsh-atb-slash-item`,"data-active":t===O?`true`:void 0,"data-kind":e.kind,onClick:()=>M(e),onMouseEnter:()=>k(t),children:[(0,n.jsx)(`span`,{className:`dsh-atb-slash-badge`,"data-kind":e.kind,children:e.kind===`command`?p(`slash.badge.command`):p(`slash.badge.skill`)}),(0,n.jsxs)(`span`,{className:`dsh-atb-slash-name`,children:[`/`,e.name]}),e.hint&&(0,n.jsx)(`span`,{className:`dsh-atb-slash-param`,children:e.hint}),e.description&&(0,n.jsx)(`span`,{className:`dsh-atb-slash-desc`,children:e.description})]},`${e.kind}-${e.name}`))})]}),document.body)]}),(0,n.jsx)(`div`,{className:`dsh-atb-prompt-foot`,children:(0,n.jsxs)(`span`,{className:`dsh-atb-prompt-tip`,children:[p(`slash.tipA`),` `,(0,n.jsx)(`code`,{children:`/`}),` `,p(`slash.tipB`)]})})]})}const Ae=`dsh-taskboard-last-model-v1`;function je(){try{let e=localStorage.getItem(Ae);if(e===null)return;let t=JSON.parse(e);if(typeof t==`object`&&t){let{provider:e,model:n,reasoningEffort:r}=t;if(typeof e==`string`&&typeof n==`string`&&e.trim().length>0&&n.trim().length>0)return{provider:e.trim(),model:n.trim(),...typeof r==`string`&&r.trim().length>0?{reasoningEffort:r.trim()}:{}}}return}catch{return}}function Me(e){try{e===void 0?localStorage.removeItem(Ae):localStorage.setItem(Ae,JSON.stringify(e))}catch{}}const Ne=e=>[{value:`urgent`,label:e(`form.urgency.urgent`),hint:e(`form.urgency.urgentHint`)},{value:`normal`,label:e(`form.urgency.normal`),hint:e(`form.urgency.normalHint`)},{value:`relaxed`,label:e(`form.urgency.relaxed`),hint:e(`form.urgency.relaxedHint`)}],Pe=e=>[{label:e(`form.cron.daily`),cron:`0 9 * * *`},{label:e(`form.cron.hourly`),cron:`0 * * * *`},{label:e(`form.cron.every10min`),cron:`*/10 * * * *`},{label:e(`form.cron.weekly`),cron:`0 9 * * 1`}],Fe=e=>[{value:`workspace-write`,label:e(`form.perm.write`),hint:e(`form.perm.writeHint`),icon:`📁`},{value:`read-only`,label:e(`form.perm.readOnly`),hint:e(`form.perm.readOnlyHint`),icon:`🔒`},{value:`danger-full-access`,label:e(`form.perm.fullAccess`),hint:e(`form.perm.fullAccessHint`),icon:`⚡`}];function $({label:e,required:t=!1,full:r=!1,children:i}){return(0,n.jsxs)(`label`,{className:`dsh-atb-field`,"data-span":r?`full`:void 0,children:[(0,n.jsxs)(`span`,{className:`dsh-atb-field-label`,children:[e,t&&(0,n.jsx)(`em`,{className:`dsh-atb-req`,children:`*`})]}),i]})}function Ie({rows:e,onChange:t,editing:r}){let i=R(),a=(n,r)=>{t(e.map((e,t)=>t===n?{...e,...r}:e))},o=e.filter(e=>e.checked).length;return(0,n.jsxs)(`div`,{className:`dsh-atb-cke`,children:[e.map((o,s)=>(0,n.jsxs)(`div`,{className:`dsh-atb-cke-row`,children:[r&&(0,n.jsx)(`input`,{type:`checkbox`,className:`dsh-atb-cke-box`,checked:o.checked,title:i(`form.check.checkedTitle`,{who:o.checkedBy??i(`form.check.notCheckedYet`)}),onChange:e=>a(s,{checked:e.target.checked})}),(0,n.jsx)(`input`,{className:`dsh-atb-cke-text`,value:o.text,maxLength:200,placeholder:i(`form.check.itemPlaceholder`,{n:s+1}),spellCheck:!1,onChange:e=>a(s,{text:e.target.value})}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-cke-del`,title:i(`form.check.removeTitle`),onClick:()=>t(e.filter((e,t)=>t!==s)),children:`✕`})]},o.id??`new-${s}`)),e.length<30&&(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-cke-add`,onClick:()=>t([...e,{text:``,checked:!1}]),children:i(`form.check.add`)}),e.length>0&&(0,n.jsx)(`span`,{className:`dsh-atb-cke-hint`,children:r?i(`form.check.hintEdit`,{checked:o,total:e.length}):i(`form.check.hintCreate`,{n:e.length})})]})}function Le({controller:t,task:r}){let i=R(),a=t.getSnapshot(),o=a.templatePrefill,s=r!==void 0,[c,l]=(0,e.useState)(r?.title??o?.title??``),[u,d]=(0,e.useState)(r?.description??o?.description??``),[f,h]=(0,e.useState)(r?.prompt??o?.prompt??``),[v,b]=(0,e.useState)(r?.workspaceId??a.filters.workspaceId??a.workspaces[0]?.id??``),[x,S]=(0,e.useState)(r?.urgency??(o?.urgency===`urgent`||o?.urgency===`relaxed`?o.urgency:`normal`)),[C,w]=(0,e.useState)(r?.execution.mode===`scheduled`||o?.execution?.mode===`scheduled`?`scheduled`:`claim`),[T,E]=(0,e.useState)(r?.execution.cron??o?.execution?.cron??`0 9 * * *`),[D,O]=(0,e.useState)([]),k=r?.model??o?.model??(s?void 0:je()),[A,j]=(0,e.useState)(k===void 0?``:JSON.stringify({provider:k.provider,model:k.model})),[M,N]=(0,e.useState)(k?.reasoningEffort??``),P=r?.presetId??o?.presetId??``,[F,ee]=(0,e.useState)(P),[I,te]=(0,e.useState)([]),[L,ne]=(0,e.useState)(void 0),[z,re]=(0,e.useState)(r?.permission??(o?.permission?p(o.permission):g(a.ledger.settings))),[ie,ae]=(0,e.useState)(r?.isolation??(o?.isolation===`none`?`none`:o?.isolation===`worktree`?`worktree`:m(a.ledger.settings))),[oe,se]=(0,e.useState)(r?.checklist!==void 0&&r.checklist.length>0?r.checklist.map(e=>({...e})):(o?.checklist??[]).map(e=>({text:e,checked:!1}))),ce=(0,e.useRef)(null),[B,V]=(0,e.useState)(!1);(0,e.useEffect)(()=>{ce.current?.focus();let e=e=>{e.key===`Escape`&&t.closeForm()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[t]),(0,e.useEffect)(()=>{t.fetchModelCatalog().then(O).catch(()=>O([]))},[t]),(0,e.useEffect)(()=>{t.fetchPresetCatalog().then(e=>{te(e.presets),ne(e.defaultId),!s&&P===``&&e.defaultId!==void 0&&ee(e.defaultId)}).catch(()=>te([]))},[t,s,r?.presetId,P]);let H=C===`scheduled`?_(T.trim()):null,U=H===null?null:y(H,Date.now()),le=C===`scheduled`&&(H===null||U===null),W=c.trim().length>0&&v!==``&&!le,G=s&&r.status===`in_progress`,K=s&&((r.executions?.length??0)>0||r.status===`in_progress`),q=t.gitAvailable(v),ue=t.repoCount(v),de=K||!q,fe=()=>{if(q)return ie},pe=()=>F.trim().length>0?F.trim():void 0,me=()=>oe.map(e=>({...e,text:e.text.trim()})).filter(e=>e.text.length>0),Y=A===``?void 0:JSON.parse(A),X=(Y===void 0?void 0:D.find(e=>e.provider===Y.provider&&e.model===Y.model))?.reasoning,he=()=>{if(Y===void 0)return;let e=M.trim();return{provider:Y.provider,model:Y.model,...e.length>0?{reasoningEffort:e}:{}}},ge=()=>{if(!W||B)return;let e=he();s||Me(e);let n=fe(),i=pe(),a=me();V(!0),(s?t.update(r.id,r.version,{title:c,description:u,prompt:f,urgency:x,workspaceId:v,execution:C===`scheduled`?{mode:C,cron:T.trim()}:{mode:C},model:e??null,...n!==void 0&&!K?{isolation:n}:{},presetId:i??null,permission:z,checklist:a.length>0?a:null}):t.create({title:c,workspaceId:v,urgency:x,description:u.length>0?u:void 0,prompt:f.length>0?f:void 0,execution:C===`scheduled`?{mode:C,cron:T.trim()}:{mode:C},model:e,...n===void 0?{}:{isolation:n},...i===void 0?{}:{presetId:i},permission:z,...a.length>0?{checklist:a.map(e=>e.text)}:{}})).catch(()=>void 0).finally(()=>V(!1))},Z=()=>{if(!W||G||B)return;let e=he();s||Me(e);let n=fe(),i=pe(),a=me();V(!0),(async()=>{if(s)await t.update(r.id,r.version,{title:c,description:u,prompt:f,urgency:x,workspaceId:v,execution:C===`scheduled`?{mode:C,cron:T.trim()}:{mode:C},model:e??null,...n!==void 0&&!K?{isolation:n}:{},presetId:i??null,permission:z,checklist:a.length>0?a:null})&&await t.run(r.id);else{let r=await t.create({title:c,workspaceId:v,urgency:x,description:u.length>0?u:void 0,prompt:f.length>0?f:void 0,execution:C===`scheduled`?{mode:C,cron:T.trim()}:{mode:C},model:e,...n===void 0?{}:{isolation:n},...i===void 0?{}:{presetId:i},permission:z,...a.length>0?{checklist:a.map(e=>e.text)}:{}});r!==void 0&&await t.run(r)}})().catch(()=>void 0).finally(()=>V(!1))},_e=W?C===`scheduled`&&U!==null?i(`form.hint.nextRun`,{time:J(U)}):s?i(`form.hint.saveVersion`,{v:r.version,next:r.version+1}):i(`form.hint.createClaim`):c.trim().length===0?i(`form.hint.needTitle`):i(v===``?`form.hint.needProject`:`form.hint.cronBad`);return(0,n.jsx)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:e=>{e.target===e.currentTarget&&t.closeForm()},children:(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-taskform-modal`,"data-mode":s?`edit`:`create`,role:`dialog`,"aria-modal":`true`,"aria-label":i(s?`form.title.edit`:`form.title.create`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:s?`✎`:`✚`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:i(s?`form.title.edit`:`form.title.create`)}),(0,n.jsx)(`p`,{children:i(s?`form.subtitle.edit`:`form.subtitle.create`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":i(`shared.close`),onClick:()=>t.closeForm(),children:`✕`})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-body dsh-atb-taskform-body`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-form-col dsh-atb-form-left`,children:[(0,n.jsx)($,{label:i(`form.field.title`),required:!0,full:!0,children:(0,n.jsx)(`input`,{ref:ce,value:c,onChange:e=>l(e.target.value),placeholder:i(`form.field.titlePlaceholder`),maxLength:200})}),(0,n.jsxs)(`div`,{className:`dsh-atb-form-subgrid`,children:[(0,n.jsx)($,{label:i(`form.field.project`),required:!0,children:(0,n.jsx)(`select`,{value:v,onChange:e=>b(e.target.value),children:a.workspaces.map(e=>(0,n.jsx)(`option`,{value:e.id,children:e.title||e.path},e.id))})}),(0,n.jsx)($,{label:i(`form.field.model`),children:(0,n.jsxs)(`select`,{value:A,onChange:e=>{let t=e.target.value;if(j(t),t===``)N(``);else{let e=JSON.parse(t),n=D.find(t=>t.provider===e.provider&&t.model===e.model);n?.reasoning?.defaultEffort===void 0?N(``):N(n.reasoning.defaultEffort)}},children:[(0,n.jsx)(`option`,{value:``,children:i(`form.field.modelDefault`)}),D.map(e=>(0,n.jsx)(`option`,{value:JSON.stringify({provider:e.provider,model:e.model}),children:i(`form.model.option`,{name:e.name??e.model,provider:e.provider})},`${e.provider}/${e.model}`))]})}),Y!==void 0&&(0,n.jsx)($,{label:i(`form.field.effort`),children:(0,n.jsxs)(`select`,{value:M,onChange:e=>N(e.target.value),title:i(`form.field.effortTitle`),children:[(0,n.jsxs)(`option`,{value:``,children:[i(`form.effort.follow`),X?.defaultEffort===void 0?``:i(`shared.current`,{name:X.efforts.find(e=>e.id===X.defaultEffort)?.name??X.defaultEffort})]}),X!==void 0&&X.efforts.length>0?X.efforts.map(e=>(0,n.jsxs)(`option`,{value:e.id,children:[e.name,e.description?` (${e.description})`:``]},e.id)):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`option`,{value:`low`,children:i(`form.effort.low`)}),(0,n.jsx)(`option`,{value:`medium`,children:i(`form.effort.medium`)}),(0,n.jsx)(`option`,{value:`high`,children:i(`form.effort.high`)}),(0,n.jsx)(`option`,{value:`none`,children:i(`form.effort.none`)})]})]})}),I.length>0&&(0,n.jsx)($,{label:i(`form.field.preset`),children:(0,n.jsxs)(`select`,{value:F,onChange:e=>ee(e.target.value),title:i(`form.field.presetTitle`),children:[(0,n.jsxs)(`option`,{value:``,children:[i(`form.preset.follow`),L===void 0?``:i(`shared.current`,{name:I.find(e=>e.id===L)?.name??L})]}),I.map(e=>(0,n.jsxs)(`option`,{value:e.id,children:[e.name??e.id,e.id===L?i(`form.preset.defaultTag`):``]},e.id))]})})]}),(0,n.jsx)($,{label:i(`form.field.urgency`),full:!0,children:(0,n.jsx)(`div`,{className:`dsh-atb-urgency-picker`,children:Ne(i).map(e=>(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-urgency-opt`,"data-urgency":e.value,"data-on":x===e.value,onClick:()=>S(e.value),children:[(0,n.jsxs)(`span`,{className:`dsh-atb-urgency-name`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-dot`,"data-urgency":e.value}),e.label]}),(0,n.jsx)(`span`,{className:`dsh-atb-urgency-hint`,children:e.hint})]},e.value))})}),(0,n.jsx)($,{label:i(`form.field.permission`),full:!0,children:(0,n.jsx)(`div`,{className:`dsh-atb-perm-picker`,children:Fe(i).map(e=>(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-perm-opt`,"data-on":z===e.value,onClick:()=>re(e.value),children:[(0,n.jsxs)(`span`,{className:`dsh-atb-perm-name`,children:[e.icon,` `,e.label,e.value===`workspace-write`?i(`form.perm.defaultTag`):``]}),(0,n.jsx)(`span`,{className:`dsh-atb-perm-hint`,children:e.hint})]},e.value))})}),(0,n.jsx)($,{label:i(`form.field.mode`),full:!0,children:(0,n.jsxs)(`div`,{className:`dsh-atb-mode-picker`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":C===`claim`,onClick:()=>w(`claim`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:i(`form.mode.claim`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:i(`form.mode.claimHint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":C===`scheduled`,onClick:()=>w(`scheduled`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:i(`form.mode.scheduled`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:i(`form.mode.scheduledHint`)})]})]})}),C===`scheduled`&&(0,n.jsxs)($,{label:i(`form.field.cron`),required:!0,full:!0,children:[(0,n.jsx)(`input`,{className:le?`dsh-atb-input-bad`:void 0,value:T,onChange:e=>E(e.target.value),placeholder:i(`form.cron.placeholder`),spellCheck:!1}),(0,n.jsxs)(`span`,{className:`dsh-atb-cron-presets`,children:[Pe(i).map(e=>(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-cron-preset`,"data-on":T.trim()===e.cron,onClick:()=>E(e.cron),children:e.label},e.cron)),!le&&U!==null&&(0,n.jsx)(`span`,{className:`dsh-atb-cron-next`,children:i(`form.cron.next`,{time:J(U)})})]})]}),(0,n.jsxs)($,{label:i(`form.field.isolation`),full:!0,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-mode-picker`,"data-disabled":de?`true`:void 0,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":ie===`worktree`,disabled:de,title:i(K?`form.iso.locked`:q?`form.iso.worktreeTitle`:`form.iso.nonGit`),onClick:()=>ae(`worktree`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:i(`form.iso.worktree`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:i(K?`form.iso.lockedShort`:q?`form.iso.worktreeHint`:`form.iso.nonGit`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":ie===`none`,disabled:de,title:i(K?`form.iso.locked`:`form.iso.noneTitle`),onClick:()=>ae(`none`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:i(`form.iso.none`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:i(K?`form.iso.lockedShort`:q?`form.iso.noneHint`:`form.iso.noneHintNonGit`)})]})]}),!q&&!K&&(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,children:i(`form.iso.nonGitNote`)}),q&&!K&&ue>1&&(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,"data-mirror":`true`,children:i(`form.iso.mirrorNote`,{n:ue})})]}),(0,n.jsx)($,{label:i(s?`form.field.checklist`:`form.field.checklistOptional`),full:!0,children:(0,n.jsx)(Ie,{rows:oe,onChange:se,editing:s})})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-form-col dsh-atb-form-right`,children:[(0,n.jsx)($,{label:i(s?`form.field.description`:`form.field.descriptionOptional`),full:!0,children:(0,n.jsx)(ke,{value:u,onChange:d,controller:t,rows:7,placeholder:i(`form.desc.placeholder`)})}),(0,n.jsx)($,{label:i(s?`form.field.prompt`:`form.field.promptOptional`),full:!0,children:(0,n.jsx)(ke,{value:f,onChange:h,controller:t,rows:7,placeholder:i(`form.prompt.placeholder`)})})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-foot`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-hint`,"data-tone":W?void 0:`bad`,children:_e}),(0,n.jsxs)(`span`,{className:`dsh-atb-modal-footbtns`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>t.closeForm(),children:i(`shared.cancel`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,disabled:!W||G||B,title:i(G?`form.action.runBlockedTitle`:B?`form.action.runBusyTitle`:`form.action.runTitle`),onClick:Z,children:i(`form.action.run`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,disabled:!W||B,onClick:ge,children:i(s?`form.action.save`:`form.action.create`)})]})]})]})})}const Re=e=>[{value:`none`,name:e(`form.iso.none`),hint:e(`set.iso.noneHint`)},{value:`worktree`,name:e(`form.iso.worktree`),hint:e(`set.iso.worktreeHint`)}];function ze({controller:t}){let r=R(),i=t.getSnapshot(),a=i.ledger.settings?.defaultIsolation??`none`,o=h(i.ledger.settings),s=g(i.ledger.settings),[c,l]=(0,e.useState)(a),[u,d]=(0,e.useState)(o),[f,p]=(0,e.useState)(s),m=c!==a||u!==o||f!==s;return(0,n.jsx)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:e=>{e.target===e.currentTarget&&t.closeSettings()},children:(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-set`,role:`dialog`,"aria-modal":`true`,"aria-label":r(`set.aria`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:`🛠`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:r(`set.title`)}),(0,n.jsx)(`p`,{children:r(`set.subtitle`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":r(`shared.close`),onClick:()=>t.closeSettings(),children:`✕`})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-body`,children:[(0,n.jsxs)(`section`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:r(`set.iso.heading`)}),(0,n.jsx)(`div`,{className:`dsh-atb-mode-picker`,children:Re(r).map(e=>(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":c===e.value,title:e.hint,onClick:()=>l(e.value),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:e.name}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:e.hint})]},e.value))}),(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,children:r(`set.iso.current`,{current:r(a===`worktree`?`form.iso.worktree`:`form.iso.none`)})})]}),(0,n.jsxs)(`section`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:r(`set.sync.heading`)}),(0,n.jsxs)(`div`,{className:`dsh-atb-mode-picker`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":!u,title:r(`set.sync.off.title`),onClick:()=>d(!1),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:r(`set.sync.off.name`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:r(`set.sync.off.hint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":u,title:r(`set.sync.on.title`),onClick:()=>d(!0),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:r(`set.sync.on.name`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:r(`set.sync.on.hint`)})]})]}),(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,children:r(o?`set.sync.stateOn`:`set.sync.stateOff`)})]}),(0,n.jsxs)(`section`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:r(`set.perm.heading`)}),(0,n.jsxs)(`div`,{className:`dsh-atb-perm-picker`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-perm-opt`,"data-on":f===`workspace-write`,onClick:()=>p(`workspace-write`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-perm-name`,children:r(`set.perm.writeName`)}),(0,n.jsx)(`span`,{className:`dsh-atb-perm-hint`,children:r(`set.perm.writeHint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-perm-opt`,"data-on":f===`read-only`,onClick:()=>p(`read-only`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-perm-name`,children:r(`set.perm.readOnlyName`)}),(0,n.jsx)(`span`,{className:`dsh-atb-perm-hint`,children:r(`set.perm.readOnlyHint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-perm-opt`,"data-on":f===`danger-full-access`,onClick:()=>p(`danger-full-access`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-perm-name`,children:r(`set.perm.fullName`)}),(0,n.jsx)(`span`,{className:`dsh-atb-perm-hint`,children:r(`set.perm.fullHint`)})]})]}),(0,n.jsx)(`span`,{className:`dsh-atb-isolation-note`,children:r(`set.perm.current`,{current:r(s===`read-only`?`set.perm.readOnlyName`:s===`danger-full-access`?`set.perm.fullName`:`set.perm.writeName`)})})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-foot`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-hint`,children:r(m?`set.foot.dirty`:`set.foot.clean`)}),(0,n.jsxs)(`span`,{className:`dsh-atb-modal-footbtns`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>t.closeSettings(),children:r(`shared.cancel`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,disabled:!m,onClick:()=>{t.updateSettings({defaultIsolation:c,syncExternalSessions:u,defaultPermission:f}).then(e=>{e&&t.closeSettings()})},children:r(`set.action.save`)})]})]})]})})}function Be({row:e}){return(0,n.jsxs)(`div`,{className:`dsh-atb-imp-row`,title:e.id,children:[(0,n.jsx)(`span`,{className:`dsh-atb-imp-row-title`,children:e.title}),(0,n.jsx)(`span`,{className:`dsh-atb-imp-row-status`,children:e.status})]})}function Ve({controller:t}){let r=R(),[i,a]=(0,e.useState)(``),[o,s]=(0,e.useState)(null),[c,l]=(0,e.useState)(void 0),[u,d]=(0,e.useState)(void 0),[f,p]=(0,e.useState)(`merge`),[m,h]=(0,e.useState)(!1),[g,_]=(0,e.useState)(void 0),[v,y]=(0,e.useState)(!1),b=(0,e.useRef)(null),{alert:x,el:S}=X(),C=e=>{d(void 0),l(void 0),_(void 0),y(!1),a(``),s(null),e!==void 0&&e.text().then(n=>{try{let r=JSON.parse(n);s(r),a(e.name),t.importPreview(r).then(e=>{e!==void 0&&d(e)})}catch{l(r(`imp.parseError`))}})},w=()=>{if(!(o===null||u===void 0||m)){if(f===`replace`&&!v){y(!0);return}h(!0),t.importCommit(f,o).then(e=>{h(!1),y(!1),e!==void 0&&_(e.mode===`replace`?r(`imp.result.replace`,{n:e.created+e.overwritten,total:e.replacedTotal??0}):r(`imp.result.merge`,{n:e.created,m:e.overwritten}))})}},T=()=>t.closeImport();return(0,n.jsxs)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:e=>{e.target===e.currentTarget&&T()},children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-imp`,role:`dialog`,"aria-modal":`true`,"aria-label":r(`imp.aria`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:`⬆`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:r(`imp.title`)}),(0,n.jsx)(`p`,{children:r(`imp.subtitle`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":r(`shared.close`),onClick:T,children:`✕`})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-body`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-imp-picker`,children:[(0,n.jsx)(`input`,{ref:b,type:`file`,accept:`.json,application/json`,onChange:e=>C(e.target.files?.[0])}),i.length>0&&(0,n.jsx)(`span`,{className:`dsh-atb-imp-filename`,children:i})]}),(0,n.jsx)(`div`,{className:`dsh-atb-imp-note`,children:r(`imp.note`)}),c!==void 0&&(0,n.jsx)(`div`,{className:`dsh-atb-imp-error`,children:c}),u===void 0&&c===void 0&&i.length>0&&(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:r(`imp.previewing`)}),u!==void 0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`div`,{className:`dsh-atb-imp-stats`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-imp-stat`,"data-tone":`ok`,children:[(0,n.jsx)(`b`,{children:u.create.length}),(0,n.jsx)(`span`,{children:r(`imp.stat.create`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-imp-stat`,"data-tone":`warn`,children:[(0,n.jsx)(`b`,{children:u.overwrite.length}),(0,n.jsx)(`span`,{children:r(`imp.stat.overwrite`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-imp-stat`,"data-tone":u.invalid.length>0?`bad`:void 0,children:[(0,n.jsx)(`b`,{children:u.invalid.length}),(0,n.jsx)(`span`,{children:r(`imp.stat.invalid`)})]})]}),u.create.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-imp-sec`,children:[(0,n.jsx)(`h4`,{children:r(`imp.sec.create`)}),(0,n.jsx)(`div`,{className:`dsh-atb-imp-list`,children:u.create.map(e=>(0,n.jsx)(Be,{row:e},e.id))})]}),u.overwrite.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-imp-sec`,children:[(0,n.jsx)(`h4`,{children:r(`imp.sec.overwrite`)}),(0,n.jsx)(`div`,{className:`dsh-atb-imp-list`,children:u.overwrite.map(e=>(0,n.jsx)(Be,{row:e},e.id))})]}),u.invalid.length>0&&(0,n.jsxs)(`div`,{className:`dsh-atb-imp-sec`,children:[(0,n.jsx)(`h4`,{children:r(`imp.sec.invalid`)}),(0,n.jsx)(`div`,{className:`dsh-atb-imp-list`,children:u.invalid.map((e,t)=>(0,n.jsxs)(`div`,{className:`dsh-atb-imp-row`,"data-tone":`bad`,title:e.id??``,children:[(0,n.jsx)(`span`,{className:`dsh-atb-imp-row-title`,children:e.id??r(`imp.noId`)}),(0,n.jsx)(`span`,{className:`dsh-atb-imp-row-status`,children:e.reason})]},e.id??`invalid-${t}`))})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-mode-picker`,children:[(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":f===`merge`,onClick:()=>{p(`merge`),y(!1)},children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:r(`imp.mode.merge`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:r(`imp.mode.mergeHint`)})]}),(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-mode-opt`,"data-on":f===`replace`,onClick:()=>p(`replace`),children:[(0,n.jsx)(`span`,{className:`dsh-atb-mode-name`,children:r(`imp.mode.replace`)}),(0,n.jsx)(`span`,{className:`dsh-atb-mode-hint`,children:r(`imp.mode.replaceHint`)})]})]}),g!==void 0&&(0,n.jsx)(`div`,{className:`dsh-atb-imp-result`,children:g})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-foot`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-hint`,children:r(f===`replace`?v?`imp.foot.replaceConfirm`:`imp.foot.replaceNeedConfirm`:`imp.foot.mergeHint`)}),(0,n.jsxs)(`span`,{className:`dsh-atb-modal-footbtns`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:T,children:r(g===void 0?`shared.cancel`:`shared.close`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,"data-danger":f===`replace`&&v?`true`:void 0,disabled:u===void 0||m,onClick:w,children:r(f===`replace`&&v?`imp.action.confirmReplace`:`imp.action.run`)})]})]})]}),S]})}function He({controller:t}){let r=R(),i=t.getSnapshot(),[a,o]=(0,e.useState)({}),[s,c]=(0,e.useState)(void 0),{alert:l,el:u}=X(),d=()=>t.closeTemplateManager(),f=(e,t)=>a[e]??t,p=(e,n)=>{let a=i.templates.find(t=>t.id===e);a===void 0||n===a.name||t.upsertTemplate({id:e,name:n,task:a.task}).then(t=>{t&&(o(t=>{let n={...t};return delete n[e],n}),l(r(`tpl.renamed`)))})};return(0,n.jsxs)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:e=>{e.target===e.currentTarget&&d()},children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-tplm`,role:`dialog`,"aria-modal":`true`,"aria-label":r(`tpl.aria`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:`⌗`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:r(`tpl.title`)}),(0,n.jsx)(`p`,{children:r(`tpl.subtitle`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":r(`shared.close`),onClick:d,children:`✕`})]}),(0,n.jsx)(`div`,{className:`dsh-atb-modal-body`,children:i.templates.length===0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:r(`tpl.empty`)}):(0,n.jsx)(`div`,{className:`dsh-atb-tplm-list`,children:i.templates.map(e=>(0,n.jsxs)(`div`,{className:`dsh-atb-tplm-row`,children:[(0,n.jsx)(`input`,{className:`dsh-atb-tplm-name`,value:f(e.id,e.name),maxLength:60,spellCheck:!1,"aria-label":r(`tpl.name.aria`,{name:e.name}),onChange:t=>o(n=>({...n,[e.id]:t.target.value})),onKeyDown:t=>{t.key===`Enter`&&p(e.id,f(e.id,e.name))}}),(0,n.jsxs)(`span`,{className:`dsh-atb-tplm-meta`,title:`${e.builtin===!0?r(`tpl.builtin`):r(`tpl.custom`)}${e.task.checklist!==void 0&&e.task.checklist.length>0?r(`tpl.meta.checklist`,{n:e.task.checklist.length}):``}${e.task.urgency===void 0?``:` · ${e.task.urgency}`}${e.task.permission===void 0?``:` · ${r(`shared.permission`)}: ${e.task.permission}`}`,children:[e.builtin===!0?r(`tpl.builtin`):r(`tpl.custom`),e.task.checklist!==void 0&&e.task.checklist.length>0?r(`tpl.meta.checklist`,{n:e.task.checklist.length}):``,e.task.urgency===void 0?``:` · ${e.task.urgency}`,e.task.permission!==void 0&&e.task.permission!==`workspace-write`?` · ${e.task.permission===`read-only`?r(`tpl.meta.permReadOnly`):r(`tpl.meta.permFull`)}`:``]}),(0,n.jsxs)(`span`,{className:`dsh-atb-tplm-btns`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,disabled:f(e.id,e.name)===e.name||f(e.id,e.name).trim().length===0,title:r(`tpl.rename.title`),onClick:()=>p(e.id,f(e.id,e.name)),children:r(`tpl.rename.button`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`tpl.use.title`),onClick:()=>{d(),t.newFromTemplate(e.task)},children:r(`tpl.use.button`)}),s===e.id?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,onClick:()=>{t.deleteTemplate(e.id),c(void 0)},children:r(`shared.confirmDelete`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>c(void 0),children:r(`shared.cancel`)})]}):(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,title:r(`tpl.delete.title`),onClick:()=>c(e.id),children:`🗑`})]})]},e.id))})}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-foot`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-hint`,children:r(`tpl.foot.hint`)}),(0,n.jsx)(`span`,{className:`dsh-atb-modal-footbtns`,children:(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:d,children:r(`shared.close`)})})]})]}),u]})}const Ue={urgent:0,normal:1,relaxed:2};function We(e,t){let n=e.search.trim().toLowerCase(),r=t.filter(t=>(e.filters.workspaceId===void 0||t.workspaceId===e.filters.workspaceId)&&(e.filters.urgencies.length===0||e.filters.urgencies.includes(t.urgency))&&(n.length===0||t.title.toLowerCase().includes(n)||t.id.toLowerCase().includes(n)));if(e.sortBy==="default")return r;let i=[...r];return e.sortBy===`updated`?i.sort((e,t)=>t.updatedAt-e.updatedAt):e.sortBy===`created`?i.sort((e,t)=>t.createdAt-e.createdAt):e.sortBy===`urgency`?i.sort((e,t)=>Ue[e.urgency]-Ue[t.urgency]||t.updatedAt-e.updatedAt):e.sortBy===`title`&&i.sort((e,t)=>e.title.localeCompare(t.title,void 0,{numeric:!0})),i}function Ge({controller:t}){let r=R(),i=(0,e.useSyncExternalStore)(e=>t.subscribe(e),()=>t.getSnapshot()),[a,o]=(0,e.useState)(()=>Date.now());(0,e.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),6e4);return()=>clearInterval(e)},[]);let s=We(i,i.ledger.tasks.filter(e=>e.trashedAt===void 0)),c=i.selectedId===void 0?void 0:i.ledger.tasks.find(e=>e.id===i.selectedId),{alert:u,el:d}=X(),[p,m]=(0,e.useState)(!1),h=()=>m(!1),[g,_]=(0,e.useState)(!1),v=()=>_(!1);return(0,n.jsxs)(`div`,{className:`dsh-atb-board`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-toolbar`,children:[(0,n.jsx)(`h2`,{className:`dsh-atb-title`,children:r(`board.title`)}),(0,n.jsx)(`span`,{className:`dsh-atb-count`,children:r(`board.count.tasks`,{n:s.length,rev:i.ledger.revision})}),(0,n.jsxs)(`div`,{className:`dsh-atb-newmenu`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-primary":`true`,onClick:()=>{let e=!p;m(e),e&&t.prepareTemplateMenu()},children:r(`board.action.newTask`)}),p&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`dsh-atb-newmenu-backdrop`,onClick:h}),(0,n.jsxs)(`div`,{className:`dsh-atb-newmenu-list`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,onClick:()=>{h(),t.setComposer(!0)},children:r(`board.action.blankTask`)}),i.templates.map(e=>(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,title:e.task.description!==void 0&&e.task.description.length>0?e.task.description.slice(0,120):e.name,onClick:()=>{h(),t.newFromTemplate(e.task)},children:e.name},e.id)),(0,n.jsx)(`div`,{className:`dsh-atb-newmenu-sep`}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,onClick:()=>{h(),t.openTemplateManager()},children:r(`board.action.manageTemplates`)})]})]})]}),(0,n.jsx)(`div`,{className:`dsh-atb-spacer`}),(0,n.jsx)(`input`,{className:`dsh-atb-input dsh-atb-search`,value:i.search,placeholder:r(`board.search.placeholder`),spellCheck:!1,onChange:e=>t.setSearch(e.target.value)}),(0,n.jsxs)(`select`,{className:`dsh-atb-select`,value:i.filters.workspaceId??``,onChange:e=>t.setWorkspaceFilter(e.target.value===``?void 0:e.target.value),children:[(0,n.jsx)(`option`,{value:``,children:r(`board.filter.allProjects`)}),i.workspaces.map(e=>(0,n.jsx)(`option`,{value:e.id,children:e.title||e.path},e.id))]}),(0,n.jsxs)(`select`,{className:`dsh-atb-select`,value:i.sortBy,title:r(`board.sort.title`),onChange:e=>t.setSortBy(e.target.value),children:[(0,n.jsx)(`option`,{value:`default`,children:r(`board.sort.default`)}),(0,n.jsx)(`option`,{value:`updated`,children:r(`board.sort.updated`)}),(0,n.jsx)(`option`,{value:`urgency`,children:r(`board.sort.urgency`)}),(0,n.jsx)(`option`,{value:`created`,children:r(`board.sort.created`)}),(0,n.jsx)(`option`,{value:`title`,children:r(`board.sort.byTitle`)})]}),[`urgent`,`normal`,`relaxed`].map(e=>(0,n.jsxs)(`button`,{type:`button`,className:`dsh-atb-chip`,"data-urgency":e,"data-on":i.filters.urgencies.includes(e),onClick:()=>t.toggleUrgency(e),children:[(0,n.jsx)(`span`,{className:`dsh-atb-dot`,"data-urgency":e}),r(ue[e])]},e)),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,onClick:()=>t.toggleSecondary(),children:i.secondaryOpen?r(`board.action.backToBoard`):r(`board.action.otherTasks`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`board.action.settingsTitle`),onClick:()=>t.openSettings(),children:r(`board.action.settings`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`board.action.diagTitle`),onClick:()=>t.openDiagnostics(),children:r(`board.action.diag`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`board.action.importTitle`),onClick:()=>t.openImport(),children:r(`board.action.import`)}),(0,n.jsxs)(`div`,{className:`dsh-atb-newmenu`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,title:r(`board.action.exportTitle`),onClick:()=>_(!g),children:r(`board.action.export`)}),g&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`dsh-atb-newmenu-backdrop`,onClick:v}),(0,n.jsxs)(`div`,{className:`dsh-atb-newmenu-list`,children:[(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,title:r(`board.export.jsonTitle`),onClick:()=>{v(),t.exportJson()},children:r(`board.export.json`)}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-newmenu-opt`,title:r(`board.export.csvTitle`),onClick:()=>{v(),t.exportCsv()},children:r(`board.export.csv`)})]})]})]}),(0,n.jsxs)(`a`,{className:`dsh-atb-ver`,href:`https://github.com/cloader/dsh-taskboard`,target:`_blank`,rel:`noopener noreferrer`,children:[`V`,`0.6.5`]})]}),i.error!==void 0&&(0,n.jsx)(`div`,{className:`dsh-atb-error`,children:i.error}),i.secondaryOpen?(0,n.jsx)(qe,{controller:t,tasks:We(i,i.ledger.tasks)}):(0,n.jsx)(`div`,{className:`dsh-atb-columns`,children:l.map(e=>{let o=s.filter(t=>t.status===e);return(0,n.jsxs)(`div`,{className:`dsh-atb-column`,onDragOver:e=>{e.dataTransfer.types.includes(`application/x-dsh-atb-task`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,e.currentTarget.dataset.dragover=`true`)},onDragLeave:e=>{delete e.currentTarget.dataset.dragover},onDrop:n=>{n.preventDefault(),delete n.currentTarget.dataset.dragover;let a=n.dataTransfer.getData(pe);if(a.length===0)return;let o=i.ledger.tasks.find(e=>e.id===a);if(!(o===void 0||o.status===e)){if(!f(o.status,e)){u(r(`board.drag.forbidden`,{from:r(G[o.status]),to:r(G[e])}));return}t.move(a,o.version,e)}},children:[(0,n.jsxs)(`div`,{className:`dsh-atb-colhead`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-dot`,"data-status":e}),r(G[e]),(0,n.jsx)(`span`,{className:`dsh-atb-colcount`,children:o.length})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-cards`,children:[o.map(e=>(0,n.jsx)(Y,{task:e,controller:t,draggable:!0,now:a,onAlert:u},e.id)),o.length===0&&(0,n.jsx)(`div`,{className:`dsh-atb-empty`,children:r(`board.empty`)})]})]},e)})}),c!==void 0&&(0,n.jsx)(`div`,{className:`dsh-atb-detailpanel`,children:(0,n.jsx)(Ee,{task:c,controller:t,now:a},c.id)}),i.composerOpen&&(0,n.jsx)(Le,{controller:t,task:i.editingId===void 0?void 0:i.ledger.tasks.find(e=>e.id===i.editingId)}),i.diagOpen&&(0,n.jsx)(Ke,{controller:t}),i.settingsOpen&&(0,n.jsx)(ze,{controller:t}),i.importOpen&&(0,n.jsx)(Ve,{controller:t}),i.tplManagerOpen&&(0,n.jsx)(He,{controller:t}),d]})}function Ke({controller:e}){let t=R(),r=e.getSnapshot(),i=r.diagnostics,a=e=>{let t=r.workspaces.find(t=>t.id===e);return t?.title??t?.path??e.slice(0,8)};return(0,n.jsx)(`div`,{className:`dsh-atb-modal-backdrop`,onClick:t=>{t.target===t.currentTarget&&e.closeDiagnostics()},children:(0,n.jsxs)(`div`,{className:`dsh-atb-modal dsh-atb-diag`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`diag.title`),children:[(0,n.jsxs)(`div`,{className:`dsh-atb-modal-head`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-modal-headicon`,children:`⚙`}),(0,n.jsxs)(`div`,{className:`dsh-atb-modal-headtext`,children:[(0,n.jsx)(`h3`,{children:t(`diag.title`)}),(0,n.jsx)(`p`,{children:t(`diag.subtitle`)})]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-modal-close`,"aria-label":t(`shared.close`),onClick:()=>e.closeDiagnostics(),children:`✕`})]}),(0,n.jsx)(`div`,{className:`dsh-atb-modal-body`,children:i===void 0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:t(`shared.loading`)}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(`div`,{className:`dsh-atb-diag-grid`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-diag-item`,children:[(0,n.jsx)(`b`,{children:i.revision}),(0,n.jsx)(`span`,{children:t(`diag.revision`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-item`,children:[(0,n.jsx)(`b`,{children:i.tasks}),(0,n.jsx)(`span`,{children:t(`diag.tasks`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-item`,"data-bad":i.staleRunning>0?`true`:void 0,children:[(0,n.jsx)(`b`,{children:i.staleRunning}),(0,n.jsx)(`span`,{children:t(`diag.running`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-item`,"data-bad":i.orphanWorktrees.length>0?`true`:void 0,children:[(0,n.jsx)(`b`,{children:i.orphanWorktrees.length}),(0,n.jsx)(`span`,{children:t(`diag.orphans`)})]})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:t(`diag.orphans.heading`)}),i.orphanWorktrees.length===0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:t(`diag.orphans.none`)}):(0,n.jsx)(`div`,{className:`dsh-atb-diag-orphans`,children:i.orphanWorktrees.map(r=>(0,n.jsxs)(`div`,{className:`dsh-atb-diag-orphan`,children:[(0,n.jsxs)(`span`,{className:`dsh-atb-diag-orphan-path`,title:r.path,children:[a(r.workspaceId),` · `,r.taskId]}),(0,n.jsx)(`button`,{type:`button`,className:`dsh-atb-btn`,"data-danger":`true`,onClick:()=>void e.cleanupOrphan(r.workspaceId,r.taskId),children:t(`diag.orphans.cleanup`)})]},r.path))}),(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:t(`diag.orphans.hint`)})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-diag-sec`,children:[(0,n.jsx)(`h4`,{children:t(`diag.gitignore.heading`)}),(i.gitIgnoreSuggestions??[]).length===0?(0,n.jsx)(`div`,{className:`dsh-atb-empty2`,children:t(`diag.gitignore.none`)}):(0,n.jsx)(`div`,{className:`dsh-atb-diag-orphans`,children:i.gitIgnoreSuggestions.map(e=>(0,n.jsx)(`div`,{className:`dsh-atb-diag-orphan`,children:(0,n.jsxs)(`span`,{className:`dsh-atb-diag-orphan-path`,title:e.workspacePath,children:[a(e.workspaceId),` · `,t(`diag.gitignore.suggestA`),` `,(0,n.jsx)(`code`,{children:`.dsh-worktrees/`}),t(`diag.gitignore.suggestB`)]})},e.workspaceId))})]})]})})]})})}function qe({controller:e,tasks:t}){let r=R(),i=t.filter(e=>e.trashedAt!==void 0),a=t.filter(e=>e.trashedAt===void 0&&e.status===`archived`),o=t.filter(e=>e.trashedAt===void 0&&e.status===`canceled`),s=[{label:r(`status.column.canceled`),dot:`canceled`,rows:o},{label:r(`status.column.archived`),dot:`archived`,rows:a},{label:r(`board.group.trashed`),dot:`trashed`,rows:i}];return i.length+a.length+o.length===0?(0,n.jsx)(`div`,{className:`dsh-atb-secondary`,children:(0,n.jsx)(`div`,{className:`dsh-atb-empty`,children:r(`board.secondary.empty`)})}):(0,n.jsx)(`div`,{className:`dsh-atb-columns`,children:s.map(t=>(0,n.jsxs)(`div`,{className:`dsh-atb-column`,children:[(0,n.jsxs)(`div`,{className:`dsh-atb-colhead`,children:[(0,n.jsx)(`span`,{className:`dsh-atb-dot`,"data-status":t.dot}),t.label,(0,n.jsx)(`span`,{className:`dsh-atb-colcount`,children:t.rows.length})]}),(0,n.jsxs)(`div`,{className:`dsh-atb-cards`,children:[t.rows.map(t=>(0,n.jsx)(Y,{task:t,controller:e},t.id)),t.rows.length===0&&(0,n.jsx)(`div`,{className:`dsh-atb-empty`,children:r(`board.empty`)})]})]},t.label))})}const Je=`data-dsh-atb-active`,Ye=[`data-dsh-taskboard-active`,`data-dsh-ssh-active`],Xe=`dsh-panel-activate`,Ze=`dsh-taskboard`;function Qe(){return document.querySelector(`[data-pane="conversation"], [class*="centerCol"], .dshDesktopConversationSurface`)??void 0}function $e(e){let r,i,a=()=>{if(i!==void 0)return;let a=Qe();a!==void 0&&(i=document.createElement(`div`),i.dataset.dshAtbView=``,i.className=`dsh-atb-view`,a.appendChild(i),r=(0,t.createRoot)(i),r.render((0,n.jsx)(Ge,{controller:e})))},o=new MutationObserver(()=>{a()});o.observe(document.body,{childList:!0,subtree:!0});let s=()=>{if(e.getSnapshot().boardOpen){for(let e of Ye)document.documentElement.removeAttribute(e);document.documentElement.setAttribute(Je,``),document.dispatchEvent(new CustomEvent(Xe,{detail:Ze}))}else document.documentElement.removeAttribute(Je)},c=t=>{t.detail!==Ze&&e.getSnapshot().boardOpen&&e.closeBoard()},l=t=>{if(!e.getSnapshot().boardOpen)return;let n=t.target;n!==null&&n.closest(`[data-dsh-atb-entry]`)===null&&n.closest(`[class*="sessionRow"], [class*="projectRow"], [class*="searchResultRow"], [class*="searchResultWorkspace"], [class*="newSession"]`)!==null&&e.closeBoard()};document.addEventListener(`click`,l,!0),document.addEventListener(Xe,c);let u=e.subscribe(s);return s(),a(),()=>{document.removeEventListener(`click`,l,!0),document.removeEventListener(Xe,c),o.disconnect(),u(),document.documentElement.removeAttribute(Je),r?.unmount(),i?.remove()}}function et(e){let t=(e,t,n)=>e.list.getSnapshot().byId[n]===void 0?`absent`:t?.list.getSnapshot().archivedSessionIds.includes(n)??!1?`archived`:`openable`;return async n=>{let r=e.getSessions();if(r===void 0)return`unavailable`;try{let i=t(r,e.getWorkspaces(),n);if(i===`absent`){try{await r.refresh()}catch{}i=t(r,e.getWorkspaces(),n)}return i===`archived`?`archived`:i===`absent`?`missing`:(r.open(n),`opened`)}catch{return`unavailable`}}}const tt=[`connection`];function nt(e){try{oe(),F(e.get?.(`locale`),()=>e.get?.(`locale`));let t=c(),n=new ie(t);n.installModelCatalog(async()=>{try{let t=e.get?.(`modelDirectories`)??e.modelDirectories;if(t?.catalog?.load!==void 0){let e=await t.catalog.load();if(e?.groups!==void 0&&e.groups.length>0){let t=[];for(let n of e.groups)for(let e of n.models)t.push({provider:n.id,model:e.id,name:e.name,...e.description===void 0?{}:{description:e.description},...e.reasoning===void 0?{}:{reasoning:e.reasoning}});if(t.length>0)return t}}}catch{}try{let t=e.get?.(`remote`)??e.remote;if(t?.session?.modelCatalog!==void 0){let e=await t.session.modelCatalog();if(e.ok&&e.value?.groups!==void 0&&e.value.groups.length>0){let t=[];for(let n of e.value.groups)for(let e of n.models)t.push({provider:n.id,model:e.id,name:e.name,...e.description===void 0?{}:{description:e.description},...e.reasoning===void 0?{}:{reasoning:e.reasoning}});if(t.length>0)return t}}if(t?.llm?.models!==void 0){let e=await t.llm.models({});if(e.result.ok&&e.result.value?.groups!==void 0&&e.result.value.groups.length>0){let t=[];for(let n of e.result.value.groups)for(let e of n.models)t.push({provider:n.id,model:e.id,name:e.name,...e.description===void 0?{}:{description:e.description},...e.reasoning===void 0?{}:{reasoning:e.reasoning}});if(t.length>0)return t}}}catch{}try{let t=e.get?.(`connection`)??e.connection;if(t?.api?.llm?.models!==void 0){let e=await t.api.llm.models({});if(e.result.ok&&e.result.value?.groups!==void 0&&e.result.value.groups.length>0){let t=[];for(let n of e.result.value.groups)for(let e of n.models)t.push({provider:n.id,model:e.id,name:e.name,...e.description===void 0?{}:{description:e.description},...e.reasoning===void 0?{}:{reasoning:e.reasoning}});if(t.length>0)return t}}}catch{}try{let e=await t.modelCatalog();if(e.models!==void 0&&e.models.length>0)return e.models}catch{}return[]}),n.installPresetRoster(async()=>{try{let t=e.get?.(`remote`)??e.remote;if(t?.agentPresets?.list!==void 0){let e=await t.agentPresets.list(),n=e.ok===!0?e.value.presets:e.result?.ok===!0?e.result.value.presets:void 0;if(n!==void 0&&n.length>0){let e=n.map(e=>({id:e.id,name:e.name})),t=n.find(e=>e.isDefault);return{presets:e,...t===void 0?{}:{defaultId:t.id}}}}}catch{}try{let t=e.get?.(`connection`)??e.connection;if(t?.api?.agentPresets?.list!==void 0){let e=await t.api.agentPresets.list({});if(e.result.ok&&e.result.value?.presets!==void 0&&e.result.value.presets.length>0){let t=e.result.value.presets.map(e=>({id:e.id,name:e.name})),n=e.result.value.presets.find(e=>e.isDefault);return{presets:t,...n===void 0?{}:{defaultId:n.id}}}}}catch{}try{let e=await t.modelCatalog();if(e.presets!==void 0&&e.presets.length>0)return{presets:e.presets,...e.defaultPresetId===void 0?{}:{defaultId:e.defaultPresetId}}}catch{}return{presets:[]}}),n.installSessionJumper(et({getSessions:()=>e.get?.(`sessions`),getWorkspaces:()=>e.get?.(`workspaces`)})),n.start();let r=[];try{r.push(W(n)),r.push($e(n))}catch(e){console.error(`[dsh-taskboard] mount failed:`,e)}e.effect?.(()=>()=>{for(let e of r.splice(0))e();n.dispose(),ee()},`dsh-taskboard: client mount`)}catch(e){console.error(`[dsh-taskboard] client half failed to start:`,e)}}exports.apply=nt,exports.inject=tt,exports.name=`dsh-taskboard/client`;
|
|
918
927
|
return module.exports;
|
|
919
928
|
}
|
|
920
929
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-taskboard",
|
|
3
3
|
"description": "Agent-first task board for the DSH web GUI: host-authoritative task ledger with taskboard_* agent tools, project (= workspace) claim boundaries, per-task model execution in fresh sessions, optional per-task git-worktree isolation (dedicated task branches, commit evidence, one-click merge), host-side cron scheduling, and a live SSE kanban view. Mounts via the official dsh plugin system — no DSH source changes.",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"0.1.1-rc.2": "compatible",
|
|
26
26
|
"0.1.2-alpha.2": "compatible",
|
|
27
27
|
"0.1.2-alpha.3": "compatible",
|
|
28
|
-
"0.1.2-alpha.4": "compatible"
|
|
28
|
+
"0.1.2-alpha.4": "compatible",
|
|
29
|
+
"0.1.2-alpha.5": "compatible",
|
|
30
|
+
"0.1.2-rc.1": "compatible"
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
},
|
package/src/client/styles.ts
CHANGED
|
@@ -80,6 +80,15 @@ html[data-dsh-atb-active] .dsh-atb-view { display: flex; flex-direction: column;
|
|
|
80
80
|
|
|
81
81
|
.dsh-atb-board { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 12px 16px; gap: 10px; box-sizing: border-box; }
|
|
82
82
|
.dsh-atb-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
|
83
|
+
/* 0.6.5 / #19: dsh-better-sidebar 钉在视口右上角的常驻按钮簇(2×28px + 4px
|
|
84
|
+
* gap,right:10px → 占视口右边 10~70px)。它对 DSH 原生会话头的避让契约是
|
|
85
|
+
* body[data-dsh-sidebar-collapsed] 下给 header padding-right:78px(其
|
|
86
|
+
* layout.css);看板隐藏该会话头并占据同一条顶带,工具条右端便沉到簇下面。
|
|
87
|
+
* 镜像避让:面板收起(body 属性存在)且看板激活时,工具条右侧预留
|
|
88
|
+
* 70px 足迹 + 8px 间隙 − 16px(.dsh-atb-board 自身 padding)= 62px;
|
|
89
|
+
* padding 作用于容器所有换行行,配合 flex-wrap,任何宽度都不进簇区。
|
|
90
|
+
* 未装 better-sidebar 或面板展开时属性不存在,规则零生效。 */
|
|
91
|
+
html[data-dsh-atb-active] body[data-dsh-sidebar-collapsed] .dsh-atb-toolbar { padding-right: 62px; }
|
|
83
92
|
.dsh-atb-title { font-size: 15px; font-weight: 600; margin: 0; }
|
|
84
93
|
.dsh-atb-count { font-size: 12px; color: var(--dsw-text-secondary, gray); }
|
|
85
94
|
.dsh-atb-ver {
|
package/src/shared/version.ts
CHANGED