@linxin666/dsh-client-ui-task-board 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +3 -3
- package/README.zh.md +3 -3
- package/lib/client.js +377 -115
- package/lib/client.js.map +1 -1
- package/lib/types/client/PluginSettingsCard.d.ts +11 -0
- package/lib/types/client/locales.d.ts +7 -0
- package/lib/types/client/schedule-presets.d.ts +10 -0
- package/lib/types/core/controller.d.ts +27 -0
- package/lib/types/core/execution.d.ts +16 -0
- package/lib/types/core/scheduler.d.ts +7 -0
- package/lib/types/core/tasks.d.ts +16 -0
- package/lib/types/core/use-cases/task-archive.d.ts +22 -0
- package/lib/types/core/use-cases/task-create.d.ts +1 -6
- package/package.json +1 -1
- package/src/client/PluginSettingsCard.tsx +50 -47
- package/src/client/board/NewTaskModal.tsx +68 -0
- package/src/client/board/TaskBoard.tsx +48 -19
- package/src/client/board/TaskDetail.tsx +27 -8
- package/src/client/index.ts +3 -0
- package/src/client/locales.ts +14 -0
- package/src/client/schedule-presets.ts +13 -0
- package/src/client/settings-card.module.css +9 -0
- package/src/core/controller.ts +54 -0
- package/src/core/execution.ts +41 -2
- package/src/core/scheduler.ts +15 -0
- package/src/core/store.ts +1 -0
- package/src/core/tasks.ts +15 -0
- package/src/core/use-cases/task-archive.ts +48 -0
- package/src/core/use-cases/task-create.ts +12 -3
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: ed814f18cf9668624c70d26ef8190d378aaf62f1
|
|
6
|
+
README.zh.md: 54aa8959f94f196196e70107a3a18846f4a45dc5
|
package/README.md
CHANGED
|
@@ -11,12 +11,12 @@ A hot-pluggable DeepSeek Harness (DSH) client GUI plugin: it adds a **task board
|
|
|
11
11
|
## Features
|
|
12
12
|
|
|
13
13
|
- **Sidebar entry**: injects a "任务看板" (task board) entry row inside the sidebar column (`[data-pane="sidebar"]` on older shells, `[class*="sidebarCol"]` on the DSH 0.1.0-rc.6 AppFrame layout) below the new-session button (wide rail shows icon + text, collapsed rail shows a bare icon, adapting to DSH skin tokens).
|
|
14
|
-
- **Multi-column board**: five columns — 待规划 (to plan) / 待办 (to do) / 进行中 (in progress) / 已完成 (done) / 已失败 (failed); cards show title, description, status, update time, and execution count; the top supports search filter, new task, and back to chat.
|
|
14
|
+
- **Multi-column board**: five columns — 待规划 (to plan) / 待办 (to do) / 进行中 (in progress) / 已完成 (done) / 已失败 (failed); cards show title, description, status, update time, and execution count; the top supports search filter, an archive view (done/failed tasks can be archived off the board and restored anytime, keeping execution history and session transcripts traceable), new task, and back to chat.
|
|
15
15
|
- **Task details**: click a card to open details (title/description/execution prompt/execution log) — it does **not** execute on a single click; the details offer "执行 / 重新执行" (Run / Re-run), "删除" (Delete, with confirm), "查看会话" (View session, jumps to the execution transcript), and a manual move to 待规划/待办.
|
|
16
16
|
- **Real execution**: on "执行" (Run), the plugin connects a workspace session through the client runtime (`workspaces.connectWorkspace`, reusing a blank session or letting the host create one), names the session after the task title, and drives a real agent via `session.prompt([{ type: 'text', text }], 'queue')`; it then subscribes to that session's snapshot and, once the round really finishes, sets the card to 已完成/已失败 and records the execution result. The execution session appears in the session list and can be opened to view the real transcript.
|
|
17
17
|
- **Per-task execution targets**: a task can pin where and how it runs — **workspace** (the execution session lands in that workspace), **mode** (the agent preset the session is composed from, switched through `agentPresets.select` while the session is still blank), and **permission** (a sandbox preset applied through the `/permission <id>` slash command: read-only / workspace-write / danger-full-access). Blank pins fall back to the runtime defaults (recent workspace / deployment preset / session default). A pin that cannot be applied fails the run **before** the prompt is sent, so a task never silently runs under settings it did not ask for.
|
|
18
18
|
- **Status write-back**: card status (进行中 → 完成/失败) is driven by the real session state; after a page refresh/restart, leftover running tasks are auto-reconciled against the current session state (reconcile).
|
|
19
|
-
- **Scheduled tasks**: the details panel can schedule a task — an enable switch + a 5-field cron expression (分 时 日 月 周, supporting `*` / `*/n` / `a-b` / comma lists) + common presets (daily 09:00, every hour, every 10 minutes, Mondays 09:00); enabling computes and persists the "下次运行时间" (next run time), and the card shows a scheduled marker; at the due time it automatically takes the same real-execution path (as manual run), and the execution session remains linkable.
|
|
19
|
+
- **Scheduled tasks**: the new-task dialog and the details panel can schedule a task — an enable switch + a 5-field cron expression (分 时 日 月 周, supporting `*` / `*/n` / `a-b` / comma lists) + common presets (daily 09:00, every hour, every 10 minutes, Mondays 09:00); enabling computes and persists the "下次运行时间" (next run time), and the card shows a scheduled marker; at the due time it automatically takes the same real-execution path (as manual run), and the execution session remains linkable.
|
|
20
20
|
- **System-prompt injection**: the host half (`src/index.ts`) registers a `plugin:task-board` section (order 200) via `SystemPrompt.section`, declaring this plugin's existence, capabilities, and limits to every agent — it is injected when the plugin is in the composition (after mount + DSH restart) and disappears when removed (after unmount + restart), so an agent needs no external docs to know how to work with this board.
|
|
21
21
|
|
|
22
22
|
## Directory structure
|
|
@@ -48,7 +48,7 @@ scripts/dsh-task-board.js # one-click mount/unmount/sta
|
|
|
48
48
|
- **Execution rides the client runtime**: `ctx.sessions.list` subscribes to session state (`running` / `byId`), `ctx.workspaces.connectWorkspace()` creates/reuses a session, `session.prompt()` drives a real agent, and `ctx.sessions.open()` jumps to the transcript.
|
|
49
49
|
- **Execution targets ride the same runtime faces**: the workspace pin passes the task's id to `workspaces.connectWorkspace()` (validated against the workspace list first, so a stale pin fails locally); the mode pin recomposes the blank execution session via `api.agentPresets.select` — only legal before the first turn, so it runs before `session.prompt`, and `sessions.noteAgentPreset` keeps the list label current; the permission pin admits a `/permission <id>` slash command through `session.command` — the same mechanism the shell's own permission picker uses. A rejected admission or a line no command claims fails the run before the prompt.
|
|
50
50
|
- **Background settlement relies on list reconciliation**: an unopened session has no chat-snapshot window (cold), so settlement keys off the session list — every list change reconciles running tasks; result judgment takes, in order, "missing from list → cancelled / still running → wait / chat snapshot visible → by lastAgentError / tail of raw history → a turn-error node proves failure / otherwise success", and reconciliation is idempotent.
|
|
51
|
-
- **Scheduled tasks run in the browser scheduler**: the plugin is pure-client (no server channel), so "run at the due time" is done by the in-tab scheduler — a tick every minute, with an immediate catch-up tick when the page returns from the background; before firing it first moves "next run" forward to the next cron match so the same tick never fires twice; it does not fire early in page load (before the session-list baseline is ready), avoiding mis-execution. Limitation: the tab must stay open (schedules missed while closed are "miss = skip", and only already-deferred due tasks are caught up on the next open); a task that is 进行中 (in progress) skips the current due time and waits for the next cron match.
|
|
51
|
+
- **Scheduled tasks run in the browser scheduler**: the plugin is pure-client (no server channel), so "run at the due time" is done by the in-tab scheduler — a tick every minute, with an immediate catch-up tick when the page returns from the background; before firing it first moves "next run" forward to the next cron match so the same tick never fires twice; it does not fire early in page load (before the session-list baseline is ready), avoiding mis-execution. Every tick first re-reads the persisted ledger, so a task deleted in another tab can never be fired from a stale in-memory copy. Limitation: the tab must stay open (schedules missed while closed are "miss = skip", and only already-deferred due tasks are caught up on the next open); a task that is 进行中 (in progress) skips the current due time and waits for the next cron match.
|
|
52
52
|
- **Same-origin tabs share one ledger**: additions, edits, and deletions in any tab propagate to the others through storage events (`LocalStorageTaskStore.subscribeExternal`), so a task deleted in one tab can never keep firing from another tab's stale in-memory copy — nor be written back by that copy's later persistence (schedule roll-forward, execution settlement).
|
|
53
53
|
|
|
54
54
|
## Install
|
package/README.zh.md
CHANGED
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
## 功能
|
|
12
12
|
|
|
13
13
|
- **侧边栏入口**:侧边栏列(旧版 `[data-pane="sidebar"]`,DSH 0.1.0-rc.6 AppFrame 布局为 `[class*="sidebarCol"]`)内、新会话按钮下方注入「任务看板」入口行(宽栏显示图标+文字,折叠 rail 显示纯图标,随 DSH 皮肤 token 自适应)。
|
|
14
|
-
- **多列看板**:待规划 / 待办 / 进行中 / 已完成 / 已失败
|
|
14
|
+
- **多列看板**:待规划 / 待办 / 进行中 / 已完成 / 已失败 五列;卡片显示标题、描述、状态、更新时间、执行次数;顶部支持搜索过滤、归档视图(已完成/已失败任务可归档,归档后移出看板,可随时恢复,执行记录与会话 transcript 保留可追溯)、新建任务、返回对话。
|
|
15
15
|
- **任务详情**:点卡片打开详情(标题/描述/执行 Prompt/执行记录),**不会**一点就执行;详情内提供「执行 / 重新执行」「删除(带确认)」「查看会话(跳转到执行 transcript)」以及手动移到待规划/待办。
|
|
16
16
|
- **真实执行**:点「执行」后,插件通过客户端 runtime 连接工作区会话(`workspaces.connectWorkspace`,空白会话复用或 host 新建),把任务标题设为会话名,以任务 Prompt 调用 `session.prompt([{ type: 'text', text }], 'queue')` 驱动真实 agent;随后订阅该会话快照,轮次真实结束后把卡片置为 已完成/已失败 并记录执行结果。执行会话会出现在会话列表,可点进对话查看真实 transcript。
|
|
17
17
|
- **任务级执行目标**:任务可钉住「在哪跑、怎么跑」——**工作区**(执行会话落在指定工作区)、**模式**(会话以指定 agent 预设组合,趁会话仍为空白时走 `agentPresets.select` 切换)、**权限**(经 `/permission <id>` 斜杠命令应用的沙箱预设:read-only / workspace-write / danger-full-access)。留空即回退运行时默认(最近工作区 / 部署预设 / 会话默认)。钉不住的目标会在发 Prompt **之前**失败,任务绝不会悄悄按没要求过的设置运行。
|
|
18
18
|
- **状态回写**:卡片状态(进行中 → 完成/失败)由真实会话状态驱动;刷新页面/重启后,遗留的 running 任务会按会话现状自动对账(reconcile)。
|
|
19
|
-
-
|
|
19
|
+
- **定时任务**:新建任务与详情面板均可配置定时执行——启用开关 + 5 段 cron 表达式(分 时 日 月 周,支持 `*` / `*/n` / `a-b` / 逗号列表)+ 常用预设(每天 09:00、每小时、每 10 分钟、每周一 09:00);启用即计算并持久化「下次运行时间」,卡片显示定时标识;到点自动走真实执行链路(同手动执行),执行会话照常可跳转。
|
|
20
20
|
- **系统提示词注入**:host 半边(`src/index.ts`)通过 `SystemPrompt.section` 注册 `plugin:task-board` 段(order 200),向每个 agent 声明本插件存在、能力与限制——插件在组合中(mount 后重启 DSH)即注入,移出组合(unmount 后重启)即消失,agent 无需任何外部文档就能知道如何与本看板协作。
|
|
21
21
|
|
|
22
22
|
## 目录结构
|
|
@@ -48,7 +48,7 @@ scripts/dsh-task-board.js # 一键挂载/卸载/状态
|
|
|
48
48
|
- **执行走客户端 runtime**:`ctx.sessions.list` 订阅会话状态(`running` / `byId`),`ctx.workspaces.connectWorkspace()` 创建/复用会话,`session.prompt()` 真实驱动 agent,`ctx.sessions.open()` 跳转 transcript。
|
|
49
49
|
- **执行目标走同样的 runtime 脸**:工作区钉子把任务指定的 id 传给 `workspaces.connectWorkspace()`(先对照工作区列表校验,失效的钉子就地失败);模式钉子通过 `api.agentPresets.select` 重组仍为空白状态的执行会话——只有首轮之前合法,所以排在 `session.prompt` 之前执行,`sessions.noteAgentPreset` 让会话列表标签即时更新;权限钉子经 `session.command` 提交 `/permission <id>` 斜杠命令——与壳自带权限选择器同一机制。提交被拒或没有命令认领该行时,在发 Prompt 前失败。
|
|
50
50
|
- **后台结算靠列表对账**:未打开的会话没有对话快照窗口(cold),所以执行结算以会话列表为准——每次列表变化都对账 running 任务;结果判定依次取「列表缺失→已取消 / 仍在跑→等待 / 对话快照可见→按 lastAgentError / 原始历史尾部→turn-error 节点证明失败 / 否则按成功」,对账幂等。
|
|
51
|
-
- **定时任务在浏览器端调度**:插件是纯客户端(无服务端通道),所以「到点执行」由标签页内的调度器完成——每分钟 tick 一次,页面从后台恢复可见时立即补 tick;到点触发前先把「下次运行」顺延到下一个 cron 匹配点再执行,同一 tick
|
|
51
|
+
- **定时任务在浏览器端调度**:插件是纯客户端(无服务端通道),所以「到点执行」由标签页内的调度器完成——每分钟 tick 一次,页面从后台恢复可见时立即补 tick;到点触发前先把「下次运行」顺延到下一个 cron 匹配点再执行,同一 tick 不会重复触发;页面加载早期(会话列表基线未就绪)不触发,避免误执行;每次 tick 先重读持久化账本,在别的标签页删除的任务绝不会从陈旧内存副本被触发。限制:需要标签页保持打开(关闭期间错过的调度按「错过即跳过」处理,下次打开时只补跑已顺延的到期任务);任务处于「进行中」时到点跳过本次,等下一个 cron 匹配点。
|
|
52
52
|
- **多标签页同源共享同一份台账**:任一标签页的增删改通过 storage 事件同步到其他标签页(`LocalStorageTaskStore.subscribeExternal`),删除的任务不会在其他标签页的内存副本里残留触发,也不会被其他标签页的后续持久化写回复活。
|
|
53
53
|
|
|
54
54
|
## 安装
|