@linxin666/dsh-client-ui-task-board 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +56 -18
  3. package/README.zh.md +56 -18
  4. package/lib/client.js +6242 -958
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +3475 -234
  7. package/lib/types/client/PluginSettingsCard.d.ts +7 -0
  8. package/lib/types/client/TaskBoardSettingsCard.d.ts +19 -3
  9. package/lib/types/client/board/ClampedMarkdown.d.ts +3 -0
  10. package/lib/types/client/board/ConfirmDialog.d.ts +4 -1
  11. package/lib/types/client/board/EditTaskModal.d.ts +5 -2
  12. package/lib/types/client/board/LinkSubtaskModal.d.ts +5 -2
  13. package/lib/types/client/board/NewTaskModal.d.ts +4 -1
  14. package/lib/types/client/board/TagManagerModal.d.ts +26 -0
  15. package/lib/types/client/board/TaskBoard.d.ts +10 -1
  16. package/lib/types/client/board/TaskCard.d.ts +14 -1
  17. package/lib/types/client/board/TaskDetail.d.ts +3 -1
  18. package/lib/types/client/board/TaskForm.d.ts +23 -2
  19. package/lib/types/client/board/VerificationReport.d.ts +23 -0
  20. package/lib/types/client/board/card-view.d.ts +113 -0
  21. package/lib/types/client/board/icons.d.ts +32 -0
  22. package/lib/types/client/board/overlay.d.ts +69 -0
  23. package/lib/types/client/board/preset-label.d.ts +22 -0
  24. package/lib/types/client/board/status-key.d.ts +15 -0
  25. package/lib/types/client/board/task-markdown.d.ts +19 -0
  26. package/lib/types/client/board-card-seat.d.ts +34 -0
  27. package/lib/types/client/host-api.d.ts +24 -1
  28. package/lib/types/client/index.d.ts +19 -0
  29. package/lib/types/client/locales.d.ts +141 -3
  30. package/lib/types/client/native-panel.d.ts +6 -20
  31. package/lib/types/client/schedule-zone.d.ts +47 -0
  32. package/lib/types/client/seats.d.ts +18 -0
  33. package/lib/types/client/service.d.ts +32 -0
  34. package/lib/types/client/settings-form.d.ts +16 -0
  35. package/lib/types/core/controller.d.ts +38 -1
  36. package/lib/types/core/degraded-reason.d.ts +46 -0
  37. package/lib/types/core/extension.d.ts +283 -0
  38. package/lib/types/core/handover.d.ts +13 -1
  39. package/lib/types/core/issue-form.d.ts +16 -0
  40. package/lib/types/core/package-name.d.ts +9 -0
  41. package/lib/types/core/schedule.d.ts +95 -20
  42. package/lib/types/core/subtask.d.ts +30 -11
  43. package/lib/types/core/tasks.d.ts +110 -5
  44. package/lib/types/core/use-cases/task-create.d.ts +2 -1
  45. package/lib/types/core/use-cases/task-schedule.d.ts +8 -4
  46. package/lib/types/core/use-cases/task-tag.d.ts +48 -0
  47. package/lib/types/core/use-cases/task-update.d.ts +5 -3
  48. package/lib/types/core/verification.d.ts +386 -0
  49. package/lib/types/core/workspace-target.d.ts +41 -0
  50. package/lib/types/host/agent-tools.d.ts +1 -1
  51. package/lib/types/host/extension-registry.d.ts +111 -0
  52. package/lib/types/host/llm-dispatch.d.ts +63 -0
  53. package/lib/types/host/verification-gate.d.ts +71 -0
  54. package/lib/types/host/verification-runner.d.ts +108 -0
  55. package/lib/types/host/workspace-evidence.d.ts +53 -0
  56. package/lib/types/host-ledger.d.ts +107 -11
  57. package/lib/types/host-runner.d.ts +99 -4
  58. package/lib/types/host-service.d.ts +114 -2
  59. package/lib/types/index.d.ts +80 -26
  60. package/lib/types/protocol.d.ts +53 -3
  61. package/lib/types/tool-surface.d.ts +71 -0
  62. package/package.json +27 -26
  63. package/src/client/PluginSettingsCard.tsx +9 -0
  64. package/src/client/TaskBoardSettingsCard.tsx +304 -65
  65. package/src/client/board/ClampedMarkdown.tsx +69 -0
  66. package/src/client/board/ConfirmDialog.tsx +7 -3
  67. package/src/client/board/EditTaskModal.tsx +5 -2
  68. package/src/client/board/LinkSubtaskModal.tsx +30 -15
  69. package/src/client/board/NewTaskModal.tsx +288 -151
  70. package/src/client/board/TagManagerModal.tsx +235 -0
  71. package/src/client/board/TaskBoard.tsx +259 -103
  72. package/src/client/board/TaskCard.tsx +238 -86
  73. package/src/client/board/TaskDetail.tsx +154 -59
  74. package/src/client/board/TaskForm.tsx +61 -6
  75. package/src/client/board/VerificationReport.tsx +203 -0
  76. package/src/client/board/card-view.ts +220 -0
  77. package/src/client/board/icons.tsx +89 -0
  78. package/src/client/board/overlay.tsx +189 -0
  79. package/src/client/board/preset-label.ts +44 -0
  80. package/src/client/board/status-key.ts +27 -0
  81. package/src/client/board/task-markdown.module.css +137 -0
  82. package/src/client/board/task-markdown.tsx +106 -0
  83. package/src/client/board-card-seat.ts +102 -0
  84. package/src/client/board-settings.module.css +66 -0
  85. package/src/client/board.module.css +602 -68
  86. package/src/client/host-api.ts +109 -6
  87. package/src/client/index.ts +48 -6
  88. package/src/client/locales.ts +290 -12
  89. package/src/client/native-panel.tsx +18 -2
  90. package/src/client/schedule-zone.ts +135 -0
  91. package/src/client/seats.tsx +58 -0
  92. package/src/client/service.ts +94 -0
  93. package/src/client/settings-card.module.css +31 -5
  94. package/src/client/settings-form.ts +27 -1
  95. package/src/core/controller.ts +101 -5
  96. package/src/core/degraded-reason.ts +81 -0
  97. package/src/core/extension.ts +376 -0
  98. package/src/core/freeze-snapshot.ts +2 -2
  99. package/src/core/handover.ts +16 -1
  100. package/src/core/issue-form.ts +19 -0
  101. package/src/core/package-name.ts +9 -0
  102. package/src/core/schedule.ts +211 -55
  103. package/src/core/store.ts +26 -1
  104. package/src/core/subtask.ts +77 -22
  105. package/src/core/tasks.ts +138 -10
  106. package/src/core/use-cases/task-create.ts +14 -2
  107. package/src/core/use-cases/task-parent.ts +3 -2
  108. package/src/core/use-cases/task-schedule.ts +17 -6
  109. package/src/core/use-cases/task-tag.ts +110 -0
  110. package/src/core/use-cases/task-update.ts +13 -4
  111. package/src/core/verification.ts +826 -0
  112. package/src/core/workspace-target.ts +59 -0
  113. package/src/host/agent-tools.ts +58 -24
  114. package/src/host/extension-registry.ts +509 -0
  115. package/src/host/llm-dispatch.ts +87 -0
  116. package/src/host/verification-gate.ts +331 -0
  117. package/src/host/verification-runner.ts +535 -0
  118. package/src/host/workspace-evidence.ts +176 -0
  119. package/src/host-ai.ts +15 -9
  120. package/src/host-ledger.ts +342 -51
  121. package/src/host-routes.ts +15 -2
  122. package/src/host-runner.ts +219 -20
  123. package/src/host-service.ts +346 -26
  124. package/src/index.ts +204 -16
  125. package/src/protocol.ts +122 -9
  126. package/src/tool-surface.ts +95 -0
  127. package/lib/types/host/run-guarded.d.ts +0 -39
  128. package/src/host/run-guarded.ts +0 -76
@@ -0,0 +1,95 @@
1
+ // Generated by scripts/sync-shared.mjs from shared/host/tool-surface.ts. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs".
2
+ /**
3
+ * Family-shared tool-surface conventions for the packages that register
4
+ * model-facing tools.
5
+ *
6
+ * One home for the prompt-section placement and the visibility gate this
7
+ * family previously restated per package.
8
+ *
9
+ * Modelled on the official tool packages:
10
+ * - `@deepseek-ai/dsh-tool-subagent` renders its section through
11
+ * `tools.get(name, context.scope) === undefined ? '' : text`, so guidance
12
+ * disappears together with a restricted tool.
13
+ * - 21 of the 22 official tool packages register their tools GLOBALLY and gate
14
+ * them with a setting, not per agent. Only the Agent Teams tool package —
15
+ * whose tools belong to one membership — installs into each `agent.ctx`.
16
+ * This family follows the majority: registration stays global so the
17
+ * registry's per-scope `restrict()` mask (which filters inherited global
18
+ * tools and REJECTS scope-local names) can still withhold these tools.
19
+ *
20
+ * Structural types only: this copy lands in packages that do not all depend on
21
+ * the same SDK service packages.
22
+ */
23
+
24
+ /**
25
+ * Prompt-section order for each package's tool guidance.
26
+ *
27
+ * These sit in the family band between the deployment persona and the SDK's
28
+ * `PLAN_POLICY` (500). Values are owned here rather than written per package so
29
+ * the host plugins whose guidance shares one prompt cannot drift into an
30
+ * accidental tie.
31
+ */
32
+ export const PLUGIN_TOOL_SECTION_ORDERS = {
33
+ ssh: 150,
34
+ 'task-board': 200,
35
+ } as const
36
+
37
+ /** One plugin id keyed by {@link PLUGIN_TOOL_SECTION_ORDERS}. */
38
+ export type PluginToolSectionId = keyof typeof PLUGIN_TOOL_SECTION_ORDERS
39
+
40
+ /**
41
+ * Order of an external provider extension's own guidance section, right after
42
+ * the band of the plugin it extends.
43
+ *
44
+ * An extension names itself, not the plugin it plugs into, so its order stays
45
+ * out of {@link PLUGIN_TOOL_SECTION_ORDERS}: every package's copy of this module
46
+ * then carries no provider id. The slot still has one owner and cannot collide
47
+ * with a host plugin's band.
48
+ */
49
+ export const EXTENSION_TOOL_SECTION_ORDER = 210
50
+
51
+ /**
52
+ * The scoped tool lookup a section provider needs: the registry read for one
53
+ * assembly's scope. Matches `ctx.tools.get(name, scope)`.
54
+ */
55
+ export interface ScopedToolLookup {
56
+ get(name: string, scope?: unknown): unknown
57
+ }
58
+
59
+ /** One assembly context carrying the scope the section is rendered for. */
60
+ export interface SectionScopeContext {
61
+ scope?: unknown
62
+ }
63
+
64
+ /**
65
+ * Build a section provider that renders \`text\` only while at least one of
66
+ * \`toolNames\` is visible to the rendering scope.
67
+ *
68
+ * The native convention: a tool that a restriction, a preset, or a missing
69
+ * registry removed must not leave guidance behind telling the model to call it.
70
+ * An unreadable registry renders the text unchanged — guidance that outlives a
71
+ * momentary read failure is recoverable; guidance for a tool that is gone is
72
+ * not.
73
+ * @param tools - the scoped tool registry, when the deployment serves one.
74
+ * @param toolNames - registered names the guidance describes.
75
+ * @param text - the guidance rendered while they are reachable.
76
+ * @returns the section text provider.
77
+ */
78
+ export function visibleToolText(
79
+ tools: ScopedToolLookup | undefined,
80
+ toolNames: readonly string[],
81
+ text: string,
82
+ ): (context: SectionScopeContext) => string {
83
+ if (tools === undefined) return () => text
84
+ return (context: SectionScopeContext) => {
85
+ for (const name of toolNames) {
86
+ try {
87
+ if (tools.get(name, context.scope) !== undefined) return text
88
+ } catch {
89
+ // A refused lookup is not proof the tool is gone; keep the guidance.
90
+ return text
91
+ }
92
+ }
93
+ return ''
94
+ }
95
+ }
@@ -1,39 +0,0 @@
1
- /**
2
- * Async-boundary guard shared by the plugin family's Host halves: every
3
- * fire-and-forget promise chain and callback the host runtime does not own
4
- * (route handlers, timers, event listeners, spawned work) funnels through
5
- * these helpers. The dsh host installs a process-level fail-loud guard that
6
- * turns ANY unhandled promise rejection into a whole-process exit — one
7
- * plugin's stray rejection would otherwise take every plugin down. These
8
- * helpers exist so that failure mode is structurally impossible in family
9
- * code: the rejection becomes a logged error at the plugin boundary instead.
10
- *
11
- * Complements the aggregate's shell isolation (packages/dsh-web-all): the
12
- * shell contains import/activation failures at boot; runGuarded contains
13
- * run-time failures after activation.
14
- * @module dsh-web-shared/host/run-guarded
15
- */
16
- /**
17
- * Run one async operation, logging (never propagating) a rejection. Use for
18
- * promises whose lifecycle the caller does not await: spawned work, retry
19
- * loops, background flushes. Returns the original promise so callers can
20
- * still chain when they want to.
21
- * @param promise - the work to shield; any thenable.
22
- * @param label - log prefix naming the work site.
23
- * @param log - error sink; defaults to console.error.
24
- * @returns the input promise (rejection already consumed).
25
- */
26
- export declare function runGuarded<T>(promise: PromiseLike<T>, label: string, log?: (error: unknown) => void): PromiseLike<T>;
27
- /**
28
- * Wrap one callback so every invocation is individually guarded: a rejection
29
- * inside one call is logged and swallowed instead of escaping into whatever
30
- * infrastructure invoked the callback (HTTP server, EventEmitter, interval).
31
- * Sync throws are caught identically; a returned promise is replaced by
32
- * `undefined` after guarding (callers that need the original rejection should
33
- * await inside their own try/catch instead).
34
- * @param label - log prefix naming the callback site.
35
- * @param handler - the work to guard.
36
- * @param log - error sink; defaults to console.error.
37
- * @returns a wrapped callback with the same parameter list.
38
- */
39
- export declare function guardedHandler<A extends unknown[]>(label: string, handler: (...args: A) => unknown, log?: (error: unknown) => void): (...args: A) => unknown;
@@ -1,76 +0,0 @@
1
- // Generated by scripts/sync-shared.mjs from shared/host/run-guarded.ts. Do not edit this copy; edit the shared source and run "node scripts/sync-shared.mjs".
2
- /**
3
- * Async-boundary guard shared by the plugin family's Host halves: every
4
- * fire-and-forget promise chain and callback the host runtime does not own
5
- * (route handlers, timers, event listeners, spawned work) funnels through
6
- * these helpers. The dsh host installs a process-level fail-loud guard that
7
- * turns ANY unhandled promise rejection into a whole-process exit — one
8
- * plugin's stray rejection would otherwise take every plugin down. These
9
- * helpers exist so that failure mode is structurally impossible in family
10
- * code: the rejection becomes a logged error at the plugin boundary instead.
11
- *
12
- * Complements the aggregate's shell isolation (packages/dsh-web-all): the
13
- * shell contains import/activation failures at boot; runGuarded contains
14
- * run-time failures after activation.
15
- * @module dsh-web-shared/host/run-guarded
16
- */
17
-
18
- /** Format one failure line for logging. */
19
- function formatFailure(label: string, error: unknown): Error {
20
- return new Error(`[${label}] unhandled async failure: ${error instanceof Error ? error.stack ?? error.message : String(error)}`)
21
- }
22
-
23
- /**
24
- * Run one async operation, logging (never propagating) a rejection. Use for
25
- * promises whose lifecycle the caller does not await: spawned work, retry
26
- * loops, background flushes. Returns the original promise so callers can
27
- * still chain when they want to.
28
- * @param promise - the work to shield; any thenable.
29
- * @param label - log prefix naming the work site.
30
- * @param log - error sink; defaults to console.error.
31
- * @returns the input promise (rejection already consumed).
32
- */
33
- export function runGuarded<T>(promise: PromiseLike<T>, label: string, log: (error: unknown) => void = console.error): PromiseLike<T> {
34
- void Promise.resolve(promise).catch(error => {
35
- log(formatFailure(label, error))
36
- })
37
- return promise
38
- }
39
-
40
- /**
41
- * Wrap one callback so every invocation is individually guarded: a rejection
42
- * inside one call is logged and swallowed instead of escaping into whatever
43
- * infrastructure invoked the callback (HTTP server, EventEmitter, interval).
44
- * Sync throws are caught identically; a returned promise is replaced by
45
- * `undefined` after guarding (callers that need the original rejection should
46
- * await inside their own try/catch instead).
47
- * @param label - log prefix naming the callback site.
48
- * @param handler - the work to guard.
49
- * @param log - error sink; defaults to console.error.
50
- * @returns a wrapped callback with the same parameter list.
51
- */
52
- export function guardedHandler<A extends unknown[]>(
53
- label: string,
54
- handler: (...args: A) => unknown,
55
- log: (error: unknown) => void = console.error,
56
- ): (...args: A) => unknown {
57
- return (...args: A) => {
58
- try {
59
- const result = handler(...args)
60
- if (isPromiseLike(result)) {
61
- void Promise.resolve(result).catch(error => {
62
- log(formatFailure(label, error))
63
- })
64
- return undefined
65
- }
66
- return result
67
- } catch (error) {
68
- log(formatFailure(label, error))
69
- return undefined
70
- }
71
- }
72
- }
73
-
74
- function isPromiseLike(value: unknown): value is PromiseLike<unknown> {
75
- return typeof value === 'object' && value !== null && typeof (value as PromiseLike<unknown>).then === 'function'
76
- }