@linxin666/dsh-client-ui-task-board 0.4.6 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +15 -6
- package/README.zh.md +15 -6
- package/lib/client.js +1634 -822
- package/lib/client.js.map +1 -1
- package/lib/index.js +1072 -125
- package/lib/types/client/CardDefaultPresetField.d.ts +35 -0
- package/lib/types/client/PluginSettingsCard.d.ts +39 -0
- package/lib/types/client/TaskBoardSettingsCard.d.ts +56 -0
- package/lib/types/client/board/ReasoningEffortField.d.ts +25 -0
- package/lib/types/client/board/model-options.d.ts +67 -0
- package/lib/types/client/board/preset-label.d.ts +21 -0
- package/lib/types/client/board/preset-roster.d.ts +45 -0
- package/lib/types/client/board/team-run-promotion.d.ts +26 -0
- package/lib/types/client/locales.d.ts +18 -0
- package/lib/types/client/telemetry.d.ts +14 -2
- package/lib/types/core/card-defaults.d.ts +78 -0
- package/lib/types/core/controller.d.ts +32 -7
- package/lib/types/core/execution-summary.d.ts +52 -0
- package/lib/types/core/extension.d.ts +34 -0
- package/lib/types/core/launch-width.d.ts +31 -0
- package/lib/types/core/reasoning-effort.d.ts +57 -0
- package/lib/types/core/spend-budget.d.ts +28 -0
- package/lib/types/core/subtask.d.ts +30 -8
- package/lib/types/core/tasks.d.ts +51 -1
- package/lib/types/core/use-cases/task-create.d.ts +10 -5
- package/lib/types/core/use-cases/task-update.d.ts +1 -1
- package/lib/types/host/launch-admission.d.ts +72 -0
- package/lib/types/host-ledger.d.ts +33 -6
- package/lib/types/host-runner.d.ts +83 -5
- package/lib/types/host-service.d.ts +116 -2
- package/lib/types/host-spend.d.ts +52 -0
- package/lib/types/index.d.ts +98 -0
- package/lib/types/loopback.d.ts +20 -1
- package/lib/types/protocol.d.ts +13 -0
- package/package.json +28 -28
- package/src/client/CardDefaultPresetField.tsx +101 -0
- package/src/client/PluginSettingsCard.tsx +63 -3
- package/src/client/TaskBoardSettingsCard.tsx +251 -16
- package/src/client/board/LinkSubtaskModal.tsx +8 -0
- package/src/client/board/NewTaskModal.tsx +86 -40
- package/src/client/board/ReasoningEffortField.tsx +50 -0
- package/src/client/board/TaskDetail.tsx +42 -6
- package/src/client/board/model-options.ts +178 -0
- package/src/client/board/preset-label.ts +32 -0
- package/src/client/board/preset-roster.ts +58 -0
- package/src/client/board/team-run-promotion.ts +39 -0
- package/src/client/index.ts +98 -94
- package/src/client/locales.ts +38 -2
- package/src/client/settings-card.module.css +70 -1
- package/src/client/settings-entry-form.ts +0 -1
- package/src/client/telemetry.ts +47 -2
- package/src/core/card-defaults.ts +132 -0
- package/src/core/controller.ts +44 -9
- package/src/core/execution-summary.ts +96 -0
- package/src/core/extension.ts +34 -0
- package/src/core/launch-width.ts +38 -0
- package/src/core/reasoning-effort.ts +92 -0
- package/src/core/spend-budget.ts +35 -0
- package/src/core/store.ts +9 -0
- package/src/core/subtask.ts +48 -13
- package/src/core/tasks.ts +63 -1
- package/src/core/use-cases/task-create.ts +27 -16
- package/src/core/use-cases/task-update.ts +6 -1
- package/src/host/agent-tools.ts +21 -8
- package/src/host/launch-admission.ts +140 -0
- package/src/host-ledger.ts +80 -10
- package/src/host-runner.ts +199 -25
- package/src/host-service.ts +340 -27
- package/src/host-spend.ts +105 -0
- package/src/index.ts +182 -2
- package/src/loopback.ts +25 -1
- package/src/protocol.ts +28 -4
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one execution left behind: the text of its last assistant message,
|
|
3
|
+
* recorded on the execution record next to the verdict it belongs to.
|
|
4
|
+
*
|
|
5
|
+
* A settled execution used to carry only a verdict, so a parent card could see
|
|
6
|
+
* that a subtask succeeded without ever seeing what it produced, and had to
|
|
7
|
+
* guess or redo the work. The card's own content cannot answer that: card
|
|
8
|
+
* content is the plan and freezes at the first execution
|
|
9
|
+
* (`canEditTaskContent`), so the closing words of a run are recorded on the
|
|
10
|
+
* execution record instead.
|
|
11
|
+
*
|
|
12
|
+
* Pure (no cordis, no runtime imports) so the settlement path is unit-testable
|
|
13
|
+
* without a session, and so a text-less run degrades to "no field" rather than
|
|
14
|
+
* to an empty string.
|
|
15
|
+
*/
|
|
16
|
+
import { type ExecutionSummary } from './tasks.ts';
|
|
17
|
+
/** Structural view of one session event, as both readers expose it. */
|
|
18
|
+
export interface SummaryEvent {
|
|
19
|
+
type?: unknown;
|
|
20
|
+
seq?: unknown;
|
|
21
|
+
time?: unknown;
|
|
22
|
+
data?: unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Bound one summary, keeping its tail: the closing paragraphs carry the
|
|
26
|
+
* conclusion a reader is after, and the omitted opening is announced instead of
|
|
27
|
+
* silently dropped. Mirrors the evidence reader's tail bound.
|
|
28
|
+
*/
|
|
29
|
+
export declare function truncateExecutionSummary(text: string, limit?: number): string;
|
|
30
|
+
/**
|
|
31
|
+
* The summary one execution's own events support.
|
|
32
|
+
*
|
|
33
|
+
* Only events at or after `startedAt` belong to this run: a reused session
|
|
34
|
+
* carries the history of earlier executions, which must not be reported as this
|
|
35
|
+
* one's output. The last assistant message WITH prose wins — a trailing
|
|
36
|
+
* tool-call or reasoning-only message has nothing to leave behind, so the reader
|
|
37
|
+
* walks back to the last one that speaks.
|
|
38
|
+
* @param events - the session events the inspection already read.
|
|
39
|
+
* @param startedAt - the execution's start instant (ms epoch); 0 means "all".
|
|
40
|
+
* @returns the bounded summary with the seq it came from, or undefined when the
|
|
41
|
+
* run left no usable text.
|
|
42
|
+
*/
|
|
43
|
+
export declare function executionSummaryOf(events: readonly SummaryEvent[], startedAt: number): ExecutionSummary | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Repair one persisted or reported summary.
|
|
46
|
+
*
|
|
47
|
+
* A summary is informational, so an unreadable one is dropped on its own rather
|
|
48
|
+
* than costing the execution (or the task row) it hangs on. A hand-edited
|
|
49
|
+
* overlong text is bounded on the way in, so no reader ever holds more than the
|
|
50
|
+
* limit.
|
|
51
|
+
*/
|
|
52
|
+
export declare function normalizeExecutionSummary(value: unknown): ExecutionSummary | undefined;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* @module dsh-task-board/core/extension
|
|
13
13
|
*/
|
|
14
14
|
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
15
|
+
import type { TaskBoardAction, TaskBoardSnapshot, TaskBoardVerificationOptions } from '../protocol.ts';
|
|
15
16
|
import type { ExecutionOutcome, TaskRecord, TaskStatus } from './tasks.ts';
|
|
16
17
|
/** Cordis service name the host and browser halves each publish. */
|
|
17
18
|
export declare const TASK_BOARD_SERVICE_NAME = "taskBoard";
|
|
@@ -255,6 +256,39 @@ export interface TaskBoardHostFace {
|
|
|
255
256
|
registerExtension(extension: TaskBoardExtension): () => void;
|
|
256
257
|
/** Whether the board currently runs a given extension (board x extension). */
|
|
257
258
|
isExtensionEnabled(extensionId: string): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* The whole ledger as the board builds it, tasks included.
|
|
261
|
+
*
|
|
262
|
+
* Part of the read/write face an IN-PROCESS consumer drives the board through
|
|
263
|
+
* (the remote bridge plugin forwarding it to a paired phone); a browser half
|
|
264
|
+
* reads the same document over the board's own HTTP surface. Forwards
|
|
265
|
+
* {@link ../host-service.ts | TaskBoardHostService.snapshot}, so nothing is
|
|
266
|
+
* interpreted between the ledger and the caller.
|
|
267
|
+
*/
|
|
268
|
+
snapshot(): TaskBoardSnapshot;
|
|
269
|
+
/**
|
|
270
|
+
* Apply one action through every gate the board already has — the running
|
|
271
|
+
* lock, the permission confirmation, the subtask depth, the schedule budget —
|
|
272
|
+
* and answer the resulting snapshot.
|
|
273
|
+
*
|
|
274
|
+
* The `requestId` is the ledger's own idempotency key, so a caller that
|
|
275
|
+
* retries one envelope does not apply it twice. Refusals are the ledger's:
|
|
276
|
+
* they throw with the Host's own text, which is why this face adds no code
|
|
277
|
+
* table of its own.
|
|
278
|
+
*/
|
|
279
|
+
apply(requestId: string, action: TaskBoardAction, initiator?: string): TaskBoardSnapshot | Promise<TaskBoardSnapshot>;
|
|
280
|
+
/**
|
|
281
|
+
* Follow the board's change notifications. The listener receives no payload —
|
|
282
|
+
* a consumer that needs the state reads {@link snapshot} — and the returned
|
|
283
|
+
* disposer unsubscribes.
|
|
284
|
+
*/
|
|
285
|
+
subscribe(listener: () => void): () => void;
|
|
286
|
+
/**
|
|
287
|
+
* The acceptance settings, the contract they resolve to right now, and the
|
|
288
|
+
* model catalog the choices come from. The same document the board's own
|
|
289
|
+
* `/verification` route serves.
|
|
290
|
+
*/
|
|
291
|
+
verificationOptions(): Promise<TaskBoardVerificationOptions>;
|
|
258
292
|
}
|
|
259
293
|
declare module '@deepseek-ai/cordis' {
|
|
260
294
|
interface Context {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run-launch admission width: the one bound on how many sessions this board
|
|
3
|
+
* starts at the same time.
|
|
4
|
+
*
|
|
5
|
+
* One board action opens a whole subtree, and a team run hands every member of
|
|
6
|
+
* it to the Lead at once, so without a bound the Host asks DSH for dozens of
|
|
7
|
+
* sessions in a single tick. The repository's own measured guidance caps heavy
|
|
8
|
+
* implementation subagents at three (docs/multi-agent-resources.md) and no
|
|
9
|
+
* runtime mechanism enforced it; this setting is that mechanism.
|
|
10
|
+
*
|
|
11
|
+
* The bounds and the default live here rather than in either half, exactly like
|
|
12
|
+
* the roster cadence: the settings card validates a draft against the same
|
|
13
|
+
* range the Host clamps a hand-edited configuration to, and a programmatic
|
|
14
|
+
* mount that names no width gets the default.
|
|
15
|
+
*
|
|
16
|
+
* @module dsh-task-board/core/launch-width
|
|
17
|
+
*/
|
|
18
|
+
/** Width used when neither the settings document nor the mount names one. */
|
|
19
|
+
export declare const DEFAULT_RUN_LAUNCH_WIDTH = 3;
|
|
20
|
+
/** Narrowest accepted width: one launch at a time. */
|
|
21
|
+
export declare const RUN_LAUNCH_WIDTH_MIN = 1;
|
|
22
|
+
/** Widest accepted width. */
|
|
23
|
+
export declare const RUN_LAUNCH_WIDTH_MAX = 16;
|
|
24
|
+
/**
|
|
25
|
+
* Clamp a configured width into the supported range. A value the schema would
|
|
26
|
+
* refuse (non-finite, below the floor, above the ceiling) still leaves the
|
|
27
|
+
* board launching: an out-of-range setting never stalls a run.
|
|
28
|
+
* @param width - configured width, or undefined for the default.
|
|
29
|
+
* @returns the effective width.
|
|
30
|
+
*/
|
|
31
|
+
export declare function normalizeRunLaunchWidth(width: number | undefined): number;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which reasoning effort one execution may actually send.
|
|
3
|
+
*
|
|
4
|
+
* The rule lives here, in one pure place, so the launch path cannot drift from
|
|
5
|
+
* what the picker promises: an effort is sent ONLY for the exact model route
|
|
6
|
+
* whose adapter declares that id. An unsupported value is dropped rather than
|
|
7
|
+
* passed through — the Host validates the selection against the same
|
|
8
|
+
* capability (`resolveCallConfig` rejects an unsupported effort) and the whole
|
|
9
|
+
* model selection would fail with it. An absent effort stays absent: the SDK
|
|
10
|
+
* then materializes the model's own default, which is exactly what "inherit
|
|
11
|
+
* the model" means.
|
|
12
|
+
*
|
|
13
|
+
* A card that pins a bare model id also gets its provider resolved here: the
|
|
14
|
+
* session wire contract requires `provider` (ModelSelection), so the catalog is
|
|
15
|
+
* the only place that can complete the documented `provider/model` or model-id
|
|
16
|
+
* pin.
|
|
17
|
+
*/
|
|
18
|
+
import type { CatalogModel, ModelCatalogView } from './verification.ts';
|
|
19
|
+
/** One execution route an effort resolves against: `provider/model`, or a bare model id. */
|
|
20
|
+
export interface ReasoningRoute {
|
|
21
|
+
provider?: string;
|
|
22
|
+
model: string;
|
|
23
|
+
}
|
|
24
|
+
/** The catalog entry a route names, once the catalog can complete it. */
|
|
25
|
+
export interface DeclaredReasoningRoute {
|
|
26
|
+
provider: string;
|
|
27
|
+
model: string;
|
|
28
|
+
/** The adapter's reasoning metadata; absent when it exposes none. */
|
|
29
|
+
reasoning?: CatalogModel['reasoning'];
|
|
30
|
+
}
|
|
31
|
+
/** What one card's effort resolves to for one route. */
|
|
32
|
+
export interface ReasoningEffortDecision {
|
|
33
|
+
/** The effort to send; absent means "send none". */
|
|
34
|
+
effort?: string;
|
|
35
|
+
/** The card's own value when it will NOT be sent. */
|
|
36
|
+
dropped?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Trim one optional effort: blank text means "not set", like every other pinned target. */
|
|
39
|
+
export declare function normalizeReasoningEffort(value: string | undefined): string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Complete one route through the host catalog: a qualified route must match its
|
|
42
|
+
* provider group, and a bare model id matches the first group carrying it —
|
|
43
|
+
* which is the provider the request then names.
|
|
44
|
+
* @param catalog - the host model catalog, when this deployment serves one.
|
|
45
|
+
* @param route - the route as the card pins it.
|
|
46
|
+
* @returns the completed route with its reasoning metadata, or undefined when
|
|
47
|
+
* the catalog declares no such model.
|
|
48
|
+
*/
|
|
49
|
+
export declare function declaredRoute(catalog: ModelCatalogView | undefined, route: ReasoningRoute): DeclaredReasoningRoute | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the effort one execution sends.
|
|
52
|
+
* @param requested - the card's stored effort (absent or blank = inherit).
|
|
53
|
+
* @param catalog - the host model catalog, when this deployment serves one.
|
|
54
|
+
* @param route - the route the execution will actually run at.
|
|
55
|
+
* @returns the effort to send, or the dropped value that will not be sent.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resolveReasoningEffort(requested: string | undefined, catalog: ModelCatalogView | undefined, route: ReasoningRoute | undefined): ReasoningEffortDecision;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The daily token ceiling both spend gates share, as pure rules: the cap
|
|
3
|
+
* comparison and the one refusal wording.
|
|
4
|
+
*
|
|
5
|
+
* The unit is tokens, not money. The usage ledger the board reads prices only
|
|
6
|
+
* DeepSeek's own routes, so a cost cap would read 0 on every other route and
|
|
7
|
+
* refuse nothing on exactly the deployments that need it. A cap of 0 is the
|
|
8
|
+
* shipped default and means "no gate": both gates answer before they read a
|
|
9
|
+
* file, subscribe to an event, or compute anything.
|
|
10
|
+
* @module @linxin666/dsh-task-board/core/spend-budget
|
|
11
|
+
*/
|
|
12
|
+
/** Token cap one board day may spend; 0 disables the gate. */
|
|
13
|
+
export declare const DEFAULT_SPEND_BUDGET_TOKENS = 0;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a day's measured spend already reached the cap.
|
|
16
|
+
* @param usedTokens - tokens the day's spend measurement reported.
|
|
17
|
+
* @param cap - the configured cap, 0 for "no gate".
|
|
18
|
+
* @returns true when a run must be refused.
|
|
19
|
+
*/
|
|
20
|
+
export declare function spendCapReached(usedTokens: number, cap: number): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The refusal text both gates report: the thrown message a client sees as
|
|
23
|
+
* board-refused, and the scheduler error a due occurrence records.
|
|
24
|
+
* @param usedTokens - tokens the day's spend measurement reported.
|
|
25
|
+
* @param cap - the configured cap.
|
|
26
|
+
* @returns the refusal message.
|
|
27
|
+
*/
|
|
28
|
+
export declare function spendCapMessage(usedTokens: number, cap: number): string;
|
|
@@ -76,11 +76,32 @@ export interface ParentLinkCheck {
|
|
|
76
76
|
export declare function checkParentLink(tasks: readonly TaskRecord[], childId: string, parentId: string | null, maxSubtaskDepth: number, lineage?: LineageIndex): ParentLinkCheck;
|
|
77
77
|
/**
|
|
78
78
|
* The tasks one run request opens executions for: the requested task first,
|
|
79
|
-
* then its on-board descendants within the configured depth.
|
|
80
|
-
*
|
|
81
|
-
* the
|
|
79
|
+
* then its on-board descendants within the configured depth. This is the
|
|
80
|
+
* SHAPE of a cascade — every walk that must see the whole tree (settlement,
|
|
81
|
+
* archive/restore, the running lock) reads it. The run path filters it with
|
|
82
|
+
* {@link joinsCascadeRun}: archived tasks never run, a participant that already
|
|
83
|
+
* has an open execution is skipped by the caller, which cannot start it twice,
|
|
84
|
+
* and a finished descendant is left alone.
|
|
82
85
|
*/
|
|
83
86
|
export declare function cascadeTargets(tasks: readonly TaskRecord[], rootId: string, maxSubtaskDepth: number): TaskRecord[];
|
|
87
|
+
/**
|
|
88
|
+
* Whether a cascade member takes part in a new run.
|
|
89
|
+
*
|
|
90
|
+
* The task the user ran is always a member: the request names that card, and
|
|
91
|
+
* the operator asked for it to run whatever its column says. A descendant does
|
|
92
|
+
* not join once it sits in the `done` column — its work is finished, so running
|
|
93
|
+
* the parent again is a run of the parent, never a second execution of work
|
|
94
|
+
* that is already done. The rule keys on the column alone, so it covers both a
|
|
95
|
+
* subtask that ran and one an operator moved to done by hand, and it holds for
|
|
96
|
+
* every trigger: a manual run, a re-run, and a due occurrence of a schedule.
|
|
97
|
+
* A card whose own schedule is enabled settles back into `todo`, so a scheduled
|
|
98
|
+
* subtask stays a participant; to make a finished one run again, move it back
|
|
99
|
+
* to `todo` or run it on its own.
|
|
100
|
+
* @param task - the candidate member.
|
|
101
|
+
* @param rootId - the task the run request named.
|
|
102
|
+
* @returns false when this member is left alone by the run.
|
|
103
|
+
*/
|
|
104
|
+
export declare function joinsCascadeRun(task: TaskRecord, rootId: string): boolean;
|
|
84
105
|
/** One still-open execution belonging to a cascade run group. */
|
|
85
106
|
export interface OpenCascadeChild {
|
|
86
107
|
taskId: string;
|
|
@@ -114,11 +135,12 @@ export declare function effectiveTaskPermission(task: TaskRecord): TaskRecord['p
|
|
|
114
135
|
/**
|
|
115
136
|
* Resolve the execution targets a (sub)task actually runs with: its own value
|
|
116
137
|
* wins, and an unset target inherits the nearest ancestor up to the root.
|
|
117
|
-
* Workspace, agent preset and
|
|
118
|
-
* handover bundle is a per-card continuation artefact and is never
|
|
119
|
-
* The permission inherits the ancestor's EFFECTIVE binding, and its
|
|
120
|
-
* confirmation travels with it, so a subtask of an already-confirmed
|
|
121
|
-
* card is runnable while a subtask's own unconfirmed binding stays
|
|
138
|
+
* Workspace, agent preset, model and reasoning effort inherit the ancestor's
|
|
139
|
+
* PIN only — a handover bundle is a per-card continuation artefact and is never
|
|
140
|
+
* inherited. The permission inherits the ancestor's EFFECTIVE binding, and its
|
|
141
|
+
* human confirmation travels with it, so a subtask of an already-confirmed
|
|
142
|
+
* elevated card is runnable while a subtask's own unconfirmed binding stays
|
|
143
|
+
* gated.
|
|
122
144
|
*/
|
|
123
145
|
/**
|
|
124
146
|
* The immutable teammate name for one team-mode member. Teammate names are
|
|
@@ -12,6 +12,27 @@ import { type TaskBoardExtensionPayload } from './extension.ts';
|
|
|
12
12
|
export type TaskStatus = 'backlog' | 'todo' | 'running' | 'done' | 'failed';
|
|
13
13
|
/** Settled outcome of one execution attempt. */
|
|
14
14
|
export type ExecutionOutcome = 'succeeded' | 'failed' | 'cancelled';
|
|
15
|
+
/**
|
|
16
|
+
* What one execution left behind: the text of the run's last assistant message
|
|
17
|
+
* and the session event it was read from.
|
|
18
|
+
*
|
|
19
|
+
* The board records a verdict per execution but no output, so a parent card
|
|
20
|
+
* could see that a subtask succeeded without seeing what it produced. Card
|
|
21
|
+
* content cannot answer that (it is the plan and freezes at the first
|
|
22
|
+
* execution), so the closing text rides the execution record instead.
|
|
23
|
+
*/
|
|
24
|
+
export interface ExecutionSummary {
|
|
25
|
+
/** Last assistant message text of the run, bounded by {@link EXECUTION_SUMMARY_LIMIT}. */
|
|
26
|
+
text: string;
|
|
27
|
+
/** Seq of the session event that text came from; absent text has no seq either. */
|
|
28
|
+
seq: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Upper bound of one recorded summary, in characters. The ledger stores a
|
|
32
|
+
* conclusion, not a transcript: a reader that needs the whole message follows
|
|
33
|
+
* {@link ExecutionSummary.seq} into the session history.
|
|
34
|
+
*/
|
|
35
|
+
export declare const EXECUTION_SUMMARY_LIMIT = 4000;
|
|
15
36
|
/**
|
|
16
37
|
* One real execution attempt: the run's own id, the dsh session that ran it
|
|
17
38
|
* (filled once the session is created), and the settled outcome once the
|
|
@@ -69,6 +90,16 @@ export interface ExecutionRecord {
|
|
|
69
90
|
ownResult?: ExecutionOutcome;
|
|
70
91
|
/** Human failure text that arrived with {@link ownResult}. */
|
|
71
92
|
ownError?: string;
|
|
93
|
+
/**
|
|
94
|
+
* What this run left behind: the text of its last assistant message, taken
|
|
95
|
+
* when the settlement read the session and recorded with the verdict.
|
|
96
|
+
*
|
|
97
|
+
* Absent — never an empty string — when the session could not be read or
|
|
98
|
+
* carried no assistant prose, so "recorded nothing" stays distinguishable
|
|
99
|
+
* from "produced nothing". Settling never fails over it: a summary is
|
|
100
|
+
* informational, and every field above is what the board decides with.
|
|
101
|
+
*/
|
|
102
|
+
summary?: ExecutionSummary;
|
|
72
103
|
/**
|
|
73
104
|
* Goal acceptance state of this execution (task-board goal verification).
|
|
74
105
|
* Fixed when the execution starts and never rewritten from later settings:
|
|
@@ -325,6 +356,15 @@ export interface TaskRecord {
|
|
|
325
356
|
* absent falls back to the host default (agent-default-model).
|
|
326
357
|
*/
|
|
327
358
|
model?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Reasoning effort pinned for that execution route (an adapter-owned id such
|
|
361
|
+
* as "high"). Absent (or blank) means INHERIT: the session runs at the
|
|
362
|
+
* model's own default level, exactly as a card written before the field
|
|
363
|
+
* existed does. The launch sends the value only when the target model's
|
|
364
|
+
* adapter declares that exact id, so switching a card to a model without
|
|
365
|
+
* that level never pushes an invalid selection (see core/reasoning-effort.ts).
|
|
366
|
+
*/
|
|
367
|
+
reasoningEffort?: string;
|
|
328
368
|
/**
|
|
329
369
|
* Whether later executions continue in the previous execution's session
|
|
330
370
|
* (issue #1419) instead of minting a fresh conversation per run. Absent or
|
|
@@ -446,6 +486,16 @@ export interface NewTaskInput {
|
|
|
446
486
|
permission?: TaskPermission;
|
|
447
487
|
/** Optional pinned model for the execution session; absent = host default. */
|
|
448
488
|
model?: string;
|
|
489
|
+
/** Optional reasoning effort for that model route; empty/absent = the model's own default. */
|
|
490
|
+
reasoningEffort?: string;
|
|
491
|
+
/**
|
|
492
|
+
* Opt in to the deployment's new-card defaults: a target this input leaves
|
|
493
|
+
* out is filled from the configured default (agent preset, permission, model
|
|
494
|
+
* and the level bound to that model). Absent means the create stores exactly
|
|
495
|
+
* what it was given, which is what the extension provider's own create path
|
|
496
|
+
* and the legacy import rely on.
|
|
497
|
+
*/
|
|
498
|
+
applyCardDefaults?: boolean;
|
|
449
499
|
/** Reuse the previous execution's session for later runs (issue #1419). */
|
|
450
500
|
reuseSession?: boolean;
|
|
451
501
|
/** Run the subtree as an Agent Team (Team Lead session plus one teammate per direct subtask). */
|
|
@@ -596,6 +646,6 @@ export declare function settledStatus(task: TaskRecord, outcome: ExecutionOutcom
|
|
|
596
646
|
* matching column. No-op (returns the input task) when the execution is not
|
|
597
647
|
* the task's latest or is already settled.
|
|
598
648
|
*/
|
|
599
|
-
export declare function settleExecution(task: TaskRecord, executionId: string, outcome: ExecutionOutcome, now: number, error: string | undefined): TaskRecord;
|
|
649
|
+
export declare function settleExecution(task: TaskRecord, executionId: string, outcome: ExecutionOutcome, now: number, error: string | undefined, summary?: ExecutionSummary): TaskRecord;
|
|
600
650
|
/** A settled-execution summary string for the detail view. */
|
|
601
651
|
export declare function executionLabel(execution: ExecutionRecord): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CardDefaults } from '../card-defaults.ts';
|
|
1
2
|
import { type NewTaskInput, type TaskRecord } from '../tasks.ts';
|
|
2
3
|
/** Result of a create transition: the new task (when accepted) + the next ledger. */
|
|
3
4
|
export interface CreateTaskResult {
|
|
@@ -13,15 +14,19 @@ export interface CreateTaskResult {
|
|
|
13
14
|
* appended ledger, or the unchanged ledger when the title is blank or the
|
|
14
15
|
* requested parent link is refused.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* The execution targets resolve through {@link resolveCardTargets}: what the
|
|
18
|
+
* caller sent wins, then the parent's own pins, then - only when the caller
|
|
19
|
+
* opted in with `applyCardDefaults` - the deployment's configured new-card
|
|
20
|
+
* defaults. Without the flag the resolution sees no defaults at all, which is
|
|
21
|
+
* exactly the inline parent inheritance this path has always applied. The
|
|
22
|
+
* workspace is not part of that resolution: a subtask still takes the parent's
|
|
23
|
+
* workspace, and the defaults never name one.
|
|
20
24
|
* @param tasks - current ledger.
|
|
21
25
|
* @param input - raw user input (title/description/prompt + optional schedule/parent).
|
|
22
26
|
* @param now - clock instant (ms epoch).
|
|
23
27
|
* @param id - minted task id.
|
|
24
28
|
* @param maxSubtaskDepth - deployment subtask depth limit.
|
|
25
29
|
* @param hostTimeZone - zone a rule that stores no zone of its own follows.
|
|
30
|
+
* @param cardDefaults - the deployment's new-card defaults, read live at creation.
|
|
26
31
|
*/
|
|
27
|
-
export declare function applyCreateTask(tasks: readonly TaskRecord[], input: NewTaskInput, now: number, id: string, maxSubtaskDepth?: number, hostTimeZone?: string): CreateTaskResult;
|
|
32
|
+
export declare function applyCreateTask(tasks: readonly TaskRecord[], input: NewTaskInput, now: number, id: string, maxSubtaskDepth?: number, hostTimeZone?: string, cardDefaults?: CardDefaults): CreateTaskResult;
|
|
@@ -15,7 +15,7 @@ import type { TaskHandoverInput } from '../handover.ts';
|
|
|
15
15
|
* Editable fields on a task (the update patch surface). `freeze` replaces the
|
|
16
16
|
* continuation-card snapshot (restamping frozenAt); an explicit null clears it.
|
|
17
17
|
*/
|
|
18
|
-
export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' | 'prompt' | 'workspaceId' | 'mode' | 'permission' | 'model' | 'reuseSession' | 'teamRun' | 'goalRun' | 'skipVerification'>> & {
|
|
18
|
+
export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' | 'prompt' | 'workspaceId' | 'mode' | 'permission' | 'model' | 'reasoningEffort' | 'reuseSession' | 'teamRun' | 'goalRun' | 'skipVerification'>> & {
|
|
19
19
|
freeze?: FreezeSnapshot & {
|
|
20
20
|
redacted?: boolean;
|
|
21
21
|
} | null;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admission control for the session-creating half of a run.
|
|
3
|
+
*
|
|
4
|
+
* One board action can open a whole subtree, and a team run hands every member
|
|
5
|
+
* of it to the Lead at once. Both paths used to fire every launch in the same
|
|
6
|
+
* tick, so the Host asked DSH for N sessions at once — the burst the repository's
|
|
7
|
+
* measured guidance caps at three heavy implementation subagents
|
|
8
|
+
* (docs/multi-agent-resources.md), with no mechanism enforcing it.
|
|
9
|
+
*
|
|
10
|
+
* The queue is SERVICE-wide, not per run group: the pressure it bounds is the
|
|
11
|
+
* machine's (the Host process's memory and the swap it drives), and two run
|
|
12
|
+
* groups opened from two tabs share one Host. Admission is round-robin across
|
|
13
|
+
* run groups — FIFO inside a group, so a group's first run (the Lead, which
|
|
14
|
+
* carries the run shape and the teammate namespace) always starts before its
|
|
15
|
+
* members — so a large subtree cannot starve a run opened after it, and no
|
|
16
|
+
* entry can be starved.
|
|
17
|
+
*
|
|
18
|
+
* The width is read through a live callback, so a settings edit takes effect on
|
|
19
|
+
* the next admission without remounting anything.
|
|
20
|
+
*
|
|
21
|
+
* @module dsh-task-board/host/launch-admission
|
|
22
|
+
*/
|
|
23
|
+
/** One launch the queue has not started yet. */
|
|
24
|
+
export interface QueuedLaunch {
|
|
25
|
+
/** Run group this launch belongs to; the unit of round-robin fairness. */
|
|
26
|
+
readonly groupId: string;
|
|
27
|
+
/**
|
|
28
|
+
* Perform the launch. The slot is held until this promise settles, which
|
|
29
|
+
* makes "in flight" mean "still creating and prompting its session".
|
|
30
|
+
* A rejection is swallowed here so one broken launch can never wedge the
|
|
31
|
+
* slot; the caller owns reporting.
|
|
32
|
+
*/
|
|
33
|
+
start(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Called by {@link LaunchAdmissionQueue.drain} for a launch that never
|
|
36
|
+
* started, so the caller can take its execution out of the running column.
|
|
37
|
+
*/
|
|
38
|
+
abandon(): void;
|
|
39
|
+
}
|
|
40
|
+
export declare class LaunchAdmissionQueue {
|
|
41
|
+
private readonly width;
|
|
42
|
+
/** Waiting launches per run group, in arrival order. */
|
|
43
|
+
private readonly waiting;
|
|
44
|
+
/** Run groups in round-robin order. */
|
|
45
|
+
private rotation;
|
|
46
|
+
/** Slot holders of the launches in flight, one per admitted launch. */
|
|
47
|
+
private readonly inFlight;
|
|
48
|
+
/** Highest number of launches in flight at once; observability and tests. */
|
|
49
|
+
peakInFlight: number;
|
|
50
|
+
/**
|
|
51
|
+
* @param width - live admission width (already normalized by the caller).
|
|
52
|
+
*/
|
|
53
|
+
constructor(width: () => number);
|
|
54
|
+
/** Launches the queue has not admitted yet. */
|
|
55
|
+
get pendingCount(): number;
|
|
56
|
+
/** Launches currently holding a slot. */
|
|
57
|
+
get inFlightCount(): number;
|
|
58
|
+
/** Admit one launch, immediately if a slot is free. */
|
|
59
|
+
enqueue(launch: QueuedLaunch): void;
|
|
60
|
+
/**
|
|
61
|
+
* Abandon every waiting launch: the queue is being torn down, so an entry
|
|
62
|
+
* that never started can never start. Launches already in flight are left
|
|
63
|
+
* alone — their session may already exist, and the callers that own them
|
|
64
|
+
* settle them through the normal path.
|
|
65
|
+
* @returns the abandoned launches, in abandonment order.
|
|
66
|
+
*/
|
|
67
|
+
drain(): QueuedLaunch[];
|
|
68
|
+
private pump;
|
|
69
|
+
/** The next launch by round-robin across groups and FIFO inside one. */
|
|
70
|
+
private takeNext;
|
|
71
|
+
private admit;
|
|
72
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ExecutionOutcome, type ExecutionRecord, type ScheduleMode, type TaskRecord } from './core/tasks.ts';
|
|
1
|
+
import { type ExecutionOutcome, type ExecutionRecord, type ExecutionSummary, type ScheduleMode, type TaskRecord } from './core/tasks.ts';
|
|
2
|
+
import type { CardDefaults } from './core/card-defaults.ts';
|
|
2
3
|
import { type TaskBoardAction, type TaskBoardSchedulerSnapshot } from './protocol.ts';
|
|
3
4
|
import { type ExecutionVerification } from './core/verification.ts';
|
|
4
5
|
import { type TaskPermission } from './core/handover.ts';
|
|
@@ -125,9 +126,22 @@ export declare class HostTaskLedger {
|
|
|
125
126
|
* instead of remounting the row.
|
|
126
127
|
*/
|
|
127
128
|
private depthLimit;
|
|
129
|
+
/** Live reader of the deployment's new-card defaults (a volatile config read). */
|
|
130
|
+
private readonly cardDefaults;
|
|
131
|
+
/**
|
|
132
|
+
* Live reader of the daily token cap (0 = no gate). The scheduled path asks it
|
|
133
|
+
* per due occurrence, so a cap raised after a skipped occurrence admits the
|
|
134
|
+
* next one without a restart.
|
|
135
|
+
*/
|
|
136
|
+
private readonly spendBudget;
|
|
137
|
+
/** Today's measured spend in tokens, or undefined when nothing can be measured. */
|
|
138
|
+
private readonly spendUsed;
|
|
128
139
|
constructor(dir?: string, now?: () => number, options?: {
|
|
129
140
|
sessionDefaultPermission?: TaskPermission | (() => TaskPermission);
|
|
130
141
|
maxSubtaskDepth?: number;
|
|
142
|
+
cardDefaults?: () => CardDefaults;
|
|
143
|
+
spendBudgetTokens?: () => number;
|
|
144
|
+
spendUsedToday?: (now: number) => number | undefined;
|
|
131
145
|
});
|
|
132
146
|
/** Current subtask depth limit (1..3). */
|
|
133
147
|
get maxSubtaskDepth(): number;
|
|
@@ -184,6 +198,14 @@ export declare class HostTaskLedger {
|
|
|
184
198
|
* @returns the executions this occurrence opened.
|
|
185
199
|
*/
|
|
186
200
|
openScheduled(taskId: string, triggeredAt: number): OpenedRun[];
|
|
201
|
+
/**
|
|
202
|
+
* Why a due occurrence may not open a run because the day already spent the
|
|
203
|
+
* cap, or undefined when it may. A cap of 0 — the default — answers before the
|
|
204
|
+
* measurement is read, so a board with no gate reads no ledger file.
|
|
205
|
+
* @param now - clock instant (ms epoch).
|
|
206
|
+
* @returns the refusal message, when the cap is reached.
|
|
207
|
+
*/
|
|
208
|
+
private spendRefusal;
|
|
187
209
|
/**
|
|
188
210
|
* Record a due occurrence that opened no execution: roll a recurring rule to
|
|
189
211
|
* its next occurrence (budget untouched), or stop it when there is none. A
|
|
@@ -219,8 +241,12 @@ export declare class HostTaskLedger {
|
|
|
219
241
|
* and only finalizes once every child execution in its run group has
|
|
220
242
|
* settled, so a parent card leaves 'running' with the whole tree's verdict
|
|
221
243
|
* rather than its own turn alone.
|
|
244
|
+
*
|
|
245
|
+
* `summary` is what the run left behind (see `ExecutionSummary`), passed in
|
|
246
|
+
* by whichever reader observed the session. It is informational: a caller
|
|
247
|
+
* without one settles exactly as before, and a settlement never waits on it.
|
|
222
248
|
*/
|
|
223
|
-
settle(taskId: string, executionId: string, outcome: ExecutionOutcome, error?: string): void;
|
|
249
|
+
settle(taskId: string, executionId: string, outcome: ExecutionOutcome, error?: string, summary?: ExecutionSummary): void;
|
|
224
250
|
attachSession(taskId: string, executionId: string, sessionId: string): void;
|
|
225
251
|
allTasks(): readonly TaskRecord[];
|
|
226
252
|
getTask(id: string): TaskRecord | undefined;
|
|
@@ -259,10 +285,11 @@ export declare class HostTaskLedger {
|
|
|
259
285
|
/** Whether a task or any of its subtasks still has an open execution. */
|
|
260
286
|
private subtreeHasOpenExecution;
|
|
261
287
|
/**
|
|
262
|
-
* Open one execution per cascade participant
|
|
263
|
-
* on-board descendants, within the depth limit) under
|
|
264
|
-
* commit the ledger once.
|
|
265
|
-
*
|
|
288
|
+
* Open one execution per cascade participant that still has work (the
|
|
289
|
+
* requested task and its on-board descendants, within the depth limit) under
|
|
290
|
+
* a single run group, and commit the ledger once. A descendant in 'done' is
|
|
291
|
+
* not a participant ({@link joinsCascadeRun}). The returned runs are ordered
|
|
292
|
+
* root-first, so the Host launches the parent before its subtasks.
|
|
266
293
|
* @param root - the task the user ran.
|
|
267
294
|
* @param now - clock instant (ms epoch).
|
|
268
295
|
* @param initiator - the DSH session that asked for the run (audit only).
|