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

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 (62) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +17 -37
  3. package/README.zh.md +17 -37
  4. package/lib/client.js +136 -1347
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +166 -2529
  7. package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -20
  8. package/lib/types/client/board/ExecutionLog.d.ts +8 -0
  9. package/lib/types/client/board/status-key.d.ts +0 -15
  10. package/lib/types/client/locales.d.ts +2 -110
  11. package/lib/types/core/controller.d.ts +1 -1
  12. package/lib/types/core/extension.d.ts +4 -5
  13. package/lib/types/core/model-catalog.d.ts +58 -0
  14. package/lib/types/core/reasoning-effort.d.ts +1 -1
  15. package/lib/types/core/subtask.d.ts +31 -0
  16. package/lib/types/core/tasks.d.ts +0 -45
  17. package/lib/types/core/use-cases/task-update.d.ts +1 -1
  18. package/lib/types/host/llm-dispatch.d.ts +8 -10
  19. package/lib/types/host-ledger.d.ts +0 -28
  20. package/lib/types/host-runner.d.ts +15 -71
  21. package/lib/types/host-service.d.ts +25 -89
  22. package/lib/types/index.d.ts +0 -78
  23. package/lib/types/protocol.d.ts +6 -23
  24. package/package.json +26 -26
  25. package/src/client/TaskBoardSettingsCard.tsx +13 -200
  26. package/src/client/board/ExecutionLog.tsx +17 -6
  27. package/src/client/board/NewTaskModal.tsx +1 -42
  28. package/src/client/board/TaskCard.tsx +2 -7
  29. package/src/client/board/TaskDetail.tsx +2 -37
  30. package/src/client/board/status-key.ts +0 -30
  31. package/src/client/board-settings.module.css +3 -22
  32. package/src/client/board.module.css +1 -104
  33. package/src/client/index.ts +1 -1
  34. package/src/client/locales.ts +8 -224
  35. package/src/core/controller.ts +1 -3
  36. package/src/core/extension.ts +4 -5
  37. package/src/core/model-catalog.ts +114 -0
  38. package/src/core/reasoning-effort.ts +1 -1
  39. package/src/core/store.ts +22 -17
  40. package/src/core/subtask.ts +36 -0
  41. package/src/core/tasks.ts +0 -53
  42. package/src/core/use-cases/task-update.ts +1 -8
  43. package/src/host/agent-tools.ts +1 -15
  44. package/src/host/llm-dispatch.ts +8 -10
  45. package/src/host-ledger.ts +1 -86
  46. package/src/host-routes.ts +4 -4
  47. package/src/host-runner.ts +33 -139
  48. package/src/host-service.ts +60 -266
  49. package/src/index.ts +27 -164
  50. package/src/protocol.ts +8 -43
  51. package/lib/types/client/board/VerificationReport.d.ts +0 -10
  52. package/lib/types/core/verification-budget.d.ts +0 -52
  53. package/lib/types/core/verification.d.ts +0 -753
  54. package/lib/types/host/verification-gate.d.ts +0 -95
  55. package/lib/types/host/verification-runner.d.ts +0 -139
  56. package/lib/types/host/workspace-evidence.d.ts +0 -53
  57. package/src/client/board/VerificationReport.tsx +0 -361
  58. package/src/core/verification-budget.ts +0 -115
  59. package/src/core/verification.ts +0 -1594
  60. package/src/host/verification-gate.ts +0 -487
  61. package/src/host/verification-runner.ts +0 -702
  62. package/src/host/workspace-evidence.ts +0 -176
@@ -3,10 +3,10 @@ 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
- import type { ModelCatalogView } from './core/verification.ts'
9
+ import type { ModelCatalogView } from './core/model-catalog.ts'
10
10
  import type { ExecutionSummary, TaskPermission, TaskRecord } from './core/tasks.ts'
11
11
  import type { TaskAttachment } from './core/attachment.ts'
12
12
  import {
@@ -336,27 +336,6 @@ export function promptText(task: TaskRecord, context: PromptContext = {}): strin
336
336
  return preamble === undefined ? declaration : `${preamble}\n\n${declaration}`
337
337
  }
338
338
 
339
- /**
340
- * The parts of an objective the built-in `/goal` command reads as an operation
341
- * rather than as an objective: an exact `clear`/`pause`/`resume`/`edit`
342
- * (case-insensitive) and a leading `edit <objective>`.
343
- */
344
- const GOAL_COMMAND_KEYWORD = /^(?:clear|pause|resume|edit)$|^edit\s/i
345
-
346
- /**
347
- * Build the objective the built-in `/goal` command receives. A prompt whose
348
- * text would be read as a goal operation is prefixed with a neutral label: the
349
- * instruction stays intact, and the command arms an objective instead of
350
- * clearing, pausing, or editing an unrelated goal (or refusing for a missing
351
- * one).
352
- * @param prompt - the composed execution prompt.
353
- * @returns the objective text for `/goal <objective>`.
354
- */
355
- export function goalObjective(prompt: string): string {
356
- const text = prompt.trim()
357
- return GOAL_COMMAND_KEYWORD.test(text) ? `Goal: ${text}` : text
358
- }
359
-
360
339
  /**
361
340
  * Build the tag section of the execution prompt (issue #1521). Only tags with
362
341
  * a non-blank `promptPrefix` contribute; a task whose tags are all bare names
@@ -427,6 +406,15 @@ export interface TaskBoardRuntimeFaces {
427
406
  attachments?: () => TaskBoardAttachmentStore | undefined
428
407
  /** The model-info reader, or undefined when the deployment serves no model information. */
429
408
  llm?: () => ModelInfoResolver | undefined
409
+ /**
410
+ * Whether this deployment runs the legacy Agent Teams runtime, read live
411
+ * from the agent tool registry. Absent, or answering false, means the
412
+ * deployment is not PROVEN legacy: the dispatcher preset is then forced as
413
+ * before. Only a positive answer refuses the run, so a deployment whose
414
+ * registry cannot be read keeps its current behaviour instead of losing the
415
+ * ability to dispatch a subtask tree.
416
+ */
417
+ legacyAgentTeams?: () => boolean
430
418
  }
431
419
 
432
420
  export class HostExecutionRunner {
@@ -502,25 +490,11 @@ export class HostExecutionRunner {
502
490
  */
503
491
  agentPreset?: string
504
492
  onSession?: (sessionId: string) => void
505
- onGoalArmed?: (armed: boolean) => void
506
- /**
507
- * GLOBAL native /goal switch, resolved by the caller ONCE per execution and
508
- * carried here so the decision is frozen for this launch.
509
- *
510
- * Frozen deliberately: a settings edit made while the run is in flight must
511
- * not arm, disarm or otherwise change the goal/acceptance contract of a run
512
- * already running. Absent means off — the default for every deployment that
513
- * never touched the switch, including cards written before the option
514
- * existed. A plain single turn is what an off switch produces; the task-level
515
- * `goalRun` still applies on top of it (both must ASK for a goal).
516
- */
517
- goalEnabled?: boolean
518
493
  /**
519
494
  * The host model catalog, read ONCE per execution by the caller. The card's
520
495
  * pinned reasoning effort is sent only when this catalog declares it for the
521
- * route the execution runs at, so one snapshot decides both the acceptance
522
- * contract and the effort this run freezes. Absent means "no capability
523
- * evidence": an effort is then not sent at all.
496
+ * route the execution runs at. Absent means "no capability evidence": an
497
+ * effort is then not sent at all.
524
498
  */
525
499
  catalog?: ModelCatalogView
526
500
  } = {}): Promise<string> {
@@ -553,6 +527,17 @@ export class HostExecutionRunner {
553
527
  }
554
528
  if (preset === undefined) throw new Error('agent preset not found: ' + mode)
555
529
  if (preset.broken !== undefined) throw new Error('agent preset is unavailable: ' + preset.broken)
530
+ // A forced preset is the run's shape, so the deployment must also be
531
+ // able to orchestrate under it: the dispatcher preset's own compatibility
532
+ // gate judges the tool surface at session start and, when the legacy
533
+ // Agent Teams runtime shadows the coordination tools, stops and waits for
534
+ // a human reply. A card with unfinished subtasks may be launched by a
535
+ // schedule, so that reply never comes and the card would sit in running
536
+ // forever (issue #2031). Refuse here instead, with the reason readable on
537
+ // the card, rather than minting a session that can only deadlock.
538
+ if (options.agentPreset !== undefined && this.faces.legacyAgentTeams?.() === true) {
539
+ throw new Error(LEGACY_AGENT_TEAMS_REASON)
540
+ }
556
541
  }
557
542
  // The ledger only ever stores ids minted by this runner (or the roster),
558
543
  // so the brand is reasserted at this boundary instead of re-deriving it.
@@ -572,7 +557,7 @@ export class HostExecutionRunner {
572
557
  // at the gate without its binding.
573
558
  options.onSession?.(reused)
574
559
  await this.assertReusedPreset(reused, mode)
575
- await this.pinAndPrompt(reused, task, permission, options.promptContext, options.onGoalArmed, options.goalEnabled === true, options.catalog)
560
+ await this.pinAndPrompt(reused, task, permission, options.promptContext, options.catalog)
576
561
  } catch (error) {
577
562
  throw new SessionLaunchError(reused, error)
578
563
  }
@@ -593,7 +578,7 @@ export class HostExecutionRunner {
593
578
  options.onSession?.(sessionId)
594
579
  try {
595
580
  await this.invoke('session', 'rename', { sessionId, title: task.title })
596
- await this.pinAndPrompt(sessionId, task, permission, options.promptContext, options.onGoalArmed, options.goalEnabled === true, options.catalog)
581
+ await this.pinAndPrompt(sessionId, task, permission, options.promptContext, options.catalog)
597
582
  } catch (error) {
598
583
  throw new SessionLaunchError(sessionId, error)
599
584
  }
@@ -707,8 +692,6 @@ export class HostExecutionRunner {
707
692
  task: TaskRecord,
708
693
  permission: TaskPermission | undefined,
709
694
  context: PromptContext = {},
710
- onGoalArmed?: (armed: boolean) => void,
711
- goalEnabled = false,
712
695
  catalog?: ModelCatalogView,
713
696
  ): Promise<void> {
714
697
  if (permission !== undefined) {
@@ -789,8 +772,6 @@ export class HostExecutionRunner {
789
772
  ...resolved.images,
790
773
  ],
791
774
  })
792
- const armed = await this.armGoal(sessionId, task, promptContext, goalEnabled)
793
- onGoalArmed?.(armed)
794
775
  }
795
776
 
796
777
  /**
@@ -812,107 +793,18 @@ export class HostExecutionRunner {
812
793
  /**
813
794
  * Read the host's model catalog: the default route an unconfigured session
814
795
  * starts at, and each provider's models with the reasoning metadata its
815
- * adapter exposes. The acceptance settings card and the frozen contract both
816
- * resolve against it, so "inherit host" means the host's own configuration
817
- * rather than a session's or a card's pinned model.
796
+ * adapter exposes. The board resolves a card's pinned route and reasoning
797
+ * level against it, so "the model declares this level" is answered from the
798
+ * host's own configuration rather than from a session's or a card's pin.
818
799
  * @returns the raw catalog value, or undefined when this cohort serves none.
819
800
  */
820
801
  async modelCatalog(): Promise<unknown> {
821
802
  try {
822
803
  return await this.invoke('session', 'modelCatalog', {})
823
804
  } catch (error) {
824
- console.warn('[dsh-task-board] session/modelCatalog failed; the acceptance settings fall back to the configured route', error)
825
- return undefined
826
- }
827
- }
828
-
829
- /**
830
- * Arm dsh's built-in goal on the session. The task prompt is queued FIRST, so
831
- * the session's first turn carries the instruction verbatim; `/goal
832
- * <objective>` then turns the same text into a persistent objective, and
833
- * dsh's goal-round driver keeps starting continuation rounds until the agent
834
- * marks it complete (see {@link goalVerdict} for how the run settles).
835
- *
836
- * Two switches gate the arming, and BOTH must ask for it:
837
- * - the GLOBAL native-/goal switch (`goalEnabled`, default OFF), frozen when
838
- * this execution started; and
839
- * - the task's own `goalRun` (absent means off, only an explicit true opts
840
- * the card into a goal run).
841
- *
842
- * A refusal (no command dispatcher, no `/goal` command in this cohort, an
843
- * objective the command rejects) is reported and the run continues as a plain
844
- * turn: the task was asked to run, and a missing goal mode must not lose the
845
- * work.
846
- * @param sessionId - the session to arm in.
847
- * @param task - the task being run.
848
- * @param context - the run's prompt context.
849
- * @param goalEnabled - the GLOBAL switch, frozen for this execution.
850
- * @returns whether `/goal` was really armed.
851
- */
852
- private async armGoal(sessionId: ExecutionSessionId, task: TaskRecord, context: PromptContext, goalEnabled: boolean): Promise<boolean> {
853
- if (!goalEnabled) return false
854
- if (task.goalRun !== true) return false
855
- if (this.commands === undefined) {
856
- console.warn('[dsh-task-board] no command dispatcher is available; task ' + task.id + ' runs without /goal')
857
- return false
858
- }
859
- try {
860
- const command = await this.commands.execute(
861
- sessionId,
862
- '/goal ' + goalObjective(promptText(task, context)),
863
- AbortSignal.timeout(30_000),
864
- )
865
- if (command === undefined) {
866
- console.warn('[dsh-task-board] /goal was not acknowledged for session ' + sessionId + '; the run continues as a plain turn')
867
- return false
868
- }
869
- if (command.kind !== 'success') {
870
- console.warn('[dsh-task-board] /goal was refused for session ' + sessionId + ': ' + (command.text ?? 'no reason reported') + '; the run continues as a plain turn')
871
- return false
872
- }
873
- return true
874
- } catch (error) {
875
- console.warn('[dsh-task-board] could not arm /goal on session ' + sessionId + '; the run continues as a plain turn', error)
876
- return false
877
- }
878
- }
879
-
880
- /**
881
- * The verdict an armed dsh goal imposes on an otherwise completed turn.
882
- *
883
- * A goal run is one session working many automatic continuation rounds:
884
- * dsh's goal-round driver queues the next round whenever the agent goes
885
- * idle, so the first completed `turn/end` is not the execution's result.
886
- * Settling there would leave the card in `done` while the session keeps
887
- * working, and a scheduled task would fire a second, concurrent session.
888
- * The session projection is the authority: an `active` goal keeps the
889
- * execution pending, a `blocked` goal fails it with the recorded reason, and
890
- * any other phase (complete, paused, or no goal at all) leaves the turn
891
- * verdict in place.
892
- *
893
- * An unreadable projection falls back to that turn verdict: a cohort whose
894
- * gateway withdrew `session/projections` must not hang every execution.
895
- */
896
- private async goalVerdict(sessionId: string): Promise<ExecutionInspection | undefined> {
897
- let projections: { values?: { goal?: unknown } } | null
898
- try {
899
- projections = await this.invoke('session', 'projections', { sessionId }) as { values?: { goal?: unknown } } | null
900
- } catch (error) {
901
- console.warn('[dsh-task-board] session/projections failed while reading the goal phase; settling from the turn result', error)
805
+ console.warn('[dsh-task-board] session/modelCatalog failed; the board falls back to the pinned route', error)
902
806
  return undefined
903
807
  }
904
- const goal = projections?.values?.goal
905
- if (goal === undefined || goal === null) return undefined
906
- const view = (goal as { goal?: { phase?: unknown; blockedReason?: { message?: unknown } } }).goal
907
- if (view?.phase === 'active') return { outcome: 'pending' }
908
- if (view?.phase === 'blocked') {
909
- const message = view.blockedReason?.message
910
- return {
911
- outcome: 'failed',
912
- error: 'goal is blocked: ' + (typeof message === 'string' && message !== '' ? message : 'no reason recorded'),
913
- }
914
- }
915
- return undefined
916
808
  }
917
809
 
918
810
  async listRunning(): Promise<{ known: true; count: number; items: SessionSummary[] } | { known: false }> {
@@ -1063,7 +955,9 @@ export class HostExecutionRunner {
1063
955
  const closing = executionSummaryOf(events.map(entry => entry.event), startedAt)
1064
956
  const carried = closing === undefined ? {} : { summary: closing }
1065
957
  const reason = nonCompletedTurnEnd(turnEnd.event.data)
1066
- if (reason === undefined) return { ...(await this.goalVerdict(sessionId) ?? { outcome: 'succeeded' as const }), ...carried }
958
+ // The turn is the ONLY verdict: an execution is a single plain turn, so a
959
+ // completed turn end is a success and nothing else has to be read.
960
+ if (reason === undefined) return { outcome: 'succeeded' as const, ...carried }
1067
961
  // `error` keeps its historical wording; every other non-completed reason
1068
962
  // (aborted / blocked / max-tokens / interrupted) now reports instead of
1069
963
  // silently counting as success.