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

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 (65) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +16 -36
  3. package/README.zh.md +16 -36
  4. package/lib/client.js +107 -1354
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +138 -2537
  7. package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -20
  8. package/lib/types/client/board/status-key.d.ts +0 -15
  9. package/lib/types/client/locales.d.ts +1 -110
  10. package/lib/types/client/settings-entry-form.d.ts +1 -1
  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/tasks.d.ts +0 -45
  16. package/lib/types/core/use-cases/task-update.d.ts +1 -1
  17. package/lib/types/host/llm-dispatch.d.ts +8 -10
  18. package/lib/types/host-ledger.d.ts +0 -28
  19. package/lib/types/host-runner.d.ts +6 -71
  20. package/lib/types/host-service.d.ts +17 -89
  21. package/lib/types/index.d.ts +0 -78
  22. package/lib/types/protocol.d.ts +6 -23
  23. package/package.json +26 -26
  24. package/src/client/TaskBoardSettingsCard.tsx +13 -201
  25. package/src/client/board/ExecutionLog.tsx +2 -5
  26. package/src/client/board/NewTaskModal.tsx +1 -42
  27. package/src/client/board/TaskBoard.tsx +2 -2
  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 +2 -2
  34. package/src/client/locales.ts +6 -224
  35. package/src/client/settings-entry-form.ts +1 -1
  36. package/src/core/attachment.ts +1 -0
  37. package/src/core/controller.ts +1 -3
  38. package/src/core/extension.ts +4 -5
  39. package/src/core/freeze-snapshot.ts +3 -3
  40. package/src/core/model-catalog.ts +114 -0
  41. package/src/core/reasoning-effort.ts +1 -1
  42. package/src/core/store.ts +22 -17
  43. package/src/core/tasks.ts +0 -53
  44. package/src/core/use-cases/task-update.ts +1 -8
  45. package/src/host/agent-tools.ts +1 -15
  46. package/src/host/extension-registry.ts +2 -2
  47. package/src/host/llm-dispatch.ts +8 -10
  48. package/src/host-ledger.ts +3 -89
  49. package/src/host-routes.ts +4 -4
  50. package/src/host-runner.ts +13 -139
  51. package/src/host-service.ts +51 -266
  52. package/src/index.ts +9 -163
  53. package/src/protocol.ts +9 -44
  54. package/lib/types/client/board/VerificationReport.d.ts +0 -10
  55. package/lib/types/core/verification-budget.d.ts +0 -52
  56. package/lib/types/core/verification.d.ts +0 -753
  57. package/lib/types/host/verification-gate.d.ts +0 -95
  58. package/lib/types/host/verification-runner.d.ts +0 -139
  59. package/lib/types/host/workspace-evidence.d.ts +0 -53
  60. package/src/client/board/VerificationReport.tsx +0 -361
  61. package/src/core/verification-budget.ts +0 -115
  62. package/src/core/verification.ts +0 -1594
  63. package/src/host/verification-gate.ts +0 -487
  64. package/src/host/verification-runner.ts +0 -702
  65. package/src/host/workspace-evidence.ts +0 -176
@@ -6,7 +6,7 @@ import type { Workspace } from '@deepseek-ai/dsh-workspace/types'
6
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
@@ -511,25 +490,11 @@ export class HostExecutionRunner {
511
490
  */
512
491
  agentPreset?: string
513
492
  onSession?: (sessionId: string) => void
514
- onGoalArmed?: (armed: boolean) => void
515
- /**
516
- * GLOBAL native /goal switch, resolved by the caller ONCE per execution and
517
- * carried here so the decision is frozen for this launch.
518
- *
519
- * Frozen deliberately: a settings edit made while the run is in flight must
520
- * not arm, disarm or otherwise change the goal/acceptance contract of a run
521
- * already running. Absent means off — the default for every deployment that
522
- * never touched the switch, including cards written before the option
523
- * existed. A plain single turn is what an off switch produces; the task-level
524
- * `goalRun` still applies on top of it (both must ASK for a goal).
525
- */
526
- goalEnabled?: boolean
527
493
  /**
528
494
  * The host model catalog, read ONCE per execution by the caller. The card's
529
495
  * pinned reasoning effort is sent only when this catalog declares it for the
530
- * route the execution runs at, so one snapshot decides both the acceptance
531
- * contract and the effort this run freezes. Absent means "no capability
532
- * 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.
533
498
  */
534
499
  catalog?: ModelCatalogView
535
500
  } = {}): Promise<string> {
@@ -592,7 +557,7 @@ export class HostExecutionRunner {
592
557
  // at the gate without its binding.
593
558
  options.onSession?.(reused)
594
559
  await this.assertReusedPreset(reused, mode)
595
- 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)
596
561
  } catch (error) {
597
562
  throw new SessionLaunchError(reused, error)
598
563
  }
@@ -613,7 +578,7 @@ export class HostExecutionRunner {
613
578
  options.onSession?.(sessionId)
614
579
  try {
615
580
  await this.invoke('session', 'rename', { sessionId, title: task.title })
616
- 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)
617
582
  } catch (error) {
618
583
  throw new SessionLaunchError(sessionId, error)
619
584
  }
@@ -727,8 +692,6 @@ export class HostExecutionRunner {
727
692
  task: TaskRecord,
728
693
  permission: TaskPermission | undefined,
729
694
  context: PromptContext = {},
730
- onGoalArmed?: (armed: boolean) => void,
731
- goalEnabled = false,
732
695
  catalog?: ModelCatalogView,
733
696
  ): Promise<void> {
734
697
  if (permission !== undefined) {
@@ -790,7 +753,7 @@ export class HostExecutionRunner {
790
753
  // keeps the best-effort behavior: the card was asked to run, and losing
791
754
  // the work over a model switch this run never promised is worse.
792
755
  if (decision.effort !== undefined) {
793
- throw new Error(`session ${sessionId} refused the model selection "${provider === undefined ? modelId : provider + '/' + modelId}" with reasoning effort "${decision.effort}": ` + (modelError instanceof Error ? modelError.message : String(modelError)))
756
+ throw new Error(`session ${sessionId} refused the model selection "${provider === undefined ? modelId : provider + '/' + modelId}" with reasoning effort "${decision.effort}": ` + (modelError instanceof Error ? modelError.message : String(modelError)), { cause: modelError })
794
757
  }
795
758
  console.warn(`[dsh-task-board] failed to select model "${provider === undefined ? modelId : provider + '/' + modelId}" for session ${sessionId}, falling back to default:`, modelError)
796
759
  }
@@ -809,8 +772,6 @@ export class HostExecutionRunner {
809
772
  ...resolved.images,
810
773
  ],
811
774
  })
812
- const armed = await this.armGoal(sessionId, task, promptContext, goalEnabled)
813
- onGoalArmed?.(armed)
814
775
  }
815
776
 
816
777
  /**
@@ -832,109 +793,20 @@ export class HostExecutionRunner {
832
793
  /**
833
794
  * Read the host's model catalog: the default route an unconfigured session
834
795
  * starts at, and each provider's models with the reasoning metadata its
835
- * adapter exposes. The acceptance settings card and the frozen contract both
836
- * resolve against it, so "inherit host" means the host's own configuration
837
- * 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.
838
799
  * @returns the raw catalog value, or undefined when this cohort serves none.
839
800
  */
840
801
  async modelCatalog(): Promise<unknown> {
841
802
  try {
842
803
  return await this.invoke('session', 'modelCatalog', {})
843
804
  } catch (error) {
844
- console.warn('[dsh-task-board] session/modelCatalog failed; the acceptance settings fall back to the configured route', error)
805
+ console.warn('[dsh-task-board] session/modelCatalog failed; the board falls back to the pinned route', error)
845
806
  return undefined
846
807
  }
847
808
  }
848
809
 
849
- /**
850
- * Arm dsh's built-in goal on the session. The task prompt is queued FIRST, so
851
- * the session's first turn carries the instruction verbatim; `/goal
852
- * <objective>` then turns the same text into a persistent objective, and
853
- * dsh's goal-round driver keeps starting continuation rounds until the agent
854
- * marks it complete (see {@link goalVerdict} for how the run settles).
855
- *
856
- * Two switches gate the arming, and BOTH must ask for it:
857
- * - the GLOBAL native-/goal switch (`goalEnabled`, default OFF), frozen when
858
- * this execution started; and
859
- * - the task's own `goalRun` (absent means off, only an explicit true opts
860
- * the card into a goal run).
861
- *
862
- * A refusal (no command dispatcher, no `/goal` command in this cohort, an
863
- * objective the command rejects) is reported and the run continues as a plain
864
- * turn: the task was asked to run, and a missing goal mode must not lose the
865
- * work.
866
- * @param sessionId - the session to arm in.
867
- * @param task - the task being run.
868
- * @param context - the run's prompt context.
869
- * @param goalEnabled - the GLOBAL switch, frozen for this execution.
870
- * @returns whether `/goal` was really armed.
871
- */
872
- private async armGoal(sessionId: ExecutionSessionId, task: TaskRecord, context: PromptContext, goalEnabled: boolean): Promise<boolean> {
873
- if (!goalEnabled) return false
874
- if (task.goalRun !== true) return false
875
- if (this.commands === undefined) {
876
- console.warn('[dsh-task-board] no command dispatcher is available; task ' + task.id + ' runs without /goal')
877
- return false
878
- }
879
- try {
880
- const command = await this.commands.execute(
881
- sessionId,
882
- '/goal ' + goalObjective(promptText(task, context)),
883
- AbortSignal.timeout(30_000),
884
- )
885
- if (command === undefined) {
886
- console.warn('[dsh-task-board] /goal was not acknowledged for session ' + sessionId + '; the run continues as a plain turn')
887
- return false
888
- }
889
- if (command.kind !== 'success') {
890
- console.warn('[dsh-task-board] /goal was refused for session ' + sessionId + ': ' + (command.text ?? 'no reason reported') + '; the run continues as a plain turn')
891
- return false
892
- }
893
- return true
894
- } catch (error) {
895
- console.warn('[dsh-task-board] could not arm /goal on session ' + sessionId + '; the run continues as a plain turn', error)
896
- return false
897
- }
898
- }
899
-
900
- /**
901
- * The verdict an armed dsh goal imposes on an otherwise completed turn.
902
- *
903
- * A goal run is one session working many automatic continuation rounds:
904
- * dsh's goal-round driver queues the next round whenever the agent goes
905
- * idle, so the first completed `turn/end` is not the execution's result.
906
- * Settling there would leave the card in `done` while the session keeps
907
- * working, and a scheduled task would fire a second, concurrent session.
908
- * The session projection is the authority: an `active` goal keeps the
909
- * execution pending, a `blocked` goal fails it with the recorded reason, and
910
- * any other phase (complete, paused, or no goal at all) leaves the turn
911
- * verdict in place.
912
- *
913
- * An unreadable projection falls back to that turn verdict: a cohort whose
914
- * gateway withdrew `session/projections` must not hang every execution.
915
- */
916
- private async goalVerdict(sessionId: string): Promise<ExecutionInspection | undefined> {
917
- let projections: { values?: { goal?: unknown } } | null
918
- try {
919
- projections = await this.invoke('session', 'projections', { sessionId }) as { values?: { goal?: unknown } } | null
920
- } catch (error) {
921
- console.warn('[dsh-task-board] session/projections failed while reading the goal phase; settling from the turn result', error)
922
- return undefined
923
- }
924
- const goal = projections?.values?.goal
925
- if (goal === undefined || goal === null) return undefined
926
- const view = (goal as { goal?: { phase?: unknown; blockedReason?: { message?: unknown } } }).goal
927
- if (view?.phase === 'active') return { outcome: 'pending' }
928
- if (view?.phase === 'blocked') {
929
- const message = view.blockedReason?.message
930
- return {
931
- outcome: 'failed',
932
- error: 'goal is blocked: ' + (typeof message === 'string' && message !== '' ? message : 'no reason recorded'),
933
- }
934
- }
935
- return undefined
936
- }
937
-
938
810
  async listRunning(): Promise<{ known: true; count: number; items: SessionSummary[] } | { known: false }> {
939
811
  for (let attempt = 1; ; attempt++) {
940
812
  try {
@@ -1083,7 +955,9 @@ export class HostExecutionRunner {
1083
955
  const closing = executionSummaryOf(events.map(entry => entry.event), startedAt)
1084
956
  const carried = closing === undefined ? {} : { summary: closing }
1085
957
  const reason = nonCompletedTurnEnd(turnEnd.event.data)
1086
- 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 }
1087
961
  // `error` keeps its historical wording; every other non-completed reason
1088
962
  // (aborted / blocked / max-tokens / interrupted) now reports instead of
1089
963
  // silently counting as success.