dsh-baton-host 0.6.11 → 0.6.13

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 (2) hide show
  1. package/lib/index.js +38 -2
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -790,6 +790,7 @@ export function apply(ctx) {
790
790
 
791
791
  let goalsService = null
792
792
  let agentsService = null
793
+ let teamsService = null
793
794
  const activations = new Map() // sessionId -> 'armed' | 'disarmed', from goal/activation-changed
794
795
  ctx.on('goal/activation-changed', guard('goal activation', ({ sessionId, goal } = {}) => {
795
796
  if (!sessionId) return
@@ -1174,9 +1175,32 @@ export function apply(ctx) {
1174
1175
  }
1175
1176
  }
1176
1177
 
1177
- async function send({ message, session_id, cwd, workspace_id, mode: asked, sender, model, reasoning_effort }) {
1178
+ // --- Agent Teams ----------------------------------------------------------------
1179
+ // Harness 0.2.2-rc.2 turns a root session's Team mode on or off from its model menu
1180
+ // ("Use Agent Teams"): agentTeams.setEnabled with the session's live root Agent. The
1181
+ // selection is saved in the session, so it holds for later messages and restarts.
1182
+ const TEAMS_UNSUPPORTED = 'this DeepSeek Harness cannot turn Agent Teams on per session; that needs Harness 0.2.2-rc.2 or later: update Harness, or send without team'
1183
+ async function setTeam(sessionId, enabled) {
1184
+ if (typeof teamsService?.setEnabled !== 'function') throw new Error(TEAMS_UNSUPPORTED)
1185
+ // The exact live Agent from Harness's registry, as its own UI lookup takes it: Team rejects
1186
+ // any other object ("subagent tree access requires the exact live caller"). A session not
1187
+ // loaded yet is loaded first.
1188
+ let agent = agentsService?.get?.(sessionId)
1189
+ if (!agent && typeof controller.resolveAgent === 'function') {
1190
+ await controller.resolveAgent(sessionId)
1191
+ agent = agentsService?.get?.(sessionId)
1192
+ }
1193
+ // A finished sub-agent's session is never loaded again: name the likely cause.
1194
+ if (!agent) throw new Error(`session ${sessionId} is not loaded in Harness; if it is a sub-agent's (teammate's) session, change Team mode on its root session instead`)
1195
+ await teamsService.setEnabled(agent, enabled)
1196
+ }
1197
+
1198
+ async function send({ message, session_id, cwd, workspace_id, mode: asked, sender, model, reasoning_effort, team }) {
1178
1199
  if (!message || !message.trim()) throw new Error('message is required')
1179
1200
  if (asked != null && asked !== 'followup' && asked !== 'steer') throw new Error('mode must be followup or steer')
1201
+ if (team != null && typeof team !== 'boolean') throw new Error('team must be true or false')
1202
+ // Checked before a new session is made, so a Harness without them is left as it was.
1203
+ if (team != null && typeof teamsService?.setEnabled !== 'function') throw new Error(`Nothing was sent: ${TEAMS_UNSUPPORTED}`)
1180
1204
  // Without a mode, a message to a busy session does what Harness's own busy-send setting says.
1181
1205
  const fromHarness = asked == null ? harnessBusyMode() : null
1182
1206
  const mode = asked ?? fromHarness ?? 'followup'
@@ -1209,6 +1233,12 @@ export function apply(ctx) {
1209
1233
  const chosen = await applyModel(sessionId, plan, isNew).catch((error) => {
1210
1234
  throw new Error(`${isNew ? `Session ${sessionId} was created, but no message was sent: ` : 'No message was sent: '}the model could not be set (${error?.message ?? error})`)
1211
1235
  })
1236
+ // Team mode goes on (or off) before the prompt, so the first step already has the Team tools.
1237
+ if (team != null) {
1238
+ await setTeam(sessionId, team).catch((error) => {
1239
+ throw new Error(`${isNew ? `Session ${sessionId} was created, but no message was sent: ` : 'No message was sent: '}Agent Teams could not be turned ${team ? 'on' : 'off'} (${error?.message ?? error})`)
1240
+ })
1241
+ }
1212
1242
  // A session that never picked a model runs on Harness's default.
1213
1243
  let provider = chosen.model?.provider
1214
1244
  if (!provider) try { provider = defaultModel()?.currentSelection?.()?.provider } catch { /* unknown: no check */ }
@@ -1237,6 +1267,7 @@ export function apply(ctx) {
1237
1267
  mode_source: modeSource,
1238
1268
  model: chosen.model,
1239
1269
  model_source: chosen.source,
1270
+ ...(team != null ? { team } : {}),
1240
1271
  ...(ahead.length ? { other_active_runs: ahead } : {}),
1241
1272
  ...(workspace ? { workspace } : {}),
1242
1273
  }
@@ -1362,7 +1393,8 @@ export function apply(ctx) {
1362
1393
  }
1363
1394
 
1364
1395
  const methods = {
1365
- ping: () => ({ name, version: VERSION, pid: process.pid }),
1396
+ // features: what this plugin can do that an older one cannot (team: dsh_send team).
1397
+ ping: () => ({ name, version: VERSION, pid: process.pid, features: ['team'] }),
1366
1398
  workspaces,
1367
1399
  create_workspace: createWorkspace,
1368
1400
  list_sessions: listSessions,
@@ -1469,6 +1501,10 @@ export function apply(ctx) {
1469
1501
  agentsService = child.agents
1470
1502
  child.effect(() => () => { if (agentsService === child.agents) agentsService = null }, 'dsh-baton-host agents')
1471
1503
  })
1504
+ ctx.inject(['agentTeams'], (child) => {
1505
+ teamsService = child.agentTeams
1506
+ child.effect(() => () => { if (teamsService === child.agentTeams) teamsService = null }, 'dsh-baton-host agent teams')
1507
+ })
1472
1508
  ctx.inject(['webServer'], (web) => {
1473
1509
  web.effect(() => web.webServer.register({
1474
1510
  kind: 'exact',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-baton-host",
3
- "version": "0.6.11",
3
+ "version": "0.6.13",
4
4
  "description": "Hand coding tasks from Claude Code or Codex to DeepSeek Harness: they run live in the Harness window and come back with the changed files and test results.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -20,7 +20,7 @@
20
20
  "LICENSE"
21
21
  ],
22
22
  "dependencies": {
23
- "dsh-baton-mcp": "0.6.11"
23
+ "dsh-baton-mcp": "0.6.13"
24
24
  },
25
25
  "license": "MIT",
26
26
  "dsh": {