dsh-taskbridge 1.6.0 → 1.7.0
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/CHANGELOG.md +10 -1
- package/README.md +41 -41
- package/THIRD_PARTY_NOTICES.txt +23 -0
- package/codex/dsh-taskbridge.toml +140 -71
- package/docs/INTRODUCTION.md +44 -22
- package/docs/INTRODUCTION.zh.md +32 -26
- package/docs/codex-integration.md +90 -10
- package/docs/contracts-stage-b.md +4 -4
- package/docs/conversation-placement.md +25 -7
- package/docs/plugin-market.md +1 -1
- package/docs/releases/1.7.0.zh.md +11 -0
- package/docs/runtime-compatibility.md +4 -11
- package/docs/silent-wait.md +69 -31
- package/docs/taskbridge-upgrade.md +1 -1
- package/docs/worker-permissions.md +4 -14
- package/docs/workspace-grouping.md +126 -0
- package/lib/client.d.ts +365 -3
- package/lib/client.js +260 -5
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +7 -19
- package/src/client/api.js +550 -90
- package/src/client/index.jsx +699 -307
- package/src/client/sidebar.jsx +6 -5
- package/src/client/styles.js +251 -0
- package/src/client/task-cleanup.js +304 -0
- package/src/client/task-records-table.jsx +217 -0
- package/src/client/task-view.js +226 -10
- package/src/client/workspace-groups.js +482 -0
- package/src/client/workspaces-browser.jsx +770 -0
- package/src/codex/agent-ownership.js +270 -0
- package/src/codex/installer.js +525 -35
- package/src/codex/seam.js +5 -0
- package/src/config/defaults.js +63 -17
- package/src/config/settings.js +60 -62
- package/src/config/validate.js +126 -71
- package/src/http/respond.js +8 -0
- package/src/http/user-plane.js +197 -2
- package/src/index.js +50 -42
- package/src/jobs/activity.js +968 -78
- package/src/jobs/engine.js +784 -230
- package/src/jobs/history.js +188 -12
- package/src/jobs/plan-store.js +5 -0
- package/src/jobs/record-cleanup.js +196 -0
- package/src/jobs/task-tree.js +5 -3
- package/src/jobs/title.js +129 -12
- package/src/mcp/server.js +16 -8
- package/src/mcp/wait.js +64 -5
- package/src/runtime/agent-runner.js +53 -15
- package/src/runtime/worker-prompt.js +53 -0
- package/src/workspace/locks.js +288 -167
- package/docs/releases/1.4.0-token-benchmark.zh.md +0 -40
- package/docs/releases/1.4.0.zh.md +0 -54
- package/docs/releases/1.4.1.zh.md +0 -59
- package/docs/releases/1.4.2.zh.md +0 -23
- package/docs/releases/1.5.0-token-benchmark.zh.md +0 -73
- package/docs/releases/1.5.0.zh.md +0 -51
- package/docs/releases/1.5.1.zh.md +0 -70
- package/docs/releases/1.5.2.zh.md +0 -30
- package/docs/releases/1.5.3-test.1.zh.md +0 -28
- package/docs/releases/1.5.3-test.2.zh.md +0 -24
- package/docs/releases/1.5.3.zh.md +0 -33
- package/docs/releases/1.5.4.zh.md +0 -25
- package/src/review/preset.js +0 -868
- package/src/review/prompts.js +0 -145
- package/src/review/reviewer.js +0 -933
package/src/codex/seam.js
CHANGED
|
@@ -284,6 +284,11 @@ export function createCodexSeam(options = {}) {
|
|
|
284
284
|
* Migrate a byte-exact, known prior agent template during plugin startup, and
|
|
285
285
|
* upgrade an already-installed managed MCP entry that is merely stale.
|
|
286
286
|
*
|
|
287
|
+
* "Known" now has two exact sources: the enumerated published history
|
|
288
|
+
* (`KNOWN_AGENT_TEMPLATES`) and the digest of the template THIS plugin recorded writing
|
|
289
|
+
* into this same home — see `src/codex/agent-ownership.js`. Neither is a name, a marker
|
|
290
|
+
* or a version line: an edited character still makes the file the operator's.
|
|
291
|
+
*
|
|
287
292
|
* This never creates the agent file, never CREATES the MCP entry, never adopts a
|
|
288
293
|
* same-name entry it cannot prove it wrote, and never edits another Codex setting.
|
|
289
294
|
* @param {object} [callOptions] - `startupTarget`: the target `startupTarget()`
|
package/src/config/defaults.js
CHANGED
|
@@ -63,6 +63,16 @@ export const LIMITS = Object.freeze({
|
|
|
63
63
|
providers: 32,
|
|
64
64
|
manualModelsPerProvider: 128,
|
|
65
65
|
presets: 32,
|
|
66
|
+
/**
|
|
67
|
+
* Bounds on the LEGACY `worker.timeoutSeconds`.
|
|
68
|
+
*
|
|
69
|
+
* The field is no longer offered in the settings page and no longer bounds a
|
|
70
|
+
* normal run: an ordinary delegated task has no total execution deadline, only
|
|
71
|
+
* the explicit per-job override documented in `validateJobOverrides`. The bounds
|
|
72
|
+
* survive because a stored document (or an older client) may still carry the
|
|
73
|
+
* value, and a legacy value must keep loading instead of failing the whole
|
|
74
|
+
* document — see `validateWorkerSettings`.
|
|
75
|
+
*/
|
|
66
76
|
timeoutSecondsMin: 30,
|
|
67
77
|
timeoutSecondsMax: 2 * 60 * 60,
|
|
68
78
|
maxParallelismMin: 1,
|
|
@@ -75,9 +85,13 @@ export const LIMITS = Object.freeze({
|
|
|
75
85
|
// strictly greater than the first: two identical thresholds would deliver a
|
|
76
86
|
// self-check and an attention alert for the same instant, which is exactly the
|
|
77
87
|
// noisy behaviour the whole feature exists to remove.
|
|
78
|
-
|
|
88
|
+
//
|
|
89
|
+
// `0` is a legal value for EITHER threshold and means "this reminder is off".
|
|
90
|
+
// The minimum is therefore 0 rather than a duration, and the ordering rule is
|
|
91
|
+
// only enforced when both thresholds are actually enabled.
|
|
92
|
+
selfCheckSecondsMin: 0,
|
|
79
93
|
selfCheckSecondsMax: 60 * 60,
|
|
80
|
-
attentionSecondsMin:
|
|
94
|
+
attentionSecondsMin: 0,
|
|
81
95
|
attentionSecondsMax: 2 * 60 * 60,
|
|
82
96
|
// Repeated-failure reminder. `0` disables it, so the minimum is a switch rather
|
|
83
97
|
// than an error; the ceiling keeps a silly value from being indistinguishable from
|
|
@@ -85,21 +99,35 @@ export const LIMITS = Object.freeze({
|
|
|
85
99
|
repeatFailureThresholdMin: 0,
|
|
86
100
|
repeatFailureThresholdMax: 20,
|
|
87
101
|
promptChars: 200_000,
|
|
88
|
-
reviewPromptChars: 400_000,
|
|
89
102
|
});
|
|
90
103
|
|
|
91
104
|
/**
|
|
92
105
|
* Default activity-monitoring thresholds, in seconds of *inactivity*.
|
|
93
106
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
107
|
+
* There is exactly ONE time base: consecutive time without real progress. Real progress
|
|
108
|
+
* — model output, a reasoning step, a tool call or a tool result — resets it; a
|
|
109
|
+
* heartbeat, a result poll, the self-check itself and a plain state read do not.
|
|
110
|
+
*
|
|
111
|
+
* Two reminders are measured on that clock, and each can be switched off with `0`:
|
|
112
|
+
*
|
|
113
|
+
* * `selfCheckSeconds` — one read-only local inspection (default 10 minutes);
|
|
114
|
+
* * `attentionSeconds` — one notification to the commander asking it to check the
|
|
115
|
+
* run's progress (default 40 minutes).
|
|
116
|
+
*
|
|
117
|
+
* Neither depends on total runtime, so a task that keeps working for hours produces
|
|
118
|
+
* neither. Nothing here ever ends, cancels or restarts a run: a reminder is a REPORT,
|
|
119
|
+
* never a verdict.
|
|
97
120
|
*/
|
|
98
121
|
export const MONITORING_DEFAULTS = Object.freeze({
|
|
99
|
-
/**
|
|
100
|
-
selfCheckSeconds:
|
|
101
|
-
/**
|
|
102
|
-
|
|
122
|
+
/** No-progress span after which one read-only local self-check is performed (0 = off). */
|
|
123
|
+
selfCheckSeconds: 10 * 60,
|
|
124
|
+
/**
|
|
125
|
+
* No-progress span after which the wait reports the run progress check (0 = off).
|
|
126
|
+
*
|
|
127
|
+
* This is the ONE notification interval: it doubles as the point at which a host is
|
|
128
|
+
* asked to confirm the goal, so there is no second duration to configure.
|
|
129
|
+
*/
|
|
130
|
+
attentionSeconds: 40 * 60,
|
|
103
131
|
/**
|
|
104
132
|
* How many CONSECUTIVE identical tool failures are reported once, or `0` to disable.
|
|
105
133
|
*
|
|
@@ -124,6 +152,20 @@ export const KNOWN_EFFORTS = Object.freeze(['off', 'minimal', 'low', 'medium', '
|
|
|
124
152
|
/** Canonical sort index for declared effort ids. */
|
|
125
153
|
export const EFFORT_ORDER = Object.freeze(new Map(KNOWN_EFFORTS.map((id, index) => [id, index])));
|
|
126
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Default for the operator's per-task Agent Teams choice: OFF.
|
|
157
|
+
*
|
|
158
|
+
* This is a TASK-level default, not DSH's global switch. It decides what a NEW
|
|
159
|
+
* submission does when its dispatcher states no per-task choice of its own:
|
|
160
|
+
* `false` writes that one run's Session to "teams off", `true` writes it to
|
|
161
|
+
* "teams on". It is deliberately `false` on a fresh install and on upgrade, so
|
|
162
|
+
* upgrading never silently turns agent collaboration on for every new task.
|
|
163
|
+
*
|
|
164
|
+
* It never touches DSH's global agent-teams setting and never overrides a
|
|
165
|
+
* dispatcher's explicit per-task `agentTeams` value.
|
|
166
|
+
*/
|
|
167
|
+
export const DEFAULT_AGENT_TEAMS_FOR_NEW_TASKS = false;
|
|
168
|
+
|
|
127
169
|
/**
|
|
128
170
|
* Default settings document. Delegation is off until the operator enables it.
|
|
129
171
|
*/
|
|
@@ -136,22 +178,26 @@ export function defaultSettings() {
|
|
|
136
178
|
providerId: null,
|
|
137
179
|
model: null,
|
|
138
180
|
reasoningEffort: null,
|
|
181
|
+
// LEGACY, kept so every reader of this document sees one shape. It is no
|
|
182
|
+
// longer offered in the settings page and no longer bounds an ordinary run;
|
|
183
|
+
// `resolveEffectiveConfig` publishes it as `executionTimeoutSeconds`.
|
|
139
184
|
timeoutSeconds: 1800,
|
|
140
185
|
maxParallelism: 1,
|
|
141
186
|
isolation: DEFAULT_ISOLATION,
|
|
142
187
|
},
|
|
143
|
-
review: {
|
|
144
|
-
enabled: false,
|
|
145
|
-
providerId: null,
|
|
146
|
-
model: null,
|
|
147
|
-
reasoningEffort: null,
|
|
148
|
-
},
|
|
149
188
|
// Kept separate from the legacy in-memory connection/grant compatibility
|
|
150
189
|
// layer. New installations use this one switch for MCP dispatch.
|
|
151
190
|
authorization: {
|
|
152
191
|
taskGrantTtlSeconds: 900,
|
|
153
192
|
sessionGrantTtlSeconds: 4 * 60 * 60,
|
|
154
193
|
},
|
|
194
|
+
// The operator's default for NEW tasks only. Absent in documents written
|
|
195
|
+
// before this block existed; validation fills in the OFF default, so schema
|
|
196
|
+
// version 1 stays readable both ways and an upgrade needs no migration and
|
|
197
|
+
// never turns collaboration on by itself.
|
|
198
|
+
execution: {
|
|
199
|
+
agentTeamsDefault: DEFAULT_AGENT_TEAMS_FOR_NEW_TASKS,
|
|
200
|
+
},
|
|
155
201
|
// Silence thresholds for a running task. Absent in documents written before
|
|
156
202
|
// this block existed; validation fills in the defaults, so schema version 1
|
|
157
203
|
// stays readable both ways and an upgraded document needs no migration step.
|
|
@@ -160,7 +206,7 @@ export function defaultSettings() {
|
|
|
160
206
|
attentionSeconds: MONITORING_DEFAULTS.attentionSeconds,
|
|
161
207
|
},
|
|
162
208
|
projectOverrides: {},
|
|
163
|
-
// Named, non-secret worker
|
|
209
|
+
// Named, non-secret worker settings. Empty by default, and absent
|
|
164
210
|
// in documents written before presets existed — validation fills it in, so
|
|
165
211
|
// schema version 1 stays readable both ways.
|
|
166
212
|
presets: [],
|
package/src/config/settings.js
CHANGED
|
@@ -29,11 +29,11 @@ import {
|
|
|
29
29
|
ConfigError,
|
|
30
30
|
canonicalProjectKey,
|
|
31
31
|
validateConversationSettings,
|
|
32
|
+
validateExecutionSettings,
|
|
32
33
|
validateJobOverrides,
|
|
33
34
|
validateMonitoringSettings,
|
|
34
35
|
validateProjectOverride,
|
|
35
36
|
validateProviderProfile,
|
|
36
|
-
validateReviewSettings,
|
|
37
37
|
validateSelection,
|
|
38
38
|
validateSettings,
|
|
39
39
|
validateWorkerSettings,
|
|
@@ -108,7 +108,6 @@ function projectOverrideIndex(projectOverrides) {
|
|
|
108
108
|
export function resolveEffectiveConfig(settings, { projectPath = null, overrides = {} } = {}) {
|
|
109
109
|
const applied = [];
|
|
110
110
|
let worker = { ...settings.worker };
|
|
111
|
-
let review = { ...settings.review };
|
|
112
111
|
const canonical = projectPath === null || projectPath === undefined ? null : projectKey(projectPath);
|
|
113
112
|
|
|
114
113
|
if (canonical !== null) {
|
|
@@ -118,10 +117,6 @@ export function resolveEffectiveConfig(settings, { projectPath = null, overrides
|
|
|
118
117
|
worker = mergeWorker(worker, projectBlock.worker);
|
|
119
118
|
applied.push('project:worker');
|
|
120
119
|
}
|
|
121
|
-
if (projectBlock.review !== undefined) {
|
|
122
|
-
review = { ...projectBlock.review };
|
|
123
|
-
applied.push('project:review');
|
|
124
|
-
}
|
|
125
120
|
}
|
|
126
121
|
}
|
|
127
122
|
|
|
@@ -135,9 +130,6 @@ export function resolveEffectiveConfig(settings, { projectPath = null, overrides
|
|
|
135
130
|
// project block cannot leave a provider/model pair that global settings once
|
|
136
131
|
// made legal and a later edit invalidated.
|
|
137
132
|
const selection = validateSelection(worker, settings.providers, 'effective.worker');
|
|
138
|
-
const effectiveReview = review.enabled
|
|
139
|
-
? { ...review, ...pluckSelection(validateSelection(review, settings.providers, 'effective.review')) }
|
|
140
|
-
: { enabled: false, providerId: null, model: null, reasoningEffort: null };
|
|
141
133
|
|
|
142
134
|
return deepFreeze({
|
|
143
135
|
schemaVersion: SCHEMA_VERSION,
|
|
@@ -145,7 +137,16 @@ export function resolveEffectiveConfig(settings, { projectPath = null, overrides
|
|
|
145
137
|
providerId: selection.providerId,
|
|
146
138
|
model: selection.model,
|
|
147
139
|
reasoningEffort: selection.reasoningEffort,
|
|
140
|
+
// LEGACY, reported verbatim so a reader can see what the stored document
|
|
141
|
+
// still says. It is NOT a run budget: nothing bounds an ordinary task by it.
|
|
148
142
|
timeoutSeconds: worker.timeoutSeconds,
|
|
143
|
+
// The budget the RUN actually gets. `null` is the documented state: an
|
|
144
|
+
// ordinary delegated task has no total execution deadline — silence is
|
|
145
|
+
// reported by the monitoring block, never turned into a failure. A number
|
|
146
|
+
// appears only when the caller explicitly asked for a per-job cap through
|
|
147
|
+
// `overrides.timeoutSeconds` (the compatibility path the engine still
|
|
148
|
+
// honours), and that number is what the engine applies.
|
|
149
|
+
executionTimeoutSeconds: normalizedOverrides.timeoutSeconds ?? null,
|
|
149
150
|
maxParallelism: worker.maxParallelism,
|
|
150
151
|
isolation: worker.isolation,
|
|
151
152
|
// Explicit placeholder for the native provider route. In this stage the
|
|
@@ -154,29 +155,9 @@ export function resolveEffectiveConfig(settings, { projectPath = null, overrides
|
|
|
154
155
|
// its decision against this field rather than re-deriving it.
|
|
155
156
|
providerRoute: selection.providerId,
|
|
156
157
|
},
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
providerId: effectiveReview.providerId ?? null,
|
|
160
|
-
model: effectiveReview.model ?? null,
|
|
161
|
-
reasoningEffort: effectiveReview.reasoningEffort ?? null,
|
|
162
|
-
providerRoute: effectiveReview.providerId ?? null,
|
|
163
|
-
},
|
|
164
|
-
// What this task does with its DSH conversation is NOT a settings fact any
|
|
165
|
-
// more: it is decided per submission by `continueFromTaskId`. The frozen
|
|
166
|
-
// snapshot therefore carries the rule rather than a stored mode, so a task
|
|
167
|
-
// record states what the plugin will do instead of echoing a retired setting.
|
|
158
|
+
// The conversation rule is frozen with the task. The monitoring thresholds
|
|
159
|
+
// apply to new tasks when settings change.
|
|
168
160
|
conversation: { policy: CONVERSATION_POLICY },
|
|
169
|
-
// The silence thresholds and the repeated-failure count this task runs under,
|
|
170
|
-
// FROZEN at admission. They are global-only (no project or per-job layer): an
|
|
171
|
-
// operator edits them rarely, and a per-job override would let one submission ask
|
|
172
|
-
// to be watched on a different clock than the alert thresholds the operator
|
|
173
|
-
// actually set. Freezing them here is what makes an edit during a live run apply to
|
|
174
|
-
// the NEXT task instead of silently retiming one already in flight.
|
|
175
|
-
monitoring: {
|
|
176
|
-
selfCheckSeconds: settings.monitoring.selfCheckSeconds,
|
|
177
|
-
attentionSeconds: settings.monitoring.attentionSeconds,
|
|
178
|
-
repeatFailureThreshold: settings.monitoring.repeatFailureThreshold,
|
|
179
|
-
},
|
|
180
161
|
provenance: {
|
|
181
162
|
// Canonical, not the caller's spelling: a recorded snapshot must compare
|
|
182
163
|
// equal to the key its override is stored under.
|
|
@@ -184,21 +165,33 @@ export function resolveEffectiveConfig(settings, { projectPath = null, overrides
|
|
|
184
165
|
projectKey: canonical === null ? null : canonical.key,
|
|
185
166
|
applied,
|
|
186
167
|
},
|
|
168
|
+
// Frozen verbatim, `0` included: `0` means "this reminder is off", which is a
|
|
169
|
+
// decision a running task must keep and must not be re-read out of a settings
|
|
170
|
+
// document that has since changed. Stated LAST so this single block is the one
|
|
171
|
+
// definition of the monitoring snapshot.
|
|
172
|
+
monitoring: {
|
|
173
|
+
selfCheckSeconds: settings.monitoring.selfCheckSeconds,
|
|
174
|
+
attentionSeconds: settings.monitoring.attentionSeconds,
|
|
175
|
+
repeatFailureThreshold: settings.monitoring.repeatFailureThreshold,
|
|
176
|
+
},
|
|
187
177
|
});
|
|
188
178
|
}
|
|
189
179
|
|
|
190
180
|
function mergeWorker(base, patch) {
|
|
191
181
|
const next = { ...base };
|
|
192
|
-
|
|
182
|
+
// `timeoutSeconds` is deliberately NOT merged. It is a retired field: a project
|
|
183
|
+
// override that still carries one must not be able to turn it into a run budget,
|
|
184
|
+
// and an operator who set it years ago must not silently cap new tasks through a
|
|
185
|
+
// layer they cannot see in the settings page. The effective snapshot publishes the
|
|
186
|
+
// GLOBAL stored value as `worker.timeoutSeconds` (read-only, for readers of the
|
|
187
|
+
// document) and the actual budget as `worker.executionTimeoutSeconds`, which only
|
|
188
|
+
// an explicit per-job override can set.
|
|
189
|
+
for (const key of ['providerId', 'model', 'reasoningEffort', 'isolation', 'maxParallelism']) {
|
|
193
190
|
if (patch[key] !== undefined) next[key] = patch[key];
|
|
194
191
|
}
|
|
195
192
|
return next;
|
|
196
193
|
}
|
|
197
194
|
|
|
198
|
-
function pluckSelection(selection) {
|
|
199
|
-
return { providerId: selection.providerId, model: selection.model, reasoningEffort: selection.reasoningEffort };
|
|
200
|
-
}
|
|
201
|
-
|
|
202
195
|
/**
|
|
203
196
|
* Project one preset without any field that could carry a secret.
|
|
204
197
|
* @param {object} preset - validated preset.
|
|
@@ -208,8 +201,7 @@ function publicPreset(preset) {
|
|
|
208
201
|
return {
|
|
209
202
|
id: preset.id,
|
|
210
203
|
name: preset.name,
|
|
211
|
-
worker:
|
|
212
|
-
review: preset.review === null ? null : { ...preset.review },
|
|
204
|
+
worker: { ...preset.worker },
|
|
213
205
|
};
|
|
214
206
|
}
|
|
215
207
|
|
|
@@ -217,7 +209,7 @@ function publicPreset(preset) {
|
|
|
217
209
|
* Public, secret-free projection of settings for a settings surface or export.
|
|
218
210
|
*
|
|
219
211
|
* This is also the export shape: a preset holds only provider ids and
|
|
220
|
-
* worker
|
|
212
|
+
* worker settings, so exporting presets exports no endpoint and no
|
|
221
213
|
* credential. A credential *reference* is included because it is a name, not a
|
|
222
214
|
* value; the value never enters this document.
|
|
223
215
|
* @param {object} settings - validated settings.
|
|
@@ -240,12 +232,15 @@ export function publicSettings(settings) {
|
|
|
240
232
|
models: provider.models.map((model) => ({ ...model, efforts: [...model.efforts] })),
|
|
241
233
|
})),
|
|
242
234
|
worker: { ...settings.worker },
|
|
243
|
-
review: { ...settings.review },
|
|
244
235
|
authorization: { ...settings.authorization },
|
|
245
236
|
// Included so a settings surface (and an export/import round-trip) sees the
|
|
246
237
|
// actual thresholds a new task will freeze. They are plain bounded integers,
|
|
247
238
|
// never a secret.
|
|
248
239
|
monitoring: { ...validateMonitoringSettings(settings.monitoring) },
|
|
240
|
+
// Included so a settings surface (and an export/import round-trip) sees the
|
|
241
|
+
// actual default a NEW task will freeze. Absent in a stored document it is the
|
|
242
|
+
// documented OFF default, never "on" and never "no choice".
|
|
243
|
+
execution: { ...validateExecutionSettings(settings.execution) },
|
|
249
244
|
projectOverrides: structuredClone(settings.projectOverrides ?? {}),
|
|
250
245
|
presets: presets.map(publicPreset),
|
|
251
246
|
// Kept in the export for compatibility with documents and clients that read
|
|
@@ -387,9 +382,7 @@ export class SettingsService {
|
|
|
387
382
|
}
|
|
388
383
|
|
|
389
384
|
/**
|
|
390
|
-
* Remove one provider profile.
|
|
391
|
-
* review settings is refused: silently dropping the reference would leave
|
|
392
|
-
* delegation pointing at nothing.
|
|
385
|
+
* Remove one provider profile. Refuse a provider that the worker or a project override selects.
|
|
393
386
|
* @param {string} providerId - provider to remove.
|
|
394
387
|
* @returns {Promise<object>} committed settings.
|
|
395
388
|
*/
|
|
@@ -400,11 +393,8 @@ export class SettingsService {
|
|
|
400
393
|
if (previous.worker.providerId === providerId) {
|
|
401
394
|
throw new ConfigError('PROVIDER_IN_USE', 'the worker settings select this provider', { providerId, role: 'worker' });
|
|
402
395
|
}
|
|
403
|
-
if (previous.review.enabled && previous.review.providerId === providerId) {
|
|
404
|
-
throw new ConfigError('PROVIDER_IN_USE', 'the additional review selects this provider', { providerId, role: 'review' });
|
|
405
|
-
}
|
|
406
396
|
for (const [projectPath, block] of Object.entries(previous.projectOverrides)) {
|
|
407
|
-
if (block?.worker?.providerId === providerId
|
|
397
|
+
if (block?.worker?.providerId === providerId) {
|
|
408
398
|
throw new ConfigError('PROVIDER_IN_USE', 'a project override selects this provider', { providerId, projectPath });
|
|
409
399
|
}
|
|
410
400
|
}
|
|
@@ -416,7 +406,6 @@ export class SettingsService {
|
|
|
416
406
|
...previous,
|
|
417
407
|
providers,
|
|
418
408
|
worker: defaultSettings().worker,
|
|
419
|
-
review: defaultSettings().review,
|
|
420
409
|
projectOverrides: {},
|
|
421
410
|
presets: [],
|
|
422
411
|
}, previous);
|
|
@@ -459,20 +448,6 @@ export class SettingsService {
|
|
|
459
448
|
);
|
|
460
449
|
}
|
|
461
450
|
|
|
462
|
-
/**
|
|
463
|
-
* Replace the additional-review block. Enabling review requires a complete,
|
|
464
|
-
* independently valid provider/model/effort triple.
|
|
465
|
-
* @param {unknown} candidate - candidate review block.
|
|
466
|
-
* @returns {Promise<object>} committed settings.
|
|
467
|
-
*/
|
|
468
|
-
async setReview(candidate) {
|
|
469
|
-
return await this.serialize(async () => {
|
|
470
|
-
const previous = await this.snapshot();
|
|
471
|
-
const review = validateReviewSettings(candidate, previous.providers);
|
|
472
|
-
return await this.persistWithinQueue({ ...previous, review }, previous);
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
|
|
476
451
|
/**
|
|
477
452
|
* Replace or clear one project override.
|
|
478
453
|
*
|
|
@@ -553,6 +528,29 @@ export class SettingsService {
|
|
|
553
528
|
});
|
|
554
529
|
}
|
|
555
530
|
|
|
531
|
+
/**
|
|
532
|
+
* Replace the operator's execution-choice block.
|
|
533
|
+
*
|
|
534
|
+
* Today that block holds one decision: whether a NEW delegated task should have
|
|
535
|
+
* DSH Agent Teams on when its dispatcher states no per-task choice. This is a
|
|
536
|
+
* TASK default only — it is not DSH's global switch, and it never overrides a
|
|
537
|
+
* per-task `agentTeams` value a dispatcher states.
|
|
538
|
+
*
|
|
539
|
+
* Shape validation is pure, so it happens before the turn is queued; the write
|
|
540
|
+
* then takes the same serialized queue as every other settings mutation, so it
|
|
541
|
+
* cannot lose a concurrent edit. A task already running keeps the snapshot it
|
|
542
|
+
* froze at admission; only a later submission reads the new default.
|
|
543
|
+
* @param {unknown} candidate - `{ agentTeamsDefault }`.
|
|
544
|
+
* @returns {Promise<object>} committed settings.
|
|
545
|
+
*/
|
|
546
|
+
async setExecution(candidate) {
|
|
547
|
+
const execution = validateExecutionSettings(candidate);
|
|
548
|
+
return await this.serialize(async () => {
|
|
549
|
+
const previous = await this.snapshot();
|
|
550
|
+
return await this.persistWithinQueue({ ...previous, execution }, previous);
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
|
|
556
554
|
/**
|
|
557
555
|
* Validate and commit a whole settings-shaped document.
|
|
558
556
|
*
|