@linxin666/dsh-client-ui-task-board 0.4.8 → 0.4.10

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.
Files changed (64) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +28 -22
  3. package/README.zh.md +28 -22
  4. package/lib/client.js +1435 -682
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.js +356 -366
  7. package/lib/types/client/PluginSettingsCard.d.ts +21 -0
  8. package/lib/types/client/TaskBoardSettingsCard.d.ts +7 -0
  9. package/lib/types/client/board/ExecutionLog.d.ts +16 -0
  10. package/lib/types/client/board/TaskForm.d.ts +4 -0
  11. package/lib/types/client/board/VerificationReport.d.ts +2 -15
  12. package/lib/types/client/body-mutations.d.ts +45 -0
  13. package/lib/types/client/locales.d.ts +42 -6
  14. package/lib/types/client/suppress-schedule-row.d.ts +86 -0
  15. package/lib/types/core/controller.d.ts +1 -1
  16. package/lib/types/core/subtask.d.ts +59 -49
  17. package/lib/types/core/tasks.d.ts +5 -8
  18. package/lib/types/core/use-cases/task-update.d.ts +1 -1
  19. package/lib/types/core/workspace-target.d.ts +23 -3
  20. package/lib/types/host/launch-admission.d.ts +8 -9
  21. package/lib/types/host-ledger.d.ts +72 -48
  22. package/lib/types/host-routes.d.ts +49 -0
  23. package/lib/types/host-runner.d.ts +20 -10
  24. package/lib/types/host-service.d.ts +7 -50
  25. package/lib/types/index.d.ts +61 -63
  26. package/lib/types/loopback.d.ts +21 -0
  27. package/lib/types/protocol.d.ts +0 -5
  28. package/lib/types/tool-surface.d.ts +1 -0
  29. package/package.json +25 -25
  30. package/src/client/CardDefaultPresetField.tsx +1 -1
  31. package/src/client/PluginSettingsCard.tsx +78 -18
  32. package/src/client/TaskBoardSettingsCard.tsx +68 -25
  33. package/src/client/board/ExecutionLog.tsx +140 -0
  34. package/src/client/board/LinkSubtaskModal.tsx +1 -9
  35. package/src/client/board/NewTaskModal.tsx +2 -11
  36. package/src/client/board/TaskCard.tsx +45 -23
  37. package/src/client/board/TaskDetail.tsx +407 -261
  38. package/src/client/board/TaskForm.tsx +19 -4
  39. package/src/client/board/VerificationReport.tsx +143 -104
  40. package/src/client/board/task-markdown.module.css +11 -8
  41. package/src/client/board-settings.module.css +35 -7
  42. package/src/client/board.module.css +855 -115
  43. package/src/client/body-mutations.ts +133 -0
  44. package/src/client/index.ts +10 -0
  45. package/src/client/locales.ts +97 -24
  46. package/src/client/settings-card.module.css +71 -10
  47. package/src/client/suppress-schedule-row.ts +198 -0
  48. package/src/core/controller.ts +1 -3
  49. package/src/core/subtask.ts +81 -76
  50. package/src/core/tasks.ts +5 -9
  51. package/src/core/use-cases/task-update.ts +1 -3
  52. package/src/core/workspace-target.ts +27 -3
  53. package/src/host/agent-tools.ts +14 -15
  54. package/src/host/launch-admission.ts +8 -9
  55. package/src/host-ledger.ts +158 -125
  56. package/src/host-routes.ts +65 -2
  57. package/src/host-runner.ts +53 -28
  58. package/src/host-service.ts +42 -127
  59. package/src/index.ts +84 -106
  60. package/src/loopback.ts +32 -0
  61. package/src/protocol.ts +2 -9
  62. package/src/tool-surface.ts +1 -0
  63. package/lib/types/client/board/team-run-promotion.d.ts +0 -26
  64. package/src/client/board/team-run-promotion.ts +0 -39
package/src/index.ts CHANGED
@@ -17,7 +17,7 @@ import type {} from '@deepseek-ai/dsh-host-webserver'
17
17
  import type {} from '@deepseek-ai/dsh-tools'
18
18
  import type { ToolDefinition } from '@deepseek-ai/dsh-tools'
19
19
  import type { LlmRuntime } from '@deepseek-ai/dsh-llm'
20
- import { TaskBoardHostService, type HostTimerFace, type TaskBoardTeamDispatcher } from './host-service.ts'
20
+ 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'
@@ -39,7 +39,7 @@ import { DEFAULT_SESSION_PERMISSION } from './core/handover.ts'
39
39
  import type { CardDefaults } from './core/card-defaults.ts'
40
40
  import { buildTaskBoardTools, TASK_BOARD_TOOL_NAMES } from './host/agent-tools.ts'
41
41
  import { PLUGIN_TOOL_SECTION_ORDERS, visibleToolText } from './tool-surface.ts'
42
- import { makeTaskBoardRoutes } from './host-routes.ts'
42
+ import { makeTaskBoardRoutes, type TaskBoardConnectionTrust } from './host-routes.ts'
43
43
  import { TASK_BOARD_SERVICE_NAME, type TaskBoardExtension } from './core/extension.ts'
44
44
  import type { TaskBoardAction } from './protocol.ts'
45
45
  import { mountOnce } from './mount-once.ts'
@@ -88,6 +88,19 @@ export interface Config {
88
88
  trustedProxyHosts?: string[]
89
89
  /** Environment variable whose value the authenticated proxy injects upstream. */
90
90
  proxyTokenEnv?: string
91
+ /**
92
+ * Whether the operator's OWN reverse proxy or tunnel may speak for the
93
+ * browser (default OFF). Off keeps the pre-existing fence exactly: a request
94
+ * that carries a forwarding header is never local, so only a direct loopback
95
+ * client or an allowlisted token-injecting proxy reaches the board (issue
96
+ * #1906). On admits one narrower case — a forwarded request whose socket and
97
+ * Host are both this machine's loopback upstream, i.e. the proxy dials the
98
+ * board itself (issue #1918) — and still requires the browser same-origin
99
+ * marker, so a third party's tunnel is only trusted while the operator says
100
+ * it is. Volatile: the fence reads it at each request, so an edit binds the
101
+ * next request without re-registering the routes.
102
+ */
103
+ trustForwardedProxy?: Volatile<boolean>
91
104
  /**
92
105
  * An explicit baseline for the permission confirmation gate. Left unset, the
93
106
  * board follows the Host's own default permission preset — the value new DSH
@@ -100,8 +113,8 @@ export interface Config {
100
113
  /**
101
114
  * Subtask depth limit, 1..3 (default 1). At 1 a task may carry one level of
102
115
  * subtasks and a subtask cannot be given subtasks of its own; raising it
103
- * allows deeper trees. Every extra level multiplies the sessions one run
104
- * of the root task opens, so the ceiling is deliberately small.
116
+ * allows deeper trees. Every extra level is another tree the card's own
117
+ * session may have to dispatch, so the ceiling is deliberately small.
105
118
  */
106
119
  maxSubtaskDepth?: Volatile<number>
107
120
  /**
@@ -113,13 +126,13 @@ export interface Config {
113
126
  sessionPollSeconds?: Volatile<number>
114
127
  /**
115
128
  * How many run launches this board may have in flight at once (1..16,
116
- * default 3). One run opens its whole subtree, so without a bound the Host
117
- * asks DSH for every member's session in the same tick; this is the mechanism
118
- * that enforces the repository's measured guidance for heavy implementation
119
- * subagents. Members wait their turn instead of being dropped: the subtree
120
- * still opens completely, they only enter the running column in batches. Read
121
- * at each admission, so an edit bounds the next launch of a run that is still
122
- * queueing.
129
+ * default 3). A run opens one session, so a burst is several cards run at
130
+ * once (several tabs, or a due schedule firing while a manual run starts);
131
+ * without a bound the Host would ask DSH for all of them in the same tick.
132
+ * This is the mechanism that enforces the repository's measured guidance for
133
+ * heavy implementation subagents. Runs wait their turn instead of being
134
+ * dropped, and every one of them still starts. Read at each admission, so an
135
+ * edit bounds the next launch of a run that is still queueing.
123
136
  */
124
137
  runLaunchWidth?: Volatile<number>
125
138
  /**
@@ -131,12 +144,6 @@ export interface Config {
131
144
  * is skipped onto the scheduler with its run budget untouched.
132
145
  */
133
146
  spendBudgetTokens?: Volatile<number>
134
- /**
135
- * Continuable-subagent provider the Agent Teams service uses to compose a
136
- * teammate. Matches the Agent Teams tool plugin's `freshProvider` default;
137
- * only team-mode runs use it.
138
- */
139
- teamProvider?: string
140
147
  /**
141
148
  * GLOBAL native /goal switch (default OFF), the master control over whether
142
149
  * this board starts a run with dsh's built-in /goal at all. A run uses native
@@ -224,12 +231,6 @@ export interface Config {
224
231
  goalVerificationBudgetSeconds?: Volatile<number>
225
232
  }
226
233
 
227
- /**
228
- * Continuable-subagent provider for fresh teammates, matching the Agent Teams
229
- * tool plugin's own `freshProvider` default.
230
- */
231
- export const DEFAULT_TEAM_PROVIDER = 'spawn'
232
-
233
234
  /**
234
235
  * Profile-patch shape of {@link Config}: what the Host validates the row's
235
236
  * config against, before the schema turns volatile fields into live references
@@ -251,6 +252,8 @@ export interface ConfigInput {
251
252
  trustedProxyHosts?: string[]
252
253
  /** Environment variable whose value the authenticated proxy injects. */
253
254
  proxyTokenEnv?: string
255
+ /** Trust a forwarded request that landed on this machine's loopback upstream; default off. */
256
+ trustForwardedProxy?: boolean
254
257
  /** Explicit baseline for the permission confirmation gate; unset follows the Host default. */
255
258
  sessionDefaultPermission?: TaskPermission
256
259
  /** Subtask depth limit, 1..3. */
@@ -261,8 +264,6 @@ export interface ConfigInput {
261
264
  runLaunchWidth?: number
262
265
  /** Daily token ceiling for board runs; 0 disables the gate. */
263
266
  spendBudgetTokens?: number
264
- /** Continuable-subagent provider the Agent Teams service composes a teammate from. */
265
- teamProvider?: string
266
267
  /** Global native /goal switch; default off, frozen per execution. */
267
268
  goalRunEnabled?: boolean
268
269
  /** Agent preset a new card starts from; blank = not set. */
@@ -291,12 +292,12 @@ export const Config: z<ConfigInput, Config> = z.object({
291
292
  preventIdleSleep: z.boolean().default(false).volatile(),
292
293
  trustedProxyHosts: z.array(z.string()).default([]),
293
294
  proxyTokenEnv: z.string().min(1).default(DEFAULT_PROXY_TOKEN_ENV),
295
+ trustForwardedProxy: z.boolean().default(false).volatile(),
294
296
  sessionDefaultPermission: z.union(TASK_PERMISSIONS),
295
297
  maxSubtaskDepth: z.number().min(SUBTASK_DEPTH_MIN).max(SUBTASK_DEPTH_MAX).default(DEFAULT_SUBTASK_DEPTH).volatile(),
296
298
  sessionPollSeconds: z.number().min(SESSION_POLL_MIN_SECONDS).max(SESSION_POLL_MAX_SECONDS).default(DEFAULT_SESSION_POLL_SECONDS).volatile(),
297
299
  runLaunchWidth: z.number().min(RUN_LAUNCH_WIDTH_MIN).max(RUN_LAUNCH_WIDTH_MAX).default(DEFAULT_RUN_LAUNCH_WIDTH).volatile(),
298
300
  spendBudgetTokens: z.number().min(DEFAULT_SPEND_BUDGET_TOKENS).default(DEFAULT_SPEND_BUDGET_TOKENS).volatile(),
299
- teamProvider: z.string().min(1).default(DEFAULT_TEAM_PROVIDER),
300
301
  goalRunEnabled: z.boolean().default(false).volatile(),
301
302
  cardDefaultMode: z.string().default('').volatile(),
302
303
  cardDefaultPermission: z.union([...TASK_PERMISSIONS, '']).default('').volatile(),
@@ -352,17 +353,66 @@ export function readConfigField<T>(field: Volatile<T> | T | undefined, fallback:
352
353
  return field as T
353
354
  }
354
355
 
355
- /** Resolve proxy access without ever placing the token value in plugin config. */
356
- export function resolveProxyAccess(config: Config | undefined, env: NodeJS.ProcessEnv = process.env): { trustedProxyHosts: string[]; proxyToken?: string } {
356
+ /**
357
+ * Resolve proxy access without ever placing the token value in plugin config.
358
+ *
359
+ * The forwarded-proxy switch travels as a reader rather than a value: it is
360
+ * schema-volatile, so the fence must read it when a request arrives instead of
361
+ * when the routes are registered.
362
+ * @param config - the resolved plugin config.
363
+ * @param env - environment holding the proxy token value.
364
+ * @returns the route access handed to {@link makeTaskBoardRoutes}.
365
+ */
366
+ export function resolveProxyAccess(config: Config | undefined, env: NodeJS.ProcessEnv = process.env): {
367
+ trustedProxyHosts: string[]
368
+ proxyToken?: string
369
+ trustForwardedProxy: () => boolean
370
+ } {
371
+ const trustForwardedProxy = (): boolean => readConfigField(config?.trustForwardedProxy, DEFAULT_TRUST_FORWARDED_PROXY)
357
372
  const trustedProxyHosts = config?.trustedProxyHosts ?? []
358
- if (trustedProxyHosts.length === 0) return { trustedProxyHosts }
373
+ if (trustedProxyHosts.length === 0) return { trustedProxyHosts, trustForwardedProxy }
359
374
  const proxyTokenEnv = config?.proxyTokenEnv ?? DEFAULT_PROXY_TOKEN_ENV
360
375
  if (proxyTokenEnv.trim() === '') throw new Error('task-board: proxyTokenEnv must not be empty')
361
376
  const proxyToken = env[proxyTokenEnv]
362
377
  if (proxyToken === undefined || proxyToken === '') {
363
378
  throw new Error(`task-board: trustedProxyHosts requires a non-empty ${proxyTokenEnv} environment variable`)
364
379
  }
365
- return { trustedProxyHosts, proxyToken }
380
+ return { trustedProxyHosts, proxyToken, trustForwardedProxy }
381
+ }
382
+
383
+ /**
384
+ /**
385
+ * Schema default for the forwarded-proxy switch, re-read for hand-built
386
+ * contexts. Deliberately false: a deployment that never configured it keeps
387
+ * refusing every forwarded request, which is the #1906 fence.
388
+ */
389
+ export const DEFAULT_TRUST_FORWARDED_PROXY = false
390
+
391
+ /**
392
+ * Resolve the composition's optional `connection` service.
393
+ *
394
+ * The service is the Host's own browser-session authority: it fronts every
395
+ * `/api` request with the Host/Origin fence and the signed `dsh-auth-*` cookie,
396
+ * which is what a deployment behind a reverse proxy or ingress validates on the
397
+ * same authority the GUI is served from. The board bridges it instead of
398
+ * repeating that check, so a proxy request the Host already authenticated is
399
+ * admitted without a board-specific host allowlist (issue #1930). It is
400
+ * deliberately resolved like the agent-tool registry rather than injected:
401
+ * a composition that serves no connection keeps mounting the board on the
402
+ * pre-existing loopback fence, and one that mounts the service later is picked
403
+ * up on the next request because the fence asks this resolver each time.
404
+ * @param ctx - the plugin context.
405
+ * @returns the trust face, or undefined when this deployment serves none.
406
+ */
407
+ export function resolveConnectionTrust(ctx: Context): TaskBoardConnectionTrust | undefined {
408
+ try {
409
+ const connection = ctx.get('connection') as Partial<TaskBoardConnectionTrust> | undefined
410
+ return connection !== undefined && typeof connection.requestRejection === 'function'
411
+ ? connection as TaskBoardConnectionTrust
412
+ : undefined
413
+ } catch {
414
+ return undefined
415
+ }
366
416
  }
367
417
 
368
418
  /** The registry face the agent tools register into. */
@@ -445,80 +495,6 @@ export function resolveHostDefaultPermission(ctx: Context): TaskPermission | und
445
495
  }
446
496
  }
447
497
 
448
- /**
449
- * How long one teammate may take to reach its durable active or failed edge.
450
- * Agent Teams provisioning normally resolves in seconds; the bound exists so a
451
- * hung spawn settles the subtask instead of holding the cascade open forever.
452
- */
453
- const TEAMMATE_PROVISION_TIMEOUT_MS = 600_000
454
-
455
- /** The subset of the Agent Teams service this plugin drives. */
456
- interface AgentTeamsFace {
457
- spawnTeammate(caller: unknown, request: {
458
- name: string
459
- description: string
460
- prompt: Array<{ type: 'text'; text: string }>
461
- context: 'fresh' | 'fork'
462
- provider: string
463
- signal: AbortSignal
464
- }): Promise<{ member?: { id?: string; phase?: string; error?: string } }>
465
- }
466
-
467
- /**
468
- * Resolve the optional Agent Teams service. Like the tool registry and the llm
469
- * runtime, it is deliberately not injected: a deployment without Agent Teams
470
- * must still mount the whole board and only lose team-mode runs.
471
- * @param ctx - the plugin context.
472
- * @returns the service, or undefined when this deployment serves none.
473
- */
474
- export function resolveAgentTeams(ctx: Context): AgentTeamsFace | undefined {
475
- try {
476
- const teams = ctx.get('agentTeams') as AgentTeamsFace | undefined
477
- return teams !== undefined && typeof teams.spawnTeammate === 'function' ? teams : undefined
478
- } catch {
479
- return undefined
480
- }
481
- }
482
-
483
- /**
484
- * Build the team dispatcher: the run's Lead session spawns one teammate per
485
- * subtask through the Agent Teams service, and the teammate's session id is
486
- * attached to that subtask's execution so the ordinary session monitor settles
487
- * it. Returns undefined when the deployment serves no Agent Teams service or
488
- * no live-agent registry, which makes a team run fail closed.
489
- * @param ctx - the plugin context.
490
- * @param provider - the continuable-subagent provider for fresh teammates.
491
- * @returns the dispatcher, or undefined when team runs cannot be served.
492
- */
493
- export function buildTeamDispatcher(ctx: Context, provider: string): TaskBoardTeamDispatcher | undefined {
494
- const teams = resolveAgentTeams(ctx)
495
- if (teams === undefined) return undefined
496
- if (typeof (ctx.agents as { get?: unknown } | undefined)?.get !== 'function') return undefined
497
- return {
498
- async spawn(input) {
499
- const lead = ctx.agents.get(input.leadSessionId as Parameters<typeof ctx.agents.get>[0])
500
- if (lead === undefined) return { error: `lead session ${input.leadSessionId} is not live` }
501
- try {
502
- const result = await teams.spawnTeammate(lead, {
503
- name: input.name,
504
- description: input.description,
505
- prompt: [{ type: 'text', text: input.prompt }],
506
- context: 'fresh',
507
- provider,
508
- signal: AbortSignal.timeout(TEAMMATE_PROVISION_TIMEOUT_MS),
509
- })
510
- const member = result?.member
511
- if (member === undefined) return { error: 'Agent Teams returned no teammate' }
512
- if (member.phase === 'failed') return { error: member.error ?? 'teammate provisioning failed' }
513
- if (typeof member.id !== 'string' || member.id === '') return { error: 'Agent Teams returned no teammate session' }
514
- return { sessionId: member.id }
515
- } catch (error) {
516
- return { error: `teammate provisioning failed: ${error instanceof Error ? error.message : String(error)}` }
517
- }
518
- },
519
- }
520
- }
521
-
522
498
  /**
523
499
  * Read the optional `llm` service. The board deliberately does not inject it:
524
500
  * a deployment without a model must still mount the board, and the parse route
@@ -706,7 +682,6 @@ function applyImpl(ctx: Context, config?: Config): void {
706
682
  verificationSettings,
707
683
  verificationCatalog,
708
684
  timers: resolveHostTimers(ctx),
709
- team: buildTeamDispatcher(ctx, config?.teamProvider ?? DEFAULT_TEAM_PROVIDER),
710
685
  commandDispatcher: {
711
686
  async execute(sessionId, line, signal) {
712
687
  const agent = await resolveExecutionAgent(ctx, sessionId)
@@ -832,7 +807,10 @@ function applyImpl(ctx: Context, config?: Config): void {
832
807
  const handle = offGate as { dispose(): void }
833
808
  disposers.push(() => { handle.dispose() })
834
809
  }
835
- const routes = makeTaskBoardRoutes(host, resolveProxyAccess(config), {
810
+ const routes = makeTaskBoardRoutes(host, {
811
+ ...resolveProxyAccess(config),
812
+ connection: () => resolveConnectionTrust(ctx),
813
+ }, {
836
814
  parseTask: async (request, signal) => {
837
815
  const llm = resolveLlmRuntime(ctx)
838
816
  if (llm === undefined) throw new TaskParseError('no-model', 'this deployment serves no llm service')
package/src/loopback.ts CHANGED
@@ -16,6 +16,11 @@
16
16
  * request. Forwarding headers are the signal that a hop stands in between: a
17
17
  * request that carries CF-Connecting-IP or X-Forwarded-For is answered through
18
18
  * a proxy and is never treated as a local one (issue #1906).
19
+ *
20
+ * An operator who runs that proxy or tunnel themselves can opt into the
21
+ * narrower case: isForwardedLoopbackRequest describes a forwarded request that
22
+ * still landed on this machine's loopback upstream, and a route family admits
23
+ * it only behind its own default-off switch (issue #1918).
19
24
  * @module dsh-web-shared/host/loopback
20
25
  */
21
26
 
@@ -85,3 +90,30 @@ export function isLoopbackRequest(request: IncomingMessage): boolean {
85
90
  return false
86
91
  }
87
92
  }
93
+
94
+ /**
95
+ * Whether a forwarded request landed on this machine's loopback upstream: a
96
+ * forwarding header (the proxy's own stamp), a loopback socket address (the
97
+ * proxy dials 127.0.0.1:<port>), and a loopback Host header (the proxy rewrote
98
+ * the authority to its upstream literal).
99
+ *
100
+ * This is a fact about the route, not a trust decision. A public request to a
101
+ * tunnel satisfies all three by construction, because the proxy is the client
102
+ * of this process: only a caller that operates the proxy can decide it stands
103
+ * for the browser, which is why every consumer keeps this behind an explicit
104
+ * default-off switch and its own browser markers. isLoopbackRequest is
105
+ * unchanged and still refuses a forwarded request (issue #1906).
106
+ * @param request - node HTTP request.
107
+ * @returns true when a forwarding header, a loopback socket, and a loopback Host all hold.
108
+ */
109
+ export function isForwardedLoopbackRequest(request: IncomingMessage): boolean {
110
+ if (!isProxiedRequest(request)) return false
111
+ if (!isLoopbackAddress(request.socket.remoteAddress)) return false
112
+ const host = request.headers.host
113
+ if (typeof host !== 'string') return false
114
+ try {
115
+ return isLoopbackHostname(new URL('http://' + host).hostname)
116
+ } catch {
117
+ return false
118
+ }
119
+ }
package/src/protocol.ts CHANGED
@@ -80,11 +80,6 @@ export interface TaskBoardSnapshot {
80
80
  * disable the subtask controls; the Host ledger is the authority.
81
81
  */
82
82
  maxSubtaskDepth?: number
83
- /**
84
- * Whether this deployment serves the Agent Teams service, so a task may opt
85
- * into team execution (Team Lead session plus one teammate per subtask).
86
- */
87
- teamRunAvailable?: boolean
88
83
  /**
89
84
  * Live GLOBAL native-/goal switch. The browser uses it to disable the
90
85
  * task-level option (and explain that the global switch must be turned on
@@ -391,7 +386,7 @@ function handoverPayload(value: unknown): TaskHandoverInput | undefined {
391
386
 
392
387
  function createInput(value: unknown): value is NewTaskInput {
393
388
  const input = record(value)
394
- if (input === undefined || !exactKeys(input, ['title', 'description', 'prompt', 'parentId', 'workspaceId', 'mode', 'permission', 'schedule', 'freeze', 'handover', 'model', 'reasoningEffort', 'applyCardDefaults', 'reuseSession', 'teamRun', 'goalRun', 'skipVerification', 'tags', 'integrations'])) return false
389
+ if (input === undefined || !exactKeys(input, ['title', 'description', 'prompt', 'parentId', 'workspaceId', 'mode', 'permission', 'schedule', 'freeze', 'handover', 'model', 'reasoningEffort', 'applyCardDefaults', 'reuseSession', 'goalRun', 'skipVerification', 'tags', 'integrations'])) return false
395
390
  if (input.parentId !== undefined && (typeof input.parentId !== 'string' || input.parentId.trim() === '')) return false
396
391
  if (typeof input.title !== 'string' || typeof input.description !== 'string' || typeof input.prompt !== 'string') return false
397
392
  // The reasoning effort is an adapter-owned id the Host resolves against the
@@ -401,7 +396,6 @@ function createInput(value: unknown): value is NewTaskInput {
401
396
  if (!optionalString(input.workspaceId) || !optionalString(input.mode) || !optionalString(input.model) || !optionalString(input.reasoningEffort)) return false
402
397
  if (input.applyCardDefaults !== undefined && typeof input.applyCardDefaults !== 'boolean') return false
403
398
  if (input.reuseSession !== undefined && typeof input.reuseSession !== 'boolean') return false
404
- if (input.teamRun !== undefined && typeof input.teamRun !== 'boolean') return false
405
399
  if (input.goalRun !== undefined && typeof input.goalRun !== 'boolean') return false
406
400
  if (input.skipVerification !== undefined && typeof input.skipVerification !== 'boolean') return false
407
401
  if (input.permission !== undefined && !isTaskPermission(input.permission)) return false
@@ -426,10 +420,9 @@ function createInput(value: unknown): value is NewTaskInput {
426
420
 
427
421
  function updatePatch(value: unknown): boolean {
428
422
  const patch = record(value)
429
- if (patch === undefined || !exactKeys(patch, ['title', 'description', 'prompt', 'workspaceId', 'mode', 'permission', 'freeze', 'handover', 'model', 'reasoningEffort', 'reuseSession', 'teamRun', 'goalRun', 'skipVerification', 'tags'])) return false
423
+ if (patch === undefined || !exactKeys(patch, ['title', 'description', 'prompt', 'workspaceId', 'mode', 'permission', 'freeze', 'handover', 'model', 'reasoningEffort', 'reuseSession', 'goalRun', 'skipVerification', 'tags'])) return false
430
424
  // null (or false) clears the reuse opt-in; only a real boolean is accepted.
431
425
  if (patch.reuseSession !== undefined && patch.reuseSession !== null && typeof patch.reuseSession !== 'boolean') return false
432
- if (patch.teamRun !== undefined && patch.teamRun !== null && typeof patch.teamRun !== 'boolean') return false
433
426
  // The goal opt-in is tri-state: null/true return the card to its default
434
427
  // (goal run), false pins a single plain turn.
435
428
  if (patch.goalRun !== undefined && patch.goalRun !== null && typeof patch.goalRun !== 'boolean') return false
@@ -32,6 +32,7 @@
32
32
  export const PLUGIN_TOOL_SECTION_ORDERS = {
33
33
  ssh: 150,
34
34
  'task-board': 200,
35
+ agents: 220,
35
36
  } as const
36
37
 
37
38
  /** One plugin id keyed by {@link PLUGIN_TOOL_SECTION_ORDERS}. */
@@ -1,26 +0,0 @@
1
- /**
2
- * Team-run promotion for a parent card that just gained a subtask. A card with
3
- * subtasks is exactly what the Agent Team mode is for, so the two join actions
4
- * (create a subtask, link an existing task) opt the parent in — but only after
5
- * the Host confirmed the join, and only where the deployment serves Agent
6
- * Teams. A refused join changes nothing, and a parent that already opted in is
7
- * left alone rather than rewritten.
8
- *
9
- * Nothing here runs on mount or from a render effect: an existing card is only
10
- * ever touched by the user's own join action, so switching the option off by
11
- * hand stays off.
12
- */
13
- import type { BoardController } from '../../core/controller.ts';
14
- import type { TaskRecord } from '../../core/tasks.ts';
15
- /**
16
- * Whether a join would promote this parent: the deployment serves Agent Teams
17
- * and the parent has not opted in yet.
18
- * @param controller - the board controller (the snapshot carries both facts).
19
- * @param parent - the task that gained a subtask, if there is one.
20
- */
21
- export declare function parentAwaitsTeamRunPromotion(controller: BoardController, parent: TaskRecord | undefined): boolean;
22
- /**
23
- * Opt the parent in after the Host confirmed the join.
24
- * @returns true when the opt-in was written; false when it did not apply.
25
- */
26
- export declare function promoteParentForTeamRun(controller: BoardController, parent: TaskRecord | undefined): Promise<boolean>;
@@ -1,39 +0,0 @@
1
- /**
2
- * Team-run promotion for a parent card that just gained a subtask. A card with
3
- * subtasks is exactly what the Agent Team mode is for, so the two join actions
4
- * (create a subtask, link an existing task) opt the parent in — but only after
5
- * the Host confirmed the join, and only where the deployment serves Agent
6
- * Teams. A refused join changes nothing, and a parent that already opted in is
7
- * left alone rather than rewritten.
8
- *
9
- * Nothing here runs on mount or from a render effect: an existing card is only
10
- * ever touched by the user's own join action, so switching the option off by
11
- * hand stays off.
12
- */
13
- import type { BoardController } from '../../core/controller.ts'
14
- import type { TaskRecord } from '../../core/tasks.ts'
15
-
16
- /**
17
- * Whether a join would promote this parent: the deployment serves Agent Teams
18
- * and the parent has not opted in yet.
19
- * @param controller - the board controller (the snapshot carries both facts).
20
- * @param parent - the task that gained a subtask, if there is one.
21
- */
22
- export function parentAwaitsTeamRunPromotion(controller: BoardController, parent: TaskRecord | undefined): boolean {
23
- if (parent === undefined) return false
24
- const snapshot = controller.getSnapshot()
25
- if (snapshot.host?.teamRunAvailable !== true) return false
26
- // The freshest record wins: the card may have been edited since this modal
27
- // opened with its own copy.
28
- return (snapshot.tasks.find(task => task.id === parent.id) ?? parent).teamRun !== true
29
- }
30
-
31
- /**
32
- * Opt the parent in after the Host confirmed the join.
33
- * @returns true when the opt-in was written; false when it did not apply.
34
- */
35
- export async function promoteParentForTeamRun(controller: BoardController, parent: TaskRecord | undefined): Promise<boolean> {
36
- if (parent === undefined) return false
37
- if (!parentAwaitsTeamRunPromotion(controller, parent)) return false
38
- return await controller.updateTask(parent.id, { teamRun: true })
39
- }