tryharness 0.7.72 → 0.7.75

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 (51) hide show
  1. package/assets/opencode-plugin.js +70 -3
  2. package/assets/pi-extension.ts +7 -1
  3. package/cli.mjs +2 -2
  4. package/lib/asks.mjs +2 -0
  5. package/lib/boardCommands.mjs +9 -1
  6. package/lib/boardProtocol.json +23 -19
  7. package/lib/bridge.mjs +2 -0
  8. package/lib/capabilityCheck.mjs +86 -0
  9. package/lib/computerAddress.mjs +6 -14
  10. package/lib/coordinator.mjs +220 -35
  11. package/lib/daemon.mjs +160 -126
  12. package/lib/dispatchContract.json +1 -31
  13. package/lib/dispatchTools.js +8 -39
  14. package/lib/dispatches.mjs +27 -285
  15. package/lib/goalCommands.mjs +7 -3
  16. package/lib/herdr.mjs +159 -0
  17. package/lib/hookDialects.mjs +36 -2
  18. package/lib/jobAnswers.mjs +3 -0
  19. package/lib/kanban.mjs +256 -0
  20. package/lib/library.mjs +83 -7
  21. package/lib/localAgentAsk.mjs +20 -29
  22. package/lib/localStack.mjs +19 -3
  23. package/lib/machineRoutes.mjs +1 -5
  24. package/lib/manager.mjs +254 -0
  25. package/lib/mcp-stdio.mjs +72 -46
  26. package/lib/moves.mjs +365 -0
  27. package/lib/nudge.mjs +18 -3
  28. package/lib/ownMachines.mjs +43 -6
  29. package/lib/places.mjs +29 -2
  30. package/lib/runAuthority.mjs +2 -14
  31. package/lib/runBrief.mjs +14 -1
  32. package/lib/runWorker.mjs +4 -10
  33. package/lib/runner.mjs +1 -49
  34. package/lib/sessionControl.mjs +65 -1
  35. package/lib/steerHook.mjs +124 -0
  36. package/lib/steerQueue.mjs +176 -0
  37. package/lib/store.mjs +20 -29
  38. package/lib/subagentSteering.mjs +363 -0
  39. package/lib/subagents.mjs +138 -29
  40. package/lib/swarm.mjs +16 -6
  41. package/lib/taskCommands.mjs +0 -62
  42. package/lib/threadActions.mjs +4 -2
  43. package/lib/threadBriefs.mjs +9 -3
  44. package/lib/threadRuns.mjs +13 -0
  45. package/npm-shrinkwrap.json +14 -14
  46. package/package.json +4 -4
  47. package/release.json +48 -44
  48. package/lib/comfyExecution.mjs +0 -545
  49. package/lib/promptDecider.mjs +0 -471
  50. package/lib/promptFlow.mjs +0 -597
  51. package/lib/promptScopes.mjs +0 -670
@@ -11,6 +11,14 @@ const RUNTIME = "__HARNESS_RUNTIME__";
11
11
  const AGENT = "__HARNESS_AGENT__";
12
12
  const harness = () =>
13
13
  import(pathToFileURL(path.join(RUNTIME, "lib", "nudge.mjs")).href);
14
+ // What the person tells a subagent from Harness waits in steerQueue.mjs for that session's next tool call.
15
+ let queue = null;
16
+ const steering = () =>
17
+ (queue ??= import(
18
+ pathToFileURL(path.join(RUNTIME, "lib", "steerQueue.mjs")).href
19
+ ).catch(() => null));
20
+ // When OpenCode's client cannot take the message, a note rides on what the tool returns instead.
21
+ const notes = new Map();
14
22
  const socketPath = async () =>
15
23
  (await import(pathToFileURL(path.join(RUNTIME, "lib", "paths.mjs")).href))
16
24
  .paths.socket;
@@ -46,6 +54,35 @@ const partId = () => {
46
54
  };
47
55
 
48
56
  export const TryHarnessPlugin = async ({ directory, client }) => ({
57
+ // An OpenCode subagent is a session of its own, so the person's word for it waits under that session. A note or a new
58
+ // brief goes in as the person's next message, which OpenCode queues for a session at work and the model reads as the
59
+ // person's own (words added to a tool's result are read as the tool's, Claude Code showed). A stop refuses every call
60
+ // with the reason until the session goes idle.
61
+ "tool.execute.before": async (input) => {
62
+ const steer = input?.sessionID ? await steering() : null;
63
+ if (!steer) return;
64
+ const items = steer.takeSteers(input.sessionID, steer.PARENT, {
65
+ tool: input.tool ?? null,
66
+ });
67
+ if (!items.length) return;
68
+ const text = steer.steerText(items);
69
+ if (items.some((item) => item.kind === "stop")) throw new Error(text);
70
+ const send =
71
+ client?.session?.promptAsync?.bind(client.session) ??
72
+ client?.session?.prompt?.bind(client.session);
73
+ if (send)
74
+ await send({
75
+ path: { id: input.sessionID },
76
+ body: { parts: [{ type: "text", text }] },
77
+ }).catch(() => notes.set(input.callID, text));
78
+ else notes.set(input.callID, text);
79
+ },
80
+ "tool.execute.after": async (input, output) => {
81
+ const text = notes.get(input?.callID);
82
+ if (!text || !output) return;
83
+ notes.delete(input.callID);
84
+ output.output = `${output.output ?? ""}\n\n${text}`;
85
+ },
49
86
  // A session's first message is its start (Claude Code's SessionStart: the whole board); each later one carries the
50
87
  // board again only when it changed (UserPromptSubmit).
51
88
  "chat.message": async (input, output) => {
@@ -92,12 +129,19 @@ export const TryHarnessPlugin = async ({ directory, client }) => ({
92
129
  const send =
93
130
  client?.session?.promptAsync?.bind(client.session) ??
94
131
  client?.session?.prompt?.bind(client.session);
95
- if (messages.length && send)
132
+ const steerWords = await leftSteers(client, sessionId);
133
+ const text = [
134
+ messages.length ? board.messagesText(messages) : "",
135
+ steerWords,
136
+ ]
137
+ .filter(Boolean)
138
+ .join("\n\n");
139
+ if (text && send)
96
140
  await send({
97
141
  path: { id: sessionId },
98
- body: { parts: [{ type: "text", text: board.messagesText(messages) }] },
142
+ body: { parts: [{ type: "text", text }] },
99
143
  }).catch(() => {});
100
- else if (board && !messages.length)
144
+ else if (board && !text)
101
145
  await board.noteTurn(
102
146
  AGENT,
103
147
  { session_id: sessionId, cwd: directory },
@@ -105,3 +149,26 @@ export const TryHarnessPlugin = async ({ directory, client }) => ({
105
149
  );
106
150
  },
107
151
  });
152
+
153
+ // A session went idle: a stop for it is spent. A word the person sent a subagent that finished before reading it goes to
154
+ // the session that started the subagent, which has its answer now; one for a session of the person's own is its next
155
+ // turn (returned, for the caller to send).
156
+ async function leftSteers(client, sessionId) {
157
+ const steer = await steering();
158
+ const left = steer
159
+ ? steer.endSteers(sessionId, steer.PARENT, { event: "end" })
160
+ : [];
161
+ if (!left.length) return "";
162
+ const got = await client?.session
163
+ ?.get?.({ path: { id: sessionId } })
164
+ .catch(() => null);
165
+ const info = got?.data ?? got;
166
+ if (!info?.parentID) return steer.steerText(left);
167
+ steer.putSteer({
168
+ session: info.parentID,
169
+ agent: steer.PARENT,
170
+ kind: "parent",
171
+ text: `Your subagent "${info.title ?? sessionId}" finished before it read what they sent it, so it is yours to act on:\n\n${left.map((item) => item.text).join("\n\n")}`,
172
+ });
173
+ return "";
174
+ }
@@ -208,7 +208,13 @@ export default function tryHarness(pi) {
208
208
  const board = await harness().catch(() => null);
209
209
  if (!board) return undefined;
210
210
  await board.notePrompt(AGENT, where(ctx), pids);
211
- const text = [await said(board, ctx), await board.boardNudge(AGENT)]
211
+ // What every agent with an MCP client reads in the handshake, then the queue. An older runtime has no
212
+ // HARNESS_INSTRUCTIONS and gives the queue alone.
213
+ const text = [
214
+ await said(board, ctx),
215
+ board.HARNESS_INSTRUCTIONS,
216
+ await board.boardNudge(AGENT),
217
+ ]
212
218
  .filter(Boolean)
213
219
  .join("\n\n");
214
220
  if (!text || typeof event?.systemPrompt !== "string") return undefined;
package/cli.mjs CHANGED
@@ -1832,7 +1832,7 @@ async function swarm() {
1832
1832
  }
1833
1833
  for (const d of response.days)
1834
1834
  console.log(
1835
- `${d.day} ${String(d.rounds).padStart(4)} rounds: Harness ${d.harness}, backup ${d.backup}, this computer ${d.local}, undecided ${d.undecided}`
1835
+ `${d.day} ${String(d.rounds).padStart(4)} rounds: Jev ${d.jev}, backup ${d.backup}, this computer ${d.local}, undecided ${d.undecided}`
1836
1836
  );
1837
1837
  return;
1838
1838
  }
@@ -2682,7 +2682,7 @@ function installedLine() {
2682
2682
 
2683
2683
  function help() {
2684
2684
  console.log(
2685
- `tryharness ${VERSION}\n\n${installedLine()}Commands:\n tryharness set up everything and start the daemon\n tryharness upgrade [version] fetch a newer release, check it is signed with Harness's release key, then set it up\n tryharness desktop open the Harness desktop app (setup opens it too; --no-desktop skips it)\n tryharness status show daemon, bridge, agent, and index health\n tryharness doctor diagnose the complete connection\n tryharness local [learn] the relay's local models, where they run, what is indexed and the last learning\n tryharness local on|off search over your Desktop, Documents and Downloads by what is in the files (on by default)\n tryharness local add|remove <folder> another folder to search the same way\n tryharness watch [add <name> --run <command> [--every 5m] [--field f | --age f | --count text] [--above n] [--below n] | start <id> | remove <id>]\n watches the relay checks and says out loud only when they are off\n tryharness sync [--agent] rescan local coding history in the background\n tryharness task <id> --follow\n follow a delegated agent run in this terminal\n tryharness runs what your agents are running on this computer now\n tryharness steer <thread or run> "<words>" [--agent <agent>]\n tell an agent something while it works\n tryharness ssh [<cloud computer>] [--key <file>] [--print] [-- <command>]\n SSH into your cloud computer with your own key; it wakes if asleep\n tryharness board [--all] list open work on the machine's task board\n tryharness board post --for <agent> --objective <text> [--file <brief.md>]\n tryharness board show <id>\n tryharness board post --for codex --objective <text> --run --workspace <dir>\n the daemon runs it and reports back on the task\n tryharness board run <id> authorize a run an agent asked for\n tryharness board release <id>\n tryharness board agents when each agent last read the board\n tryharness board --watch follow the board in this terminal\n tryharness notify on|off desktop notifications for what waits on you\n tryharness usage-totals on|off daily counts of your swarm's work, without your account or any text (on by default)\n tryharness board send <task> <message> send a held reply to another person's agent\n tryharness board snippet [<id> share|keep] code an agent elsewhere asked to see; nothing leaves until you share it\n tryharness board auto <task> on|off auto-send replies on that thread\n tryharness board end <task> --outcome <text>\n tryharness board context <task> <query> search everything written about a task\n tryharness goal set --objective <text> [--team a,b] [--workspace <dir>] a goal your agents work together in one room\n tryharness goal [list | show <id> | stop <id> | resume <id>]\n tryharness room <goal> | room post <goal> <text> [--ask agent,agent]\n tryharness swarm rounds [<thread>] what the coordinator saw, chose and cost each round\n tryharness swarm health [<thread>] who decided each day's rounds: Harness, a backup, or no one\n tryharness swarm ceiling <thread> <dollars|off> what a thread may spend of your Harness credits\n tryharness swarm checkin <thread> "<what>" (--in 2h | --at 14:30 | --every 30m | --daily 09:00 [--days mon-fri]) [--wake codex] [--times n] [--until <date>]\n the thread comes back on its own then, waking those agents or its lead\n tryharness swarm checkins [<thread>] [--all] | swarm checkin remove <id>\n tryharness swarm coordinator [harness|local] who coordinates your threads\n tryharness connect <handle/agent> --about <text> ask another person's agent to work an issue with yours, sealed to their computer\n tryharness peers the keys of other people's computers this one has worked with, to compare\n tryharness machines your computers: which holds the board (home) and which work through it; machines add <code> [--hosted] | name <name> | home | update <name> [version] | remove <name>\n tryharness backup [on | now | restore | off] an encrypted backup of your board, for Residents; only your passphrase opens it\n tryharness agents who is in your swarm, and who can be added\n tryharness agents add [<agent>…] put agents in your swarm; with no name, pick from the ones found here\n tryharness agents remove <agent> take an agent out of your swarm\n tryharness agents confirm <agent> the program Harness starts for an agent, after you install it somewhere new\n tryharness agents setup [<agent>] | agents test <agent> how Harness wakes each agent\n tryharness agents cards what each of your agents is told about the others\n tryharness agents note <agent> <text> [--clear] your own note on an agent's card, told to every other agent\n tryharness lessons [--replaced | --retired] | lessons remove <id> | lessons edit <id> "<text>"\n what your swarm learned from your words, to read, change or take out\n tryharness memory [dream | forget <id> | delete <post id> | back <id>]\n what your swarm keeps from its work, overnight; forget, delete or bring back\n tryharness agents models [<agent>] [--refresh] the models each coding agent lists and the one it runs on\n tryharness agents model <agent> <model> [--effort <level>] | auto | default the model it runs on; auto lets Harness pick per run\n tryharness agents routing "<text>" [--clear] how Auto picks models for your swarm\n tryharness connections on|off outside apps (Gmail, Calendar, Slack, Notion, Linear) for your agents; off by default\n tryharness connections connect apps, choose agent access and review approvals (connections catalog for providers)\n tryharness vault your secrets, kept on this computer: agents use them without seeing them (vault add <name> --hosts <host> | allow <agent> <name> | runs <agent> <name> <VARIABLE> | backup <email> | share <name>)\n tryharness mcp grok-bot print the MCP snippet that puts Grok Bot on the board\n tryharness link connect the browser you use Harness in to this computer, end to end (--print shows the link)\n tryharness phone pair show a QR code that pairs your phone with this computer\n tryharness phone list | revoke <id>\n tryharness t3 approve Harness in T3 Code once, so your messages go into its threads (t3 status | t3 forget)\n tryharness logs [--follow]\n tryharness uninstall [--everything] take Harness off this computer; --everything also deletes your board and history\n`
2685
+ `tryharness ${VERSION}\n\n${installedLine()}Commands:\n tryharness set up everything and start the daemon\n tryharness upgrade [version] fetch a newer release, check it is signed with Harness's release key, then set it up\n tryharness desktop open the Harness desktop app (setup opens it too; --no-desktop skips it)\n tryharness status show daemon, bridge, agent, and index health\n tryharness doctor diagnose the complete connection\n tryharness local [learn] the relay's local models, where they run, what is indexed and the last learning\n tryharness local on|off search over your Desktop, Documents and Downloads by what is in the files (on by default)\n tryharness local add|remove <folder> another folder to search the same way\n tryharness watch [add <name> --run <command> [--every 5m] [--field f | --age f | --count text] [--above n] [--below n] | start <id> | remove <id>]\n watches the relay checks and says out loud only when they are off\n tryharness sync [--agent] rescan local coding history in the background\n tryharness task <id> --follow\n follow a delegated agent run in this terminal\n tryharness runs what your agents are running on this computer now\n tryharness steer <thread or run> "<words>" [--agent <agent>]\n tell an agent something while it works\n tryharness ssh [<cloud computer>] [--key <file>] [--print] [-- <command>]\n SSH into your cloud computer with your own key; it wakes if asleep\n tryharness board [--all] list open work on the machine's task board\n tryharness board post --for <agent> --objective <text> [--file <brief.md>]\n tryharness board show <id>\n tryharness board post --for codex --objective <text> --run --workspace <dir>\n the daemon runs it and reports back on the task\n tryharness board run <id> authorize a run an agent asked for\n tryharness board release <id>\n tryharness board agents when each agent last read the board\n tryharness board --watch follow the board in this terminal\n tryharness notify on|off desktop notifications for what waits on you\n tryharness usage-totals on|off daily counts of your swarm's work, without your account or any text (on by default)\n tryharness board send <task> <message> send a held reply to another person's agent\n tryharness board snippet [<id> share|keep] code an agent elsewhere asked to see; nothing leaves until you share it\n tryharness board auto <task> on|off auto-send replies on that thread\n tryharness board end <task> --outcome <text>\n tryharness board context <task> <query> search everything written about a task\n tryharness goal set --objective <text> [--team a,b] [--workspace <dir>] a goal your agents work together in one room\n tryharness goal [list | show <id> | stop <id> | resume <id>]\n tryharness room <goal> | room post <goal> <text> [--ask agent,agent]\n tryharness swarm rounds [<thread>] what the coordinator saw, chose and cost each round\n tryharness swarm health [<thread>] who decided each day's rounds: Jev, a backup, or no one\n tryharness swarm ceiling <thread> <dollars|off> what a thread may spend of your Harness credits\n tryharness swarm checkin <thread> "<what>" (--in 2h | --at 14:30 | --every 30m | --daily 09:00 [--days mon-fri]) [--wake codex] [--times n] [--until <date>]\n the thread comes back on its own then, waking those agents or its lead\n tryharness swarm checkins [<thread>] [--all] | swarm checkin remove <id>\n tryharness swarm coordinator [harness|local] who coordinates your threads\n tryharness connect <handle/agent> --about <text> ask another person's agent to work an issue with yours, sealed to their computer\n tryharness peers the keys of other people's computers this one has worked with, to compare\n tryharness machines your computers: which holds the board (home) and which work through it; machines add <code> [--hosted] | name <name> | home | update <name> [version] | remove <name>\n tryharness backup [on | now | restore | off] an encrypted backup of your board, for Residents; only your passphrase opens it\n tryharness agents who is in your swarm, and who can be added\n tryharness agents add [<agent>…] put agents in your swarm; with no name, pick from the ones found here\n tryharness agents remove <agent> take an agent out of your swarm\n tryharness agents confirm <agent> the program Harness starts for an agent, after you install it somewhere new\n tryharness agents setup [<agent>] | agents test <agent> how Harness wakes each agent\n tryharness agents cards what each of your agents is told about the others\n tryharness agents note <agent> <text> [--clear] your own note on an agent's card, told to every other agent\n tryharness lessons [--replaced | --retired] | lessons remove <id> | lessons edit <id> "<text>"\n what your swarm learned from your words, to read, change or take out\n tryharness memory [dream | forget <id> | delete <post id> | back <id>]\n what your swarm keeps from its work, overnight; forget, delete or bring back\n tryharness agents models [<agent>] [--refresh] the models each coding agent lists and the one it runs on\n tryharness agents model <agent> <model> [--effort <level>] | auto | default the model it runs on; auto lets Harness pick per run\n tryharness agents routing "<text>" [--clear] how Auto picks models for your swarm\n tryharness connections on|off outside apps (Gmail, Calendar, Slack, Notion, Linear) for your agents; off by default\n tryharness connections connect apps, choose agent access and review approvals (connections catalog for providers)\n tryharness vault your secrets, kept on this computer: agents use them without seeing them (vault add <name> --hosts <host> | allow <agent> <name> | runs <agent> <name> <VARIABLE> | backup <email> | share <name>)\n tryharness mcp grok-bot print the MCP snippet that puts Grok Bot on the board\n tryharness link connect the browser you use Harness in to this computer, end to end (--print shows the link)\n tryharness phone pair show a QR code that pairs your phone with this computer\n tryharness phone list | revoke <id>\n tryharness t3 approve Harness in T3 Code once, so your messages go into its threads (t3 status | t3 forget)\n tryharness logs [--follow]\n tryharness uninstall [--everything] take Harness off this computer; --everything also deletes your board and history\n`
2686
2686
  );
2687
2687
  }
2688
2688
 
package/lib/asks.mjs CHANGED
@@ -152,6 +152,8 @@ export function createAsks({
152
152
  if (sent?.pending) await sent.pending;
153
153
  else if (!sent?.ok)
154
154
  throw Object.assign(new Error(sent?.error), { refused: connected() });
155
+ // The agent's newest task on Harness's server in this thread, by the ask's own id: what a stop ends (moves.mjs).
156
+ store.meta(`hosted-ask:${thread.id}:${ask.agent}`, ask.id);
155
157
  forget(thread.id, ask.id);
156
158
  } catch (error) {
157
159
  const tries = (ask.tries ?? 0) + 1;
@@ -9,6 +9,8 @@ export function createBoardCommands({
9
9
  handlers,
10
10
  task,
11
11
  machineOf = () => null,
12
+ // What a feature's answer becomes before the caller has it; a pending answer is passed on once it settles.
13
+ answered = (request, answer) => answer,
12
14
  }) {
13
15
  return (request) => {
14
16
  if (!validAgent(request.agent))
@@ -25,6 +27,12 @@ export function createBoardCommands({
25
27
  const context = { agent, id, expected, machine };
26
28
  const owner = boardCommandOwner(String(request.command));
27
29
  const handler = Object.hasOwn(handlers, owner) ? handlers[owner] : task;
28
- return handler(request, context);
30
+ const answer = handler(request, context);
31
+ return answer?.pending
32
+ ? {
33
+ ...answer,
34
+ pending: answer.pending.then((settled) => answered(request, settled)),
35
+ }
36
+ : answered(request, answer);
29
37
  };
30
38
  }
@@ -22,12 +22,6 @@
22
22
  "board.dispatch.scope.list": "task",
23
23
  "board.dispatch.scope.revoke": "task",
24
24
  "board.dispatch.propose": "task",
25
- "board.dispatch.prompt": "task",
26
- "board.prompt.start": "task",
27
- "board.prompt.status": "task",
28
- "board.prompt.cancel": "task",
29
- "board.prompt.receipt": "task",
30
- "board.dispatch.workspace": "task",
31
25
  "board.dispatch.view": "task",
32
26
  "board.dispatch.apply": "task",
33
27
  "board.dispatch.advisory": "task",
@@ -68,6 +62,7 @@
68
62
  "board.media.search": "tools",
69
63
  "board.notices.take": "watch",
70
64
  "board.place.op": "place",
65
+ "board.kanban.update": "kanban",
71
66
  "board.plan.add": "plans",
72
67
  "board.plan.edit": "plans",
73
68
  "board.plan.remove": "plans",
@@ -214,7 +209,9 @@
214
209
  "board.native.decide": "nativeRequests",
215
210
  "board.swarm.links": "swarm",
216
211
  "board.swarm.link": "swarm",
217
- "board.wait": "waits"
212
+ "board.wait": "waits",
213
+ "board.subagent.read": "subagents",
214
+ "board.subagent.steer": "subagents"
218
215
  },
219
216
  "families": [
220
217
  {
@@ -229,6 +226,10 @@
229
226
  "owner": "landed",
230
227
  "prefixes": ["board.landed."]
231
228
  },
229
+ {
230
+ "owner": "subagents",
231
+ "prefixes": ["board.subagent."]
232
+ },
232
233
  {
233
234
  "owner": "relay",
234
235
  "prefixes": ["board.relay."]
@@ -257,6 +258,10 @@
257
258
  "owner": "plans",
258
259
  "prefixes": ["board.plan.", "board.template."]
259
260
  },
261
+ {
262
+ "owner": "kanban",
263
+ "prefixes": ["board.kanban."]
264
+ },
260
265
  {
261
266
  "owner": "projects",
262
267
  "prefixes": ["board.project."]
@@ -284,6 +289,8 @@
284
289
  ],
285
290
  "access": {
286
291
  "phone": [
292
+ "board.subagent.read",
293
+ "board.subagent.steer",
287
294
  "board.list",
288
295
  "board.get",
289
296
  "board.children",
@@ -342,6 +349,7 @@
342
349
  "board.swarm.link",
343
350
  "board.vault.allow",
344
351
  "board.vault.dismiss",
352
+ "board.kanban.update",
345
353
  "board.plan.add",
346
354
  "board.plan.edit",
347
355
  "board.plan.remove",
@@ -376,12 +384,11 @@
376
384
  "board.swarm.specialty",
377
385
  "board.swarm.pin",
378
386
  "board.swarm.offices",
379
- "board.swarm.office",
380
- "board.prompt.start",
381
- "board.prompt.status",
382
- "board.prompt.cancel"
387
+ "board.swarm.office"
383
388
  ],
384
389
  "browserPerson": [
390
+ "board.subagent.read",
391
+ "board.subagent.steer",
385
392
  "board.list",
386
393
  "board.get",
387
394
  "board.children",
@@ -501,10 +508,7 @@
501
508
  "board.vault.share",
502
509
  "board.vault.unshare",
503
510
  "board.vault.import",
504
- "board.vault.allow",
505
- "board.prompt.start",
506
- "board.prompt.status",
507
- "board.prompt.cancel"
511
+ "board.vault.allow"
508
512
  ],
509
513
  "harnessBrowser": [
510
514
  "board.list",
@@ -591,6 +595,8 @@
591
595
  "board.room.search"
592
596
  ],
593
597
  "desktop": [
598
+ "board.subagent.read",
599
+ "board.subagent.steer",
594
600
  "board.audit.week",
595
601
  "board.desk.book",
596
602
  "board.desk.contract",
@@ -674,6 +680,7 @@
674
680
  "board.relay.seen",
675
681
  "board.relay.defaults",
676
682
  "board.relay.peers",
683
+ "board.kanban.update",
677
684
  "board.plan.add",
678
685
  "board.plan.edit",
679
686
  "board.plan.remove",
@@ -763,10 +770,7 @@
763
770
  "board.wait",
764
771
  "board.landed.thread",
765
772
  "board.landed.folder",
766
- "board.landed.open",
767
- "board.prompt.start",
768
- "board.prompt.status",
769
- "board.prompt.cancel"
773
+ "board.landed.open"
770
774
  ],
771
775
  "plainPerson": ["board.standing.off"],
772
776
  "plainHarnessReads": [
package/lib/bridge.mjs CHANGED
@@ -31,6 +31,8 @@ const SCRUBBED = new Set([
31
31
  "harness_task",
32
32
  "harness_steer",
33
33
  "coordinate",
34
+ // The swarm's manager (manager.mjs): what the person's message is, and where their asks stand.
35
+ "manage",
34
36
  "pick_folder",
35
37
  "route_model",
36
38
  "check_work",
@@ -0,0 +1,86 @@
1
+ import { askLocalAgent, LOCAL_DECIDERS } from "./localAgentAsk.mjs";
2
+
3
+ // The capability check (owner, November 1): when work comes in, each of the person's computers is asked whether it
4
+ // can do that specific work, and an agent there looks at what the computer has. The coordinator gives the answers to
5
+ // Jev with each agent's computers, so routing goes by what each computer can actually do rather than a fixed list of
6
+ // features any one person's machines happen to have.
7
+
8
+ const ANSWERS = ["yes", "no", "unknown"];
9
+
10
+ const question = (label, work) =>
11
+ [
12
+ `You are checking the computer "${label}" for the person who owns it. Their swarm of agents may send the work below to this computer.`,
13
+ "Look at this computer to see whether it can do that work: what is installed, set up and available here that the work needs. Change nothing.",
14
+ 'Answer with only this JSON: {"answer": "yes" | "no" | "unknown", "why": "one sentence naming what you found"}.',
15
+ "",
16
+ "The work:",
17
+ work,
18
+ ].join("\n");
19
+
20
+ const unknown = (why) => ({ answer: "unknown", why });
21
+
22
+ /** An agent's reply as an answer, or unknown when it is not one. */
23
+ const shaped = (reply) =>
24
+ ANSWERS.includes(reply?.answer) && typeof reply.why === "string"
25
+ ? { answer: reply.answer, why: reply.why.slice(0, 300) }
26
+ : unknown("the check did not answer in the agreed shape");
27
+
28
+ export function createCapabilityCheck({
29
+ machine,
30
+ installedAgents,
31
+ // The person's other computers (ownMachines.mjs), read when a check runs: they connect after this is made.
32
+ ownMachines = () => null,
33
+ log,
34
+ ask = askLocalAgent,
35
+ }) {
36
+ /** This computer's answer for `work`, from the first agent here that can look. */
37
+ const answer = async (work) => {
38
+ const agent = LOCAL_DECIDERS.find((id) => installedAgents.includes(id));
39
+ if (!agent) return unknown("no agent on this computer can look");
40
+ try {
41
+ return shaped(
42
+ await ask(agent, question(machine().label, String(work)), {
43
+ look: true,
44
+ })
45
+ );
46
+ } catch (error) {
47
+ log(`capability check: ${error.message}`);
48
+ return unknown(`the check failed: ${error.message}`);
49
+ }
50
+ };
51
+
52
+ /** Every online computer's answer for `work`, this one included: [{ id, label, answer, why }]. */
53
+ const check = async (work) => {
54
+ const here = machine();
55
+ const own = ownMachines();
56
+ const others = (own?.all() ?? []).filter(
57
+ (computer) => computer.id !== here.id && computer.connected
58
+ );
59
+ // With no other computer online there is no choice of computer to make.
60
+ if (!others.length) return [];
61
+ const asked = [
62
+ answer(work).then((found) => ({
63
+ id: here.id,
64
+ label: here.label,
65
+ ...found,
66
+ })),
67
+ ...others.map(async (computer) => {
68
+ if (computer.unanswered)
69
+ return {
70
+ id: computer.id,
71
+ label: computer.label,
72
+ ...unknown("it did not answer its last request from home"),
73
+ };
74
+ const reply = await own.capabilityOf(computer.id, work);
75
+ return {
76
+ id: computer.id,
77
+ label: computer.label,
78
+ ...(reply ? shaped(reply) : unknown("the computer did not answer")),
79
+ };
80
+ }),
81
+ ];
82
+ return Promise.all(asked);
83
+ };
84
+
85
+ return { answer, check };
86
+ }
@@ -53,16 +53,12 @@ export function computerAddress({
53
53
  text,
54
54
  computers,
55
55
  target = null,
56
- recipient = null,
57
56
  agentOf = (name) => name,
58
57
  }) {
59
58
  const refuse = (error) => ({ ok: false, error });
60
- const original = String(text ?? "");
61
- // A task already names its recipient in a typed field; "On pop-os: ..." is the same address without repeating @agent.
62
- const words =
63
- recipient && /^\s*on\s+/i.test(original)
64
- ? `@${recipient} ${original.trimStart()}`
65
- : original;
59
+ // Only explicit addresses are read here: #computer, `@agent on computer` and a typed computer. Whether plain words
60
+ // ("On pop-os: ...") mean a computer is the coordinator's judgment (Jev), never a pattern (owner, November 1).
61
+ const words = String(text ?? "");
66
62
  let typed = null;
67
63
  if (target != null && String(target).trim()) {
68
64
  const wanted = String(target).trim();
@@ -118,13 +114,9 @@ export function computerAddress({
118
114
  const after = words.slice(match.index + match[0].length);
119
115
  const found = computersAtStart(after, computers);
120
116
  if (!found.length) {
121
- // A # or a computer-shaped handle makes an unknown address explicit. A plain phrase before a colon can be
122
- // ordinary prose ("on this:", "On Monday:"), so it does not choose or refuse a computer.
123
- const unknown = after.match(/^([\w.-]+(?: [\w.-]+)*):(?:\s|$)/)?.[1];
124
- const explicit =
125
- match[0].endsWith("#") ||
126
- (unknown && /^[\w.-]+$/.test(unknown) && /[-._\d]/.test(unknown));
127
- if (several && unknown && explicit)
117
+ // "@agent on #name" with no such computer is an explicit address to a computer that does not exist.
118
+ const unknown = after.match(/^[\w.-]+/)?.[0];
119
+ if (several && unknown && match[0].endsWith("#"))
128
120
  return refuse(
129
121
  `No computer is called "${unknown}". Your computers: ${listOf(computers)}.`
130
122
  );