@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
package/src/core/subtask.ts
CHANGED
|
@@ -183,9 +183,12 @@ export function checkParentLink(
|
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
185
|
* The tasks one run request opens executions for: the requested task first,
|
|
186
|
-
* then its on-board descendants within the configured depth.
|
|
187
|
-
*
|
|
188
|
-
* the
|
|
186
|
+
* then its on-board descendants within the configured depth. This is the
|
|
187
|
+
* SHAPE of a cascade — every walk that must see the whole tree (settlement,
|
|
188
|
+
* archive/restore, the running lock) reads it. The run path filters it with
|
|
189
|
+
* {@link joinsCascadeRun}: archived tasks never run, a participant that already
|
|
190
|
+
* has an open execution is skipped by the caller, which cannot start it twice,
|
|
191
|
+
* and a finished descendant is left alone.
|
|
189
192
|
*/
|
|
190
193
|
export function cascadeTargets(
|
|
191
194
|
tasks: readonly TaskRecord[],
|
|
@@ -197,6 +200,27 @@ export function cascadeTargets(
|
|
|
197
200
|
return [root, ...descendantTasks(tasks, rootId, maxSubtaskDepth)]
|
|
198
201
|
}
|
|
199
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Whether a cascade member takes part in a new run.
|
|
205
|
+
*
|
|
206
|
+
* The task the user ran is always a member: the request names that card, and
|
|
207
|
+
* the operator asked for it to run whatever its column says. A descendant does
|
|
208
|
+
* not join once it sits in the `done` column — its work is finished, so running
|
|
209
|
+
* the parent again is a run of the parent, never a second execution of work
|
|
210
|
+
* that is already done. The rule keys on the column alone, so it covers both a
|
|
211
|
+
* subtask that ran and one an operator moved to done by hand, and it holds for
|
|
212
|
+
* every trigger: a manual run, a re-run, and a due occurrence of a schedule.
|
|
213
|
+
* A card whose own schedule is enabled settles back into `todo`, so a scheduled
|
|
214
|
+
* subtask stays a participant; to make a finished one run again, move it back
|
|
215
|
+
* to `todo` or run it on its own.
|
|
216
|
+
* @param task - the candidate member.
|
|
217
|
+
* @param rootId - the task the run request named.
|
|
218
|
+
* @returns false when this member is left alone by the run.
|
|
219
|
+
*/
|
|
220
|
+
export function joinsCascadeRun(task: TaskRecord, rootId: string): boolean {
|
|
221
|
+
return task.id === rootId || task.status !== 'done'
|
|
222
|
+
}
|
|
223
|
+
|
|
200
224
|
/** One still-open execution belonging to a cascade run group. */
|
|
201
225
|
export interface OpenCascadeChild {
|
|
202
226
|
taskId: string
|
|
@@ -263,11 +287,12 @@ export function effectiveTaskPermission(task: TaskRecord): TaskRecord['permissio
|
|
|
263
287
|
/**
|
|
264
288
|
* Resolve the execution targets a (sub)task actually runs with: its own value
|
|
265
289
|
* wins, and an unset target inherits the nearest ancestor up to the root.
|
|
266
|
-
* Workspace, agent preset and
|
|
267
|
-
* handover bundle is a per-card continuation artefact and is never
|
|
268
|
-
* The permission inherits the ancestor's EFFECTIVE binding, and its
|
|
269
|
-
* confirmation travels with it, so a subtask of an already-confirmed
|
|
270
|
-
* card is runnable while a subtask's own unconfirmed binding stays
|
|
290
|
+
* Workspace, agent preset, model and reasoning effort inherit the ancestor's
|
|
291
|
+
* PIN only — a handover bundle is a per-card continuation artefact and is never
|
|
292
|
+
* inherited. The permission inherits the ancestor's EFFECTIVE binding, and its
|
|
293
|
+
* human confirmation travels with it, so a subtask of an already-confirmed
|
|
294
|
+
* elevated card is runnable while a subtask's own unconfirmed binding stays
|
|
295
|
+
* gated.
|
|
271
296
|
*/
|
|
272
297
|
/**
|
|
273
298
|
* The immutable teammate name for one team-mode member. Teammate names are
|
|
@@ -317,13 +342,22 @@ export function resolveExecutionTargets(
|
|
|
317
342
|
): TaskRecord {
|
|
318
343
|
if (task.parentId === undefined) return task
|
|
319
344
|
const chain = [task, ...ancestorChain(tasks, task).slice(0, maxSubtaskDepth)]
|
|
320
|
-
const first = (key: 'workspaceId' | 'mode' | 'model'): string | undefined => {
|
|
321
|
-
for (const candidate of
|
|
345
|
+
const first = (key: 'workspaceId' | 'mode' | 'model' | 'reasoningEffort', candidates: readonly TaskRecord[]): string | undefined => {
|
|
346
|
+
for (const candidate of candidates) {
|
|
322
347
|
const value = candidate[key]
|
|
323
348
|
if (value !== undefined) return value
|
|
324
349
|
}
|
|
325
350
|
return undefined
|
|
326
351
|
}
|
|
352
|
+
// The model pin is the boundary of the effort: an effort is only ever taken
|
|
353
|
+
// from the card the model came from, or from the card that pinned it below
|
|
354
|
+
// that one. A card with a model of its own thus sends NO effort when it stores
|
|
355
|
+
// none — the model's own default — instead of quietly running at an ancestor
|
|
356
|
+
// level chosen for a different model, even when both models declare that
|
|
357
|
+
// level. A card with no model of its own still inherits the nearest model
|
|
358
|
+
// together with the nearest level pinned at or below it.
|
|
359
|
+
const boundary = chain.findIndex(candidate => candidate.model !== undefined)
|
|
360
|
+
const effortChain = boundary === -1 ? chain : chain.slice(0, boundary + 1)
|
|
327
361
|
const own = effectiveTaskPermission(task)
|
|
328
362
|
// An own binding (pin or handover) keeps its own confirmation stamp; only an
|
|
329
363
|
// absent one borrows the ancestor's binding AND that ancestor's stamp.
|
|
@@ -332,9 +366,10 @@ export function resolveExecutionTargets(
|
|
|
332
366
|
: undefined
|
|
333
367
|
return {
|
|
334
368
|
...task,
|
|
335
|
-
workspaceId: first('workspaceId'),
|
|
336
|
-
mode: first('mode'),
|
|
337
|
-
model: first('model'),
|
|
369
|
+
workspaceId: first('workspaceId', chain),
|
|
370
|
+
mode: first('mode', chain),
|
|
371
|
+
model: first('model', chain),
|
|
372
|
+
reasoningEffort: first('reasoningEffort', effortChain),
|
|
338
373
|
permission: own ?? (owner === undefined ? undefined : effectiveTaskPermission(owner)),
|
|
339
374
|
permissionConfirmedAt: own === undefined ? owner?.permissionConfirmedAt : task.permissionConfirmedAt,
|
|
340
375
|
}
|
package/src/core/tasks.ts
CHANGED
|
@@ -15,6 +15,29 @@ export type TaskStatus = 'backlog' | 'todo' | 'running' | 'done' | 'failed'
|
|
|
15
15
|
/** Settled outcome of one execution attempt. */
|
|
16
16
|
export type ExecutionOutcome = 'succeeded' | 'failed' | 'cancelled'
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* What one execution left behind: the text of the run's last assistant message
|
|
20
|
+
* and the session event it was read from.
|
|
21
|
+
*
|
|
22
|
+
* The board records a verdict per execution but no output, so a parent card
|
|
23
|
+
* could see that a subtask succeeded without seeing what it produced. Card
|
|
24
|
+
* content cannot answer that (it is the plan and freezes at the first
|
|
25
|
+
* execution), so the closing text rides the execution record instead.
|
|
26
|
+
*/
|
|
27
|
+
export interface ExecutionSummary {
|
|
28
|
+
/** Last assistant message text of the run, bounded by {@link EXECUTION_SUMMARY_LIMIT}. */
|
|
29
|
+
text: string
|
|
30
|
+
/** Seq of the session event that text came from; absent text has no seq either. */
|
|
31
|
+
seq: number
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Upper bound of one recorded summary, in characters. The ledger stores a
|
|
36
|
+
* conclusion, not a transcript: a reader that needs the whole message follows
|
|
37
|
+
* {@link ExecutionSummary.seq} into the session history.
|
|
38
|
+
*/
|
|
39
|
+
export const EXECUTION_SUMMARY_LIMIT = 4000
|
|
40
|
+
|
|
18
41
|
/**
|
|
19
42
|
* One real execution attempt: the run's own id, the dsh session that ran it
|
|
20
43
|
* (filled once the session is created), and the settled outcome once the
|
|
@@ -72,6 +95,16 @@ export interface ExecutionRecord {
|
|
|
72
95
|
ownResult?: ExecutionOutcome
|
|
73
96
|
/** Human failure text that arrived with {@link ownResult}. */
|
|
74
97
|
ownError?: string
|
|
98
|
+
/**
|
|
99
|
+
* What this run left behind: the text of its last assistant message, taken
|
|
100
|
+
* when the settlement read the session and recorded with the verdict.
|
|
101
|
+
*
|
|
102
|
+
* Absent — never an empty string — when the session could not be read or
|
|
103
|
+
* carried no assistant prose, so "recorded nothing" stays distinguishable
|
|
104
|
+
* from "produced nothing". Settling never fails over it: a summary is
|
|
105
|
+
* informational, and every field above is what the board decides with.
|
|
106
|
+
*/
|
|
107
|
+
summary?: ExecutionSummary
|
|
75
108
|
/**
|
|
76
109
|
* Goal acceptance state of this execution (task-board goal verification).
|
|
77
110
|
* Fixed when the execution starts and never rewritten from later settings:
|
|
@@ -406,6 +439,15 @@ export interface TaskRecord {
|
|
|
406
439
|
* absent falls back to the host default (agent-default-model).
|
|
407
440
|
*/
|
|
408
441
|
model?: string
|
|
442
|
+
/**
|
|
443
|
+
* Reasoning effort pinned for that execution route (an adapter-owned id such
|
|
444
|
+
* as "high"). Absent (or blank) means INHERIT: the session runs at the
|
|
445
|
+
* model's own default level, exactly as a card written before the field
|
|
446
|
+
* existed does. The launch sends the value only when the target model's
|
|
447
|
+
* adapter declares that exact id, so switching a card to a model without
|
|
448
|
+
* that level never pushes an invalid selection (see core/reasoning-effort.ts).
|
|
449
|
+
*/
|
|
450
|
+
reasoningEffort?: string
|
|
409
451
|
/**
|
|
410
452
|
* Whether later executions continue in the previous execution's session
|
|
411
453
|
* (issue #1419) instead of minting a fresh conversation per run. Absent or
|
|
@@ -535,6 +577,16 @@ export interface NewTaskInput {
|
|
|
535
577
|
permission?: TaskPermission
|
|
536
578
|
/** Optional pinned model for the execution session; absent = host default. */
|
|
537
579
|
model?: string
|
|
580
|
+
/** Optional reasoning effort for that model route; empty/absent = the model's own default. */
|
|
581
|
+
reasoningEffort?: string
|
|
582
|
+
/**
|
|
583
|
+
* Opt in to the deployment's new-card defaults: a target this input leaves
|
|
584
|
+
* out is filled from the configured default (agent preset, permission, model
|
|
585
|
+
* and the level bound to that model). Absent means the create stores exactly
|
|
586
|
+
* what it was given, which is what the extension provider's own create path
|
|
587
|
+
* and the legacy import rely on.
|
|
588
|
+
*/
|
|
589
|
+
applyCardDefaults?: boolean
|
|
538
590
|
/** Reuse the previous execution's session for later runs (issue #1419). */
|
|
539
591
|
reuseSession?: boolean
|
|
540
592
|
/** Run the subtree as an Agent Team (Team Lead session plus one teammate per direct subtask). */
|
|
@@ -699,6 +751,7 @@ export function createTask(input: NewTaskInput, now: number, id: string): TaskRe
|
|
|
699
751
|
mode: normalizeTargetId(input.mode),
|
|
700
752
|
permission: isTaskPermission(input.permission) ? input.permission : undefined,
|
|
701
753
|
model: normalizeTargetId(input.model),
|
|
754
|
+
reasoningEffort: normalizeTargetId(input.reasoningEffort),
|
|
702
755
|
reuseSession: input.reuseSession === true ? true : undefined,
|
|
703
756
|
teamRun: input.teamRun === true ? true : undefined,
|
|
704
757
|
// Default OFF: only an explicit true is stored, so a card that never
|
|
@@ -823,12 +876,21 @@ export function settleExecution(
|
|
|
823
876
|
outcome: ExecutionOutcome,
|
|
824
877
|
now: number,
|
|
825
878
|
error: string | undefined,
|
|
879
|
+
summary?: ExecutionSummary,
|
|
826
880
|
): TaskRecord {
|
|
827
881
|
const index = task.executions.findIndex(execution => execution.id === executionId)
|
|
828
882
|
if (index === -1) return task
|
|
829
883
|
const execution = task.executions[index]
|
|
830
884
|
if (execution.endedAt !== undefined) return task
|
|
831
|
-
|
|
885
|
+
// A settle without one keeps whatever an earlier settle already recorded: a
|
|
886
|
+
// cascade parent's final fold has no session of its own to read.
|
|
887
|
+
const settled: ExecutionRecord = {
|
|
888
|
+
...execution,
|
|
889
|
+
endedAt: now,
|
|
890
|
+
result: outcome,
|
|
891
|
+
error,
|
|
892
|
+
...(summary === undefined ? {} : { summary }),
|
|
893
|
+
}
|
|
832
894
|
const executions = [...task.executions]
|
|
833
895
|
executions[index] = settled
|
|
834
896
|
return { ...task, status: settledStatus(task, outcome), updatedAt: now, executions }
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { isValidCron, isValidTimeZone, nextRunAtMs, resolveHostTimeZone } from '../schedule.ts'
|
|
8
8
|
import { DEFAULT_SUBTASK_DEPTH, normalizeSubtaskDepth, taskDepth } from '../subtask.ts'
|
|
9
|
-
import {
|
|
9
|
+
import { resolveCardTargets, type CardDefaults } from '../card-defaults.ts'
|
|
10
|
+
import { createTask, isTaskPermission, withSchedule, type NewTaskInput, type TaskRecord } from '../tasks.ts'
|
|
10
11
|
|
|
11
12
|
/** Result of a create transition: the new task (when accepted) + the next ledger. */
|
|
12
13
|
export interface CreateTaskResult {
|
|
@@ -23,16 +24,20 @@ export interface CreateTaskResult {
|
|
|
23
24
|
* appended ledger, or the unchanged ledger when the title is blank or the
|
|
24
25
|
* requested parent link is refused.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* The execution targets resolve through {@link resolveCardTargets}: what the
|
|
28
|
+
* caller sent wins, then the parent's own pins, then - only when the caller
|
|
29
|
+
* opted in with `applyCardDefaults` - the deployment's configured new-card
|
|
30
|
+
* defaults. Without the flag the resolution sees no defaults at all, which is
|
|
31
|
+
* exactly the inline parent inheritance this path has always applied. The
|
|
32
|
+
* workspace is not part of that resolution: a subtask still takes the parent's
|
|
33
|
+
* workspace, and the defaults never name one.
|
|
30
34
|
* @param tasks - current ledger.
|
|
31
35
|
* @param input - raw user input (title/description/prompt + optional schedule/parent).
|
|
32
36
|
* @param now - clock instant (ms epoch).
|
|
33
37
|
* @param id - minted task id.
|
|
34
38
|
* @param maxSubtaskDepth - deployment subtask depth limit.
|
|
35
39
|
* @param hostTimeZone - zone a rule that stores no zone of its own follows.
|
|
40
|
+
* @param cardDefaults - the deployment's new-card defaults, read live at creation.
|
|
36
41
|
*/
|
|
37
42
|
export function applyCreateTask(
|
|
38
43
|
tasks: readonly TaskRecord[],
|
|
@@ -41,6 +46,7 @@ export function applyCreateTask(
|
|
|
41
46
|
id: string,
|
|
42
47
|
maxSubtaskDepth: number = DEFAULT_SUBTASK_DEPTH,
|
|
43
48
|
hostTimeZone: string = resolveHostTimeZone(),
|
|
49
|
+
cardDefaults?: CardDefaults,
|
|
44
50
|
): CreateTaskResult {
|
|
45
51
|
if (input.title.trim() === '') return { task: undefined, tasks, error: 'title is required' }
|
|
46
52
|
const limit = normalizeSubtaskDepth(maxSubtaskDepth)
|
|
@@ -53,18 +59,23 @@ export function applyCreateTask(
|
|
|
53
59
|
return { task: undefined, tasks, error: `subtask depth limit (${limit}) exceeded` }
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
// The execution targets resolve through the one shared rule: the caller's own
|
|
63
|
+
// choice, then the parent's own pins (never its permission, see
|
|
64
|
+
// core/card-defaults.ts), then the deployment's new-card defaults — and only
|
|
65
|
+
// when the caller asked for them, so a create that never opts in stores
|
|
66
|
+
// exactly what it sent, as it always has.
|
|
67
|
+
const seed = resolveCardTargets(
|
|
68
|
+
input.applyCardDefaults === true ? cardDefaults : undefined,
|
|
69
|
+
parent === undefined ? undefined : { kind: 'parent', task: parent },
|
|
70
|
+
{ mode: input.mode, permission: input.permission, model: input.model, reasoningEffort: input.reasoningEffort },
|
|
71
|
+
)
|
|
72
|
+
const effective: NewTaskInput = {
|
|
64
73
|
...input,
|
|
65
|
-
workspaceId: input.workspaceId ?? parent
|
|
66
|
-
mode:
|
|
67
|
-
|
|
74
|
+
workspaceId: input.workspaceId ?? parent?.workspaceId,
|
|
75
|
+
mode: seed.mode,
|
|
76
|
+
permission: isTaskPermission(seed.permission) ? seed.permission : undefined,
|
|
77
|
+
model: seed.model,
|
|
78
|
+
reasoningEffort: seed.reasoningEffort,
|
|
68
79
|
}
|
|
69
80
|
let task = createTask(effective, now, id)
|
|
70
81
|
// Arm the requested schedule (new-task dialog). The Host wire gate already
|
|
@@ -16,7 +16,7 @@ import type { TaskHandoverInput } from '../handover.ts'
|
|
|
16
16
|
* Editable fields on a task (the update patch surface). `freeze` replaces the
|
|
17
17
|
* continuation-card snapshot (restamping frozenAt); an explicit null clears it.
|
|
18
18
|
*/
|
|
19
|
-
export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' | 'prompt' | 'workspaceId' | 'mode' | 'permission' | 'model' | 'reuseSession' | 'teamRun' | 'goalRun' | 'skipVerification'>> & {
|
|
19
|
+
export type TaskUpdatePatch = Partial<Pick<TaskRecord, 'title' | 'description' | 'prompt' | 'workspaceId' | 'mode' | 'permission' | 'model' | 'reasoningEffort' | 'reuseSession' | 'teamRun' | 'goalRun' | 'skipVerification'>> & {
|
|
20
20
|
freeze?: FreezeSnapshot & { redacted?: boolean } | null
|
|
21
21
|
/** Replaces the handover bundle (restamping bundledAt); an explicit null clears it. */
|
|
22
22
|
handover?: TaskHandoverInput | null
|
|
@@ -82,6 +82,7 @@ export function applyUpdateTask(
|
|
|
82
82
|
const mode = 'mode' in patch ? normalizeTargetId(patch.mode) : undefined
|
|
83
83
|
const permission = 'permission' in patch ? normalizePermission(task.permission, patch.permission) : undefined
|
|
84
84
|
const model = 'model' in patch ? normalizeTargetId(patch.model) : undefined
|
|
85
|
+
const reasoningEffort = 'reasoningEffort' in patch ? normalizeTargetId(patch.reasoningEffort) : undefined
|
|
85
86
|
const next: TaskRecord = { ...task, ...rest, updatedAt: now }
|
|
86
87
|
// Content fields normalize like creation does (trimmed); an explicit
|
|
87
88
|
// undefined keeps the current value — content cannot be cleared.
|
|
@@ -121,6 +122,10 @@ export function applyUpdateTask(
|
|
|
121
122
|
if (mode !== undefined || 'mode' in patch) next.mode = mode
|
|
122
123
|
if (permission !== undefined || 'permission' in patch) next.permission = permission
|
|
123
124
|
if (model !== undefined || 'model' in patch) next.model = model
|
|
125
|
+
// The effort is bound to the model route above it: blank text (or an
|
|
126
|
+
// explicit undefined) returns the card to the model's own default level,
|
|
127
|
+
// and only the launch decides whether the value can be sent at all.
|
|
128
|
+
if (reasoningEffort !== undefined || 'reasoningEffort' in patch) next.reasoningEffort = reasoningEffort
|
|
124
129
|
return next
|
|
125
130
|
})
|
|
126
131
|
}
|
package/src/host/agent-tools.ts
CHANGED
|
@@ -166,6 +166,7 @@ function taskSummary(
|
|
|
166
166
|
...(task.mode === undefined ? {} : { mode: task.mode }),
|
|
167
167
|
...(task.permission === undefined ? {} : { permission: task.permission }),
|
|
168
168
|
...(task.model === undefined ? {} : { model: task.model }),
|
|
169
|
+
...(task.reasoningEffort === undefined ? {} : { reasoningEffort: task.reasoningEffort }),
|
|
169
170
|
...(task.reuseSession === true ? { reuseSession: true } : {}),
|
|
170
171
|
...(task.teamRun === true ? { teamRun: true } : {}),
|
|
171
172
|
// Default-OFF opt-in: only a card that asked for the goal run reports it.
|
|
@@ -277,7 +278,7 @@ function buildSetParentTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
277
278
|
'Attach an existing task under a parent (making it a subtask) or detach it back to the root board by setting its parentId.',
|
|
278
279
|
'Pass an empty parentId to detach.',
|
|
279
280
|
'The Host refuses the link when the parent is unknown or archived, when the moved task is one of its own descendants, when the resulting depth exceeds the deployment subtask limit (default one level, maximum three), or while the task has an unsettled execution (its link may still be a running cascade parent pointer).',
|
|
280
|
-
'Running a task
|
|
281
|
+
'Running a task opens one run group over its subtree concurrently and leaves a subtask that already sits in the done column alone; a parent card settles only after its own turn and every direct subtask it opened have settled.',
|
|
281
282
|
].join(' '),
|
|
282
283
|
parameters: {
|
|
283
284
|
taskId: { type: 'string', required: true, description: 'The task whose parent link changes.' },
|
|
@@ -313,7 +314,7 @@ function buildRunTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
313
314
|
'Executions consume real API quota. Sessions are created asynchronously, so read their ids and outcomes back with task_board_get.',
|
|
314
315
|
].join(' '),
|
|
315
316
|
parameters: {
|
|
316
|
-
taskId: { type: 'string', required: true, description: 'The task to run; running a root task runs its whole subtree.' },
|
|
317
|
+
taskId: { type: 'string', required: true, description: 'The task to run; running a root task runs its whole subtree, minus the subtasks that are already in the done column.' },
|
|
317
318
|
rerun: { type: 'boolean', description: 'Re-run a settled task: reset its column to todo before starting (default false).' },
|
|
318
319
|
},
|
|
319
320
|
output: { schema: { type: 'json' }, render: renderJson },
|
|
@@ -458,7 +459,7 @@ function buildScheduleTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
458
459
|
'Arm, change, or disarm a task scheduled runs. Two kinds of plan exist: a recurring 5-field cron rule (day-of-month and day-of-week follow Vixie semantics: both restricted means OR, otherwise AND), and a one-shot that runs once at a future instant.',
|
|
459
460
|
'For a one-shot pass mode "once" with at (the planned instant, ms since epoch UTC). For a recurring rule pass mode "cron" (or omit mode) with a cron expression, optionally capped by maxRuns (a positive whole number of scheduled executions; omit for unlimited, pass 0 to clear a cap).',
|
|
460
461
|
'The wall clock is read in the rule stored IANA time zone; omit timeZone to use the Host zone reported by task_board_list/task_board_get. DST gaps are skipped and an ambiguous fall-back time fires once, at the earlier instant.',
|
|
461
|
-
'A due scheduled task runs the same cascade a manual run does, so a root task runs its whole subtask tree.',
|
|
462
|
+
'A due scheduled task runs the same cascade a manual run does, so a root task runs its whole subtask tree minus the subtasks already in the done column.',
|
|
462
463
|
'The scheduler counts executions it actually starts; once a rule reaches its run budget it stops itself in the ledger, and a manual run never consumes the budget. A schedule whose tree contains an unconfirmed above-default permission is refused and does not consume the budget; the reason is reported in the list board summary as schedulerError.',
|
|
463
464
|
'Missed occurrences during Host downtime are skipped, never queued (a one-shot whose instant passed while the Host was down is stopped as missed); a task that is already running skips its occurrence without consuming the budget.',
|
|
464
465
|
].join(' '),
|
|
@@ -586,7 +587,7 @@ function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
586
587
|
name: 'task_board_create',
|
|
587
588
|
description: [
|
|
588
589
|
'Create a task on the DSH task board, or a subtask by passing parentId.',
|
|
589
|
-
'A subtask inherits every execution target it does not override (workspace, agent preset, permission, model) from its parent, and inherits the parent human permission confirmation together with an inherited binding.',
|
|
590
|
+
'A subtask inherits every execution target it does not override (workspace, agent preset, permission, model, reasoning effort) from its parent, and inherits the parent human permission confirmation together with an inherited binding.',
|
|
590
591
|
'The deployment caps subtask depth (default one level, maximum three): a subtask of a subtask is refused unless the board is configured deeper.',
|
|
591
592
|
'The task lands in the todo column and does NOT run; call task_board_run to execute it.',
|
|
592
593
|
].join(' '),
|
|
@@ -596,9 +597,10 @@ function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
596
597
|
prompt: { type: 'string', description: 'The instruction sent to the execution agent; the title is used when blank.' },
|
|
597
598
|
parentId: { type: 'string', description: 'Parent task id, making this a subtask. Omit for a root task.' },
|
|
598
599
|
workspaceId: { type: 'string', description: 'Workspace id the execution must run in; omit to inherit the workspace this session is in (root task) or the parent value (subtask).' },
|
|
599
|
-
mode: { type: 'string', description: 'Agent preset id the execution session is composed from; omit
|
|
600
|
-
permission: { type: 'string', enum: [...TASK_PERMISSIONS], description: 'Permission preset for the execution session
|
|
601
|
-
model: { type: 'string', description: 'Pinned model as provider/model (or a model id); omit
|
|
600
|
+
mode: { type: 'string', description: 'Agent preset id the execution session is composed from; omit to adopt the board new-card default, and the deployment default when none is configured.' },
|
|
601
|
+
permission: { type: 'string', enum: [...TASK_PERMISSIONS], description: 'Permission preset for the execution session; omit to adopt the board new-card default. An omitted permission is never taken from a parent: the launch resolves the parent binding instead. A value above the session default needs a human confirmation in the board UI before the card can run.' },
|
|
602
|
+
model: { type: 'string', description: 'Pinned model as provider/model (or a model id); omit to adopt the board new-card default, and the host default when none is configured.' },
|
|
603
|
+
reasoningEffort: { type: 'string', description: 'Reasoning effort id for that model (an adapter-owned level such as "high"); omit to adopt the board new-card default for that model, and the model own default when none applies. Only an effort the target model declares is sent; an empty string clears it back to the default.' },
|
|
602
604
|
reuseSession: { type: 'boolean', description: 'Continue later runs in the previous execution session instead of a fresh conversation.' },
|
|
603
605
|
teamRun: { type: 'boolean', description: 'Run this task as an Agent Team: running it starts one Team Lead session and the Host spawns a teammate per subtask inside it. Omit or false for one independent session per member. Refused when the deployment serves no Agent Teams service.' },
|
|
604
606
|
goalRun: { type: 'boolean', description: 'Start each run with dsh built-in /goal so the session keeps working continuation rounds until the goal completes. Off by default: omit (or pass false) for a single plain turn, and pass true to opt this card in. It only takes effect while the deployment global native /goal switch is on.' },
|
|
@@ -645,6 +647,12 @@ function buildCreateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
645
647
|
...(args.mode === undefined || args.mode === '' ? {} : { mode: args.mode }),
|
|
646
648
|
...(args.permission === undefined ? {} : { permission: args.permission }),
|
|
647
649
|
...(args.model === undefined || args.model === '' ? {} : { model: args.model }),
|
|
650
|
+
...(args.reasoningEffort === undefined || args.reasoningEffort === '' ? {} : { reasoningEffort: args.reasoningEffort }),
|
|
651
|
+
// This tool creates cards on behalf of a deployment that configured its
|
|
652
|
+
// new-card defaults once: an omitted target adopts them instead of
|
|
653
|
+
// leaving the card to resolve the host default at run time. Only the
|
|
654
|
+
// targets the caller omitted are filled.
|
|
655
|
+
applyCardDefaults: true,
|
|
648
656
|
...(args.reuseSession === true ? { reuseSession: true } : {}),
|
|
649
657
|
...(args.teamRun === true ? { teamRun: true } : {}),
|
|
650
658
|
...(args.goalRun === true ? { goalRun: true } : {}),
|
|
@@ -676,7 +684,7 @@ function buildUpdateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
676
684
|
return defineTool({
|
|
677
685
|
name: 'task_board_update',
|
|
678
686
|
description: [
|
|
679
|
-
'Edit a task board card: title, description, prompt, labels, and the execution targets (workspace, agent preset, permission, model, session reuse).',
|
|
687
|
+
'Edit a task board card: title, description, prompt, labels, and the execution targets (workspace, agent preset, permission, model, reasoning effort, session reuse).',
|
|
680
688
|
'Only the fields you pass change; pass an empty string to clear a target, or an empty labels array to clear the labels.',
|
|
681
689
|
'Title, description and prompt freeze once the task has started executing; the execution targets stay editable because they only affect future runs.',
|
|
682
690
|
'Changing the pinned permission re-arms the permission confirmation gate.',
|
|
@@ -704,6 +712,7 @@ function buildUpdateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
704
712
|
description: 'New permission preset; an empty string clears it back to the session default.',
|
|
705
713
|
},
|
|
706
714
|
model: { type: 'string', description: 'New pinned model; an empty string clears it.' },
|
|
715
|
+
reasoningEffort: { type: 'string', description: 'New reasoning effort id for the pinned model; an empty string clears it back to the model own default. Only an effort the target model declares is sent at run time.' },
|
|
707
716
|
reuseSession: { type: 'boolean', description: 'Continue later runs in the previous execution session.' },
|
|
708
717
|
teamRun: { type: 'boolean', description: 'Switches this task between a plain cascade (one session per member) and an Agent Team run (Lead session plus a teammate per subtask).' },
|
|
709
718
|
goalRun: { type: 'boolean', description: 'Whether each run starts with dsh built-in /goal (default false, one plain turn). Pass true to opt this card in, or false to return it to the default.' },
|
|
@@ -730,6 +739,10 @@ function buildUpdateTool(host: TaskBoardToolHost): ToolDefinition {
|
|
|
730
739
|
if (has(args, 'workspaceId') && typeof args.workspaceId === 'string') patch.workspaceId = args.workspaceId
|
|
731
740
|
if (has(args, 'mode') && typeof args.mode === 'string') patch.mode = args.mode
|
|
732
741
|
if (has(args, 'model') && typeof args.model === 'string') patch.model = args.model
|
|
742
|
+
// An empty effort is the wire's clearing value (back to the model's own default).
|
|
743
|
+
if (has(args, 'reasoningEffort') && typeof args.reasoningEffort === 'string') {
|
|
744
|
+
patch.reasoningEffort = args.reasoningEffort
|
|
745
|
+
}
|
|
733
746
|
// An empty permission is the wire's clearing value (back to the session default).
|
|
734
747
|
if (has(args, 'permission') && typeof args.permission === 'string') {
|
|
735
748
|
patch.permission = args.permission === '' ? undefined : args.permission
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
|
|
24
|
+
/** One launch the queue has not started yet. */
|
|
25
|
+
export interface QueuedLaunch {
|
|
26
|
+
/** Run group this launch belongs to; the unit of round-robin fairness. */
|
|
27
|
+
readonly groupId: string
|
|
28
|
+
/**
|
|
29
|
+
* Perform the launch. The slot is held until this promise settles, which
|
|
30
|
+
* makes "in flight" mean "still creating and prompting its session".
|
|
31
|
+
* A rejection is swallowed here so one broken launch can never wedge the
|
|
32
|
+
* slot; the caller owns reporting.
|
|
33
|
+
*/
|
|
34
|
+
start(): Promise<void>
|
|
35
|
+
/**
|
|
36
|
+
* Called by {@link LaunchAdmissionQueue.drain} for a launch that never
|
|
37
|
+
* started, so the caller can take its execution out of the running column.
|
|
38
|
+
*/
|
|
39
|
+
abandon(): void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class LaunchAdmissionQueue {
|
|
43
|
+
/** Waiting launches per run group, in arrival order. */
|
|
44
|
+
private readonly waiting = new Map<string, QueuedLaunch[]>()
|
|
45
|
+
/** Run groups in round-robin order. */
|
|
46
|
+
private rotation: string[] = []
|
|
47
|
+
/** Slot holders of the launches in flight, one per admitted launch. */
|
|
48
|
+
private readonly inFlight = new Set<() => void>()
|
|
49
|
+
/** Highest number of launches in flight at once; observability and tests. */
|
|
50
|
+
peakInFlight = 0
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param width - live admission width (already normalized by the caller).
|
|
54
|
+
*/
|
|
55
|
+
constructor(private readonly width: () => number) {}
|
|
56
|
+
|
|
57
|
+
/** Launches the queue has not admitted yet. */
|
|
58
|
+
get pendingCount(): number {
|
|
59
|
+
let total = 0
|
|
60
|
+
for (const queue of this.waiting.values()) total += queue.length
|
|
61
|
+
return total
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Launches currently holding a slot. */
|
|
65
|
+
get inFlightCount(): number {
|
|
66
|
+
return this.inFlight.size
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Admit one launch, immediately if a slot is free. */
|
|
70
|
+
enqueue(launch: QueuedLaunch): void {
|
|
71
|
+
const queue = this.waiting.get(launch.groupId)
|
|
72
|
+
if (queue === undefined) {
|
|
73
|
+
this.waiting.set(launch.groupId, [launch])
|
|
74
|
+
this.rotation.push(launch.groupId)
|
|
75
|
+
} else {
|
|
76
|
+
queue.push(launch)
|
|
77
|
+
}
|
|
78
|
+
this.pump()
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Abandon every waiting launch: the queue is being torn down, so an entry
|
|
83
|
+
* that never started can never start. Launches already in flight are left
|
|
84
|
+
* alone — their session may already exist, and the callers that own them
|
|
85
|
+
* settle them through the normal path.
|
|
86
|
+
* @returns the abandoned launches, in abandonment order.
|
|
87
|
+
*/
|
|
88
|
+
drain(): QueuedLaunch[] {
|
|
89
|
+
const abandoned: QueuedLaunch[] = []
|
|
90
|
+
for (const groupId of this.rotation) {
|
|
91
|
+
for (const launch of this.waiting.get(groupId) ?? []) abandoned.push(launch)
|
|
92
|
+
}
|
|
93
|
+
this.rotation = []
|
|
94
|
+
this.waiting.clear()
|
|
95
|
+
for (const launch of abandoned) launch.abandon()
|
|
96
|
+
return abandoned
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private pump(): void {
|
|
100
|
+
while (this.inFlight.size < this.width()) {
|
|
101
|
+
const launch = this.takeNext()
|
|
102
|
+
if (launch === undefined) return
|
|
103
|
+
this.admit(launch)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** The next launch by round-robin across groups and FIFO inside one. */
|
|
108
|
+
private takeNext(): QueuedLaunch | undefined {
|
|
109
|
+
while (this.rotation.length > 0) {
|
|
110
|
+
const groupId = this.rotation.shift()
|
|
111
|
+
if (groupId === undefined) return undefined
|
|
112
|
+
const queue = this.waiting.get(groupId)
|
|
113
|
+
if (queue === undefined || queue.length === 0) {
|
|
114
|
+
this.waiting.delete(groupId)
|
|
115
|
+
continue
|
|
116
|
+
}
|
|
117
|
+
const launch = queue.shift()
|
|
118
|
+
if (launch === undefined) continue
|
|
119
|
+
if (queue.length === 0) this.waiting.delete(groupId)
|
|
120
|
+
// A group that still has work goes to the back of the rotation, so every
|
|
121
|
+
// other run group gets its turn before this one's next member.
|
|
122
|
+
else this.rotation.push(groupId)
|
|
123
|
+
return launch
|
|
124
|
+
}
|
|
125
|
+
return undefined
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private admit(launch: QueuedLaunch): void {
|
|
129
|
+
const release = (): void => {
|
|
130
|
+
this.inFlight.delete(release)
|
|
131
|
+
this.pump()
|
|
132
|
+
}
|
|
133
|
+
this.inFlight.add(release)
|
|
134
|
+
if (this.inFlight.size > this.peakInFlight) this.peakInFlight = this.inFlight.size
|
|
135
|
+
void Promise.resolve()
|
|
136
|
+
.then(() => launch.start())
|
|
137
|
+
.catch(() => { /* a rejected launch still releases its slot; the caller reports it */ })
|
|
138
|
+
.then(release)
|
|
139
|
+
}
|
|
140
|
+
}
|