@linxin666/dsh-client-ui-task-board 0.4.15 → 0.4.17
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 +17 -37
- package/README.zh.md +17 -37
- package/lib/client.js +136 -1347
- package/lib/client.js.map +1 -1
- package/lib/index.js +166 -2529
- package/lib/types/client/TaskBoardSettingsCard.d.ts +0 -20
- package/lib/types/client/board/ExecutionLog.d.ts +8 -0
- package/lib/types/client/board/status-key.d.ts +0 -15
- package/lib/types/client/locales.d.ts +2 -110
- package/lib/types/core/controller.d.ts +1 -1
- package/lib/types/core/extension.d.ts +4 -5
- package/lib/types/core/model-catalog.d.ts +58 -0
- package/lib/types/core/reasoning-effort.d.ts +1 -1
- package/lib/types/core/subtask.d.ts +31 -0
- package/lib/types/core/tasks.d.ts +0 -45
- package/lib/types/core/use-cases/task-update.d.ts +1 -1
- package/lib/types/host/llm-dispatch.d.ts +8 -10
- package/lib/types/host-ledger.d.ts +0 -28
- package/lib/types/host-runner.d.ts +15 -71
- package/lib/types/host-service.d.ts +25 -89
- package/lib/types/index.d.ts +0 -78
- package/lib/types/protocol.d.ts +6 -23
- package/package.json +26 -26
- package/src/client/TaskBoardSettingsCard.tsx +13 -200
- package/src/client/board/ExecutionLog.tsx +17 -6
- package/src/client/board/NewTaskModal.tsx +1 -42
- package/src/client/board/TaskCard.tsx +2 -7
- package/src/client/board/TaskDetail.tsx +2 -37
- package/src/client/board/status-key.ts +0 -30
- package/src/client/board-settings.module.css +3 -22
- package/src/client/board.module.css +1 -104
- package/src/client/index.ts +1 -1
- package/src/client/locales.ts +8 -224
- package/src/core/controller.ts +1 -3
- package/src/core/extension.ts +4 -5
- package/src/core/model-catalog.ts +114 -0
- package/src/core/reasoning-effort.ts +1 -1
- package/src/core/store.ts +22 -17
- package/src/core/subtask.ts +36 -0
- package/src/core/tasks.ts +0 -53
- package/src/core/use-cases/task-update.ts +1 -8
- package/src/host/agent-tools.ts +1 -15
- package/src/host/llm-dispatch.ts +8 -10
- package/src/host-ledger.ts +1 -86
- package/src/host-routes.ts +4 -4
- package/src/host-runner.ts +33 -139
- package/src/host-service.ts +60 -266
- package/src/index.ts +27 -164
- package/src/protocol.ts +8 -43
- package/lib/types/client/board/VerificationReport.d.ts +0 -10
- package/lib/types/core/verification-budget.d.ts +0 -52
- package/lib/types/core/verification.d.ts +0 -753
- package/lib/types/host/verification-gate.d.ts +0 -95
- package/lib/types/host/verification-runner.d.ts +0 -139
- package/lib/types/host/workspace-evidence.d.ts +0 -53
- package/src/client/board/VerificationReport.tsx +0 -361
- package/src/core/verification-budget.ts +0 -115
- package/src/core/verification.ts +0 -1594
- package/src/host/verification-gate.ts +0 -487
- package/src/host/verification-runner.ts +0 -702
- package/src/host/workspace-evidence.ts +0 -176
package/src/index.ts
CHANGED
|
@@ -21,20 +21,10 @@ import { TaskBoardHostService, type HostTimerFace } from './host-service.ts'
|
|
|
21
21
|
import { createOwnerPeer } from './host-runner.ts'
|
|
22
22
|
import { parseTaskDraft, TaskParseError } from './host-ai.ts'
|
|
23
23
|
import { TASK_PERMISSIONS, isTaskPermission, type TaskPermission } from './core/tasks.ts'
|
|
24
|
-
import { DEFAULT_SUBTASK_DEPTH, SUBTASK_DEPTH_MAX, SUBTASK_DEPTH_MIN } from './core/subtask.ts'
|
|
24
|
+
import { LEGACY_AGENT_TEAMS_TOOL, DEFAULT_SUBTASK_DEPTH, SUBTASK_DEPTH_MAX, SUBTASK_DEPTH_MIN } from './core/subtask.ts'
|
|
25
25
|
import { DEFAULT_SESSION_POLL_SECONDS, SESSION_POLL_MAX_SECONDS, SESSION_POLL_MIN_SECONDS } from './core/poll-cadence.ts'
|
|
26
26
|
import { DEFAULT_RUN_LAUNCH_WIDTH, RUN_LAUNCH_WIDTH_MAX, RUN_LAUNCH_WIDTH_MIN } from './core/launch-width.ts'
|
|
27
27
|
import { DEFAULT_SPEND_BUDGET_TOKENS } from './core/spend-budget.ts'
|
|
28
|
-
import {
|
|
29
|
-
DEFAULT_VERIFICATION_BUDGET_SECONDS,
|
|
30
|
-
DEFAULT_VERIFICATION_CALL_TIMEOUT_SECONDS,
|
|
31
|
-
VERIFICATION_BUDGET_MAX_SECONDS,
|
|
32
|
-
VERIFICATION_BUDGET_MIN_SECONDS,
|
|
33
|
-
VERIFICATION_CALL_TIMEOUT_MAX_SECONDS,
|
|
34
|
-
VERIFICATION_CALL_TIMEOUT_MIN_SECONDS,
|
|
35
|
-
verificationBudgetMs,
|
|
36
|
-
verificationCallTimeoutMs,
|
|
37
|
-
} from './core/verification-budget.ts'
|
|
38
28
|
import { DEFAULT_SESSION_PERMISSION } from './core/handover.ts'
|
|
39
29
|
import type { CardDefaults } from './core/card-defaults.ts'
|
|
40
30
|
import { buildTaskBoardTools, TASK_BOARD_TOOL_NAMES } from './host/agent-tools.ts'
|
|
@@ -44,9 +34,7 @@ import type { ModelInfoResolver, TaskBoardAttachmentStore } from './host/attachm
|
|
|
44
34
|
import { TASK_BOARD_SERVICE_NAME, type TaskBoardExtension } from './core/extension.ts'
|
|
45
35
|
import type { TaskBoardAction } from './protocol.ts'
|
|
46
36
|
import { mountOnce } from './mount-once.ts'
|
|
47
|
-
import {
|
|
48
|
-
import { normalizeCatalog, type ModelCatalogView, type VerificationSettings } from './core/verification.ts'
|
|
49
|
-
import { probeWorkspaceChanges } from './host/workspace-evidence.ts'
|
|
37
|
+
import { normalizeCatalog, type ModelCatalogView } from './core/model-catalog.ts'
|
|
50
38
|
|
|
51
39
|
/** Order of the announcement section within the shared tool-guidance band. */
|
|
52
40
|
const SECTION_ORDER = PLUGIN_TOOL_SECTION_ORDERS['task-board']
|
|
@@ -145,22 +133,6 @@ export interface Config {
|
|
|
145
133
|
* is skipped onto the scheduler with its run budget untouched.
|
|
146
134
|
*/
|
|
147
135
|
spendBudgetTokens?: Volatile<number>
|
|
148
|
-
/**
|
|
149
|
-
* GLOBAL native /goal switch (default OFF), the master control over whether
|
|
150
|
-
* this board starts a run with dsh's built-in /goal at all. A run uses native
|
|
151
|
-
* /goal only when THIS is on AND the task's own `goalRun` is not off; while
|
|
152
|
-
* it is off every task runs one plain turn.
|
|
153
|
-
*
|
|
154
|
-
* The value is frozen when an execution starts, so toggling it only affects
|
|
155
|
-
* executions that begin afterwards and never re-writes a task's stored
|
|
156
|
-
* `goalRun` preference. A run that consequently does not execute native
|
|
157
|
-
* /goal is marked as such (its acceptance applicability is `goal-disabled`)
|
|
158
|
-
* and is never reported as a passed goal acceptance or failed for lacking a
|
|
159
|
-
* completion call. Independent of `goalVerification`; acceptance governs the
|
|
160
|
-
* completing call of a goal-form run, this switch governs whether the run
|
|
161
|
-
* becomes a goal run.
|
|
162
|
-
*/
|
|
163
|
-
goalRunEnabled?: Volatile<boolean>
|
|
164
136
|
/**
|
|
165
137
|
* Agent preset a NEW card starts from (volatile, default blank = not set).
|
|
166
138
|
* A prefill, never a pin: the create dialog opens with it selected, the
|
|
@@ -188,48 +160,6 @@ export interface Config {
|
|
|
188
160
|
* model, and a blank `cardDefaultModel` makes it inert.
|
|
189
161
|
*/
|
|
190
162
|
cardDefaultReasoningEffort?: Volatile<string>
|
|
191
|
-
/**
|
|
192
|
-
* Goal acceptance for executions this board starts (default ON). When on,
|
|
193
|
-
* update_goal(action: complete) inside a task execution is refused until an
|
|
194
|
-
* acceptance pass is recorded for that execution: the three coding criteria,
|
|
195
|
-
* a 0.65 threshold, two rounds per criterion with the A/B slots swapped, and
|
|
196
|
-
* at most two acceptances per execution — the first failure returns its
|
|
197
|
-
* findings to the fixing agent, the second ends the cycle. The switch only
|
|
198
|
-
* affects goal-form executions of the board; plain chat and a task pinned to
|
|
199
|
-
* goalRun: false are untouched. When a separate third-party verifier also
|
|
200
|
-
* runs its own automatic acceptance, both judges score independently: this
|
|
201
|
-
* one gates completion, the other only steers, and no public interface lets
|
|
202
|
-
* the two share a verdict.
|
|
203
|
-
*/
|
|
204
|
-
goalVerification?: Volatile<boolean>
|
|
205
|
-
/**
|
|
206
|
-
* Judge model for goal acceptance as provider/model. Blank inherits the HOST's
|
|
207
|
-
* own model catalog default — never the card's pinned execution model.
|
|
208
|
-
*/
|
|
209
|
-
goalVerificationModel?: Volatile<string>
|
|
210
|
-
/**
|
|
211
|
-
* Reasoning effort for the judge. Blank inherits the host default level; an
|
|
212
|
-
* effort the resolved model does not declare is dropped instead of being
|
|
213
|
-
* sent, and the fallback to the model's own default is reported.
|
|
214
|
-
*/
|
|
215
|
-
goalVerificationReasoningEffort?: Volatile<string>
|
|
216
|
-
/**
|
|
217
|
-
* Ceiling of ONE judge request of a goal acceptance, in seconds
|
|
218
|
-
* (30..600, default 150). One acceptance issues six judge requests (three
|
|
219
|
-
* criteria times two rounds), so a ceiling that is too small turns a slow but
|
|
220
|
-
* healthy judge route into a wall of timeouts, and every timeout was charged
|
|
221
|
-
* as an acceptance anomaly. Raise it for a reasoning model reading a long
|
|
222
|
-
* trace.
|
|
223
|
-
*/
|
|
224
|
-
goalVerificationCallTimeoutSeconds?: Volatile<number>
|
|
225
|
-
/**
|
|
226
|
-
* Total ceiling of ONE goal acceptance attempt, in seconds (120..1800,
|
|
227
|
-
* default eight times the per-call default). Keep it at or above
|
|
228
|
-
* `goalVerificationCallTimeoutSeconds` times six or an acceptance can never
|
|
229
|
-
* finish: the attempt then ends early with a budget stop that judges nothing
|
|
230
|
-
* and spends no acceptance budget.
|
|
231
|
-
*/
|
|
232
|
-
goalVerificationBudgetSeconds?: Volatile<number>
|
|
233
163
|
}
|
|
234
164
|
|
|
235
165
|
/**
|
|
@@ -265,8 +195,6 @@ export interface ConfigInput {
|
|
|
265
195
|
runLaunchWidth?: number
|
|
266
196
|
/** Daily token ceiling for board runs; 0 disables the gate. */
|
|
267
197
|
spendBudgetTokens?: number
|
|
268
|
-
/** Global native /goal switch; default off, frozen per execution. */
|
|
269
|
-
goalRunEnabled?: boolean
|
|
270
198
|
/** Agent preset a new card starts from; blank = not set. */
|
|
271
199
|
cardDefaultMode?: string
|
|
272
200
|
/** Permission a new card starts from; blank = not set. */
|
|
@@ -275,16 +203,6 @@ export interface ConfigInput {
|
|
|
275
203
|
cardDefaultModel?: string
|
|
276
204
|
/** Reasoning level a new card starts from; blank = not set. */
|
|
277
205
|
cardDefaultReasoningEffort?: string
|
|
278
|
-
/** Goal acceptance switch. */
|
|
279
|
-
goalVerification?: boolean
|
|
280
|
-
/** Judge model route for goal acceptance; blank inherits the host default. */
|
|
281
|
-
goalVerificationModel?: string
|
|
282
|
-
/** Judge reasoning effort; blank inherits the host default. */
|
|
283
|
-
goalVerificationReasoningEffort?: string
|
|
284
|
-
/** Ceiling of one judge request of a goal acceptance, in seconds. */
|
|
285
|
-
goalVerificationCallTimeoutSeconds?: number
|
|
286
|
-
/** Total ceiling of one goal acceptance attempt, in seconds. */
|
|
287
|
-
goalVerificationBudgetSeconds?: number
|
|
288
206
|
}
|
|
289
207
|
|
|
290
208
|
export const Config: z<ConfigInput, Config> = z.object({
|
|
@@ -299,28 +217,12 @@ export const Config: z<ConfigInput, Config> = z.object({
|
|
|
299
217
|
sessionPollSeconds: z.number().min(SESSION_POLL_MIN_SECONDS).max(SESSION_POLL_MAX_SECONDS).default(DEFAULT_SESSION_POLL_SECONDS).volatile(),
|
|
300
218
|
runLaunchWidth: z.number().min(RUN_LAUNCH_WIDTH_MIN).max(RUN_LAUNCH_WIDTH_MAX).default(DEFAULT_RUN_LAUNCH_WIDTH).volatile(),
|
|
301
219
|
spendBudgetTokens: z.number().min(DEFAULT_SPEND_BUDGET_TOKENS).default(DEFAULT_SPEND_BUDGET_TOKENS).volatile(),
|
|
302
|
-
goalRunEnabled: z.boolean().default(false).volatile(),
|
|
303
220
|
cardDefaultMode: z.string().default('').volatile(),
|
|
304
221
|
cardDefaultPermission: z.union([...TASK_PERMISSIONS, '']).default('').volatile(),
|
|
305
222
|
cardDefaultModel: z.string().default('').volatile(),
|
|
306
223
|
cardDefaultReasoningEffort: z.string().default('').volatile(),
|
|
307
|
-
goalVerification: z.boolean().default(true).volatile(),
|
|
308
|
-
goalVerificationModel: z.string().default('').volatile(),
|
|
309
|
-
goalVerificationReasoningEffort: z.string().default('').volatile(),
|
|
310
|
-
goalVerificationCallTimeoutSeconds: z.number().min(VERIFICATION_CALL_TIMEOUT_MIN_SECONDS).max(VERIFICATION_CALL_TIMEOUT_MAX_SECONDS).default(DEFAULT_VERIFICATION_CALL_TIMEOUT_SECONDS).volatile(),
|
|
311
|
-
goalVerificationBudgetSeconds: z.number().min(VERIFICATION_BUDGET_MIN_SECONDS).max(VERIFICATION_BUDGET_MAX_SECONDS).default(DEFAULT_VERIFICATION_BUDGET_SECONDS).volatile(),
|
|
312
224
|
})
|
|
313
225
|
|
|
314
|
-
/** Schema default for the goal-acceptance switch, re-read for hand-built contexts. */
|
|
315
|
-
export const DEFAULT_GOAL_VERIFICATION = true
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Schema default for the GLOBAL native-/goal switch, re-read for hand-built
|
|
319
|
-
* contexts. Deliberately false: a deployment that never configured it (and
|
|
320
|
-
* every card written before the option existed) runs plain single turns.
|
|
321
|
-
*/
|
|
322
|
-
export const DEFAULT_GOAL_RUN = false
|
|
323
|
-
|
|
324
226
|
declare module '@deepseek-ai/cordis' {
|
|
325
227
|
interface Events {
|
|
326
228
|
/**
|
|
@@ -667,34 +569,18 @@ function applyImpl(ctx: Context, config?: Config): void {
|
|
|
667
569
|
const sessionDefaultPermission = (): TaskPermission =>
|
|
668
570
|
config?.sessionDefaultPermission ?? resolveHostDefaultPermission(ctx) ?? DEFAULT_SESSION_PERMISSION
|
|
669
571
|
|
|
670
|
-
/** Live acceptance settings the contract of each new execution freezes. */
|
|
671
|
-
const verificationSettings = (): VerificationSettings => ({
|
|
672
|
-
enabled: readConfigField(config?.goalVerification, DEFAULT_GOAL_VERIFICATION),
|
|
673
|
-
model: readConfigField(config?.goalVerificationModel, ''),
|
|
674
|
-
reasoningEffort: readConfigField(config?.goalVerificationReasoningEffort, ''),
|
|
675
|
-
})
|
|
676
|
-
/**
|
|
677
|
-
* The acceptance time ceilings, read live: raising one must unblock a card
|
|
678
|
-
* whose acceptance is stuck on a slow judge route without a remount, so
|
|
679
|
-
* these deliberately are NOT frozen into the per-execution contract.
|
|
680
|
-
*/
|
|
681
|
-
const verificationCallTimeoutMsLive = (): number =>
|
|
682
|
-
verificationCallTimeoutMs(readConfigField(config?.goalVerificationCallTimeoutSeconds, DEFAULT_VERIFICATION_CALL_TIMEOUT_SECONDS))
|
|
683
|
-
const verificationBudgetMsLive = (): number =>
|
|
684
|
-
verificationBudgetMs(readConfigField(config?.goalVerificationBudgetSeconds, DEFAULT_VERIFICATION_BUDGET_SECONDS))
|
|
685
572
|
// The catalog reader needs the service, and the service needs the reader;
|
|
686
573
|
// the reader only runs after start(), so a late holder is enough.
|
|
687
574
|
let hostForCatalog: TaskBoardHostService | undefined
|
|
688
|
-
|
|
575
|
+
/**
|
|
576
|
+
* Live reader of the host model catalog, normalized for the board. The
|
|
577
|
+
* service reads it once per run group and carries the value, so a settings
|
|
578
|
+
* edit only reaches executions that start afterwards.
|
|
579
|
+
*/
|
|
580
|
+
const modelCatalog = async (): Promise<ModelCatalogView | undefined> => {
|
|
689
581
|
const runner = hostForCatalog?.runner
|
|
690
582
|
return runner === undefined ? undefined : normalizeCatalog(await runner.modelCatalog())
|
|
691
583
|
}
|
|
692
|
-
/**
|
|
693
|
-
* Live reader of the GLOBAL native-/goal switch. The service calls it exactly
|
|
694
|
-
* once per execution and carries the value, so a settings edit only reaches
|
|
695
|
-
* executions that start afterwards.
|
|
696
|
-
*/
|
|
697
|
-
const goalRunEnabled = (): boolean => readConfigField(config?.goalRunEnabled, DEFAULT_GOAL_RUN)
|
|
698
584
|
/**
|
|
699
585
|
* Live reader of the new-card defaults, read at every use like the switch
|
|
700
586
|
* above: the create dialog prefills from the published snapshot, and each
|
|
@@ -714,19 +600,34 @@ function applyImpl(ctx: Context, config?: Config): void {
|
|
|
714
600
|
// the board calls as the host-local owner, so its peer is minted on this
|
|
715
601
|
// fiber and aborts with it (see createOwnerPeer).
|
|
716
602
|
const ownerPeer = createOwnerPeer(ctx)
|
|
603
|
+
// A deployment that registers the legacy Agent Teams fingerprint cannot
|
|
604
|
+
// orchestrate under the dispatcher preset: the preset's own compatibility
|
|
605
|
+
// gate stops and waits for a human reply, which a scheduled or unattended run
|
|
606
|
+
// never brings (issue #2031). Read at launch, so a runtime mounted after this
|
|
607
|
+
// row is still judged, and read tolerantly: no registry, no lookup half, or a
|
|
608
|
+
// throw all answer false, which keeps today's behaviour rather than refusing
|
|
609
|
+
// cards on a guess.
|
|
610
|
+
const legacyAgentTeams = (): boolean => {
|
|
611
|
+
const lookup = lookupOf(resolveToolRegistry(ctx))
|
|
612
|
+
if (lookup === undefined) return false
|
|
613
|
+
try {
|
|
614
|
+
return lookup.get(LEGACY_AGENT_TEAMS_TOOL) !== undefined
|
|
615
|
+
} catch {
|
|
616
|
+
return false
|
|
617
|
+
}
|
|
618
|
+
}
|
|
717
619
|
const host = new TaskBoardHostService(ctx.typertGateway, {
|
|
718
620
|
workspaceRegistry: ctx.workspaceRegistry,
|
|
719
621
|
ownerPeer,
|
|
720
622
|
sessionDefaultPermission,
|
|
721
623
|
maxSubtaskDepth: maxSubtaskDepth(),
|
|
722
|
-
goalRunEnabled,
|
|
723
624
|
runLaunchWidth,
|
|
724
625
|
spendBudgetTokens,
|
|
725
626
|
cardDefaults,
|
|
726
|
-
|
|
727
|
-
verificationCatalog,
|
|
627
|
+
modelCatalog,
|
|
728
628
|
attachments: () => resolveAttachmentStore(ctx),
|
|
729
629
|
modelInfo: () => resolveModelInfoReader(ctx),
|
|
630
|
+
legacyAgentTeams,
|
|
730
631
|
timers: resolveHostTimers(ctx),
|
|
731
632
|
commandDispatcher: {
|
|
732
633
|
async execute(sessionId, line, signal) {
|
|
@@ -760,7 +661,7 @@ function applyImpl(ctx: Context, config?: Config): void {
|
|
|
760
661
|
snapshot: () => host.snapshot(),
|
|
761
662
|
apply: (requestId: string, action: TaskBoardAction, initiator?: string) => host.apply(requestId, action, initiator),
|
|
762
663
|
subscribe: (listener: () => void) => host.subscribe(listener),
|
|
763
|
-
|
|
664
|
+
modelCatalogOptions: () => host.modelCatalogOptions(),
|
|
764
665
|
})
|
|
765
666
|
}
|
|
766
667
|
|
|
@@ -815,44 +716,6 @@ function applyImpl(ctx: Context, config?: Config): void {
|
|
|
815
716
|
ctx.effect(() => {
|
|
816
717
|
const disposers: Array<() => void> = []
|
|
817
718
|
try {
|
|
818
|
-
// The goal acceptance gate: the OFFICIAL tool pre-execution lifecycle,
|
|
819
|
-
// installed before the tool body runs, so a completion claim cannot take
|
|
820
|
-
// effect without a matching acceptance pass record.
|
|
821
|
-
const gate = createGoalVerificationGate({
|
|
822
|
-
ledger: host.ledger,
|
|
823
|
-
llm: () => resolveLlmRuntime(ctx),
|
|
824
|
-
goals: () => {
|
|
825
|
-
try {
|
|
826
|
-
return ctx.get('goals') as GoalFace | undefined
|
|
827
|
-
} catch {
|
|
828
|
-
return undefined
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
// The host's own observation of what a turn changed on disk, when this
|
|
832
|
-
// deployment records it; the acceptance degrades to the trajectory alone
|
|
833
|
-
// when it does not.
|
|
834
|
-
workspaceChanges: () => probeWorkspaceChanges(ctx),
|
|
835
|
-
callTimeoutMs: verificationCallTimeoutMsLive,
|
|
836
|
-
budgetMs: verificationBudgetMsLive,
|
|
837
|
-
logger: {
|
|
838
|
-
warn: (message: string, ...rest: unknown[]) => {
|
|
839
|
-
const logger = (ctx as { logger?: { warn?: (...args: unknown[]) => void } }).logger
|
|
840
|
-
if (typeof logger?.warn === 'function') logger.warn(message, ...rest)
|
|
841
|
-
else console.warn(message, ...rest)
|
|
842
|
-
},
|
|
843
|
-
},
|
|
844
|
-
})
|
|
845
|
-
// A capture-only context may implement no listener registry (it returns
|
|
846
|
-
// no disposer), so the handle is pushed only when it really is one.
|
|
847
|
-
const offGate = ctx.on('tools/pre-execute', async (exec, next) => {
|
|
848
|
-
const decision = await gate({ name: exec.name, arguments: exec.arguments, agent: exec.agent, signal: exec.signal })
|
|
849
|
-
return decision ?? next()
|
|
850
|
-
})
|
|
851
|
-
if (typeof offGate === 'function') disposers.push(offGate)
|
|
852
|
-
else if (typeof (offGate as { dispose?: unknown } | undefined)?.dispose === 'function') {
|
|
853
|
-
const handle = offGate as { dispose(): void }
|
|
854
|
-
disposers.push(() => { handle.dispose() })
|
|
855
|
-
}
|
|
856
719
|
const routes = makeTaskBoardRoutes(host, {
|
|
857
720
|
...resolveProxyAccess(config),
|
|
858
721
|
connection: () => resolveConnectionTrust(ctx),
|
package/src/protocol.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { isValidTimeZone } from './core/schedule.ts'
|
|
|
6
6
|
import { sanitizeFreezeSnapshot, type FreezeSnapshot } from './core/freeze-snapshot.ts'
|
|
7
7
|
import { sanitizeHandover, type TaskHandoverInput } from './core/handover.ts'
|
|
8
8
|
import { TASK_BOARD_MESSAGE_MAX_LENGTH, isTaskBoardExtensionPayload, normalizeTaskIntegrations, type TaskBoardExtensionPayload } from './core/extension.ts'
|
|
9
|
-
import {
|
|
9
|
+
import type { ModelCatalogView } from './core/model-catalog.ts'
|
|
10
10
|
import { isTaskAttachmentList, TASK_ATTACHMENT_LIMIT, TASK_ATTACHMENT_MAX_BYTES, TASK_ATTACHMENT_TOTAL_MAX_BYTES } from './core/attachment.ts'
|
|
11
11
|
|
|
12
12
|
/** Freeze payload carried by create/update actions after the gate (redacted in place). */
|
|
@@ -85,14 +85,6 @@ export interface TaskBoardSnapshot {
|
|
|
85
85
|
* disable the subtask controls; the Host ledger is the authority.
|
|
86
86
|
*/
|
|
87
87
|
maxSubtaskDepth?: number
|
|
88
|
-
/**
|
|
89
|
-
* Live GLOBAL native-/goal switch. The browser uses it to disable the
|
|
90
|
-
* task-level option (and explain that the global switch must be turned on
|
|
91
|
-
* first) WITHOUT rewriting anyone's stored per-task preference; the Host
|
|
92
|
-
* freezes its own read per execution, so this mirror never governs a run in
|
|
93
|
-
* flight.
|
|
94
|
-
*/
|
|
95
|
-
goalRunEnabled?: boolean
|
|
96
88
|
/**
|
|
97
89
|
* New-card defaults this deployment configures: what the create dialog opens
|
|
98
90
|
* with, and what the create path fills an omitted target from when the caller
|
|
@@ -129,16 +121,12 @@ export interface TaskBoardSnapshot {
|
|
|
129
121
|
}
|
|
130
122
|
|
|
131
123
|
/**
|
|
132
|
-
* Body of `GET {TASK_BOARD_API_PREFIX}/
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* credential material — model routes and level ids only.
|
|
124
|
+
* Body of `GET {TASK_BOARD_API_PREFIX}/model-catalog`: the host model catalog the
|
|
125
|
+
* board's model and reasoning-level choices come from. Served through the same
|
|
126
|
+
* loopback / authenticated-proxy guard as the rest of the board API, and it
|
|
127
|
+
* carries no credential material — model routes and level ids only.
|
|
137
128
|
*/
|
|
138
|
-
export interface
|
|
139
|
-
settings: VerificationSettings
|
|
140
|
-
/** The RESOLVED contract, so the card can show what the next execution freezes. */
|
|
141
|
-
contract: VerificationContract
|
|
129
|
+
export interface TaskBoardModelCatalog {
|
|
142
130
|
catalog: ModelCatalogView
|
|
143
131
|
}
|
|
144
132
|
|
|
@@ -192,8 +180,6 @@ export type TaskBoardAction =
|
|
|
192
180
|
| { kind: 'archive'; taskId: string }
|
|
193
181
|
| { kind: 'restore'; taskId: string }
|
|
194
182
|
| { kind: 'settle'; taskId: string }
|
|
195
|
-
/** Clear the acceptance anomalies recorded on a card's open execution (issue #1828). */
|
|
196
|
-
| { kind: 'reset-verification'; taskId: string }
|
|
197
183
|
/**
|
|
198
184
|
* Record an outcome an agent OUTSIDE the Host produced (issue #1826).
|
|
199
185
|
*
|
|
@@ -320,10 +306,6 @@ function validImportedKnownFields(value: Record<string, unknown>): boolean {
|
|
|
320
306
|
if (execution.external !== undefined && typeof execution.external !== 'boolean') return false
|
|
321
307
|
if (execution.frozenBy !== undefined && typeof execution.frozenBy !== 'string') return false
|
|
322
308
|
if (execution.frozenAt !== undefined && typeof execution.frozenAt !== 'number') return false
|
|
323
|
-
// A well-formed acceptance block may be imported for inspection, but the
|
|
324
|
-
// import path DROPS it (see importedTask): a fabricated pass record must
|
|
325
|
-
// never let an imported execution settle as verified.
|
|
326
|
-
if (execution.verification !== undefined && normalizeVerification(execution.verification) === undefined) return false
|
|
327
309
|
}
|
|
328
310
|
}
|
|
329
311
|
return true
|
|
@@ -353,8 +335,6 @@ function importedTask(value: unknown): TaskRecord | undefined {
|
|
|
353
335
|
...(execution.external === true ? { external: true } : {}),
|
|
354
336
|
...(execution.frozenAt === undefined ? {} : { frozenAt: execution.frozenAt }),
|
|
355
337
|
...(execution.frozenBy === undefined ? {} : { frozenBy: execution.frozenBy }),
|
|
356
|
-
// 安全门(对抗场景 d):验收报告是 Host 的判定,不接受 import 携带——
|
|
357
|
-
// 一条伪造的通过记录会让导入的执行被当成已验收。
|
|
358
338
|
})),
|
|
359
339
|
// The rule was already reconstructed field by field by parseLedger (which
|
|
360
340
|
// is what drops an unknown or malformed field), so the import keeps that
|
|
@@ -376,12 +356,6 @@ function importedTask(value: unknown): TaskRecord | undefined {
|
|
|
376
356
|
// is the user's own card preference, not a verdict.
|
|
377
357
|
...(task.reasoningEffort === undefined ? {} : { reasoningEffort: task.reasoningEffort }),
|
|
378
358
|
...(task.reuseSession === undefined ? {} : { reuseSession: task.reuseSession }),
|
|
379
|
-
...(task.goalRun === undefined ? {} : { goalRun: task.goalRun }),
|
|
380
|
-
// The per-card acceptance opt-out rides the import like the /goal opt-in:
|
|
381
|
-
// it is a user-chosen execution preference on their own board, not a
|
|
382
|
-
// verdict. The per-execution `verification` block is still stripped below, so
|
|
383
|
-
// no imported card can arrive already accepted.
|
|
384
|
-
...(task.skipVerification === undefined ? {} : { skipVerification: task.skipVerification }),
|
|
385
359
|
...(task.archivedAt === undefined ? {} : { archivedAt: task.archivedAt }),
|
|
386
360
|
...(task.freeze === undefined ? {} : { freeze: task.freeze }),
|
|
387
361
|
...(task.handover === undefined ? {} : { handover: task.handover }),
|
|
@@ -420,7 +394,7 @@ function handoverPayload(value: unknown): TaskHandoverInput | undefined {
|
|
|
420
394
|
|
|
421
395
|
function createInput(value: unknown): value is NewTaskInput {
|
|
422
396
|
const input = record(value)
|
|
423
|
-
if (input === undefined || !exactKeys(input, ['title', 'description', 'prompt', 'parentId', 'workspaceId', 'mode', 'permission', 'schedule', 'freeze', 'handover', 'model', 'reasoningEffort', 'applyCardDefaults', 'reuseSession', '
|
|
397
|
+
if (input === undefined || !exactKeys(input, ['title', 'description', 'prompt', 'parentId', 'workspaceId', 'mode', 'permission', 'schedule', 'freeze', 'handover', 'model', 'reasoningEffort', 'applyCardDefaults', 'reuseSession', 'tags', 'integrations', 'attachments'])) return false
|
|
424
398
|
if (input.parentId !== undefined && (typeof input.parentId !== 'string' || input.parentId.trim() === '')) return false
|
|
425
399
|
if (typeof input.title !== 'string' || typeof input.description !== 'string' || typeof input.prompt !== 'string') return false
|
|
426
400
|
// The reasoning effort is an adapter-owned id the Host resolves against the
|
|
@@ -430,8 +404,6 @@ function createInput(value: unknown): value is NewTaskInput {
|
|
|
430
404
|
if (!optionalString(input.workspaceId) || !optionalString(input.mode) || !optionalString(input.model) || !optionalString(input.reasoningEffort)) return false
|
|
431
405
|
if (input.applyCardDefaults !== undefined && typeof input.applyCardDefaults !== 'boolean') return false
|
|
432
406
|
if (input.reuseSession !== undefined && typeof input.reuseSession !== 'boolean') return false
|
|
433
|
-
if (input.goalRun !== undefined && typeof input.goalRun !== 'boolean') return false
|
|
434
|
-
if (input.skipVerification !== undefined && typeof input.skipVerification !== 'boolean') return false
|
|
435
407
|
if (input.permission !== undefined && !isTaskPermission(input.permission)) return false
|
|
436
408
|
if (input.tags !== undefined && !isTaskTagList(input.tags)) return false
|
|
437
409
|
if (input.integrations !== undefined && normalizeTaskIntegrations(input.integrations) === undefined) return false
|
|
@@ -458,15 +430,9 @@ function createInput(value: unknown): value is NewTaskInput {
|
|
|
458
430
|
|
|
459
431
|
function updatePatch(value: unknown): boolean {
|
|
460
432
|
const patch = record(value)
|
|
461
|
-
if (patch === undefined || !exactKeys(patch, ['title', 'description', 'prompt', 'workspaceId', 'mode', 'permission', 'freeze', 'handover', 'model', 'reasoningEffort', 'reuseSession', '
|
|
433
|
+
if (patch === undefined || !exactKeys(patch, ['title', 'description', 'prompt', 'workspaceId', 'mode', 'permission', 'freeze', 'handover', 'model', 'reasoningEffort', 'reuseSession', 'tags', 'attachments'])) return false
|
|
462
434
|
// null (or false) clears the reuse opt-in; only a real boolean is accepted.
|
|
463
435
|
if (patch.reuseSession !== undefined && patch.reuseSession !== null && typeof patch.reuseSession !== 'boolean') return false
|
|
464
|
-
// The goal opt-in is tri-state: null/true return the card to its default
|
|
465
|
-
// (goal run), false pins a single plain turn.
|
|
466
|
-
if (patch.goalRun !== undefined && patch.goalRun !== null && typeof patch.goalRun !== 'boolean') return false
|
|
467
|
-
// The acceptance opt-out is the mirror tri-state: null/false return the card
|
|
468
|
-
// to inheriting the board-wide switch, true pins it out of the gate.
|
|
469
|
-
if (patch.skipVerification !== undefined && patch.skipVerification !== null && typeof patch.skipVerification !== 'boolean') return false
|
|
470
436
|
for (const key of ['title', 'description', 'prompt', 'workspaceId', 'mode', 'model', 'reasoningEffort'] as const) {
|
|
471
437
|
if (!optionalString(patch[key])) return false
|
|
472
438
|
}
|
|
@@ -645,7 +611,6 @@ function parseEnvelopeAction(value: unknown): TaskBoardActionEnvelope | undefine
|
|
|
645
611
|
case 'archive':
|
|
646
612
|
case 'restore':
|
|
647
613
|
case 'settle':
|
|
648
|
-
case 'reset-verification':
|
|
649
614
|
case 'run':
|
|
650
615
|
case 'rerun':
|
|
651
616
|
if (!exactKeys(action, ['kind', 'taskId'])) return undefined
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type ExecutionVerification } from '../../core/verification.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Render one execution's acceptance report.
|
|
4
|
-
* @param props - the execution's persisted acceptance block.
|
|
5
|
-
* @returns the verdict badge with its fold-out detail, or nothing when
|
|
6
|
-
* acceptance never applied.
|
|
7
|
-
*/
|
|
8
|
-
export declare function VerificationReport({ verification }: {
|
|
9
|
-
verification: ExecutionVerification;
|
|
10
|
-
}): import("react").JSX.Element | null;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/** Judge calls one acceptance issues: every criterion, every round. */
|
|
2
|
-
export declare const ACCEPTANCE_JUDGE_CALLS: number;
|
|
3
|
-
/**
|
|
4
|
-
* Per-judge-call ceiling used when the row names none: two and a half minutes
|
|
5
|
-
* for a reasoning model reading an 80,000 character trace with a 16,384 token
|
|
6
|
-
* output cap. The former 120s constant was tight enough that a slow but healthy
|
|
7
|
-
* route produced a wall of per-call timeouts, and every one of them was charged
|
|
8
|
-
* as an acceptance anomaly against a budget that then failed the card.
|
|
9
|
-
*/
|
|
10
|
-
export declare const DEFAULT_VERIFICATION_CALL_TIMEOUT_SECONDS = 150;
|
|
11
|
-
/** Shortest accepted per-call ceiling: below this no useful judge answers. */
|
|
12
|
-
export declare const VERIFICATION_CALL_TIMEOUT_MIN_SECONDS = 30;
|
|
13
|
-
/** Longest accepted per-call ceiling, ten minutes. */
|
|
14
|
-
export declare const VERIFICATION_CALL_TIMEOUT_MAX_SECONDS = 600;
|
|
15
|
-
/**
|
|
16
|
-
* Total ceiling of one acceptance attempt, covering evidence rendering and
|
|
17
|
-
* every judge call including retries. Derived from the per-call default rather
|
|
18
|
-
* than pinned, because a total budget smaller than
|
|
19
|
-
* {@link ACCEPTANCE_JUDGE_CALLS} times the per-call ceiling guarantees that no
|
|
20
|
-
* acceptance can ever finish.
|
|
21
|
-
*/
|
|
22
|
-
export declare const DEFAULT_VERIFICATION_BUDGET_SECONDS: number;
|
|
23
|
-
/** Shortest accepted total budget: long enough for at least one judge call. */
|
|
24
|
-
export declare const VERIFICATION_BUDGET_MIN_SECONDS = 120;
|
|
25
|
-
/** Longest accepted total budget, thirty minutes. */
|
|
26
|
-
export declare const VERIFICATION_BUDGET_MAX_SECONDS = 1800;
|
|
27
|
-
/** The default total budget in milliseconds, the face the abort timer takes. */
|
|
28
|
-
export declare const DEFAULT_VERIFICATION_BUDGET_MS: number;
|
|
29
|
-
/**
|
|
30
|
-
* The effective per-judge-call ceiling.
|
|
31
|
-
* @param seconds - configured seconds, or undefined for the default.
|
|
32
|
-
* @returns the effective ceiling in seconds.
|
|
33
|
-
*/
|
|
34
|
-
export declare function normalizeVerificationCallTimeoutSeconds(seconds: number | undefined): number;
|
|
35
|
-
/**
|
|
36
|
-
* The effective per-judge-call ceiling the timer face takes.
|
|
37
|
-
* @param seconds - configured seconds, or undefined for the default.
|
|
38
|
-
* @returns the effective ceiling in milliseconds.
|
|
39
|
-
*/
|
|
40
|
-
export declare function verificationCallTimeoutMs(seconds: number | undefined): number;
|
|
41
|
-
/**
|
|
42
|
-
* The effective total budget of one acceptance attempt.
|
|
43
|
-
* @param seconds - configured seconds, or undefined for the default.
|
|
44
|
-
* @returns the effective budget in seconds.
|
|
45
|
-
*/
|
|
46
|
-
export declare function normalizeVerificationBudgetSeconds(seconds: number | undefined): number;
|
|
47
|
-
/**
|
|
48
|
-
* The effective total budget the abort face takes.
|
|
49
|
-
* @param seconds - configured seconds, or undefined for the default.
|
|
50
|
-
* @returns the effective budget in milliseconds.
|
|
51
|
-
*/
|
|
52
|
-
export declare function verificationBudgetMs(seconds: number | undefined): number;
|