tryharness 0.7.53 → 0.7.57

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 (167) hide show
  1. package/README.md +23 -19
  2. package/assets/dsh-plugin.mjs +72 -0
  3. package/assets/opencode-plugin.js +4 -3
  4. package/cli.mjs +484 -90
  5. package/lib/activity.mjs +10 -10
  6. package/lib/adapters.mjs +173 -222
  7. package/lib/agentBinaries.mjs +71 -0
  8. package/lib/agentRuntimeConfig.mjs +1 -1
  9. package/lib/agentRuntimes.mjs +34 -18
  10. package/lib/agentSignIn.mjs +456 -0
  11. package/lib/answers.mjs +5 -5
  12. package/lib/archetypes.d.ts +64 -0
  13. package/lib/archetypes.js +989 -0
  14. package/lib/asks.mjs +4 -4
  15. package/lib/audit.mjs +666 -0
  16. package/lib/backupSetup.mjs +143 -0
  17. package/lib/boardAccess.mjs +24 -11
  18. package/lib/boardBackup.mjs +283 -0
  19. package/lib/boardFileCommands.mjs +6 -6
  20. package/lib/boardFiles.mjs +13 -12
  21. package/lib/boardMirror.mjs +124 -25
  22. package/lib/boardProtocol.json +88 -2
  23. package/lib/boardWaits.mjs +101 -0
  24. package/lib/book.mjs +659 -0
  25. package/lib/bridge.mjs +6 -6
  26. package/lib/cards.mjs +138 -28
  27. package/lib/cloudAgents.mjs +216 -0
  28. package/lib/cloudAi.mjs +1312 -0
  29. package/lib/cloudAssistants.mjs +242 -0
  30. package/lib/cloudBoot.mjs +119 -0
  31. package/lib/cloudSave.mjs +197 -0
  32. package/lib/cloudSsh.mjs +178 -0
  33. package/lib/commands.mjs +7 -2
  34. package/lib/context.mjs +19 -5
  35. package/lib/contractGate.mjs +399 -0
  36. package/lib/control-client.mjs +9 -1
  37. package/lib/controlSocket.mjs +86 -0
  38. package/lib/coordinator.mjs +252 -144
  39. package/lib/daemon.mjs +1351 -2767
  40. package/lib/desk.mjs +240 -0
  41. package/lib/desktop.mjs +178 -74
  42. package/lib/directLink.mjs +16 -5
  43. package/lib/environment.mjs +2 -1
  44. package/lib/environments.mjs +247 -9
  45. package/lib/firewall.mjs +9 -9
  46. package/lib/folders.mjs +20 -16
  47. package/lib/frames.mjs +2 -3
  48. package/lib/gitHost.mjs +174 -0
  49. package/lib/goalCommands.mjs +25 -7
  50. package/lib/goals.mjs +7 -7
  51. package/lib/guestRequests.mjs +94 -0
  52. package/lib/handoffs.mjs +8 -7
  53. package/lib/handover.mjs +4 -4
  54. package/lib/harnessModel.mjs +6 -6
  55. package/lib/harnessOffers.mjs +266 -0
  56. package/lib/hookDialects.mjs +298 -0
  57. package/lib/inference.mjs +26 -8
  58. package/lib/jobAnswers.mjs +190 -0
  59. package/lib/landed.mjs +887 -0
  60. package/lib/lane.mjs +42 -11
  61. package/lib/lessons.mjs +16 -16
  62. package/lib/library.mjs +3 -3
  63. package/lib/lineup.mjs +3 -0
  64. package/lib/linkRelay.mjs +574 -0
  65. package/lib/live.mjs +284 -13
  66. package/lib/localAgentAsk.mjs +74 -0
  67. package/lib/localStack.mjs +536 -0
  68. package/lib/localmodels.mjs +6 -4
  69. package/lib/loopBackstop.mjs +4 -4
  70. package/lib/machineIdentity.mjs +9 -1
  71. package/lib/machineRoutes.mjs +181 -2
  72. package/lib/machineRuns.mjs +76 -1
  73. package/lib/machineSeal.mjs +39 -12
  74. package/lib/mcp-stdio.mjs +163 -27
  75. package/lib/mcpRelay.mjs +1 -1
  76. package/lib/members.json +29 -2
  77. package/lib/members.mjs +1 -1
  78. package/lib/models.mjs +85 -31
  79. package/lib/museSession.mjs +21 -13
  80. package/lib/nativeHost.mjs +36 -8
  81. package/lib/neovim.mjs +126 -0
  82. package/lib/network.mjs +50 -5
  83. package/lib/notify.mjs +7 -5
  84. package/lib/nudge.mjs +50 -19
  85. package/lib/ocr.mjs +9 -9
  86. package/lib/onboard.mjs +26 -20
  87. package/lib/oneLine.mjs +7 -7
  88. package/lib/ownMachines.mjs +1223 -140
  89. package/lib/pairing.mjs +60 -16
  90. package/lib/paths.mjs +19 -1
  91. package/lib/peerProcess.mjs +124 -0
  92. package/lib/personModel.mjs +89 -0
  93. package/lib/personNotices.mjs +151 -0
  94. package/lib/phones.mjs +538 -31
  95. package/lib/placeCommands.mjs +4 -4
  96. package/lib/places.mjs +400 -12
  97. package/lib/profile.mjs +67 -14
  98. package/lib/projectGit.mjs +158 -14
  99. package/lib/projectPieces.mjs +902 -0
  100. package/lib/projectSettings.mjs +7 -4
  101. package/lib/projects.mjs +384 -62
  102. package/lib/provenance.mjs +5 -1
  103. package/lib/proxyLinks.mjs +267 -0
  104. package/lib/reactions.mjs +7 -5
  105. package/lib/readiness.mjs +145 -23
  106. package/lib/record.mjs +128 -0
  107. package/lib/redact.mjs +4 -4
  108. package/lib/relayLimits.mjs +62 -0
  109. package/lib/release.mjs +170 -0
  110. package/lib/releaseKeys.json +6 -0
  111. package/lib/repoLinks.mjs +4 -4
  112. package/lib/roomChannels.mjs +24 -0
  113. package/lib/roomPage.mjs +1 -1
  114. package/lib/runAuthority.mjs +101 -0
  115. package/lib/runBrief.mjs +19 -8
  116. package/lib/runWorker.mjs +31 -7
  117. package/lib/runner.mjs +223 -29
  118. package/lib/runtime-install.mjs +143 -9
  119. package/lib/schedules.mjs +2 -2
  120. package/lib/screens.mjs +1 -1
  121. package/lib/sealed.mjs +11 -2
  122. package/lib/sealedThreads.mjs +671 -0
  123. package/lib/secretPatterns.json +1 -1
  124. package/lib/secrets.mjs +4 -4
  125. package/lib/seen.mjs +6 -6
  126. package/lib/serverWords.mjs +175 -0
  127. package/lib/service.mjs +22 -12
  128. package/lib/sessionControl.mjs +378 -90
  129. package/lib/specialties.json +74 -0
  130. package/lib/specialties.mjs +477 -0
  131. package/lib/specialtyKeys.d.ts +3 -0
  132. package/lib/specialtyKeys.js +57 -0
  133. package/lib/specialtyNotice.mjs +147 -0
  134. package/lib/specialtySnapshot.mjs +138 -0
  135. package/lib/speech.mjs +5 -5
  136. package/lib/store.mjs +420 -36
  137. package/lib/stuck.mjs +1 -1
  138. package/lib/swarm.mjs +304 -37
  139. package/lib/swarmDevices.mjs +319 -0
  140. package/lib/swarmMemory.mjs +27 -25
  141. package/lib/t3.mjs +24 -15
  142. package/lib/taskCommands.mjs +80 -20
  143. package/lib/taskRooms.mjs +125 -0
  144. package/lib/taskRuns.mjs +45 -3
  145. package/lib/team.json +255 -148
  146. package/lib/team.mjs +554 -190
  147. package/lib/threadActions.mjs +315 -0
  148. package/lib/threadAuthority.mjs +101 -0
  149. package/lib/threadBriefs.mjs +178 -0
  150. package/lib/threadLine.mjs +116 -0
  151. package/lib/threadRuns.mjs +209 -50
  152. package/lib/threadView.mjs +20 -7
  153. package/lib/usageTotals.mjs +2 -3
  154. package/lib/vault.mjs +101 -10
  155. package/lib/vaultCloud.mjs +2 -2
  156. package/lib/vaultCommands.mjs +15 -6
  157. package/lib/vaultTools.js +2 -2
  158. package/lib/verdicts.mjs +328 -0
  159. package/lib/wakes.mjs +1 -1
  160. package/lib/watches.mjs +2 -2
  161. package/lib/windowAsks.mjs +13 -5
  162. package/lib/worktrees.mjs +157 -25
  163. package/npm-shrinkwrap.json +1093 -0
  164. package/package.json +12 -11
  165. package/release.json +220 -0
  166. package/lib/modelTiers.json +0 -1183
  167. package/lib/modelTiers.mjs +0 -133
@@ -0,0 +1,174 @@
1
+ import { spawn } from "node:child_process";
2
+ import { resolveCommand } from "./commands.mjs";
3
+
4
+ // Where a repository's work is out in the world: its git host's pages, read from the remote's address, and (on GitHub)
5
+ // its pull requests through the person's own `gh` sign-in. Nothing here signs in or keeps a token of its own.
6
+
7
+ const HOSTS = [
8
+ { host: "github.com", kind: "github", name: "GitHub" },
9
+ { host: "gitlab.com", kind: "gitlab", name: "GitLab" },
10
+ { host: "bitbucket.org", kind: "bitbucket", name: "Bitbucket" },
11
+ ];
12
+
13
+ /**
14
+ * The web home of a remote (`git@github.com:acme/widgets.git`, `https://github.com/acme/widgets`, `ssh://...`): its
15
+ * host, its owner/name path and the page that shows it. Null for a remote with no web page (a folder, a bare path).
16
+ */
17
+ export function remoteWeb(remote) {
18
+ const text = String(remote || "").trim();
19
+ const scp = /^[\w.-]+@([\w.-]+):(.+)$/.exec(text);
20
+ const url = scp
21
+ ? { host: scp[1], path: scp[2] }
22
+ : (() => {
23
+ try {
24
+ const parsed = new URL(text);
25
+ if (!["https:", "http:", "ssh:", "git:"].includes(parsed.protocol))
26
+ return null;
27
+ return { host: parsed.hostname, path: parsed.pathname };
28
+ } catch {
29
+ return null;
30
+ }
31
+ })();
32
+ if (!url?.host) return null;
33
+ const slug = url.path.replace(/^\/+|\/+$/g, "").replace(/\.git$/, "");
34
+ if (!slug.includes("/")) return null;
35
+ const known = HOSTS.find((entry) => entry.host === url.host);
36
+ return {
37
+ kind: known?.kind ?? "other",
38
+ name: known?.name ?? url.host,
39
+ slug,
40
+ web: `https://${url.host}/${slug}`,
41
+ };
42
+ }
43
+
44
+ /** The page that shows a pull request's changes, on the host that has it. */
45
+ export function changesPage(host, request) {
46
+ if (host.kind === "gitlab") return `${request.url}/diffs`;
47
+ if (host.kind === "bitbucket") return `${request.url}/diff`;
48
+ return `${request.url}/files`;
49
+ }
50
+
51
+ /** The page that shows one commit, on the host that has it. */
52
+ export function commitPage(host, sha) {
53
+ if (host.kind === "gitlab") return `${host.web}/-/commit/${sha}`;
54
+ if (host.kind === "bitbucket") return `${host.web}/commits/${sha}`;
55
+ return `${host.web}/commit/${sha}`;
56
+ }
57
+
58
+ // A branch name keeps its slashes in a page's address; anything else in it is escaped.
59
+ const inPath = (branch) =>
60
+ String(branch).split("/").map(encodeURIComponent).join("/");
61
+
62
+ /** The page comparing a pushed branch with the branch it would go into, for a branch with no pull request. */
63
+ export function comparePage(host, base, branch) {
64
+ if (host.kind === "gitlab")
65
+ return `${host.web}/-/compare/${base}...${inPath(branch)}`;
66
+ if (host.kind === "bitbucket")
67
+ return `${host.web}/branches/compare/${encodeURIComponent(branch)}%0D${base}`;
68
+ return `${host.web}/compare/${base}...${inPath(branch)}`;
69
+ }
70
+
71
+ const FIELDS =
72
+ "number,title,state,isDraft,url,headRefName,author,createdAt,mergedAt,updatedAt";
73
+ // Measured on a Mac: `gh pr list --limit 100` took 301-918 ms (32 runs over three repositories, the busiest cli/cli and
74
+ // vercel/next.js) and `gh pr view` 347-790 ms (10 runs). Ten seconds is about ten times the slowest; past it the board
75
+ // says GitHub did not answer rather than waiting on it.
76
+ const GH_DEADLINE_MS = 10_000;
77
+ const LIST_FRESH_MS = 60_000;
78
+ const ONE_FRESH_MS = 5 * 60_000;
79
+
80
+ /** A pull request as the board shows it: what it is, where it stands, whose branch. */
81
+ const requestOf = (row) => ({
82
+ number: row.number,
83
+ title: row.title,
84
+ state: row.state === "OPEN" && row.isDraft ? "DRAFT" : row.state,
85
+ url: row.url,
86
+ branch: row.headRefName,
87
+ author: row.author?.login ?? null,
88
+ createdAt: row.createdAt ?? null,
89
+ mergedAt: row.mergedAt || null,
90
+ updatedAt: row.updatedAt ?? null,
91
+ });
92
+
93
+ /**
94
+ * GitHub's pull requests through `gh`, kept a minute (a single one five) so a surface reading the board every few
95
+ * seconds asks GitHub at most once a minute. `answer` is how the board says it could not ask.
96
+ */
97
+ export function createGithub({ log = () => {} } = {}) {
98
+ const kept = new Map();
99
+ const ask = (args) =>
100
+ new Promise((resolve) => {
101
+ const gh = resolveCommand("gh");
102
+ if (!gh) return resolve({ ok: false, answer: "no_gh" });
103
+ const child = spawn(gh, args, {
104
+ env: { ...process.env, GH_PROMPT_DISABLED: "1", NO_COLOR: "1" },
105
+ stdio: ["ignore", "pipe", "pipe"],
106
+ });
107
+ let out = "";
108
+ let err = "";
109
+ const timer = setTimeout(() => child.kill("SIGTERM"), GH_DEADLINE_MS);
110
+ child.stdout.on("data", (chunk) => (out += chunk));
111
+ child.stderr.on("data", (chunk) => (err += chunk));
112
+ child.on("error", () => {
113
+ clearTimeout(timer);
114
+ resolve({ ok: false, answer: "no_gh" });
115
+ });
116
+ child.on("close", (code, signal) => {
117
+ clearTimeout(timer);
118
+ if (code === 0) {
119
+ try {
120
+ return resolve({ ok: true, value: JSON.parse(out || "null") });
121
+ } catch {}
122
+ }
123
+ const said = err.trim().split("\n")[0];
124
+ if (signal) log(`gh did not answer in ${GH_DEADLINE_MS / 1000}s`);
125
+ else if (said) log(`gh: ${said}`);
126
+ resolve({
127
+ ok: false,
128
+ answer: signal
129
+ ? "slow"
130
+ : /auth login|not logged|authentication/i.test(err)
131
+ ? "signed_out"
132
+ : /could not resolve to a/i.test(err)
133
+ ? "missing"
134
+ : "error",
135
+ });
136
+ });
137
+ });
138
+ const cached = (key, freshMs, fetch) => {
139
+ const entry = kept.get(key);
140
+ if (entry && Date.now() - entry.at < freshMs) return entry.value;
141
+ const value = fetch();
142
+ kept.set(key, { at: Date.now(), value });
143
+ return value;
144
+ };
145
+
146
+ return {
147
+ /** The repository's hundred most recent pull requests, open, merged and closed. */
148
+ list: (slug) =>
149
+ cached(`list:${slug}`, LIST_FRESH_MS, () =>
150
+ ask([
151
+ "pr",
152
+ "list",
153
+ "-R",
154
+ slug,
155
+ "--state",
156
+ "all",
157
+ "--limit",
158
+ "100",
159
+ "--json",
160
+ FIELDS,
161
+ ]).then((reply) =>
162
+ reply.ok ? { ok: true, requests: reply.value.map(requestOf) } : reply
163
+ )
164
+ ),
165
+ /** One pull request by its number, for one a thread named that is older than the list reaches. */
166
+ one: (slug, number) =>
167
+ cached(`one:${slug}#${number}`, ONE_FRESH_MS, () =>
168
+ ask(["pr", "view", String(number), "-R", slug, "--json", FIELDS]).then(
169
+ (reply) =>
170
+ reply.ok ? { ok: true, request: requestOf(reply.value) } : reply
171
+ )
172
+ ),
173
+ };
174
+ }
@@ -8,7 +8,8 @@ import { provenanceFor } from "./provenance.mjs";
8
8
  import { TAGGED_ONLY, nameOf } from "./members.mjs";
9
9
  import { picksIn } from "./models.mjs";
10
10
  import { roomPage } from "./roomPage.mjs";
11
- import { withComputer } from "./machineRoutes.mjs";
11
+ import { FROM_MACHINE, withComputer } from "./machineRoutes.mjs";
12
+ import { callerLimit } from "./runAuthority.mjs";
12
13
 
13
14
  export function createGoalCommands({
14
15
  DEFAULT_MAX_POSTS,
@@ -20,6 +21,8 @@ export function createGoalCommands({
20
21
  endGuestThreads,
21
22
  getFirewall,
22
23
  flagNote,
24
+ // A post's words as an agent reads them (serverWords.mjs agentText); the person reads every post as written.
25
+ agentText = (post) => post.text,
23
26
  heardPerson,
24
27
  inRoom,
25
28
  localEvent,
@@ -66,7 +69,7 @@ export function createGoalCommands({
66
69
  if (!objective) return { ok: false, error: "a goal needs an objective" };
67
70
  // With no team, the agents the person named that can work here; the coordinator brings in the rest as it hands
68
71
  // out work. Never every agent the relay knows: that put Bankr, Quotient and agents never installed into an
69
- // @swarm thread (October 18).
72
+ // @swarm thread.
70
73
  const reachable = available();
71
74
  const team =
72
75
  Array.isArray(request.team) && request.team.length
@@ -102,7 +105,9 @@ export function createGoalCommands({
102
105
  objective,
103
106
  brief: String(request.brief || "").slice(0, 200000),
104
107
  originAgent: agent,
105
- provenance: provenanceFor(agent),
108
+ provenance: provenanceFor(agent, null, null, {
109
+ viaServer: request.hostedCaller === true,
110
+ }),
106
111
  team: team.includes(facilitator) ? team : [...team, facilitator],
107
112
  facilitator,
108
113
  workspace: workspace && path.resolve(workspace),
@@ -117,7 +122,9 @@ export function createGoalCommands({
117
122
  text: request.brief ? `${objective}\n\n${request.brief}` : objective,
118
123
  mentions: [facilitator],
119
124
  });
120
- wakeFor(goal.id, post, agent);
125
+ wakeFor(goal.id, post, agent, undefined, {
126
+ window: request.fromWindow === true,
127
+ });
121
128
  notifyBoard(store.getTask(goal.id));
122
129
  return { ok: true, task: store.getTask(goal.id) };
123
130
  }
@@ -138,7 +145,10 @@ export function createGoalCommands({
138
145
  // A post as a reader gets it: which of the person's computers its agent wrote from, when they have several, and
139
146
  // the guard's flag.
140
147
  const readable = (post) => {
141
- const placed = withComputer(post, computerOf);
148
+ const placed = withComputer(
149
+ agent === "user" ? post : { ...post, text: agentText(post) },
150
+ computerOf
151
+ );
142
152
  return flagNote(post)
143
153
  ? {
144
154
  ...placed,
@@ -167,7 +177,7 @@ export function createGoalCommands({
167
177
  return { ok: false, error: `${agent} is not on this goal's team` };
168
178
  if (!teams) return { ok: false, error: "the daemon is still starting" };
169
179
  // A note goes to every agent of the swarm, so it is checked like a post: never a secret, never orders to the
170
- // swarm (it was kept unchecked until October 22, when notes became the swarm's shared memory).
180
+ // swarm (notes are the swarm's shared memory).
171
181
  const said = `${request.text ?? ""}\n${request.reason ?? ""}`;
172
182
  const flag = secretReason(said);
173
183
  if (flag)
@@ -347,7 +357,13 @@ export function createGoalCommands({
347
357
  return { ok: true, post, paused: true };
348
358
  }
349
359
  const told = wakeFor(goal.id, post, agent, wakes, {
350
- hosted: request.hostedCaller === true,
360
+ // An agent's words from another of the person's computers carry no go here, as through Harness (M1).
361
+ hosted:
362
+ request.hostedCaller === true ||
363
+ (request[FROM_MACHINE] !== undefined &&
364
+ !["user", "harness"].includes(agent)),
365
+ limited: callerLimit(request),
366
+ window: request.fromWindow === true,
351
367
  guard: verdict ?? {
352
368
  score: null,
353
369
  verdict: "clean",
@@ -457,6 +473,8 @@ export function createGoalCommands({
457
473
  about: `Goal: ${goal.objective}`.slice(0, 500),
458
474
  brief,
459
475
  refs: [],
476
+ // A guest whose computer has no key gets a readable invitation only when the person said so (--readable).
477
+ readable: request.readable === true,
460
478
  }).then((response) => {
461
479
  if (!response.ok)
462
480
  throw new Error(response.error || "the invitation was refused");
package/lib/goals.mjs CHANGED
@@ -1,9 +1,9 @@
1
- // A thread's goal (owner, October 15: "very little plumbing on evaluating whether that goal has been reached… no
2
- // mechanism to update the goal by whoever is leading the swarm"). The thread's title is only its first line; the goal is
3
- // the whole aim in the person's terms, the checks that show it is reached, and where it stands. The lead drafts it from
4
- // the person's words, writes a new version when the person changes what they want, and marks each check reached with
5
- // the posts that show it. Every version stays, with the post that caused it. A version can say what the work is for, never
6
- // what it may spend or do: those stay the person's own limits.
1
+ // A thread's goal, so that whether it has been reached can be judged and whoever leads the swarm can update it. The
2
+ // thread's title is only its first line; the goal is the whole aim in the person's terms, the checks that show it is
3
+ // reached, and where it stands. The lead drafts it from the person's words, writes a new version when the person
4
+ // changes what they want, and marks each check reached with the posts that show it. Every version stays, with the post
5
+ // that caused it. A version can say what the work is for, never what it may spend or do: those stay the person's own
6
+ // limits.
7
7
 
8
8
  const KEY = (threadId) => `goal-record:${threadId}`;
9
9
  const MAX_CRITERIA = 12;
@@ -150,7 +150,7 @@ export function createGoals({ store, notifyBoard = () => {} }) {
150
150
  });
151
151
  const allMet = criteria.every((criterion) => criterion.status !== "open");
152
152
  // Met, or ready for the person's review, only when every check is reached: a round that says so early leaves it
153
- // working (October 19: "Ready for your review" with one of three checks met).
153
+ // working (a round once said "Ready for your review" with one of three checks met).
154
154
  const state = STATES.includes(goalState)
155
155
  ? goalState !== "working" && !allMet
156
156
  ? "working"
@@ -0,0 +1,94 @@
1
+ import { t3GuestRequests, t3Link } from "./places.mjs";
2
+
3
+ // T3 Code's guest links (beta, October 2026) let someone without T3 follow one of the person's threads and send
4
+ // messages into it; each waits for the person's Send or Dismiss in T3, and a Send runs it with the thread's permission
5
+ // mode, which can be full access. T3 asks the person to check the words first. This reads each waiting message with the
6
+ // guard on this computer (firewall.mjs), so a guest's words never leave it, and puts the message, the guard's verdict
7
+ // and what a Send would run it with where the person sees what waits on them. Send and Dismiss stay in T3.
8
+
9
+ /**
10
+ * What waits on the person from T3 guests: `refresh` reads T3's record again and has the guard read each new
11
+ * message; `needsOf` is a thread's waiting messages as needs-you items. `changed` hears when either moved.
12
+ */
13
+ export function createGuestRequests({
14
+ guard,
15
+ log = () => {},
16
+ changed = () => {},
17
+ read = () => t3GuestRequests(),
18
+ linkOf = (threadId) => t3Link(threadId),
19
+ }) {
20
+ let waiting = new Map();
21
+ // The guard's reading of each message, by its id: a message's words never change while it waits.
22
+ const verdicts = new Map();
23
+ let refreshing = null;
24
+ let said = "";
25
+
26
+ const tell = () => {
27
+ const now = JSON.stringify([[...waiting], [...verdicts]]);
28
+ if (now === said) return;
29
+ said = now;
30
+ changed();
31
+ };
32
+
33
+ async function readNew() {
34
+ for (const [, request] of waiting)
35
+ for (const message of request.pending) {
36
+ if (verdicts.has(message.id)) continue;
37
+ verdicts.set(message.id, "reading");
38
+ try {
39
+ const read = await guard(message.text);
40
+ verdicts.set(
41
+ message.id,
42
+ read.unavailable ? "unavailable" : read.verdict
43
+ );
44
+ } catch (error) {
45
+ log(`guest request guard: ${error.message}`);
46
+ verdicts.set(message.id, "unavailable");
47
+ }
48
+ tell();
49
+ }
50
+ }
51
+
52
+ function refresh() {
53
+ if (refreshing) return refreshing;
54
+ refreshing = (async () => {
55
+ try {
56
+ waiting = await read();
57
+ const live = new Set(
58
+ [...waiting.values()].flatMap((request) =>
59
+ request.pending.map((message) => message.id)
60
+ )
61
+ );
62
+ for (const id of verdicts.keys())
63
+ if (!live.has(id)) verdicts.delete(id);
64
+ tell();
65
+ await readNew();
66
+ } catch (error) {
67
+ log(`guest requests: ${error.message}`);
68
+ } finally {
69
+ refreshing = null;
70
+ }
71
+ })();
72
+ return refreshing;
73
+ }
74
+
75
+ /** A thread's waiting guest messages, oldest first, as the buddy's needs-you card reads them. */
76
+ function needsOf(threadId, agent) {
77
+ const request = waiting.get(threadId);
78
+ if (!request) return [];
79
+ return request.pending.map((message) => ({
80
+ id: `guest:${message.id}`,
81
+ kind: "guest",
82
+ agent,
83
+ who: request.guestName ?? "Your guest",
84
+ text: message.text,
85
+ guard: verdicts.get(message.id) ?? "reading",
86
+ access: request.runtimeMode,
87
+ files: message.files,
88
+ link: linkOf(threadId),
89
+ at: message.submittedAt,
90
+ }));
91
+ }
92
+
93
+ return { refresh, needsOf };
94
+ }
package/lib/handoffs.mjs CHANGED
@@ -1,20 +1,21 @@
1
1
  import { nameOf } from "./members.mjs";
2
2
 
3
3
  // Work handed to an agent that has to be woken (Grok Bot by email, OpenClaw and Hermes on their gateways) is watched
4
- // until the agent picks it up. A wake can be accepted and still never start a run (October 19: two of Grok Bot's
5
- // emails went unanswered for 2 h and 20 min), so a missed pickup is never silent: the agent is woken again at 3
6
- // minutes, and at 10 the work moves to Harness, whose server takes it at once. The thread says so each time, and the
7
- // person can put the work back.
4
+ // until the agent picks it up. A wake can be accepted and still never start a run (two of Grok Bot's emails once went
5
+ // unanswered for 2 h and 20 min), so a missed pickup is never silent: the agent is woken again at 3 minutes, and at 10
6
+ // the work moves to Harness, whose server takes it at once. The thread says so each time, and the person can put the
7
+ // work back.
8
8
  //
9
- // The 3 and 10 minutes: Grok Bot's 36 email wakes from October 15 to 19 were claimed 13 to 59 s after sending, so 3
10
- // minutes is three times its slowest normal pickup (owner, October 19).
9
+ // The 3 and 10 minutes: Grok Bot's 36 email wakes over five days were claimed 13 to 59 s after sending, so 3
10
+ // minutes is three times its slowest normal pickup.
11
11
 
12
12
  export const HANDOFF_TIMING = { nudgeMs: 3 * 60_000, moveMs: 10 * 60_000 };
13
13
  // A setup check waits as long as setup does (onboard.mjs, ten minutes), then it is off the board.
14
14
  const SETUP_CHECK_MS = 15 * 60_000;
15
15
  export const WATCHED = new Set(["grok-bot", "openclaw", "hermes"]);
16
16
 
17
- // A setup check (onboard.mjs), marked since October 19, or by the exact objective setup posts from before that.
17
+ // A setup check (onboard.mjs): marked as one in the store, or, from a setup older than the mark, known by its exact
18
+ // objective.
18
19
  export const isSetupCheck = (store, task) =>
19
20
  Boolean(store.meta(`setup-check:${task.id}`)) ||
20
21
  task.objective === "Setup check from Harness: reply ready";
package/lib/handover.mjs CHANGED
@@ -8,10 +8,10 @@ import { oneLine } from "./oneLine.mjs";
8
8
  // turn and lose its record to a summary, so before resuming, the relay reads the session's last model call from the
9
9
  // agent's own file and, past the line, starts a fresh session that is told where the old one is and what was said last.
10
10
 
11
- // Where the line sits, measured on the owner's machine, October 20, 2026:
12
- // - Codex compacted 90 times since September 15; the last call before each carried a median 87% of the window Codex
13
- // reported, and 77% or more in 9 of 10 (the lowest 58%). Claude Code's automatic compactions of 1M-token sessions came
14
- // at 96.6% or more.
11
+ // Where the line sits, measured on one developer machine:
12
+ // - Codex compacted 90 times in five weeks; the last call before each carried a median 87% of the window Codex
13
+ // reported, and 77% or more in 9 of 10 (the lowest 58%). Claude Code's automatic compactions of 1M-token sessions
14
+ // came at 96.6% or more.
15
15
  // - A thread turn that resumed a session grew it by up to 39,469 tokens before its last call (13 turns of Claude Code and
16
16
  // Codex on the board with their session files still on disk; median 9,773 to 13,309).
17
17
  // So a session is resumed only while its last call plus one such turn stays under 77% of the window.
@@ -1,9 +1,9 @@
1
- // The model Harness answers with in the swarm's threads, picked in the buddy as every other agent's is (owner,
2
- // October 17: "harness behavior should be no different than the rest", a model "from the harness catalog based on the
3
- // provider selected"). A provider first: Harness credits, or one of the person's own keys or their endpoint once they
4
- // let Harness Relay keep it (lane.mjs); then one of the models Harness's catalog offers on it, the list the server sends
5
- // (src/server/swarm/harnessModels.ts), or the endpoint's own models. With no pick Harness answers with the person's last
6
- // Harness model, as before. Harness's server checks the pick again before a task runs on it.
1
+ // The model Harness answers with in the swarm's threads, picked in the buddy as every other agent's is: Harness
2
+ // behaves no differently from the rest, with a model from Harness's catalog for the provider selected. A provider
3
+ // first: Harness credits, or one of the person's own keys or their endpoint once they let Harness Relay keep it
4
+ // (lane.mjs); then one of the models Harness's catalog offers on it, the list Harness's server sends, or the endpoint's
5
+ // own models. With no pick Harness answers with the person's last Harness model, as before. Harness's server checks the
6
+ // pick again before a task runs on it.
7
7
 
8
8
  const catalogKey = "models:harness";
9
9
  const choiceKey = "model-choice:harness";