@linxin666/dsh-client-ui-task-board 0.1.16 → 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.
Files changed (37) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +11 -7
  3. package/README.zh.md +11 -7
  4. package/lib/client.js +821 -145
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +1 -1
  7. package/lib/types/client/PluginSettingsCard.d.ts +11 -0
  8. package/lib/types/client/locales.d.ts +21 -0
  9. package/lib/types/client/schedule-presets.d.ts +10 -0
  10. package/lib/types/core/controller.d.ts +57 -1
  11. package/lib/types/core/execution.d.ts +65 -4
  12. package/lib/types/core/scheduler.d.ts +7 -0
  13. package/lib/types/core/store.d.ts +1 -1
  14. package/lib/types/core/tasks.d.ts +43 -0
  15. package/lib/types/core/use-cases/task-archive.d.ts +22 -0
  16. package/lib/types/core/use-cases/task-create.d.ts +1 -6
  17. package/lib/types/core/use-cases/task-update.d.ts +9 -4
  18. package/lib/types/index.d.ts +1 -1
  19. package/package.json +1 -1
  20. package/src/client/PluginSettingsCard.tsx +50 -47
  21. package/src/client/board/NewTaskModal.tsx +136 -3
  22. package/src/client/board/TaskBoard.tsx +48 -19
  23. package/src/client/board/TaskDetail.tsx +97 -8
  24. package/src/client/board.module.css +16 -0
  25. package/src/client/index.ts +71 -2
  26. package/src/client/locales.ts +42 -0
  27. package/src/client/schedule-presets.ts +13 -0
  28. package/src/client/settings-card.module.css +9 -0
  29. package/src/core/controller.ts +92 -2
  30. package/src/core/execution.ts +179 -12
  31. package/src/core/scheduler.ts +15 -0
  32. package/src/core/store.ts +16 -2
  33. package/src/core/tasks.ts +56 -0
  34. package/src/core/use-cases/task-archive.ts +48 -0
  35. package/src/core/use-cases/task-create.ts +12 -3
  36. package/src/core/use-cases/task-update.ts +34 -5
  37. package/src/index.ts +1 -1
@@ -1,12 +1,31 @@
1
1
  /**
2
2
  * Update-task use case: apply an editable-field patch (title/description/
3
- * prompt) with a fresh updatedAt. Pure ledger transition (no persistence or
4
- * notify — the controller orchestrates those).
3
+ * prompt plus the execution targets workspaceId/mode/permission) with a
4
+ * fresh updatedAt. Pure ledger transition (no persistence or notify — the
5
+ * controller orchestrates those).
6
+ *
7
+ * An explicit `undefined` in the patch clears the field (the task falls
8
+ * back to the runtime default); an unknown permission string is ignored so
9
+ * stale UI can never persist a value the execution service rejects.
5
10
  */
6
- import type { TaskRecord } from '../tasks.ts'
11
+ import { isTaskPermission, type TaskRecord, type TaskPermission } from '../tasks.ts'
7
12
 
8
13
  /** Editable fields on a task (the update patch surface). */
9
- export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' | 'prompt'>>
14
+ export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' | 'prompt' | 'workspaceId' | 'mode' | 'permission'>>
15
+
16
+ /** Collapse a blank target string to undefined (clears the pin). */
17
+ function normalizeTargetId(value: string | undefined): string | undefined {
18
+ return value !== undefined && value.trim() === '' ? undefined : value
19
+ }
20
+
21
+ /** Keep an unknown permission string from entering the ledger. */
22
+ function normalizePermission(
23
+ current: TaskPermission | undefined,
24
+ value: TaskPermission | undefined,
25
+ ): TaskPermission | undefined {
26
+ if (value === undefined) return undefined
27
+ return isTaskPermission(value) ? value : current
28
+ }
10
29
 
11
30
  /**
12
31
  * Apply an update across the ledger. Tasks that do not match the id are left
@@ -22,5 +41,15 @@ export function applyUpdateTask(
22
41
  patch: TaskUpdatePatch,
23
42
  now: number,
24
43
  ): readonly TaskRecord[] {
25
- return tasks.map(task => task.id === id ? { ...task, ...patch, updatedAt: now } : task)
44
+ return tasks.map(task => {
45
+ if (task.id !== id) return task
46
+ const workspaceId = 'workspaceId' in patch ? normalizeTargetId(patch.workspaceId) : undefined
47
+ const mode = 'mode' in patch ? normalizeTargetId(patch.mode) : undefined
48
+ const permission = 'permission' in patch ? normalizePermission(task.permission, patch.permission) : undefined
49
+ const next: TaskRecord = { ...task, ...patch, updatedAt: now }
50
+ if (workspaceId !== undefined || 'workspaceId' in patch) next.workspaceId = workspaceId
51
+ if (mode !== undefined || 'mode' in patch) next.mode = mode
52
+ if (permission !== undefined || 'permission' in patch) next.permission = permission
53
+ return next
54
+ })
26
55
  }
package/src/index.ts CHANGED
@@ -22,7 +22,7 @@ const SECTION_ORDER = 200
22
22
  export const inject = ['systemPrompt']
23
23
 
24
24
  /** Model-facing announcement: plugin presence, capabilities, and limits. */
25
- export const TASK_BOARD_GUIDANCE = '本机已安装 dsh-task-board 插件(DSH Web GUI 的任务看板):侧边栏「任务看板」入口;在 dsh-web-ui 插件全家桶仓库(packages/dsh-task-board)统一维护,经聚合包 web-ui-all 一键安装。能力:多列看板管理任务;任务可真实执行(驱动 agent 会话);任务支持 5 段 cron 定时执行(如 0 23 * * *);数据存浏览器 localStorage(键 dsh.taskBoard.v1)。限制:定时调度在浏览器端,需 GUI 标签页打开,错过即跳过;执行消耗 API 额度。用户提到「任务看板 / 看板 / 定时任务」时即指本插件,请据此协作。'
25
+ export const TASK_BOARD_GUIDANCE = '本机已安装 dsh-task-board 插件(DSH Web GUI 的任务看板):侧边栏「任务看板」入口;在 dsh-web-ui 插件全家桶仓库(packages/dsh-task-board)统一维护,经聚合包 web-ui-all 一键安装。能力:多列看板管理任务;任务可真实执行(驱动 agent 会话);任务可钉住执行目标——工作区 / 模式(agent 预设)/ 权限(read-only / workspace-write / danger-full-access),缺省用运行时默认;任务支持 5 段 cron 定时执行(如 0 23 * * *);数据存浏览器 localStorage(键 dsh.taskBoard.v1)。限制:定时调度在浏览器端,需 GUI 标签页打开,错过即跳过;执行消耗 API 额度。用户提到「任务看板 / 看板 / 定时任务」时即指本插件,请据此协作。'
26
26
 
27
27
  /**
28
28
  * Settings namespace of the board's announcement capability — the section the