dsh-taskboard 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -6,8 +6,8 @@ window.__ModuleLoader__.load({
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
7
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react-dom/client"),n=require("react/jsx-runtime"),r=require("react-dom");async function i(e){let t=await e,n=await t.json().catch(()=>null);if(n===null)throw Error(`taskboard: HTTP ${t.status}`);if(!n.ok)throw Error(`taskboard: ${n.error.code}: ${n.error.message}`);return n.value}const a=1e4;async function o(e){return i(fetch(e,{signal:AbortSignal.timeout(a)}))}async function s(e,t){return i(await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t),signal:AbortSignal.timeout(a)}))}function c(){return{state:()=>o(`/dsh-taskboard/state`),workspaces:()=>o(`/dsh-taskboard/workspaces`),create:e=>s(`/dsh-taskboard/tasks`,e),get:e=>o(`/dsh-taskboard/tasks/${encodeURIComponent(e)}`),update:(e,t)=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/update`,t),move:(e,t)=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/move`,t),reject:(e,t)=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/reject`,t),comment:(e,t)=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/comment`,{body:t}),remove:(e,t)=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/delete`,t),run:(e,t)=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/run`,t??{}),cancel:e=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/cancel`,{}),mergeBranch:e=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/merge`,{}),worktreeRemove:(e,t)=>s(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/worktree-remove`,t),diagnostics:()=>o(`/dsh-taskboard/diagnostics`),worktreeCleanup:(e,t)=>s(`/dsh-taskboard/worktree-cleanup`,{workspaceId:e,taskId:t}),diff:(e,t)=>{let n=new URLSearchParams({execution:t.execution});return t.commit!==void 0&&n.set(`commit`,t.commit),t.path!==void 0&&n.set(`path`,t.path),t.repo!==void 0&&n.set(`repo`,t.repo),o(`/dsh-taskboard/tasks/${encodeURIComponent(e)}/diff?${n.toString()}`)},importPreview:e=>s(`/dsh-taskboard/import/preview`,e),importCommit:(e,t)=>s(`/dsh-taskboard/import`,{mode:e,ledger:t}),templates:()=>o(`/dsh-taskboard/templates`),templateUpsert:e=>s(`/dsh-taskboard/templates`,e),templateDelete:e=>s(`/dsh-taskboard/templates/delete`,{id:e}),settings:()=>o(`/dsh-taskboard/settings`),updateSettings:e=>s(`/dsh-taskboard/settings/update`,e),promptCompletions:()=>o(`/dsh-taskboard/prompt-completions`),modelCatalog:()=>o(`/dsh-taskboard/model-catalog`),stream(e,t){let n=new EventSource(`/dsh-taskboard/events`),r;return n.addEventListener(`hello`,e=>{let n;try{n=JSON.parse(e.data)}catch{return}r!==void 0&&n.revision!==r&&t(),r=n.revision}),n.addEventListener(`change`,n=>{let i;try{i=JSON.parse(n.data)}catch{return}r!==void 0&&i.revision!==r+1&&t(),r=i.revision,e(i)}),n.onerror=()=>{},()=>{n.close()}}}}const l=[`backlog`,`todo`,`in_progress`,`in_review`,`done`],u=[`canceled`,`archived`];[...l,...u];const d={backlog:[`todo`,`canceled`],todo:[`in_progress`,`backlog`,`canceled`],in_progress:[`in_review`,`todo`,`canceled`],in_review:[`in_progress`,`todo`,`done`,`canceled`],done:[`archived`],canceled:[`archived`,`todo`],archived:[]};function f(e,t){return d[e].includes(t)}function p(e){if(typeof e!=`string`)return`workspace-write`;let t=e.trim();if(t===`workspace-write`||t===`workspaceWrite`)return`workspace-write`;if(t===`read-only`||t===`readOnly`)return`read-only`;if(t===`danger-full-access`||t===`fullAccess`)return`danger-full-access`;throw Error(`permission must be 'workspace-write', 'read-only', or 'danger-full-access'`)}function m(e){return e?.defaultIsolation??`none`}function h(e){return e?.syncExternalSessions??!1}function g(e){return e?.defaultPermission??`workspace-write`}function _(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=[[0,59],[0,23],[1,31],[1,12],[0,7]],r=[];for(let e=0;e<5;e++){let[i,a]=n[e],o=new Set;if(!v(t[e],i,a,o))return null;r.push(o)}let i=new Set;for(let e of r[4])i.add(e===7?0:e);return{minutes:r[0],hours:r[1],days:r[2],months:r[3],weekdays:i}}function v(e,t,n,r){for(let i of e.split(`,`)){let[e,a]=i.split(`/`),o=a===void 0?1:Number.parseInt(a,10);if(!Number.isInteger(o)||o<1)return!1;let s,c;if(e===void 0||e===``)return!1;if(e===`*`)s=t,c=n;else if(e.includes(`-`)){let[t,n]=e.split(`-`);if(s=Number.parseInt(t??``,10),c=Number.parseInt(n??``,10),!Number.isInteger(s)||!Number.isInteger(c))return!1}else{if(s=Number.parseInt(e,10),!Number.isInteger(s))return!1;c=a===void 0?s:n}if(s<t||c>n||s>c)return!1;for(let e=s;e<=c;e+=o)r.add(e)}return r.size>0}function y(e,t){let n=new Date(t);n.setSeconds(0,0),n.setMinutes(n.getMinutes()+1);let r=t+4*366*24*60*60*1e3,i=n.getTime();for(;i<=r;){let t=new Date(i);if(e.months.has(t.getMonth()+1)&&e.days.has(t.getDate())&&e.weekdays.has(t.getDay())&&e.hours.has(t.getHours())&&e.minutes.has(t.getMinutes()))return i;i+=6e4}return null}function b(){return{schemaVersion:1,revision:0,tasks:[]}}function x(e){let t=e.checklist??[];return{done:t.filter(e=>e.checked).length,total:t.length}}const S={zh:{"shared.close":`关闭`,"shared.cancel":`取消`,"shared.loading":`读取中…`,"shared.blocked":`受阻`,"shared.permission":`权限`,"shared.confirmDelete":`确认删除`,"shared.current":`(当前:{name})`,"shared.entry.aria":`Agent 任务看板`,"shared.entry.label":`任务看板`,"shared.stats.title":`待办 {todo} | 进行中 {doing} | 待验收 {review}(待办|进行中|待验收)`,"shared.duplicate.suffix":`(副本)`,"status.column.backlog":`待规划`,"status.column.todo":`待办`,"status.column.in_progress":`进行中`,"status.column.in_review":`待验收`,"status.column.done":`已完成`,"status.column.canceled":`已取消`,"status.column.archived":`已归档`,"status.pill.backlog":`待规划`,"status.pill.todo":`待办`,"status.pill.in_progress":`进行中`,"status.pill.in_review":`待验收`,"status.pill.done":`完成`,"status.pill.canceled":`取消`,"status.pill.archived":`归档`,"status.move.backlog":`待规划`,"status.move.todo":`待办`,"status.move.in_progress":`进行中`,"status.move.in_review":`待验收`,"status.move.done":`完成`,"status.move.canceled":`取消`,"status.move.archived":`归档`,"urgency.urgent":`紧急`,"urgency.normal":`一般`,"urgency.relaxed":`不急`,"outcome.running":`执行中`,"outcome.succeeded":`成功`,"outcome.failed":`失败`,"outcome.cancelled":`已取消`,"board.title":`Agent 任务看板`,"board.count.tasks":`{n} 任务 · rev {rev}`,"board.action.newTask":`+ 新建任务 ▼`,"board.action.blankTask":`空白任务`,"board.action.manageTemplates":`⌗ 管理模板…`,"board.search.placeholder":`搜索标题 / ID…`,"board.filter.allProjects":`全部项目`,"board.sort.title":`列内排序`,"board.sort.default":`默认排序`,"board.sort.updated":`最近更新`,"board.sort.urgency":`按紧急度`,"board.sort.created":`创建时间`,"board.sort.byTitle":`按标题`,"board.action.backToBoard":`返回看板`,"board.action.otherTasks":`其它任务`,"board.action.settingsTitle":`看板设置:新建任务的默认执行隔离等`,"board.action.settings":`🛠 设置`,"board.action.diagTitle":`健康诊断:遗留 worktree、台账基本项`,"board.action.diag":`⚙ 诊断`,"board.action.importTitle":`从 JSON 备份文件导入台账(预览后合并或整册替换)`,"board.action.import":`⬆ 导入`,"board.action.exportTitle":`导出台账:完整 JSON 备份或任务清单 CSV`,"board.action.export":`⬇ 导出 ▼`,"board.export.jsonTitle":`完整台账备份(含执行历史与看板设置),可用于导入恢复`,"board.export.json":`完整台账(JSON)`,"board.export.csvTitle":`任务清单表格(Excel 可直接打开,中文已加 BOM)`,"board.export.csv":`任务清单(CSV)`,"board.drag.forbidden":`无法从「{from}」拖至「{to}」`,"board.empty":`无任务`,"board.secondary.empty":`无已取消 / 已归档 / 已删除任务`,"board.group.trashed":`已删除`,"diag.title":`健康诊断`,"diag.subtitle":`台账基本项与 worktree 遗留清理`,"diag.revision":`台账修订号`,"diag.tasks":`任务总数`,"diag.running":`执行中`,"diag.orphans":`遗留 worktree`,"diag.orphans.heading":`遗留 worktree(台账无主但目录存在)`,"diag.orphans.none":`无遗留 — 各项目 .dsh-worktrees 目录干净`,"diag.orphans.cleanup":`清理`,"diag.orphans.hint":`提示:有未提交修改的遗留目录会被拒绝清理,请先手动处理其内容。live 任务的 worktree 请在任务详情页删除。`,"diag.gitignore.heading":`gitignore 建议`,"diag.gitignore.none":`无待办 — 各 git 项目已忽略 .dsh-worktrees 目录`,"diag.gitignore.suggestA":`建议在 .gitignore 加入一行`,"diag.gitignore.suggestB":`(不会自动修改)`,"card.drag.running":`该任务正由会话执行中({title}),不能拖动`,"card.badge.stale":`⏱ 认领超时`,"card.badge.modelTitle":`固定模型: {model}`,"card.badge.modelEffort":` · 思考强度: {effort}`,"card.badge.checklistReview":`待验收:清单未全部勾选`,"card.badge.checklist":`验收清单进度`,"card.badge.pendingPurge":`待清除`,"card.session.jumpTitle":`点击一键跳转到会话:{id}`,"card.session.missing":`该会话已被删除({id}),无法打开`,"card.session.archived":`该会话已归档({id}),已从会话列表隐藏`,"card.session.unavailable":`会话导航不可用,会话 ID:{id}`,"card.reject.placeholder":`退回原因(可选,agent 开工前会读)…`,"card.reject.confirm":`退回待办`,"card.action.doneTitle":`验收完成:移至已完成`,"card.action.done":`✓ 完成`,"card.action.rejectTitle":`退回待办,可附退回原因`,"card.action.reject":`✗ 退回`,"alert.ok":`知道了`,"diff.commit":`提交 {hash}`,"diff.file":`文件 {path}`,"diff.truncated":`⚠ 内容过长已截断`,"diff.failed":`获取失败(原因见看板顶部错误条;对象可能已随 worktree 删除丢失)`,"checklist.title":`验收清单(DoD)`,"checklist.unchecked":` · {n} 项未完成`,"checklist.allDone":` · 全部完成`,"checklist.byUser":`👤 用户`,"checklist.uncheckedItem":`未完成`,"checklist.evidence":`证据:{note}`,"report.title":`执行报告`,"report.submitted":`由执行会话提交 · {time}`,"report.changedFiles":`改动文件`,"report.checks":`自验情况`,"report.artifacts":`产物`,"report.risk":`剩余风险`,"iso.title":`执行隔离`,"iso.none":`📁 原目录执行`,"iso.worktreeTitle":`执行隔离 · Worktree`,"iso.branch":`🌿 分支`,"iso.baseline":`基线 {base} → {head}`,"iso.changed":`改动 {n} 个文件`,"iso.commit.openTitle":`点击展开该提交的 diff`,"iso.commits.more":`… 共 {n} 个提交`,"iso.nocommit":`该次执行没有产生提交(改动可能未提交,见下方警告)`,"iso.dirty.toggle":`⚠ 有 {n} 处未提交修改(合并前请让 agent 提交,或手动处理)`,"iso.dirty.expand":` ▼ 查看文件`,"iso.dirty.collapse":` ▲`,"iso.dirty.openTitle":`点击查看该文件的未提交 diff`,"iso.dirty.more":`… 共 {n} 处(完整列表见任务台账)`,"iso.hint.running":`执行中 — 结束后可合并或清理`,"iso.merge.confirm":`将分支以 --no-ff 合并到主工作区?`,"iso.merge.go":`确认合并`,"iso.merge.title":`在主工作区 git merge --no-ff 该任务分支(要求主区干净;冲突会原样报告)`,"iso.merge.button":`⇥ 合并到主工作区`,"iso.merge.failed":`合并失败:{error}`,"iso.merge.noop":`该分支没有领先主工作区的新提交,无需合并(可退回续跑或直接清理)`,"iso.merge.done":`已按仓库合并(--no-ff):{summary}`,"iso.merge.partial":`部分仓库合并失败:{summary}
8
8
  {error}`,"iso.repo.root":`根仓库`,"iso.remove.wt":`🗑 删除 worktree`,"iso.remove.wtTitle":`git worktree remove(有未提交修改时拒绝)`,"iso.remove.wtb":`🗑 删 worktree + 分支`,"iso.remove.wtbTitle":`删除 worktree 并删除任务分支(有未提交修改时拒绝)`,"iso.remove.confirmWt":`删除 worktree 目录?`,"iso.remove.confirmWtb":`删除 worktree 并删除分支?`,"iso.remove.failed":`删除失败:{error}`,"iso.remove.branchFailed":`worktree 已删除,但分支删除失败:{error}`,"iso.hint.keep":`分支与 worktree 保留中 — 可退回继续修改`,"detail.session.jumpTitle":`一键跳转到对应会话:{id}`,"detail.session.jump":`🤖 跳转会话 ↗`,"detail.action.edit":`✎ 编辑`,"detail.action.duplicateTitle":`复制此任务的全部配置为一张新卡(待办列)`,"detail.action.duplicate":`⧉ 复制`,"detail.action.saveTplTitle":`把此任务的配置(含清单)保存为模板,新建任务时可用`,"detail.action.saveTplDone":`已存为模板(新建任务 ▼ 下拉可用,可在模板管理中改名)`,"detail.action.saveTpl":`⌗ 存为模板`,"detail.action.reuseTitle":`续跑:保留现有 worktree 与分支(上次的改动和提交都在原处),在其上继续执行;默认「立即执行」会重置为全新基线`,"detail.action.reuse":`↻ 续跑`,"detail.action.runTitleModel":`新会话执行({model})`,"detail.action.runTitleDefault":`新会话执行(默认模型)`,"detail.action.run":`▶ 立即执行`,"detail.action.stopConfirm":`停止该执行会话?`,"detail.action.stop":`停止`,"detail.action.stopTitle":`停止执行会话 {id}(任务回到待办)`,"detail.action.stopExec":`■ 停止执行`,"detail.chip.nextRun":`{cron} · 下次 {time}`,"detail.chip.checklist":`清单 {done}/{total}`,"detail.chip.isolated":`Worktree 隔离`,"detail.chip.holderTitle":`点击跳转至该会话:{id}`,"detail.chip.holderStale":`认领超时 · `,"detail.chip.holderBy":`由 `,"detail.chip.holderSuffix":` 持有 ↗`,"detail.chip.trashed":`已删除待清除`,"detail.sub.line":`更新 {time} · 最近操作 {who}`,"detail.updatedBy.system":`⚙️ 系统`,"detail.updatedBy.user":`👤 用户`,"detail.field.description":`描述`,"detail.field.prompt":`执行 Prompt`,"detail.move.to":`移至→{status}`,"detail.move.confirmDoneUnchecked":`仍有 {n} 项清单未勾选,确认完成?`,"detail.move.confirmDone":`确认完成?`,"detail.move.confirm":`确认`,"detail.blocked.unmark":`✓ 解除受阻`,"detail.blocked.mark":`⛔ 标记受阻`,"detail.release.title":`释放 {id} 的认领:任务回到待办(持有会话可能仍在工作,确认它已停止后再释放)`,"detail.release.button":`🔓 释放认领`,"detail.comments.title":`评论`,"detail.comments.empty":`暂无评论 — agent 交接时会在这里汇报改动与验证结果`,"detail.comments.user":`用户`,"detail.composer.placeholder":`以用户身份留言(agent 开工前会读)…`,"detail.composer.send":`发表`,"detail.exec.title":`执行记录`,"detail.exec.prunedTitle":`更早的 {n} 条执行记录已按保留上限清理`,"detail.exec.pruned":`+{n} 已清理`,"detail.exec.trigger.manual":`手动`,"detail.exec.trigger.scheduled":`定时`,"detail.exec.openTitle":`点击打开该执行会话:{id}`,"detail.danger.delete":`🗑 删除(标记待清除)`,"detail.danger.purgeConfirm":`物理清除不可恢复`,"detail.danger.purgeGo":`确认清除`,"detail.danger.purge":`🔥 物理清除(需确认)`,"form.title.create":`新建任务`,"form.title.edit":`编辑任务`,"form.subtitle.create":`推入看板,项目内会话可认领执行`,"form.subtitle.edit":`调整任务内容与执行配置`,"form.field.title":`标题`,"form.field.titlePlaceholder":`一句话说清要做什么`,"form.field.project":`项目`,"form.field.model":`模型(默认 = 会话默认模型)`,"form.field.modelDefault":`默认模型`,"form.model.option":`{name}({provider})`,"form.field.effort":`思考强度(Reasoning Effort)`,"form.field.effortTitle":`设置模型的思考强度(如 low/medium/high);默认 = 跟随模型/提供商默认`,"form.effort.follow":`跟随模型默认`,"form.effort.low":`低 (low)`,"form.effort.medium":`中 (medium)`,"form.effort.high":`高 (high)`,"form.effort.none":`关闭思考 (none)`,"form.field.preset":`执行模式(preset)`,"form.field.presetTitle":`执行会话按该 preset 组合(决定工具集与人设);默认 = 部署默认 preset`,"form.preset.follow":`跟随部署默认`,"form.preset.defaultTag":`(部署默认)`,"form.field.urgency":`紧急度`,"form.urgency.urgent":`紧急`,"form.urgency.urgentHint":`优先处理`,"form.urgency.normal":`一般`,"form.urgency.normalHint":`正常排期`,"form.urgency.relaxed":`不急`,"form.urgency.relaxedHint":`有空再做`,"form.field.description":`描述`,"form.field.descriptionOptional":`描述(可选)`,"form.desc.placeholder":`需求细节、背景说明、验收标准…`,"form.field.prompt":`执行 Prompt(实际 Prompt = 标题+任务描述+Prompt)`,"form.field.promptOptional":`执行 Prompt(可选;实际 Prompt = 标题+任务描述+Prompt)`,"form.prompt.placeholder":`追加在「标题+任务描述」之后发给执行会话的补充指令。支持模板变量:{{lastExecution}}(上次执行结果)、{{lastComments}}(最近 3 条评论)`,"form.field.mode":`执行方式`,"form.mode.claim":`🤝 认领制`,"form.mode.claimHint":`项目内会话认领`,"form.mode.scheduled":`⏰ 定时执行`,"form.mode.scheduledHint":`到点自动开跑`,"form.field.cron":`Cron 表达式`,"form.cron.placeholder":`分 时 日 月 周`,"form.cron.daily":`每天 09:00`,"form.cron.hourly":`每小时`,"form.cron.every10min":`每 10 分钟`,"form.cron.weekly":`每周一 09:00`,"form.cron.next":`下次 {time}`,"form.field.isolation":`执行隔离`,"form.iso.locked":`任务已有执行记录,隔离方式已锁定`,"form.iso.lockedShort":`已锁定(执行开始后不可更改)`,"form.iso.nonGit":`当前项目非 git 仓库`,"form.iso.worktree":`🌿 Worktree 隔离`,"form.iso.worktreeTitle":`每次执行在独立 worktree 分支上进行`,"form.iso.worktreeHint":`独立分支 task/标题+ID,互不污染`,"form.iso.none":`📁 原目录执行`,"form.iso.noneTitle":`直接在项目目录执行(不使用 git)`,"form.iso.noneHintNonGit":`当前项目非 git 仓库,将在原目录执行`,"form.iso.noneHint":`不使用 git,直接在项目目录工作`,"form.iso.nonGitNote":`当前项目非 git 仓库,将在原目录执行(任务仍按默认配置创建,运行时自动降级)`,"form.iso.mirrorNote":`多仓库工作区:Worktree 隔离将自动整区镜像 {n} 个仓库——每仓库独立任务分支,验收按仓库合并`,"form.field.checklist":`验收清单(DoD)`,"form.field.checklistOptional":`验收清单(DoD,可选)`,"form.check.itemPlaceholder":`验收项 {n}(完成标准)`,"form.check.removeTitle":`删除该验收项`,"form.check.add":`+ 添加验收项`,"form.check.checkedTitle":`勾选状态随保存保留(当前勾选人:{who})`,"form.check.notCheckedYet":`未勾选`,"form.check.hintCreate":`共 {n} 项,执行会话按清单干活并逐项勾选,未完成项验收时高亮`,"form.check.hintEdit":`已勾选 {checked}/{total}(保存将整体覆盖清单,勾选状态保留)`,"form.hint.needTitle":`请填写标题`,"form.hint.needProject":`请选择项目`,"form.hint.cronBad":`Cron 表达式无效(分 时 日 月 周)`,"form.hint.nextRun":`下次运行 {time}`,"form.hint.saveVersion":`保存后版本 v{v} → v{next}`,"form.hint.createClaim":`创建后项目内会话可认领执行`,"form.action.runBlockedTitle":`任务正在执行中,不能重复发起`,"form.action.runBusyTitle":`正在提交…`,"form.action.runTitle":`保存后立即发起执行(新会话)`,"form.action.run":`⚡ 立即执行`,"form.action.save":`保存修改`,"form.action.create":`创建任务`,"tpl.aria":`管理模板`,"tpl.title":`任务模板`,"tpl.subtitle":`新建任务 ▼ 下拉的模板:改名 / 删除 / 直接使用;任务详情页「存为模板」可新增`,"tpl.empty":`暂无模板 — 在任务详情页点「存为模板」把常用配置沉淀下来`,"tpl.name.aria":`模板名 {name}`,"tpl.builtin":`内置`,"tpl.custom":`自建`,"tpl.meta.checklist":` · 清单 {n} 项`,"tpl.rename.title":`保存改名`,"tpl.rename.button":`改名`,"tpl.use.title":`用此模板打开新建表单`,"tpl.use.button":`用此新建`,"tpl.delete.title":`删除该模板`,"tpl.renamed":`模板已改名`,"tpl.foot.hint":`模板随台账一同保存在 DSH 主目录,升级不丢`,"imp.aria":`导入台账`,"imp.title":`导入台账`,"imp.subtitle":`选择导出的 JSON 备份文件:先预览、再合并或整册替换`,"imp.parseError":`文件不是合法 JSON`,"imp.note":`⬇ JSON 导出的文件即为同格式备份,可直接导入恢复;导入文件的 schemaVersion 必须与当前版本一致。`,"imp.previewing":`预览中…`,"imp.stat.create":`新增`,"imp.stat.overwrite":`覆盖(同 id)`,"imp.stat.invalid":`无效(跳过)`,"imp.sec.create":`新增任务`,"imp.sec.overwrite":`覆盖任务(整卡替换,含执行历史与评论)`,"imp.sec.invalid":`无效条目(不会导入)`,"imp.noId":`(无 id)`,"imp.mode.merge":`⊕ 合并`,"imp.mode.mergeHint":`新增 + 按 id 覆盖,其余不动`,"imp.mode.replace":`💣 整册替换`,"imp.mode.replaceHint":`清空当前台账,以导入文件为准(先自动备份)`,"imp.result.replace":`整册替换完成:导入 {n} 张(原 {total} 张已整册备份)`,"imp.result.merge":`合并完成:新增 {n} 张、覆盖 {m} 张`,"imp.foot.replaceConfirm":`⚠ 再次点击确认执行整册替换(不可撤销,已自动备份)`,"imp.foot.replaceNeedConfirm":`整册替换需要二次确认`,"imp.foot.mergeHint":`合并只写入预览中列出的任务`,"imp.action.run":`执行导入`,"imp.action.confirmReplace":`确认整册替换`,"set.aria":`看板设置`,"set.title":`看板设置`,"set.subtitle":`新建任务与会话同步的全局默认值`,"set.iso.heading":`默认执行隔离`,"set.iso.noneHint":`不使用 git,直接在项目目录工作(出厂默认)`,"set.iso.worktreeHint":`每次执行在独立 worktree 分支上进行(task/标题+ID),互不污染;多仓库工作区自动整区镜像(每仓库独立分支)`,"set.iso.current":`当前保存的默认:{current}。仅影响之后新建的任务;已有任务保持创建时的选择,非 git 项目运行时仍自动降级原目录。`,"set.sync.heading":`自动同步工作区会话`,"set.sync.off.name":`🚫 关闭同步`,"set.sync.off.title":`仅管理在任务看板中创建和触发的任务`,"set.sync.off.hint":`仅管理看板任务(出厂默认)`,"set.sync.on.name":`🔄 自动纳入会话`,"set.sync.on.title":`各工作区直接新建的会话也会在看板展示,运行中进入「进行中」,完成后自动进入「待验收」`,"set.sync.on.hint":`跟踪运行并在完成后进入待验收`,"set.sync.stateOn":`已开启:工作区直接新建并执行的会话将自动在看板生成任务卡片,并在完成后流转至「待验收」列。`,"set.sync.stateOff":`已关闭:仅在看板内部创建与触发执行的任务会出现在看板上。`,"set.foot.dirty":`有未保存的修改`,"set.foot.clean":`与看板当前设置一致`,"set.action.save":`保存设置`,"form.field.permission":`执行权限`,"form.perm.write":`可写入工作区`,"form.perm.writeHint":`可读写工作区及临时目录(推荐默认)`,"form.perm.readOnly":`仅可查看`,"form.perm.readOnlyHint":`只读查看与检索,禁止修改文件或执行外部命令`,"form.perm.fullAccess":`完全权限`,"form.perm.fullAccessHint":`完全无限制权限,可访问全盘及执行外部命令`,"form.perm.defaultTag":`(默认)`,"set.perm.heading":`默认执行权限`,"set.perm.writeName":`📁 可写入工作区(出厂默认)`,"set.perm.writeHint":`可读写工作区及临时目录,写操作无需二次确认`,"set.perm.readOnlyName":`🔒 仅可查看`,"set.perm.readOnlyHint":`仅允许只读查看与检索,禁止修改文件或破坏性命令`,"set.perm.fullName":`⚡ 完全权限`,"set.perm.fullHint":`完全无限制权限,可访问全盘及执行系统外部命令`,"set.perm.current":`当前保存的默认:{current}。新建任务时预设的执行权限。`,"card.badge.permReadOnly":`🔒 仅查看`,"card.badge.permReadOnlyTitle":`权限:仅可查看`,"card.badge.permFull":`⚡ 全权限`,"card.badge.permFullTitle":`权限:完全权限`,"detail.chip.permReadOnly":`仅可查看`,"detail.chip.permFull":`完全权限`,"detail.chip.permWrite":`可写入工作区`,"tpl.meta.permReadOnly":`仅查看`,"tpl.meta.permFull":`全权限`,"md.imageAlt":`图片 {n}`,"md.imageTitle":`点击查看大图 ({alt})`,"md.lightboxAlt":`大图预览`,"md.closePreview":`关闭预览`,"slash.aria":`快捷命令与技能`,"slash.title":`快捷命令与技能补全`,"slash.hint":`↑↓ 选择 · Enter / Tab 确认 · Esc 关闭`,"slash.badge.command":`⚡ 命令`,"slash.badge.skill":`🧩 技能`,"slash.tipA":`💡 输入`,"slash.tipB":`可快速补全 Slash 命令与 Agent 技能`,"slash.cmd.goal.desc":`自主完成长期目标任务,持续深度推进`,"slash.cmd.goal.hint":`<目标描述>`,"slash.cmd.schedule.desc":`设置一次性定时或周期性 Cron 调度`,"slash.cmd.schedule.hint":`<时间/表达式>`,"slash.cmd.plan.desc":`在行动前制定分步实施计划并由用户确认`,"slash.cmd.browser.desc":`启动网页浏览器交互与实时页面检索`,"slash.cmd.grill-me.desc":`通过多轮单题访谈深入对齐需求与设计意图`,"slash.cmd.teamwork-preview.desc":`多智能体协作与团队工作流预览`,"slash.cmd.learn.desc":`沉淀解决经验与新规则到知识库`,"slash.cmd.review.desc":`多维度代码审查(正确性、架构与安全)`,"slash.cmd.security.desc":`安全加固与代码漏洞扫描`,"slash.cmd.permission.desc":`切换当前会话权限级别 (read-only / workspace-write / full-access)`,"slash.cmd.permission.hint":`<preset>`,"slash.skill.frontend-ui-engineering":`构建生产级、可访问的高品质前端界面与组件`,"slash.skill.api-and-interface-design":`设计稳定契约、清晰边界的 REST / RPC 接口`,"slash.skill.test-driven-development":`测试驱动开发(TDD),编写单元与集成测试`,"slash.skill.debugging-and-error-recovery":`系统化定位 Bug 根因并恢复错误`,"slash.skill.performance-optimization":`前后端性能调优、减少渲染开销与查询优化`,"slash.skill.ci-cd-and-automation":`自动化构建、CI/CD 流水线与质量门禁`,"slash.skill.code-review-and-quality":`多轴向代码审查与重构指导`,"slash.skill.code-simplification":`精简复杂逻辑,提升可读性与可维护性`,"slash.skill.context-engineering":`优化上下文结构与提示词工程`,"slash.skill.doubt-driven-development":`以怀疑驱动的对抗式审查,确保核心逻辑正确`,"slash.skill.git-workflow-and-versioning":`Git 工作流、分支管理、语义化版本与变更日志`,"slash.skill.idea-refine":`通过发散与收敛思维细化方案与假设检验`,"slash.skill.incremental-implementation":`小步快跑、增量交付多文件变更`,"slash.skill.interview-me":`深度访谈挖掘真实意图`,"slash.skill.memory-leak-debugging":`排查诊断 JavaScript/Node.js 内存泄漏`,"slash.skill.observability-and-instrumentation":`添加日志、指标打点与链路追踪`,"slash.skill.planning-and-task-breakdown":`将复杂需求拆解为有序可执行任务`,"slash.skill.security-and-hardening":`防御安全漏洞、输入过滤与鉴权加固`,"slash.skill.shipping-and-launch":`生产发布前检查清单与回滚策略`,"slash.skill.source-driven-development":`基于权威官方文档与源码进行设计实现`,"slash.skill.spec-driven-development":`在编码前制定清晰的技术规范`,"slash.skill.using-agent-skills":`发现并动态调用智能体各项专业技能`},en:{"shared.close":`Close`,"shared.cancel":`Cancel`,"shared.loading":`Loading…`,"shared.blocked":`Blocked`,"shared.permission":`Permission`,"shared.confirmDelete":`Delete`,"shared.current":` (current: {name})`,"shared.entry.aria":`Agent task board`,"shared.entry.label":`Task board`,"shared.stats.title":`To do {todo} | In progress {doing} | In review {review} (todo | in progress | in review)`,"shared.duplicate.suffix":` (copy)`,"status.column.backlog":`Backlog`,"status.column.todo":`To do`,"status.column.in_progress":`In progress`,"status.column.in_review":`In review`,"status.column.done":`Done`,"status.column.canceled":`Canceled`,"status.column.archived":`Archived`,"status.pill.backlog":`Planned`,"status.pill.todo":`To do`,"status.pill.in_progress":`In progress`,"status.pill.in_review":`In review`,"status.pill.done":`Done`,"status.pill.canceled":`Canceled`,"status.pill.archived":`Archived`,"status.move.backlog":`Backlog`,"status.move.todo":`To do`,"status.move.in_progress":`In progress`,"status.move.in_review":`In review`,"status.move.done":`Done`,"status.move.canceled":`Canceled`,"status.move.archived":`Archived`,"urgency.urgent":`Urgent`,"urgency.normal":`Normal`,"urgency.relaxed":`Relaxed`,"outcome.running":`Running`,"outcome.succeeded":`Succeeded`,"outcome.failed":`Failed`,"outcome.cancelled":`Canceled`,"board.title":`Agent Task Board`,"board.count.tasks":`{n} tasks · rev {rev}`,"board.action.newTask":`+ New Task ▼`,"board.action.blankTask":`Blank task`,"board.action.manageTemplates":`⌗ Manage templates…`,"board.search.placeholder":`Search title / ID…`,"board.filter.allProjects":`All projects`,"board.sort.title":`Sort within columns`,"board.sort.default":`Default order`,"board.sort.updated":`Recently updated`,"board.sort.urgency":`By urgency`,"board.sort.created":`Creation time`,"board.sort.byTitle":`By title`,"board.action.backToBoard":`Back to board`,"board.action.otherTasks":`Other tasks`,"board.action.settingsTitle":`Board settings: default execution isolation for new tasks, etc.`,"board.action.settings":`🛠 Settings`,"board.action.diagTitle":`Health diagnostics: orphan worktrees, ledger basics`,"board.action.diag":`⚙ Diagnostics`,"board.action.importTitle":`Import the ledger from a JSON backup (preview, then merge or replace)`,"board.action.import":`⬆ Import`,"board.action.exportTitle":`Export the ledger: full JSON backup or task-list CSV`,"board.action.export":`⬇ Export ▼`,"board.export.jsonTitle":`Full ledger backup (execution history and board settings included); import it to restore`,"board.export.json":`Full ledger (JSON)`,"board.export.csvTitle":`Task-list spreadsheet (opens directly in Excel; BOM added for CJK text)`,"board.export.csv":`Task list (CSV)`,"board.drag.forbidden":`Cannot drag from "{from}" to "{to}"`,"board.empty":`No tasks`,"board.secondary.empty":`No canceled / archived / deleted tasks`,"board.group.trashed":`Deleted`,"diag.title":`Health diagnostics`,"diag.subtitle":`Ledger basics and orphan-worktree cleanup`,"diag.revision":`Ledger revision`,"diag.tasks":`Total tasks`,"diag.running":`Running`,"diag.orphans":`Orphan worktrees`,"diag.orphans.heading":`Orphan worktrees (no owning task, directory still present)`,"diag.orphans.none":`None — every project’s .dsh-worktrees directory is clean`,"diag.orphans.cleanup":`Clean up`,"diag.orphans.hint":`Note: orphan directories with uncommitted changes are refused; handle their contents manually first. Remove a live task’s worktree from its task detail pane.`,"diag.gitignore.heading":`gitignore suggestions`,"diag.gitignore.none":`Nothing to do — every git project already ignores .dsh-worktrees`,"diag.gitignore.suggestA":`suggests adding one line to .gitignore:`,"diag.gitignore.suggestB":`(no automatic edits)`,"card.drag.running":`This task is being executed by a session ({title}) and cannot be dragged`,"card.badge.stale":`⏱ Claim stale`,"card.badge.modelTitle":`Pinned model: {model}`,"card.badge.modelEffort":` · reasoning effort: {effort}`,"card.badge.checklistReview":`In review: checklist has unchecked items`,"card.badge.checklist":`Acceptance checklist progress`,"card.badge.pendingPurge":`Pending purge`,"card.session.jumpTitle":`Click to jump to the session: {id}`,"card.session.missing":`The session has been deleted ({id}) and cannot be opened`,"card.session.archived":`The session is archived ({id}) and hidden from the session list`,"card.session.unavailable":`Session navigation unavailable; session id: {id}`,"card.reject.placeholder":`Reason for sending back (optional; the agent reads it before starting)…`,"card.reject.confirm":`Send back to todo`,"card.action.doneTitle":`Accept and complete: move to Done`,"card.action.done":`✓ Done`,"card.action.rejectTitle":`Send back to todo, optionally with a reason`,"card.action.reject":`✗ Send back`,"alert.ok":`Got it`,"diff.commit":`Commit {hash}`,"diff.file":`File {path}`,"diff.truncated":`⚠ Content truncated (too long)`,"diff.failed":`Failed to fetch (see the error bar at the top of the board; the object may be gone with a removed worktree)`,"checklist.title":`Acceptance checklist (DoD)`,"checklist.unchecked":` · {n} unchecked`,"checklist.allDone":` · all done`,"checklist.byUser":`👤 User`,"checklist.uncheckedItem":`Unchecked`,"checklist.evidence":`Evidence: {note}`,"report.title":`Execution report`,"report.submitted":`Submitted by the execution session · {time}`,"report.changedFiles":`Changed files`,"report.checks":`Self-verification`,"report.artifacts":`Artifacts`,"report.risk":`Remaining risks`,"iso.title":`Execution isolation`,"iso.none":`📁 Run in the original directory`,"iso.worktreeTitle":`Execution isolation · Worktree`,"iso.branch":`🌿 Branch`,"iso.baseline":`Baseline {base} → {head}`,"iso.changed":`{n} files changed`,"iso.commit.openTitle":`Click to expand this commit’s diff`,"iso.commits.more":`… {n} commits in total`,"iso.nocommit":`This execution produced no commits (changes may be uncommitted — see the warning below)`,"iso.dirty.toggle":`⚠ {n} uncommitted changes (have the agent commit before merging, or handle them manually)`,"iso.dirty.expand":` ▼ view files`,"iso.dirty.collapse":` ▲`,"iso.dirty.openTitle":`Click to view the uncommitted diff of this file`,"iso.dirty.more":`… {n} in total (full list in the task ledger)`,"iso.hint.running":`Running — merge or clean up after it ends`,"iso.merge.confirm":`Merge the branch into the main worktree with --no-ff?`,"iso.merge.go":`Merge`,"iso.merge.title":`git merge --no-ff the task branch into the main worktree (requires a clean main worktree; conflicts are reported as-is)`,"iso.merge.button":`⇥ Merge into main worktree`,"iso.merge.failed":`Merge failed: {error}`,"iso.merge.noop":`The branch has no commits ahead of the main worktree — nothing to merge (send it back to continue running, or clean it up)`,"iso.merge.done":`Merged per repo (--no-ff): {summary}`,"iso.merge.partial":`Some repos failed to merge: {summary}
9
- {error}`,"iso.repo.root":`Root repo`,"iso.remove.wt":`🗑 Remove worktree`,"iso.remove.wtTitle":`git worktree remove (refused when uncommitted changes exist)`,"iso.remove.wtb":`🗑 Remove worktree + branch`,"iso.remove.wtbTitle":`Remove the worktree and delete the task branch (refused when uncommitted changes exist)`,"iso.remove.confirmWt":`Remove the worktree directory?`,"iso.remove.confirmWtb":`Remove the worktree and delete the branch?`,"iso.remove.failed":`Removal failed: {error}`,"iso.remove.branchFailed":`Worktree removed, but branch deletion failed: {error}`,"iso.hint.keep":`Branch and worktree kept — send back to continue editing`,"detail.session.jumpTitle":`Jump to the corresponding session: {id}`,"detail.session.jump":`🤖 Jump to session ↗`,"detail.action.edit":`✎ Edit`,"detail.action.duplicateTitle":`Duplicate this task’s full configuration as a new card (todo column)`,"detail.action.duplicate":`⧉ Duplicate`,"detail.action.saveTplTitle":`Save this task’s configuration (checklist included) as a template for new tasks`,"detail.action.saveTplDone":`Saved as a template (available in the New Task ▼ menu; rename it in template management)`,"detail.action.saveTpl":`⌗ Save as template`,"detail.action.reuseTitle":`Reuse-run: keep the existing worktree and branch (last run’s changes and commits stay in place) and continue on top of them; the default "Run" resets to a fresh baseline`,"detail.action.reuse":`↻ Reuse-run`,"detail.action.runTitleModel":`Run in a new session ({model})`,"detail.action.runTitleDefault":`Run in a new session (default model)`,"detail.action.run":`▶ Run`,"detail.action.stopConfirm":`Stop this execution session?`,"detail.action.stop":`Stop`,"detail.action.stopTitle":`Stop execution session {id} (the task returns to todo)`,"detail.action.stopExec":`■ Stop execution`,"detail.chip.nextRun":`{cron} · next {time}`,"detail.chip.checklist":`Checklist {done}/{total}`,"detail.chip.isolated":`Worktree isolation`,"detail.chip.holderTitle":`Click to jump to the session: {id}`,"detail.chip.holderStale":`Claim stale · `,"detail.chip.holderBy":`Held by `,"detail.chip.holderSuffix":` ↗`,"detail.chip.trashed":`Deleted, pending purge`,"detail.sub.line":`Updated {time} · last change by {who}`,"detail.updatedBy.system":`⚙️ System`,"detail.updatedBy.user":`👤 User`,"detail.field.description":`Description`,"detail.field.prompt":`Execution prompt`,"detail.move.to":`Move to → {status}`,"detail.move.confirmDoneUnchecked":`{n} checklist items are still unchecked — confirm done?`,"detail.move.confirmDone":`Confirm done?`,"detail.move.confirm":`Confirm`,"detail.blocked.unmark":`✓ Unblock`,"detail.blocked.mark":`⛔ Mark blocked`,"detail.release.title":`Release {id}’s claim: the task returns to todo (the holding session may still be working — make sure it has stopped first)`,"detail.release.button":`🔓 Release claim`,"detail.comments.title":`Comments`,"detail.comments.empty":`No comments yet — the agent reports changes and verification here at handoff`,"detail.comments.user":`User`,"detail.composer.placeholder":`Leave a comment as the user (the agent reads it before starting)…`,"detail.composer.send":`Post`,"detail.exec.title":`Executions`,"detail.exec.prunedTitle":`{n} older execution records were pruned at the retention cap`,"detail.exec.pruned":`+{n} pruned`,"detail.exec.trigger.manual":`Manual`,"detail.exec.trigger.scheduled":`Scheduled`,"detail.exec.openTitle":`Click to open the execution session: {id}`,"detail.danger.delete":`🗑 Delete (mark for purge)`,"detail.danger.purgeConfirm":`Physical purge is irreversible`,"detail.danger.purgeGo":`Purge`,"detail.danger.purge":`🔥 Purge physically (confirm required)`,"form.title.create":`New task`,"form.title.edit":`Edit task`,"form.subtitle.create":`Push onto the board; sessions in the project can claim and run it`,"form.subtitle.edit":`Adjust the task content and execution configuration`,"form.field.title":`Title`,"form.field.titlePlaceholder":`One line: what should be done`,"form.field.project":`Project`,"form.field.model":`Model (default = session default model)`,"form.field.modelDefault":`Default model`,"form.model.option":`{name} ({provider})`,"form.field.effort":`Reasoning effort`,"form.field.effortTitle":`Set the model’s reasoning effort (e.g. low/medium/high); default = follow the model/provider default`,"form.effort.follow":`Follow model default`,"form.effort.low":`Low (low)`,"form.effort.medium":`Medium (medium)`,"form.effort.high":`High (high)`,"form.effort.none":`Off (none)`,"form.field.preset":`Execution preset`,"form.field.presetTitle":`The execution session is composed from this preset (tool set and persona); default = the deployment default preset`,"form.preset.follow":`Follow deployment default`,"form.preset.defaultTag":` (deployment default)`,"form.field.urgency":`Urgency`,"form.urgency.urgent":`Urgent`,"form.urgency.urgentHint":`Handle first`,"form.urgency.normal":`Normal`,"form.urgency.normalHint":`Normal scheduling`,"form.urgency.relaxed":`Relaxed`,"form.urgency.relaxedHint":`When there is time`,"form.field.description":`Description`,"form.field.descriptionOptional":`Description (optional)`,"form.desc.placeholder":`Requirement details, background, acceptance criteria…`,"form.field.prompt":`Execution prompt (the actual prompt = title + description + prompt)`,"form.field.promptOptional":`Execution prompt (optional; the actual prompt = title + description + prompt)`,"form.prompt.placeholder":`Extra instructions appended after "title + task description" and sent to the execution session. Template variables: {{lastExecution}} (last execution result), {{lastComments}} (latest 3 comments)`,"form.field.mode":`Execution mode`,"form.mode.claim":`🤝 Claim-based`,"form.mode.claimHint":`Sessions in the project claim it`,"form.mode.scheduled":`⏰ Scheduled`,"form.mode.scheduledHint":`Starts automatically on schedule`,"form.field.cron":`Cron expression`,"form.cron.placeholder":`min hour day month weekday`,"form.cron.daily":`Daily 09:00`,"form.cron.hourly":`Hourly`,"form.cron.every10min":`Every 10 minutes`,"form.cron.weekly":`Mondays 09:00`,"form.cron.next":`Next {time}`,"form.field.isolation":`Execution isolation`,"form.iso.locked":`The task has execution history; isolation is locked`,"form.iso.lockedShort":`Locked (cannot change once execution has started)`,"form.iso.nonGit":`This project is not a git repository`,"form.iso.worktree":`🌿 Worktree isolation`,"form.iso.worktreeTitle":`Each execution runs on its own worktree branch`,"form.iso.worktreeHint":`Isolated branch task/title+ID, no cross-contamination`,"form.iso.none":`📁 Run in the project directory`,"form.iso.noneTitle":`Run directly in the project directory (no git)`,"form.iso.noneHintNonGit":`Not a git repository; will run in the project directory`,"form.iso.noneHint":`No git; works directly in the project directory`,"form.iso.nonGitNote":`This project is not a git repository; the task will run in its directory (still created with the default configuration; the runtime degrades automatically)`,"form.iso.mirrorNote":`Multi-repo workspace: worktree isolation automatically mirrors all {n} repos — one task branch each, merged per repo at acceptance`,"form.field.checklist":`Acceptance checklist (DoD)`,"form.field.checklistOptional":`Acceptance checklist (DoD, optional)`,"form.check.itemPlaceholder":`Checklist item {n} (definition of done)`,"form.check.removeTitle":`Remove this checklist item`,"form.check.add":`+ Add checklist item`,"form.check.checkedTitle":`Checked state is preserved on save (currently checked by: {who})`,"form.check.notCheckedYet":`not checked yet`,"form.check.hintCreate":`{n} items; the execution session works through them and checks each off; unfinished items are highlighted at review`,"form.check.hintEdit":`{checked}/{total} checked (saving replaces the whole list; checked state is preserved)`,"form.hint.needTitle":`Enter a title`,"form.hint.needProject":`Select a project`,"form.hint.cronBad":`Invalid cron expression (min hour day month weekday)`,"form.hint.nextRun":`Next run {time}`,"form.hint.saveVersion":`On save: v{v} → v{next}`,"form.hint.createClaim":`After creation, sessions in the project can claim and run it`,"form.action.runBlockedTitle":`The task is running; cannot start another`,"form.action.runBusyTitle":`Submitting…`,"form.action.runTitle":`Save, then immediately start an execution (new session)`,"form.action.run":`⚡ Run now`,"form.action.save":`Save changes`,"form.action.create":`Create task`,"tpl.aria":`Manage templates`,"tpl.title":`Task templates`,"tpl.subtitle":`Templates from the New Task ▼ menu: rename / delete / use directly; "Save as template" in the task detail pane adds new ones`,"tpl.empty":`No templates yet — click "Save as template" in a task detail pane to capture a common configuration`,"tpl.name.aria":`Template name {name}`,"tpl.builtin":`Built-in`,"tpl.custom":`Custom`,"tpl.meta.checklist":` · {n} checklist items`,"tpl.rename.title":`Save rename`,"tpl.rename.button":`Rename`,"tpl.use.title":`Open the new-task form with this template`,"tpl.use.button":`Use`,"tpl.delete.title":`Delete this template`,"tpl.renamed":`Template renamed`,"tpl.foot.hint":`Templates are stored with the ledger in the DSH home directory and survive upgrades`,"imp.aria":`Import ledger`,"imp.title":`Import ledger`,"imp.subtitle":`Pick an exported JSON backup: preview first, then merge or replace everything`,"imp.parseError":`The file is not valid JSON`,"imp.note":`The ⬇ JSON export is a same-format backup and can be imported to restore; the file’s schemaVersion must match the current version.`,"imp.previewing":`Previewing…`,"imp.stat.create":`New`,"imp.stat.overwrite":`Overwrite (same id)`,"imp.stat.invalid":`Invalid (skipped)`,"imp.sec.create":`New tasks`,"imp.sec.overwrite":`Overwritten tasks (whole-card replacement, execution history and comments included)`,"imp.sec.invalid":`Invalid entries (not imported)`,"imp.noId":`(no id)`,"imp.mode.merge":`⊕ Merge`,"imp.mode.mergeHint":`Adds new + overwrites by id; everything else untouched`,"imp.mode.replace":`💣 Replace all`,"imp.mode.replaceHint":`Clears the current ledger and adopts the imported file (automatic backup first)`,"imp.result.replace":`Replace complete: imported {n} tasks ({total} former tasks backed up)`,"imp.result.merge":`Merge complete: {n} added, {m} overwritten`,"imp.foot.replaceConfirm":`⚠ Click again to confirm the full replacement (irreversible; a backup has been taken)`,"imp.foot.replaceNeedConfirm":`Full replacement requires a second confirmation`,"imp.foot.mergeHint":`Merge writes only the tasks listed in the preview`,"imp.action.run":`Import`,"imp.action.confirmReplace":`Confirm replace`,"set.aria":`Board settings`,"set.title":`Board settings`,"set.subtitle":`Global defaults for new tasks and session sync`,"set.iso.heading":`Default execution isolation`,"set.iso.noneHint":`No git; works directly in the project directory (factory default)`,"set.iso.worktreeHint":`Each execution runs on its own worktree branch (task/title+ID), isolated from the others; multi-repo workspaces are mirrored whole (one branch per repo)`,"set.iso.current":`Currently saved default: {current}. Affects only tasks created hereafter; existing tasks keep their creation-time choice, and non-git projects still degrade to the project directory at run time.`,"set.sync.heading":`Auto-sync workspace sessions`,"set.sync.off.name":`🚫 Sync off`,"set.sync.off.title":`Manage only tasks created and triggered in the task board`,"set.sync.off.hint":`Board tasks only (factory default)`,"set.sync.on.name":`🔄 Auto-include sessions`,"set.sync.on.title":`Sessions created directly in workspaces also appear on the board: In progress while running, In review automatically when done`,"set.sync.on.hint":`Tracks runs and enters review on completion`,"set.sync.stateOn":`On: sessions created and run directly in workspaces automatically become board cards and flow to the "In review" column when done.`,"set.sync.stateOff":`Off: only tasks created and triggered inside the board appear on the board.`,"set.foot.dirty":`Unsaved changes`,"set.foot.clean":`Matches the current board settings`,"set.action.save":`Save settings`,"form.field.permission":`Execution permission`,"form.perm.write":`Workspace write`,"form.perm.writeHint":`Read-write access to the workspace and temp directories (recommended default)`,"form.perm.readOnly":`Read-only`,"form.perm.readOnlyHint":`View and search only; no file changes or external commands`,"form.perm.fullAccess":`Full access`,"form.perm.fullAccessHint":`Unrestricted: whole-disk access and external commands`,"form.perm.defaultTag":` (default)`,"set.perm.heading":`Default execution permission`,"set.perm.writeName":`📁 Workspace write (factory default)`,"set.perm.writeHint":`Read-write access to the workspace and temp directories; writes need no extra confirmation`,"set.perm.readOnlyName":`🔒 Read-only`,"set.perm.readOnlyHint":`Read-only viewing and search only; no file changes or destructive commands`,"set.perm.fullName":`⚡ Full access`,"set.perm.fullHint":`Unrestricted: whole-disk access and external system commands`,"set.perm.current":`Currently saved default: {current}. The execution permission preset applied to new tasks.`,"card.badge.permReadOnly":`🔒 Read-only`,"card.badge.permReadOnlyTitle":`Permission: read-only`,"card.badge.permFull":`⚡ Full access`,"card.badge.permFullTitle":`Permission: full access`,"detail.chip.permReadOnly":`Read-only`,"detail.chip.permFull":`Full access`,"detail.chip.permWrite":`Workspace write`,"tpl.meta.permReadOnly":`read-only`,"tpl.meta.permFull":`full access`,"md.imageAlt":`Image {n}`,"md.imageTitle":`Click to view full size ({alt})`,"md.lightboxAlt":`Full-size preview`,"md.closePreview":`Close preview`,"slash.aria":`Quick commands and skills`,"slash.title":`Quick command and skill completion`,"slash.hint":`↑↓ navigate · Enter / Tab pick · Esc close`,"slash.badge.command":`⚡ command`,"slash.badge.skill":`🧩 skill`,"slash.tipA":`💡 Type`,"slash.tipB":`to autocomplete slash commands and agent skills`,"slash.cmd.goal.desc":`Autonomously drive long-horizon goals to completion`,"slash.cmd.goal.hint":`<goal description>`,"slash.cmd.schedule.desc":`Set one-off or recurring cron schedules`,"slash.cmd.schedule.hint":`<time or expression>`,"slash.cmd.plan.desc":`Draft a step-by-step plan and get user confirmation before acting`,"slash.cmd.browser.desc":`Launch a browser for page interaction and live search`,"slash.cmd.grill-me.desc":`Align requirements and design intent through one-question-at-a-time interviews`,"slash.cmd.teamwork-preview.desc":`Multi-agent collaboration and team workflow preview`,"slash.cmd.learn.desc":`Capture solutions and new rules into the knowledge base`,"slash.cmd.review.desc":`Multi-axis code review (correctness, architecture, security)`,"slash.cmd.security.desc":`Security hardening and vulnerability scanning`,"slash.cmd.permission.desc":`Switch the session permission level (read-only / workspace-write / full-access)`,"slash.cmd.permission.hint":`<preset>`,"slash.skill.frontend-ui-engineering":`Build production-grade, accessible frontend interfaces and components`,"slash.skill.api-and-interface-design":`Design stable, well-bounded REST / RPC interfaces`,"slash.skill.test-driven-development":`Test-driven development (TDD): unit and integration tests`,"slash.skill.debugging-and-error-recovery":`Systematically locate bug root causes and recover`,"slash.skill.performance-optimization":`Frontend/backend performance tuning and query optimization`,"slash.skill.ci-cd-and-automation":`Build automation, CI/CD pipelines and quality gates`,"slash.skill.code-review-and-quality":`Multi-axis code review and refactoring guidance`,"slash.skill.code-simplification":`Simplify complex logic for readability and maintainability`,"slash.skill.context-engineering":`Optimize context structure and prompt engineering`,"slash.skill.doubt-driven-development":`Adversarial, doubt-driven review of core logic`,"slash.skill.git-workflow-and-versioning":`Git workflow, branching, semantic versioning and changelogs`,"slash.skill.idea-refine":`Refine ideas and test hypotheses via divergent-convergent thinking`,"slash.skill.incremental-implementation":`Deliver multi-file changes in small, incremental steps`,"slash.skill.interview-me":`Deep interviews to surface true intent`,"slash.skill.memory-leak-debugging":`Diagnose JavaScript/Node.js memory leaks`,"slash.skill.observability-and-instrumentation":`Add logging, metrics and distributed tracing`,"slash.skill.planning-and-task-breakdown":`Break complex requirements into ordered, executable tasks`,"slash.skill.security-and-hardening":`Harden against vulnerabilities; input filtering and auth hardening`,"slash.skill.shipping-and-launch":`Pre-launch checklists and rollback strategies`,"slash.skill.source-driven-development":`Design from authoritative docs and source code`,"slash.skill.spec-driven-development":`Write clear technical specs before coding`,"slash.skill.using-agent-skills":`Discover and invoke agent skills dynamically`}};let C,w,T={active:j(),revision:0};const E=new Set;let D,O;function k(){O!==void 0&&(clearInterval(O),O=void 0);try{D?.disconnect()}catch{}D=void 0}function A(e){return e===`zh`||e===`en`}function j(){try{if(typeof document<`u`){let e=document.documentElement.lang;if(typeof e==`string`&&e.length>0){let t=e.toLowerCase();if(t.startsWith(`zh`))return`zh`;if(t.startsWith(`en`))return`en`}}}catch{}try{if(typeof navigator<`u`)return(navigator.language??`en`).toLowerCase().startsWith(`zh`)?`zh`:`en`}catch{}return`en`}function M(e){let t=e;if(!(t==null||typeof t.getSnapshot!=`function`||typeof t.subscribe!=`function`))return t}function N(e){k();try{typeof MutationObserver<`u`&&typeof document<`u`&&(D=new MutationObserver(()=>{if(C!==void 0)return;let e=j();e!==T.active&&P({active:e,revision:T.revision+1})}),D.observe(document.documentElement,{attributes:!0,attributeFilter:[`lang`]}))}catch{}if(e===void 0)return;let t=0;O=setInterval(()=>{t+=1;let n;try{n=M(e())}catch{n=void 0}if(n!==void 0){F(n);return}t>=8&&k()},250)}function P(e){if(!(e.active===T.active&&e.revision===T.revision)){T=e;for(let e of E)e()}}function F(e,t){let n=M(e);if(n===void 0){P({active:j(),revision:0}),N(t);return}k(),C=n;let r=()=>{try{let e=n.getSnapshot();P({active:A(e.active)?e.active:j(),revision:e.revision})}catch{}};r(),w=n.subscribe(r)}function ee(){k();try{w?.()}catch{}w=void 0,C=void 0,P({active:j(),revision:0})}const I={getSnapshot(){return T},subscribe(e){return E.add(e),()=>{E.delete(e)}}},te=/\{(\w+)\}/g,L=(e,t)=>{let n=S[T.active][e]??S.en[e]??e;return t===void 0?n:n.replace(te,(e,n)=>{let r=t[n];return r===void 0?e:String(r)})};function R(){return(0,e.useSyncExternalStore)(I.subscribe,I.getSnapshot),L}const ne=`dsh-taskboard-view-v1`;function z(){try{let e=localStorage.getItem(ne);if(e===null)return{urgencies:[],sortBy:`default`};let t=JSON.parse(e),n=t.sortBy===`updated`||t.sortBy===`urgency`||t.sortBy===`created`||t.sortBy===`title`?t.sortBy:`default`;return{workspaceId:typeof t.workspaceId==`string`?t.workspaceId:void 0,urgencies:Array.isArray(t.urgencies)?t.urgencies.filter(e=>e===`urgent`||e===`normal`||e===`relaxed`):[],sortBy:n}}catch{return{urgencies:[],sortBy:`default`}}}function re(){let e=z();return{boardOpen:!1,ledger:b(),workspaces:[],filters:{workspaceId:e.workspaceId,urgencies:e.urgencies},search:``,sortBy:e.sortBy,composerOpen:!1,secondaryOpen:!1,diagOpen:!1,templates:[],tplManagerOpen:!1,importOpen:!1,settingsOpen:!1}}var ie=class{client;state=re();subscribers=new Set;disposed=!1;disposeStream;refreshInFlight;seenRevision;sessionJumper;catalogFaces={};constructor(e){this.client=e}getSnapshot(){return this.state}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}emit(){if(!this.disposed)for(let e of this.subscribers)e()}setState(e){this.state={...this.state,...e},this.emit()}start(){this.refresh(),this.disposeStream=this.client.stream(e=>{this.seenRevision=e.revision,this.refresh()},()=>{this.refresh()})}async refresh(){return this.refreshInFlight===void 0&&(this.refreshInFlight=(async()=>{try{for(let e=0;e<3;e++){let[e,t]=await Promise.all([this.client.state(),this.client.workspaces()]),n;if(this.state.selectedId!==void 0&&(n=e.tasks.find(e=>e.id===this.state.selectedId)),this.setState({ledger:e,workspaces:t,error:void 0,selectedId:n===void 0?void 0:this.state.selectedId}),this.seenRevision===void 0||e.revision>=this.seenRevision)break}}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}finally{this.refreshInFlight=void 0}})()),this.refreshInFlight}dispose(){this.disposed=!0,this.disposeStream?.(),this.subscribers.clear()}openBoard(){this.setState({boardOpen:!0})}closeBoard(){this.setState({boardOpen:!1})}toggleBoard(){this.setState({boardOpen:!this.state.boardOpen})}setWorkspaceFilter(e){this.setState({filters:{...this.state.filters,workspaceId:e}}),this.persistView()}toggleUrgency(e){let t=new Set(this.state.filters.urgencies);t.has(e)?t.delete(e):t.add(e),this.setState({filters:{...this.state.filters,urgencies:[...t]}}),this.persistView()}setSearch(e){this.setState({search:e})}setSortBy(e){this.setState({sortBy:e}),this.persistView()}persistView(){try{localStorage.setItem(ne,JSON.stringify({workspaceId:this.state.filters.workspaceId,urgencies:this.state.filters.urgencies,sortBy:this.state.sortBy}))}catch{}}select(e){this.setState({selectedId:e})}setComposer(e){this.setState({composerOpen:e,editingId:void 0,templatePrefill:void 0})}newFromTemplate(e){this.setState({composerOpen:!0,editingId:void 0,templatePrefill:e})}openEditor(e){this.setState({composerOpen:!0,editingId:e,templatePrefill:void 0})}closeForm(){this.setState({composerOpen:!1,editingId:void 0,templatePrefill:void 0})}toggleSecondary(){this.setState({secondaryOpen:!this.state.secondaryOpen})}gitAvailable(e){return e===void 0||this.state.workspaces.find(t=>t.id===e)?.gitAvailable===!0}repoCount(e){return e===void 0?1:this.state.workspaces.find(t=>t.id===e)?.repoCount??1}installSessionJumper(e){this.sessionJumper=e}installModelCatalog(e){this.catalogFaces.models=e}installPresetRoster(e){this.catalogFaces.presets=e}get modelCatalog(){return this.catalogFaces.models}get presetCatalog(){return this.catalogFaces.presets}async fetchModelCatalog(){if(this.catalogFaces.models!==void 0)try{let e=await this.catalogFaces.models();if(e!==void 0&&e.length>0)return e}catch{}try{return(await this.client.modelCatalog()).models??[]}catch{return[]}}async fetchPresetCatalog(){if(this.catalogFaces.presets!==void 0)try{let e=await this.catalogFaces.presets();if(e!==void 0&&e.presets!==void 0&&e.presets.length>0)return e}catch{}try{let e=await this.client.modelCatalog();return{presets:e.presets??[],...e.defaultPresetId===void 0?{}:{defaultId:e.defaultPresetId}}}catch{return{presets:[]}}}async openSession(e){if(this.sessionJumper===void 0)return`unavailable`;let t;try{t=await this.sessionJumper(e)}catch{return`unavailable`}return t===`opened`&&this.closeBoard(),t}async create(e){try{let t=await this.client.create(e);return this.setState({composerOpen:!1,error:void 0}),await this.refresh(),t.id}catch(e){this.setState({error:e instanceof Error?e.message:String(e)});return}}async update(e,t,n){try{return await this.client.update(e,{ifVersion:t,...n}),this.setState({composerOpen:!1,editingId:void 0,error:void 0}),await this.refresh(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async move(e,t,n){try{await this.client.move(e,{ifVersion:t,status:n}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async reject(e,t,n){let r=n!==void 0&&n.trim().length>0?n.trim():void 0;try{return await this.client.reject(e,r===void 0?{ifVersion:t}:{ifVersion:t,body:r}),await this.refresh(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async toggleBlocked(e){try{await this.client.update(e.id,{ifVersion:e.version,blocked:!e.blocked}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async toggleChecklistItem(e,t){let n=(e.checklist??[]).map(e=>e.id===t?e.checked?{id:e.id,text:e.text,checked:!1}:{id:e.id,text:e.text,checked:!0,checkedBy:`user`,checkedAt:Date.now(),...e.note===void 0?{}:{note:e.note}}:e);try{await this.client.update(e.id,{ifVersion:e.version,checklist:n}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async fetchDiff(e,t){try{return await this.client.diff(e,t)}catch(e){this.setState({error:e instanceof Error?e.message:String(e)});return}}async comment(e,t){try{return await this.client.comment(e,t),await this.refresh(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async run(e,t=!1){try{await this.client.run(e,t?{reuse:!0}:{}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async cancel(e){try{await this.client.cancel(e),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async mergeBranch(e){try{let t=await this.client.mergeBranch(e);return await this.refresh(),t.noop===!0?{ok:!0,noop:!0}:t.results===void 0?{ok:!0}:{ok:!0,results:t.results}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async removeWorktree(e,t){try{let n=await this.client.worktreeRemove(e,{deleteBranch:t});return await this.refresh(),n.branchError===void 0?{ok:!0}:{ok:!0,branchError:n.branchError}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}openDiagnostics(){this.setState({diagOpen:!0}),this.client.diagnostics().then(e=>this.setState({diagnostics:e})).catch(e=>this.setState({error:e instanceof Error?e.message:String(e)}))}closeDiagnostics(){this.setState({diagOpen:!1})}openSettings(){this.setState({settingsOpen:!0})}closeSettings(){this.setState({settingsOpen:!1})}async updateSettings(e){try{return await this.client.updateSettings(e),await this.refresh(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async cleanupOrphan(e,t){try{await this.client.worktreeCleanup(e,t);let n=await this.client.diagnostics();this.setState({diagnostics:n,error:void 0})}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async remove(e,t,n){try{await this.client.remove(e,n?{purge:!0}:{ifVersion:t}),n&&this.setState({selectedId:void 0}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async duplicate(e){try{await this.client.create({title:e.title.slice(0,196)+L(`shared.duplicate.suffix`),workspaceId:e.workspaceId,urgency:e.urgency,description:e.description.length>0?e.description:void 0,prompt:e.prompt.length>0?e.prompt:void 0,execution:e.execution.mode===`scheduled`&&e.execution.cron!==void 0?{mode:`scheduled`,cron:e.execution.cron}:{mode:`claim`},model:e.model,isolation:e.isolation,...e.presetId===void 0?{}:{presetId:e.presetId},...e.permission===void 0?{}:{permission:e.permission},...e.checklist!==void 0&&e.checklist.length>0?{checklist:e.checklist.map(e=>e.text)}:{}}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async loadTemplates(){try{let e=await this.client.templates();return this.setState({templates:e.templates,error:void 0}),e.templates}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),[]}}prepareTemplateMenu(){this.state.templates.length===0&&this.loadTemplates()}openTemplateManager(){this.setState({tplManagerOpen:!0}),this.loadTemplates()}closeTemplateManager(){this.setState({tplManagerOpen:!1})}async upsertTemplate(e){try{return await this.client.templateUpsert(e),await this.loadTemplates(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async deleteTemplate(e){try{await this.client.templateDelete(e),await this.loadTemplates()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async saveAsTemplate(e){return this.upsertTemplate({name:e.title.slice(0,60),task:{title:e.title,description:e.description.length>0?e.description:void 0,prompt:e.prompt.length>0?e.prompt:void 0,urgency:e.urgency,execution:e.execution.mode===`scheduled`&&e.execution.cron!==void 0?{mode:`scheduled`,cron:e.execution.cron}:{mode:`claim`},model:e.model,isolation:e.isolation,...e.presetId===void 0?{}:{presetId:e.presetId},...e.permission===void 0?{}:{permission:e.permission},...e.checklist!==void 0&&e.checklist.length>0?{checklist:e.checklist.map(e=>e.text)}:{}}})}async fetchPromptCompletions(){try{return await this.client.promptCompletions()}catch{return}}openImport(){this.setState({importOpen:!0})}closeImport(){this.setState({importOpen:!1})}async importPreview(e){try{return(await this.client.importPreview(e)).plan}catch(e){this.setState({error:e instanceof Error?e.message:String(e)});return}}async importCommit(e,t){try{let n=await this.client.importCommit(e,t);return await this.refresh(),n}catch(e){this.setState({error:e instanceof Error?e.message:String(e)});return}}exportJson(){let e=new Date,t=e=>String(e).padStart(2,`0`),n=`dsh-taskboard-${e.getFullYear()}${t(e.getMonth()+1)}${t(e.getDate())}-${t(e.getHours())}${t(e.getMinutes())}.json`,r=JSON.stringify(this.state.ledger,null,2);this.download(n,r,`application/json`)}exportCsv(){let e=e=>{let t=String(e??``);return/^[=+\-@\t\r]/.test(t)&&(t=`'${t}`),/[",\n\r]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t},t=[`id`,`title`,`status`,`urgency`,`blocked`,`project`,`claimedBy`,`mode`,`cron`,`nextRunAt`,`model`,`createdAt`,`updatedAt`,`comments`,`executions`],n=this.state.ledger.tasks.map(t=>[t.id,t.title,t.status,t.urgency,t.blocked?`yes`:`no`,t.workspaceId,t.claimedBy??``,t.execution.mode,t.execution.cron??``,t.execution.nextRunAt===void 0?``:new Date(t.execution.nextRunAt).toISOString(),t.model===void 0?``:`${t.model.provider}/${t.model.model}`,new Date(t.createdAt).toISOString(),new Date(t.updatedAt).toISOString(),t.comments.length,t.executions.length].map(e).join(`,`)),r=new Date,i=e=>String(e).padStart(2,`0`),a=`dsh-taskboard-${r.getFullYear()}${i(r.getMonth()+1)}${i(r.getDate())}.csv`;this.download(a,`\uFEFF${[t.join(`,`),...n].join(`\r
10
- `)}`,`text/csv`)}download(e,t,n){try{let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),setTimeout(()=>URL.revokeObjectURL(i),5e3)}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}};const ae=`dsh-taskboard-styles`;function oe(){if(typeof document>`u`)return;let e=document.getElementById(ae);e===null&&(e=document.createElement(`style`),e.id=ae,e.textContent=`
9
+ {error}`,"iso.repo.root":`Root repo`,"iso.remove.wt":`🗑 Remove worktree`,"iso.remove.wtTitle":`git worktree remove (refused when uncommitted changes exist)`,"iso.remove.wtb":`🗑 Remove worktree + branch`,"iso.remove.wtbTitle":`Remove the worktree and delete the task branch (refused when uncommitted changes exist)`,"iso.remove.confirmWt":`Remove the worktree directory?`,"iso.remove.confirmWtb":`Remove the worktree and delete the branch?`,"iso.remove.failed":`Removal failed: {error}`,"iso.remove.branchFailed":`Worktree removed, but branch deletion failed: {error}`,"iso.hint.keep":`Branch and worktree kept — send back to continue editing`,"detail.session.jumpTitle":`Jump to the corresponding session: {id}`,"detail.session.jump":`🤖 Jump to session ↗`,"detail.action.edit":`✎ Edit`,"detail.action.duplicateTitle":`Duplicate this task’s full configuration as a new card (todo column)`,"detail.action.duplicate":`⧉ Duplicate`,"detail.action.saveTplTitle":`Save this task’s configuration (checklist included) as a template for new tasks`,"detail.action.saveTplDone":`Saved as a template (available in the New Task ▼ menu; rename it in template management)`,"detail.action.saveTpl":`⌗ Save as template`,"detail.action.reuseTitle":`Reuse-run: keep the existing worktree and branch (last run’s changes and commits stay in place) and continue on top of them; the default "Run" resets to a fresh baseline`,"detail.action.reuse":`↻ Reuse-run`,"detail.action.runTitleModel":`Run in a new session ({model})`,"detail.action.runTitleDefault":`Run in a new session (default model)`,"detail.action.run":`▶ Run`,"detail.action.stopConfirm":`Stop this execution session?`,"detail.action.stop":`Stop`,"detail.action.stopTitle":`Stop execution session {id} (the task returns to todo)`,"detail.action.stopExec":`■ Stop execution`,"detail.chip.nextRun":`{cron} · next {time}`,"detail.chip.checklist":`Checklist {done}/{total}`,"detail.chip.isolated":`Worktree isolation`,"detail.chip.holderTitle":`Click to jump to the session: {id}`,"detail.chip.holderStale":`Claim stale · `,"detail.chip.holderBy":`Held by `,"detail.chip.holderSuffix":` ↗`,"detail.chip.trashed":`Deleted, pending purge`,"detail.sub.line":`Updated {time} · last change by {who}`,"detail.updatedBy.system":`⚙️ System`,"detail.updatedBy.user":`👤 User`,"detail.field.description":`Description`,"detail.field.prompt":`Execution prompt`,"detail.move.to":`Move to → {status}`,"detail.move.confirmDoneUnchecked":`{n} checklist items are still unchecked — confirm done?`,"detail.move.confirmDone":`Confirm done?`,"detail.move.confirm":`Confirm`,"detail.blocked.unmark":`✓ Unblock`,"detail.blocked.mark":`⛔ Mark blocked`,"detail.release.title":`Release {id}’s claim: the task returns to todo (the holding session may still be working — make sure it has stopped first)`,"detail.release.button":`🔓 Release claim`,"detail.comments.title":`Comments`,"detail.comments.empty":`No comments yet — the agent reports changes and verification here at handoff`,"detail.comments.user":`User`,"detail.composer.placeholder":`Leave a comment as the user (the agent reads it before starting)…`,"detail.composer.send":`Post`,"detail.exec.title":`Executions`,"detail.exec.prunedTitle":`{n} older execution records were pruned at the retention cap`,"detail.exec.pruned":`+{n} pruned`,"detail.exec.trigger.manual":`Manual`,"detail.exec.trigger.scheduled":`Scheduled`,"detail.exec.openTitle":`Click to open the execution session: {id}`,"detail.danger.delete":`🗑 Delete (mark for purge)`,"detail.danger.purgeConfirm":`Physical purge is irreversible`,"detail.danger.purgeGo":`Purge`,"detail.danger.purge":`🔥 Purge physically (confirm required)`,"form.title.create":`New task`,"form.title.edit":`Edit task`,"form.subtitle.create":`Push onto the board; sessions in the project can claim and run it`,"form.subtitle.edit":`Adjust the task content and execution configuration`,"form.field.title":`Title`,"form.field.titlePlaceholder":`One line: what should be done`,"form.field.project":`Project`,"form.field.model":`Model (default = session default model)`,"form.field.modelDefault":`Default model`,"form.model.option":`{name} ({provider})`,"form.field.effort":`Reasoning effort`,"form.field.effortTitle":`Set the model’s reasoning effort (e.g. low/medium/high); default = follow the model/provider default`,"form.effort.follow":`Follow model default`,"form.effort.low":`Low (low)`,"form.effort.medium":`Medium (medium)`,"form.effort.high":`High (high)`,"form.effort.none":`Off (none)`,"form.field.preset":`Execution preset`,"form.field.presetTitle":`The execution session is composed from this preset (tool set and persona); default = the deployment default preset`,"form.preset.follow":`Follow deployment default`,"form.preset.defaultTag":` (deployment default)`,"form.field.urgency":`Urgency`,"form.urgency.urgent":`Urgent`,"form.urgency.urgentHint":`Handle first`,"form.urgency.normal":`Normal`,"form.urgency.normalHint":`Normal scheduling`,"form.urgency.relaxed":`Relaxed`,"form.urgency.relaxedHint":`When there is time`,"form.field.description":`Description`,"form.field.descriptionOptional":`Description (optional)`,"form.desc.placeholder":`Requirement details, background, acceptance criteria…`,"form.field.prompt":`Execution prompt (the actual prompt = title + description + prompt)`,"form.field.promptOptional":`Execution prompt (optional; the actual prompt = title + description + prompt)`,"form.prompt.placeholder":`Extra instructions appended after "title + task description" and sent to the execution session. Template variables: {{lastExecution}} (last execution result), {{lastComments}} (latest 3 comments)`,"form.field.mode":`Execution mode`,"form.mode.claim":`🤝 Claim-based`,"form.mode.claimHint":`Sessions in the project claim it`,"form.mode.scheduled":`⏰ Scheduled`,"form.mode.scheduledHint":`Starts automatically on schedule`,"form.field.cron":`Cron expression`,"form.cron.placeholder":`min hour day month weekday`,"form.cron.daily":`Daily 09:00`,"form.cron.hourly":`Hourly`,"form.cron.every10min":`Every 10 minutes`,"form.cron.weekly":`Mondays 09:00`,"form.cron.next":`Next {time}`,"form.field.isolation":`Execution isolation`,"form.iso.locked":`The task has execution history; isolation is locked`,"form.iso.lockedShort":`Locked (cannot change once execution has started)`,"form.iso.nonGit":`This project is not a git repository`,"form.iso.worktree":`🌿 Worktree isolation`,"form.iso.worktreeTitle":`Each execution runs on its own worktree branch`,"form.iso.worktreeHint":`Isolated branch task/title+ID, no cross-contamination`,"form.iso.none":`📁 Run in the project directory`,"form.iso.noneTitle":`Run directly in the project directory (no git)`,"form.iso.noneHintNonGit":`Not a git repository; will run in the project directory`,"form.iso.noneHint":`No git; works directly in the project directory`,"form.iso.nonGitNote":`This project is not a git repository; the task will run in its directory (still created with the default configuration; the runtime degrades automatically)`,"form.iso.mirrorNote":`Multi-repo workspace: worktree isolation automatically mirrors all {n} repos — one task branch each, merged per repo at acceptance`,"form.field.checklist":`Acceptance checklist (DoD)`,"form.field.checklistOptional":`Acceptance checklist (DoD, optional)`,"form.check.itemPlaceholder":`Checklist item {n} (definition of done)`,"form.check.removeTitle":`Remove this checklist item`,"form.check.add":`+ Add checklist item`,"form.check.checkedTitle":`Checked state is preserved on save (currently checked by: {who})`,"form.check.notCheckedYet":`not checked yet`,"form.check.hintCreate":`{n} items; the execution session works through them and checks each off; unfinished items are highlighted at review`,"form.check.hintEdit":`{checked}/{total} checked (saving replaces the whole list; checked state is preserved)`,"form.hint.needTitle":`Enter a title`,"form.hint.needProject":`Select a project`,"form.hint.cronBad":`Invalid cron expression (min hour day month weekday)`,"form.hint.nextRun":`Next run {time}`,"form.hint.saveVersion":`On save: v{v} → v{next}`,"form.hint.createClaim":`After creation, sessions in the project can claim and run it`,"form.action.runBlockedTitle":`The task is running; cannot start another`,"form.action.runBusyTitle":`Submitting…`,"form.action.runTitle":`Save, then immediately start an execution (new session)`,"form.action.run":`⚡ Run now`,"form.action.save":`Save changes`,"form.action.create":`Create task`,"tpl.aria":`Manage templates`,"tpl.title":`Task templates`,"tpl.subtitle":`Templates from the New Task ▼ menu: rename / delete / use directly; "Save as template" in the task detail pane adds new ones`,"tpl.empty":`No templates yet — click "Save as template" in a task detail pane to capture a common configuration`,"tpl.name.aria":`Template name {name}`,"tpl.builtin":`Built-in`,"tpl.custom":`Custom`,"tpl.meta.checklist":` · {n} checklist items`,"tpl.rename.title":`Save rename`,"tpl.rename.button":`Rename`,"tpl.use.title":`Open the new-task form with this template`,"tpl.use.button":`Use`,"tpl.delete.title":`Delete this template`,"tpl.renamed":`Template renamed`,"tpl.foot.hint":`Templates are stored with the ledger in the DSH home directory and survive upgrades`,"imp.aria":`Import ledger`,"imp.title":`Import ledger`,"imp.subtitle":`Pick an exported JSON backup: preview first, then merge or replace everything`,"imp.parseError":`The file is not valid JSON`,"imp.note":`The ⬇ JSON export is a same-format backup and can be imported to restore; the file’s schemaVersion must match the current version.`,"imp.previewing":`Previewing…`,"imp.stat.create":`New`,"imp.stat.overwrite":`Overwrite (same id)`,"imp.stat.invalid":`Invalid (skipped)`,"imp.sec.create":`New tasks`,"imp.sec.overwrite":`Overwritten tasks (whole-card replacement, execution history and comments included)`,"imp.sec.invalid":`Invalid entries (not imported)`,"imp.noId":`(no id)`,"imp.mode.merge":`⊕ Merge`,"imp.mode.mergeHint":`Adds new + overwrites by id; everything else untouched`,"imp.mode.replace":`💣 Replace all`,"imp.mode.replaceHint":`Clears the current ledger and adopts the imported file (automatic backup first)`,"imp.result.replace":`Replace complete: imported {n} tasks ({total} former tasks backed up)`,"imp.result.merge":`Merge complete: {n} added, {m} overwritten`,"imp.foot.replaceConfirm":`⚠ Click again to confirm the full replacement (irreversible; a backup has been taken)`,"imp.foot.replaceNeedConfirm":`Full replacement requires a second confirmation`,"imp.foot.mergeHint":`Merge writes only the tasks listed in the preview`,"imp.action.run":`Import`,"imp.action.confirmReplace":`Confirm replace`,"set.aria":`Board settings`,"set.title":`Board settings`,"set.subtitle":`Global defaults for new tasks and session sync`,"set.iso.heading":`Default execution isolation`,"set.iso.noneHint":`No git; works directly in the project directory (factory default)`,"set.iso.worktreeHint":`Each execution runs on its own worktree branch (task/title+ID), isolated from the others; multi-repo workspaces are mirrored whole (one branch per repo)`,"set.iso.current":`Currently saved default: {current}. Affects only tasks created hereafter; existing tasks keep their creation-time choice, and non-git projects still degrade to the project directory at run time.`,"set.sync.heading":`Auto-sync workspace sessions`,"set.sync.off.name":`🚫 Sync off`,"set.sync.off.title":`Manage only tasks created and triggered in the task board`,"set.sync.off.hint":`Board tasks only (factory default)`,"set.sync.on.name":`🔄 Auto-include sessions`,"set.sync.on.title":`Sessions created directly in workspaces also appear on the board: In progress while running, In review automatically when done`,"set.sync.on.hint":`Tracks runs and enters review on completion`,"set.sync.stateOn":`On: sessions created and run directly in workspaces automatically become board cards and flow to the "In review" column when done.`,"set.sync.stateOff":`Off: only tasks created and triggered inside the board appear on the board.`,"set.foot.dirty":`Unsaved changes`,"set.foot.clean":`Matches the current board settings`,"set.action.save":`Save settings`,"form.field.permission":`Execution permission`,"form.perm.write":`Workspace write`,"form.perm.writeHint":`Read-write access to the workspace and temp directories (recommended default)`,"form.perm.readOnly":`Read-only`,"form.perm.readOnlyHint":`View and search only; no file changes or external commands`,"form.perm.fullAccess":`Full access`,"form.perm.fullAccessHint":`Unrestricted: whole-disk access and external commands`,"form.perm.defaultTag":` (default)`,"set.perm.heading":`Default execution permission`,"set.perm.writeName":`📁 Workspace write (factory default)`,"set.perm.writeHint":`Read-write access to the workspace and temp directories; writes need no extra confirmation`,"set.perm.readOnlyName":`🔒 Read-only`,"set.perm.readOnlyHint":`Read-only viewing and search only; no file changes or destructive commands`,"set.perm.fullName":`⚡ Full access`,"set.perm.fullHint":`Unrestricted: whole-disk access and external system commands`,"set.perm.current":`Currently saved default: {current}. The execution permission preset applied to new tasks.`,"card.badge.permReadOnly":`🔒 Read-only`,"card.badge.permReadOnlyTitle":`Permission: read-only`,"card.badge.permFull":`⚡ Full access`,"card.badge.permFullTitle":`Permission: full access`,"detail.chip.permReadOnly":`Read-only`,"detail.chip.permFull":`Full access`,"detail.chip.permWrite":`Workspace write`,"tpl.meta.permReadOnly":`read-only`,"tpl.meta.permFull":`full access`,"md.imageAlt":`Image {n}`,"md.imageTitle":`Click to view full size ({alt})`,"md.lightboxAlt":`Full-size preview`,"md.closePreview":`Close preview`,"slash.aria":`Quick commands and skills`,"slash.title":`Quick command and skill completion`,"slash.hint":`↑↓ navigate · Enter / Tab pick · Esc close`,"slash.badge.command":`⚡ command`,"slash.badge.skill":`🧩 skill`,"slash.tipA":`💡 Type`,"slash.tipB":`to autocomplete slash commands and agent skills`,"slash.cmd.goal.desc":`Autonomously drive long-horizon goals to completion`,"slash.cmd.goal.hint":`<goal description>`,"slash.cmd.schedule.desc":`Set one-off or recurring cron schedules`,"slash.cmd.schedule.hint":`<time or expression>`,"slash.cmd.plan.desc":`Draft a step-by-step plan and get user confirmation before acting`,"slash.cmd.browser.desc":`Launch a browser for page interaction and live search`,"slash.cmd.grill-me.desc":`Align requirements and design intent through one-question-at-a-time interviews`,"slash.cmd.teamwork-preview.desc":`Multi-agent collaboration and team workflow preview`,"slash.cmd.learn.desc":`Capture solutions and new rules into the knowledge base`,"slash.cmd.review.desc":`Multi-axis code review (correctness, architecture, security)`,"slash.cmd.security.desc":`Security hardening and vulnerability scanning`,"slash.cmd.permission.desc":`Switch the session permission level (read-only / workspace-write / full-access)`,"slash.cmd.permission.hint":`<preset>`,"slash.skill.frontend-ui-engineering":`Build production-grade, accessible frontend interfaces and components`,"slash.skill.api-and-interface-design":`Design stable, well-bounded REST / RPC interfaces`,"slash.skill.test-driven-development":`Test-driven development (TDD): unit and integration tests`,"slash.skill.debugging-and-error-recovery":`Systematically locate bug root causes and recover`,"slash.skill.performance-optimization":`Frontend/backend performance tuning and query optimization`,"slash.skill.ci-cd-and-automation":`Build automation, CI/CD pipelines and quality gates`,"slash.skill.code-review-and-quality":`Multi-axis code review and refactoring guidance`,"slash.skill.code-simplification":`Simplify complex logic for readability and maintainability`,"slash.skill.context-engineering":`Optimize context structure and prompt engineering`,"slash.skill.doubt-driven-development":`Adversarial, doubt-driven review of core logic`,"slash.skill.git-workflow-and-versioning":`Git workflow, branching, semantic versioning and changelogs`,"slash.skill.idea-refine":`Refine ideas and test hypotheses via divergent-convergent thinking`,"slash.skill.incremental-implementation":`Deliver multi-file changes in small, incremental steps`,"slash.skill.interview-me":`Deep interviews to surface true intent`,"slash.skill.memory-leak-debugging":`Diagnose JavaScript/Node.js memory leaks`,"slash.skill.observability-and-instrumentation":`Add logging, metrics and distributed tracing`,"slash.skill.planning-and-task-breakdown":`Break complex requirements into ordered, executable tasks`,"slash.skill.security-and-hardening":`Harden against vulnerabilities; input filtering and auth hardening`,"slash.skill.shipping-and-launch":`Pre-launch checklists and rollback strategies`,"slash.skill.source-driven-development":`Design from authoritative docs and source code`,"slash.skill.spec-driven-development":`Write clear technical specs before coding`,"slash.skill.using-agent-skills":`Discover and invoke agent skills dynamically`}};let C,w,T={active:j(),revision:0};const E=new Set;let D,O;function k(){O!==void 0&&(clearInterval(O),O=void 0);try{D?.disconnect()}catch{}D=void 0}function A(e){return e===`zh`||e===`en`}function j(){try{if(typeof document<`u`){let e=document.documentElement.lang;if(typeof e==`string`&&e.length>0){let t=e.toLowerCase();if(t.startsWith(`zh`))return`zh`;if(t.startsWith(`en`))return`en`}}}catch{}try{if(typeof navigator<`u`)return(navigator.language??`en`).toLowerCase().startsWith(`zh`)?`zh`:`en`}catch{}return`en`}function M(e){let t=e;if(!(t==null||typeof t.getSnapshot!=`function`||typeof t.subscribe!=`function`))return t}function N(e){k();try{typeof MutationObserver<`u`&&typeof document<`u`&&(D=new MutationObserver(()=>{if(C!==void 0)return;let e=j();e!==T.active&&P({active:e,revision:T.revision+1})}),D.observe(document.documentElement,{attributes:!0,attributeFilter:[`lang`]}))}catch{}if(e===void 0)return;let t=0;O=setInterval(()=>{t+=1;let n;try{n=M(e())}catch{n=void 0}if(n!==void 0){ee(n);return}t>=8&&k()},250)}function P(e){if(!(e.active===T.active&&e.revision===T.revision)){T=e;for(let e of E)e()}}function ee(e,t){let n=M(e);if(n===void 0){P({active:j(),revision:0}),N(t);return}k(),C=n;let r=()=>{try{let e=n.getSnapshot();P({active:A(e.active)?e.active:j(),revision:e.revision})}catch{}};r(),w=n.subscribe(r)}function te(){k();try{w?.()}catch{}w=void 0,C=void 0,P({active:j(),revision:0})}const F={getSnapshot(){return T},subscribe(e){return E.add(e),()=>{E.delete(e)}}},ne=/\{(\w+)\}/g,I=(e,t)=>{let n=S[T.active][e]??S.en[e]??e;return t===void 0?n:n.replace(ne,(e,n)=>{let r=t[n];return r===void 0?e:String(r)})};function L(){return(0,e.useSyncExternalStore)(F.subscribe,F.getSnapshot),I}const re=`dsh-taskboard-view-v1`;function R(){try{let e=localStorage.getItem(re);if(e===null)return{urgencies:[],sortBy:`default`};let t=JSON.parse(e),n=t.sortBy===`updated`||t.sortBy===`urgency`||t.sortBy===`created`||t.sortBy===`title`?t.sortBy:`default`;return{workspaceId:typeof t.workspaceId==`string`?t.workspaceId:void 0,urgencies:Array.isArray(t.urgencies)?t.urgencies.filter(e=>e===`urgent`||e===`normal`||e===`relaxed`):[],sortBy:n}}catch{return{urgencies:[],sortBy:`default`}}}function ie(){let e=R();return{boardOpen:!1,ledger:b(),workspaces:[],filters:{workspaceId:e.workspaceId,urgencies:e.urgencies},search:``,sortBy:e.sortBy,composerOpen:!1,secondaryOpen:!1,diagOpen:!1,templates:[],tplManagerOpen:!1,importOpen:!1,settingsOpen:!1}}var ae=class{client;state=ie();subscribers=new Set;disposed=!1;disposeStream;refreshInFlight;seenRevision;sessionJumper;catalogFaces={};constructor(e){this.client=e}getSnapshot(){return this.state}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}emit(){if(!this.disposed)for(let e of this.subscribers)e()}setState(e){this.state={...this.state,...e},this.emit()}start(){this.refresh(),this.disposeStream=this.client.stream(e=>{this.seenRevision=e.revision,this.refresh()},()=>{this.refresh()})}async refresh(){return this.refreshInFlight===void 0&&(this.refreshInFlight=(async()=>{try{for(let e=0;e<3;e++){let[e,t]=await Promise.all([this.client.state(),this.client.workspaces()]),n;if(this.state.selectedId!==void 0&&(n=e.tasks.find(e=>e.id===this.state.selectedId)),this.setState({ledger:e,workspaces:t,error:void 0,selectedId:n===void 0?void 0:this.state.selectedId}),this.seenRevision===void 0||e.revision>=this.seenRevision)break}}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}finally{this.refreshInFlight=void 0}})()),this.refreshInFlight}dispose(){this.disposed=!0,this.disposeStream?.(),this.subscribers.clear()}openBoard(){this.setState({boardOpen:!0})}closeBoard(){this.setState({boardOpen:!1})}toggleBoard(){this.setState({boardOpen:!this.state.boardOpen})}setWorkspaceFilter(e){this.setState({filters:{...this.state.filters,workspaceId:e}}),this.persistView()}toggleUrgency(e){let t=new Set(this.state.filters.urgencies);t.has(e)?t.delete(e):t.add(e),this.setState({filters:{...this.state.filters,urgencies:[...t]}}),this.persistView()}setSearch(e){this.setState({search:e})}setSortBy(e){this.setState({sortBy:e}),this.persistView()}persistView(){try{localStorage.setItem(re,JSON.stringify({workspaceId:this.state.filters.workspaceId,urgencies:this.state.filters.urgencies,sortBy:this.state.sortBy}))}catch{}}select(e){this.setState({selectedId:e})}setComposer(e){this.setState({composerOpen:e,editingId:void 0,templatePrefill:void 0})}newFromTemplate(e){this.setState({composerOpen:!0,editingId:void 0,templatePrefill:e})}openEditor(e){this.setState({composerOpen:!0,editingId:e,templatePrefill:void 0})}closeForm(){this.setState({composerOpen:!1,editingId:void 0,templatePrefill:void 0})}toggleSecondary(){this.setState({secondaryOpen:!this.state.secondaryOpen})}gitAvailable(e){return e===void 0||this.state.workspaces.find(t=>t.id===e)?.gitAvailable===!0}repoCount(e){return e===void 0?1:this.state.workspaces.find(t=>t.id===e)?.repoCount??1}installSessionJumper(e){this.sessionJumper=e}installModelCatalog(e){this.catalogFaces.models=e}installPresetRoster(e){this.catalogFaces.presets=e}get modelCatalog(){return this.catalogFaces.models}get presetCatalog(){return this.catalogFaces.presets}async fetchModelCatalog(){if(this.catalogFaces.models!==void 0)try{let e=await this.catalogFaces.models();if(e!==void 0&&e.length>0)return e}catch{}try{return(await this.client.modelCatalog()).models??[]}catch{return[]}}async fetchPresetCatalog(){if(this.catalogFaces.presets!==void 0)try{let e=await this.catalogFaces.presets();if(e!==void 0&&e.presets!==void 0&&e.presets.length>0)return e}catch{}try{let e=await this.client.modelCatalog();return{presets:e.presets??[],...e.defaultPresetId===void 0?{}:{defaultId:e.defaultPresetId}}}catch{return{presets:[]}}}async openSession(e){if(this.sessionJumper===void 0)return`unavailable`;let t;try{t=await this.sessionJumper(e)}catch{return`unavailable`}return t===`opened`&&this.closeBoard(),t}async create(e){try{let t=await this.client.create(e);return this.setState({composerOpen:!1,error:void 0}),await this.refresh(),t.id}catch(e){this.setState({error:e instanceof Error?e.message:String(e)});return}}async update(e,t,n){try{return await this.client.update(e,{ifVersion:t,...n}),this.setState({composerOpen:!1,editingId:void 0,error:void 0}),await this.refresh(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async move(e,t,n){try{await this.client.move(e,{ifVersion:t,status:n}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async reject(e,t,n){let r=n!==void 0&&n.trim().length>0?n.trim():void 0;try{return await this.client.reject(e,r===void 0?{ifVersion:t}:{ifVersion:t,body:r}),await this.refresh(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async toggleBlocked(e){try{await this.client.update(e.id,{ifVersion:e.version,blocked:!e.blocked}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async toggleChecklistItem(e,t){let n=(e.checklist??[]).map(e=>e.id===t?e.checked?{id:e.id,text:e.text,checked:!1}:{id:e.id,text:e.text,checked:!0,checkedBy:`user`,checkedAt:Date.now(),...e.note===void 0?{}:{note:e.note}}:e);try{await this.client.update(e.id,{ifVersion:e.version,checklist:n}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async fetchDiff(e,t){try{return await this.client.diff(e,t)}catch(e){this.setState({error:e instanceof Error?e.message:String(e)});return}}async comment(e,t){try{return await this.client.comment(e,t),await this.refresh(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async run(e,t=!1){try{await this.client.run(e,t?{reuse:!0}:{}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async cancel(e){try{await this.client.cancel(e),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async mergeBranch(e){try{let t=await this.client.mergeBranch(e);return await this.refresh(),t.noop===!0?{ok:!0,noop:!0}:t.results===void 0?{ok:!0}:{ok:!0,results:t.results}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async removeWorktree(e,t){try{let n=await this.client.worktreeRemove(e,{deleteBranch:t});return await this.refresh(),n.branchError===void 0?{ok:!0}:{ok:!0,branchError:n.branchError}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}openDiagnostics(){this.setState({diagOpen:!0}),this.client.diagnostics().then(e=>this.setState({diagnostics:e})).catch(e=>this.setState({error:e instanceof Error?e.message:String(e)}))}closeDiagnostics(){this.setState({diagOpen:!1})}openSettings(){this.setState({settingsOpen:!0})}closeSettings(){this.setState({settingsOpen:!1})}async updateSettings(e){try{return await this.client.updateSettings(e),await this.refresh(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async cleanupOrphan(e,t){try{await this.client.worktreeCleanup(e,t);let n=await this.client.diagnostics();this.setState({diagnostics:n,error:void 0})}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async remove(e,t,n){try{await this.client.remove(e,n?{purge:!0}:{ifVersion:t}),n&&this.setState({selectedId:void 0}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async duplicate(e){try{await this.client.create({title:e.title.slice(0,196)+I(`shared.duplicate.suffix`),workspaceId:e.workspaceId,urgency:e.urgency,description:e.description.length>0?e.description:void 0,prompt:e.prompt.length>0?e.prompt:void 0,execution:e.execution.mode===`scheduled`&&e.execution.cron!==void 0?{mode:`scheduled`,cron:e.execution.cron}:{mode:`claim`},model:e.model,isolation:e.isolation,...e.presetId===void 0?{}:{presetId:e.presetId},...e.permission===void 0?{}:{permission:e.permission},...e.checklist!==void 0&&e.checklist.length>0?{checklist:e.checklist.map(e=>e.text)}:{}}),await this.refresh()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async loadTemplates(){try{let e=await this.client.templates();return this.setState({templates:e.templates,error:void 0}),e.templates}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),[]}}prepareTemplateMenu(){this.state.templates.length===0&&this.loadTemplates()}openTemplateManager(){this.setState({tplManagerOpen:!0}),this.loadTemplates()}closeTemplateManager(){this.setState({tplManagerOpen:!1})}async upsertTemplate(e){try{return await this.client.templateUpsert(e),await this.loadTemplates(),!0}catch(e){return this.setState({error:e instanceof Error?e.message:String(e)}),!1}}async deleteTemplate(e){try{await this.client.templateDelete(e),await this.loadTemplates()}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}async saveAsTemplate(e){return this.upsertTemplate({name:e.title.slice(0,60),task:{title:e.title,description:e.description.length>0?e.description:void 0,prompt:e.prompt.length>0?e.prompt:void 0,urgency:e.urgency,execution:e.execution.mode===`scheduled`&&e.execution.cron!==void 0?{mode:`scheduled`,cron:e.execution.cron}:{mode:`claim`},model:e.model,isolation:e.isolation,...e.presetId===void 0?{}:{presetId:e.presetId},...e.permission===void 0?{}:{permission:e.permission},...e.checklist!==void 0&&e.checklist.length>0?{checklist:e.checklist.map(e=>e.text)}:{}}})}async fetchPromptCompletions(){try{return await this.client.promptCompletions()}catch{return}}openImport(){this.setState({importOpen:!0})}closeImport(){this.setState({importOpen:!1})}async importPreview(e){try{return(await this.client.importPreview(e)).plan}catch(e){this.setState({error:e instanceof Error?e.message:String(e)});return}}async importCommit(e,t){try{let n=await this.client.importCommit(e,t);return await this.refresh(),n}catch(e){this.setState({error:e instanceof Error?e.message:String(e)});return}}exportJson(){let e=new Date,t=e=>String(e).padStart(2,`0`),n=`dsh-taskboard-${e.getFullYear()}${t(e.getMonth()+1)}${t(e.getDate())}-${t(e.getHours())}${t(e.getMinutes())}.json`,r=JSON.stringify(this.state.ledger,null,2);this.download(n,r,`application/json`)}exportCsv(){let e=e=>{let t=String(e??``);return/^[=+\-@\t\r]/.test(t)&&(t=`'${t}`),/[",\n\r]/.test(t)?`"${t.replace(/"/g,`""`)}"`:t},t=[`id`,`title`,`status`,`urgency`,`blocked`,`project`,`claimedBy`,`mode`,`cron`,`nextRunAt`,`model`,`createdAt`,`updatedAt`,`comments`,`executions`],n=this.state.ledger.tasks.map(t=>[t.id,t.title,t.status,t.urgency,t.blocked?`yes`:`no`,t.workspaceId,t.claimedBy??``,t.execution.mode,t.execution.cron??``,t.execution.nextRunAt===void 0?``:new Date(t.execution.nextRunAt).toISOString(),t.model===void 0?``:`${t.model.provider}/${t.model.model}`,new Date(t.createdAt).toISOString(),new Date(t.updatedAt).toISOString(),t.comments.length,t.executions.length].map(e).join(`,`)),r=new Date,i=e=>String(e).padStart(2,`0`),a=`dsh-taskboard-${r.getFullYear()}${i(r.getMonth()+1)}${i(r.getDate())}.csv`;this.download(a,`\uFEFF${[t.join(`,`),...n].join(`\r
10
+ `)}`,`text/csv`)}download(e,t,n){try{let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,a.click(),setTimeout(()=>URL.revokeObjectURL(i),5e3)}catch(e){this.setState({error:e instanceof Error?e.message:String(e)})}}};const oe=`dsh-taskboard-styles`;function se(){if(typeof document>`u`)return;let e=document.getElementById(oe);e===null&&(e=document.createElement(`style`),e.id=oe,e.textContent=`
11
11
  .dsh-atb-entry {
12
12
  display: flex; align-items: center; gap: 8px; position: relative;
13
13
  width: calc(100% - 8px); margin: 2px 4px; padding: 6px 10px;
@@ -78,6 +78,14 @@ window.__ModuleLoader__.load({
78
78
  html[data-dsh-atb-active] .dsh-atb-view { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
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
+ /* #20: native Windows caption controls overlay older Desktop content. Reserve
82
+ * their vertical band, including wrapped toolbar rows. New Desktop layouts
83
+ * already start below it: subtract the actual view top to avoid double insets.
84
+ * Electron exposes titlebar-area env values; 36px covers the Desktop frame
85
+ * when that API is unavailable. Ordinary Web/macOS views never match. */
86
+ .dsh-atb-view[data-dsh-atb-windows] > .dsh-atb-board {
87
+ padding-top: max(12px, calc(env(titlebar-area-y, 0px) + env(titlebar-area-height, 36px) + 8px - var(--dsh-atb-viewport-top, 0px)));
88
+ }
81
89
  .dsh-atb-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
82
90
  /* 0.6.5 / #19: dsh-better-sidebar 钉在视口右上角的常驻按钮簇(2×28px + 4px
83
91
  * gap,right:10px → 占视口右边 10~70px)。它对 DSH 原生会话头的避让契约是
@@ -537,7 +545,10 @@ window.__ModuleLoader__.load({
537
545
  color: var(--dsw-alias-label-secondary, gray);
538
546
  }
539
547
  .dsh-atb-req { color: var(--dsw-alias-state-error-primary, #e5484d); font-style: normal; }
540
- .dsh-atb-modal-body input, .dsh-atb-modal-body textarea, .dsh-atb-modal-body select {
548
+ /* Checkbox 排除:整行宽输入样式(width:100% + padding/border)特异性 (0,1,1) 高于
549
+ .dsh-atb-cke-box (0,1,0),曾把编辑表单清单行的勾选框拉满整行(勾选框画在行
550
+ 中央)、文本框挤扁。清单勾选框保持原生外观与 15px 布局。 */
551
+ .dsh-atb-modal-body input:not([type="checkbox"]), .dsh-atb-modal-body textarea, .dsh-atb-modal-body select {
541
552
  font: inherit; font-size: 13px; padding: 7px 10px; border-radius: 8px;
542
553
  width: 100%; box-sizing: border-box;
543
554
  border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.35));
@@ -545,7 +556,7 @@ window.__ModuleLoader__.load({
545
556
  transition: border-color .12s ease, box-shadow .12s ease;
546
557
  }
547
558
  .dsh-atb-modal-body textarea { min-height: 64px; resize: vertical; }
548
- .dsh-atb-modal-body input:focus, .dsh-atb-modal-body textarea:focus, .dsh-atb-modal-body select:focus {
559
+ .dsh-atb-modal-body input:not([type="checkbox"]):focus, .dsh-atb-modal-body textarea:focus, .dsh-atb-modal-body select:focus {
549
560
  outline: none; border-color: var(--dsw-alias-brand-primary, #1f2328);
550
561
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dsw-alias-brand-primary, #1f2328) 18%, transparent);
551
562
  }
@@ -921,9 +932,9 @@ window.__ModuleLoader__.load({
921
932
  .dsh-atb-prompt-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
922
933
  .dsh-atb-prompt-tip { font-size: 11px; color: var(--dsw-alias-label-tertiary, gray); }
923
934
  .dsh-atb-prompt-tip code { font-size: 10.5px; padding: 1px 4px; border-radius: 4px; background: rgba(128,128,128,.14); }
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]??`
935
+ `,document.head.append(e)),e.dataset.plugin=`dsh-taskboard`,e.dataset.pluginCss=`dsh-taskboard/styles`}function ce(){let e=document.querySelector(`[data-pane="sidebar"], [class*="sidebarCol"], .dshDesktopUpstreamSidebar, .dshDesktopSidebarSurface`);if(e!==null)return e.querySelector(`[class*="logoRow"]`)?.parentElement??e.firstElementChild}function le(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 z(e){let t=document.createElement(`button`);return t.type=`button`,t.dataset.dshAtbEntry=``,t.className=`dsh-atb-entry`,t.setAttribute(`aria-label`,I(`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">${I(`shared.entry.label`)}</span><span class="dsh-atb-entry-stats"></span>`,t.addEventListener(`click`,()=>{e.toggleBoard()}),t}function B(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 V(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 H(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]=B(t);V(i[0],e),V(i[1],r),V(i[2],a),n.title=I(`shared.stats.title`,{todo:e,doing:r,review:a})}}function U(e,t){let n=le(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=z(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??=ce(),i!==void 0&&(n.found=le(i)!==void 0,a=U(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=U(i,t))}),l=setInterval(()=>{o()},2e3),u=H(t,e),d=()=>{e.getSnapshot().boardOpen?t.dataset.active=`true`:delete t.dataset.active,u()},f=e.subscribe(d),p=F.subscribe(()=>{t.setAttribute(`aria-label`,I(`shared.entry.aria`));let e=t.querySelector(`.dsh-atb-entry-label`);e!==null&&(e.textContent=I(`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=L(),[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=L();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=L(),[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=L(),[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=L(),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=L(),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=L(),{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=L(),[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=L(),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]??`
925
936
  `:`
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`;
937
+ `,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=L(),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=L(),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??``,[ee,te]=(0,e.useState)(P),[F,ne]=(0,e.useState)([]),[I,re]=(0,e.useState)(void 0),[R,ie]=(0,e.useState)(r?.permission??(o?.permission?p(o.permission):g(a.ledger.settings))),[ae,oe]=(0,e.useState)(r?.isolation??(o?.isolation===`none`?`none`:o?.isolation===`worktree`?`worktree`:m(a.ledger.settings))),[se,ce]=(0,e.useState)(r?.checklist!==void 0&&r.checklist.length>0?r.checklist.map(e=>({...e})):(o?.checklist??[]).map(e=>({text:e,checked:!1}))),le=(0,e.useRef)(null),[z,B]=(0,e.useState)(!1);(0,e.useEffect)(()=>{le.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=>{ne(e.presets),re(e.defaultId),!s&&P===``&&e.defaultId!==void 0&&te(e.defaultId)}).catch(()=>ne([]))},[t,s,r?.presetId,P]);let V=C===`scheduled`?_(T.trim()):null,H=V===null?null:y(V,Date.now()),U=C===`scheduled`&&(V===null||H===null),W=c.trim().length>0&&v!==``&&!U,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 ae},pe=()=>ee.trim().length>0?ee.trim():void 0,me=()=>se.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||z)return;let e=he();s||Me(e);let n=fe(),i=pe(),a=me();B(!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:R,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:R,...a.length>0?{checklist:a.map(e=>e.text)}:{}})).catch(()=>void 0).finally(()=>B(!1))},Z=()=>{if(!W||G||z)return;let e=he();s||Me(e);let n=fe(),i=pe(),a=me();B(!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:R,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:R,...a.length>0?{checklist:a.map(e=>e.text)}:{}});r!==void 0&&await t.run(r)}})().catch(()=>void 0).finally(()=>B(!1))},_e=W?C===`scheduled`&&H!==null?i(`form.hint.nextRun`,{time:J(H)}):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:le,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`)})]})]})}),F.length>0&&(0,n.jsx)($,{label:i(`form.field.preset`),children:(0,n.jsxs)(`select`,{value:ee,onChange:e=>te(e.target.value),title:i(`form.field.presetTitle`),children:[(0,n.jsxs)(`option`,{value:``,children:[i(`form.preset.follow`),I===void 0?``:i(`shared.current`,{name:F.find(e=>e.id===I)?.name??I})]}),F.map(e=>(0,n.jsxs)(`option`,{value:e.id,children:[e.name??e.id,e.id===I?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":R===e.value,onClick:()=>ie(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:U?`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)),!U&&H!==null&&(0,n.jsx)(`span`,{className:`dsh-atb-cron-next`,children:i(`form.cron.next`,{time:J(H)})})]})]}),(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":ae===`worktree`,disabled:de,title:i(K?`form.iso.locked`:q?`form.iso.worktreeTitle`:`form.iso.nonGit`),onClick:()=>oe(`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":ae===`none`,disabled:de,title:i(K?`form.iso.locked`:`form.iso.noneTitle`),onClick:()=>oe(`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:se,onChange:ce,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||z,title:i(G?`form.action.runBlockedTitle`:z?`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||z,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=L(),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=L(),[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=L(),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=L(),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.6`]})]}),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=L(),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=L(),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))})}function Je(e){let t=()=>{if((document.body.getAttribute(`data-dsh-desktop-platform`)??new URLSearchParams(window.location.search).get(`dsh-desktop-platform`))!==`win32`){delete e.dataset.dshAtbWindows,e.style.removeProperty(`--dsh-atb-viewport-top`);return}e.dataset.dshAtbWindows=``,e.style.setProperty(`--dsh-atb-viewport-top`,`${e.getBoundingClientRect().top}px`)},n,r=()=>{n===void 0&&(n=requestAnimationFrame(()=>{n=void 0,t()}))},i=new MutationObserver(r);i.observe(document.body,{attributes:!0,childList:!0,subtree:!0,attributeFilter:[`class`,`data-dsh-desktop-platform`,`data-dsh-desktop-mode`,`data-details-collapsed`]}),i.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-dsh-atb-active`]});let a=typeof ResizeObserver>`u`?void 0:new ResizeObserver(r);return a?.observe(e),e.parentElement!==null&&a?.observe(e.parentElement),window.addEventListener(`resize`,r),r(),()=>{i.disconnect(),a?.disconnect(),window.removeEventListener(`resize`,r),n!==void 0&&cancelAnimationFrame(n),delete e.dataset.dshAtbWindows,e.style.removeProperty(`--dsh-atb-viewport-top`)}}const Ye=`data-dsh-atb-active`,Xe=[`data-dsh-taskboard-active`,`data-dsh-ssh-active`],Ze=`dsh-panel-activate`,Qe=`dsh-taskboard`;function $e(){return document.querySelector(`[data-pane="conversation"], [class*="centerCol"], .dshDesktopConversationSurface`)??void 0}function et(e){let r,i,a,o=()=>{if(i!==void 0)return;let o=$e();o!==void 0&&(i=document.createElement(`div`),i.dataset.dshAtbView=``,i.className=`dsh-atb-view`,o.appendChild(i),a=Je(i),r=(0,t.createRoot)(i),r.render((0,n.jsx)(Ge,{controller:e})))},s=new MutationObserver(()=>{o()});s.observe(document.body,{childList:!0,subtree:!0});let c=()=>{if(e.getSnapshot().boardOpen){for(let e of Xe)document.documentElement.removeAttribute(e);document.documentElement.setAttribute(Ye,``),document.dispatchEvent(new CustomEvent(Ze,{detail:Qe}))}else document.documentElement.removeAttribute(Ye)},l=t=>{t.detail!==Qe&&e.getSnapshot().boardOpen&&e.closeBoard()},u=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`,u,!0),document.addEventListener(Ze,l);let d=e.subscribe(c);return c(),o(),()=>{document.removeEventListener(`click`,u,!0),document.removeEventListener(Ze,l),s.disconnect(),d(),a?.(),document.documentElement.removeAttribute(Ye),r?.unmount(),i?.remove()}}function tt(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 nt=[`connection`];function rt(e){try{se(),ee(e.get?.(`locale`),()=>e.get?.(`locale`));let t=c(),n=new ae(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(tt({getSessions:()=>e.get?.(`sessions`),getWorkspaces:()=>e.get?.(`workspaces`)})),n.start();let r=[];try{r.push(W(n)),r.push(et(n))}catch(e){console.error(`[dsh-taskboard] mount failed:`,e)}e.effect?.(()=>()=>{for(let e of r.splice(0))e();n.dispose(),te()},`dsh-taskboard: client mount`)}catch(e){console.error(`[dsh-taskboard] client half failed to start:`,e)}}exports.apply=rt,exports.inject=nt,exports.name=`dsh-taskboard/client`;
927
938
  return module.exports;
928
939
  }
929
940
  });