@linxin666/dsh-client-ui-task-board 0.4.15 → 0.4.16

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/lib/index.js CHANGED
@@ -1424,6 +1424,30 @@ function hasOutstandingDescendants(tasks, rootId, maxSubtaskDepth) {
1424
1424
  * applied at launch and never written into a card's `mode` field.
1425
1425
  */
1426
1426
  const LIANGSHEN_PRESET_ID = "liangshen";
1427
+ /**
1428
+ * The tool a legacy Agent Teams runtime registers, and the one fingerprint
1429
+ * this board reads off a deployment: the pre-#7519 generation registers
1430
+ * `spawn_teammate` and replaces `send_message` / `list_agents` /
1431
+ * `interrupt_agent` with team-scoped variants, so children exist but are
1432
+ * unreachable. The current runtime adds a shared task board instead and reuses
1433
+ * the coordination tools, so those three names prove nothing and are never
1434
+ * gated on (the criterion is the same one
1435
+ * `packages/dsh-liangshen/presets/liangshen/dispatcher-rules.mjs` states).
1436
+ */
1437
+ const LEGACY_AGENT_TEAMS_TOOL = "spawn_teammate";
1438
+ /**
1439
+ * The failure text the Host records when a run would have been forced under
1440
+ * the dispatcher preset on a deployment that cannot orchestrate.
1441
+ *
1442
+ * A finished sentence rather than a code (the shape `core/workspace-target.ts`
1443
+ * gives its missing-workspace refusal): the ledger stores it as the
1444
+ * execution's failure text, the agent tools serve it to a model, and any
1445
+ * client prints it verbatim. It names the fix, not the mechanism. The launch
1446
+ * is refused before any session exists, because the dispatcher preset would
1447
+ * otherwise stop and wait for a human reply that an unattended run never
1448
+ * brings.
1449
+ */
1450
+ const LEGACY_AGENT_TEAMS_REASON = "this deployment runs the legacy Agent Teams runtime, which cannot dispatch a card that has unfinished subtasks under the liangshen preset; disable that runtime and restart the Host, or finish the subtasks before running";
1427
1451
  /** The open execution of a task inside a run group, if it still exists. */
1428
1452
  function openGroupExecution(task, runGroupId) {
1429
1453
  return task.executions.find((execution) => execution.runGroupId === runGroupId && execution.endedAt === void 0);
@@ -6787,6 +6811,7 @@ var HostExecutionRunner = class HostExecutionRunner {
6787
6811
  if (preset === void 0 && options.agentPreset !== void 0) throw new Error("agent preset not found: " + mode + " (a card with unfinished subtasks runs under the liangshen preset, which this deployment does not serve)");
6788
6812
  if (preset === void 0) throw new Error("agent preset not found: " + mode);
6789
6813
  if (preset.broken !== void 0) throw new Error("agent preset is unavailable: " + preset.broken);
6814
+ if (options.agentPreset !== void 0 && this.faces.legacyAgentTeams?.() === true) throw new Error(LEGACY_AGENT_TEAMS_REASON);
6790
6815
  }
6791
6816
  const reused = options.reuseSessionId;
6792
6817
  if (reused !== void 0) {
@@ -8347,7 +8372,8 @@ var TaskBoardHostService = class {
8347
8372
  this.attachmentStore = options.attachments ?? (() => void 0);
8348
8373
  this.runner = new HostExecutionRunner(gateway, options.commandDispatcher, options.workspaceRegistry, void 0, options.ownerPeer, {
8349
8374
  attachments: this.attachmentStore,
8350
- llm: options.modelInfo
8375
+ llm: options.modelInfo,
8376
+ ...options.legacyAgentTeams === void 0 ? {} : { legacyAgentTeams: options.legacyAgentTeams }
8351
8377
  });
8352
8378
  this.workspaceRegistry = options.workspaceRegistry;
8353
8379
  this.timers = options.timers ?? PROCESS_TIMERS;
@@ -12465,6 +12491,15 @@ function applyImpl(ctx, config) {
12465
12491
  };
12466
12492
  };
12467
12493
  const ownerPeer = createOwnerPeer(ctx);
12494
+ const legacyAgentTeams = () => {
12495
+ const lookup = lookupOf(resolveToolRegistry(ctx));
12496
+ if (lookup === void 0) return false;
12497
+ try {
12498
+ return lookup.get(LEGACY_AGENT_TEAMS_TOOL) !== void 0;
12499
+ } catch {
12500
+ return false;
12501
+ }
12502
+ };
12468
12503
  const host = new TaskBoardHostService(ctx.typertGateway, {
12469
12504
  workspaceRegistry: ctx.workspaceRegistry,
12470
12505
  ownerPeer,
@@ -12478,6 +12513,7 @@ function applyImpl(ctx, config) {
12478
12513
  verificationCatalog,
12479
12514
  attachments: () => resolveAttachmentStore(ctx),
12480
12515
  modelInfo: () => resolveModelInfoReader(ctx),
12516
+ legacyAgentTeams,
12481
12517
  timers: resolveHostTimers(ctx),
12482
12518
  commandDispatcher: { async execute(sessionId, line, signal) {
12483
12519
  const agent = await resolveExecutionAgent(ctx, sessionId);
@@ -3,6 +3,14 @@ import { type TaskBoardKey } from '../locales.ts';
3
3
  /** Rows shown before the history asks to be expanded. */
4
4
  export declare const VISIBLE_EXECUTIONS = 5;
5
5
  /** Execution outcome → locale key, shared with the history's folded summary. */
6
+ /**
7
+ * A recorded failure text in the reader's own language, for the refusals the
8
+ * board itself produces and can therefore translate. Any other text is the
9
+ * Host's own sentence and is printed verbatim.
10
+ * @param error - the execution's recorded failure text.
11
+ * @returns the localized refusal, or the original text.
12
+ */
13
+ export declare function failureText(error: string): string;
6
14
  export declare const EXECUTION_RESULT_KEY: Record<NonNullable<ExecutionRecord['result']>, TaskBoardKey>;
7
15
  /**
8
16
  * Render one card's execution history.
@@ -195,6 +195,7 @@ export declare const zh: {
195
195
  'status.move.done': string;
196
196
  'status.move.failed': string;
197
197
  'exec.error.noWorkspace': string;
198
+ 'exec.error.legacyAgentTeams': string;
198
199
  'exec.error.promptRejected': string;
199
200
  'run.failed': string;
200
201
  'time.justNow': string;
@@ -119,6 +119,37 @@ export declare function hasOutstandingDescendants(tasks: readonly TaskRecord[],
119
119
  * applied at launch and never written into a card's `mode` field.
120
120
  */
121
121
  export declare const LIANGSHEN_PRESET_ID = "liangshen";
122
+ /**
123
+ * The tool a legacy Agent Teams runtime registers, and the one fingerprint
124
+ * this board reads off a deployment: the pre-#7519 generation registers
125
+ * `spawn_teammate` and replaces `send_message` / `list_agents` /
126
+ * `interrupt_agent` with team-scoped variants, so children exist but are
127
+ * unreachable. The current runtime adds a shared task board instead and reuses
128
+ * the coordination tools, so those three names prove nothing and are never
129
+ * gated on (the criterion is the same one
130
+ * `packages/dsh-liangshen/presets/liangshen/dispatcher-rules.mjs` states).
131
+ */
132
+ export declare const LEGACY_AGENT_TEAMS_TOOL = "spawn_teammate";
133
+ /**
134
+ * The failure text the Host records when a run would have been forced under
135
+ * the dispatcher preset on a deployment that cannot orchestrate.
136
+ *
137
+ * A finished sentence rather than a code (the shape `core/workspace-target.ts`
138
+ * gives its missing-workspace refusal): the ledger stores it as the
139
+ * execution's failure text, the agent tools serve it to a model, and any
140
+ * client prints it verbatim. It names the fix, not the mechanism. The launch
141
+ * is refused before any session exists, because the dispatcher preset would
142
+ * otherwise stop and wait for a human reply that an unattended run never
143
+ * brings.
144
+ */
145
+ export declare const LEGACY_AGENT_TEAMS_REASON: string;
146
+ /**
147
+ * Whether a recorded failure text is the legacy-runtime refusal, which the
148
+ * browser half renders in the reader's own language.
149
+ * @param reason - the execution's recorded failure text.
150
+ * @returns true when that run was refused for a deployment that cannot orchestrate.
151
+ */
152
+ export declare function isLegacyAgentTeamsReason(reason: string): boolean;
122
153
  /**
123
154
  * Whether a card belongs to a run's dispatch set: the card the request named,
124
155
  * or a card whose work is still outstanding. Kept for the browser's subtask
@@ -177,6 +177,15 @@ export interface TaskBoardRuntimeFaces {
177
177
  attachments?: () => TaskBoardAttachmentStore | undefined;
178
178
  /** The model-info reader, or undefined when the deployment serves no model information. */
179
179
  llm?: () => ModelInfoResolver | undefined;
180
+ /**
181
+ * Whether this deployment runs the legacy Agent Teams runtime, read live
182
+ * from the agent tool registry. Absent, or answering false, means the
183
+ * deployment is not PROVEN legacy: the dispatcher preset is then forced as
184
+ * before. Only a positive answer refuses the run, so a deployment whose
185
+ * registry cannot be read keeps its current behaviour instead of losing the
186
+ * ability to dispatch a subtask tree.
187
+ */
188
+ legacyAgentTeams?: () => boolean;
180
189
  }
181
190
  export declare class HostExecutionRunner {
182
191
  private readonly gateway;
@@ -197,6 +197,14 @@ export declare class TaskBoardHostService {
197
197
  * unknown is allowed.
198
198
  */
199
199
  modelInfo?: () => ModelInfoResolver | undefined;
200
+ /**
201
+ * Whether this deployment runs the legacy Agent Teams runtime. Read at
202
+ * launch, only for a run the board is about to force under the dispatcher
203
+ * preset: such a deployment cannot orchestrate, so the run fails closed on
204
+ * the card instead of deadlocking in a session nobody answers (issue #2031).
205
+ * Absent means "not proven legacy", which keeps the force exactly as it is.
206
+ */
207
+ legacyAgentTeams?: () => boolean;
200
208
  });
201
209
  start(): void;
202
210
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linxin666/dsh-client-ui-task-board",
3
3
  "description": "Host-authoritative task board for the DSH Web GUI with real session execution, Host cron scheduling, and optional cross-platform idle-sleep protection; mounted without DSH source changes.",
4
- "version": "0.4.15",
4
+ "version": "0.4.16",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { useId, useState } from 'react'
17
17
  import type { ExecutionRecord } from '../../core/tasks.ts'
18
+ import { isLegacyAgentTeamsReason } from '../../core/subtask.ts'
18
19
  import { isMissingWorkspaceReason } from '../../core/workspace-target.ts'
19
20
  import { t, type TaskBoardKey } from '../locales.ts'
20
21
  import css from '../board.module.css'
@@ -27,6 +28,19 @@ import { VerificationReport } from './VerificationReport.tsx'
27
28
  export const VISIBLE_EXECUTIONS = 5
28
29
 
29
30
  /** Execution outcome → locale key, shared with the history's folded summary. */
31
+ /**
32
+ * A recorded failure text in the reader's own language, for the refusals the
33
+ * board itself produces and can therefore translate. Any other text is the
34
+ * Host's own sentence and is printed verbatim.
35
+ * @param error - the execution's recorded failure text.
36
+ * @returns the localized refusal, or the original text.
37
+ */
38
+ export function failureText(error: string): string {
39
+ if (isMissingWorkspaceReason(error)) return t('exec.error.noWorkspace')
40
+ if (isLegacyAgentTeamsReason(error)) return t('exec.error.legacyAgentTeams')
41
+ return error
42
+ }
43
+
30
44
  export const EXECUTION_RESULT_KEY: Record<NonNullable<ExecutionRecord['result']>, TaskBoardKey> = {
31
45
  succeeded: 'detail.result.succeeded',
32
46
  failed: 'detail.result.failed',
@@ -85,7 +99,7 @@ function ExecutionRow({ execution, timeZone, onOpen }: {
85
99
  {execution.verification !== undefined && <VerificationReport verification={execution.verification} />}
86
100
  {execution.error !== undefined && execution.error !== '' && (
87
101
  <span className={css.executionError}>
88
- {isMissingWorkspaceReason(execution.error) ? t('exec.error.noWorkspace') : execution.error}
102
+ {failureText(execution.error)}
89
103
  </span>
90
104
  )}
91
105
  </div>
@@ -197,6 +197,7 @@ export const zh = {
197
197
  'status.move.done': '移到已完成',
198
198
  'status.move.failed': '移到已失败',
199
199
  'exec.error.noWorkspace': '这张卡没有指定工作区,请先在卡片上选择工作区',
200
+ 'exec.error.legacyAgentTeams': '这张卡有未完成的子任务,需按梁神模式的派发方式执行,但当前部署运行的是 legacy Agent Teams,无法编排;请关闭该 runtime 并重启 Host,或先完成子任务再执行',
200
201
  'exec.error.promptRejected': 'Prompt 被拒绝',
201
202
  'run.failed': '执行失败:{error}',
202
203
  'time.justNow': '刚刚',
@@ -704,6 +705,7 @@ export const en: Record<keyof typeof zh, string> = {
704
705
  'status.move.done': 'Move to Done',
705
706
  'status.move.failed': 'Move to Failed',
706
707
  'exec.error.noWorkspace': 'This card has no workspace pinned; choose one on the card before it can run',
708
+ 'exec.error.legacyAgentTeams': 'This card has unfinished subtasks, which run through the LiangShen dispatcher preset, but this deployment runs the legacy Agent Teams runtime and cannot orchestrate; disable that runtime and restart the Host, or finish the subtasks before running',
707
709
  'exec.error.promptRejected': 'Prompt rejected',
708
710
  'run.failed': 'Run failed: {error}',
709
711
  'time.justNow': 'just now',
@@ -253,6 +253,42 @@ export function hasOutstandingDescendants(
253
253
  */
254
254
  export const LIANGSHEN_PRESET_ID = 'liangshen'
255
255
 
256
+ /**
257
+ * The tool a legacy Agent Teams runtime registers, and the one fingerprint
258
+ * this board reads off a deployment: the pre-#7519 generation registers
259
+ * `spawn_teammate` and replaces `send_message` / `list_agents` /
260
+ * `interrupt_agent` with team-scoped variants, so children exist but are
261
+ * unreachable. The current runtime adds a shared task board instead and reuses
262
+ * the coordination tools, so those three names prove nothing and are never
263
+ * gated on (the criterion is the same one
264
+ * `packages/dsh-liangshen/presets/liangshen/dispatcher-rules.mjs` states).
265
+ */
266
+ export const LEGACY_AGENT_TEAMS_TOOL = 'spawn_teammate'
267
+
268
+ /**
269
+ * The failure text the Host records when a run would have been forced under
270
+ * the dispatcher preset on a deployment that cannot orchestrate.
271
+ *
272
+ * A finished sentence rather than a code (the shape `core/workspace-target.ts`
273
+ * gives its missing-workspace refusal): the ledger stores it as the
274
+ * execution's failure text, the agent tools serve it to a model, and any
275
+ * client prints it verbatim. It names the fix, not the mechanism. The launch
276
+ * is refused before any session exists, because the dispatcher preset would
277
+ * otherwise stop and wait for a human reply that an unattended run never
278
+ * brings.
279
+ */
280
+ export const LEGACY_AGENT_TEAMS_REASON = 'this deployment runs the legacy Agent Teams runtime, which cannot dispatch a card that has unfinished subtasks under the ' + LIANGSHEN_PRESET_ID + ' preset; disable that runtime and restart the Host, or finish the subtasks before running'
281
+
282
+ /**
283
+ * Whether a recorded failure text is the legacy-runtime refusal, which the
284
+ * browser half renders in the reader's own language.
285
+ * @param reason - the execution's recorded failure text.
286
+ * @returns true when that run was refused for a deployment that cannot orchestrate.
287
+ */
288
+ export function isLegacyAgentTeamsReason(reason: string): boolean {
289
+ return reason === LEGACY_AGENT_TEAMS_REASON
290
+ }
291
+
256
292
  /**
257
293
  * Whether a card belongs to a run's dispatch set: the card the request named,
258
294
  * or a card whose work is still outstanding. Kept for the browser's subtask
@@ -3,7 +3,7 @@ import type { InvokeRemoteRequest, TypertGateway } from '@deepseek-ai/dsh-api-ga
3
3
  import type { SessionAddress, SessionHistoryRecord, SessionListValue, SessionPage, SessionSummary } from '@deepseek-ai/dsh-api-session-controller/types'
4
4
  import type { CommandResult } from '@deepseek-ai/dsh-commands/types'
5
5
  import type { Workspace } from '@deepseek-ai/dsh-workspace/types'
6
- import { LIANGSHEN_PRESET_ID } from './core/subtask.ts'
6
+ import { LEGACY_AGENT_TEAMS_REASON, LIANGSHEN_PRESET_ID } from './core/subtask.ts'
7
7
  import { MISSING_WORKSPACE_REASON, mostRecentWorkspaceId } from './core/workspace-target.ts'
8
8
  import { declaredRoute, normalizeReasoningEffort, resolveReasoningEffort, type ReasoningRoute } from './core/reasoning-effort.ts'
9
9
  import type { ModelCatalogView } from './core/verification.ts'
@@ -427,6 +427,15 @@ export interface TaskBoardRuntimeFaces {
427
427
  attachments?: () => TaskBoardAttachmentStore | undefined
428
428
  /** The model-info reader, or undefined when the deployment serves no model information. */
429
429
  llm?: () => ModelInfoResolver | undefined
430
+ /**
431
+ * Whether this deployment runs the legacy Agent Teams runtime, read live
432
+ * from the agent tool registry. Absent, or answering false, means the
433
+ * deployment is not PROVEN legacy: the dispatcher preset is then forced as
434
+ * before. Only a positive answer refuses the run, so a deployment whose
435
+ * registry cannot be read keeps its current behaviour instead of losing the
436
+ * ability to dispatch a subtask tree.
437
+ */
438
+ legacyAgentTeams?: () => boolean
430
439
  }
431
440
 
432
441
  export class HostExecutionRunner {
@@ -553,6 +562,17 @@ export class HostExecutionRunner {
553
562
  }
554
563
  if (preset === undefined) throw new Error('agent preset not found: ' + mode)
555
564
  if (preset.broken !== undefined) throw new Error('agent preset is unavailable: ' + preset.broken)
565
+ // A forced preset is the run's shape, so the deployment must also be
566
+ // able to orchestrate under it: the dispatcher preset's own compatibility
567
+ // gate judges the tool surface at session start and, when the legacy
568
+ // Agent Teams runtime shadows the coordination tools, stops and waits for
569
+ // a human reply. A card with unfinished subtasks may be launched by a
570
+ // schedule, so that reply never comes and the card would sit in running
571
+ // forever (issue #2031). Refuse here instead, with the reason readable on
572
+ // the card, rather than minting a session that can only deadlock.
573
+ if (options.agentPreset !== undefined && this.faces.legacyAgentTeams?.() === true) {
574
+ throw new Error(LEGACY_AGENT_TEAMS_REASON)
575
+ }
556
576
  }
557
577
  // The ledger only ever stores ids minted by this runner (or the roster),
558
578
  // so the brand is reasserted at this boundary instead of re-deriving it.
@@ -370,6 +370,14 @@ export class TaskBoardHostService {
370
370
  * unknown is allowed.
371
371
  */
372
372
  modelInfo?: () => ModelInfoResolver | undefined
373
+ /**
374
+ * Whether this deployment runs the legacy Agent Teams runtime. Read at
375
+ * launch, only for a run the board is about to force under the dispatcher
376
+ * preset: such a deployment cannot orchestrate, so the run fails closed on
377
+ * the card instead of deadlocking in a session nobody answers (issue #2031).
378
+ * Absent means "not proven legacy", which keeps the force exactly as it is.
379
+ */
380
+ legacyAgentTeams?: () => boolean
373
381
  } = {}) {
374
382
  this.ledger = options.ledger ?? new HostTaskLedger(undefined, undefined, {
375
383
  sessionDefaultPermission: options.sessionDefaultPermission,
@@ -382,6 +390,7 @@ export class TaskBoardHostService {
382
390
  this.runner = new HostExecutionRunner(gateway, options.commandDispatcher, options.workspaceRegistry, undefined, options.ownerPeer, {
383
391
  attachments: this.attachmentStore,
384
392
  llm: options.modelInfo,
393
+ ...(options.legacyAgentTeams === undefined ? {} : { legacyAgentTeams: options.legacyAgentTeams }),
385
394
  })
386
395
  this.workspaceRegistry = options.workspaceRegistry
387
396
  this.timers = options.timers ?? PROCESS_TIMERS
package/src/index.ts CHANGED
@@ -21,7 +21,7 @@ import { TaskBoardHostService, type HostTimerFace } from './host-service.ts'
21
21
  import { createOwnerPeer } from './host-runner.ts'
22
22
  import { parseTaskDraft, TaskParseError } from './host-ai.ts'
23
23
  import { TASK_PERMISSIONS, isTaskPermission, type TaskPermission } from './core/tasks.ts'
24
- import { DEFAULT_SUBTASK_DEPTH, SUBTASK_DEPTH_MAX, SUBTASK_DEPTH_MIN } from './core/subtask.ts'
24
+ import { LEGACY_AGENT_TEAMS_TOOL, DEFAULT_SUBTASK_DEPTH, SUBTASK_DEPTH_MAX, SUBTASK_DEPTH_MIN } from './core/subtask.ts'
25
25
  import { DEFAULT_SESSION_POLL_SECONDS, SESSION_POLL_MAX_SECONDS, SESSION_POLL_MIN_SECONDS } from './core/poll-cadence.ts'
26
26
  import { DEFAULT_RUN_LAUNCH_WIDTH, RUN_LAUNCH_WIDTH_MAX, RUN_LAUNCH_WIDTH_MIN } from './core/launch-width.ts'
27
27
  import { DEFAULT_SPEND_BUDGET_TOKENS } from './core/spend-budget.ts'
@@ -714,6 +714,22 @@ function applyImpl(ctx: Context, config?: Config): void {
714
714
  // the board calls as the host-local owner, so its peer is minted on this
715
715
  // fiber and aborts with it (see createOwnerPeer).
716
716
  const ownerPeer = createOwnerPeer(ctx)
717
+ // A deployment that registers the legacy Agent Teams fingerprint cannot
718
+ // orchestrate under the dispatcher preset: the preset's own compatibility
719
+ // gate stops and waits for a human reply, which a scheduled or unattended run
720
+ // never brings (issue #2031). Read at launch, so a runtime mounted after this
721
+ // row is still judged, and read tolerantly: no registry, no lookup half, or a
722
+ // throw all answer false, which keeps today's behaviour rather than refusing
723
+ // cards on a guess.
724
+ const legacyAgentTeams = (): boolean => {
725
+ const lookup = lookupOf(resolveToolRegistry(ctx))
726
+ if (lookup === undefined) return false
727
+ try {
728
+ return lookup.get(LEGACY_AGENT_TEAMS_TOOL) !== undefined
729
+ } catch {
730
+ return false
731
+ }
732
+ }
717
733
  const host = new TaskBoardHostService(ctx.typertGateway, {
718
734
  workspaceRegistry: ctx.workspaceRegistry,
719
735
  ownerPeer,
@@ -727,6 +743,7 @@ function applyImpl(ctx: Context, config?: Config): void {
727
743
  verificationCatalog,
728
744
  attachments: () => resolveAttachmentStore(ctx),
729
745
  modelInfo: () => resolveModelInfoReader(ctx),
746
+ legacyAgentTeams,
730
747
  timers: resolveHostTimers(ctx),
731
748
  commandDispatcher: {
732
749
  async execute(sessionId, line, signal) {