@linxin666/dsh-client-ui-task-board 0.1.1

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 (50) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +211 -0
  3. package/cordis.patch.yml +12 -0
  4. package/lib/client.js +2592 -0
  5. package/lib/index.js +54 -0
  6. package/lib/invariant.js +6 -0
  7. package/lib/types/client/PluginSettingsCard.d.ts +77 -0
  8. package/lib/types/client/TaskBoardSettingsCard.d.ts +51 -0
  9. package/lib/types/client/board/ConfirmDialog.d.ts +12 -0
  10. package/lib/types/client/board/NewTaskModal.d.ts +6 -0
  11. package/lib/types/client/board/TaskBoard.d.ts +5 -0
  12. package/lib/types/client/board/TaskCard.d.ts +12 -0
  13. package/lib/types/client/board/TaskDetail.d.ts +7 -0
  14. package/lib/types/client/board-mount.d.ts +10 -0
  15. package/lib/types/client/index.d.ts +43 -0
  16. package/lib/types/client/locales.d.ts +105 -0
  17. package/lib/types/client/settings-form.d.ts +118 -0
  18. package/lib/types/client/sidebar-entry.d.ts +25 -0
  19. package/lib/types/core/controller.d.ts +129 -0
  20. package/lib/types/core/execution.d.ts +136 -0
  21. package/lib/types/core/schedule.d.ts +40 -0
  22. package/lib/types/core/scheduler.d.ts +49 -0
  23. package/lib/types/core/store.d.ts +36 -0
  24. package/lib/types/core/tasks.d.ts +111 -0
  25. package/lib/types/index.d.ts +44 -0
  26. package/lib/types/invariant.d.ts +3 -0
  27. package/package.json +85 -0
  28. package/src/client/PluginSettingsCard.tsx +207 -0
  29. package/src/client/TaskBoardSettingsCard.tsx +124 -0
  30. package/src/client/board/ConfirmDialog.tsx +40 -0
  31. package/src/client/board/NewTaskModal.tsx +82 -0
  32. package/src/client/board/TaskBoard.tsx +107 -0
  33. package/src/client/board/TaskCard.tsx +62 -0
  34. package/src/client/board/TaskDetail.tsx +286 -0
  35. package/src/client/board-mount.tsx +74 -0
  36. package/src/client/board.module.css +849 -0
  37. package/src/client/css-modules.d.ts +5 -0
  38. package/src/client/index.ts +167 -0
  39. package/src/client/locales.ts +211 -0
  40. package/src/client/settings-card.module.css +261 -0
  41. package/src/client/settings-form.ts +294 -0
  42. package/src/client/sidebar-entry.ts +118 -0
  43. package/src/core/controller.ts +379 -0
  44. package/src/core/execution.ts +259 -0
  45. package/src/core/schedule.ts +140 -0
  46. package/src/core/scheduler.ts +104 -0
  47. package/src/core/store.ts +183 -0
  48. package/src/core/tasks.ts +204 -0
  49. package/src/index.ts +94 -0
  50. package/src/invariant.ts +4 -0
package/src/index.ts ADDED
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Host loader entry for the task-board plugin.
3
+ *
4
+ * Everything the board does is browser work (DOM, localStorage, driving the
5
+ * client runtime's session services over the wire), so the host half's main
6
+ * behavior is a system-prompt section announcing the plugin to every agent.
7
+ * The section registers while this plugin is in the host composition (mount /
8
+ * DSH restart) and disappears when the plugin leaves it (unmount / restart),
9
+ * so agents always know the board exists and how to cooperate with it. The
10
+ * announcement can be turned off through the web settings plugin-configuration
11
+ * surface (`announceToAgent`); the section then disappears live.
12
+ */
13
+
14
+ import type { Context } from '@deepseek-ai/cordis'
15
+ import { installSettingsSection, settingsNamespace } from '@deepseek-ai/dsh-settings'
16
+ import z from 'schemastery'
17
+ import type {} from '@deepseek-ai/dsh-system-prompt'
18
+
19
+ /** Order of the announcement section within the tool-guidance band. */
20
+ const SECTION_ORDER = 200
21
+
22
+ export const inject = ['systemPrompt']
23
+
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 额度。用户提到「任务看板 / 看板 / 定时任务」时即指本插件,请据此协作。'
26
+
27
+ /**
28
+ * Settings namespace of the board's announcement capability — the section the
29
+ * web settings surface edits. Spelled here rather than imported: the browser
30
+ * half spells the same value and must not depend on a Host package.
31
+ */
32
+ export const TASK_BOARD_SETTINGS_NAMESPACE = settingsNamespace('task-board')
33
+
34
+ /** Plugin config, validated by the same-named schemastery schema. */
35
+ export interface Config {
36
+ /**
37
+ * When true (default), a system-prompt section announces the board to every
38
+ * agent. Set false to keep the board silent in prompts; agents then learn
39
+ * about it only when the user mentions it.
40
+ */
41
+ announceToAgent?: boolean
42
+ /** Master switch for the plugin (browser half + host announcement). */
43
+ enabled?: boolean
44
+ }
45
+
46
+ export const Config: z<Config> = z.object({
47
+ announceToAgent: z.boolean().default(true),
48
+ enabled: z.boolean().default(true),
49
+ })
50
+
51
+ /** Schema default, re-read for hand-built test contexts (the loader applies them normally). */
52
+ const DEFAULT_ANNOUNCE = true
53
+
54
+ /**
55
+ * Register the board's announcement section, gated on the composition entry's
56
+ * `announceToAgent` (and the live settings value once the web settings
57
+ * surface is served). The section is re-registered whenever the source
58
+ * changes, so a settings edit takes effect without a restart.
59
+ * @param ctx - the plugin context (systemPrompt injected).
60
+ * @param config - resolved plugin config (schema defaults applied by the loader).
61
+ */
62
+ export function apply(ctx: Context, config?: Config): void {
63
+ // The live source the announcement reads: the settings section once the web
64
+ // settings surface is served, the composition entry otherwise
65
+ // (installSettingsSection swaps it when the namespace registers).
66
+ let current: () => Config = () => config ?? {}
67
+ let disposeSection: (() => void) | undefined
68
+
69
+ // Register (or drop) the announcement to match the current source. The
70
+ // section is kept under one disposer: re-registering first tears the old
71
+ // one down so a duplicate-name registration never throws.
72
+ const sync = (): void => {
73
+ if (disposeSection !== undefined) {
74
+ disposeSection()
75
+ disposeSection = undefined
76
+ }
77
+ if ((current().enabled ?? true) === false) return
78
+ if ((current().announceToAgent ?? DEFAULT_ANNOUNCE) === false) return
79
+ disposeSection = ctx.systemPrompt.section({
80
+ name: 'plugin:task-board',
81
+ order: SECTION_ORDER,
82
+ text: TASK_BOARD_GUIDANCE,
83
+ })
84
+ }
85
+
86
+ installSettingsSection(ctx, TASK_BOARD_SETTINGS_NAMESPACE, Config, config ?? {}, {
87
+ setSource: (source) => { current = source },
88
+ onChange: sync,
89
+ })
90
+
91
+ // Initial registration from the composition entry (covers deployments with
92
+ // no settings service, whose installSettingsSection never fires its hooks).
93
+ sync()
94
+ }
@@ -0,0 +1,4 @@
1
+ /** Invariant companion plugin (no assertions — nothing to check at runtime). */
2
+
3
+ /** Provides no assertions: the board owns no cross-package runtime invariants. */
4
+ export function apply(): void {}