@linxin666/dsh-client-ui-task-board 0.4.7 → 0.4.9
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 +29 -22
- package/README.zh.md +29 -22
- package/lib/client.js +1553 -670
- package/lib/client.js.map +1 -1
- package/lib/index.js +757 -419
- package/lib/types/client/PluginSettingsCard.d.ts +60 -0
- package/lib/types/client/TaskBoardSettingsCard.d.ts +14 -0
- package/lib/types/client/board/ExecutionLog.d.ts +16 -0
- package/lib/types/client/board/TaskForm.d.ts +4 -0
- package/lib/types/client/board/VerificationReport.d.ts +2 -15
- package/lib/types/client/body-mutations.d.ts +45 -0
- package/lib/types/client/locales.d.ts +44 -6
- package/lib/types/client/suppress-schedule-row.d.ts +86 -0
- package/lib/types/client/telemetry.d.ts +14 -2
- package/lib/types/core/controller.d.ts +1 -1
- package/lib/types/core/execution-summary.d.ts +52 -0
- package/lib/types/core/extension.d.ts +34 -0
- package/lib/types/core/spend-budget.d.ts +28 -0
- package/lib/types/core/subtask.d.ts +59 -49
- package/lib/types/core/tasks.d.ts +37 -9
- package/lib/types/core/use-cases/task-update.d.ts +1 -1
- package/lib/types/core/workspace-target.d.ts +23 -3
- package/lib/types/host/launch-admission.d.ts +8 -9
- package/lib/types/host-ledger.d.ts +96 -50
- package/lib/types/host-routes.d.ts +49 -0
- package/lib/types/host-runner.d.ts +24 -11
- package/lib/types/host-service.d.ts +38 -50
- package/lib/types/host-spend.d.ts +52 -0
- package/lib/types/index.d.ts +70 -61
- package/lib/types/loopback.d.ts +41 -1
- package/lib/types/protocol.d.ts +0 -5
- package/lib/types/tool-surface.d.ts +1 -0
- package/package.json +25 -25
- package/src/client/CardDefaultPresetField.tsx +1 -1
- package/src/client/PluginSettingsCard.tsx +140 -20
- package/src/client/TaskBoardSettingsCard.tsx +104 -24
- package/src/client/board/ExecutionLog.tsx +140 -0
- package/src/client/board/LinkSubtaskModal.tsx +1 -9
- package/src/client/board/NewTaskModal.tsx +2 -11
- package/src/client/board/TaskCard.tsx +45 -23
- package/src/client/board/TaskDetail.tsx +407 -261
- package/src/client/board/TaskForm.tsx +19 -4
- package/src/client/board/VerificationReport.tsx +143 -104
- package/src/client/board/task-markdown.module.css +11 -8
- package/src/client/board-settings.module.css +35 -7
- package/src/client/board.module.css +855 -115
- package/src/client/body-mutations.ts +133 -0
- package/src/client/index.ts +10 -0
- package/src/client/locales.ts +101 -24
- package/src/client/settings-card.module.css +141 -11
- package/src/client/suppress-schedule-row.ts +198 -0
- package/src/client/telemetry.ts +47 -2
- package/src/core/controller.ts +1 -3
- package/src/core/execution-summary.ts +96 -0
- package/src/core/extension.ts +34 -0
- package/src/core/spend-budget.ts +35 -0
- package/src/core/store.ts +4 -0
- package/src/core/subtask.ts +81 -76
- package/src/core/tasks.ts +48 -10
- package/src/core/use-cases/task-update.ts +1 -3
- package/src/core/workspace-target.ts +27 -3
- package/src/host/agent-tools.ts +14 -15
- package/src/host/launch-admission.ts +8 -9
- package/src/host-ledger.ts +218 -127
- package/src/host-routes.ts +65 -2
- package/src/host-runner.ts +68 -35
- package/src/host-service.ts +136 -132
- package/src/host-spend.ts +105 -0
- package/src/index.ts +115 -104
- package/src/loopback.ts +57 -1
- package/src/protocol.ts +2 -9
- package/src/tool-surface.ts +1 -0
- package/lib/types/client/board/team-run-promotion.d.ts +0 -26
- package/src/client/board/team-run-promotion.ts +0 -39
|
@@ -5,9 +5,19 @@
|
|
|
5
5
|
* as siblings of the built-in Shell / Agent loop / Web search cards. */
|
|
6
6
|
|
|
7
7
|
.card {
|
|
8
|
+
/* The card's local scale: every literal below reads one of these, and the
|
|
9
|
+
nested density overrides the same seven on the same element, so one rule
|
|
10
|
+
set serves both densities. */
|
|
11
|
+
--settings-card-radius: 12px;
|
|
12
|
+
--settings-card-header-pad: 16px;
|
|
13
|
+
--settings-card-header-gap: 13px;
|
|
14
|
+
--settings-card-title-size: 15px;
|
|
15
|
+
--settings-card-description-size: 13px;
|
|
16
|
+
--settings-card-body-inset: 16px;
|
|
17
|
+
--settings-card-motion: 0.18s;
|
|
8
18
|
border: 1px solid var(--dsw-alias-border-l2);
|
|
9
19
|
background: var(--dsw-alias-bg-layer-3);
|
|
10
|
-
border-radius:
|
|
20
|
+
border-radius: var(--settings-card-radius);
|
|
11
21
|
list-style: none;
|
|
12
22
|
transition: border-color 0.16s, background 0.16s;
|
|
13
23
|
}
|
|
@@ -21,6 +31,24 @@
|
|
|
21
31
|
border-color: var(--dsw-alias-label-dimmed);
|
|
22
32
|
}
|
|
23
33
|
|
|
34
|
+
/* Nested density: a topic card inside another card's body. It overrides the
|
|
35
|
+
local scale only, so the first-level card and this one stay one rule set. */
|
|
36
|
+
.cardNested {
|
|
37
|
+
--settings-card-radius: 10px;
|
|
38
|
+
--settings-card-header-pad: 10px 12px;
|
|
39
|
+
--settings-card-header-gap: 10px;
|
|
40
|
+
--settings-card-title-size: 13px;
|
|
41
|
+
--settings-card-description-size: 12px;
|
|
42
|
+
--settings-card-body-inset: 12px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* One line: the header already carries the full sentence on its title. */
|
|
46
|
+
.cardNested .description {
|
|
47
|
+
white-space: nowrap;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
}
|
|
51
|
+
|
|
24
52
|
.header {
|
|
25
53
|
appearance: none;
|
|
26
54
|
width: 100%;
|
|
@@ -34,10 +62,10 @@
|
|
|
34
62
|
cursor: pointer;
|
|
35
63
|
background: transparent;
|
|
36
64
|
border: 0;
|
|
37
|
-
border-radius:
|
|
65
|
+
border-radius: var(--settings-card-radius);
|
|
38
66
|
align-items: center;
|
|
39
|
-
gap:
|
|
40
|
-
padding:
|
|
67
|
+
gap: var(--settings-card-header-gap);
|
|
68
|
+
padding: var(--settings-card-header-pad);
|
|
41
69
|
display: flex;
|
|
42
70
|
}
|
|
43
71
|
|
|
@@ -49,10 +77,10 @@
|
|
|
49
77
|
.headerStatic {
|
|
50
78
|
width: 100%;
|
|
51
79
|
box-sizing: border-box;
|
|
52
|
-
border-radius:
|
|
80
|
+
border-radius: var(--settings-card-radius);
|
|
53
81
|
align-items: center;
|
|
54
|
-
gap:
|
|
55
|
-
padding:
|
|
82
|
+
gap: var(--settings-card-header-gap);
|
|
83
|
+
padding: var(--settings-card-header-pad);
|
|
56
84
|
display: flex;
|
|
57
85
|
}
|
|
58
86
|
|
|
@@ -85,7 +113,7 @@
|
|
|
85
113
|
|
|
86
114
|
.name {
|
|
87
115
|
color: var(--dsw-alias-label-primary);
|
|
88
|
-
font-size:
|
|
116
|
+
font-size: var(--settings-card-title-size);
|
|
89
117
|
font-weight: 600;
|
|
90
118
|
line-height: 1.4;
|
|
91
119
|
}
|
|
@@ -95,7 +123,7 @@
|
|
|
95
123
|
print leave 12-13px hint text below readable contrast (orca-link #778399
|
|
96
124
|
on cream measures ~3.4:1). */
|
|
97
125
|
color: var(--dsw-alias-label-secondary);
|
|
98
|
-
font-size:
|
|
126
|
+
font-size: var(--settings-card-description-size);
|
|
99
127
|
line-height: 1.5;
|
|
100
128
|
}
|
|
101
129
|
|
|
@@ -111,6 +139,14 @@
|
|
|
111
139
|
line-height: 17px;
|
|
112
140
|
}
|
|
113
141
|
|
|
142
|
+
/* Header trailing control (an immediate toggle): a flex item that keeps its
|
|
143
|
+
natural width while the title block takes the remaining space. */
|
|
144
|
+
.headerAction {
|
|
145
|
+
flex: none;
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
}
|
|
149
|
+
|
|
114
150
|
.chevron {
|
|
115
151
|
color: var(--dsw-alias-label-tertiary);
|
|
116
152
|
flex: none;
|
|
@@ -127,9 +163,36 @@
|
|
|
127
163
|
transform: rotate(180deg);
|
|
128
164
|
}
|
|
129
165
|
|
|
166
|
+
/* Body disclosure. One transition pair drives both legs: the wrapper
|
|
167
|
+
animates 0fr -> 1fr and back, the body is its only item and shrinks into the
|
|
168
|
+
collapsed track. Only the moving states clip, so a settled card never cuts
|
|
169
|
+
off a field's popup. */
|
|
170
|
+
.disclosure {
|
|
171
|
+
display: grid;
|
|
172
|
+
grid-template-rows: 0fr;
|
|
173
|
+
opacity: 0;
|
|
174
|
+
transition: grid-template-rows var(--settings-card-motion) ease, opacity var(--settings-card-motion) ease;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.disclosure[data-state='collapsed'],
|
|
178
|
+
.disclosure[data-state='entering'],
|
|
179
|
+
.disclosure[data-state='closing'] {
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.disclosure[data-state='entering'],
|
|
184
|
+
.disclosure[data-state='shown'] {
|
|
185
|
+
grid-template-rows: 1fr;
|
|
186
|
+
opacity: 1;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.disclosure > .body {
|
|
190
|
+
min-height: 0;
|
|
191
|
+
}
|
|
192
|
+
|
|
130
193
|
.body {
|
|
131
194
|
border-top: 1px solid var(--dsw-alias-border-l2);
|
|
132
|
-
margin: 0
|
|
195
|
+
margin: 0 var(--settings-card-body-inset);
|
|
133
196
|
padding-bottom: 8px;
|
|
134
197
|
}
|
|
135
198
|
|
|
@@ -428,6 +491,65 @@
|
|
|
428
491
|
line-height: 1.5;
|
|
429
492
|
}
|
|
430
493
|
|
|
494
|
+
/* Immediate boolean toggle: the official switch shape (30x16 track, 12px
|
|
495
|
+
thumb). The on state fills with the primary-action pair rather than a fixed
|
|
496
|
+
state color, so it stays legible in every theme; disabled dims through
|
|
497
|
+
opacity instead of a second palette. */
|
|
498
|
+
.toggle {
|
|
499
|
+
appearance: none;
|
|
500
|
+
display: inline-flex;
|
|
501
|
+
align-items: center;
|
|
502
|
+
background: transparent;
|
|
503
|
+
border: 0;
|
|
504
|
+
border-radius: 999px;
|
|
505
|
+
margin: 0;
|
|
506
|
+
padding: 0;
|
|
507
|
+
cursor: pointer;
|
|
508
|
+
font: inherit;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.toggleTrack {
|
|
512
|
+
position: relative;
|
|
513
|
+
flex: none;
|
|
514
|
+
width: 30px;
|
|
515
|
+
height: 16px;
|
|
516
|
+
border-radius: 999px;
|
|
517
|
+
/* Off must still read as a rail: border-l2 is an alpha hairline color and
|
|
518
|
+
leaves the track nearly invisible on a card surface. */
|
|
519
|
+
background: var(--dsw-alias-label-dimmed);
|
|
520
|
+
transition: background 0.18s ease;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.toggleThumb {
|
|
524
|
+
position: absolute;
|
|
525
|
+
top: 2px;
|
|
526
|
+
left: 2px;
|
|
527
|
+
width: 12px;
|
|
528
|
+
height: 12px;
|
|
529
|
+
border-radius: 50%;
|
|
530
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
531
|
+
transition: left 0.18s ease;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.toggle[aria-checked='true'] .toggleTrack {
|
|
535
|
+
background: var(--dsw-alias-button-primary-fill, var(--dsw-alias-label-primary));
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.toggle[aria-checked='true'] .toggleThumb {
|
|
539
|
+
left: 16px;
|
|
540
|
+
background: var(--dsw-alias-label-primary-foreground, var(--dsw-alias-bg-layer-3));
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.toggle:focus-visible {
|
|
544
|
+
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
545
|
+
outline-offset: 2px;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.toggle:disabled {
|
|
549
|
+
opacity: 0.45;
|
|
550
|
+
cursor: default;
|
|
551
|
+
}
|
|
552
|
+
|
|
431
553
|
@media (prefers-reduced-motion: reduce) {
|
|
432
554
|
.card,
|
|
433
555
|
.header,
|
|
@@ -438,7 +560,15 @@
|
|
|
438
560
|
.save,
|
|
439
561
|
.selectChevron,
|
|
440
562
|
.selectChevronOpen,
|
|
441
|
-
.selectPopup
|
|
563
|
+
.selectPopup,
|
|
564
|
+
.toggleTrack,
|
|
565
|
+
.toggleThumb {
|
|
442
566
|
transition: none;
|
|
443
567
|
}
|
|
568
|
+
|
|
569
|
+
/* Reduced motion drops the height travel but keeps the fade, so a closing
|
|
570
|
+
body still leaves through the leg its own state started. */
|
|
571
|
+
.disclosure {
|
|
572
|
+
transition-property: opacity;
|
|
573
|
+
}
|
|
444
574
|
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hide the official automation-tasks entry while the board is on.
|
|
3
|
+
*
|
|
4
|
+
* The shell mounts two scheduling surfaces side by side in the sidebar: the
|
|
5
|
+
* official `ui-schedule` client half ("Automation tasks" — the Host Schedule
|
|
6
|
+
* service's own page) and this package's board ("Task board" — a Host ledger
|
|
7
|
+
* that runs real DSH sessions). The board is the family's complete surface, so
|
|
8
|
+
* while it is enabled the official row is hidden and the sidebar offers one
|
|
9
|
+
* scheduling entry instead of two.
|
|
10
|
+
*
|
|
11
|
+
* The shell owns that row: it renders the button, the label, the tooltip, the
|
|
12
|
+
* active highlight and the collapsed rail, and the host's own end-to-end suite
|
|
13
|
+
* addresses the row by its accessible name. The row is therefore located the
|
|
14
|
+
* same way — the shell's global panel list seat (`sidebar.panellist`), whose
|
|
15
|
+
* per-row anchor the slot renderer stamps — and it is identified by the label
|
|
16
|
+
* the shell itself resolves for that entry (`resolveSlotLabel`, exactly the
|
|
17
|
+
* call the shell's panel projection makes), so the match follows the active
|
|
18
|
+
* language instead of a hard-coded translation.
|
|
19
|
+
*
|
|
20
|
+
* The write is one inline `display: none` on the shell's own button: the row
|
|
21
|
+
* stays mounted (React keeps owning it) and the official panel keeps working
|
|
22
|
+
* everywhere else it is reachable — only the duplicate sidebar entry goes
|
|
23
|
+
* away. The board's master switch owns the state, exactly as it owns the
|
|
24
|
+
* board's own row: with the board off, the official row comes back.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { resolveSlotLabel, type StoredEntry } from '@deepseek-ai/dsh-client-ui-slots'
|
|
28
|
+
import { subscribeBodyInvalidations } from './body-mutations.ts'
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The official automation-tasks panel id.
|
|
32
|
+
*
|
|
33
|
+
* The host `ui-schedule` client half registers its sidebar row and its
|
|
34
|
+
* center-column page under this id; the shell's panel projection addresses
|
|
35
|
+
* both by it.
|
|
36
|
+
*/
|
|
37
|
+
export const OFFICIAL_SCHEDULE_PANEL_ID = 'schedules'
|
|
38
|
+
|
|
39
|
+
/** The shell's global panel list seat; every rendered panel row carries one anchor. */
|
|
40
|
+
const PANEL_LIST_SLOT = 'sidebar.panellist'
|
|
41
|
+
|
|
42
|
+
/** The anchor the slot renderer stamps for each global panel row. */
|
|
43
|
+
const PANEL_ROW_ANCHOR = `[data-slot="${PANEL_LIST_SLOT}"]`
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The family's own hook on a plugin-owned panel row.
|
|
47
|
+
*
|
|
48
|
+
* A row carrying it belongs to a plugin that owns its entry, never to the
|
|
49
|
+
* official automation-tasks row, so the guard skips those rows: it must not
|
|
50
|
+
* be able to hide the board's own entry.
|
|
51
|
+
*/
|
|
52
|
+
const PLUGIN_ROW_HOOK = '[data-dsh-panel-entry]'
|
|
53
|
+
|
|
54
|
+
/** The slot-service slice the guard reads. */
|
|
55
|
+
export interface PanelSlotReader {
|
|
56
|
+
entriesOfSlot?(key: string): readonly StoredEntry[]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The context slice the guard needs. */
|
|
60
|
+
export interface ScheduleRowGuardContext {
|
|
61
|
+
slots?: PanelSlotReader
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The live panel-list ledger, or an empty one.
|
|
66
|
+
*
|
|
67
|
+
* A context that serves no slot registry (a capture-only test context, or a
|
|
68
|
+
* shell that never declared the seat) has no official row to hide, and the
|
|
69
|
+
* guard must read that as "nothing to do" instead of failing the page.
|
|
70
|
+
* @param ctx - the client context.
|
|
71
|
+
* @returns the panel-list entries the shell currently projects.
|
|
72
|
+
*/
|
|
73
|
+
function panelEntries(ctx: ScheduleRowGuardContext): readonly StoredEntry[] {
|
|
74
|
+
const reader = ctx.slots
|
|
75
|
+
if (reader === undefined || typeof reader.entriesOfSlot !== 'function') return []
|
|
76
|
+
try {
|
|
77
|
+
return reader.entriesOfSlot(PANEL_LIST_SLOT) ?? []
|
|
78
|
+
} catch {
|
|
79
|
+
return []
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The guard's controls. */
|
|
84
|
+
export interface ScheduleRowGuard {
|
|
85
|
+
/** Hide the official row, and keep it hidden while the board is on. */
|
|
86
|
+
hide(): void
|
|
87
|
+
/** Restore the official row: the board's master switch is off. */
|
|
88
|
+
show(): void
|
|
89
|
+
/** Release the listeners and restore the row. */
|
|
90
|
+
dispose(): void
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The accessible name the shell renders on the official automation-tasks row.
|
|
95
|
+
*
|
|
96
|
+
* The shell projects its panel list with `resolveSlotLabel(options.label) ??
|
|
97
|
+
* id`, and that value becomes the row's accessible name. Reading the same
|
|
98
|
+
* value out of the same ledger is what keeps the DOM match correct in every
|
|
99
|
+
* language.
|
|
100
|
+
* @param entries - the live panel-list ledger.
|
|
101
|
+
* @returns the row's accessible name, or undefined when the official panel is not mounted.
|
|
102
|
+
*/
|
|
103
|
+
export function officialScheduleRowLabel(entries: readonly StoredEntry[]): string | undefined {
|
|
104
|
+
const entry = entries.find(candidate => candidate.options.id === OFFICIAL_SCHEDULE_PANEL_ID)
|
|
105
|
+
if (entry === undefined) return undefined
|
|
106
|
+
try {
|
|
107
|
+
return resolveSlotLabel(entry.options.label) ?? entry.options.id
|
|
108
|
+
} catch {
|
|
109
|
+
// A label thunk that throws must not take the sidebar down with it.
|
|
110
|
+
return undefined
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The shell's button for the panel row carrying this accessible name.
|
|
116
|
+
*
|
|
117
|
+
* Every global panel row renders one slot anchor inside the shell's own
|
|
118
|
+
* button, so the anchor is the row's handle and the button is what the user
|
|
119
|
+
* sees. Rows a plugin owns (they carry the family's own entry hook) are
|
|
120
|
+
* skipped.
|
|
121
|
+
* @param root - the document (or a subtree) to search.
|
|
122
|
+
* @param label - the accessible name to match.
|
|
123
|
+
* @returns the row button, or undefined when no row carries that name.
|
|
124
|
+
*/
|
|
125
|
+
export function findPanelRow(root: ParentNode, label: string): HTMLElement | undefined {
|
|
126
|
+
for (const anchor of root.querySelectorAll(PANEL_ROW_ANCHOR)) {
|
|
127
|
+
if (anchor.querySelector(PLUGIN_ROW_HOOK) !== null) continue
|
|
128
|
+
const button = anchor.closest('button') as HTMLElement | null
|
|
129
|
+
if (button !== null && button.getAttribute('aria-label') === label) return button
|
|
130
|
+
}
|
|
131
|
+
return undefined
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Guard the official automation-tasks row against the board's presence.
|
|
136
|
+
*
|
|
137
|
+
* The guard hides the row while the board is enabled and restores it when the
|
|
138
|
+
* board is switched off. It re-applies its write after every DOM change,
|
|
139
|
+
* because the shell owns the row and may mount or replace it at any time (a
|
|
140
|
+
* re-render, a panel-list change, the official plugin arriving late).
|
|
141
|
+
* @param ctx - client context carrying the slot registry.
|
|
142
|
+
* @param root - the document to search; defaults to the ambient one.
|
|
143
|
+
* @returns the guard's controls.
|
|
144
|
+
*/
|
|
145
|
+
export function createScheduleRowGuard(ctx: ScheduleRowGuardContext, root?: ParentNode): ScheduleRowGuard {
|
|
146
|
+
const scope = root ?? (typeof document === 'undefined' ? undefined : document)
|
|
147
|
+
let hidden: HTMLElement | undefined
|
|
148
|
+
let previousDisplay: string | null = null
|
|
149
|
+
let stopWatching: (() => void) | undefined
|
|
150
|
+
|
|
151
|
+
const restoreRow = (): void => {
|
|
152
|
+
if (hidden === undefined) return
|
|
153
|
+
const button = hidden
|
|
154
|
+
hidden = undefined
|
|
155
|
+
if (previousDisplay === null) button.style.removeProperty('display')
|
|
156
|
+
else button.style.setProperty('display', previousDisplay)
|
|
157
|
+
previousDisplay = null
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const hideRow = (): void => {
|
|
161
|
+
if (scope === undefined) return
|
|
162
|
+
const label = officialScheduleRowLabel(panelEntries(ctx))
|
|
163
|
+
if (label === undefined) return
|
|
164
|
+
const button = findPanelRow(scope, label)
|
|
165
|
+
if (button === undefined) return
|
|
166
|
+
if (hidden === button) return
|
|
167
|
+
restoreRow()
|
|
168
|
+
hidden = button
|
|
169
|
+
previousDisplay = button.style.getPropertyValue('display')
|
|
170
|
+
// The shell's own row rule sets a display value, so the write has to beat
|
|
171
|
+
// it: an inline declaration outranks any author rule that is not itself
|
|
172
|
+
// important, and the important flag also survives a skin's own overrides.
|
|
173
|
+
button.style.setProperty('display', 'none', 'important')
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const sync = (): void => {
|
|
177
|
+
// A replaced row is a new element: the old write died with it.
|
|
178
|
+
if (hidden !== undefined && !hidden.isConnected) restoreRow()
|
|
179
|
+
hideRow()
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const hide = (): void => {
|
|
183
|
+
hideRow()
|
|
184
|
+
if (stopWatching === undefined) {
|
|
185
|
+
// The page-wide hub: one body observer for every family consumer, and
|
|
186
|
+
// the row is re-hidden after whatever the shell did to the DOM.
|
|
187
|
+
stopWatching = subscribeBodyInvalidations(sync)
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const show = (): void => {
|
|
192
|
+
stopWatching?.()
|
|
193
|
+
stopWatching = undefined
|
|
194
|
+
restoreRow()
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return { hide, show, dispose: show }
|
|
198
|
+
}
|
package/src/client/telemetry.ts
CHANGED
|
@@ -7,8 +7,12 @@
|
|
|
7
7
|
* The payload carries no conversation data and no identifiers beyond a random
|
|
8
8
|
* UUID generated in localStorage; the server hashes it with a deployment salt
|
|
9
9
|
* before storage and never persists IP addresses. Sends are fire-and-forget:
|
|
10
|
-
* failures stay silent and simply retry on a later mount or day.
|
|
11
|
-
* is
|
|
10
|
+
* failures stay silent and simply retry on a later mount or day. Frames where
|
|
11
|
+
* storage is unavailable report nothing.
|
|
12
|
+
*
|
|
13
|
+
* The family-wide opt-out and the browser's Do Not Track signal both suppress
|
|
14
|
+
* the heartbeat; the Web Plugins settings switch writes the same localStorage
|
|
15
|
+
* key. The system is documented in docs/telemetry.md.
|
|
12
16
|
*/
|
|
13
17
|
|
|
14
18
|
export type TelemetryChannel = 'market' | 'npm' | 'unknown'
|
|
@@ -22,6 +26,9 @@ export interface TelemetryItem {
|
|
|
22
26
|
channel?: TelemetryChannel
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
/** localStorage key carrying the family-wide telemetry opt-out ('1' = off). */
|
|
30
|
+
export const TELEMETRY_OPT_OUT_KEY = 'dsh-web-ui-telemetry-opt-out'
|
|
31
|
+
|
|
25
32
|
const VISITOR_KEY = 'dsh-web-ui-telemetry-visitor'
|
|
26
33
|
const DAY_KEY_PREFIX = 'dsh-web-ui-telemetry-day:'
|
|
27
34
|
const ENDPOINT = 'https://dsh-market.com/api/telemetry/event'
|
|
@@ -41,6 +48,41 @@ function bakedVersion(): string | undefined {
|
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
|
|
51
|
+
/** Whether the user switched the family-wide opt-out on (reads storage only). */
|
|
52
|
+
export function isTelemetryOptedOut(): boolean {
|
|
53
|
+
try {
|
|
54
|
+
return localStorage.getItem(TELEMETRY_OPT_OUT_KEY) === '1'
|
|
55
|
+
} catch {
|
|
56
|
+
// Storage unavailable: there is no stored opt-out to honour.
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Turn the family-wide opt-out on or off (writing '1' / removing the key); never throws. */
|
|
62
|
+
export function setTelemetryOptedOut(optedOut: boolean): void {
|
|
63
|
+
try {
|
|
64
|
+
if (optedOut) localStorage.setItem(TELEMETRY_OPT_OUT_KEY, '1')
|
|
65
|
+
else localStorage.removeItem(TELEMETRY_OPT_OUT_KEY)
|
|
66
|
+
} catch {
|
|
67
|
+
// Storage unavailable: the preference cannot be persisted on this machine.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Whether the browser itself asks not to be tracked; a failed read means no signal. */
|
|
72
|
+
function doNotTrackRequested(): boolean {
|
|
73
|
+
try {
|
|
74
|
+
// '1' per the DNT header spec, 'yes' from older Firefox builds.
|
|
75
|
+
return navigator.doNotTrack === '1' || navigator.doNotTrack === 'yes'
|
|
76
|
+
} catch {
|
|
77
|
+
return false
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Whether a heartbeat must be suppressed right now: opt-out stored, or the browser asks not to be tracked. */
|
|
82
|
+
export function isTelemetrySuppressed(): boolean {
|
|
83
|
+
return isTelemetryOptedOut() || doNotTrackRequested()
|
|
84
|
+
}
|
|
85
|
+
|
|
44
86
|
/** Read or lazily create the anonymous visitor id; null when storage is unavailable. */
|
|
45
87
|
function visitorId(): string | null {
|
|
46
88
|
try {
|
|
@@ -74,6 +116,9 @@ function pruneDayKeys(today: string): void {
|
|
|
74
116
|
*/
|
|
75
117
|
export function reportDailyHeartbeat(items: readonly TelemetryItem[]): void {
|
|
76
118
|
try {
|
|
119
|
+
// First guard: a stored opt-out or the browser's Do Not Track stops every
|
|
120
|
+
// read below from minting an id, marking the day, or reaching the network.
|
|
121
|
+
if (isTelemetrySuppressed()) return
|
|
77
122
|
if (items.length === 0) return
|
|
78
123
|
const today = new Date().toISOString().slice(0, 10)
|
|
79
124
|
// Automation contexts (CDP-driven QA browsers, fresh isolated profiles)
|
package/src/core/controller.ts
CHANGED
|
@@ -152,7 +152,7 @@ export interface ExecutionOptionsSnapshot {
|
|
|
152
152
|
* (revision/scheduler/power); a full snapshot also carries the deployment
|
|
153
153
|
* constants the UI reads (session default permission, subtask depth).
|
|
154
154
|
*/
|
|
155
|
-
export type HostMirror = Pick<TaskBoardSnapshot, 'revision' | 'scheduler' | 'power' | 'sessionDefaultPermission' | 'maxSubtaskDepth' | '
|
|
155
|
+
export type HostMirror = Pick<TaskBoardSnapshot, 'revision' | 'scheduler' | 'power' | 'sessionDefaultPermission' | 'maxSubtaskDepth' | 'goalRunEnabled' | 'cardDefaults' | 'extensions'>
|
|
156
156
|
|
|
157
157
|
/** Immutable controller snapshot for UI subscriptions. */
|
|
158
158
|
export interface ControllerSnapshot {
|
|
@@ -842,7 +842,6 @@ export class BoardController {
|
|
|
842
842
|
private mirrorOf(snapshot: TaskBoardSnapshot): HostMirror {
|
|
843
843
|
const sessionDefaultPermission = snapshot.sessionDefaultPermission ?? this.hostState?.sessionDefaultPermission
|
|
844
844
|
const maxSubtaskDepth = snapshot.maxSubtaskDepth ?? this.hostState?.maxSubtaskDepth
|
|
845
|
-
const teamRunAvailable = snapshot.teamRunAvailable ?? this.hostState?.teamRunAvailable
|
|
846
845
|
const goalRunEnabled = snapshot.goalRunEnabled ?? this.hostState?.goalRunEnabled
|
|
847
846
|
// The new-card defaults are NOT carried over: the Host publishes a target
|
|
848
847
|
// nothing configures by omitting it (protocol.ts states that explicitly), so
|
|
@@ -857,7 +856,6 @@ export class BoardController {
|
|
|
857
856
|
power: snapshot.power,
|
|
858
857
|
...(sessionDefaultPermission === undefined ? {} : { sessionDefaultPermission }),
|
|
859
858
|
...(maxSubtaskDepth === undefined ? {} : { maxSubtaskDepth }),
|
|
860
|
-
...(teamRunAvailable === undefined ? {} : { teamRunAvailable }),
|
|
861
859
|
...(goalRunEnabled === undefined ? {} : { goalRunEnabled }),
|
|
862
860
|
...(cardDefaults === undefined ? {} : { cardDefaults }),
|
|
863
861
|
...(extensions === undefined ? {} : { extensions }),
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one execution left behind: the text of its last assistant message,
|
|
3
|
+
* recorded on the execution record next to the verdict it belongs to.
|
|
4
|
+
*
|
|
5
|
+
* A settled execution used to carry only a verdict, so a parent card could see
|
|
6
|
+
* that a subtask succeeded without ever seeing what it produced, and had to
|
|
7
|
+
* guess or redo the work. The card's own content cannot answer that: card
|
|
8
|
+
* content is the plan and freezes at the first execution
|
|
9
|
+
* (`canEditTaskContent`), so the closing words of a run are recorded on the
|
|
10
|
+
* execution record instead.
|
|
11
|
+
*
|
|
12
|
+
* Pure (no cordis, no runtime imports) so the settlement path is unit-testable
|
|
13
|
+
* without a session, and so a text-less run degrades to "no field" rather than
|
|
14
|
+
* to an empty string.
|
|
15
|
+
*/
|
|
16
|
+
import { EXECUTION_SUMMARY_LIMIT, type ExecutionSummary } from './tasks.ts'
|
|
17
|
+
|
|
18
|
+
/** Structural view of one session event, as both readers expose it. */
|
|
19
|
+
export interface SummaryEvent {
|
|
20
|
+
type?: unknown
|
|
21
|
+
seq?: unknown
|
|
22
|
+
time?: unknown
|
|
23
|
+
data?: unknown
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** One rendered content block of an assistant message, or '' when it has no prose. */
|
|
27
|
+
function blockProse(block: unknown): string {
|
|
28
|
+
if (typeof block !== 'object' || block === null) return ''
|
|
29
|
+
const row = block as Record<string, unknown>
|
|
30
|
+
// Only prose: reasoning and tool traffic are the acceptance evidence's job,
|
|
31
|
+
// and a summary that opened with a tool call would bury the conclusion.
|
|
32
|
+
return row.type === 'text' && typeof row.text === 'string' ? row.text : ''
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The assistant's own prose of one message: its text blocks joined and trimmed. */
|
|
36
|
+
function messageProse(content: unknown): string {
|
|
37
|
+
if (!Array.isArray(content)) return ''
|
|
38
|
+
return content.map(blockProse).filter(part => part !== '').join('\n').trim()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Bound one summary, keeping its tail: the closing paragraphs carry the
|
|
43
|
+
* conclusion a reader is after, and the omitted opening is announced instead of
|
|
44
|
+
* silently dropped. Mirrors the evidence reader's tail bound.
|
|
45
|
+
*/
|
|
46
|
+
export function truncateExecutionSummary(text: string, limit = EXECUTION_SUMMARY_LIMIT): string {
|
|
47
|
+
if (text.length <= limit) return text
|
|
48
|
+
const notice = '[truncated ' + String(text.length - limit) + ' chars] '
|
|
49
|
+
return notice.length >= limit ? text.slice(-limit) : notice + text.slice(-(limit - notice.length))
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The summary one execution's own events support.
|
|
54
|
+
*
|
|
55
|
+
* Only events at or after `startedAt` belong to this run: a reused session
|
|
56
|
+
* carries the history of earlier executions, which must not be reported as this
|
|
57
|
+
* one's output. The last assistant message WITH prose wins — a trailing
|
|
58
|
+
* tool-call or reasoning-only message has nothing to leave behind, so the reader
|
|
59
|
+
* walks back to the last one that speaks.
|
|
60
|
+
* @param events - the session events the inspection already read.
|
|
61
|
+
* @param startedAt - the execution's start instant (ms epoch); 0 means "all".
|
|
62
|
+
* @returns the bounded summary with the seq it came from, or undefined when the
|
|
63
|
+
* run left no usable text.
|
|
64
|
+
*/
|
|
65
|
+
export function executionSummaryOf(events: readonly SummaryEvent[], startedAt: number): ExecutionSummary | undefined {
|
|
66
|
+
const own = events
|
|
67
|
+
.filter(event => typeof event.time !== 'number' || startedAt <= 0 || event.time >= startedAt)
|
|
68
|
+
.filter(event => event.type === 'assistant/message' && typeof event.seq === 'number')
|
|
69
|
+
.sort((a, b) => (a.seq as number) - (b.seq as number))
|
|
70
|
+
for (let index = own.length - 1; index >= 0; index -= 1) {
|
|
71
|
+
const event = own[index]
|
|
72
|
+
const data = typeof event.data === 'object' && event.data !== null ? event.data as Record<string, unknown> : {}
|
|
73
|
+
const message = typeof data.message === 'object' && data.message !== null ? data.message as Record<string, unknown> : {}
|
|
74
|
+
const text = messageProse(message.content)
|
|
75
|
+
if (text === '') continue
|
|
76
|
+
return { text: truncateExecutionSummary(text), seq: event.seq as number }
|
|
77
|
+
}
|
|
78
|
+
return undefined
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Repair one persisted or reported summary.
|
|
83
|
+
*
|
|
84
|
+
* A summary is informational, so an unreadable one is dropped on its own rather
|
|
85
|
+
* than costing the execution (or the task row) it hangs on. A hand-edited
|
|
86
|
+
* overlong text is bounded on the way in, so no reader ever holds more than the
|
|
87
|
+
* limit.
|
|
88
|
+
*/
|
|
89
|
+
export function normalizeExecutionSummary(value: unknown): ExecutionSummary | undefined {
|
|
90
|
+
if (typeof value !== 'object' || value === null) return undefined
|
|
91
|
+
const row = value as Record<string, unknown>
|
|
92
|
+
if (typeof row.text !== 'string' || typeof row.seq !== 'number' || !Number.isFinite(row.seq)) return undefined
|
|
93
|
+
const text = row.text.trim()
|
|
94
|
+
if (text === '') return undefined
|
|
95
|
+
return { text: truncateExecutionSummary(text), seq: row.seq }
|
|
96
|
+
}
|
package/src/core/extension.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* @module dsh-task-board/core/extension
|
|
13
13
|
*/
|
|
14
14
|
import type { ToolDefinition } from '@deepseek-ai/dsh-tools'
|
|
15
|
+
import type { TaskBoardAction, TaskBoardSnapshot, TaskBoardVerificationOptions } from '../protocol.ts'
|
|
15
16
|
import type { ExecutionOutcome, TaskRecord, TaskStatus } from './tasks.ts'
|
|
16
17
|
|
|
17
18
|
/** Cordis service name the host and browser halves each publish. */
|
|
@@ -338,6 +339,39 @@ export interface TaskBoardHostFace {
|
|
|
338
339
|
registerExtension(extension: TaskBoardExtension): () => void
|
|
339
340
|
/** Whether the board currently runs a given extension (board x extension). */
|
|
340
341
|
isExtensionEnabled(extensionId: string): boolean
|
|
342
|
+
/**
|
|
343
|
+
* The whole ledger as the board builds it, tasks included.
|
|
344
|
+
*
|
|
345
|
+
* Part of the read/write face an IN-PROCESS consumer drives the board through
|
|
346
|
+
* (the remote bridge plugin forwarding it to a paired phone); a browser half
|
|
347
|
+
* reads the same document over the board's own HTTP surface. Forwards
|
|
348
|
+
* {@link ../host-service.ts | TaskBoardHostService.snapshot}, so nothing is
|
|
349
|
+
* interpreted between the ledger and the caller.
|
|
350
|
+
*/
|
|
351
|
+
snapshot(): TaskBoardSnapshot
|
|
352
|
+
/**
|
|
353
|
+
* Apply one action through every gate the board already has — the running
|
|
354
|
+
* lock, the permission confirmation, the subtask depth, the schedule budget —
|
|
355
|
+
* and answer the resulting snapshot.
|
|
356
|
+
*
|
|
357
|
+
* The `requestId` is the ledger's own idempotency key, so a caller that
|
|
358
|
+
* retries one envelope does not apply it twice. Refusals are the ledger's:
|
|
359
|
+
* they throw with the Host's own text, which is why this face adds no code
|
|
360
|
+
* table of its own.
|
|
361
|
+
*/
|
|
362
|
+
apply(requestId: string, action: TaskBoardAction, initiator?: string): TaskBoardSnapshot | Promise<TaskBoardSnapshot>
|
|
363
|
+
/**
|
|
364
|
+
* Follow the board's change notifications. The listener receives no payload —
|
|
365
|
+
* a consumer that needs the state reads {@link snapshot} — and the returned
|
|
366
|
+
* disposer unsubscribes.
|
|
367
|
+
*/
|
|
368
|
+
subscribe(listener: () => void): () => void
|
|
369
|
+
/**
|
|
370
|
+
* The acceptance settings, the contract they resolve to right now, and the
|
|
371
|
+
* model catalog the choices come from. The same document the board's own
|
|
372
|
+
* `/verification` route serves.
|
|
373
|
+
*/
|
|
374
|
+
verificationOptions(): Promise<TaskBoardVerificationOptions>
|
|
341
375
|
}
|
|
342
376
|
|
|
343
377
|
declare module '@deepseek-ai/cordis' {
|