tryharness 0.7.45 → 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 (99) 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 +206 -6
  12. package/lib/boardTools.mjs +2 -6
  13. package/lib/bridge.mjs +25 -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 +8 -1
  25. package/lib/coreModels.mjs +78 -0
  26. package/lib/daemon.mjs +643 -45
  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 +58 -14
  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 +121 -118
  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 +7 -2
  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/projects.mjs +624 -137
  64. package/lib/readiness.mjs +283 -0
  65. package/lib/repoLinks.mjs +354 -0
  66. package/lib/roomChannels.mjs +641 -0
  67. package/lib/runBrief.mjs +32 -2
  68. package/lib/runRequests.mjs +157 -0
  69. package/lib/runWorker.mjs +20 -7
  70. package/lib/runner.mjs +67 -8
  71. package/lib/secretPatterns.json +55 -0
  72. package/lib/secrets.mjs +10 -27
  73. package/lib/seen.mjs +102 -0
  74. package/lib/service.mjs +11 -6
  75. package/lib/sessionControl.mjs +10 -8
  76. package/lib/sessionIndex.mjs +5 -3
  77. package/lib/store.mjs +546 -29
  78. package/lib/subagents.mjs +8 -4
  79. package/lib/swarm.mjs +367 -37
  80. package/lib/swarmMemory.mjs +947 -0
  81. package/lib/t3.mjs +43 -13
  82. package/lib/taskCommands.mjs +56 -5
  83. package/lib/taskRuns.mjs +61 -11
  84. package/lib/team.json +17 -15
  85. package/lib/team.mjs +68 -18
  86. package/lib/threadRuns.mjs +3 -1
  87. package/lib/threadView.mjs +51 -14
  88. package/lib/tokenizer.mjs +405 -0
  89. package/lib/ui.mjs +16 -2
  90. package/lib/usageTotals.mjs +148 -0
  91. package/lib/vault.mjs +1144 -0
  92. package/lib/vaultCloud.mjs +117 -0
  93. package/lib/vaultCommands.mjs +201 -0
  94. package/lib/vaultTools.d.ts +12 -0
  95. package/lib/vaultTools.js +42 -0
  96. package/lib/windowAsks.mjs +42 -0
  97. package/lib/workFocus.mjs +59 -0
  98. package/lib/workLinks.mjs +90 -0
  99. 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,
@@ -324,6 +326,7 @@ export function createCoordinator({
324
326
  const causesTaken = mode() === "local" || serverHas("swarm_failure_causes");
325
327
  const verdictsTaken = mode() === "local" || serverHas("swarm_reactions");
326
328
  const machinesTaken = mode() === "local" || serverHas("machines");
329
+ const tiersTaken = mode() === "local" || serverHas("team_tiers");
327
330
  // Who could hold a role on the thread's team: the candidates and the agents the person named.
328
331
  const eligible = roster()
329
332
  .filter(
@@ -351,6 +354,7 @@ export function createCoordinator({
351
354
  },
352
355
  }),
353
356
  lessons: readsLessons() ? candidate.lessons : undefined,
357
+ tier: tiersTaken ? candidate.tier : undefined,
354
358
  machines: machinesTaken
355
359
  ? machinesOf(candidate.id, thread.goal.workspace)
356
360
  : undefined,
@@ -639,8 +643,10 @@ export function createCoordinator({
639
643
  const applyTeamPlan = (thread, decision, coordinator) => {
640
644
  const proposed = decision.team?.plan;
641
645
  if (!proposed || !keepsTeams() || team.plan(thread.id)) return null;
646
+ const cards = roster();
642
647
  return team.set(thread.id, proposed, {
643
- members: roster().map((card) => card.id),
648
+ members: cards.map((card) => card.id),
649
+ tiers: Object.fromEntries(cards.map((card) => [card.id, card.tier])),
644
650
  by: coordinator,
645
651
  post: (text) =>
646
652
  postAsCoordinator({
@@ -1082,6 +1088,7 @@ export function createCoordinator({
1082
1088
 
1083
1089
  /** A thread changed: run a round once it is quiet; one at a time per thread, again if more came in meanwhile. */
1084
1090
  const poke = (goalId) => {
1091
+ if (!holdsBoard()) return;
1085
1092
  if (busy.has(goalId)) {
1086
1093
  again.add(goalId);
1087
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
+ }