tryharness 0.7.44 → 0.7.53

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 (101) hide show
  1. package/README.md +232 -12
  2. package/cli.mjs +406 -184
  3. package/lib/actorRoster.mjs +28 -5
  4. package/lib/adapters.mjs +9 -1
  5. package/lib/agentRuntimeConfig.mjs +36 -0
  6. package/lib/agentRuntimes.mjs +560 -0
  7. package/lib/atlas.mjs +7 -2
  8. package/lib/boardCommands.mjs +5 -10
  9. package/lib/boardFileCommands.mjs +2 -1
  10. package/lib/boardMirror.mjs +459 -0
  11. package/lib/boardProtocol.json +259 -6
  12. package/lib/boardTools.mjs +2 -6
  13. package/lib/bridge.mjs +27 -3
  14. package/lib/browserWake.mjs +60 -0
  15. package/lib/cards.mjs +35 -2
  16. package/lib/commands.mjs +20 -5
  17. package/lib/connectionTools.d.ts +13 -0
  18. package/lib/connectionTools.js +45 -0
  19. package/lib/connectorAuth.mjs +309 -0
  20. package/lib/connectorCatalog.json +41 -0
  21. package/lib/connectorCommands.mjs +121 -0
  22. package/lib/connectorGoogle.mjs +513 -0
  23. package/lib/connectors.mjs +805 -0
  24. package/lib/coordinator.mjs +16 -2
  25. package/lib/coreModels.mjs +78 -0
  26. package/lib/daemon.mjs +775 -46
  27. package/lib/desktop.mjs +7 -2
  28. package/lib/digest.mjs +32 -0
  29. package/lib/directLink.mjs +283 -0
  30. package/lib/environments.mjs +595 -0
  31. package/lib/folders.mjs +2 -2
  32. package/lib/goalCommands.mjs +61 -12
  33. package/lib/inference.mjs +263 -152
  34. package/lib/lessons.mjs +6 -0
  35. package/lib/lineup.mjs +324 -0
  36. package/lib/localmodels.mjs +10 -0
  37. package/lib/machineIdentity.mjs +3 -0
  38. package/lib/machineRoutes.mjs +40 -2
  39. package/lib/machineRuns.mjs +30 -3
  40. package/lib/machineSeal.mjs +69 -10
  41. package/lib/mcp-stdio.mjs +180 -98
  42. package/lib/mcpRelay.mjs +119 -0
  43. package/lib/members.json +12 -0
  44. package/lib/members.mjs +33 -0
  45. package/lib/modelMemory.mjs +100 -0
  46. package/lib/modelTiers.json +1183 -0
  47. package/lib/modelTiers.mjs +133 -0
  48. package/lib/models.mjs +41 -8
  49. package/lib/museSession.mjs +119 -0
  50. package/lib/nativeHost.mjs +203 -0
  51. package/lib/network.mjs +38 -1
  52. package/lib/nudge.mjs +10 -2
  53. package/lib/onboard.mjs +430 -1
  54. package/lib/oneclawLocal.mjs +150 -0
  55. package/lib/ownMachines.mjs +521 -36
  56. package/lib/pairing.mjs +165 -0
  57. package/lib/paths.mjs +4 -0
  58. package/lib/phones.mjs +61 -0
  59. package/lib/placeCommands.mjs +27 -0
  60. package/lib/places.mjs +10 -2
  61. package/lib/plans.mjs +151 -27
  62. package/lib/profile.mjs +152 -0
  63. package/lib/projectGit.mjs +328 -0
  64. package/lib/projectSettings.mjs +120 -0
  65. package/lib/projects.mjs +2539 -0
  66. package/lib/readiness.mjs +283 -0
  67. package/lib/repoLinks.mjs +354 -0
  68. package/lib/roomChannels.mjs +641 -0
  69. package/lib/runBrief.mjs +32 -2
  70. package/lib/runRequests.mjs +157 -0
  71. package/lib/runWorker.mjs +20 -7
  72. package/lib/runner.mjs +67 -8
  73. package/lib/secretPatterns.json +55 -0
  74. package/lib/secrets.mjs +10 -27
  75. package/lib/seen.mjs +102 -0
  76. package/lib/service.mjs +11 -6
  77. package/lib/sessionControl.mjs +10 -8
  78. package/lib/sessionIndex.mjs +5 -3
  79. package/lib/store.mjs +559 -30
  80. package/lib/subagents.mjs +8 -4
  81. package/lib/swarm.mjs +379 -38
  82. package/lib/swarmMemory.mjs +947 -0
  83. package/lib/t3.mjs +43 -13
  84. package/lib/taskCommands.mjs +58 -5
  85. package/lib/taskRuns.mjs +61 -11
  86. package/lib/team.json +17 -15
  87. package/lib/team.mjs +68 -18
  88. package/lib/threadRuns.mjs +50 -7
  89. package/lib/threadView.mjs +68 -15
  90. package/lib/tokenizer.mjs +405 -0
  91. package/lib/ui.mjs +16 -2
  92. package/lib/usageTotals.mjs +148 -0
  93. package/lib/vault.mjs +1144 -0
  94. package/lib/vaultCloud.mjs +117 -0
  95. package/lib/vaultCommands.mjs +201 -0
  96. package/lib/vaultTools.d.ts +12 -0
  97. package/lib/vaultTools.js +42 -0
  98. package/lib/windowAsks.mjs +42 -0
  99. package/lib/workFocus.mjs +59 -0
  100. package/lib/workLinks.mjs +90 -0
  101. package/package.json +9 -4
@@ -176,6 +176,8 @@ const choicesOf = (value) => {
176
176
  const FAILED_REST_MS = 10 * 60_000;
177
177
 
178
178
  export function createCoordinator({
179
+ // Whether this computer acts on the board (home or a stand-in); a worker's copy gets no rounds here.
180
+ holdsBoard = () => true,
179
181
  store,
180
182
  mode,
181
183
  askHarness,
@@ -208,6 +210,8 @@ export function createCoordinator({
208
210
  // (ownMachines.mjs), and whether one of them can take the thread's turn at all.
209
211
  machinesOf = () => undefined,
210
212
  placeable = () => true,
213
+ // A post from the other side of a shared project (projects.mjs): their own swarm sorts it, so it starts no round here.
214
+ fromPartner = () => false,
211
215
  }) {
212
216
  const failedHereLately = (threadId, agent) => {
213
217
  const at = Date.parse(store.meta(`job-failed:${threadId}:${agent}`) || "");
@@ -322,6 +326,7 @@ export function createCoordinator({
322
326
  const causesTaken = mode() === "local" || serverHas("swarm_failure_causes");
323
327
  const verdictsTaken = mode() === "local" || serverHas("swarm_reactions");
324
328
  const machinesTaken = mode() === "local" || serverHas("machines");
329
+ const tiersTaken = mode() === "local" || serverHas("team_tiers");
325
330
  // Who could hold a role on the thread's team: the candidates and the agents the person named.
326
331
  const eligible = roster()
327
332
  .filter(
@@ -349,6 +354,7 @@ export function createCoordinator({
349
354
  },
350
355
  }),
351
356
  lessons: readsLessons() ? candidate.lessons : undefined,
357
+ tier: tiersTaken ? candidate.tier : undefined,
352
358
  machines: machinesTaken
353
359
  ? machinesOf(candidate.id, thread.goal.workspace)
354
360
  : undefined,
@@ -637,8 +643,10 @@ export function createCoordinator({
637
643
  const applyTeamPlan = (thread, decision, coordinator) => {
638
644
  const proposed = decision.team?.plan;
639
645
  if (!proposed || !keepsTeams() || team.plan(thread.id)) return null;
646
+ const cards = roster();
640
647
  return team.set(thread.id, proposed, {
641
- members: roster().map((card) => card.id),
648
+ members: cards.map((card) => card.id),
649
+ tiers: Object.fromEntries(cards.map((card) => [card.id, card.tier])),
642
650
  by: coordinator,
643
651
  post: (text) =>
644
652
  postAsCoordinator({
@@ -869,7 +877,12 @@ export function createCoordinator({
869
877
  const asked = askedOf(goalId);
870
878
  const posts = store
871
879
  .roomPosts(goalId, state.lastSeenSeq, 500)
872
- .filter((post) => !QUIET_KINDS.has(post.kind) && !ownPost(thread, post));
880
+ .filter(
881
+ (post) =>
882
+ !QUIET_KINDS.has(post.kind) &&
883
+ !ownPost(thread, post) &&
884
+ !fromPartner(goalId, post)
885
+ );
873
886
  // A turn T3 Code is running for one of the thread's agents counts as work going on, though Harness did not start it
874
887
  // (October 14: the coordinator told Claude Code to "continue" three times while it worked in T3).
875
888
  const active =
@@ -1075,6 +1088,7 @@ export function createCoordinator({
1075
1088
 
1076
1089
  /** A thread changed: run a round once it is quiet; one at a time per thread, again if more came in meanwhile. */
1077
1090
  const poke = (goalId) => {
1091
+ if (!holdsBoard()) return;
1078
1092
  if (busy.has(goalId)) {
1079
1093
  again.add(goalId);
1080
1094
  return;
@@ -0,0 +1,78 @@
1
+ import {
2
+ MODELS,
3
+ ensureLlama,
4
+ ensureModels,
5
+ modelsPresent,
6
+ } from "./localmodels.mjs";
7
+
8
+ // The relay's core local models (localmodels.mjs) give agents context packs, code search, the handoff firewall and
9
+ // image checks. Setup used to download them (about 860 MB) before it said Done, so a new person sat at the end of setup
10
+ // waiting for files they did not need yet. Setup now only records that the person wants them
11
+ // (`config.localModels: "download"`) and the daemon fetches them in the background. Until they are all present, each
12
+ // feature works as it does without them (search answers from words and says so), which is how setup already left a
13
+ // computer whose download failed. A computer whose config never asked for them (an older setup, a test) downloads
14
+ // nothing.
15
+
16
+ /** The core models' ids. */
17
+ export const CORE = MODELS.filter((entry) => entry.tier === "core").map(
18
+ (entry) => entry.id
19
+ );
20
+
21
+ /** How much the core models take to download, in MB, for setup to say. */
22
+ export const coreSizeMb = () =>
23
+ Math.round(
24
+ MODELS.filter((entry) => CORE.includes(entry.id))
25
+ .flatMap((entry) => entry.files)
26
+ .reduce((sum, file) => sum + file.size, 0) / 1e6
27
+ );
28
+
29
+ /**
30
+ * The daemon's background download of the core models. `start` begins it when the config asks for the models and any is
31
+ * missing, once per daemon run (a failed one is tried again when the daemon next starts); `status` says how it stands.
32
+ */
33
+ export function createCoreModels({
34
+ root,
35
+ wanted,
36
+ log = () => {},
37
+ download = { ensureLlama, ensureModels },
38
+ }) {
39
+ let running = null;
40
+ let lastError = null;
41
+ let tried = false;
42
+ const ready = () => modelsPresent(root, CORE);
43
+ const start = () => {
44
+ if (running || tried || !wanted() || ready()) return running;
45
+ tried = true;
46
+ log(`local models: downloading about ${coreSizeMb()} MB in the background`);
47
+ // The model server and the models are fetched apart: the classifiers run without the server, so one that cannot
48
+ // start on this computer does not hold the models back.
49
+ running = (async () => {
50
+ const failures = [];
51
+ for (const step of [
52
+ () => download.ensureLlama({ root, log }),
53
+ () => download.ensureModels({ root, ids: CORE, log }),
54
+ ]) {
55
+ try {
56
+ await step();
57
+ } catch (error) {
58
+ failures.push(error.message);
59
+ }
60
+ }
61
+ lastError = failures.length ? failures.join("; ") : null;
62
+ log(
63
+ lastError
64
+ ? `local models: not ready (${lastError}); tried again when the daemon next starts`
65
+ : "local models: ready"
66
+ );
67
+ })().finally(() => (running = null));
68
+ return running;
69
+ };
70
+ return {
71
+ start,
72
+ status: () => ({
73
+ ready: ready(),
74
+ downloading: Boolean(running),
75
+ error: lastError,
76
+ }),
77
+ };
78
+ }