@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.
Files changed (75) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +29 -22
  3. package/README.zh.md +29 -22
  4. package/lib/client.js +1553 -670
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +757 -419
  7. package/lib/types/client/PluginSettingsCard.d.ts +60 -0
  8. package/lib/types/client/TaskBoardSettingsCard.d.ts +14 -0
  9. package/lib/types/client/board/ExecutionLog.d.ts +16 -0
  10. package/lib/types/client/board/TaskForm.d.ts +4 -0
  11. package/lib/types/client/board/VerificationReport.d.ts +2 -15
  12. package/lib/types/client/body-mutations.d.ts +45 -0
  13. package/lib/types/client/locales.d.ts +44 -6
  14. package/lib/types/client/suppress-schedule-row.d.ts +86 -0
  15. package/lib/types/client/telemetry.d.ts +14 -2
  16. package/lib/types/core/controller.d.ts +1 -1
  17. package/lib/types/core/execution-summary.d.ts +52 -0
  18. package/lib/types/core/extension.d.ts +34 -0
  19. package/lib/types/core/spend-budget.d.ts +28 -0
  20. package/lib/types/core/subtask.d.ts +59 -49
  21. package/lib/types/core/tasks.d.ts +37 -9
  22. package/lib/types/core/use-cases/task-update.d.ts +1 -1
  23. package/lib/types/core/workspace-target.d.ts +23 -3
  24. package/lib/types/host/launch-admission.d.ts +8 -9
  25. package/lib/types/host-ledger.d.ts +96 -50
  26. package/lib/types/host-routes.d.ts +49 -0
  27. package/lib/types/host-runner.d.ts +24 -11
  28. package/lib/types/host-service.d.ts +38 -50
  29. package/lib/types/host-spend.d.ts +52 -0
  30. package/lib/types/index.d.ts +70 -61
  31. package/lib/types/loopback.d.ts +41 -1
  32. package/lib/types/protocol.d.ts +0 -5
  33. package/lib/types/tool-surface.d.ts +1 -0
  34. package/package.json +25 -25
  35. package/src/client/CardDefaultPresetField.tsx +1 -1
  36. package/src/client/PluginSettingsCard.tsx +140 -20
  37. package/src/client/TaskBoardSettingsCard.tsx +104 -24
  38. package/src/client/board/ExecutionLog.tsx +140 -0
  39. package/src/client/board/LinkSubtaskModal.tsx +1 -9
  40. package/src/client/board/NewTaskModal.tsx +2 -11
  41. package/src/client/board/TaskCard.tsx +45 -23
  42. package/src/client/board/TaskDetail.tsx +407 -261
  43. package/src/client/board/TaskForm.tsx +19 -4
  44. package/src/client/board/VerificationReport.tsx +143 -104
  45. package/src/client/board/task-markdown.module.css +11 -8
  46. package/src/client/board-settings.module.css +35 -7
  47. package/src/client/board.module.css +855 -115
  48. package/src/client/body-mutations.ts +133 -0
  49. package/src/client/index.ts +10 -0
  50. package/src/client/locales.ts +101 -24
  51. package/src/client/settings-card.module.css +141 -11
  52. package/src/client/suppress-schedule-row.ts +198 -0
  53. package/src/client/telemetry.ts +47 -2
  54. package/src/core/controller.ts +1 -3
  55. package/src/core/execution-summary.ts +96 -0
  56. package/src/core/extension.ts +34 -0
  57. package/src/core/spend-budget.ts +35 -0
  58. package/src/core/store.ts +4 -0
  59. package/src/core/subtask.ts +81 -76
  60. package/src/core/tasks.ts +48 -10
  61. package/src/core/use-cases/task-update.ts +1 -3
  62. package/src/core/workspace-target.ts +27 -3
  63. package/src/host/agent-tools.ts +14 -15
  64. package/src/host/launch-admission.ts +8 -9
  65. package/src/host-ledger.ts +218 -127
  66. package/src/host-routes.ts +65 -2
  67. package/src/host-runner.ts +68 -35
  68. package/src/host-service.ts +136 -132
  69. package/src/host-spend.ts +105 -0
  70. package/src/index.ts +115 -104
  71. package/src/loopback.ts +57 -1
  72. package/src/protocol.ts +2 -9
  73. package/src/tool-surface.ts +1 -0
  74. package/lib/types/client/board/team-run-promotion.d.ts +0 -26
  75. package/src/client/board/team-run-promotion.ts +0 -39
@@ -4,7 +4,7 @@ import type { SessionSummary } from '@deepseek-ai/dsh-api-session-controller/typ
4
4
  import type { CommandResult } from '@deepseek-ai/dsh-commands/types';
5
5
  import type { Workspace } from '@deepseek-ai/dsh-workspace/types';
6
6
  import type { ModelCatalogView } from './core/verification.ts';
7
- import type { TaskRecord } from './core/tasks.ts';
7
+ import type { ExecutionSummary, TaskRecord } from './core/tasks.ts';
8
8
  /**
9
9
  * Host services needed to validate a task's workspace before creating a
10
10
  * session, and to resolve the workspace an unpinned card runs in.
@@ -77,12 +77,15 @@ export type ExecutionInspection =
77
77
  reason?: string;
78
78
  } | {
79
79
  outcome: 'succeeded';
80
+ summary?: ExecutionSummary;
80
81
  } | {
81
82
  outcome: 'failed';
82
83
  error: string;
84
+ summary?: ExecutionSummary;
83
85
  } | {
84
86
  outcome: 'cancelled';
85
87
  error: string;
88
+ summary?: ExecutionSummary;
86
89
  };
87
90
  /** A post-create launch failure that still identifies the session to the ledger. */
88
91
  export declare class SessionLaunchError extends Error {
@@ -99,21 +102,23 @@ export declare class SessionLaunchError extends Error {
99
102
  * first, the provenance wrap then encloses the instruction. Plain tasks (no
100
103
  * freeze) keep the bare handover preamble + prompt.
101
104
  */
102
- /** One other execution member of a run, as named in the launched task's prompt. */
103
- export interface PromptPeer {
104
- /** Task id of the member. */
105
+ /** One unfinished subtask the launched card's own agent has to dispatch. */
106
+ export interface PromptDescendant {
107
+ /** Task id of the subtask card. */
105
108
  id: string;
106
- /** Member title. */
109
+ /** Subtask title. */
107
110
  title: string;
108
- /** Teammate name when this member runs as a teammate. */
109
- name?: string;
111
+ /** Its column, so the run can tell a fresh card from one already failed before. */
112
+ status: string;
110
113
  }
111
114
  /** Execution-shape context appended to the launched task's prompt. */
112
115
  export interface PromptContext {
113
- /** The other members this run opens, excluding the launched task itself. */
114
- peers?: readonly PromptPeer[];
115
- /** True when those members run as teammates inside this session (Team Lead). */
116
- team?: boolean;
116
+ /**
117
+ * The card's outstanding descendants. Present exactly when this run is an
118
+ * autonomous dispatch: the Host opens no session for them, so this session
119
+ * reads them and dispatches subagents itself.
120
+ */
121
+ descendants?: readonly PromptDescendant[];
117
122
  /**
118
123
  * Scheduled-run provenance: the instant the rule actually fired, its kind,
119
124
  * and the IANA zone its wall clock was read in. Present only for a
@@ -190,6 +195,14 @@ export declare class HostExecutionRunner {
190
195
  launch(task: TaskRecord, options?: {
191
196
  reuseSessionId?: string;
192
197
  promptContext?: PromptContext;
198
+ /**
199
+ * Agent preset this execution is FORCED under, overriding the card's own
200
+ * `mode` pin (and a handover bundle's): the caller decides it from the run's
201
+ * shape (a card with unfinished subtasks runs as the autonomous dispatcher),
202
+ * and the override is never written into the card. A preset the deployment
203
+ * does not register fails the launch before any session exists.
204
+ */
205
+ agentPreset?: string;
193
206
  onSession?: (sessionId: string) => void;
194
207
  onGoalArmed?: (armed: boolean) => void;
195
208
  /**
@@ -9,33 +9,6 @@ import type { TaskBoardExtension } from './core/extension.ts';
9
9
  import { type ScheduleMode } from './core/tasks.ts';
10
10
  import { type ModelCatalogView, type VerificationContract, type VerificationSettings } from './core/verification.ts';
11
11
  import type { TaskPermission } from './core/handover.ts';
12
- /** One teammate the Host asks the Agent Teams service to spawn for a team run. */
13
- export interface TeamSpawnInput {
14
- /** Session id of the run's Team Lead (the root task's execution session). */
15
- leadSessionId: string;
16
- /** Immutable lower-kebab-case teammate name, unique inside the Team. */
17
- name: string;
18
- /** Short description of the delegated responsibility. */
19
- description: string;
20
- /** The subtask's execution prompt. */
21
- prompt: string;
22
- }
23
- /** Result of one teammate spawn attempt. */
24
- export interface TeamSpawnResult {
25
- /** The teammate's session id when it reached the active edge. */
26
- sessionId?: string;
27
- /** Why the spawn failed: a thrown call, or a member that settled as failed. */
28
- error?: string;
29
- }
30
- /**
31
- * The Agent Teams capability the Host needs for team-mode runs. The plugin
32
- * builds it from the optional `agentTeams` service; it is absent when this
33
- * deployment does not serve that service, in which case a team run is refused
34
- * instead of silently degrading into a plain cascade.
35
- */
36
- export interface TaskBoardTeamDispatcher {
37
- spawn(input: TeamSpawnInput): Promise<TeamSpawnResult>;
38
- }
39
12
  /**
40
13
  * Why an enforced goal execution settled failed while its acceptance DID run:
41
14
  * attempts were recorded and none of them passed. The judge answered about the
@@ -61,7 +34,7 @@ export declare const NEVER_INVOKED_VERIFICATION_REASON = "goal \u9A8C\u6536\u672
61
34
  */
62
35
  export declare const INVALID_ONLY_VERIFICATION_REASON = "goal \u9A8C\u6536\u65E0\u6548\uFF1A\u672C\u6B21\u6267\u884C\u53EA\u8BB0\u5F55\u4E86\u65E0\u6548\u9A8C\u6536\uFF08\u88C1\u5224\u672A\u80FD\u7ED9\u51FA\u4E0E\u4EFB\u52A1\u8981\u6C42\u5BF9\u5E94\u3001\u4E14\u53EF\u5B9A\u4F4D\u5230\u672C\u6B21\u8BC1\u636E\u7684\u5426\u51B3\u4F9D\u636E\uFF09\uFF0C\u770B\u677F\u5DF2\u505C\u6B62\u8C03\u7528\u88C1\u5224\u3002\u8FD9**\u4E0D\u662F**\u6709\u8BC1\u636E\u7684\u8D28\u91CF\u5224\u8D1F\uFF1A\u9A8C\u6536\u672C\u8EAB\u4E0D\u53EF\u7528\uFF0C\u672C\u6B21\u8FD0\u884C\u56E0\u6CA1\u6709\u5339\u914D\u7684\u901A\u8FC7\u8BB0\u5F55\u800C\u7ED3\u675F\u3002\u8BF7\u68C0\u67E5\u9A8C\u6536\u73AF\u5883\u4E0E\u8BC1\u636E\u53EF\u89C1\u6027\uFF0C\u6216\u7528 task_board_manage(action=reset-verification) \u6E05\u9664\u8BB0\u5F55\u7684\u65E0\u6548\u9A8C\u6536\u540E\u91CD\u65B0\u5B8C\u6210\u76EE\u6807\u3002";
63
36
  /**
64
- * Provenance of one cron-triggered cascade: when the rule fired and the zone
37
+ * Provenance of one cron-triggered run: when the rule fired and the zone
65
38
  * its wall clock was read in. Passed into every launched prompt of that run so
66
39
  * a scheduled job knows its own clock rather than inferring one.
67
40
  */
@@ -119,7 +92,6 @@ export declare class TaskBoardHostService {
119
92
  private preventIdleSleep;
120
93
  private readonly verificationSettings;
121
94
  private readonly verificationCatalog;
122
- private readonly team;
123
95
  private readonly timers;
124
96
  /** Live reader of the global native-/goal switch; frozen per execution. */
125
97
  private readonly goalRunEnabled;
@@ -131,6 +103,13 @@ export declare class TaskBoardHostService {
131
103
  * launch without remounting the row. Absent means the default.
132
104
  */
133
105
  private readonly runLaunchWidth;
106
+ /**
107
+ * Live reader of the daily token cap; 0 means no gate. Read at each run
108
+ * action, so closing or raising the cap binds the next action.
109
+ */
110
+ private readonly spendBudgetTokens;
111
+ /** Today's measured spend: absent measurement reads as "cannot see", never as zero. */
112
+ private readonly spendUsedToday;
134
113
  private lastPowerJson;
135
114
  private readonly now;
136
115
  /** The deployment's workspaces, consulted to resolve a card that pins none. */
@@ -167,7 +146,6 @@ export declare class TaskBoardHostService {
167
146
  * without remounting the row. Absent means the deployment configures none.
168
147
  */
169
148
  cardDefaults?: () => CardDefaults;
170
- team?: TaskBoardTeamDispatcher;
171
149
  timers?: HostTimerFace;
172
150
  /**
173
151
  * Live GLOBAL native /goal switch (a volatile config read). Read ONCE per
@@ -192,6 +170,18 @@ export declare class TaskBoardHostService {
192
170
  * is still queueing. Absent means the default width.
193
171
  */
194
172
  runLaunchWidth?: () => number;
173
+ /**
174
+ * Live daily token cap (a volatile config read). 0 — the default, and what
175
+ * every deployment that never configured one keeps — ends the gate before
176
+ * anything is measured. A positive cap refuses a run whose day already spent
177
+ * it, on both the action path and the cron path.
178
+ */
179
+ spendBudgetTokens?: () => number;
180
+ /**
181
+ * Today's measured spend in tokens, or undefined when this deployment keeps
182
+ * no readable usage ledger. Defaults to the family usage ledger reader.
183
+ */
184
+ spendUsedToday?: (now: number) => number | undefined;
195
185
  });
196
186
  start(): void;
197
187
  /**
@@ -258,6 +248,18 @@ export declare class TaskBoardHostService {
258
248
  * never disagree about a card.
259
249
  */
260
250
  private applyBoardAction;
251
+ /**
252
+ * Refuse a run whose day already spent the cap.
253
+ *
254
+ * A cap of 0 — the shipped default — answers before the measurement is read:
255
+ * no ledger file is opened and nothing is summed, which is what keeps a board
256
+ * that never configured a cap identical to the one before it existed.
257
+ *
258
+ * The refusal is a thrown message rather than a code: the wire hands its text
259
+ * to the caller as board-refused, exactly like every other refusal this board
260
+ * makes.
261
+ */
262
+ private assertSpendCap;
261
263
  /** Route one provider action and answer the resulting board snapshot. */
262
264
  private handleExtensionAction;
263
265
  /** Current task id -> status map, for change detection around a mutation. */
@@ -286,15 +288,6 @@ export declare class TaskBoardHostService {
286
288
  * session, are never refunded.
287
289
  */
288
290
  private refundUnstartedSchedule;
289
- private scheduleTeammate;
290
- /**
291
- * Spawn one teammate inside the Lead session and attach the teammate's
292
- * session to the subtask execution, so the existing session monitor settles
293
- * it from the teammate's own turn like any other execution. A spawn that
294
- * fails settles the subtask as failed immediately, which then folds into the
295
- * Lead's cascade verdict.
296
- */
297
- private spawnTeammate;
298
291
  /**
299
292
  * One roster pass, and whether it could read the session tree.
300
293
  *
@@ -386,18 +379,13 @@ export declare class TaskBoardHostService {
386
379
  private onScheduleFire;
387
380
  private armedSchedules;
388
381
  /**
389
- * Launch one run set. The root goes first and receives the run shape in its
390
- * prompt (which members this run opens, and how they run); every plain-cascade
391
- * member then launches on its own so one refused participant cannot hold the
392
- * others back. A team run's members are spawned inside the root's Lead
393
- * session instead, once that session exists.
382
+ * Launch the one run a run request opened. A run request names one card and
383
+ * opens one execution for it; the card's own session dispatches its subtasks
384
+ * as subagents, so nothing else is enqueued here.
394
385
  *
395
- * Every launch of one run set goes through the admission queue, which admits
396
- * at most `runLaunchWidth` of them at a time — the whole subtree still opens,
397
- * members just enter the running column in batches. Order inside the group is
398
- * the order they are enqueued here, so the root's session always exists before
399
- * any member's, and one member's launch settling (or failing) is what admits
400
- * the next. All members share the one contract this group freezes.
386
+ * The launch still goes through the admission queue, which admits at most
387
+ * `runLaunchWidth` launches at a time — that bound now applies across
388
+ * concurrent runs rather than across the members of one run.
401
389
  */
402
390
  private dispatchRuns;
403
391
  /**
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Today's measured spend, read from the usage ledger this deployment keeps at
3
+ * `$DSH_HOME/dsh-usage/usage-ledger.json`.
4
+ *
5
+ * The measure is the family usage ledger rather than a counter this plugin
6
+ * accumulates from `session/event`, for two reasons. The ledger is durable, so
7
+ * a cap cannot be reset by restarting the Host (the Loader remounts a row on
8
+ * any config change, and a spend counter that lived only in memory would forget
9
+ * the day). And a second fold of the same events inside the board would have to
10
+ * persist its own totals to be worth anything, which means a second writer of
11
+ * spend state in one process.
12
+ *
13
+ * What that costs: the file belongs to the dsh-usage plugin, so a deployment
14
+ * that does not mount it keeps no ledger and the cap cannot measure anything.
15
+ * That case is reported once per process and the gate then refuses nothing —
16
+ * wedging the board because a sibling plugin is absent would be worse than a
17
+ * cap that says it cannot see. The 3 s flush debounce of that plugin is the
18
+ * other cost: the reading trails the busiest moments by at most one debounce.
19
+ * @module @linxin666/dsh-task-board/host-spend
20
+ */
21
+ /**
22
+ * Local-date key (`YYYY-MM-DD`) of an instant, the bucketing the usage ledger
23
+ * itself uses: the cap and the usage panel therefore roll over at the same
24
+ * local midnight.
25
+ * @param ms - clock instant (ms epoch).
26
+ * @returns the day key.
27
+ */
28
+ export declare function spendDateKey(ms: number): string;
29
+ /**
30
+ * Total tokens one ledger day recorded, across every provider and model of that
31
+ * day. Anything that is not a finite token count contributes 0, so a ledger
32
+ * written by another version degrades to a smaller reading instead of NaN.
33
+ * @param day - one day bucket as the ledger stores it, when it is one.
34
+ * @returns the day's token total.
35
+ */
36
+ export declare function ledgerDayTokens(day: unknown): number;
37
+ /**
38
+ * Path of the usage ledger for this DSH home.
39
+ * @returns the absolute ledger path.
40
+ */
41
+ export declare function spendLedgerPath(): string;
42
+ /**
43
+ * Tokens already spent today, or undefined when no measurement is available.
44
+ *
45
+ * Undefined is "cannot see", not "spent nothing": the caller fails open and
46
+ * reports it, because a spend cap that cannot read its own source must never
47
+ * decide that no work may run.
48
+ * @param now - clock instant (ms epoch).
49
+ * @param path - ledger path (test seam).
50
+ * @returns today's token total, or undefined when the ledger is unreadable.
51
+ */
52
+ export declare function usedTokensToday(now?: number, path?: string): number | undefined;
@@ -9,8 +9,9 @@ import type { Context, Volatile } from '@deepseek-ai/cordis';
9
9
  import z from '@deepseek-ai/schemastery';
10
10
  import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
11
11
  import type { LlmRuntime } from '@deepseek-ai/dsh-llm';
12
- import { type HostTimerFace, type TaskBoardTeamDispatcher } from './host-service.ts';
12
+ import { type HostTimerFace } from './host-service.ts';
13
13
  import { type TaskPermission } from './core/tasks.ts';
14
+ import { type TaskBoardConnectionTrust } from './host-routes.ts';
14
15
  /** Default environment variable holding the authenticated proxy token. */
15
16
  export declare const DEFAULT_PROXY_TOKEN_ENV = "DSH_TASK_BOARD_PROXY_TOKEN";
16
17
  export declare const inject: string[];
@@ -46,6 +47,19 @@ export interface Config {
46
47
  trustedProxyHosts?: string[];
47
48
  /** Environment variable whose value the authenticated proxy injects upstream. */
48
49
  proxyTokenEnv?: string;
50
+ /**
51
+ * Whether the operator's OWN reverse proxy or tunnel may speak for the
52
+ * browser (default OFF). Off keeps the pre-existing fence exactly: a request
53
+ * that carries a forwarding header is never local, so only a direct loopback
54
+ * client or an allowlisted token-injecting proxy reaches the board (issue
55
+ * #1906). On admits one narrower case — a forwarded request whose socket and
56
+ * Host are both this machine's loopback upstream, i.e. the proxy dials the
57
+ * board itself (issue #1918) — and still requires the browser same-origin
58
+ * marker, so a third party's tunnel is only trusted while the operator says
59
+ * it is. Volatile: the fence reads it at each request, so an edit binds the
60
+ * next request without re-registering the routes.
61
+ */
62
+ trustForwardedProxy?: Volatile<boolean>;
49
63
  /**
50
64
  * An explicit baseline for the permission confirmation gate. Left unset, the
51
65
  * board follows the Host's own default permission preset — the value new DSH
@@ -58,8 +72,8 @@ export interface Config {
58
72
  /**
59
73
  * Subtask depth limit, 1..3 (default 1). At 1 a task may carry one level of
60
74
  * subtasks and a subtask cannot be given subtasks of its own; raising it
61
- * allows deeper trees. Every extra level multiplies the sessions one run
62
- * of the root task opens, so the ceiling is deliberately small.
75
+ * allows deeper trees. Every extra level is another tree the card's own
76
+ * session may have to dispatch, so the ceiling is deliberately small.
63
77
  */
64
78
  maxSubtaskDepth?: Volatile<number>;
65
79
  /**
@@ -71,21 +85,24 @@ export interface Config {
71
85
  sessionPollSeconds?: Volatile<number>;
72
86
  /**
73
87
  * How many run launches this board may have in flight at once (1..16,
74
- * default 3). One run opens its whole subtree, so without a bound the Host
75
- * asks DSH for every member's session in the same tick; this is the mechanism
76
- * that enforces the repository's measured guidance for heavy implementation
77
- * subagents. Members wait their turn instead of being dropped: the subtree
78
- * still opens completely, they only enter the running column in batches. Read
79
- * at each admission, so an edit bounds the next launch of a run that is still
80
- * queueing.
88
+ * default 3). A run opens one session, so a burst is several cards run at
89
+ * once (several tabs, or a due schedule firing while a manual run starts);
90
+ * without a bound the Host would ask DSH for all of them in the same tick.
91
+ * This is the mechanism that enforces the repository's measured guidance for
92
+ * heavy implementation subagents. Runs wait their turn instead of being
93
+ * dropped, and every one of them still starts. Read at each admission, so an
94
+ * edit bounds the next launch of a run that is still queueing.
81
95
  */
82
96
  runLaunchWidth?: Volatile<number>;
83
97
  /**
84
- * Continuable-subagent provider the Agent Teams service uses to compose a
85
- * teammate. Matches the Agent Teams tool plugin's `freshProvider` default;
86
- * only team-mode runs use it.
98
+ * Daily token ceiling for the work this board dispatches (default 0 = no
99
+ * gate). Tokens, not money: the ledger the board measures against prices
100
+ * DeepSeek's own routes only, so a cost cap would read 0 elsewhere. Read at
101
+ * each gate, so an edit binds the next run without a remount; a manual
102
+ * run/rerun whose day already spent the cap is refused, and a due occurrence
103
+ * is skipped onto the scheduler with its run budget untouched.
87
104
  */
88
- teamProvider?: string;
105
+ spendBudgetTokens?: Volatile<number>;
89
106
  /**
90
107
  * GLOBAL native /goal switch (default OFF), the master control over whether
91
108
  * this board starts a run with dsh's built-in /goal at all. A run uses native
@@ -172,11 +189,6 @@ export interface Config {
172
189
  */
173
190
  goalVerificationBudgetSeconds?: Volatile<number>;
174
191
  }
175
- /**
176
- * Continuable-subagent provider for fresh teammates, matching the Agent Teams
177
- * tool plugin's own `freshProvider` default.
178
- */
179
- export declare const DEFAULT_TEAM_PROVIDER = "spawn";
180
192
  /**
181
193
  * Profile-patch shape of {@link Config}: what the Host validates the row's
182
194
  * config against, before the schema turns volatile fields into live references
@@ -198,6 +210,8 @@ export interface ConfigInput {
198
210
  trustedProxyHosts?: string[];
199
211
  /** Environment variable whose value the authenticated proxy injects. */
200
212
  proxyTokenEnv?: string;
213
+ /** Trust a forwarded request that landed on this machine's loopback upstream; default off. */
214
+ trustForwardedProxy?: boolean;
201
215
  /** Explicit baseline for the permission confirmation gate; unset follows the Host default. */
202
216
  sessionDefaultPermission?: TaskPermission;
203
217
  /** Subtask depth limit, 1..3. */
@@ -206,8 +220,8 @@ export interface ConfigInput {
206
220
  sessionPollSeconds?: number;
207
221
  /** Concurrent run launches allowed at once, 1..16. */
208
222
  runLaunchWidth?: number;
209
- /** Continuable-subagent provider the Agent Teams service composes a teammate from. */
210
- teamProvider?: string;
223
+ /** Daily token ceiling for board runs; 0 disables the gate. */
224
+ spendBudgetTokens?: number;
211
225
  /** Global native /goal switch; default off, frozen per execution. */
212
226
  goalRunEnabled?: boolean;
213
227
  /** Agent preset a new card starts from; blank = not set. */
@@ -263,11 +277,45 @@ declare module '@deepseek-ai/cordis' {
263
277
  * @returns the effective field value.
264
278
  */
265
279
  export declare function readConfigField<T>(field: Volatile<T> | T | undefined, fallback: T): T;
266
- /** Resolve proxy access without ever placing the token value in plugin config. */
280
+ /**
281
+ * Resolve proxy access without ever placing the token value in plugin config.
282
+ *
283
+ * The forwarded-proxy switch travels as a reader rather than a value: it is
284
+ * schema-volatile, so the fence must read it when a request arrives instead of
285
+ * when the routes are registered.
286
+ * @param config - the resolved plugin config.
287
+ * @param env - environment holding the proxy token value.
288
+ * @returns the route access handed to {@link makeTaskBoardRoutes}.
289
+ */
267
290
  export declare function resolveProxyAccess(config: Config | undefined, env?: NodeJS.ProcessEnv): {
268
291
  trustedProxyHosts: string[];
269
292
  proxyToken?: string;
293
+ trustForwardedProxy: () => boolean;
270
294
  };
295
+ /**
296
+ /**
297
+ * Schema default for the forwarded-proxy switch, re-read for hand-built
298
+ * contexts. Deliberately false: a deployment that never configured it keeps
299
+ * refusing every forwarded request, which is the #1906 fence.
300
+ */
301
+ export declare const DEFAULT_TRUST_FORWARDED_PROXY = false;
302
+ /**
303
+ * Resolve the composition's optional `connection` service.
304
+ *
305
+ * The service is the Host's own browser-session authority: it fronts every
306
+ * `/api` request with the Host/Origin fence and the signed `dsh-auth-*` cookie,
307
+ * which is what a deployment behind a reverse proxy or ingress validates on the
308
+ * same authority the GUI is served from. The board bridges it instead of
309
+ * repeating that check, so a proxy request the Host already authenticated is
310
+ * admitted without a board-specific host allowlist (issue #1930). It is
311
+ * deliberately resolved like the agent-tool registry rather than injected:
312
+ * a composition that serves no connection keeps mounting the board on the
313
+ * pre-existing loopback fence, and one that mounts the service later is picked
314
+ * up on the next request because the fence asks this resolver each time.
315
+ * @param ctx - the plugin context.
316
+ * @returns the trust face, or undefined when this deployment serves none.
317
+ */
318
+ export declare function resolveConnectionTrust(ctx: Context): TaskBoardConnectionTrust | undefined;
271
319
  /** The registry face the agent tools register into. */
272
320
  interface AgentToolRegistry {
273
321
  register(definition: ToolDefinition): () => void;
@@ -305,45 +353,6 @@ export declare function resolveHostTimers(ctx: Context): HostTimerFace | undefin
305
353
  * @returns the Host default as a board permission, or undefined when unreadable.
306
354
  */
307
355
  export declare function resolveHostDefaultPermission(ctx: Context): TaskPermission | undefined;
308
- /** The subset of the Agent Teams service this plugin drives. */
309
- interface AgentTeamsFace {
310
- spawnTeammate(caller: unknown, request: {
311
- name: string;
312
- description: string;
313
- prompt: Array<{
314
- type: 'text';
315
- text: string;
316
- }>;
317
- context: 'fresh' | 'fork';
318
- provider: string;
319
- signal: AbortSignal;
320
- }): Promise<{
321
- member?: {
322
- id?: string;
323
- phase?: string;
324
- error?: string;
325
- };
326
- }>;
327
- }
328
- /**
329
- * Resolve the optional Agent Teams service. Like the tool registry and the llm
330
- * runtime, it is deliberately not injected: a deployment without Agent Teams
331
- * must still mount the whole board and only lose team-mode runs.
332
- * @param ctx - the plugin context.
333
- * @returns the service, or undefined when this deployment serves none.
334
- */
335
- export declare function resolveAgentTeams(ctx: Context): AgentTeamsFace | undefined;
336
- /**
337
- * Build the team dispatcher: the run's Lead session spawns one teammate per
338
- * subtask through the Agent Teams service, and the teammate's session id is
339
- * attached to that subtask's execution so the ordinary session monitor settles
340
- * it. Returns undefined when the deployment serves no Agent Teams service or
341
- * no live-agent registry, which makes a team run fail closed.
342
- * @param ctx - the plugin context.
343
- * @param provider - the continuable-subagent provider for fresh teammates.
344
- * @returns the dispatcher, or undefined when team runs cannot be served.
345
- */
346
- export declare function buildTeamDispatcher(ctx: Context, provider: string): TaskBoardTeamDispatcher | undefined;
347
356
  /**
348
357
  * Read the optional `llm` service. The board deliberately does not inject it:
349
358
  * a deployment without a model must still mount the board, and the parse route
@@ -7,6 +7,19 @@
7
7
  * Semantics: RFC 5735 IPv4 127/8, ::1, IPv4-mapped ::ffff:127/8 (matching the
8
8
  * remote-web-ui gate), localhost hostnames, plus the browser same-origin
9
9
  * markers (sec-fetch-site and Origin) for the request-level fence.
10
+ *
11
+ * A reverse proxy in front of the host rewrites the Host header to its own
12
+ * upstream literal (a Cloudflare tunnel, frp and an nginx reverse proxy all
13
+ * dial 127.0.0.1:<port>), and the socket the origin sees is the proxy's, which
14
+ * is loopback by construction. Both halves of the fence then hold for a public
15
+ * request. Forwarding headers are the signal that a hop stands in between: a
16
+ * request that carries CF-Connecting-IP or X-Forwarded-For is answered through
17
+ * a proxy and is never treated as a local one (issue #1906).
18
+ *
19
+ * An operator who runs that proxy or tunnel themselves can opt into the
20
+ * narrower case: isForwardedLoopbackRequest describes a forwarded request that
21
+ * still landed on this machine's loopback upstream, and a route family admits
22
+ * it only behind its own default-off switch (issue #1918).
10
23
  * @module dsh-web-shared/host/loopback
11
24
  */
12
25
  import type { IncomingMessage } from 'node:http';
@@ -16,9 +29,36 @@ export declare function isIPv4Loopback(v4: string): boolean;
16
29
  export declare function isLoopbackAddress(address: string | undefined): boolean;
17
30
  /** Whether a normalized URL hostname names the loopback authority (localhost, [::1], 127/8). */
18
31
  export declare function isLoopbackHostname(hostname: string): boolean;
32
+ /**
33
+ * Whether a reverse proxy stood between the client and this host: the request
34
+ * carries CF-Connecting-IP or X-Forwarded-For. Either header is stamped by a
35
+ * hop that forwards traffic, so the request did not originate on this machine.
36
+ * @param request - node HTTP request.
37
+ * @returns true when a forwarding header is present.
38
+ */
39
+ export declare function isProxiedRequest(request: IncomingMessage): boolean;
19
40
  /**
20
41
  * Request-level trust fence: a loopback socket address AND a loopback Host
21
42
  * header, plus browser same-origin markers. The socket address is
22
- * authoritative; X-Forwarded-For is never trusted.
43
+ * authoritative for a direct connection; a request that carries a forwarding
44
+ * header is refused outright, because a proxy in front of the host makes both
45
+ * the socket address and the Host header describe the proxy rather than the
46
+ * client. X-Forwarded-For is therefore never evidence *for* loopback.
23
47
  */
24
48
  export declare function isLoopbackRequest(request: IncomingMessage): boolean;
49
+ /**
50
+ * Whether a forwarded request landed on this machine's loopback upstream: a
51
+ * forwarding header (the proxy's own stamp), a loopback socket address (the
52
+ * proxy dials 127.0.0.1:<port>), and a loopback Host header (the proxy rewrote
53
+ * the authority to its upstream literal).
54
+ *
55
+ * This is a fact about the route, not a trust decision. A public request to a
56
+ * tunnel satisfies all three by construction, because the proxy is the client
57
+ * of this process: only a caller that operates the proxy can decide it stands
58
+ * for the browser, which is why every consumer keeps this behind an explicit
59
+ * default-off switch and its own browser markers. isLoopbackRequest is
60
+ * unchanged and still refuses a forwarded request (issue #1906).
61
+ * @param request - node HTTP request.
62
+ * @returns true when a forwarding header, a loopback socket, and a loopback Host all hold.
63
+ */
64
+ export declare function isForwardedLoopbackRequest(request: IncomingMessage): boolean;
@@ -61,11 +61,6 @@ export interface TaskBoardSnapshot {
61
61
  * disable the subtask controls; the Host ledger is the authority.
62
62
  */
63
63
  maxSubtaskDepth?: number;
64
- /**
65
- * Whether this deployment serves the Agent Teams service, so a task may opt
66
- * into team execution (Team Lead session plus one teammate per subtask).
67
- */
68
- teamRunAvailable?: boolean;
69
64
  /**
70
65
  * Live GLOBAL native-/goal switch. The browser uses it to disable the
71
66
  * task-level option (and explain that the global switch must be turned on
@@ -30,6 +30,7 @@
30
30
  export declare const PLUGIN_TOOL_SECTION_ORDERS: {
31
31
  readonly ssh: 150;
32
32
  readonly 'task-board': 200;
33
+ readonly agents: 220;
33
34
  };
34
35
  /** One plugin id keyed by {@link PLUGIN_TOOL_SECTION_ORDERS}. */
35
36
  export type PluginToolSectionId = keyof typeof PLUGIN_TOOL_SECTION_ORDERS;
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.7",
4
+ "version": "0.4.9",
5
5
  "icon": "icon.svg",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "dsh": {
22
22
  "engines": {
23
- "dsh": ">=0.2.1-rc.2"
23
+ "dsh": ">=0.2.1-rc.3"
24
24
  },
25
25
  "bundle": {
26
26
  "patch": "./cordis.patch.yml"
@@ -40,7 +40,7 @@
40
40
  }
41
41
  },
42
42
  "peerDependencies": {
43
- "@deepseek-ai/dsh": ">=0.2.1-rc.2",
43
+ "@deepseek-ai/dsh": ">=0.2.1-rc.3",
44
44
  "react": "^18.2.0"
45
45
  },
46
46
  "dependencies": {
@@ -49,28 +49,28 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "@deepseek-ai/cordis": "^4.0.5",
52
- "@deepseek-ai/dsh-agent": "^0.2.1-rc.2",
53
- "@deepseek-ai/dsh-agent-preset-registry": "^0.2.1-rc.2",
54
- "@deepseek-ai/dsh-api-gateway": "^0.2.1-rc.2",
55
- "@deepseek-ai/dsh-api-remotes": "^0.2.1-rc.2",
56
- "@deepseek-ai/dsh-api-session-controller": "^0.2.1-rc.2",
57
- "@deepseek-ai/dsh-api-workspace-controller": "^0.2.1-rc.2",
58
- "@deepseek-ai/dsh-client-connection": "^0.2.1-rc.2",
59
- "@deepseek-ai/dsh-client-locale": "^0.2.1-rc.2",
60
- "@deepseek-ai/dsh-client-store": "^0.2.1-rc.2",
61
- "@deepseek-ai/dsh-client-ui-layout": "^0.2.1-rc.2",
62
- "@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.2",
63
- "@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.2",
64
- "@deepseek-ai/dsh-client-ui-sidebar": "^0.2.1-rc.2",
65
- "@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.2",
66
- "@deepseek-ai/dsh-client-ui-workspace": "^0.2.1-rc.2",
67
- "@deepseek-ai/dsh-commands": "^0.2.1-rc.2",
68
- "@deepseek-ai/dsh-host-webserver": "^0.2.1-rc.2",
69
- "@deepseek-ai/dsh-llm": "^0.2.1-rc.2",
70
- "@deepseek-ai/dsh-settings": "^0.2.1-rc.2",
71
- "@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.2",
72
- "@deepseek-ai/dsh-tools": "^0.2.1-rc.2",
73
- "@deepseek-ai/dsh-workspace": "^0.2.1-rc.2",
52
+ "@deepseek-ai/dsh-agent": "^0.2.1-rc.3",
53
+ "@deepseek-ai/dsh-agent-preset-registry": "^0.2.1-rc.3",
54
+ "@deepseek-ai/dsh-api-gateway": "^0.2.1-rc.3",
55
+ "@deepseek-ai/dsh-api-remotes": "^0.2.1-rc.3",
56
+ "@deepseek-ai/dsh-api-session-controller": "^0.2.1-rc.3",
57
+ "@deepseek-ai/dsh-api-workspace-controller": "^0.2.1-rc.3",
58
+ "@deepseek-ai/dsh-client-connection": "^0.2.1-rc.3",
59
+ "@deepseek-ai/dsh-client-locale": "^0.2.1-rc.3",
60
+ "@deepseek-ai/dsh-client-store": "^0.2.1-rc.3",
61
+ "@deepseek-ai/dsh-client-ui-layout": "^0.2.1-rc.3",
62
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.3",
63
+ "@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.3",
64
+ "@deepseek-ai/dsh-client-ui-sidebar": "^0.2.1-rc.3",
65
+ "@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.3",
66
+ "@deepseek-ai/dsh-client-ui-workspace": "^0.2.1-rc.3",
67
+ "@deepseek-ai/dsh-commands": "^0.2.1-rc.3",
68
+ "@deepseek-ai/dsh-host-webserver": "^0.2.1-rc.3",
69
+ "@deepseek-ai/dsh-llm": "^0.2.1-rc.3",
70
+ "@deepseek-ai/dsh-settings": "^0.2.1-rc.3",
71
+ "@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.3",
72
+ "@deepseek-ai/dsh-tools": "^0.2.1-rc.3",
73
+ "@deepseek-ai/dsh-workspace": "^0.2.1-rc.3",
74
74
  "@types/node": "^22.20.0",
75
75
  "@types/react": "~18.3.1",
76
76
  "@types/react-dom": "^18.3.5",
@@ -93,7 +93,7 @@ export function CardDefaultPresetField(props: CardDefaultPresetFieldProps) {
93
93
  )
94
94
  : null}
95
95
  </select>
96
- <p className={props.invalid ? css.invalid : css.hint}>
96
+ <p className={props.invalid ? css.invalid : css.hint} title={props.hintTitle}>
97
97
  {props.invalid ? props.invalidLabel : props.hint}
98
98
  </p>
99
99
  </div>