@linxin666/dsh-client-ui-task-board 0.4.22 → 0.4.23
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 +6 -6
- package/README.zh.md +6 -6
- package/lib/client.js +410 -37
- package/lib/client.js.map +1 -1
- package/lib/index.js +45 -27
- package/lib/types/client/TaskBoardSettingsCard.d.ts +1 -1
- package/lib/types/client/board/NewTaskModal.d.ts +4 -2
- package/lib/types/client/board/TaskBoard.d.ts +16 -1
- package/lib/types/client/board/model-options.d.ts +2 -2
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/locales.d.ts +3 -0
- package/lib/types/client/native-panel.d.ts +19 -1
- package/lib/types/client/session-activity.d.ts +36 -0
- package/lib/types/client/user-message-action.d.ts +46 -0
- package/lib/types/core/controller.d.ts +16 -0
- package/lib/types/core/model-catalog.d.ts +1 -1
- package/lib/types/dsh-home.d.ts +13 -3
- package/lib/types/host-routes.d.ts +2 -6
- package/lib/types/tool-surface.d.ts +6 -2
- package/package.json +33 -33
- package/src/client/TaskBoardSettingsCard.tsx +2 -2
- package/src/client/board/NewTaskModal.tsx +8 -6
- package/src/client/board/TaskBoard.tsx +59 -13
- package/src/client/board/model-options.ts +18 -8
- package/src/client/board.module.css +32 -0
- package/src/client/index.ts +31 -19
- package/src/client/locales.ts +6 -0
- package/src/client/native-panel.tsx +85 -5
- package/src/client/session-activity.tsx +163 -0
- package/src/client/user-message-action.tsx +211 -0
- package/src/core/controller.ts +30 -0
- package/src/core/model-catalog.ts +1 -1
- package/src/dsh-home.ts +35 -12
- package/src/host/agent-tools.ts +8 -0
- package/src/host-routes.ts +7 -16
- package/src/host-runner.ts +4 -4
- package/src/host-service.ts +6 -1
- package/src/index.ts +2 -3
- package/src/tool-surface.ts +17 -2
package/src/host/agent-tools.ts
CHANGED
|
@@ -315,6 +315,7 @@ export function buildTaskBoardTools(host: TaskBoardToolHost): ToolDefinition[] {
|
|
|
315
315
|
function buildSetParentTool(host: TaskBoardToolHost): ToolDefinition {
|
|
316
316
|
return defineTool({
|
|
317
317
|
name: 'task_board_set_parent',
|
|
318
|
+
environment: 'independent',
|
|
318
319
|
description: [
|
|
319
320
|
'Attach an existing task under a parent (making it a subtask) or detach it back to the root board by setting its parentId.',
|
|
320
321
|
'Pass an empty parentId to detach.',
|
|
@@ -346,6 +347,7 @@ function buildSetParentTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
346
347
|
function buildRunTool(host: TaskBoardToolHost): ToolDefinition {
|
|
347
348
|
return defineTool({
|
|
348
349
|
name: 'task_board_run',
|
|
350
|
+
environment: 'independent',
|
|
349
351
|
description: [
|
|
350
352
|
'Run a task on the board now, or re-run a settled one.',
|
|
351
353
|
'Running a card opens ONE session for that card: no session is opened for its subtasks, and the card agent dispatches them itself with subagent. A card whose subtasks are still unfinished runs under the liangshen agent preset and is told which cards to pick up.',
|
|
@@ -405,6 +407,7 @@ function buildRunTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
405
407
|
function buildManageTool(host: TaskBoardToolHost): ToolDefinition {
|
|
406
408
|
return defineTool({
|
|
407
409
|
name: 'task_board_manage',
|
|
410
|
+
environment: 'independent',
|
|
408
411
|
description: [
|
|
409
412
|
'Move, archive, restore, delete, or settle one task board card.',
|
|
410
413
|
'move-backlog, move-todo, move-running, move-done and move-failed are the manual column moves and cover every column; a card the runner is executing (one with an open execution) cannot be moved.',
|
|
@@ -504,6 +507,7 @@ function buildManageTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
504
507
|
function buildScheduleTool(host: TaskBoardToolHost): ToolDefinition {
|
|
505
508
|
return defineTool({
|
|
506
509
|
name: 'task_board_schedule',
|
|
510
|
+
environment: 'independent',
|
|
507
511
|
description: [
|
|
508
512
|
'Arm, change, or disarm a task scheduled runs. Two kinds of plan exist: a recurring 5-field cron rule (day-of-month and day-of-week follow Vixie semantics: both restricted means OR, otherwise AND), and a one-shot that runs once at a future instant.',
|
|
509
513
|
'For a one-shot pass mode "once" with at (the planned instant, ms since epoch UTC). For a recurring rule pass mode "cron" (or omit mode) with a cron expression, optionally capped by maxRuns (a positive whole number of scheduled executions; omit for unlimited, pass 0 to clear a cap).',
|
|
@@ -566,6 +570,7 @@ function buildScheduleTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
566
570
|
function buildListTool(host: TaskBoardToolHost): ToolDefinition {
|
|
567
571
|
return defineTool({
|
|
568
572
|
name: 'task_board_list',
|
|
573
|
+
environment: 'independent',
|
|
569
574
|
description: [
|
|
570
575
|
'List tasks on the DSH task board (the Host-authoritative ledger behind the Web GUI task board).',
|
|
571
576
|
'Filters: status column, parentId (direct subtasks), rootsOnly, tag, free-text query, and archived inclusion.',
|
|
@@ -613,6 +618,7 @@ function buildListTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
613
618
|
function buildGetTool(host: TaskBoardToolHost): ToolDefinition {
|
|
614
619
|
return defineTool({
|
|
615
620
|
name: 'task_board_get',
|
|
621
|
+
environment: 'independent',
|
|
616
622
|
description: [
|
|
617
623
|
'Read one task board card in full: prompt, description, labels, column, parent link, direct subtasks, execution targets, schedule, permission gate state, and the last ten execution attempts with their session ids and outcomes.',
|
|
618
624
|
'Use it before running or editing a card, after a run to read the settled outcome, and to read each subtask card before dispatching it with subagent.',
|
|
@@ -635,6 +641,7 @@ function buildGetTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
635
641
|
function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
636
642
|
return defineTool({
|
|
637
643
|
name: 'task_board_create',
|
|
644
|
+
environment: 'independent',
|
|
638
645
|
description: [
|
|
639
646
|
'Create a task on the DSH task board, or a subtask by passing parentId.',
|
|
640
647
|
'A subtask inherits every execution target it does not override (workspace, agent preset, permission, model, reasoning effort) from its parent, and inherits the parent human permission confirmation together with an inherited binding.',
|
|
@@ -727,6 +734,7 @@ function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
727
734
|
function buildUpdateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
728
735
|
return defineTool({
|
|
729
736
|
name: 'task_board_update',
|
|
737
|
+
environment: 'independent',
|
|
730
738
|
description: [
|
|
731
739
|
'Edit a task board card: title, description, prompt, labels, and the execution targets (workspace, agent preset, permission, model, reasoning effort, session reuse).',
|
|
732
740
|
'Only the fields you pass change; pass an empty string to clear a target, or an empty labels array to clear the labels.',
|
package/src/host-routes.ts
CHANGED
|
@@ -39,15 +39,13 @@ export const TASK_BOARD_PROXY_TOKEN_HEADER = 'x-dsh-task-board-proxy-token'
|
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* The composition's Host connection service, narrowed to the one check the
|
|
42
|
-
* board bridges: `
|
|
43
|
-
* the authority-bound `dsh-auth-*` browser session minted by the Host.
|
|
44
|
-
* answers `undefined` only for a request it admits and 401/403 otherwise.
|
|
42
|
+
* board bridges: `admit` runs the Host/Origin fence and verifies
|
|
43
|
+
* the authority-bound `dsh-auth-*` browser session minted by the Host.
|
|
45
44
|
* Declared structurally, like the official open-in-app routes do, because the
|
|
46
45
|
* service's package is a browser-side dependency this Host half does not
|
|
47
46
|
* import.
|
|
48
47
|
*/
|
|
49
48
|
export interface TaskBoardConnectionTrust {
|
|
50
|
-
requestRejection?(request: { readonly headers: IncomingMessage['headers'] }): 401 | 403 | undefined
|
|
51
49
|
admit?(request: { readonly headers: IncomingMessage['headers'] }): {
|
|
52
50
|
readonly peer?: unknown
|
|
53
51
|
readonly rejection?: 401 | 403
|
|
@@ -230,21 +228,15 @@ function matchesToken(candidate: string | string[] | undefined, expected: string
|
|
|
230
228
|
*/
|
|
231
229
|
export function isTrustedTaskBoardRequest(req: IncomingMessage, access: ResolvedRouteAccess): boolean {
|
|
232
230
|
const connection = access.connection?.()
|
|
233
|
-
if (connection !== undefined) {
|
|
234
|
-
//
|
|
235
|
-
// shape answers `requestRejection`, the post-#8266 shape answers `admit`,
|
|
236
|
-
// and `admit` reaches into `connection.authentication`, which throws when
|
|
231
|
+
if (connection !== undefined && typeof connection.admit === 'function') {
|
|
232
|
+
// `admit` reaches into `connection.authentication`, which throws when
|
|
237
233
|
// the calling fiber does not inject it. A bridge that cannot answer is not
|
|
238
234
|
// an admission decision: it must keep the fence below instead of escaping
|
|
239
235
|
// as a handler error (the Host answers a throwing handler with a bare 400,
|
|
240
236
|
// which the panel can only render as an unreadable response).
|
|
241
237
|
try {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (admission.rejection === undefined && 'peer' in admission && admission.peer !== undefined) return true
|
|
245
|
-
} else if (typeof connection.requestRejection === 'function' && connection.requestRejection(req) === undefined) {
|
|
246
|
-
return true
|
|
247
|
-
}
|
|
238
|
+
const admission = connection.admit(req)
|
|
239
|
+
if (admission.rejection === undefined && 'peer' in admission && admission.peer !== undefined) return true
|
|
248
240
|
} catch {
|
|
249
241
|
// Fall through to the pre-existing loopback / proxy fence.
|
|
250
242
|
}
|
|
@@ -544,8 +536,7 @@ export function makeTaskBoardRoutes(
|
|
|
544
536
|
}
|
|
545
537
|
// Task board routes enforce their own Host/Origin, DSH connection, and
|
|
546
538
|
// paired-device trust fence and must stay reachable when webServer defaults routes to auth: 'required'.
|
|
547
|
-
type AuthAwareWebRoute = WebRoute & { readonly auth?: 'anonymous' | 'required' | 'deny' }
|
|
548
539
|
return [state, action, events, parse, modelCatalog, attachmentUpload, attachmentImage].map(
|
|
549
|
-
(route):
|
|
540
|
+
(route): WebRoute => ({ ...route, auth: 'anonymous' }),
|
|
550
541
|
)
|
|
551
542
|
}
|
package/src/host-runner.ts
CHANGED
|
@@ -428,8 +428,8 @@ function nonCompletedTurnEnd(data: unknown): string | undefined {
|
|
|
428
428
|
*/
|
|
429
429
|
function invokeWireArgs(namespace: string, method: string, request: Record<string, unknown>): Record<string, unknown> {
|
|
430
430
|
if (namespace === 'agentPresets' && method === 'list') return {}
|
|
431
|
-
//
|
|
432
|
-
if (namespace === '
|
|
431
|
+
// models/catalog declares zero parameters, so its args must be {}.
|
|
432
|
+
if (namespace === 'models' && method === 'catalog') return {}
|
|
433
433
|
if (namespace === 'session' && method === 'list') return { _request: request }
|
|
434
434
|
return { request }
|
|
435
435
|
}
|
|
@@ -839,9 +839,9 @@ export class HostExecutionRunner {
|
|
|
839
839
|
*/
|
|
840
840
|
async modelCatalog(): Promise<unknown> {
|
|
841
841
|
try {
|
|
842
|
-
return await this.invoke('
|
|
842
|
+
return await this.invoke('models', 'catalog', {})
|
|
843
843
|
} catch (error) {
|
|
844
|
-
console.warn('[dsh-task-board]
|
|
844
|
+
console.warn('[dsh-task-board] models/catalog failed; the board falls back to the pinned route', error)
|
|
845
845
|
return undefined
|
|
846
846
|
}
|
|
847
847
|
}
|
package/src/host-service.ts
CHANGED
|
@@ -1209,7 +1209,12 @@ export class TaskBoardHostService {
|
|
|
1209
1209
|
*/
|
|
1210
1210
|
private onScheduleFire(target: number): void {
|
|
1211
1211
|
if (this.disposed || !this.active) return
|
|
1212
|
-
|
|
1212
|
+
// The timer covers the instant it was armed for: a callback that reads the
|
|
1213
|
+
// wall clock a hair before its target (early timer tick, coarse clock) must
|
|
1214
|
+
// still deliver that occurrence. Left at this.now() alone, dueSchedules()
|
|
1215
|
+
// would see a not-yet-due rule and the re-arm would skip a nextRunAt that
|
|
1216
|
+
// is already in the past, stranding the rule for good.
|
|
1217
|
+
const now = Math.max(this.now(), target)
|
|
1213
1218
|
this.scheduleTarget = undefined
|
|
1214
1219
|
this.ledger.setScheduler({ lastTickAt: now })
|
|
1215
1220
|
if (now - target > RECOVERY_TOLERANCE_MS) {
|
package/src/index.ts
CHANGED
|
@@ -311,7 +311,7 @@ export function resolveConnectionTrust(ctx: Context): TaskBoardConnectionTrust |
|
|
|
311
311
|
try {
|
|
312
312
|
const connection = ctx.get('connection') as Partial<TaskBoardConnectionTrust> | undefined
|
|
313
313
|
if (connection === undefined || connection === null) return undefined
|
|
314
|
-
return typeof connection.admit === 'function'
|
|
314
|
+
return typeof connection.admit === 'function'
|
|
315
315
|
? connection as TaskBoardConnectionTrust
|
|
316
316
|
: undefined
|
|
317
317
|
} catch {
|
|
@@ -723,8 +723,7 @@ function applyImpl(ctx: Context, config?: Config): void {
|
|
|
723
723
|
* \"connection.authentication\" without inject", which escaped every route
|
|
724
724
|
* handler as a bare 400. The scope keeps the row's own inject list unchanged
|
|
725
725
|
* (the service stays optional: a deployment without it keeps the loopback
|
|
726
|
-
* fence)
|
|
727
|
-
* simply never activates this scope, leaving the `requestRejection` bridge.
|
|
726
|
+
* fence).
|
|
728
727
|
*/
|
|
729
728
|
let admittedConnection: TaskBoardConnectionTrust | undefined
|
|
730
729
|
const scopedInjectConnection = (ctx as { inject?: (names: readonly string[], callback: (scoped: Context) => unknown) => unknown }).inject
|
package/src/tool-surface.ts
CHANGED
|
@@ -63,11 +63,15 @@ export interface SectionScopeContext {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* Build a section provider that renders
|
|
67
|
-
*
|
|
66
|
+
* Build a section provider that renders `text` only while at least one of
|
|
67
|
+
* `toolNames` is visible to the rendering scope.
|
|
68
68
|
*
|
|
69
69
|
* The native convention: a tool that a restriction, a preset, or a missing
|
|
70
70
|
* registry removed must not leave guidance behind telling the model to call it.
|
|
71
|
+
* Under a 0.2.3-alpha.3+ PTC root registry (`PtcToolRegistry`), `tools.get(name,
|
|
72
|
+
* scope)` exposes only the `run_code` transport while binding registered tools
|
|
73
|
+
* inside programs; when `run_code` is active in the rendering scope, fall back
|
|
74
|
+
* to checking the unscoped registry so guidance does not vanish under PTC.
|
|
71
75
|
* An unreadable registry renders the text unchanged — guidance that outlives a
|
|
72
76
|
* momentary read failure is recoverable; guidance for a tool that is gone is
|
|
73
77
|
* not.
|
|
@@ -91,6 +95,17 @@ export function visibleToolText(
|
|
|
91
95
|
return text
|
|
92
96
|
}
|
|
93
97
|
}
|
|
98
|
+
if (context.scope !== undefined && toolNames.length > 0) {
|
|
99
|
+
try {
|
|
100
|
+
if (tools.get('run_code', context.scope) !== undefined) {
|
|
101
|
+
for (const name of toolNames) {
|
|
102
|
+
if (tools.get(name) !== undefined) return text
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} catch {
|
|
106
|
+
return text
|
|
107
|
+
}
|
|
108
|
+
}
|
|
94
109
|
return ''
|
|
95
110
|
}
|
|
96
111
|
}
|