tryharness 0.7.45 → 0.7.54

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 (125) hide show
  1. package/README.md +239 -14
  2. package/assets/dsh-plugin.mjs +72 -0
  3. package/assets/opencode-plugin.js +4 -3
  4. package/cli.mjs +497 -196
  5. package/lib/actorRoster.mjs +28 -5
  6. package/lib/adapters.mjs +165 -222
  7. package/lib/agentRuntimeConfig.mjs +36 -0
  8. package/lib/agentRuntimes.mjs +570 -0
  9. package/lib/agentSignIn.mjs +226 -0
  10. package/lib/atlas.mjs +7 -2
  11. package/lib/audit.mjs +643 -0
  12. package/lib/backupSetup.mjs +141 -0
  13. package/lib/boardAccess.mjs +8 -1
  14. package/lib/boardBackup.mjs +283 -0
  15. package/lib/boardCommands.mjs +5 -10
  16. package/lib/boardFileCommands.mjs +2 -1
  17. package/lib/boardMirror.mjs +523 -0
  18. package/lib/boardProtocol.json +263 -6
  19. package/lib/boardTools.mjs +2 -6
  20. package/lib/boardWaits.mjs +102 -0
  21. package/lib/book.mjs +659 -0
  22. package/lib/bridge.mjs +26 -4
  23. package/lib/browserWake.mjs +60 -0
  24. package/lib/cards.mjs +159 -16
  25. package/lib/cloudBoot.mjs +124 -0
  26. package/lib/commands.mjs +25 -5
  27. package/lib/connectionTools.d.ts +13 -0
  28. package/lib/connectionTools.js +45 -0
  29. package/lib/connectorAuth.mjs +309 -0
  30. package/lib/connectorCatalog.json +41 -0
  31. package/lib/connectorCommands.mjs +121 -0
  32. package/lib/connectorGoogle.mjs +513 -0
  33. package/lib/connectors.mjs +805 -0
  34. package/lib/context.mjs +18 -4
  35. package/lib/contractGate.mjs +377 -0
  36. package/lib/coordinator.mjs +152 -39
  37. package/lib/coreModels.mjs +78 -0
  38. package/lib/daemon.mjs +973 -54
  39. package/lib/desk.mjs +239 -0
  40. package/lib/desktop.mjs +113 -8
  41. package/lib/digest.mjs +32 -0
  42. package/lib/directLink.mjs +283 -0
  43. package/lib/environments.mjs +825 -0
  44. package/lib/folders.mjs +4 -4
  45. package/lib/gitHost.mjs +174 -0
  46. package/lib/goalCommands.mjs +58 -14
  47. package/lib/hookDialects.mjs +298 -0
  48. package/lib/inference.mjs +263 -152
  49. package/lib/landed.mjs +887 -0
  50. package/lib/lessons.mjs +6 -0
  51. package/lib/lineup.mjs +324 -0
  52. package/lib/live.mjs +284 -13
  53. package/lib/localmodels.mjs +10 -0
  54. package/lib/machineIdentity.mjs +3 -0
  55. package/lib/machineRoutes.mjs +40 -2
  56. package/lib/machineRuns.mjs +30 -3
  57. package/lib/machineSeal.mjs +69 -10
  58. package/lib/mcp-stdio.mjs +189 -120
  59. package/lib/mcpRelay.mjs +119 -0
  60. package/lib/members.json +26 -0
  61. package/lib/members.mjs +33 -0
  62. package/lib/modelMemory.mjs +100 -0
  63. package/lib/models.mjs +48 -15
  64. package/lib/museSession.mjs +122 -0
  65. package/lib/nativeHost.mjs +203 -0
  66. package/lib/neovim.mjs +126 -0
  67. package/lib/network.mjs +7 -2
  68. package/lib/nudge.mjs +57 -18
  69. package/lib/onboard.mjs +430 -1
  70. package/lib/oneclawLocal.mjs +150 -0
  71. package/lib/ownMachines.mjs +828 -39
  72. package/lib/pairing.mjs +182 -0
  73. package/lib/paths.mjs +8 -0
  74. package/lib/personModel.mjs +89 -0
  75. package/lib/phones.mjs +119 -3
  76. package/lib/placeCommands.mjs +27 -0
  77. package/lib/places.mjs +337 -9
  78. package/lib/plans.mjs +151 -27
  79. package/lib/profile.mjs +152 -0
  80. package/lib/projects.mjs +624 -137
  81. package/lib/readiness.mjs +400 -0
  82. package/lib/record.mjs +115 -0
  83. package/lib/repoLinks.mjs +354 -0
  84. package/lib/roomChannels.mjs +641 -0
  85. package/lib/runBrief.mjs +32 -2
  86. package/lib/runRequests.mjs +157 -0
  87. package/lib/runWorker.mjs +37 -9
  88. package/lib/runner.mjs +74 -11
  89. package/lib/secretPatterns.json +55 -0
  90. package/lib/secrets.mjs +10 -27
  91. package/lib/seen.mjs +102 -0
  92. package/lib/service.mjs +11 -6
  93. package/lib/sessionControl.mjs +386 -96
  94. package/lib/sessionIndex.mjs +5 -3
  95. package/lib/specialties.json +74 -0
  96. package/lib/specialties.mjs +477 -0
  97. package/lib/specialtyKeys.d.ts +3 -0
  98. package/lib/specialtyKeys.js +58 -0
  99. package/lib/specialtyNotice.mjs +147 -0
  100. package/lib/specialtySnapshot.mjs +138 -0
  101. package/lib/store.mjs +829 -29
  102. package/lib/subagents.mjs +8 -4
  103. package/lib/swarm.mjs +483 -37
  104. package/lib/swarmMemory.mjs +947 -0
  105. package/lib/t3.mjs +56 -17
  106. package/lib/taskCommands.mjs +91 -13
  107. package/lib/taskRuns.mjs +68 -11
  108. package/lib/team.json +253 -144
  109. package/lib/team.mjs +538 -147
  110. package/lib/threadLine.mjs +116 -0
  111. package/lib/threadRuns.mjs +78 -12
  112. package/lib/threadView.mjs +66 -16
  113. package/lib/tokenizer.mjs +405 -0
  114. package/lib/ui.mjs +16 -2
  115. package/lib/usageTotals.mjs +148 -0
  116. package/lib/vault.mjs +1144 -0
  117. package/lib/vaultCloud.mjs +117 -0
  118. package/lib/vaultCommands.mjs +201 -0
  119. package/lib/vaultTools.d.ts +12 -0
  120. package/lib/vaultTools.js +42 -0
  121. package/lib/windowAsks.mjs +42 -0
  122. package/lib/workFocus.mjs +59 -0
  123. package/lib/workLinks.mjs +90 -0
  124. package/lib/worktrees.mjs +51 -13
  125. package/package.json +10 -5
package/lib/seen.mjs ADDED
@@ -0,0 +1,102 @@
1
+ // What the person saw, for the swarm's memory (owner, October 22: the swarm should know what the person has seen, read
2
+ // from the Harness extension's hidden page, "part of the memories" rather than on its own clock). Each dream asks the
3
+ // person's Harness window (windowAsks.mjs, which wakes the hidden page) for one described frame per hour since the last
4
+ // read, by browser, and drops what the person deleted there since.
5
+ //
6
+ // It stays on this computer: never sent to Harness's server (no dream reads it), never in a brief (the person's local
7
+ // agents run on hosted models too), and recall shows it to the person's own searches only (default no, owner,
8
+ // October 22). Frames themselves stay in the browser; this keeps only their descriptions.
9
+
10
+ // The answering browser keeps what it last read for at most this many of the frames kept here.
11
+ const KEPT_REFS = 200;
12
+ const SHOWN = 6;
13
+
14
+ export function createSeen({
15
+ store,
16
+ askWindows,
17
+ // Whether Harness can carry a sealed question to the window now (connected, and it offers sealed_ask).
18
+ canAsk = () => true,
19
+ log = () => {},
20
+ }) {
21
+ const cursorKey = (browser) => `seen-cursor:${browser}`;
22
+ // Every browser read so far, kept apart from what it saw: one whose items were all forgotten keeps its place.
23
+ const browsers = () => {
24
+ try {
25
+ return JSON.parse(store.meta("seen-browsers") || "[]");
26
+ } catch {
27
+ return [];
28
+ }
29
+ };
30
+
31
+ /** One read from the person's window: { ok, kept, gone } or { ok: false, why }. */
32
+ const read = async () => {
33
+ if (!canAsk())
34
+ return { ok: false, why: "Harness cannot reach the person's window now" };
35
+ const known = browsers();
36
+ const reply = await askWindows({
37
+ tool: "screen_seen_since",
38
+ agent: "memory",
39
+ input: {
40
+ since: Object.fromEntries(
41
+ known.map((browser) => [
42
+ browser,
43
+ Number(store.meta(cursorKey(browser))) || 0,
44
+ ])
45
+ ),
46
+ kept: Object.fromEntries(
47
+ known.map((browser) => [browser, store.seenRefs(browser, KEPT_REFS)])
48
+ ),
49
+ },
50
+ });
51
+ if (!reply?.ok) return { ok: false, why: reply?.error || "no answer" };
52
+ let answer;
53
+ try {
54
+ answer = JSON.parse(reply.text);
55
+ } catch {
56
+ return { ok: false, why: "the window's answer was not readable" };
57
+ }
58
+ const browser = String(answer.browser || "");
59
+ if (!browser) return { ok: false, why: "the window did not say who it is" };
60
+ if (!known.includes(browser))
61
+ store.meta("seen-browsers", JSON.stringify([...known, browser]));
62
+ let kept = 0;
63
+ for (const item of answer.seen ?? [])
64
+ if (
65
+ Number.isInteger(item.ref) &&
66
+ typeof item.text === "string" &&
67
+ item.text.trim() &&
68
+ store.addSeen({
69
+ window: browser,
70
+ ref: item.ref,
71
+ at: new Date(Number(item.at)).toISOString(),
72
+ text: item.text.slice(0, 1_000),
73
+ frames: Number(item.frames) || 1,
74
+ })
75
+ )
76
+ kept++;
77
+ let gone = 0;
78
+ for (const ref of answer.gone ?? [])
79
+ if (store.removeSeen(`${browser}:${ref}`)) gone++;
80
+ if (Number.isFinite(answer.through))
81
+ store.meta(cursorKey(browser), String(answer.through));
82
+ if (kept || gone) log(`seen: kept ${kept}, dropped ${gone} deleted`);
83
+ return { ok: true, kept, gone };
84
+ };
85
+
86
+ const view = (row) => ({
87
+ id: row.id,
88
+ at: row.at,
89
+ text: row.text,
90
+ frames: row.frames,
91
+ });
92
+
93
+ return {
94
+ read,
95
+ /** What the person saw that matches a search of theirs, best first. */
96
+ matching: (query, limit = SHOWN) =>
97
+ store.seenMatching(query, limit).map(view),
98
+ list: (options) => store.seen(options).map(view),
99
+ /** The person forgets one by id: true when it was kept. */
100
+ forget: (id) => store.removeSeen(String(id)),
101
+ };
102
+ }
package/lib/service.mjs CHANGED
@@ -2,7 +2,7 @@ import fs from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { spawn } from "node:child_process";
5
- import { resolveCommand, run } from "./commands.mjs";
5
+ import { detectAgents, run } from "./commands.mjs";
6
6
  import { ensureDir } from "./files.mjs";
7
7
  import { paths } from "./paths.mjs";
8
8
  import { appProgram } from "./desktop.mjs";
@@ -143,9 +143,8 @@ function agentPath() {
143
143
  "/usr/bin",
144
144
  "/bin",
145
145
  ]);
146
- for (const command of ["claude", "codex", "pi", "opencode"]) {
147
- const found = resolveCommand(command);
148
- if (found) dirs.add(path.dirname(found));
146
+ for (const agent of detectAgents()) {
147
+ if (agent.path) dirs.add(path.dirname(agent.path));
149
148
  }
150
149
  return [...dirs].join(path.delimiter);
151
150
  }
@@ -243,7 +242,12 @@ export function installService({
243
242
  run("launchctl", ["kickstart", "-k", `${domain}/${LABEL}`]);
244
243
  return { manager: "launchd", file: plist };
245
244
  }
246
- if (platform === "linux") {
245
+ // A Linux computer without a systemd user session (a container, WSL, a minimal install) starts the daemon for this
246
+ // login instead, as other platforms do; setup used to stop here with "could not start Harness daemon with systemd".
247
+ if (
248
+ platform === "linux" &&
249
+ execute("systemctl", ["--user", "show-environment"]).ok
250
+ ) {
247
251
  const unit = servicePath();
248
252
  ensureDir(path.dirname(unit));
249
253
  fs.writeFileSync(
@@ -323,7 +327,8 @@ export function serviceInfo({
323
327
  manager:
324
328
  platform === "darwin"
325
329
  ? "launchd"
326
- : platform === "linux"
330
+ : platform === "linux" &&
331
+ execute("systemctl", ["--user", "show-environment"]).ok
327
332
  ? "systemd"
328
333
  : "detached",
329
334
  installed: Boolean(file && fs.existsSync(file)),