tryharness 0.7.60 → 0.7.61

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.
@@ -382,7 +382,16 @@
382
382
  "board.swarm.models",
383
383
  "board.project.answer",
384
384
  "board.project.share",
385
- "board.project.held"
385
+ "board.project.held",
386
+ "board.project.list",
387
+ "board.landed.thread",
388
+ "board.landed.folder",
389
+ "board.landed.open",
390
+ "board.swarm.specialties",
391
+ "board.swarm.specialty",
392
+ "board.swarm.pin",
393
+ "board.swarm.offices",
394
+ "board.swarm.office"
386
395
  ],
387
396
  "browserPerson": [
388
397
  "board.list",
@@ -780,6 +789,15 @@
780
789
  "machines.live",
781
790
  "machines.live.read"
782
791
  ],
792
+ "phoneMachines": [
793
+ "machines.list",
794
+ "machines.live",
795
+ "machines.live.read",
796
+ "machines.models",
797
+ "machines.model",
798
+ "machines.home",
799
+ "machines.remove"
800
+ ],
783
801
  "browserSignIn": [
784
802
  "agents.signin.status",
785
803
  "agents.signin.start",
@@ -492,7 +492,14 @@ export function createEnvironments({
492
492
  if (!root)
493
493
  return { ok: false, error: "This source thread is no longer available." };
494
494
  const version = JSON.stringify([grant, summary(root).activityVersion]);
495
- if (reads.get(id)?.version === version) return reads.get(id).result;
495
+ // Whether it landed anything is known once the threads' commits are read, which can be after this read was kept:
496
+ // a kept read says it as it stands now.
497
+ const cached = reads.get(id);
498
+ if (cached?.version === version)
499
+ return {
500
+ ...cached.result,
501
+ thread: { ...cached.result.thread, landed: summary(root).landed },
502
+ };
496
503
  const selected = treeOf(root);
497
504
  const runs = [];
498
505
  const posts = [];
package/lib/landed.mjs CHANGED
@@ -854,7 +854,42 @@ export function createLanded({
854
854
  : { ok: false, error: "this thread's folder is not a repository" };
855
855
  }
856
856
  if (request.command === "board.landed.thread") return threadView(context);
857
- return openWork(context);
857
+ const plan = await openWork(context);
858
+ return request.onComputer === true ? openHere(plan) : plan;
859
+ }
860
+
861
+ /**
862
+ * The phone's Open: this computer opens the work itself, where the buddy would have opened it (a T3 Code or Codex
863
+ * link, or the app). The link and the app are this computer's own reading of the work, never the caller's. A test
864
+ * stands in for the opener with HARNESS_OPEN_COMMAND, as notify.mjs takes HARNESS_NOTIFY_COMMAND.
865
+ */
866
+ function openHere(plan) {
867
+ if (!plan.ok || (!plan.link && !plan.app)) return plan;
868
+ const args =
869
+ process.platform === "darwin"
870
+ ? plan.link
871
+ ? [plan.link]
872
+ : ["-a", plan.app]
873
+ : plan.link
874
+ ? [plan.link]
875
+ : null;
876
+ if (!args)
877
+ return {
878
+ ok: false,
879
+ error: `${plan.opensIn ?? "Its app"} can only be opened on this computer itself.`,
880
+ };
881
+ const child = spawn(
882
+ process.env.HARNESS_OPEN_COMMAND ||
883
+ (process.platform === "darwin" ? "open" : "xdg-open"),
884
+ args,
885
+ {
886
+ detached: true,
887
+ stdio: "ignore",
888
+ }
889
+ );
890
+ child.on("error", () => {});
891
+ child.unref();
892
+ return { ok: true, opensIn: plan.opensIn, openedHere: true };
858
893
  }
859
894
 
860
895
  const COMMANDS = new Set([
package/lib/phones.mjs CHANGED
@@ -133,6 +133,10 @@ const BROWSER_READS = boardCommandsFor("browserReads");
133
133
  // The person's linked window adds a computer to the swarm: how a cloud worker joins, with home pinning its key exactly
134
134
  // as for a code the person typed here. Only as the person, never in a Harness chat call.
135
135
  const MACHINE_COMMANDS = boardCommandsFor("browserMachines");
136
+ // The phone, as the person: their computers and every one's sessions, the model each agent runs on, read and set on
137
+ // the computer that runs it, and which computer is Home or taken off the swarm (the Swarm tab, # in a message,
138
+ // sessions by computer). Adding a computer stays on the computers themselves, which pair by a code typed there.
139
+ const PHONE_MACHINE_COMMANDS = boardCommandsFor("phoneMachines");
136
140
  // The person's window signs a cloud computer's agents in (agentSignIn.mjs) and picks the model each runs on
137
141
  // (models.mjs): only there, and only as the person.
138
142
  const SIGN_IN_COMMANDS = boardCommandsFor("browserSignIn");
@@ -814,6 +818,29 @@ export async function createPhoneDesk({
814
818
  })
815
819
  );
816
820
  }
821
+ if (PHONE_MACHINE_COMMANDS.has(command)) {
822
+ const own = machines();
823
+ if (!own) return { ok: false, error: "this computer has no swarm list" };
824
+ if (command === "machines.list") return own.list();
825
+ if (command === "machines.live") return own.sessions();
826
+ if (command === "machines.live.read") return own.readSession(callInput);
827
+ if (command === "machines.models")
828
+ return own.models({ refresh: callInput.refresh === true });
829
+ if (command === "machines.home" || command === "machines.remove") {
830
+ // The phone names the computer it means; it never moves Home or removes one by leaving it out.
831
+ const computer = String(callInput.computer || "");
832
+ if (!computer) return { ok: false, error: "name the computer" };
833
+ return command === "machines.home"
834
+ ? own.makeHome(computer)
835
+ : own.remove(computer);
836
+ }
837
+ return own.setModel({
838
+ computer: callInput.computer,
839
+ target: callInput.target,
840
+ model: callInput.model,
841
+ effort: callInput.effort ?? null,
842
+ });
843
+ }
817
844
  // Lid-Closed Mode's wake: no arguments, never queued, and it can only keep the Mac awake and say how it is.
818
845
  if (command === "machine.wake") return { ok: true, machine: machine() };
819
846
  if (!PHONE_COMMANDS.has(command))
@@ -0,0 +1,42 @@
1
+ import { createHash } from "node:crypto";
2
+
3
+ // A thread's read for a reader away from this computer (the phone, or a browser through Harness). Its answer comes
4
+ // back sealed through Harness in one piece, and Harness takes about 1 MB (src/shared/bridge/sealedWire.ts MAX_CT),
5
+ // while a long T3 Code thread read whole is 1 to 3 MB. So such a reader gets the newest of the timeline up to
6
+ // RECENT_BYTES, a page a phone takes in a moment, and `start`, how many entries came before; asking with `before` (a
7
+ // `start` it holds) gives the page that ends there. A reader that sends the `version` it holds and still has it hears
8
+ // only that, so an open thread asked about every two seconds costs nothing while it is quiet.
9
+ export const RECENT_BYTES = 200_000;
10
+
11
+ /** `read` is board.swarm.read's whole answer; what goes back to a reader away from this computer. */
12
+ export function recentRead(read, { since, before } = {}) {
13
+ if (!read?.ok) return read;
14
+ const version = createHash("sha256")
15
+ .update(JSON.stringify(read))
16
+ .digest("base64url");
17
+ const paging = Number.isInteger(before);
18
+ if (!paging && since === version)
19
+ return { ok: true, unchanged: true, version };
20
+ const timeline = read.timeline ?? [];
21
+ const end = paging
22
+ ? Math.max(0, Math.min(before, timeline.length))
23
+ : timeline.length;
24
+ let start = end;
25
+ let bytes = 0;
26
+ while (start > 0) {
27
+ const size = JSON.stringify(timeline[start - 1]).length;
28
+ // One entry is always given, however long, so a reader never waits on a page that cannot come.
29
+ if (start < end && bytes + size > RECENT_BYTES) break;
30
+ bytes += size;
31
+ start--;
32
+ }
33
+ const shown = timeline.slice(start, end);
34
+ const seqs = new Set(shown.map((entry) => entry.seq));
35
+ return {
36
+ ...read,
37
+ timeline: shown,
38
+ posts: (read.posts ?? []).filter((post) => seqs.has(post.seq)),
39
+ start,
40
+ version,
41
+ };
42
+ }
package/lib/swarm.mjs CHANGED
@@ -27,6 +27,7 @@ import {
27
27
  import { askOfRun } from "./threadView.mjs";
28
28
  import { createWorkFocus } from "./workFocus.mjs";
29
29
  import { createListVersions } from "./listVersions.mjs";
30
+ import { recentRead } from "./recentRead.mjs";
30
31
  import { createWorkLinks } from "./workLinks.mjs";
31
32
  import {
32
33
  DEFAULT_ROUTING,
@@ -888,6 +889,9 @@ export function createSwarm({
888
889
  ? { ...result, thread: focus.decorate(result.thread) }
889
890
  : result
890
891
  )
892
+ .then((result) =>
893
+ request.recent === true ? recentRead(result, request) : result
894
+ )
891
895
  );
892
896
  if (command === "board.swarm.post" || command === "board.swarm.stop")
893
897
  return pending(
@@ -1594,8 +1598,10 @@ export function createSwarm({
1594
1598
  thread: summary(store.getTask(thread.id)),
1595
1599
  };
1596
1600
  }
1597
- if (command === "board.swarm.read")
1598
- return read(thread, request.hostedCaller === true);
1601
+ if (command === "board.swarm.read") {
1602
+ const whole = read(thread, request.hostedCaller === true);
1603
+ return request.recent === true ? recentRead(whole, request) : whole;
1604
+ }
1599
1605
  if (command === "board.swarm.diff")
1600
1606
  return worktrees.diff(
1601
1607
  thread.id,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "tryharness",
3
- "version": "0.7.60",
3
+ "version": "0.7.61",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "tryharness",
9
- "version": "0.7.60",
9
+ "version": "0.7.61",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@agentclientprotocol/sdk": "2.0.0",
@@ -32,9 +32,9 @@
32
32
  "node": ">=18"
33
33
  },
34
34
  "optionalDependencies": {
35
- "tryharness-desktop-darwin-arm64": "0.7.60",
36
- "tryharness-desktop-darwin-x64": "0.7.60",
37
- "tryharness-desktop-linux-x64": "0.7.60"
35
+ "tryharness-desktop-darwin-arm64": "0.7.61",
36
+ "tryharness-desktop-darwin-x64": "0.7.61",
37
+ "tryharness-desktop-linux-x64": "0.7.61"
38
38
  }
39
39
  },
40
40
  "node_modules/@agentclientprotocol/sdk": {
@@ -1051,9 +1051,9 @@
1051
1051
  }
1052
1052
  },
1053
1053
  "node_modules/tryharness-desktop-darwin-arm64": {
1054
- "version": "0.7.60",
1055
- "resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-arm64/-/tryharness-desktop-darwin-arm64-0.7.60.tgz",
1056
- "integrity": "sha512-7uNDCrD/XVR8RFD3exxb3v8SepC7TXCSfzSxT8hX8kHnSGkpqXm092sCqUB/nKFN9BTsmZz0eAYPqZeL7ePQNQ==",
1054
+ "version": "0.7.61",
1055
+ "resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-arm64/-/tryharness-desktop-darwin-arm64-0.7.61.tgz",
1056
+ "integrity": "sha512-KuiD0k77mtNAATnlAThb6HJCLLc1otUX+Y1vwI0qLwC+5kc+IrU2YgjkEvDsI6Php4L8TjMlh2nlLaq8vrB1Fg==",
1057
1057
  "cpu": [
1058
1058
  "arm64"
1059
1059
  ],
@@ -1064,9 +1064,9 @@
1064
1064
  ]
1065
1065
  },
1066
1066
  "node_modules/tryharness-desktop-darwin-x64": {
1067
- "version": "0.7.60",
1068
- "resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-x64/-/tryharness-desktop-darwin-x64-0.7.60.tgz",
1069
- "integrity": "sha512-uuDwUesFWhFbs8Yl9fgV2AYmzyYly3QEwuiQzJ9cK+5u0AiRxS10eZwneBP8KnKPLL3es9018ga0+cB9JRGatQ==",
1067
+ "version": "0.7.61",
1068
+ "resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-x64/-/tryharness-desktop-darwin-x64-0.7.61.tgz",
1069
+ "integrity": "sha512-1XtM3gb4lJH3IKzfVXKP6s+g950LnJUXYUJq09BMpyzVfZRjYZVNE5HBWLwycyk3tRu57dCSrtKMOcxN7mwekA==",
1070
1070
  "cpu": [
1071
1071
  "x64"
1072
1072
  ],
@@ -1077,9 +1077,9 @@
1077
1077
  ]
1078
1078
  },
1079
1079
  "node_modules/tryharness-desktop-linux-x64": {
1080
- "version": "0.7.60",
1081
- "resolved": "https://registry.npmjs.org/tryharness-desktop-linux-x64/-/tryharness-desktop-linux-x64-0.7.60.tgz",
1082
- "integrity": "sha512-a4yMebCQ6avz5wZN5bcmrxj9p+gQKuOg8OieuRNAFwrd4k14K1d9LXlSUWiqAjK+d34ZU3A1Eqez/EjDX6iD0g==",
1080
+ "version": "0.7.61",
1081
+ "resolved": "https://registry.npmjs.org/tryharness-desktop-linux-x64/-/tryharness-desktop-linux-x64-0.7.61.tgz",
1082
+ "integrity": "sha512-z19MafI6xh2d2M5EjVKSw4ZaKnXKBQ6FnitAythLAsLr4Yz9X9MpkeRKSHEhM//BWBDKR2SJx5pojww8KmjJJg==",
1083
1083
  "cpu": [
1084
1084
  "x64"
1085
1085
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryharness",
3
- "version": "0.7.60",
3
+ "version": "0.7.61",
4
4
  "description": "Harness Relay: the daemon that turns the agents on this machine into your personal swarm. Memory, history, and work handed between any of them.",
5
5
  "bin": {
6
6
  "tryharness": "cli.mjs"
@@ -48,8 +48,8 @@
48
48
  "zod": "4.6.7"
49
49
  },
50
50
  "optionalDependencies": {
51
- "tryharness-desktop-darwin-arm64": "0.7.60",
52
- "tryharness-desktop-darwin-x64": "0.7.60",
53
- "tryharness-desktop-linux-x64": "0.7.60"
51
+ "tryharness-desktop-darwin-arm64": "0.7.61",
52
+ "tryharness-desktop-darwin-x64": "0.7.61",
53
+ "tryharness-desktop-linux-x64": "0.7.61"
54
54
  }
55
55
  }
package/release.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest": {
3
3
  "name": "tryharness",
4
- "version": "0.7.60",
4
+ "version": "0.7.61",
5
5
  "files": {
6
6
  "README.md": "b1c3d6f614dd896b6ffda089c512811ea21c41f2970181162cdba230ac7fb77e",
7
7
  "assets/dsh-plugin.mjs": "143d31361d3c34b0a9effdeaa9248f1df6166f9bb45826a9a96ec9aa21899411",
@@ -30,7 +30,7 @@
30
30
  "lib/boardFileCommands.mjs": "464449d6c2119f749e7f03796c8b1cab2d66ee005ffb93722bf4ba6f97931a32",
31
31
  "lib/boardFiles.mjs": "3e0855e7153824cdfb75e2a0a6fe15fd6c2b2d0761403fb9cb144cabb1756c92",
32
32
  "lib/boardMirror.mjs": "063e62a981011420207eecd8b8689f8afc1939f6b4ecd6b1409d5634298c0844",
33
- "lib/boardProtocol.json": "fb59678e5aba87c94cf483d3b3e9624ae9984422c69b09ada8d14b36239f2e3c",
33
+ "lib/boardProtocol.json": "68fca0123c6a9dcebca6716218950a71b59a580c649fab2cdd388bf9384317b9",
34
34
  "lib/boardProtocol.mjs": "9148f3e2905b5de761d5c5651686d131da66285579650fd1ad7b46b6ecc17a47",
35
35
  "lib/boardThreads.mjs": "e78dc7fd22540ad0e201f312ea8e575d21463079e7ad42aae76d89c465698fdc",
36
36
  "lib/boardTools.mjs": "54a6b354b1316c1380b788e394511cc568a2bfc22b553e0f8a58a786450a1a63",
@@ -68,7 +68,7 @@
68
68
  "lib/digest.mjs": "bcfb988a02dfc118f20d67a9e549be5640eae374a714a3d484fec86454caf04a",
69
69
  "lib/directLink.mjs": "ea6a56006c1a50aebe37bf65a9a3e3ae4d90d3be460103437ecf6372011af072",
70
70
  "lib/environment.mjs": "edbb17ec89177ebe6945bdc431acbab9df4eaf1a79f21794ebd85cf64104b3c4",
71
- "lib/environments.mjs": "0a36a557224fff86dfde68d98140a2967ee1e366f6b98c12b3d841c90871df88",
71
+ "lib/environments.mjs": "d8e2a3ba2d586d07740890bd0c9a3071eb801d9d38197488f4ef3e5bb3964723",
72
72
  "lib/files.mjs": "39145b9c2722f2024d37631d6dfeb44951221f3ff02b5b8dabe6182814b7adfa",
73
73
  "lib/firewall.mjs": "9f5b1dc3a4e24283a0427a59f35731442dc8d7a507a64a60bb36c66c2a5fa0a8",
74
74
  "lib/fit.mjs": "8d25fac513347975894babb6c93eb7bac6c8329cf487865a31960343957f0e2d",
@@ -85,7 +85,7 @@
85
85
  "lib/hookDialects.mjs": "da62365cc29fd232b01664e4df9b7c514812791013f5d66590bd401669da7041",
86
86
  "lib/inference.mjs": "c4806947a38cf8e4cf0bf19056cf581d3a31cc20d88ed545655a60726c231dec",
87
87
  "lib/jobAnswers.mjs": "9dbecf86bb43ab97703e9d0dc75ba6858fd447a467ee08a2b527acaf51a16ac7",
88
- "lib/landed.mjs": "0ea8dc254739803995cee35e39060491fa45cf73a598360d3ab9ba105e6b2b6a",
88
+ "lib/landed.mjs": "7844a475a1b1e23c4a03dca3f2773934882f9c0d724f56777fb2a25b3d84b0b4",
89
89
  "lib/lane.mjs": "613befd439d81e8c291d9acad2a21fe29bcadfb3c8aa80e71dcda33c7fac0950",
90
90
  "lib/learn.mjs": "cf87dfb0fc5bfafb8dec277c6c0b824ecb57531934fc762d6066f486936a11ff",
91
91
  "lib/lessons.mjs": "481ebe472010c0d0a4cedfdaea94570065d68ee8dc1c2e8e0e4e67b7e2a8f176",
@@ -129,7 +129,7 @@
129
129
  "lib/personModel.mjs": "257ce37a85d0d2b6693ab1c7c720d338e9d03f2a7fe38702d475dfd0c3061565",
130
130
  "lib/personNotices.mjs": "2f7a8bc4701ce57440ef29ee7fdbddd98488ef35b2e82a0c3812f56556a440c1",
131
131
  "lib/personal.mjs": "0261690805651e6590eb6cbcccc713f034bf2acdd5248b8238880b2ff783c722",
132
- "lib/phones.mjs": "59a777edc10fcbef95ea1de2aaa196c53629f0fc0d4a33613b945090daff2662",
132
+ "lib/phones.mjs": "c9140852b71b24da5c27d971f21020e4c7065144b23394bf03dd1f33bd452cbb",
133
133
  "lib/placeCommands.mjs": "ca9572fbe6ac36761b00e8d734d7e18a82a887388294eb89970edd65dd1577ef",
134
134
  "lib/places.mjs": "8cca0d5806aa6d23f52fced69fc2d87ee47779b352d71765792cf12521ed12ed",
135
135
  "lib/plans.mjs": "dd60476faa801fc3cfb8adcb50030d975cbf555825b0407494c309934b342356",
@@ -144,6 +144,7 @@
144
144
  "lib/readers.mjs": "1e7c851751a25658e2348d05223a344a9047870c7fb77818a60fc837d5cc46b8",
145
145
  "lib/readiness.mjs": "a7d5e4142a08e66c3dc90f1babc31032df872a00a629ca47e9d4cdc0f69a860e",
146
146
  "lib/receipts.mjs": "b73e263055dd3293f71027b69c12dd99a53a7388a49ac9cbcdf525ba0f599c31",
147
+ "lib/recentRead.mjs": "a800f306f5f102914e41ba17d7ae20d64e8d027a322572d5183a325a448fbb5b",
147
148
  "lib/record.mjs": "9acc85150049201edcd6d380e25e0d228838e4801fd4e51818439b76a2178d5a",
148
149
  "lib/redact.mjs": "31e5f1dc32009c52f387fd7c9cd979e639a11a6eef78d165c7ce802d3095492e",
149
150
  "lib/relayLimits.mjs": "bd6c9b8338b5a29f66434aa62bf39c1c9501383ece6f89ed9da1a1c68b284ebc",
@@ -180,7 +181,7 @@
180
181
  "lib/store.mjs": "46363b7088b20693117124ab6b66f1132bd27f35d85334bd00348d0fc2750948",
181
182
  "lib/stuck.mjs": "2b69af1712be31484ac0d88e05ca88d8be72d5653f2c9510d3c793362c43dfc2",
182
183
  "lib/subagents.mjs": "bf3d18a213881b49e1bd5e093353d0cccff8121f9859a9bd34ad30ec108f4125",
183
- "lib/swarm.mjs": "a921adda9a98cb8855c2a2fa54e7d7df382ff87962f2236023e49779915dc1c5",
184
+ "lib/swarm.mjs": "42f774c154f7417830ed440544b4aa35bb24e6f82904f2984a852d8bf02e130c",
184
185
  "lib/swarmDevices.mjs": "9b6af0854c3fe3c673fc552b6dcc93a8f2f881cba215975151b083c7c6aeb353",
185
186
  "lib/swarmMemory.mjs": "2e166c87ef5eb186d10ba8937ab3a454fb7900e1951cb3ba5adc15d2091e86de",
186
187
  "lib/t3.mjs": "9b2b452d52a2e862f5fa84a81e51c448f0a05465c249fc3ec83eba1b308afb83",
@@ -213,10 +214,10 @@
213
214
  "lib/workFocus.mjs": "08d3002d6114859bf7623fbcb62a5ed1dd12cecba6c8e37ed55a550a15a207a4",
214
215
  "lib/workLinks.mjs": "8269180900fdf5fbd547a4c2337bcde4d5f733621c5b72bc2c23f01e72ad3d7d",
215
216
  "lib/worktrees.mjs": "a040441863ee76e39e292e262b903b392e12d4158aa886e4c237b6fa98c0d7d2",
216
- "npm-shrinkwrap.json": "c3330b710145aa9929d872f7292ee6282880ff811d009340de5bb3e21772eb15",
217
- "package.json": "716ee5bf91298810471b16de86aaf8b2e65955f385187996aca9cb191c15de00"
217
+ "npm-shrinkwrap.json": "51f3add8632b392afca8d00d4052b458e40cf4e1dc8d31e788bcfedcb1d70cb4",
218
+ "package.json": "16f1c4fbde1b5218d8d8a1f894f129bc0dc71e43907c926a702cef01e05126e6"
218
219
  }
219
220
  },
220
221
  "key": "5bf9e60f5cabb530",
221
- "signature": "uEJNyLR8vrMyePcy+FbJnvMPvjUyF9nh4r3ejb3MB0AIN/H5RWxc6pL0Tcv6ljFfEeTpEJVe8z9L5gnfJFOrDQ=="
222
+ "signature": "8aO4In15dXr55K1Z6H1vhB0UCHaRWNTsxsrtr/aB7Yg1sFpj1Qz68jNlWtWPaX7GfVKGPjyHyJ0vIlS/9W6OBg=="
222
223
  }