tryharness 0.7.53 → 0.7.54

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 (69) hide show
  1. package/README.md +10 -5
  2. package/assets/dsh-plugin.mjs +72 -0
  3. package/assets/opencode-plugin.js +4 -3
  4. package/cli.mjs +115 -36
  5. package/lib/adapters.mjs +157 -222
  6. package/lib/agentRuntimes.mjs +26 -16
  7. package/lib/agentSignIn.mjs +226 -0
  8. package/lib/audit.mjs +643 -0
  9. package/lib/backupSetup.mjs +141 -0
  10. package/lib/boardAccess.mjs +8 -1
  11. package/lib/boardBackup.mjs +283 -0
  12. package/lib/boardMirror.mjs +71 -7
  13. package/lib/boardProtocol.json +59 -2
  14. package/lib/boardWaits.mjs +102 -0
  15. package/lib/book.mjs +659 -0
  16. package/lib/bridge.mjs +1 -1
  17. package/lib/cards.mjs +138 -28
  18. package/lib/cloudBoot.mjs +124 -0
  19. package/lib/commands.mjs +7 -2
  20. package/lib/context.mjs +18 -4
  21. package/lib/contractGate.mjs +377 -0
  22. package/lib/coordinator.mjs +149 -43
  23. package/lib/daemon.mjs +349 -28
  24. package/lib/desk.mjs +239 -0
  25. package/lib/desktop.mjs +106 -6
  26. package/lib/environments.mjs +237 -7
  27. package/lib/folders.mjs +2 -2
  28. package/lib/gitHost.mjs +174 -0
  29. package/lib/hookDialects.mjs +298 -0
  30. package/lib/landed.mjs +887 -0
  31. package/lib/live.mjs +284 -13
  32. package/lib/mcp-stdio.mjs +68 -2
  33. package/lib/members.json +16 -2
  34. package/lib/models.mjs +8 -8
  35. package/lib/museSession.mjs +16 -13
  36. package/lib/nativeHost.mjs +1 -1
  37. package/lib/neovim.mjs +126 -0
  38. package/lib/nudge.mjs +47 -16
  39. package/lib/ownMachines.mjs +343 -39
  40. package/lib/pairing.mjs +27 -10
  41. package/lib/paths.mjs +4 -0
  42. package/lib/personModel.mjs +89 -0
  43. package/lib/phones.mjs +66 -11
  44. package/lib/places.mjs +330 -10
  45. package/lib/readiness.mjs +135 -18
  46. package/lib/record.mjs +115 -0
  47. package/lib/runWorker.mjs +17 -2
  48. package/lib/runner.mjs +8 -4
  49. package/lib/sessionControl.mjs +377 -89
  50. package/lib/specialties.json +74 -0
  51. package/lib/specialties.mjs +477 -0
  52. package/lib/specialtyKeys.d.ts +3 -0
  53. package/lib/specialtyKeys.js +58 -0
  54. package/lib/specialtyNotice.mjs +147 -0
  55. package/lib/specialtySnapshot.mjs +138 -0
  56. package/lib/store.mjs +284 -1
  57. package/lib/swarm.mjs +137 -21
  58. package/lib/t3.mjs +13 -4
  59. package/lib/taskCommands.mjs +36 -9
  60. package/lib/taskRuns.mjs +9 -2
  61. package/lib/team.json +255 -148
  62. package/lib/team.mjs +529 -188
  63. package/lib/threadLine.mjs +116 -0
  64. package/lib/threadRuns.mjs +75 -11
  65. package/lib/threadView.mjs +15 -2
  66. package/lib/worktrees.mjs +51 -13
  67. package/package.json +4 -4
  68. package/lib/modelTiers.json +0 -1183
  69. package/lib/modelTiers.mjs +0 -133
package/lib/adapters.mjs CHANGED
@@ -4,6 +4,12 @@ import path from "node:path";
4
4
  import { detectAgents, run } from "./commands.mjs";
5
5
  import { ensureDir, readJson } from "./files.mjs";
6
6
  import { MACHINE_RUNNERS } from "./members.mjs";
7
+ import {
8
+ HOOK_AGENTS,
9
+ installSessionHooks,
10
+ removeSessionHooks,
11
+ sessionHooksPath,
12
+ } from "./hookDialects.mjs";
7
13
 
8
14
  export const AGENTS = MACHINE_RUNNERS;
9
15
 
@@ -93,13 +99,14 @@ export function mcpClientSnippet({
93
99
  function installAsset(
94
100
  source,
95
101
  target,
96
- { runtimeRoot, nodePath = process.execPath }
102
+ { runtimeRoot, nodePath = process.execPath, agent = "" }
97
103
  ) {
98
104
  ensureDir(path.dirname(target));
99
105
  const text = fs
100
106
  .readFileSync(source, "utf8")
101
107
  .replaceAll('"__HARNESS_RUNTIME__"', JSON.stringify(runtimeRoot))
102
- .replaceAll('"__HARNESS_NODE__"', JSON.stringify(nodePath));
108
+ .replaceAll('"__HARNESS_NODE__"', JSON.stringify(nodePath))
109
+ .replaceAll('"__HARNESS_AGENT__"', JSON.stringify(agent));
103
110
  fs.writeFileSync(target, text, { mode: 0o600 });
104
111
  try {
105
112
  fs.chmodSync(target, 0o600);
@@ -123,188 +130,136 @@ export function integrationAssets(homeDir = os.homedir()) {
123
130
  "plugins",
124
131
  "tryharness.js"
125
132
  ),
133
+ // Kilo, OpenCode's fork, reads plugins from its own folder only.
134
+ kilo: path.join(homeDir, ".config", "kilo", "plugins", "tryharness.js"),
135
+ // DeepSeek Harness loads a plugin named beside the patch file that names it.
136
+ dsh: path.join(dshHome(homeDir), "tryharness-dsh.mjs"),
126
137
  };
127
138
  }
128
139
 
129
- // Claude Code learns about waiting board work through a SessionStart hook whose stdout joins
130
- // its context. The hook is one entry in the user's settings, added once and removed on
131
- // disconnect; every other setting and hook is left as it was.
132
- export function claudeSettingsPath(homeDir = os.homedir()) {
133
- return path.join(homeDir, ".claude", "settings.json");
134
- }
135
- const isHarnessHook = (entry) =>
136
- JSON.stringify(entry).includes("/lib/nudge.mjs");
140
+ const dshHome = (homeDir) => process.env.DSH_HOME || path.join(homeDir, ".dsh");
137
141
 
138
- export function installClaudeSessionHook({
139
- runtimeRoot,
140
- homeDir = os.homedir(),
141
- nodePath = process.execPath,
142
- }) {
143
- const file = claudeSettingsPath(homeDir);
144
- const settings = readJson(file, {});
145
- const hooks =
146
- settings.hooks && typeof settings.hooks === "object" ? settings.hooks : {};
147
- const nudge = JSON.stringify(path.join(runtimeRoot, "lib", "nudge.mjs"));
148
- const starts = (
149
- Array.isArray(hooks.SessionStart) ? hooks.SessionStart : []
150
- ).filter((entry) => !isHarnessHook(entry));
151
- starts.push({
152
- hooks: [
153
- {
154
- type: "command",
155
- command: `${JSON.stringify(nodePath)} ${nudge} --agent claude-code`,
156
- timeout: 10,
157
- },
158
- ],
159
- });
160
- // Mid-session: on every prompt, one line only when the queue changed since the session last saw it.
161
- const prompts = (
162
- Array.isArray(hooks.UserPromptSubmit) ? hooks.UserPromptSubmit : []
163
- ).filter((entry) => !isHarnessHook(entry));
164
- prompts.push({
165
- hooks: [
166
- {
167
- type: "command",
168
- command: `${JSON.stringify(nodePath)} ${nudge} --agent claude-code --if-changed`,
169
- timeout: 10,
170
- },
171
- ],
172
- });
173
- // When a turn ends: a message the person sent this session from Harness keeps it going.
174
- const stops = (Array.isArray(hooks.Stop) ? hooks.Stop : []).filter(
175
- (entry) => !isHarnessHook(entry)
142
+ // DeepSeek Harness has no command that adds an MCP server or a plugin: both are rows in its home-level patch file
143
+ // (~/.dsh/cordis.patch.yml, a YAML list that applies to every profile and that people edit). Harness's rows are one
144
+ // marked block at its end, replaced by setup and taken out by uninstall; the rest of the file is kept as it is.
145
+ const DSH_BEGIN =
146
+ "# tryharness: begin (Harness's board; written and removed by npx tryharness)";
147
+ const DSH_END = "# tryharness: end";
148
+ function withoutDshBlock(text) {
149
+ const start = text.indexOf(DSH_BEGIN);
150
+ const end = text.indexOf(DSH_END);
151
+ if (start < 0 || end < start) return text;
152
+ return (text.slice(0, start) + text.slice(end + DSH_END.length)).replace(
153
+ /\n{3,}/g,
154
+ "\n\n"
176
155
  );
177
- stops.push({
178
- hooks: [
179
- {
180
- type: "command",
181
- command: `${JSON.stringify(nodePath)} ${nudge} --agent claude-code --stop`,
182
- timeout: 10,
183
- },
184
- ],
185
- });
156
+ }
157
+ function writeDshRows(homeDir, { mcpPath } = {}) {
158
+ const file = path.join(dshHome(homeDir), "cordis.patch.yml");
159
+ let text = "";
160
+ try {
161
+ text = fs.readFileSync(file, "utf8");
162
+ } catch {}
163
+ const kept = withoutDshBlock(text).trimEnd();
164
+ const block = mcpPath
165
+ ? [
166
+ DSH_BEGIN,
167
+ "- insert:",
168
+ " - id: harness",
169
+ " name: '@deepseek-ai/dsh-mcp-client'",
170
+ " config:",
171
+ " serverName: harness",
172
+ " transport: stdio",
173
+ ` command: ${JSON.stringify(process.execPath)}`,
174
+ ` args: ${JSON.stringify([mcpPath, "--agent", "dsh"])}`,
175
+ " env: {}",
176
+ " - id: tryharness",
177
+ " name: ./tryharness-dsh.mjs",
178
+ DSH_END,
179
+ ].join("\n")
180
+ : "";
181
+ const next = [kept, block].filter(Boolean).join("\n\n");
182
+ if (!next && !text) return;
186
183
  ensureDir(path.dirname(file));
187
- fs.writeFileSync(
188
- file,
189
- JSON.stringify(
190
- {
191
- ...settings,
192
- hooks: {
193
- ...hooks,
194
- SessionStart: starts,
195
- UserPromptSubmit: prompts,
196
- Stop: stops,
197
- },
198
- },
199
- null,
200
- 2
201
- ) + "\n"
202
- );
184
+ fs.writeFileSync(file, next ? next + "\n" : "");
203
185
  }
204
186
 
205
- // Codex reads the same hook shape from ~/.codex/hooks.json (SessionStart, UserPromptSubmit and Stop,
206
- // stdout added as developer context). Codex asks the person to trust a new or changed hook once,
207
- // with /hooks in its TUI, before it runs; setup says so.
208
- export function codexHooksPath(homeDir = os.homedir()) {
209
- return path.join(homeDir, ".codex", "hooks.json");
210
- }
187
+ export { installSessionHooks, removeSessionHooks, sessionHooksPath };
211
188
 
212
- export function installCodexHooks({
213
- runtimeRoot,
214
- homeDir = os.homedir(),
215
- nodePath = process.execPath,
216
- }) {
217
- const file = codexHooksPath(homeDir);
218
- const settings = readJson(file, {});
219
- const hooks =
220
- settings.hooks && typeof settings.hooks === "object" ? settings.hooks : {};
221
- const nudge = JSON.stringify(path.join(runtimeRoot, "lib", "nudge.mjs"));
222
- const starts = (
223
- Array.isArray(hooks.SessionStart) ? hooks.SessionStart : []
224
- ).filter((entry) => !isHarnessHook(entry));
225
- // After a compaction too: the hook tells the session its work again (compaction.mjs).
226
- starts.push({
227
- matcher: "startup|resume|compact",
228
- hooks: [
229
- {
230
- type: "command",
231
- command: `${JSON.stringify(nodePath)} ${nudge} --agent codex`,
232
- statusMessage: "Reading the Harness board",
233
- timeout: 10,
234
- },
235
- ],
236
- });
237
- const prompts = (
238
- Array.isArray(hooks.UserPromptSubmit) ? hooks.UserPromptSubmit : []
239
- ).filter((entry) => !isHarnessHook(entry));
240
- prompts.push({
241
- hooks: [
242
- {
243
- type: "command",
244
- command: `${JSON.stringify(nodePath)} ${nudge} --agent codex --if-changed`,
245
- timeout: 10,
246
- },
247
- ],
248
- });
249
- const stops = (Array.isArray(hooks.Stop) ? hooks.Stop : []).filter(
250
- (entry) => !isHarnessHook(entry)
251
- );
252
- stops.push({
253
- hooks: [
254
- {
255
- type: "command",
256
- command: `${JSON.stringify(nodePath)} ${nudge} --agent codex --stop`,
257
- timeout: 10,
258
- },
259
- ],
260
- });
189
+ // How Harness's MCP server goes into each hook agent's own config (its session hooks: hookDialects.mjs). By the
190
+ // agent's own command (`remove` first, so setup replaces an older entry), or, where it has no command for it, in its
191
+ // config file. Setup's line about it, when there is more to say than that it is configured.
192
+ const MCP_SETUP = {
193
+ // Other agents start the servers in Claude Code's config too (nudge.mjs startedByAnother).
194
+ "claude-code": {
195
+ remove: ["mcp", "remove", "--scope", "user", "harness"],
196
+ add: ["mcp", "add", "--scope", "user", "harness"],
197
+ flags: ["--check-host"],
198
+ },
199
+ codex: {
200
+ remove: ["mcp", "remove", "harness"],
201
+ add: ["mcp", "add", "harness"],
202
+ note: "in Codex run /hooks once to trust them",
203
+ },
204
+ "grok-build": {
205
+ remove: ["mcp", "remove", "--scope", "user", "harness"],
206
+ add: ["mcp", "add", "--scope", "user", "harness"],
207
+ },
208
+ copilot: {
209
+ remove: ["mcp", "remove", "harness"],
210
+ add: ["mcp", "add", "harness"],
211
+ },
212
+ devin: {
213
+ remove: ["mcp", "remove", "harness", "--scope", "user"],
214
+ add: ["mcp", "add", "--scope", "user", "harness"],
215
+ },
216
+ // Cursor's CLI documents no command to add one, and asks before a new server runs: `mcp enable` approves it. Grok
217
+ // Build starts the servers in Cursor's file too (nudge.mjs startedByAnother).
218
+ cursor: {
219
+ file: (home) => path.join(home, ".cursor", "mcp.json"),
220
+ entry: { type: "stdio" },
221
+ flags: ["--check-host"],
222
+ enable: ["mcp", "enable", "harness"],
223
+ },
224
+ antigravity: {
225
+ file: (home) => path.join(home, ".gemini", "config", "mcp_config.json"),
226
+ },
227
+ };
228
+
229
+ function writeMcpEntry(file, entry) {
230
+ const config = readJson(file, {});
231
+ const servers = { ...(config.mcpServers ?? {}) };
232
+ if (entry) servers.harness = entry;
233
+ else if (!servers.harness) return;
234
+ else delete servers.harness;
261
235
  ensureDir(path.dirname(file));
262
236
  fs.writeFileSync(
263
237
  file,
264
- JSON.stringify(
265
- {
266
- ...settings,
267
- hooks: {
268
- ...hooks,
269
- SessionStart: starts,
270
- UserPromptSubmit: prompts,
271
- Stop: stops,
272
- },
273
- },
274
- null,
275
- 2
276
- ) + "\n"
238
+ JSON.stringify({ ...config, mcpServers: servers }, null, 2) + "\n"
277
239
  );
278
240
  }
279
241
 
280
- export function removeCodexHooks(homeDir = os.homedir()) {
281
- const file = codexHooksPath(homeDir);
282
- const settings = readJson(file, null);
283
- if (!settings?.hooks) return;
284
- const hooks = { ...settings.hooks };
285
- for (const event of ["SessionStart", "UserPromptSubmit", "Stop"]) {
286
- if (Array.isArray(hooks[event]))
287
- hooks[event] = hooks[event].filter((entry) => !isHarnessHook(entry));
242
+ /** Harness's MCP server in a hook agent's own config: the command's result, or the file written. */
243
+ function addMcpServer(agent, executable, { mcpPath, homeDir, execute }) {
244
+ const setup = MCP_SETUP[agent];
245
+ const server = [mcpPath, "--agent", agent, ...(setup.flags ?? [])];
246
+ if (setup.file) {
247
+ writeMcpEntry(setup.file(homeDir), {
248
+ ...setup.entry,
249
+ command: process.execPath,
250
+ args: server,
251
+ });
252
+ if (setup.enable) execute(executable, setup.enable);
253
+ return { ok: true };
288
254
  }
289
- fs.writeFileSync(
290
- file,
291
- JSON.stringify({ ...settings, hooks }, null, 2) + "\n"
292
- );
255
+ execute(executable, setup.remove);
256
+ return execute(executable, [...setup.add, "--", process.execPath, ...server]);
293
257
  }
294
258
 
295
- export function removeClaudeSessionHook(homeDir = os.homedir()) {
296
- const file = claudeSettingsPath(homeDir);
297
- const settings = readJson(file, null);
298
- if (!settings?.hooks) return;
299
- const hooks = { ...settings.hooks };
300
- for (const event of ["SessionStart", "UserPromptSubmit", "Stop"]) {
301
- if (Array.isArray(hooks[event]))
302
- hooks[event] = hooks[event].filter((entry) => !isHarnessHook(entry));
303
- }
304
- fs.writeFileSync(
305
- file,
306
- JSON.stringify({ ...settings, hooks }, null, 2) + "\n"
307
- );
259
+ function removeMcpServer(agent, executable, { homeDir, execute }) {
260
+ const setup = MCP_SETUP[agent];
261
+ if (setup.file) writeMcpEntry(setup.file(homeDir), null);
262
+ else execute(executable, setup.remove);
308
263
  }
309
264
 
310
265
  export function configureAgents({
@@ -338,61 +293,26 @@ export function configureAgents({
338
293
  });
339
294
  continue;
340
295
  }
341
- if (agent === "claude-code") {
342
- execute(found.path, ["mcp", "remove", "--scope", "user", "harness"]);
343
- const added = execute(found.path, [
344
- "mcp",
345
- "add",
346
- "--scope",
347
- "user",
348
- "harness",
349
- "--",
350
- process.execPath,
296
+ if (HOOK_AGENTS.includes(agent)) {
297
+ const added = addMcpServer(agent, found.path, {
351
298
  mcpPath,
352
- "--agent",
353
- agent,
354
- ]);
355
- let hooked = true;
356
- try {
357
- installClaudeSessionHook({ runtimeRoot, homeDir });
358
- } catch {
359
- hooked = false;
360
- }
361
- states.push({
362
- agent,
363
- installed: true,
364
- configured: added.ok,
365
- detail: added.ok
366
- ? hooked
367
- ? "MCP and session-start nudge configured"
368
- : "MCP configured; the session-start hook could not be written"
369
- : diagnostic(added),
299
+ homeDir,
300
+ execute,
370
301
  });
371
- } else if (agent === "codex") {
372
- execute(found.path, ["mcp", "remove", "harness"]);
373
- const added = execute(found.path, [
374
- "mcp",
375
- "add",
376
- "harness",
377
- "--",
378
- process.execPath,
379
- mcpPath,
380
- "--agent",
381
- agent,
382
- ]);
383
302
  let hooked = true;
384
303
  try {
385
- installCodexHooks({ runtimeRoot, homeDir });
304
+ installSessionHooks(agent, { runtimeRoot, homeDir });
386
305
  } catch {
387
306
  hooked = false;
388
307
  }
308
+ const note = MCP_SETUP[agent].note;
389
309
  states.push({
390
310
  agent,
391
311
  installed: true,
392
312
  configured: added.ok,
393
313
  detail: added.ok
394
314
  ? hooked
395
- ? "MCP and session hooks configured; in Codex run /hooks once to trust them"
315
+ ? `MCP and session hooks configured${note ? `; ${note}` : ""}`
396
316
  : "MCP configured; the session hooks could not be written"
397
317
  : diagnostic(added),
398
318
  });
@@ -409,11 +329,11 @@ export function configureAgents({
409
329
  configured: fs.existsSync(assets.pi),
410
330
  detail: "extension installed",
411
331
  });
412
- } else if (agent === "opencode") {
332
+ } else if (agent === "opencode" || agent === "kilo") {
413
333
  installAsset(
414
334
  path.join(runtimeRoot, "assets", "opencode-plugin.js"),
415
- assets.opencode,
416
- { runtimeRoot }
335
+ assets[agent],
336
+ { runtimeRoot, agent }
417
337
  );
418
338
  // The same stdio server as Claude Code and Codex. opencode has no `mcp remove`; `mcp add` replaces the entry.
419
339
  const added = execute(found.path, [
@@ -434,6 +354,19 @@ export function configureAgents({
434
354
  ? "MCP and plugin configured"
435
355
  : `plugin installed; MCP: ${diagnostic(added)}`,
436
356
  });
357
+ } else if (agent === "dsh") {
358
+ installAsset(
359
+ path.join(runtimeRoot, "assets", "dsh-plugin.mjs"),
360
+ assets.dsh,
361
+ { runtimeRoot }
362
+ );
363
+ writeDshRows(homeDir, { mcpPath });
364
+ states.push({
365
+ agent,
366
+ installed: true,
367
+ configured: true,
368
+ detail: "MCP and plugin configured",
369
+ });
437
370
  } else {
438
371
  states.push({
439
372
  agent,
@@ -457,23 +390,25 @@ export function removeAgentConfigurations({
457
390
  execute = run,
458
391
  } = {}) {
459
392
  for (const found of detected) {
460
- if (!found.path) continue;
461
- if (found.agent === "claude-code") {
462
- execute(found.path, ["mcp", "remove", "--scope", "user", "harness"]);
463
- removeClaudeSessionHook(homeDir);
464
- } else if (found.agent === "codex") {
465
- execute(found.path, ["mcp", "remove", "harness"]);
466
- removeCodexHooks(homeDir);
467
- }
393
+ if (!found.path || !HOOK_AGENTS.includes(found.agent)) continue;
394
+ removeMcpServer(found.agent, found.path, { homeDir, execute });
395
+ removeSessionHooks(found.agent, homeDir);
468
396
  }
469
- // opencode has no `mcp remove`, so its entry comes out of the config file `mcp add` wrote it to.
470
- for (const name of ["opencode.json", "opencode.jsonc"]) {
471
- const file = path.join(homeDir, ".config", "opencode", name);
397
+ // opencode and Kilo have no `mcp remove`, so the entry comes out of the config file `mcp add` wrote it to.
398
+ for (const file of [
399
+ ...["opencode.json", "opencode.jsonc"].map((name) =>
400
+ path.join(homeDir, ".config", "opencode", name)
401
+ ),
402
+ ...["kilo.json", "kilo.jsonc", "opencode.json", "opencode.jsonc"].map(
403
+ (name) => path.join(homeDir, ".config", "kilo", name)
404
+ ),
405
+ ]) {
472
406
  const config = readJson(file, null);
473
407
  if (!config?.mcp?.harness) continue;
474
408
  delete config.mcp.harness;
475
409
  fs.writeFileSync(file, JSON.stringify(config, null, 2) + "\n");
476
410
  }
411
+ writeDshRows(homeDir);
477
412
  const assets = integrationAssets(homeDir);
478
413
  for (const target of Object.values(assets)) {
479
414
  try {
@@ -259,30 +259,40 @@ async function runAcp(task, runtime, hooks) {
259
259
  terminal: false,
260
260
  },
261
261
  });
262
- if (task.sessionId && !initialized.agentCapabilities?.loadSession)
262
+ // An existing session is loaded (its history replayed) or, where the agent offers only that, resumed without its
263
+ // history (session/resume, as DeepSeek Harness's ACP does).
264
+ const capabilities = initialized.agentCapabilities ?? {};
265
+ const reopen = !task.sessionId
266
+ ? "session/new"
267
+ : capabilities.loadSession
268
+ ? "session/load"
269
+ : capabilities.sessionCapabilities?.resume
270
+ ? "session/resume"
271
+ : null;
272
+ if (!reopen)
263
273
  throw new Error(
264
274
  "This ACP agent cannot resume its existing session; Harness did not start a replacement."
265
275
  );
266
276
  const args = {
267
277
  cwd: task.cwd,
268
- mcpServers: [
269
- {
270
- name: "harness",
271
- command: process.execPath,
272
- args: [
273
- fileURLToPath(new URL("./mcp-stdio.mjs", import.meta.url)),
274
- "--agent",
275
- task.agent,
278
+ // A readiness check (readiness.mjs) runs without Harness's tools.
279
+ mcpServers: task.withoutHarnessTools
280
+ ? []
281
+ : [
282
+ {
283
+ name: "harness",
284
+ command: process.execPath,
285
+ args: [
286
+ fileURLToPath(new URL("./mcp-stdio.mjs", import.meta.url)),
287
+ "--agent",
288
+ task.agent,
289
+ ],
290
+ env: [{ name: "HARNESS_RUN_ID", value: task.runId }],
291
+ },
276
292
  ],
277
- env: [{ name: "HARNESS_RUN_ID", value: task.runId }],
278
- },
279
- ],
280
293
  ...(task.sessionId ? { sessionId: task.sessionId } : {}),
281
294
  };
282
- const session = await connection.agent.request(
283
- task.sessionId ? "session/load" : "session/new",
284
- args
285
- );
295
+ const session = await connection.agent.request(reopen, args);
286
296
  sessionId = task.sessionId || session.sessionId;
287
297
  if (!sessionId)
288
298
  throw new Error("The ACP agent did not identify its session.");