dsh-team-control 0.3.0 → 0.3.2

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 (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +158 -30
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 调用顺序写在哪(别让模型自己摸)
10
10
 
11
- - 14 个工具里**只有 `dsh_team_create` 标了 `START HERE`**:它的 description 直接给出 5 步顺序、`permissionPreset` 的语义、
11
+ - 14 个工具里**只有 `dsh_team_create` 标了 `START HERE`**:它的 description 直接给出两道前置闸口(先澄清需求、再调研代码)、5 步顺序、`permissionPreset` 的语义、
12
12
  以及 `teamId` 取自 `result.team.id`;`dsh_team_spawn` 写明返回的 `member.id` 就是后面 `assignee` 要的值;
13
13
  `dsh_team_task` 写明简报必须自包含(成员看不到 Lead 的对话)。模型只看工具面就能按序走。
14
14
  - 完整配方(字段陷阱、拆任务与并发、症状→修法表)在 skill **`dsh-agent-team`**:[`../skills/dsh-agent-team/SKILL.md`](../skills/dsh-agent-team/SKILL.md)。
package/index.js CHANGED
@@ -264,11 +264,41 @@ function canDeliverTo(ctx, sender) {
264
264
  return !!subs && typeof subs.sendMessage === 'function';
265
265
  }
266
266
 
267
+ /**
268
+ * 这个失败是否表示「工具在当前 harness 下不可直接调用」(run_code / PTC 模式)。
269
+ *
270
+ * 不能只看 `tools.get()`:它查的是可见性,而 PTC 只改可执行性。顶层批次会被执行器以
271
+ * `ToolNotFoundError`(`info.code === 'UNKNOWN_TOOL'`,文案含 `only run_code is callable directly`)
272
+ * 拒绝,并且以 `{ isError: true }` 返回、不抛异常。判定依据放在错误本身,命中才回退服务通道。
273
+ */
274
+ function uncallableToolFailure(error) {
275
+ const detail = (error && error.error) || error || {};
276
+ const info = detail.info || {};
277
+ const code = info.code || detail.code || error?.code;
278
+ if (code === 'UNKNOWN_TOOL') return true;
279
+ const message = typeof detail === 'string' ? detail : String(detail.message || error?.message || '');
280
+ return /unknown tool|callable directly/i.test(message);
281
+ }
282
+
283
+ /** 服务通道:`subagents.sendMessage`(两代宿主都保留),也用于原生工具不可直接调用时的回退。 */
284
+ async function sendByService(ctx, sender, targetSessionId, text, opts = {}) {
285
+ const subs = subagentsOf(ctx);
286
+ if (!subs || typeof subs.sendMessage !== 'function') throw new Error('subagents 服务不可用,无法投递消息');
287
+ const messageId = await subs.sendMessage(
288
+ sender,
289
+ String(targetSessionId),
290
+ [{ type: 'text', text: String(text) }],
291
+ opts.signal ? { signal: opts.signal } : {},
292
+ );
293
+ return { via: 'service', messageId: messageId != null ? String(messageId) : undefined };
294
+ }
295
+
267
296
  /**
268
297
  * 把一条文本消息投进某个 agent 会话(成员与 Lead 一视同仁)。
269
298
  *
270
299
  * - 高版本 DSH 提供原生 `send_message` 工具:走工具层调用,接收方由宿主 `resolveName` 解析
271
300
  * (传 sessionId 时它会被原样当作会话 id),消息来源标记、空闲唤醒、后续语义变化都交给宿主;
301
+ * 若工具可见但不可直接调用(PTC / run_code preset),回退服务通道;
272
302
  * - 低版本没有该工具:保持原来的 `subagents.sendMessage(sender, sessionId, content, { signal })`。
273
303
  *
274
304
  * `sender` 必须是精确的活跃 Agent(两代实现都这么要求),调用方负责从 `agents` 注册表或缓存的
@@ -278,35 +308,34 @@ async function sendAgentMessage(ctx, sender, targetSessionId, text, opts = {}) {
278
308
  const native = nativeSendTools(ctx, sender);
279
309
  if (native) {
280
310
  const callId = `team-send-${randomUUID()}`;
281
- const batch = await native.tools.execute({
282
- calls: [{
283
- type: 'tool-call',
284
- id: callId,
285
- name: native.name,
286
- arguments: JSON.stringify({ agent: String(targetSessionId), message: String(text) }),
287
- }],
288
- signal: opts.signal || AbortSignal.timeout(60000),
289
- agent: sender,
290
- });
291
- const results = Array.isArray(batch?.results) ? batch.results : [];
292
- const result = (results.find((r) => r && r.callId === callId) || results[0])?.result;
311
+ let result;
312
+ try {
313
+ const batch = await native.tools.execute({
314
+ calls: [{
315
+ type: 'tool-call',
316
+ id: callId,
317
+ name: native.name,
318
+ arguments: JSON.stringify({ agent: String(targetSessionId), message: String(text) }),
319
+ }],
320
+ signal: opts.signal || AbortSignal.timeout(60000),
321
+ agent: sender,
322
+ });
323
+ const results = Array.isArray(batch?.results) ? batch.results : [];
324
+ result = (results.find((r) => r && r.callId === callId) || results[0])?.result;
325
+ } catch (err) {
326
+ if (!uncallableToolFailure(err)) throw err;
327
+ return sendByService(ctx, sender, targetSessionId, text, opts);
328
+ }
293
329
  if (!result) throw new Error('send_message 工具没有返回执行结果');
294
330
  if (result.isError) {
331
+ if (uncallableToolFailure(result)) return sendByService(ctx, sender, targetSessionId, text, opts);
295
332
  const failure = result.error || {};
296
333
  throw new Error(`send_message 工具投递失败:${failure.message || failure.code || '未知错误'}`);
297
334
  }
298
335
  const messageId = result.value && result.value.messageId;
299
336
  return { via: 'tool', messageId: messageId != null ? String(messageId) : undefined };
300
337
  }
301
- const subs = subagentsOf(ctx);
302
- if (!subs || typeof subs.sendMessage !== 'function') throw new Error('subagents 服务不可用,无法投递消息');
303
- const messageId = await subs.sendMessage(
304
- sender,
305
- String(targetSessionId),
306
- [{ type: 'text', text: String(text) }],
307
- opts.signal ? { signal: opts.signal } : {},
308
- );
309
- return { via: 'service', messageId: messageId != null ? String(messageId) : undefined };
338
+ return sendByService(ctx, sender, targetSessionId, text, opts);
310
339
  }
311
340
 
312
341
  /** `sessions` / `workspaceChanges`:读成员自己会话里的交付文件(都是可选依赖)。 */
@@ -812,6 +841,41 @@ async function assertRouteEnabled(s, ctx, provider, model, effort = null) {
812
841
  }
813
842
  }
814
843
 
844
+ /**
845
+ * 归一化看板建卡入参的模型路由:接受 { provider?, model, reasoningEffort? } 或
846
+ * "provider/model"/"model" 字符串;缺 model 返回 null(由调用方决定报错还是丢弃)。
847
+ */
848
+ function normalizeBoardRoute(input) {
849
+ if (input == null) return null;
850
+ let provider = null;
851
+ let model = null;
852
+ let effort = null;
853
+ if (typeof input === 'string') {
854
+ const raw = input.trim();
855
+ const slash = raw.indexOf('/');
856
+ if (slash > 0) {
857
+ provider = raw.slice(0, slash).trim() || null;
858
+ model = raw.slice(slash + 1).trim() || null;
859
+ } else {
860
+ model = raw || null;
861
+ }
862
+ } else if (typeof input === 'object') {
863
+ provider = input.provider != null && String(input.provider).trim() ? String(input.provider).trim() : null;
864
+ model = input.model != null && String(input.model).trim() ? String(input.model).trim() : null;
865
+ effort = input.reasoningEffort != null && String(input.reasoningEffort).trim() ? String(input.reasoningEffort).trim() : null;
866
+ }
867
+ if (!model) return null;
868
+ return { provider, model, ...(effort ? { reasoningEffort: effort } : {}) };
869
+ }
870
+
871
+ /** 显式 route 入参:undefined/null = 未设置,其余必须带 model,否则提前报错。 */
872
+ function boardRouteParam(input, label) {
873
+ if (input == null) return null;
874
+ const route = normalizeBoardRoute(input);
875
+ if (!route) throw new Error(`${label} 需要 model:传 { provider?, model, reasoningEffort? } 或 "provider/model"`);
876
+ return route;
877
+ }
878
+
815
879
  function rememberMember(sessionId, teamId, memberId, cwd, permissionPreset = null, name = null) {
816
880
  if (sessionId == null) return;
817
881
  const key = String(sessionId);
@@ -2633,7 +2697,7 @@ function buildTools(s, ctx) {
2633
2697
 
2634
2698
  tools.push({
2635
2699
  name: 'dsh_team_create',
2636
- description: 'START HERE to build a working team of agents. Order: dsh_team_create({name, workspace, permissionPreset?}) → dsh_team_models() to see the enabled provider/model routes → dsh_team_spawn({teamId, name, prompt, agentProvider?, model?, reasoningEffort?, permissionPreset?}) once per member, choosing a cheap/fast route for mechanical work and a strong-reasoning route for architecture, debugging, or review → dsh_team_task({teamId, subject, assignee?, plan, acceptance}) per DAG node → each member finishes by calling dsh_team_report_task → inspect with dsh_team_status / dsh_team_report. Every member is a real DSH sub-agent session (own model, tools, context, message inbox). `permissionPreset` decides the member sandbox + approval policy (DSH permission presets, e.g. workspace-write or danger-full-access); the team value is the default and dsh_team_spawn can override it per member. When a member hits an operation its preset requires approval for, the approval is forwarded to the Lead, who decides with dsh_team_approve. `workspace` is an absolute directory shared by the members and becomes their cwd. Keep teamId from this response (result.team.id): every later call needs it. Spawn members by capability domain, not one per requirement item: one member can own several related dsh_team_task items, so keep the member count at the minimum needed. For the full recipe with per-field pitfalls, load the skill "dsh-agent-team".',
2700
+ description: 'START HERE to build a working team of agents — but only AFTER two gates: (1) CLARIFY: if the request is vague, grill the user in numbered rounds, each question with your recommended answer, until scope/acceptance are settled — facts are yours to look up (read code, run commands, or dispatch a throwaway subagent), decisions belong to the user; (2) RESEARCH: read the workspace AGENTS.md/CLAUDE.md and the relevant code so the brief names real files, current behavior and constraints. Do not dispatch on a one-line request. Then: dsh_team_create({name, workspace, permissionPreset?}) → dsh_team_models() to see the enabled provider/model routes → dsh_team_spawn({teamId, name, prompt, agentProvider?, model?, reasoningEffort?, permissionPreset?}) once per member, choosing a cheap/fast route for mechanical work and a strong-reasoning route for architecture, debugging, or review → dsh_team_task({teamId, subject, assignee?, plan, acceptance}) per DAG node → each member finishes by calling dsh_team_report_task → inspect with dsh_team_status / dsh_team_report. Every member is a real DSH sub-agent session (own model, tools, context, message inbox). `permissionPreset` decides the member sandbox + approval policy (DSH permission presets, e.g. workspace-write or danger-full-access); the team value is the default and dsh_team_spawn can override it per member. When a member hits an operation its preset requires approval for, the approval is forwarded to the Lead, who decides with dsh_team_approve. `workspace` is an absolute directory shared by the members and becomes their cwd. Keep teamId from this response (result.team.id): every later call needs it. Spawn members by capability domain, not one per requirement item: one member can own several related dsh_team_task items, so keep the member count at the minimum needed. For the full recipe with per-field pitfalls, load the skill "dsh-agent-team".',
2637
2701
  parameters: {
2638
2702
  type: 'object',
2639
2703
  additionalProperties: false,
@@ -2925,7 +2989,7 @@ function buildTools(s, ctx) {
2925
2989
 
2926
2990
  tools.push({
2927
2991
  name: 'dsh_team_status',
2928
- description: 'Read a live snapshot instead of guessing progress. detail=summary returns every member with status/step/seq/percent/next/blockers/stale and its permissionPreset; detail=dag returns the task DAG with dependencies, readiness, joins and the critical path. `asOf` marks the snapshot time.',
2992
+ description: 'Read a live snapshot instead of guessing progress. detail=summary returns every member with status/step/seq/percent/next/blockers/stale and its permissionPreset; detail=dag returns the task DAG with dependencies, readiness, joins and the critical path. `asOf` marks the snapshot time. Read it once when reporting to the user; do not call it repeatedly to watch a running member — a rising `seq` already proves it is working, and the host wakes the Lead when it finishes.',
2929
2993
  parameters: {
2930
2994
  type: 'object',
2931
2995
  additionalProperties: false,
@@ -3001,7 +3065,7 @@ function buildTools(s, ctx) {
3001
3065
 
3002
3066
  tools.push({
3003
3067
  name: 'dsh_team_task',
3004
- description: 'Only for decomposing the CURRENT task: declare one task (DAG node) and hand it to a member. When the user asks for a new, separate task card (own deliverable or acceptance, own branch/session), use dsh_team_board_task_create instead — dsh_team_task items never appear on the board. The plan is a BRIEF sent to the member’s own sub-agent session, which does the work with its own tools and calls dsh_team_report_task when finished — write it self-contained (the member does not see this conversation). `assignee` takes a member **id** from dsh_team_spawn, not its name; omit it to let the scheduler pick an idle member. `deps[].from` takes a **task** id returned by an earlier dsh_team_task (member ids are rejected). The scheduler satisfies dependencies itself — never poll. The task dispatches immediately to an idle member once dependencies are satisfied; pass dispatch:false to build the DAG first.',
3068
+ description: 'Only for decomposing the CURRENT task: declare one task (DAG node) and hand it to a member. When the user asks for a new, separate task card (own deliverable or acceptance, own branch/session), use dsh_team_board_task_create instead — dsh_team_task items never appear on the board. The plan is a BRIEF sent to the member’s own sub-agent session, which does the work with its own tools and calls dsh_team_report_task when finished — write it self-contained (the member does not see this conversation). `assignee` takes a member **id** from dsh_team_spawn, not its name; omit it to let the scheduler pick an idle member. `deps[].from` takes a **task** id returned by an earlier dsh_team_task (member ids are rejected). The scheduler satisfies dependencies itself — never poll. The task dispatches immediately to an idle member once dependencies are satisfied; pass dispatch:false to build the DAG first. Never create a duplicate task or re-send a brief just to nudge a member that is still running — wait for its dsh_team_report_task.',
3005
3069
  parameters: {
3006
3070
  type: 'object',
3007
3071
  additionalProperties: false,
@@ -3058,7 +3122,7 @@ function buildTools(s, ctx) {
3058
3122
 
3059
3123
  tools.push({
3060
3124
  name: 'dsh_team_send',
3061
- description: "Send a message that a member will actually read: the text is injected into the target sub-agent's message inbox. By default a running member's current turn is interrupted first, so the message immediately starts a fresh turn instead of waiting for the next step boundary; pass `interrupt: false` to keep the current turn and deliver at the next step boundary. An idle member is woken. `to` is a member NAME (member id also accepted) or '*' to broadcast; use to:'lead' to reply to the Lead. Every send is also recorded on the sidecar so the panel shows the conversation. Returns delivery status only, never the member's reply: the reply arrives asynchronously as a new message in a later turn. Never wait for it with sleep/Start-Sleep/delayed scripts, polling loops, or repeated dsh_team_status calls — after sending, continue independent work or end the turn.",
3125
+ description: "Send a message that a member will actually read: the text is injected into the target sub-agent's message inbox. By default a running member's current turn is interrupted first, so the message immediately starts a fresh turn instead of waiting for the next step boundary; pass `interrupt: false` to keep the current turn and deliver at the next step boundary. An idle member is woken. `to` is a member NAME (member id also accepted) or '*' to broadcast; use to:'lead' to reply to the Lead. Every send is also recorded on the sidecar so the panel shows the conversation. Returns delivery status only, never the member's reply: the reply arrives asynchronously as a new message in a later turn. Never wait for it with sleep/Start-Sleep/delayed scripts, polling loops, or repeated dsh_team_status calls — after sending, continue independent work or end the turn. This is a REDIRECTION tool, not a progress-nudge tool: while a member is still running do NOT use it to ask how it is going, whether it is done, or to re-send the brief — the default interrupt discards its in-flight step and pushes it to wrap up early just to answer. Send once only when the member is blocked, reported an error, or you must correct a wrong direction (prefer interrupt:false for that), then end the turn.",
3062
3126
  parameters: {
3063
3127
  type: 'object',
3064
3128
  additionalProperties: false,
@@ -3067,7 +3131,7 @@ function buildTools(s, ctx) {
3067
3131
  to: { type: 'string', description: "Member name (agent teams) or member id, or '*' for broadcast." },
3068
3132
  message: { type: 'string', description: 'Message body.' },
3069
3133
  correlationId: { type: 'string', description: 'Optional correlation id to pair a request with its response.' },
3070
- interrupt: { type: 'boolean', description: 'Default true: if the target member is running, interrupt its current turn before delivering so this message takes effect immediately. false = keep the current turn and deliver at the next step boundary; the message is still queued durably and will be read (a pending steer forces another turn, an idle member is woken), but it may land only after the member finished the current step, so it cannot be relied on to change this turn.' },
3134
+ interrupt: { type: 'boolean', description: 'Use true only when you must change an instruction mid-flight; never as a nudge. Default true: if the target member is running, interrupt its current turn before delivering so this message takes effect immediately. false = keep the current turn and deliver at the next step boundary; the message is still queued durably and will be read (a pending steer forces another turn, an idle member is woken), but it may land only after the member finished the current step, so it cannot be relied on to change this turn.' },
3071
3135
  },
3072
3136
  required: ['teamId', 'to', 'message'],
3073
3137
  },
@@ -3377,7 +3441,7 @@ function buildTools(s, ctx) {
3377
3441
 
3378
3442
  tools.push({
3379
3443
  name: 'dsh_team_dispatch',
3380
- description: 'Pump the agent-team dispatcher once: claim ready tasks for idle members and send each member its brief. Normally unnecessary — dsh_team_task dispatches automatically and dsh_team_report_task dispatches the next wave — but useful after dsh_team_control/resume, after approving a scope request, or when a member went idle without reporting. Safe to call repeatedly; it returns when no idle member or no ready task is left.',
3444
+ description: 'Pump the agent-team dispatcher once: claim ready tasks for idle members and send each member its brief. Normally unnecessary — dsh_team_task dispatches automatically and dsh_team_report_task dispatches the next wave — but useful after dsh_team_control/resume, after approving a scope request, or when a member went idle without reporting. Safe to call repeatedly; it returns when no idle member or no ready task is left. It is a recovery pump, not a heartbeat: do not call it in a loop to watch a running member.',
3381
3445
  parameters: {
3382
3446
  type: 'object',
3383
3447
  additionalProperties: false,
@@ -3746,7 +3810,7 @@ function buildTools(s, ctx) {
3746
3810
  }
3747
3811
  }
3748
3812
  if (rec) { rec.phase = 'execution'; rec.sawRunning = false; }
3749
- } else if (rec) {
3813
+ } else if (rec && task?.status !== 'done') {
3750
3814
  rec.phase = 'planned';
3751
3815
  }
3752
3816
  if (task?.executionMode === 'new' && rec) {
@@ -3787,7 +3851,7 @@ function buildTools(s, ctx) {
3787
3851
 
3788
3852
  tools.push({
3789
3853
  name: 'dsh_team_board_task_create',
3790
- description: 'Create a new workspace-board task card (the user-facing queue the board scheduler picks up) — use it when the user asks for a new task that is a separate deliverable or deserves its own session/branch (not a step of the current task, which is dsh_team_task). This is NOT a team DAG task: team_* tools stay inside the current team. workspaceId defaults to the caller own board task, then to the only registered workspace; pass it when either is ambiguous. Pass gitBranch to run the new task on a git branch ("" = auto `task/<id>`, omitted = no branch).',
3854
+ description: 'Create a new workspace-board task card (the user-facing queue the board scheduler picks up) — use it when the user asks for a new task that is a separate deliverable or deserves its own session/branch (not a step of the current task, which is dsh_team_task). This is NOT a team DAG task: team_* tools stay inside the current team. workspaceId defaults to the caller own board task, then to the only registered workspace; pass it when either is ambiguous. Pass gitBranch to run the new task on a git branch ("" = auto `task/<id>`, omitted = no branch). Pin models with planRoute/leadRoute/teamModels: call dsh_team_models first and pass { provider?, model, reasoningEffort? } (or "provider/model"); omitted routes follow the board settings, and the card displays the models it uses.',
3791
3855
  parameters: {
3792
3856
  type: 'object',
3793
3857
  additionalProperties: false,
@@ -3801,6 +3865,46 @@ function buildTools(s, ctx) {
3801
3865
  useTeam: { type: 'boolean', description: 'Let the Lead orchestrate a team (default true).' },
3802
3866
  executionMode: { type: 'string', enum: ['same', 'new'], description: 'same = plan and execute in one session; new = execute in a fresh session.' },
3803
3867
  gitBranch: { type: 'string', description: 'Git branch to switch to before spawning; "" auto-generates task/<id>.' },
3868
+ planRoute: {
3869
+ type: 'object',
3870
+ additionalProperties: false,
3871
+ description: 'Planning model; omit to follow the board workspace settings. Use dsh_team_models to pick provider/model/reasoningEffort.',
3872
+ properties: {
3873
+ provider: { type: 'string', description: 'Provider id from dsh_team_models; omit when the model id is unique.' },
3874
+ model: { type: 'string', description: 'Model id from dsh_team_models.' },
3875
+ reasoningEffort: { type: 'string', description: 'Optional reasoning effort id from team_models.' },
3876
+ },
3877
+ required: ['model'],
3878
+ },
3879
+ leadRoute: {
3880
+ type: 'object',
3881
+ additionalProperties: false,
3882
+ description: 'Execution (Lead) model; omit to follow the board workspace settings.',
3883
+ properties: {
3884
+ provider: { type: 'string', description: 'Provider id from dsh_team_models; omit when the model id is unique.' },
3885
+ model: { type: 'string', description: 'Model id from dsh_team_models.' },
3886
+ reasoningEffort: { type: 'string', description: 'Optional reasoning effort id from team_models.' },
3887
+ },
3888
+ required: ['model'],
3889
+ },
3890
+ teamModels: {
3891
+ type: 'array',
3892
+ description: 'Whitelist of models team members may use (dsh_team_spawn enforces it; empty/omitted = unrestricted). Each item is the same { provider?, model, reasoningEffort? } route.',
3893
+ items: {
3894
+ type: 'object',
3895
+ additionalProperties: false,
3896
+ properties: {
3897
+ provider: { type: 'string', description: 'Provider id from dsh_team_models; omit when the model id is unique.' },
3898
+ model: { type: 'string', description: 'Model id from dsh_team_models.' },
3899
+ reasoningEffort: { type: 'string', description: 'Optional reasoning effort id from team_models.' },
3900
+ },
3901
+ required: ['model'],
3902
+ },
3903
+ },
3904
+ prewalk: {
3905
+ type: 'boolean',
3906
+ description: 'Experimental: with executionMode="same", switch the same session to leadRoute after the plan first changes files (default false).',
3907
+ },
3804
3908
  },
3805
3909
  required: ['title'],
3806
3910
  },
@@ -3848,6 +3952,24 @@ function buildTools(s, ctx) {
3848
3952
  }
3849
3953
  }
3850
3954
  }
3955
+ // 模型路由:只在显式传入时下发(省略则跟随看板工作区设置),并提前校验可用性,
3956
+ // 避免建卡成功、真正开会话时才因为模型被禁用而失败。
3957
+ const planRoute = args.planRoute === undefined ? undefined : boardRouteParam(args.planRoute, 'planRoute');
3958
+ const leadRoute = args.leadRoute === undefined ? undefined : boardRouteParam(args.leadRoute, 'leadRoute');
3959
+ let teamModels;
3960
+ if (args.teamModels !== undefined) {
3961
+ if (args.teamModels === null) {
3962
+ teamModels = null; // 显式 null 等价于不限制
3963
+ } else if (!Array.isArray(args.teamModels)) {
3964
+ throw new Error('teamModels 需要数组,每项为 { provider?, model, reasoningEffort? } 或 "provider/model"');
3965
+ } else {
3966
+ teamModels = args.teamModels.map((m, i) => boardRouteParam(m, `teamModels[${i}]`)).filter(Boolean);
3967
+ if (!teamModels.length) teamModels = null; // 空数组等价于不限制
3968
+ }
3969
+ }
3970
+ for (const route of [planRoute, leadRoute, ...(teamModels || [])]) {
3971
+ if (route) await assertRouteEnabled(s, ctx, route.provider, route.model, route.reasoningEffort || null);
3972
+ }
3851
3973
  const task = await request(s, '/api/board/tasks', {
3852
3974
  method: 'POST',
3853
3975
  body: {
@@ -3860,6 +3982,10 @@ function buildTools(s, ctx) {
3860
3982
  ...(args.useTeam !== undefined ? { useTeam: args.useTeam } : {}),
3861
3983
  ...(args.executionMode !== undefined ? { executionMode: args.executionMode } : {}),
3862
3984
  ...(args.gitBranch !== undefined ? { gitBranch: args.gitBranch } : {}),
3985
+ ...(planRoute !== undefined ? { planRoute } : {}),
3986
+ ...(leadRoute !== undefined ? { leadRoute } : {}),
3987
+ ...(teamModels !== undefined ? { teamModels } : {}),
3988
+ ...(args.prewalk !== undefined ? { prewalk: args.prewalk } : {}),
3863
3989
  },
3864
3990
  });
3865
3991
  return { task };
@@ -3868,7 +3994,7 @@ function buildTools(s, ctx) {
3868
3994
 
3869
3995
  tools.push({
3870
3996
  name: 'dsh_team_board_task_get',
3871
- description: 'Read the current workspace-board task of this session (status/planSummary/lastError/gitBranch/sessions) when taskId is omitted, or any board card by taskId. Cheap and safe to call every turn: it returns the status snapshot, not the whole plan body. Use it to decide whether to keep working, wait, or report via dsh_team_board_task_status.',
3997
+ description: 'Read the current workspace-board task of this session (status/planSummary/lastError/gitBranch/planRoute/leadRoute/teamModels/sessions) when taskId is omitted, or any board card by taskId. Cheap and safe to call every turn: it returns the status snapshot, not the whole plan body. Use it to decide whether to keep working, wait, or report via dsh_team_board_task_status.',
3872
3998
  parameters: {
3873
3999
  type: 'object',
3874
4000
  additionalProperties: false,
@@ -3883,6 +4009,8 @@ function buildTools(s, ctx) {
3883
4009
  id: t.id, workspaceId: t.workspaceId, title: t.title, status: t.status,
3884
4010
  executionMode: t.executionMode, needPlan: t.needPlan, useTeam: t.useTeam,
3885
4011
  gitBranch: t.gitBranch || null,
4012
+ planRoute: t.planRoute || null, leadRoute: t.leadRoute || null,
4013
+ teamModels: t.teamModels || null, prewalk: !!t.prewalk,
3886
4014
  planSummary: t.planSummary || null, lastError: t.lastError || null,
3887
4015
  planningSessionId: t.planningSessionId || null, leadSessionId: t.leadSessionId || null,
3888
4016
  teams: t.teams || [], archivedAt: t.archivedAt || null, updatedAt: t.updatedAt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-team-control",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "Expose the local dsh-team sidecar as model-facing tools (dsh_team_create / dsh_team_spawn / dsh_team_status / dsh_team_task / dsh_team_send / dsh_team_report_task / dsh_team_dispatch / dsh_team_control / dsh_team_approve / dsh_team_report), spawn real DSH sub-agent members with per-member permission presets, forward member approvals to the Lead, and manage the sidecar lifecycle.",
6
6
  "icon": "./icon.svg",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "dsh-team-control-cli": "^0.3.0"
24
+ "dsh-team-control-cli": "^0.3.2"
25
25
  },
26
26
  "exports": {
27
27
  ".": "./index.js",