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
package/lib/lane.mjs CHANGED
@@ -3,16 +3,47 @@ import path from "node:path";
3
3
  import { readJson, writeJsonAtomic } from "./files.mjs";
4
4
  import { paths } from "./paths.mjs";
5
5
 
6
- // The person's own model lane, kept on this computer once they let Harness Relay use it (owner, October 15): the API key
7
- // or model endpoint their Harness window runs on, so Harness can answer in their swarm's threads while that window is
8
- // closed. Only their linked Harness window gives it (sealed, phones.mjs), only they can take it back, and it leaves this
9
- // computer only with a task given to Harness, the way the window sends it with each of its own turns: Harness's server
10
- // uses it for that task and keeps nothing (src/server/swarm/harnessTask.ts). An endpoint only this computer reaches
11
- // (localhost or the person's network) is called from here for Harness's server (`fetch`), and only that endpoint.
6
+ // The person's own model lane, kept on this computer once they let Harness Relay use it: the API key or model endpoint
7
+ // their Harness window runs on, so Harness can answer in their swarm's threads while that window is closed. Only their
8
+ // linked Harness window gives it (sealed, phones.mjs), only they can take it back, and it leaves this computer only
9
+ // with a task given to Harness, the way the window sends it with each of its own turns: Harness's server uses it for
10
+ // that task and keeps nothing. An endpoint only this computer reaches (localhost or the person's network) is called
11
+ // from here for Harness's server (`fetch`), and only that endpoint.
12
12
 
13
13
  const PROVIDERS = new Set(["venice", "bankr", "openai", "dot"]);
14
14
  export const laneFile = () => path.join(paths.home, "harness-lane.json");
15
15
 
16
+ // The model API calls Harness's server makes to the person's endpoint (an OpenAI-compatible one: the chat call, and the
17
+ // model list), each with its method, under the endpoint's own path. Any other path on the person's model host (an
18
+ // admin page, another app on the same port) is not a model call (security audit S11).
19
+ const MODEL_CALLS = new Map([
20
+ ["/chat/completions", "POST"],
21
+ ["/completions", "POST"],
22
+ ["/responses", "POST"],
23
+ ["/models", "GET"],
24
+ ]);
25
+ /**
26
+ * The address asked for, if it is one of `calls` (Harness's server's: MODEL_CALLS) on the endpoint itself; null
27
+ * otherwise.
28
+ */
29
+ export function modelCallUrl(baseUrl, url, method, calls = MODEL_CALLS) {
30
+ let base, target;
31
+ try {
32
+ base = new URL(baseUrl);
33
+ target = new URL(String(url));
34
+ } catch {
35
+ return null;
36
+ }
37
+ // URL resolves dot segments; an encoded slash, dot or backslash could still mean another path to the endpoint.
38
+ if (/%2e|%2f|%5c/i.test(target.pathname)) return null;
39
+ if (target.origin !== base.origin || target.username || target.password)
40
+ return null;
41
+ const root = base.pathname.replace(/\/+$/, "");
42
+ if (!target.pathname.startsWith(`${root}/`)) return null;
43
+ const call = target.pathname.slice(root.length).replace(/\/+$/, "");
44
+ return calls.get(call) === method ? target.href : null;
45
+ }
46
+
16
47
  // The shape Harness's server takes (src/schemas/credentials.ts), checked here so a malformed lane is refused when given.
17
48
  function credentialOf(value) {
18
49
  if (!value || typeof value !== "object") return null;
@@ -131,14 +162,14 @@ export function createHarnessLane({
131
162
  credential?.type === "custom" && credential.endpoint.transport === "relay"
132
163
  ? credential.endpoint.baseUrl.replace(/\/+$/, "")
133
164
  : null;
134
- const target = String(url || "");
135
- if (!base || (target !== base && !target.startsWith(`${base}/`)))
165
+ if (!["GET", "POST"].includes(method))
166
+ return failed(403, `${method} is not a model call`);
167
+ const target = base ? modelCallUrl(base, url, method) : null;
168
+ if (!target)
136
169
  return failed(
137
170
  403,
138
- "that address is not the model endpoint the person let Harness Relay use"
171
+ "that address is not a model call on the endpoint the person let Harness Relay use"
139
172
  );
140
- if (!["GET", "POST"].includes(method))
141
- return failed(403, `${method} is not a model call`);
142
173
  let response;
143
174
  try {
144
175
  response = await fetchImpl(target, {
package/lib/lessons.mjs CHANGED
@@ -1,19 +1,19 @@
1
1
  // What the swarm learns from the person, step 2 of its learning. Each post the person writes in a thread is read on
2
- // Harness's server (src/server/swarm/lessons.ts) with the agents' work since they last wrote and the few lessons kept
3
- // here closest to it. A post that says something lasting comes back as lessons, each standing on the person's exact
4
- // words: a new one is kept, the same one again adds the new words to it, and an update or a reversal replaces the
5
- // kept one (which stays as the record of what was). Lessons are about the person (tastes, standards, ways of working),
6
- // one agent (what it should or should not do), or a kind of work (how it goes well), and hold everywhere or in the
7
- // thread's folder. They are kept apart from Harness's own memory (owner, October 16: "learnings seperated is how it
8
- // should be for sure"). Nothing is read on the privacy setting, with this computer off Harness, or from a Harness that
9
- // does not read lessons (swarm_lessons). Posts are read one at a time, so two quick ones never both add the same lesson.
2
+ // Harness's server with the agents' work since they last wrote and the few lessons kept here closest to it. A post that
3
+ // says something lasting comes back as lessons, each standing on the person's exact words: a new one is kept, the same
4
+ // one again adds the new words to it, and an update or a reversal replaces the kept one (which stays as the record of
5
+ // what was). Lessons are about the person (tastes, standards, ways of working), one agent (what it should or should not
6
+ // do), or a kind of work (how it goes well), and hold everywhere or in the thread's folder. They are kept apart from
7
+ // Harness's own memory. Nothing is read on the privacy setting, with this computer off Harness, or from a Harness that
8
+ // does not read lessons (swarm_lessons). Posts are read one at a time, so two quick ones never both add the same
9
+ // lesson.
10
10
 
11
11
  import path from "node:path";
12
12
  import { workSince } from "./reactions.mjs";
13
13
  import { fromBlob, toBlob, topK } from "./vectors.mjs";
14
14
 
15
- // The kept lessons a post is compared with, closest first. At today's scale that is every lesson: in eval swarm-lessons v1
16
- // (20261017-040509-e29f1c4d-2204) six chosen by words left out the lessons a repeat repeated.
15
+ // The kept lessons a post is compared with, closest first. At today's scale that is every lesson: in a replay of
16
+ // real threads, six chosen by words left out the lessons a repeat repeated.
17
17
  const KNOWN = 24;
18
18
  const POST_CHARS = 4_000;
19
19
 
@@ -80,10 +80,10 @@ export function createLessons({
80
80
  });
81
81
 
82
82
  const read = async (thread, post) => {
83
- // Learned from the person's threads, not from a single job's room, where their words settle that job (owner,
84
- // October 17, on "the bankr agent will have tools to be able to call the transaction" kept as a lesson: "needs to
85
- // be fixed"). No wording separated such answers from wishes when Jev read them; the two in the eval's posts were
86
- // both in task rooms, and none of the person's lasting wishes was.
83
+ // Learned from the person's threads, not from a single job's room, where their words settle that job (a room's "the
84
+ // bankr agent will have tools to be able to call the transaction" was once kept as a lasting lesson).
85
+ // No wording separated such answers from wishes when Jev read them; the two among the posts measured were both in
86
+ // task rooms, and none of the person's lasting wishes was.
87
87
  if (!readsLessons() || isTaskRoom(thread)) return [];
88
88
  const known = await closest(post.text);
89
89
  const { before } = workSince(
@@ -149,8 +149,8 @@ export function createLessons({
149
149
  };
150
150
  if (!fresh.text || !["person", "agent", "work"].includes(fresh.about))
151
151
  continue;
152
- // A lesson about one agent stands only to another about the same agent (in the eval, "Harness should be generating
153
- // the videos" read as the opposite of Claude Code's role, and replaced it); the person's and the work's stand to each
152
+ // A lesson about one agent stands only to another about the same agent (once, "Harness should be generating the
153
+ // videos" read as the opposite of Claude Code's role, and replaced it); the person's and the work's stand to each
154
154
  // other, as the writer words the same wish either way (the candy track came back once as each).
155
155
  const target = knownIds.has(lesson.match?.id)
156
156
  ? store.getLesson(lesson.match.id)
package/lib/library.mjs CHANGED
@@ -25,11 +25,11 @@ const MAX_BYTES = { image: 20e6, pdf: 200e6, doc: 20e6 };
25
25
  const Z_GATE = 2.0;
26
26
  // A brief nobody asked for takes a file only when it stands out much further, and close to the best one: among 268
27
27
  // files, right answers stood 3.9 to 8.2 above the rest and the best answer to a task about something never written 3.9
28
- // at most, while an unrelated README in second place trailed the right file by more than a point (eval file-search).
28
+ // at most, while an unrelated README in second place trailed the right file by more than a point.
29
29
  const BRIEF_Z = 4.0;
30
30
  const BRIEF_NEAR_BEST = 1.0;
31
- // Below this many parts the spread says little, and a fixed similarity stands in (eval media-search: right answers
32
- // 0.68 and up, never-said questions 0.675 at most).
31
+ // Below this many parts the spread says little, and a fixed similarity stands in (in media search, right answers
32
+ // scored 0.68 and up, never-said questions 0.675 at most).
33
33
  const MIN_SCALE = 200;
34
34
  const FLOOR = { image: 0.7, audio: 0.7, text: 0.7 };
35
35
  const SMALL_GROUP = 20;
package/lib/lineup.mjs CHANGED
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import { detectAgents } from "./commands.mjs";
5
5
  import { detectLocalAgents, setupHermes, setupOpenClaw } from "./wakes.mjs";
6
6
  import { configureAgents } from "./adapters.mjs";
7
+ import { confirmAgentBinary } from "./agentBinaries.mjs";
7
8
  import { MACHINE_RUNNERS, nameOf } from "./members.mjs";
8
9
  import { paths } from "./paths.mjs";
9
10
  import { readJson, writeJsonAtomic } from "./files.mjs";
@@ -257,6 +258,8 @@ export function joinAgent({
257
258
  ...config,
258
259
  agentStates: { ...config.agentStates, [agent]: state },
259
260
  });
261
+ // Adding an agent is the person's word on the program it runs as (agentBinaries.mjs).
262
+ confirmAgentBinary(agent, { file });
260
263
  } else {
261
264
  const result = localSetup[agent]({ runtimeRoot });
262
265
  if (!result.ok) return { ok: false, error: result.detail };