dsh-baton-host 0.6.13 → 0.6.14

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.md CHANGED
@@ -6,10 +6,10 @@ Hand coding tasks from Claude Code or Codex to DeepSeek Harness: they run live i
6
6
 
7
7
  ## Install / 安装
8
8
 
9
- **Install / 安装**: Plugins / 插件 → Add plugin / 添加插件 → `dsh-baton-host` → Install / 安装 → Enable now / 立即启用. That registers dsh-baton for Claude Code and Codex. / 启用后会为 Claude Code 和 Codex 注册 dsh-baton。
9
+ **Install / 安装**: Plugins / 插件 → Add plugin / 添加插件 → `dsh-baton-host` → Install / 安装 → Enable now / 立即启用. That registers dsh-baton for Claude Code, Codex and Antigravity. / 启用后会为 Claude Code、Codex 和 Antigravity 注册 dsh-baton。
10
10
 
11
11
  **Check / 验证**:
12
- 1. Open a new chat in Claude Code or Codex; Codex asks once to approve the dsh-baton tools. / 在 Claude Code 或 Codex 里新开对话,Codex 第一次会请你批准 dsh-baton 的工具。
12
+ 1. Open a new chat in Claude Code or Codex (restart Antigravity once); Codex asks once to approve the dsh-baton tools. / 在 Claude Code 或 Codex 里新开对话(Antigravity 要重启一次),Codex 第一次会请你批准 dsh-baton 的工具。
13
13
  2. Ask it to call `dsh_list_workspaces`; it lists your Harness workspaces. / 让它调用 `dsh_list_workspaces`,会列出你的 Harness 工作区。
14
14
 
15
15
  Not registered? / 没能注册?Run `npx -y dsh-baton-mcp setup`.
package/lib/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // dsh-baton-host, browser half. Two jobs:
2
2
  // - On the Plugins page: right after the plugin is switched on, and on its detail page,
3
- // say whether the host half registered the MCP server for Claude Code and Codex
3
+ // say whether the host half registered the MCP server for Claude Code, Codex and Antigravity
4
4
  // (it serves the outcome at /dsh-baton/status).
5
5
  // - In the chat: label messages sent through dsh-baton with their sender ("Sent by
6
6
  // Claude from another chat"). The host half puts the sender
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
30
30
  // dsh-bridge: messages sent before the project was renamed.
31
31
  const RPC_RE = /^dsh-(?:baton|bridge)\.([a-z0-9-]{1,32})\./
32
32
  // Codex shows as ChatGPT, the way the ChatGPT app labels its own cross-chat messages.
33
- const NAMES = { claude: 'Claude', codex: 'ChatGPT' }
33
+ const NAMES = { claude: 'Claude', codex: 'ChatGPT', antigravity: 'Antigravity' }
34
34
 
35
35
  const PACKAGE = 'dsh-baton-host'
36
36
  const SETUP = 'npx -y dsh-baton-mcp setup'
@@ -39,11 +39,13 @@ window.__ModuleLoader__.load({
39
39
  sentFrom: '由 {name} 从另一个聊天发送',
40
40
  readyTitle: 'dsh-baton 已就绪',
41
41
  failTitle: 'dsh-baton 还差一步',
42
- pending: '正在为 Claude Code 和 Codex 注册 dsh-baton…',
43
- ready: '已为 {clients} 注册 dsh-baton。在 Claude Code 或 Codex 里新开一个对话,就能用 dsh_* 工具。',
42
+ pending: '正在为 Claude Code、Codex 和 Antigravity 注册 dsh-baton…',
43
+ ready: '已为 {clients} 注册 dsh-baton。在里面新开一个对话,就能用 dsh_* 工具。',
44
+ restartAg: '在 Antigravity 里要先重启一次它。',
44
45
  partial: '{clients} 没能注册:',
46
+ badJson: '{file} 不是有效的 JSON,改好后重启 Harness。',
45
47
  noNode: '没找到 Node.js 22.15 或更新版本。装好 Node.js 后,',
46
- noClients: '没找到 Claude Code 或 Codex。装好之后,',
48
+ noClients: '没找到 Claude Code、Codex 或 Antigravity。装好其中一个之后,',
47
49
  failed: '没能自动注册 MCP。',
48
50
  runSetup: '请在终端运行 {cmd}。',
49
51
  unknown: '如果新对话里没有 dsh_* 工具,请在终端运行 {cmd}。',
@@ -54,16 +56,19 @@ window.__ModuleLoader__.load({
54
56
  notInstalled: '未安装',
55
57
  notRegistered: '未注册',
56
58
  and: '和',
59
+ comma: '、',
57
60
  }
58
61
  const en = {
59
62
  sentFrom: 'Sent by {name} from another chat',
60
63
  readyTitle: 'dsh-baton is ready',
61
64
  failTitle: 'dsh-baton needs one more step',
62
- pending: 'Registering dsh-baton for Claude Code and Codex…',
63
- ready: 'dsh-baton is registered for {clients}. Start a new conversation in Claude Code or Codex to use the dsh_* tools.',
65
+ pending: 'Registering dsh-baton for Claude Code, Codex and Antigravity…',
66
+ ready: 'dsh-baton is registered for {clients}. Start a new conversation there to use the dsh_* tools.',
67
+ restartAg: 'Restart Antigravity first.',
64
68
  partial: 'Could not register for {clients}: ',
69
+ badJson: '{file} is not valid JSON: fix it, then restart Harness.',
65
70
  noNode: 'Node.js 22.15 or later was not found. Once it is installed, ',
66
- noClients: 'Neither Claude Code nor Codex was found. Once one is installed, ',
71
+ noClients: 'None of Claude Code, Codex or Antigravity was found. Once one is installed, ',
67
72
  failed: 'The MCP server could not be registered automatically. ',
68
73
  runSetup: 'run {cmd} in a terminal.',
69
74
  unknown: 'If new conversations have no dsh_* tools, run {cmd} in a terminal.',
@@ -74,6 +79,7 @@ window.__ModuleLoader__.load({
74
79
  notInstalled: 'not installed',
75
80
  notRegistered: 'not registered',
76
81
  and: 'and',
82
+ comma: ', ',
77
83
  }
78
84
 
79
85
  // --- Plugins page ------------------------------------------------------------
@@ -112,10 +118,17 @@ window.__ModuleLoader__.load({
112
118
  const clients = reg.clients ?? []
113
119
  const done = clients.filter((c) => REGISTERED.includes(c.state)).map((c) => c.label)
114
120
  const failed = clients.filter((c) => c.state === 'failed').map((c) => c.label)
115
- const list = (names) => names.join(` ${t('and')} `)
116
- const fix = (reg.error === 'no-node' ? t('noNode') : reg.error === 'no-clients' ? t('noClients') : '') + t('runSetup', { cmd: SETUP })
117
- if (reg.ok) return [t('readyTitle'), t('ready', { clients: list(done) })]
118
- if (done.length) return [t('failTitle'), `${t('ready', { clients: list(done) })} ${t('partial', { clients: list(failed) })}${fix}`]
121
+ const list = (names) => (names.length > 2 ? `${names.slice(0, -1).join(t('comma'))} ${t('and')} ${names.at(-1)}` : names.join(` ${t('and')} `))
122
+ // A config file that does not parse: setup would fail the same way, so the file is named.
123
+ const broken = clients.filter((c) => c.state === 'failed' && c.error === 'bad-json')
124
+ const fix = broken.length
125
+ ? broken.map((c) => t('badJson', { file: c.file })).join(' ')
126
+ : (reg.error === 'no-node' ? t('noNode') : reg.error === 'no-clients' ? t('noClients') : '') + t('runSetup', { cmd: SETUP })
127
+ // Antigravity starts its MCP servers only when it starts: a new entry needs a restart.
128
+ const fresh = clients.some((c) => c.id === 'antigravity' && c.state === 'registered')
129
+ const ready = t('ready', { clients: list(done) }) + (fresh ? ` ${t('restartAg')}` : '')
130
+ if (reg.ok) return [t('readyTitle'), ready]
131
+ if (done.length) return [t('failTitle'), `${ready} ${t('partial', { clients: list(failed) })}${fix}`]
119
132
  return [t('failTitle'), (reg.error === 'no-node' || reg.error === 'no-clients' ? '' : t('failed')) + fix]
120
133
  }
121
134
 
@@ -161,7 +174,9 @@ window.__ModuleLoader__.load({
161
174
  const nameOf = (sender) => NAMES[sender] ?? sender.charAt(0).toUpperCase() + sender.slice(1)
162
175
 
163
176
  // Sender marks, drawn in the label's text colour like ChatGPT's own "sent from another chat" line.
177
+ // Codex's and Antigravity's are the monochrome marks of lobe-icons (MIT).
164
178
  const MARKS = {
179
+ antigravity: { viewBox: '0 0 24 24', d: 'M21.751 22.607c1.34 1.005 3.35.335 1.508-1.508C17.73 15.74 18.904 1 12.037 1 5.17 1 6.342 15.74.815 21.1c-2.01 2.009.167 2.511 1.507 1.506 5.192-3.517 4.857-9.714 9.715-9.714 4.857 0 4.522 6.197 9.714 9.715z' },
165
180
  claude: { viewBox: '0 0 248 248', d: 'M52.4285 162.873L98.7844 136.879L99.5485 134.602L98.7844 133.334H96.4921L88.7237 132.862L62.2346 132.153L39.3113 131.207L17.0249 130.026L11.4214 128.844L6.2 121.873L6.7094 118.447L11.4214 115.257L18.171 115.847L33.0711 116.911L55.485 118.447L71.6586 119.392L95.728 121.873H99.5485L100.058 120.337L98.7844 119.392L97.7656 118.447L74.5877 102.732L49.4995 86.1905L36.3823 76.62L29.3779 71.7757L25.8121 67.2858L24.2839 57.3608L30.6515 50.2716L39.3113 50.8623L41.4763 51.4531L50.2636 58.1879L68.9842 72.7209L93.4357 90.6804L97.0015 93.6343L98.4374 92.6652L98.6571 91.9801L97.0015 89.2625L83.757 65.2772L69.621 40.8192L63.2534 30.6579L61.5978 24.632C60.9565 22.1032 60.579 20.0111 60.579 17.4246L67.8381 7.49965L71.9133 6.19995L81.7193 7.49965L85.7946 11.0443L91.9074 24.9865L101.714 46.8451L116.996 76.62L121.453 85.4816L123.873 93.6343L124.764 96.1155H126.292V94.6976L127.566 77.9197L129.858 57.3608L132.15 30.8942L132.915 23.4505L136.608 14.4708L143.994 9.62643L149.725 12.344L154.437 19.0788L153.8 23.4505L150.998 41.6463L145.522 70.1215L141.957 89.2625H143.994L146.414 86.7813L156.093 74.0206L172.266 53.698L179.398 45.6635L187.803 36.802L193.152 32.5484H203.34L210.726 43.6549L207.415 55.1159L196.972 68.3492L188.312 79.5739L175.896 96.2095L168.191 109.585L168.882 110.689L170.738 110.53L198.755 104.504L213.91 101.787L231.994 98.7149L240.144 102.496L241.036 106.395L237.852 114.311L218.495 119.037L195.826 123.645L162.07 131.592L161.696 131.893L162.137 132.547L177.36 133.925L183.855 134.279H199.774L229.447 136.524L237.215 141.605L241.8 147.867L241.036 152.711L229.065 158.737L213.019 154.956L175.45 145.977L162.587 142.787H160.805V143.85L171.502 154.366L191.242 172.089L215.82 195.011L217.094 200.682L213.91 205.172L210.599 204.699L188.949 188.394L180.544 181.069L161.696 165.118H160.422V166.772L164.752 173.152L187.803 207.771L188.949 218.405L187.294 221.832L181.308 223.959L174.813 222.777L161.187 203.754L147.305 182.486L136.098 163.345L134.745 164.2L128.075 235.42L125.019 239.082L117.887 241.8L111.902 237.31L108.718 229.984L111.902 215.452L115.722 196.547L118.779 181.541L121.58 162.873L123.291 156.636L123.14 156.219L121.773 156.449L107.699 175.752L86.304 204.699L69.3663 222.777L65.291 224.431L58.2867 220.768L58.9235 214.27L62.8713 208.48L86.304 178.705L100.44 160.155L109.551 149.507L109.462 147.967L108.959 147.924L46.6977 188.512L35.6182 189.93L30.7788 185.44L31.4156 178.115L33.7079 175.752L52.4285 162.873Z' },
166
181
  codex: { viewBox: '0 0 24 24', d: 'M9.20509 8.76514V6.50548C9.20509 6.31517 9.27649 6.17237 9.44293 6.07733L13.9861 3.46091C14.6046 3.10416 15.342 2.93772 16.103 2.93772C18.9573 2.93772 20.7651 5.14986 20.7651 7.50457C20.7651 7.67101 20.7651 7.86132 20.7412 8.05164L16.0316 5.29243C15.7462 5.12599 15.4607 5.12599 15.1753 5.29243L9.20509 8.76514ZM19.8136 17.566V12.1665C19.8136 11.8334 19.6708 11.5955 19.3854 11.4291L13.4152 7.95637L15.3656 6.83836C15.5321 6.74332 15.6749 6.74332 15.8413 6.83836L20.3845 9.45477C21.6928 10.216 22.5728 11.8334 22.5728 13.4032C22.5728 15.2108 21.5025 16.8759 19.8136 17.5657V17.566ZM7.80173 12.8088L5.8513 11.6671C5.68486 11.5721 5.61346 11.4293 5.61346 11.239V6.00616C5.61346 3.46114 7.56389 1.53436 10.2042 1.53436C11.2033 1.53436 12.1307 1.86746 12.9159 2.46205L8.2301 5.17374C7.94475 5.34018 7.80196 5.57801 7.80196 5.91112V12.809L7.80173 12.8088ZM12 15.2349L9.20509 13.6651V10.3352L12 8.76537L14.7947 10.3352V13.6651L12 15.2349ZM13.7958 22.4659C12.7967 22.4659 11.8693 22.1328 11.0841 21.5382L15.7699 18.8265C16.0553 18.6601 16.198 18.4223 16.198 18.0892V11.1912L18.1723 12.3329C18.3388 12.4279 18.4102 12.5707 18.4102 12.7611V17.9939C18.4102 20.5389 16.4359 22.4657 13.7958 22.4657V22.4659ZM8.15848 17.1617L3.61528 14.5453C2.30696 13.784 1.42701 12.1667 1.42701 10.5969C1.42701 8.76537 2.52115 7.12417 4.20987 6.43431V11.8575C4.20987 12.1906 4.35266 12.4284 4.63802 12.5948L10.5846 16.0437L8.63415 17.1617C8.46771 17.2567 8.32492 17.2567 8.15848 17.1617ZM7.897 21.0626C5.20919 21.0626 3.23488 19.0407 3.23488 16.5432C3.23488 16.3529 3.25875 16.1626 3.2824 15.9723L7.96817 18.684C8.25352 18.8504 8.53911 18.8504 8.82447 18.684L14.7947 15.2351V17.4948C14.7947 17.6851 14.7233 17.8279 14.5568 17.9229L10.0136 20.5394C9.39518 20.8961 8.6578 21.0626 7.89677 21.0626H7.897ZM13.7958 23.8929C16.6739 23.8929 19.0762 21.8475 19.6235 19.1358C22.2874 18.4459 24 15.9484 24 13.4034C24 11.7383 23.2865 10.121 22.002 8.95546C22.121 8.45591 22.1924 7.95637 22.1924 7.45705C22.1924 4.05573 19.4331 1.51048 16.2458 1.51048C15.6037 1.51048 14.9852 1.60553 14.3668 1.81971C13.2963 0.773101 11.8215 0.107117 10.2042 0.107117C7.32606 0.107117 4.92383 2.15259 4.37653 4.86428C1.7126 5.55414 0 8.05164 0 10.5967C0 12.2617 0.713506 13.8791 1.99795 15.0446C1.87904 15.5441 1.80764 16.0437 1.80764 16.543C1.80764 19.9443 4.56685 22.4896 7.75421 22.4896C8.39632 22.4896 9.01478 22.3945 9.63324 22.1803C10.7035 23.2269 12.1783 23.8929 13.7958 23.8929Z' },
167
182
  }
package/lib/index.js CHANGED
@@ -258,17 +258,27 @@ export function apply(ctx) {
258
258
  fs.renameSync(tmp, file)
259
259
  }
260
260
 
261
+ // A write refused for a moment (Windows: an antivirus holding the file) is tried again a few
262
+ // times: a record left saying "running" would come back as interrupted after a restart.
263
+ const writeTries = new Map()
261
264
  function flushRuns() {
262
265
  clearTimeout(store.timer)
263
266
  store.timer = null
267
+ const again = new Set()
264
268
  for (const id of store.dirty) {
265
269
  const run = runs.get(id)
266
270
  try {
267
271
  if (run) writeRunFile(run)
268
272
  else fs.rmSync(path.join(store.dir, `${id}.json`), { force: true })
269
- } catch (error) { logError('persist run', error) }
273
+ writeTries.delete(id)
274
+ } catch (error) {
275
+ logError('persist run', error)
276
+ const tries = (writeTries.get(id) ?? 0) + 1
277
+ if (['EPERM', 'EBUSY', 'EACCES'].includes(error?.code) && tries < 5) { writeTries.set(id, tries); again.add(id) } else writeTries.delete(id)
278
+ }
270
279
  }
271
- store.dirty.clear()
280
+ store.dirty = again
281
+ if (again.size) store.timer = setTimeout(guard('persist runs', flushRuns), PERSIST_DELAY_MS)
272
282
  }
273
283
 
274
284
  // Load earlier records. A run that was active when Harness went away cannot
@@ -1222,6 +1232,12 @@ export function apply(ctx) {
1222
1232
  throw new Error(`The folder ${dir}${workspace_id ? ` (workspace ${workspace_id})` : ''} does not exist, so no session was started and nothing was sent. Check the path (a project on an external drive needs that drive connected), or create the folder first.`)
1223
1233
  }
1224
1234
  }
1235
+ // Agent Teams belong to the whole session: changed while a turn runs (for a message that
1236
+ // waits behind it, or one steered into it), they would change that turn too.
1237
+ if (team != null && sessionId) {
1238
+ const busy = activeRunsFor(sessionId).length > 0 || (await sessionActivity(sessionId).catch(() => [])).length > 0
1239
+ if (busy) throw new Error(`No message was sent: the session is busy, and Agent Teams apply to the whole session, so turning them ${team ? 'on' : 'off'} now would change the running turn too. Send it again once the session is idle, or without team.`)
1240
+ }
1225
1241
  const plan = await planModel(sessionId, { model, reasoning_effort })
1226
1242
  const isNew = !sessionId
1227
1243
  if (isNew) {
@@ -1233,12 +1249,6 @@ export function apply(ctx) {
1233
1249
  const chosen = await applyModel(sessionId, plan, isNew).catch((error) => {
1234
1250
  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})`)
1235
1251
  })
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
- }
1242
1252
  // A session that never picked a model runs on Harness's default.
1243
1253
  let provider = chosen.model?.provider
1244
1254
  if (!provider) try { provider = defaultModel()?.currentSelection?.()?.provider } catch { /* unknown: no check */ }
@@ -1246,7 +1256,17 @@ export function apply(ctx) {
1246
1256
  const empty = await emptyBalance()
1247
1257
  if (empty) throw new Error(`${isNew ? `Session ${sessionId} was created, but no message was sent` : 'No message was sent'}: the DeepSeek account has no balance left (${empty}), so the run would fail at once. Do not send again until the user has topped up (Harness → Settings → Account, or platform.deepseek.com).`)
1248
1258
  }
1259
+ // Team mode goes on (or off) before the prompt, so the first step already has the Team tools,
1260
+ // and after the checks that can refuse the send, so a refused send leaves it as it was.
1261
+ if (team != null) {
1262
+ await setTeam(sessionId, team).catch((error) => {
1263
+ 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})`)
1264
+ })
1265
+ }
1249
1266
  const ahead = activeRunsFor(sessionId).map((r) => r.id)
1267
+ // A followup into a busy session waits in its queue, behind our runs or a turn the user
1268
+ // typed in Harness: said back, so the client knows it can still change it.
1269
+ const queuedBehind = !isNew && mode === 'followup' && (ahead.length > 0 || (await sessionActivity(sessionId).catch(() => [])).length > 0)
1250
1270
  const run = {
1251
1271
  id: `hrun-${Date.now().toString(36)}-${crypto.randomBytes(3).toString('hex')}`,
1252
1272
  sessionId, requestId: requestIdFor(sender), ...(sender ? { sender } : {}), mode, state: 'queued', sawPrompt: false,
@@ -1269,6 +1289,7 @@ export function apply(ctx) {
1269
1289
  model_source: chosen.source,
1270
1290
  ...(team != null ? { team } : {}),
1271
1291
  ...(ahead.length ? { other_active_runs: ahead } : {}),
1292
+ ...(queuedBehind ? { queued_behind: true } : {}),
1272
1293
  ...(workspace ? { workspace } : {}),
1273
1294
  }
1274
1295
  }
@@ -1459,7 +1480,7 @@ export function apply(ctx) {
1459
1480
 
1460
1481
 
1461
1482
  // --- MCP registration -----------------------------------------------------
1462
- // Switching the plugin on registers the dsh-baton MCP server for Claude Code and Codex,
1483
+ // Switching the plugin on registers the dsh-baton MCP server for Claude Code, Codex and Antigravity,
1463
1484
  // the same entries `dsh-baton setup` writes, so adding the plugin is the whole install.
1464
1485
  // It runs again on every Harness start: a plugin update brings the server along, and an
1465
1486
  // entry that is already right is left untouched. The Plugins page reads the outcome from
@@ -1512,7 +1533,7 @@ export function apply(ctx) {
1512
1533
  handler: (request, response) => {
1513
1534
  const { state, ok, error, version, runtime, clients = [] } = registration
1514
1535
  response.writeHead(200, { 'content-type': 'application/json', 'cache-control': 'no-store' })
1515
- response.end(JSON.stringify({ version: VERSION, registration: { state, ok, error, version, runtime, clients: clients.map(({ id, label, state }) => ({ id, label, state })) } }))
1536
+ response.end(JSON.stringify({ version: VERSION, registration: { state, ok, error, version, runtime, clients: clients.map(({ id, label, state, error, file }) => ({ id, label, state, ...(error === 'bad-json' ? { error, file } : {}) })) } }))
1516
1537
  },
1517
1538
  }), 'dsh-baton-host status route')
1518
1539
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-baton-host",
3
- "version": "0.6.13",
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.",
3
+ "version": "0.6.14",
4
+ "description": "Hand coding tasks from Claude Code, Codex or Antigravity 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",
7
7
  "exports": {
@@ -20,7 +20,7 @@
20
20
  "LICENSE"
21
21
  ],
22
22
  "dependencies": {
23
- "dsh-baton-mcp": "0.6.13"
23
+ "dsh-baton-mcp": "0.6.14"
24
24
  },
25
25
  "license": "MIT",
26
26
  "dsh": {