tryharness 0.7.83 → 0.7.86

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 (215) hide show
  1. package/README.md +21 -19
  2. package/assets/dsh-plugin.mjs +75 -4
  3. package/assets/herdr-mod/harness/main.js +367 -0
  4. package/assets/herdr-mod/harness/mod.json +6 -0
  5. package/assets/opencode-plugin.js +87 -22
  6. package/assets/pi-extension.ts +81 -2
  7. package/cli.mjs +544 -208
  8. package/lib/adapters.mjs +62 -27
  9. package/lib/agentBinaries.mjs +6 -8
  10. package/lib/agentClaims.mjs +168 -0
  11. package/lib/agentReadTools.json +415 -0
  12. package/lib/agentSignIn.mjs +17 -18
  13. package/lib/agentWiring.mjs +114 -0
  14. package/lib/archetypes.js +10 -11
  15. package/lib/attention.mjs +100 -0
  16. package/lib/audit.mjs +1 -1
  17. package/lib/backupSetup.mjs +6 -28
  18. package/lib/bankrApprovals.mjs +86 -0
  19. package/lib/boardAccess.mjs +40 -66
  20. package/lib/boardBackup.mjs +86 -85
  21. package/lib/boardCommands.mjs +28 -0
  22. package/lib/boardFileCommands.mjs +29 -36
  23. package/lib/boardFiles.mjs +83 -15
  24. package/lib/boardMirror.mjs +78 -11
  25. package/lib/boardProtocol.json +191 -123
  26. package/lib/boardThreads.mjs +19 -37
  27. package/lib/boardTools.mjs +22 -15
  28. package/lib/boardWatches.mjs +43 -15
  29. package/lib/bridge.mjs +7 -3
  30. package/lib/browserAgentTools.mjs +59 -0
  31. package/lib/browserWake.mjs +0 -6
  32. package/lib/cards.mjs +52 -0
  33. package/lib/circling.mjs +189 -0
  34. package/lib/cleanup.mjs +234 -0
  35. package/lib/cloudBoot.mjs +21 -4
  36. package/lib/cloudSave.mjs +46 -5
  37. package/lib/compaction.mjs +8 -1
  38. package/lib/completion.mjs +358 -0
  39. package/lib/computerDevices.mjs +853 -0
  40. package/lib/connectionStatus.mjs +34 -0
  41. package/lib/connectors.mjs +139 -1
  42. package/lib/coordinator.mjs +108 -14
  43. package/lib/coreModels.mjs +36 -12
  44. package/lib/daemon.mjs +2426 -338
  45. package/lib/daemonLock.mjs +103 -0
  46. package/lib/deviceDoor.mjs +308 -0
  47. package/lib/deviceIdentity.mjs +114 -0
  48. package/lib/deviceList.mjs +172 -0
  49. package/lib/deviceSeal.mjs +74 -0
  50. package/lib/dispatcher.mjs +497 -26
  51. package/lib/dispatches.mjs +3 -3
  52. package/lib/environment.mjs +2 -1
  53. package/lib/environments.mjs +67 -41
  54. package/lib/events.mjs +318 -0
  55. package/lib/facts.mjs +170 -0
  56. package/lib/fileSource.mjs +540 -0
  57. package/lib/files.mjs +47 -2
  58. package/lib/gitHost.mjs +39 -1
  59. package/lib/goalCommands.mjs +12 -80
  60. package/lib/handover.mjs +21 -16
  61. package/lib/harnessOffers.mjs +140 -15
  62. package/lib/herdr.mjs +100 -15
  63. package/lib/herdrAppCall.mjs +19 -0
  64. package/lib/herdrCore.mjs +59 -0
  65. package/lib/herdrRuns.mjs +1126 -0
  66. package/lib/hookDialects.mjs +235 -50
  67. package/lib/identityLink.mjs +81 -0
  68. package/lib/inference.mjs +31 -2
  69. package/lib/jamAccess.mjs +82 -0
  70. package/lib/{projectBoard.mjs → jamBoard.mjs} +5 -4
  71. package/lib/{projectGit.mjs → jamGit.mjs} +53 -15
  72. package/lib/jamKey.mjs +274 -0
  73. package/lib/{projectPieces.mjs → jamPieces.mjs} +35 -29
  74. package/lib/{projectSettings.mjs → jamSettings.mjs} +12 -22
  75. package/lib/jamStore.mjs +973 -0
  76. package/lib/jamUpgrade.mjs +112 -0
  77. package/lib/jams.mjs +3079 -0
  78. package/lib/kanban.mjs +13 -7
  79. package/lib/landed.mjs +5 -1
  80. package/lib/library.mjs +41 -22
  81. package/lib/limits.mjs +91 -0
  82. package/lib/lineDiff.mjs +97 -0
  83. package/lib/lineup.mjs +18 -13
  84. package/lib/link.mjs +584 -0
  85. package/lib/localStack.mjs +75 -16
  86. package/lib/localmodels.mjs +58 -78
  87. package/lib/loopBackstop.mjs +2 -1
  88. package/lib/machine.mjs +544 -0
  89. package/lib/machineLink.mjs +446 -0
  90. package/lib/machineRoutes.mjs +68 -19
  91. package/lib/machineRuns.mjs +85 -4
  92. package/lib/machineSeal.mjs +6 -31
  93. package/lib/manager.mjs +134 -12
  94. package/lib/mcp-stdio.mjs +492 -215
  95. package/lib/mcpRelay.mjs +34 -35
  96. package/lib/members.json +1 -1
  97. package/lib/modelRoute.mjs +162 -0
  98. package/lib/nativeHost.mjs +81 -90
  99. package/lib/nativeSenses.mjs +258 -0
  100. package/lib/nerves.mjs +523 -0
  101. package/lib/network.mjs +117 -278
  102. package/lib/networkPlaces.mjs +578 -0
  103. package/lib/nextStep.mjs +95 -0
  104. package/lib/notify.mjs +2 -2
  105. package/lib/nudge.mjs +116 -10
  106. package/lib/originals.mjs +216 -0
  107. package/lib/outsideEvents.mjs +383 -0
  108. package/lib/outsideRuns.mjs +230 -0
  109. package/lib/ownMachines.mjs +674 -256
  110. package/lib/pain.mjs +215 -0
  111. package/lib/pairing.mjs +91 -11
  112. package/lib/paths.mjs +42 -3
  113. package/lib/peerProcess.mjs +21 -7
  114. package/lib/peopleLink.mjs +268 -0
  115. package/lib/personNotices.mjs +3 -2
  116. package/lib/phones.mjs +252 -542
  117. package/lib/placeCards.mjs +282 -0
  118. package/lib/placeChecks.mjs +95 -0
  119. package/lib/placeCommands.mjs +8 -17
  120. package/lib/placeRequests.mjs +152 -0
  121. package/lib/placeStore.mjs +295 -0
  122. package/lib/placeTool.d.ts +12 -0
  123. package/lib/placeTool.js +40 -0
  124. package/lib/places.mjs +63 -14
  125. package/lib/plans.mjs +53 -8
  126. package/lib/presence.mjs +270 -0
  127. package/lib/privateNetwork.d.ts +2 -0
  128. package/lib/privateNetwork.js +93 -0
  129. package/lib/proposals.mjs +300 -0
  130. package/lib/publicFetch.d.ts +32 -0
  131. package/lib/publicFetch.js +248 -0
  132. package/lib/reach.mjs +128 -0
  133. package/lib/rebuildable.mjs +72 -0
  134. package/lib/recall.mjs +216 -0
  135. package/lib/record.mjs +13 -0
  136. package/lib/reflexes.mjs +392 -0
  137. package/lib/relayLimits.mjs +31 -2
  138. package/lib/releaseNotice.mjs +198 -0
  139. package/lib/removeHarness.mjs +15 -4
  140. package/lib/repoLinks.mjs +204 -35
  141. package/lib/runAuthority.mjs +102 -39
  142. package/lib/runBrief.mjs +93 -40
  143. package/lib/runRequests.mjs +52 -14
  144. package/lib/runUsage.mjs +31 -0
  145. package/lib/runWorker.mjs +74 -25
  146. package/lib/runner.mjs +289 -45
  147. package/lib/runtime-install.mjs +37 -8
  148. package/lib/schedules.mjs +171 -47
  149. package/lib/screenWatches.mjs +221 -0
  150. package/lib/sealed.mjs +12 -30
  151. package/lib/sealedThreads.mjs +198 -392
  152. package/lib/secretStore.mjs +178 -0
  153. package/lib/secrets.mjs +11 -0
  154. package/lib/seen.mjs +3 -9
  155. package/lib/selfUpdate.mjs +51 -15
  156. package/lib/senseCall.mjs +1514 -0
  157. package/lib/senseHook.mjs +114 -0
  158. package/lib/senseTools.mjs +1298 -0
  159. package/lib/sessionBriefs.mjs +87 -0
  160. package/lib/sessionControl.mjs +63 -13
  161. package/lib/sessionFiles.mjs +85 -0
  162. package/lib/setupChoices.mjs +12 -3
  163. package/lib/setupMode.mjs +70 -25
  164. package/lib/sharedKeys.mjs +166 -0
  165. package/lib/sleep.mjs +396 -0
  166. package/lib/sources.mjs +306 -0
  167. package/lib/speech.mjs +166 -411
  168. package/lib/spoken.mjs +210 -0
  169. package/lib/steerHook.mjs +3 -1
  170. package/lib/steerQueue.mjs +40 -11
  171. package/lib/store.mjs +323 -130
  172. package/lib/stuck.mjs +85 -7
  173. package/lib/swarm.mjs +157 -49
  174. package/lib/swarmDevices.mjs +25 -85
  175. package/lib/swarmMemory.mjs +93 -9
  176. package/lib/t3.mjs +73 -3
  177. package/lib/taskCommands.mjs +51 -60
  178. package/lib/taskRooms.mjs +30 -4
  179. package/lib/taskRules.json +29 -0
  180. package/lib/taskRules.mjs +21 -0
  181. package/lib/taskRuns.mjs +74 -11
  182. package/lib/team.mjs +2 -1
  183. package/lib/threadActions.mjs +37 -9
  184. package/lib/threadAuthority.mjs +4 -4
  185. package/lib/threadBriefs.mjs +173 -43
  186. package/lib/threadNotes.mjs +320 -0
  187. package/lib/threadRecord.mjs +491 -0
  188. package/lib/threadRuns.mjs +216 -108
  189. package/lib/threadView.mjs +27 -30
  190. package/lib/threadWatches.mjs +1962 -0
  191. package/lib/timeSense.mjs +839 -0
  192. package/lib/tripwires.mjs +454 -0
  193. package/lib/ui.mjs +1 -1
  194. package/lib/vault.mjs +560 -45
  195. package/lib/vaultCommands.mjs +5 -3
  196. package/lib/vaultPeers.mjs +165 -0
  197. package/lib/vaultTools.d.ts +4 -1
  198. package/lib/vaultTools.js +22 -1
  199. package/lib/verdicts.mjs +12 -26
  200. package/lib/versions.mjs +117 -0
  201. package/lib/waitTool.mjs +278 -0
  202. package/lib/wakePicture.mjs +268 -0
  203. package/lib/wakeQueue.mjs +108 -0
  204. package/lib/watchResponses.mjs +533 -0
  205. package/lib/watches.mjs +290 -145
  206. package/lib/windowAsks.mjs +80 -17
  207. package/lib/worktrees.mjs +159 -9
  208. package/npm-shrinkwrap.json +138 -631
  209. package/package.json +7 -6
  210. package/release.json +211 -129
  211. package/lib/callSessions.mjs +0 -51
  212. package/lib/directLink.mjs +0 -349
  213. package/lib/peopleBoard.mjs +0 -131
  214. package/lib/projects.mjs +0 -2917
  215. package/lib/roomChannels.mjs +0 -667
@@ -36,7 +36,7 @@ export function shorten(text, limit) {
36
36
 
37
37
  const capitalized = (text) => text.charAt(0).toUpperCase() + text.slice(1);
38
38
 
39
- // Who said something, as the person reads it: another person's agent in a shared project is "maya's Codex".
39
+ // Who said something, as the person reads it: another person's agent in a jam is "maya's Codex".
40
40
  const whoIs = (name) => {
41
41
  const [handle, agent] = String(name).split("/");
42
42
  if (!agent) return nameOf(name);
@@ -73,23 +73,20 @@ function headlineOf(text) {
73
73
  return shorten(sentence ?? line, 160);
74
74
  }
75
75
 
76
- // An allowed task the browser has not taken by then is the person's again: Allow once more, or open Harness.
77
- const BROWSER_START_MS = 2 * 60_000;
78
-
79
76
  export function createThreadView({
80
77
  store,
81
78
  goals = null,
82
79
  handoffs = null,
83
80
  now = Date.now,
84
- // What a shared project's room waits on the person for (projects.mjs needsOf): an OK, a post to share.
85
- projectNeeds = () => [],
81
+ // What a jam's room waits on the person for (jams.mjs needsOf): an OK an agent asked for.
82
+ jamNeeds = () => [],
86
83
  nativeNeeds = () => [],
87
84
  // A run's agent asking for one of the person's secrets (vault.mjs).
88
85
  vaultNeeds = () => [],
86
+ // A thread's own requests, belonging to no run here (a Bankr proposal, bankrApprovals.mjs).
87
+ threadNeeds = () => [],
89
88
  // The name of the computer an agent wrote from, once the person has more than one (ownMachines.mjs shownLabel).
90
89
  computerOf = () => null,
91
- // Whether the person's browser is listening for this computer (browserWake.mjs), so Harness can use it now.
92
- browserListening = () => false,
93
90
  // Where the person left the thread: their last move and what it was about (threadLine.mjs).
94
91
  whereLeft = () => null,
95
92
  // What waits on the person about an agent rather than a thread (kind "agent", specialtyNotice.mjs): an agent not
@@ -125,8 +122,8 @@ export function createThreadView({
125
122
  };
126
123
 
127
124
  function titleOf(thread, posts) {
128
- // A shared project's room keeps the project's name, the same on both people's computers.
129
- if (store.meta(`project-room:${thread.id}`))
125
+ // A jam's room keeps the jam's name, the same on every member's computer.
126
+ if (store.meta(`jam-room:${thread.id}`))
130
127
  return shorten(thread.objective, TITLE_LIMIT);
131
128
  const written = goals?.record(thread.id)?.title;
132
129
  if (written) return written;
@@ -225,33 +222,23 @@ export function createThreadView({
225
222
  text: reason.replace(/^The room is paused:\s*/, "") || "Paused.",
226
223
  at: thread.updated_at,
227
224
  });
228
- // What Harness's server left for the browser waits on the person opening their Harness window (one such part once
229
- // waited 9 hours with nothing saying so), or on their Allow when their browser listens for this computer. Once
230
- // allowed it waits on no one, unless the browser has not taken it.
225
+ // What Harness's server left for the browser goes there by itself and asks the person nothing, unless its turn
226
+ // stopped there with a question for them.
231
227
  for (const run of runs) {
228
+ const stopped = store.meta(`harness-browser-stopped:${run.id}`);
232
229
  if (
233
230
  run.target_agent !== "harness" ||
234
231
  run.status !== "open" ||
235
- !store.meta(`harness-window:${run.id}`)
232
+ !store.meta(`harness-window:${run.id}`) ||
233
+ !stopped
236
234
  )
237
235
  continue;
238
- const allowedAt = Date.parse(
239
- store.meta(`harness-browser-allowed:${run.id}`) || ""
240
- );
241
- if (now() - allowedAt < BROWSER_START_MS) continue;
242
- const stopped = store.meta(`harness-browser-stopped:${run.id}`);
243
- const canAllow = !stopped && browserListening();
244
236
  items.push({
245
237
  id: `window:${run.id}`,
246
238
  kind: "window",
247
239
  agent: "harness",
248
- text: stopped
249
- ? `Harness stopped in your browser to ask you: ${stopped}. Open Harness on your computer to answer.`
250
- : canAllow
251
- ? "Harness needs your browser to finish this. Allow it, and Harness carries on in your browser now."
252
- : "Harness needs your browser to finish this: open Harness on your computer.",
240
+ text: `Harness stopped in your browser to ask you: ${stopped}. Open Harness on your computer to answer.`,
253
241
  runId: run.id,
254
- ...(canAllow ? { browser: "can-allow" } : {}),
255
242
  at: run.updated_at,
256
243
  });
257
244
  }
@@ -265,8 +252,16 @@ export function createThreadView({
265
252
  seq: held.seq,
266
253
  at: held.created_at,
267
254
  });
268
- items.push(...projectNeeds(thread.id));
269
- return items.sort((a, b) => String(a.at).localeCompare(String(b.at)));
255
+ items.push(...jamNeeds(thread.id));
256
+ items.push(...threadNeeds(thread.id));
257
+ // Two things can wait from the same second: the order they were posted in, then their ids, so the newest one a
258
+ // card shows is the same on every read.
259
+ return items.sort(
260
+ (a, b) =>
261
+ String(a.at).localeCompare(String(b.at)) ||
262
+ (a.seq ?? 0) - (b.seq ?? 0) ||
263
+ String(a.id).localeCompare(String(b.id))
264
+ );
270
265
  }
271
266
 
272
267
  // Filed Done after `at`: an answer from the person (Accept, Done) that came after the thing it settles.
@@ -349,11 +344,13 @@ export function createThreadView({
349
344
  function row(thread, posts = store.roomPosts(thread.id, 0, 500)) {
350
345
  const runs = store.threadRuns(thread.id);
351
346
  const items = needsYouOf(thread, posts, runs);
352
- const state = stateOf(thread, items, runs);
347
+ // A question left an hour waits in the thread's list, not with what waits right now (runRequests.mjs LATER_MS).
348
+ const now = items.filter((item) => !item.late);
349
+ const state = stateOf(thread, now, runs);
353
350
  return {
354
351
  title: titleOf(thread, posts),
355
352
  state,
356
- line: lineOf(state, items, runs, posts, thread),
353
+ line: lineOf(state, now, runs, posts, thread),
357
354
  // The line is a late or moved handoff, so a list can mark it apart from work going as planned.
358
355
  late: state === "working" && Boolean(lateHandoff(runs)),
359
356
  needsYou: items,