@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,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The default-agent-preset picker of the settings card's new-card-defaults
|
|
3
|
+
* topic.
|
|
4
|
+
*
|
|
5
|
+
* It renders the rows the create dialog's own mode picker renders — built-in
|
|
6
|
+
* presets first, then user presets, each labelled with its default and
|
|
7
|
+
* unavailable suffixes (board/preset-label.ts owns both) — and it renders a
|
|
8
|
+
* preset that cannot compose a session as a row that is visible but NOT
|
|
9
|
+
* selectable, so the board never stores a default no session could be composed
|
|
10
|
+
* from.
|
|
11
|
+
*
|
|
12
|
+
* The shared ChoiceField cannot express that: its choices carry no disabled
|
|
13
|
+
* state, and a stored pin the roster no longer serves would render as an empty
|
|
14
|
+
* trigger rather than as the unavailable preset it is. Both need a native
|
|
15
|
+
* `<select>` (the fallback the shared SelectField itself takes under an
|
|
16
|
+
* appearance skin), styled with the settings card's own field classes so the
|
|
17
|
+
* control stays a sibling of the fields beside it.
|
|
18
|
+
*/
|
|
19
|
+
import type { ExecutionPresetOption } from '../core/controller.ts'
|
|
20
|
+
import { inheritPresetLabel, presetChoiceRows } from './board/preset-label.ts'
|
|
21
|
+
import { t } from './locales.ts'
|
|
22
|
+
import type { FieldProps } from './PluginSettingsCard.tsx'
|
|
23
|
+
import css from './settings-card.module.css'
|
|
24
|
+
|
|
25
|
+
/** Props of the default-preset field: the shared field contract plus the roster. */
|
|
26
|
+
export interface CardDefaultPresetFieldProps extends FieldProps {
|
|
27
|
+
/**
|
|
28
|
+
* The deployment's agent-preset roster, or undefined while its runtime read
|
|
29
|
+
* has not answered: an unread roster offers the inherit choice alone instead
|
|
30
|
+
* of calling every stored pin "removed".
|
|
31
|
+
*/
|
|
32
|
+
presets: readonly ExecutionPresetOption[] | undefined
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Render the default-preset select.
|
|
37
|
+
* @param props - the field contract and the roster to list.
|
|
38
|
+
* @returns the field.
|
|
39
|
+
*/
|
|
40
|
+
export function CardDefaultPresetField(props: CardDefaultPresetFieldProps) {
|
|
41
|
+
const presets = props.presets
|
|
42
|
+
const rows = presetChoiceRows(presets ?? [])
|
|
43
|
+
// A stored pin the roster no longer serves stays visible and pickable: it is
|
|
44
|
+
// what the board currently holds, so the control must show it rather than
|
|
45
|
+
// silently reading as the inherit choice.
|
|
46
|
+
const unlisted = props.text !== '' && presets !== undefined && !presets.some(preset => preset.id === props.text)
|
|
47
|
+
return (
|
|
48
|
+
<div className={css.field}>
|
|
49
|
+
<div className={css.head}>
|
|
50
|
+
<label className={css.label} htmlFor={props.id}>{props.label}</label>
|
|
51
|
+
{props.overridden
|
|
52
|
+
? (
|
|
53
|
+
<span className={css.badges}>
|
|
54
|
+
<span className={css.badge}>{props.overriddenLabel}</span>
|
|
55
|
+
<button
|
|
56
|
+
type="button"
|
|
57
|
+
className={css.reset}
|
|
58
|
+
disabled={props.disabled}
|
|
59
|
+
onClick={props.onReset}
|
|
60
|
+
>
|
|
61
|
+
{props.resetLabel}
|
|
62
|
+
</button>
|
|
63
|
+
</span>
|
|
64
|
+
)
|
|
65
|
+
: null}
|
|
66
|
+
</div>
|
|
67
|
+
<select
|
|
68
|
+
id={props.id}
|
|
69
|
+
className={css.select}
|
|
70
|
+
value={props.text}
|
|
71
|
+
disabled={props.disabled}
|
|
72
|
+
aria-invalid={props.invalid || undefined}
|
|
73
|
+
onChange={(event) => { props.onEdit(event.target.value) }}
|
|
74
|
+
>
|
|
75
|
+
<option value="">{inheritPresetLabel(presets ?? [])}</option>
|
|
76
|
+
{unlisted ? <option value={props.text}>{props.text}{t('exec.mode.removed')}</option> : null}
|
|
77
|
+
{rows.builtin.length > 0
|
|
78
|
+
? (
|
|
79
|
+
<optgroup label={t('exec.mode.builtinGroup')}>
|
|
80
|
+
{rows.builtin.map(row => (
|
|
81
|
+
<option key={row.id} value={row.id} disabled={row.disabled}>{row.label}</option>
|
|
82
|
+
))}
|
|
83
|
+
</optgroup>
|
|
84
|
+
)
|
|
85
|
+
: null}
|
|
86
|
+
{rows.custom.length > 0
|
|
87
|
+
? (
|
|
88
|
+
<optgroup label={t('exec.mode.customGroup')}>
|
|
89
|
+
{rows.custom.map(row => (
|
|
90
|
+
<option key={row.id} value={row.id} disabled={row.disabled}>{row.label}</option>
|
|
91
|
+
))}
|
|
92
|
+
</optgroup>
|
|
93
|
+
)
|
|
94
|
+
: null}
|
|
95
|
+
</select>
|
|
96
|
+
<p className={props.invalid ? css.invalid : css.hint}>
|
|
97
|
+
{props.invalid ? props.invalidLabel : props.hint}
|
|
98
|
+
</p>
|
|
99
|
+
</div>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
@@ -54,6 +54,19 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
54
54
|
onSave: () => void
|
|
55
55
|
/** Drop every staged edit. */
|
|
56
56
|
onDiscard: () => void
|
|
57
|
+
/**
|
|
58
|
+
* Id applied to the card's title element, so a header control (an immediate
|
|
59
|
+
* toggle in `headerAction`) can name itself through `aria-labelledby`
|
|
60
|
+
* instead of repeating the title as a string.
|
|
61
|
+
*/
|
|
62
|
+
titleId?: string
|
|
63
|
+
/**
|
|
64
|
+
* Render the header only, with no body region. A card whose whole setting is
|
|
65
|
+
* the header control (a switch whose explanation is the description) has no
|
|
66
|
+
* controls to lay out below it, and an empty body would draw a divider line
|
|
67
|
+
* with nothing under it.
|
|
68
|
+
*/
|
|
69
|
+
headerOnly?: boolean
|
|
57
70
|
/**
|
|
58
71
|
* Render the controls expanded on arrival (still collapsible). Defaults to
|
|
59
72
|
* true: promoted first-level sections show their settings immediately.
|
|
@@ -71,6 +84,13 @@ export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
|
71
84
|
* edits, so the footer would sit there permanently disabled.
|
|
72
85
|
*/
|
|
73
86
|
hideFooter?: boolean
|
|
87
|
+
/**
|
|
88
|
+
* Optional control rendered at the header's trailing edge, before the pending
|
|
89
|
+
* badge and the chevron. A card whose setting is one immediate flip (it
|
|
90
|
+
* applies outside the staged form) puts its ToggleSwitch here, so the control
|
|
91
|
+
* is reachable without opening the card and matches a plugin card's shape.
|
|
92
|
+
*/
|
|
93
|
+
headerAction?: ReactNode
|
|
74
94
|
/** Render children even when the settings namespace is not exposed by the host. */
|
|
75
95
|
renderChildrenWhenNotExposed?: boolean
|
|
76
96
|
/** Hide the 'not exposed' warning banner when the settings namespace is not exposed. */
|
|
@@ -100,9 +120,10 @@ export function PluginSettingsCard<TKey extends string = string>(props: PluginSe
|
|
|
100
120
|
<div className={css.headerStatic}>
|
|
101
121
|
{props.icon !== undefined ? <span className={css.mark} aria-hidden="true">{props.icon}</span> : null}
|
|
102
122
|
<span className={css.headText}>
|
|
103
|
-
<span className={css.name} title={title}>{title}</span>
|
|
123
|
+
<span className={css.name} id={props.titleId} title={title}>{title}</span>
|
|
104
124
|
<span className={css.description} title={description}>{props.descriptionNode ?? description}</span>
|
|
105
125
|
</span>
|
|
126
|
+
{props.headerAction !== undefined ? <span className={css.headerAction}>{props.headerAction}</span> : null}
|
|
106
127
|
{state.dirty ? <span className={css.pending} title={props.t('settings.unsaved')}>{props.t('settings.unsaved')}</span> : null}
|
|
107
128
|
</div>
|
|
108
129
|
)
|
|
@@ -116,9 +137,10 @@ export function PluginSettingsCard<TKey extends string = string>(props: PluginSe
|
|
|
116
137
|
>
|
|
117
138
|
{props.icon !== undefined ? <span className={css.mark} aria-hidden="true">{props.icon}</span> : null}
|
|
118
139
|
<span className={css.headText}>
|
|
119
|
-
<span className={css.name} title={title}>{title}</span>
|
|
140
|
+
<span className={css.name} id={props.titleId} title={title}>{title}</span>
|
|
120
141
|
<span className={css.description} title={description}>{props.descriptionNode ?? description}</span>
|
|
121
142
|
</span>
|
|
143
|
+
{props.headerAction !== undefined ? <span className={css.headerAction}>{props.headerAction}</span> : null}
|
|
122
144
|
{state.dirty ? <span className={css.pending} title={props.t('settings.unsaved')}>{props.t('settings.unsaved')}</span> : null}
|
|
123
145
|
<svg
|
|
124
146
|
width="14"
|
|
@@ -154,10 +176,13 @@ export function PluginSettingsCard<TKey extends string = string>(props: PluginSe
|
|
|
154
176
|
</li>
|
|
155
177
|
)
|
|
156
178
|
}
|
|
179
|
+
// A header-only card has no body region at all: the divider would otherwise
|
|
180
|
+
// sit above an empty box.
|
|
181
|
+
const bodyVisible = expanded && props.headerOnly !== true
|
|
157
182
|
return (
|
|
158
183
|
<li className={cardClass}>
|
|
159
184
|
{header}
|
|
160
|
-
{
|
|
185
|
+
{bodyVisible
|
|
161
186
|
? (
|
|
162
187
|
<div className={css.body}>
|
|
163
188
|
{!state.writable ? <p className={css.readOnly} role="status">{props.t('settings.readOnly')}</p> : null}
|
|
@@ -562,3 +587,38 @@ export function ChoiceField(props: FieldProps & {
|
|
|
562
587
|
</div>
|
|
563
588
|
)
|
|
564
589
|
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* An immediate boolean toggle drawn as a switch track, for a setting that
|
|
593
|
+
* applies on flip rather than through a staged save. It is a real button with
|
|
594
|
+
* `role="switch"` and `aria-checked`, so keyboard and assistive activation
|
|
595
|
+
* arrive as a click and the state is announced instead of inferred from a
|
|
596
|
+
* checkbox tick.
|
|
597
|
+
*/
|
|
598
|
+
export function ToggleSwitch(props: {
|
|
599
|
+
/** Id of the element naming the switch (the card's title). */
|
|
600
|
+
labelledBy?: string
|
|
601
|
+
/** Accessible name when no element labels it. */
|
|
602
|
+
ariaLabel?: string
|
|
603
|
+
/** Current state. */
|
|
604
|
+
checked: boolean
|
|
605
|
+
/** Disables the switch while a write is in flight or the Host refuses writes. */
|
|
606
|
+
disabled?: boolean
|
|
607
|
+
/** Called with the requested next state. */
|
|
608
|
+
onChange: (next: boolean) => void
|
|
609
|
+
}) {
|
|
610
|
+
return (
|
|
611
|
+
<button
|
|
612
|
+
type="button"
|
|
613
|
+
className={css.toggle}
|
|
614
|
+
role="switch"
|
|
615
|
+
aria-checked={props.checked}
|
|
616
|
+
aria-labelledby={props.labelledBy}
|
|
617
|
+
aria-label={props.labelledBy === undefined ? props.ariaLabel : undefined}
|
|
618
|
+
disabled={props.disabled}
|
|
619
|
+
onClick={() => { props.onChange(!props.checked) }}
|
|
620
|
+
>
|
|
621
|
+
<span className={css.toggleTrack}><span className={css.toggleThumb} /></span>
|
|
622
|
+
</button>
|
|
623
|
+
)
|
|
624
|
+
}
|
|
@@ -10,12 +10,34 @@ import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
|
10
10
|
import { useEffect, useState } from 'react'
|
|
11
11
|
import type { TaskBoardPowerSnapshot, TaskBoardVerificationOptions } from '../protocol.ts'
|
|
12
12
|
import type { TaskBoardExtensionDispatch } from '../core/extension.ts'
|
|
13
|
+
import type { ExecutionPresetOption } from '../core/controller.ts'
|
|
14
|
+
import { TASK_PERMISSIONS } from '../core/tasks.ts'
|
|
13
15
|
import { resolveContract, type ModelCatalogView, type VerificationSettings } from '../core/verification.ts'
|
|
14
16
|
import { parseModelRoute } from '../core/verification.ts'
|
|
17
|
+
import { CardDefaultPresetField } from './CardDefaultPresetField.tsx'
|
|
15
18
|
import { PluginSettingsCard, BooleanField, ChoiceField, ValueField } from './PluginSettingsCard.tsx'
|
|
19
|
+
import {
|
|
20
|
+
modelChoiceRows,
|
|
21
|
+
modelOptionsFromCatalog,
|
|
22
|
+
reasoningEffortsFor,
|
|
23
|
+
reasoningHintKey,
|
|
24
|
+
reasoningPickerEnabled,
|
|
25
|
+
reconcileReasoningEffort,
|
|
26
|
+
} from './board/model-options.ts'
|
|
16
27
|
import { SUBTASK_DEPTH_MAX, SUBTASK_DEPTH_MIN } from '../core/subtask.ts'
|
|
17
28
|
import { SESSION_POLL_MAX_SECONDS, SESSION_POLL_MIN_SECONDS } from '../core/poll-cadence.ts'
|
|
18
|
-
import {
|
|
29
|
+
import { RUN_LAUNCH_WIDTH_MAX, RUN_LAUNCH_WIDTH_MIN } from '../core/launch-width.ts'
|
|
30
|
+
import {
|
|
31
|
+
CardForm,
|
|
32
|
+
booleanField,
|
|
33
|
+
choiceField,
|
|
34
|
+
textField,
|
|
35
|
+
type CardActions,
|
|
36
|
+
type CardShell,
|
|
37
|
+
type FieldSpec,
|
|
38
|
+
type FieldState as CardFieldState,
|
|
39
|
+
} from './settings-form.ts'
|
|
40
|
+
import type { TaskBoardKey } from './locales.ts'
|
|
19
41
|
import settingsCss from './board-settings.module.css'
|
|
20
42
|
|
|
21
43
|
/** The depth choices the card offers, derived from the supported range. */
|
|
@@ -65,34 +87,60 @@ function subtaskDepthField(): FieldSpec {
|
|
|
65
87
|
}
|
|
66
88
|
|
|
67
89
|
/**
|
|
68
|
-
* The
|
|
69
|
-
*
|
|
70
|
-
* draft blocks the save instead of
|
|
90
|
+
* The run-launch width field: a whole number of concurrent launches inside the
|
|
91
|
+
* supported range, because the Host schema (`runLaunchWidth`) is numeric. A
|
|
92
|
+
* draft outside the range blocks the save instead of staging a value the Host
|
|
93
|
+
* would clamp behind the user's back.
|
|
71
94
|
*/
|
|
72
|
-
function
|
|
95
|
+
function runLaunchWidthField(): FieldSpec {
|
|
73
96
|
return {
|
|
74
|
-
field: '
|
|
75
|
-
format: value => typeof value === '
|
|
97
|
+
field: 'runLaunchWidth',
|
|
98
|
+
format: value => typeof value === 'number' && Number.isInteger(value) ? String(value) : '',
|
|
76
99
|
parse: (text) => {
|
|
77
100
|
const trimmed = text.trim()
|
|
78
101
|
if (trimmed === '') return { kind: 'clear' }
|
|
79
|
-
|
|
102
|
+
if (!/^\d+$/.test(trimmed)) return undefined
|
|
103
|
+
const width = Number(trimmed)
|
|
104
|
+
return width >= RUN_LAUNCH_WIDTH_MIN && width <= RUN_LAUNCH_WIDTH_MAX
|
|
105
|
+
? { kind: 'set', value: width }
|
|
106
|
+
: undefined
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The daily token cap field: whole tokens, 0 for "no gate". Every non-negative
|
|
113
|
+
* whole number is a legal cap, so the draft only has to be one; a blank draft
|
|
114
|
+
* clears the entry back to the schema default (0).
|
|
115
|
+
*/
|
|
116
|
+
function spendBudgetField(): FieldSpec {
|
|
117
|
+
return {
|
|
118
|
+
field: 'spendBudgetTokens',
|
|
119
|
+
format: value => typeof value === 'number' && Number.isInteger(value) ? String(value) : '',
|
|
120
|
+
parse: (text) => {
|
|
121
|
+
const trimmed = text.trim()
|
|
122
|
+
if (trimmed === '') return { kind: 'clear' }
|
|
123
|
+
if (!/^\d+$/.test(trimmed)) return undefined
|
|
124
|
+
return { kind: 'set', value: Number(trimmed) }
|
|
80
125
|
},
|
|
81
126
|
}
|
|
82
127
|
}
|
|
83
128
|
|
|
84
129
|
/**
|
|
85
|
-
* The
|
|
86
|
-
*
|
|
87
|
-
*
|
|
130
|
+
* The judge-model field: blank inherits the host model catalog default, and a
|
|
131
|
+
* non-blank draft must be a qualified provider/model route. An unparseable
|
|
132
|
+
* draft blocks the save instead of storing a route nothing can resolve.
|
|
133
|
+
* The new-card default model uses the same gate, so both fields accept exactly
|
|
134
|
+
* the routes an execution can pin.
|
|
88
135
|
*/
|
|
89
|
-
function
|
|
136
|
+
function modelRouteField(field: string): FieldSpec {
|
|
90
137
|
return {
|
|
91
|
-
field
|
|
138
|
+
field,
|
|
92
139
|
format: value => typeof value === 'string' ? value : '',
|
|
93
140
|
parse: (text) => {
|
|
94
141
|
const trimmed = text.trim()
|
|
95
|
-
|
|
142
|
+
if (trimmed === '') return { kind: 'clear' }
|
|
143
|
+
return parseModelRoute(trimmed) === undefined ? undefined : { kind: 'set', value: trimmed }
|
|
96
144
|
},
|
|
97
145
|
}
|
|
98
146
|
}
|
|
@@ -109,6 +157,17 @@ export interface TaskBoardSettings {
|
|
|
109
157
|
maxSubtaskDepth?: number
|
|
110
158
|
/** Roster-poll cadence in seconds while the board has work to reconcile. */
|
|
111
159
|
sessionPollSeconds?: number
|
|
160
|
+
/**
|
|
161
|
+
* How many run launches may be in flight at once (1..16, default 3). One run
|
|
162
|
+
* opens its whole subtree, so this bounds the burst of sessions a single run
|
|
163
|
+
* action creates; members enter the running column in batches, none is dropped.
|
|
164
|
+
*/
|
|
165
|
+
runLaunchWidth?: number
|
|
166
|
+
/**
|
|
167
|
+
* Daily token ceiling for the work this board dispatches; 0 means no gate.
|
|
168
|
+
* Tokens, not money: only DeepSeek's own routes are priced.
|
|
169
|
+
*/
|
|
170
|
+
spendBudgetTokens?: number
|
|
112
171
|
/**
|
|
113
172
|
* GLOBAL native /goal switch (default off): the master control over whether
|
|
114
173
|
* this board starts a run with dsh's built-in /goal at all. Frozen per
|
|
@@ -121,6 +180,20 @@ export interface TaskBoardSettings {
|
|
|
121
180
|
goalVerificationModel?: string
|
|
122
181
|
/** Judge reasoning effort; blank inherits the host default level. */
|
|
123
182
|
goalVerificationReasoningEffort?: string
|
|
183
|
+
/**
|
|
184
|
+
* Agent preset the create dialog of this board opens with. Blank pins
|
|
185
|
+
* nothing, so a new card follows the deployment default as before.
|
|
186
|
+
*/
|
|
187
|
+
cardDefaultMode?: string
|
|
188
|
+
/** Permission the create dialog opens with; blank applies no default. */
|
|
189
|
+
cardDefaultPermission?: string
|
|
190
|
+
/** Execution model route the create dialog opens with; blank applies none. */
|
|
191
|
+
cardDefaultModel?: string
|
|
192
|
+
/**
|
|
193
|
+
* Reasoning level bound to `cardDefaultModel`; it applies only while a
|
|
194
|
+
* card's final model IS that configured route, and is inert without one.
|
|
195
|
+
*/
|
|
196
|
+
cardDefaultReasoningEffort?: string
|
|
124
197
|
}
|
|
125
198
|
|
|
126
199
|
/** What the task-board card renders. */
|
|
@@ -135,6 +208,10 @@ export interface TaskBoardSettingsCardState extends CardShell {
|
|
|
135
208
|
maxSubtaskDepth: CardFieldState
|
|
136
209
|
/** Roster-poll cadence field. */
|
|
137
210
|
sessionPollSeconds: CardFieldState
|
|
211
|
+
/** Run-launch admission width field. */
|
|
212
|
+
runLaunchWidth: CardFieldState
|
|
213
|
+
/** Daily token cap field. */
|
|
214
|
+
spendBudgetTokens: CardFieldState
|
|
138
215
|
/** GLOBAL native /goal switch. */
|
|
139
216
|
goalRunEnabled: CardFieldState
|
|
140
217
|
/** Goal-acceptance switch. */
|
|
@@ -143,6 +220,20 @@ export interface TaskBoardSettingsCardState extends CardShell {
|
|
|
143
220
|
goalVerificationModel: CardFieldState
|
|
144
221
|
/** Judge reasoning-effort field. */
|
|
145
222
|
goalVerificationReasoningEffort: CardFieldState
|
|
223
|
+
/** New-card default agent preset. */
|
|
224
|
+
cardDefaultMode: CardFieldState
|
|
225
|
+
/** New-card default permission. */
|
|
226
|
+
cardDefaultPermission: CardFieldState
|
|
227
|
+
/** New-card default model route. */
|
|
228
|
+
cardDefaultModel: CardFieldState
|
|
229
|
+
/** New-card default reasoning level. */
|
|
230
|
+
cardDefaultReasoningEffort: CardFieldState
|
|
231
|
+
/**
|
|
232
|
+
* The deployment's agent-preset roster, published by the runtime read the
|
|
233
|
+
* plugin wires; undefined until it answers, which leaves the default-preset
|
|
234
|
+
* field offering the inherit choice alone.
|
|
235
|
+
*/
|
|
236
|
+
presets?: readonly ExecutionPresetOption[]
|
|
146
237
|
}
|
|
147
238
|
|
|
148
239
|
/** The registration-side face the card's slot entry injects. */
|
|
@@ -159,6 +250,8 @@ export interface TaskBoardSettingsCardFace extends CardActions {
|
|
|
159
250
|
export class TaskBoardSettingsCardController {
|
|
160
251
|
private readonly form: CardForm<TaskBoardSettings>
|
|
161
252
|
private readonly store: SnapshotStore<TaskBoardSettingsCardState>
|
|
253
|
+
/** The deployment's agent-preset roster, once its runtime read has answered. */
|
|
254
|
+
private presets: readonly ExecutionPresetOption[] | undefined
|
|
162
255
|
|
|
163
256
|
/** @param scope - the bound configuration form for the `task-board` namespace. */
|
|
164
257
|
constructor(scope: ConfigForm<TaskBoardSettings>, private readonly dispatch: TaskBoardExtensionDispatch) {
|
|
@@ -168,10 +261,19 @@ export class TaskBoardSettingsCardController {
|
|
|
168
261
|
booleanField('preventIdleSleep'),
|
|
169
262
|
subtaskDepthField(),
|
|
170
263
|
sessionPollField(),
|
|
264
|
+
runLaunchWidthField(),
|
|
265
|
+
spendBudgetField(),
|
|
171
266
|
booleanField('goalRunEnabled'),
|
|
172
267
|
booleanField('goalVerification'),
|
|
173
|
-
|
|
174
|
-
|
|
268
|
+
modelRouteField('goalVerificationModel'),
|
|
269
|
+
textField('goalVerificationReasoningEffort'),
|
|
270
|
+
// The new-card defaults: blank is a real value every one of them keeps
|
|
271
|
+
// ("apply no default"), which is why they are staged like any other field
|
|
272
|
+
// and only their parse rules differ.
|
|
273
|
+
textField('cardDefaultMode'),
|
|
274
|
+
choiceField('cardDefaultPermission', TASK_PERMISSIONS),
|
|
275
|
+
modelRouteField('cardDefaultModel'),
|
|
276
|
+
textField('cardDefaultReasoningEffort'),
|
|
175
277
|
])
|
|
176
278
|
this.store = this.form.bind(() => this.projection())
|
|
177
279
|
}
|
|
@@ -184,13 +286,34 @@ export class TaskBoardSettingsCardController {
|
|
|
184
286
|
preventIdleSleep: this.form.field('preventIdleSleep'),
|
|
185
287
|
maxSubtaskDepth: this.form.field('maxSubtaskDepth'),
|
|
186
288
|
sessionPollSeconds: this.form.field('sessionPollSeconds'),
|
|
289
|
+
runLaunchWidth: this.form.field('runLaunchWidth'),
|
|
290
|
+
spendBudgetTokens: this.form.field('spendBudgetTokens'),
|
|
187
291
|
goalRunEnabled: this.form.field('goalRunEnabled'),
|
|
188
292
|
goalVerification: this.form.field('goalVerification'),
|
|
189
293
|
goalVerificationModel: this.form.field('goalVerificationModel'),
|
|
190
294
|
goalVerificationReasoningEffort: this.form.field('goalVerificationReasoningEffort'),
|
|
295
|
+
cardDefaultMode: this.form.field('cardDefaultMode'),
|
|
296
|
+
cardDefaultPermission: this.form.field('cardDefaultPermission'),
|
|
297
|
+
cardDefaultModel: this.form.field('cardDefaultModel'),
|
|
298
|
+
cardDefaultReasoningEffort: this.form.field('cardDefaultReasoningEffort'),
|
|
299
|
+
...(this.presets === undefined ? {} : { presets: this.presets }),
|
|
191
300
|
}
|
|
192
301
|
}
|
|
193
302
|
|
|
303
|
+
/**
|
|
304
|
+
* Publish the deployment's agent-preset roster to the default-preset field.
|
|
305
|
+
* The roster is a runtime fact read outside this card (src/client/index.ts
|
|
306
|
+
* wires it once for both the board's pickers and this topic); it can arrive
|
|
307
|
+
* late or not at all, and until it does the field lists the inherit choice
|
|
308
|
+
* alone. This never blocks a save: a deployment that serves no roster still
|
|
309
|
+
* has a writable settings document.
|
|
310
|
+
* @param presets - the roster rows.
|
|
311
|
+
*/
|
|
312
|
+
setPresetRoster(presets: readonly ExecutionPresetOption[]): void {
|
|
313
|
+
this.presets = presets
|
|
314
|
+
this.store.set(this.projection())
|
|
315
|
+
}
|
|
316
|
+
|
|
194
317
|
/**
|
|
195
318
|
* Build the face the card's slot registration injects.
|
|
196
319
|
* @returns the card's snapshot and its form actions.
|
|
@@ -304,6 +427,25 @@ export function TaskBoardSettingsCard(props: TaskBoardSettingsCardProps) {
|
|
|
304
427
|
invalidLabel: t('settings.invalidNumber'),
|
|
305
428
|
disabled,
|
|
306
429
|
}
|
|
430
|
+
// The new-card-defaults topic reads the SAME catalog the acceptance fields
|
|
431
|
+
// and the create dialog read (session/modelCatalog, served here through the
|
|
432
|
+
// verification payload), normalized once into the roster the reasoning
|
|
433
|
+
// helpers below consume, so the default level can only offer levels the
|
|
434
|
+
// chosen default model really declares.
|
|
435
|
+
const defaultModels = modelOptionsFromCatalog(catalog)
|
|
436
|
+
const defaultModel = state.cardDefaultModel.text
|
|
437
|
+
const defaultEffortChoices = reasoningEffortsFor(defaultModels, defaultModel)
|
|
438
|
+
.map(effort => ({ value: effort, label: effort }))
|
|
439
|
+
/**
|
|
440
|
+
* Drop a staged default level the newly picked default model cannot honour,
|
|
441
|
+
* exactly as the create dialog's own model picker does (one shared rule):
|
|
442
|
+
* the level belongs to the route it was chosen for.
|
|
443
|
+
*/
|
|
444
|
+
const dropUnhonouredEffort = (nextModel: string): void => {
|
|
445
|
+
const current = state.cardDefaultReasoningEffort.text
|
|
446
|
+
const kept = reconcileReasoningEffort(defaultModels, nextModel, current)
|
|
447
|
+
if (kept !== current) props.edit('cardDefaultReasoningEffort', kept)
|
|
448
|
+
}
|
|
307
449
|
// Chrome state of the nested disclosure cards below: they stage into this
|
|
308
450
|
// card's form and are written by its one save, so they carry no footer and no
|
|
309
451
|
// unsaved pill of their own (the outer header owns the pill).
|
|
@@ -405,6 +547,26 @@ export function TaskBoardSettingsCard(props: TaskBoardSettingsCardProps) {
|
|
|
405
547
|
onEdit={(text) => { props.edit('maxSubtaskDepth', text) }}
|
|
406
548
|
onReset={() => { props.resetField('maxSubtaskDepth') }}
|
|
407
549
|
/>
|
|
550
|
+
<ValueField
|
|
551
|
+
id="settings-task-board-run-launch-width"
|
|
552
|
+
label={t('settings.runLaunchWidth')}
|
|
553
|
+
hint={t('settings.runLaunchWidthHint')}
|
|
554
|
+
numeric
|
|
555
|
+
{...fieldProps}
|
|
556
|
+
{...state.runLaunchWidth}
|
|
557
|
+
onEdit={(text) => { props.edit('runLaunchWidth', text) }}
|
|
558
|
+
onReset={() => { props.resetField('runLaunchWidth') }}
|
|
559
|
+
/>
|
|
560
|
+
<ValueField
|
|
561
|
+
id="settings-task-board-spend-budget"
|
|
562
|
+
label={t('settings.spendBudgetTokens')}
|
|
563
|
+
hint={t('settings.spendBudgetTokensHint')}
|
|
564
|
+
numeric
|
|
565
|
+
{...fieldProps}
|
|
566
|
+
{...state.spendBudgetTokens}
|
|
567
|
+
onEdit={(text) => { props.edit('spendBudgetTokens', text) }}
|
|
568
|
+
onReset={() => { props.resetField('spendBudgetTokens') }}
|
|
569
|
+
/>
|
|
408
570
|
</PluginSettingsCard>
|
|
409
571
|
|
|
410
572
|
<PluginSettingsCard
|
|
@@ -511,6 +673,79 @@ export function TaskBoardSettingsCard(props: TaskBoardSettingsCardProps) {
|
|
|
511
673
|
)}
|
|
512
674
|
</PluginSettingsCard>
|
|
513
675
|
|
|
676
|
+
{/* New-card defaults: what the create dialog opens with, and what the
|
|
677
|
+
Host create path fills an omitted target from when the caller opts
|
|
678
|
+
in. Every field's blank choice is a real value — "apply no default"
|
|
679
|
+
— so a deployment that configures none of them creates cards
|
|
680
|
+
exactly as it did before this topic existed. */}
|
|
681
|
+
<PluginSettingsCard
|
|
682
|
+
t={t}
|
|
683
|
+
titleKey="settings.cardDefaultsTitle"
|
|
684
|
+
descriptionKey="settings.cardDefaultsCardHint"
|
|
685
|
+
defaultOpen={false}
|
|
686
|
+
hideFooter
|
|
687
|
+
state={nestedShell}
|
|
688
|
+
onSave={props.save}
|
|
689
|
+
onDiscard={props.discard}
|
|
690
|
+
>
|
|
691
|
+
<CardDefaultPresetField
|
|
692
|
+
id="settings-task-board-card-default-mode"
|
|
693
|
+
label={t('new.agentPreset')}
|
|
694
|
+
hint={t('settings.cardDefaultModeHint')}
|
|
695
|
+
presets={state.presets}
|
|
696
|
+
{...fieldProps}
|
|
697
|
+
{...state.cardDefaultMode}
|
|
698
|
+
onEdit={(text) => { props.edit('cardDefaultMode', text) }}
|
|
699
|
+
onReset={() => { props.resetField('cardDefaultMode') }}
|
|
700
|
+
/>
|
|
701
|
+
<ChoiceField
|
|
702
|
+
id="settings-task-board-card-default-permission"
|
|
703
|
+
label={t('new.permission')}
|
|
704
|
+
hint={t('settings.cardDefaultPermissionHint')}
|
|
705
|
+
inheritLabel={t('exec.permission.default')}
|
|
706
|
+
choices={TASK_PERMISSIONS.map(id => ({ value: id, label: t(`exec.permission.${id}` as TaskBoardKey) }))}
|
|
707
|
+
{...fieldProps}
|
|
708
|
+
{...state.cardDefaultPermission}
|
|
709
|
+
onEdit={(text) => { props.edit('cardDefaultPermission', text) }}
|
|
710
|
+
onReset={() => { props.resetField('cardDefaultPermission') }}
|
|
711
|
+
/>
|
|
712
|
+
<ChoiceField
|
|
713
|
+
id="settings-task-board-card-default-model"
|
|
714
|
+
label={t('new.model')}
|
|
715
|
+
hint={t('settings.cardDefaultModelHint')}
|
|
716
|
+
inheritLabel={t('exec.model.default')}
|
|
717
|
+
choices={modelChoiceRows(defaultModels)}
|
|
718
|
+
{...fieldProps}
|
|
719
|
+
{...state.cardDefaultModel}
|
|
720
|
+
onEdit={(text) => {
|
|
721
|
+
props.edit('cardDefaultModel', text)
|
|
722
|
+
dropUnhonouredEffort(text)
|
|
723
|
+
}}
|
|
724
|
+
onReset={() => {
|
|
725
|
+
props.resetField('cardDefaultModel')
|
|
726
|
+
// A blank default model carries no route for a level to bind to,
|
|
727
|
+
// so the staged default level goes with it.
|
|
728
|
+
dropUnhonouredEffort('')
|
|
729
|
+
}}
|
|
730
|
+
/>
|
|
731
|
+
<ChoiceField
|
|
732
|
+
id="settings-task-board-card-default-effort"
|
|
733
|
+
label={t('exec.reasoning')}
|
|
734
|
+
hint={t(reasoningHintKey(defaultModels, defaultModel))}
|
|
735
|
+
inheritLabel={t('exec.reasoning.inherit')}
|
|
736
|
+
choices={defaultEffortChoices}
|
|
737
|
+
{...fieldProps}
|
|
738
|
+
{...state.cardDefaultReasoningEffort}
|
|
739
|
+
// The levels on offer are the declared ones of the picked default
|
|
740
|
+
// model, so without a model that declares any there is nothing to
|
|
741
|
+
// choose: the selector locks instead of offering a level no model
|
|
742
|
+
// would accept.
|
|
743
|
+
disabled={disabled || !reasoningPickerEnabled(defaultModels, defaultModel)}
|
|
744
|
+
onEdit={(text) => { props.edit('cardDefaultReasoningEffort', text) }}
|
|
745
|
+
onReset={() => { props.resetField('cardDefaultReasoningEffort') }}
|
|
746
|
+
/>
|
|
747
|
+
</PluginSettingsCard>
|
|
748
|
+
|
|
514
749
|
{/* Provider sections: a family extension contributes its own nested
|
|
515
750
|
settings card into this list through the seat this card declares —
|
|
516
751
|
the family provider extension is the one that does. Each
|
|
@@ -12,6 +12,7 @@ import { t } from '../locales.ts'
|
|
|
12
12
|
import css from '../board.module.css'
|
|
13
13
|
import { useDialog, type OverlayPhase } from './overlay.tsx'
|
|
14
14
|
import { STATUS_KEY } from './status-key.ts'
|
|
15
|
+
import { parentAwaitsTeamRunPromotion, promoteParentForTeamRun } from './team-run-promotion.ts'
|
|
15
16
|
|
|
16
17
|
/** Link-subtask overlay props. */
|
|
17
18
|
export interface LinkSubtaskModalProps {
|
|
@@ -56,6 +57,10 @@ export function LinkSubtaskModal({ controller, parent, onClose, phase = 'open' }
|
|
|
56
57
|
setPending(true)
|
|
57
58
|
setError(undefined)
|
|
58
59
|
if (await controller.setParent(taskId, parent.id)) {
|
|
60
|
+
// The link is confirmed, so a parent that just gained a subtask is opted
|
|
61
|
+
// in where Agent Teams are served; a refused opt-in never undoes a link
|
|
62
|
+
// the Host already committed.
|
|
63
|
+
await promoteParentForTeamRun(controller, parent)
|
|
59
64
|
onClose()
|
|
60
65
|
return
|
|
61
66
|
}
|
|
@@ -67,6 +72,9 @@ export function LinkSubtaskModal({ controller, parent, onClose, phase = 'open' }
|
|
|
67
72
|
<div ref={dialog.attach} className={css.modal} role="dialog" aria-modal="true" aria-label={t('link.subtask.title')} tabIndex={-1}>
|
|
68
73
|
<h2 className={css.modalTitle}>{t('link.subtask.title')}</h2>
|
|
69
74
|
<p className={css.fieldHint}>{t('link.subtask.hint')}</p>
|
|
75
|
+
{parentAwaitsTeamRunPromotion(controller, parent) && (
|
|
76
|
+
<p className={css.fieldHint}>{t('exec.teamRunAutoHint')}</p>
|
|
77
|
+
)}
|
|
70
78
|
{candidates.length === 0
|
|
71
79
|
? <p className={css.detailText}>{t('link.subtask.empty')}</p>
|
|
72
80
|
: (
|