tryharness 0.7.83 → 0.7.86

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 (215) hide show
  1. package/README.md +21 -19
  2. package/assets/dsh-plugin.mjs +75 -4
  3. package/assets/herdr-mod/harness/main.js +367 -0
  4. package/assets/herdr-mod/harness/mod.json +6 -0
  5. package/assets/opencode-plugin.js +87 -22
  6. package/assets/pi-extension.ts +81 -2
  7. package/cli.mjs +544 -208
  8. package/lib/adapters.mjs +62 -27
  9. package/lib/agentBinaries.mjs +6 -8
  10. package/lib/agentClaims.mjs +168 -0
  11. package/lib/agentReadTools.json +415 -0
  12. package/lib/agentSignIn.mjs +17 -18
  13. package/lib/agentWiring.mjs +114 -0
  14. package/lib/archetypes.js +10 -11
  15. package/lib/attention.mjs +100 -0
  16. package/lib/audit.mjs +1 -1
  17. package/lib/backupSetup.mjs +6 -28
  18. package/lib/bankrApprovals.mjs +86 -0
  19. package/lib/boardAccess.mjs +40 -66
  20. package/lib/boardBackup.mjs +86 -85
  21. package/lib/boardCommands.mjs +28 -0
  22. package/lib/boardFileCommands.mjs +29 -36
  23. package/lib/boardFiles.mjs +83 -15
  24. package/lib/boardMirror.mjs +78 -11
  25. package/lib/boardProtocol.json +191 -123
  26. package/lib/boardThreads.mjs +19 -37
  27. package/lib/boardTools.mjs +22 -15
  28. package/lib/boardWatches.mjs +43 -15
  29. package/lib/bridge.mjs +7 -3
  30. package/lib/browserAgentTools.mjs +59 -0
  31. package/lib/browserWake.mjs +0 -6
  32. package/lib/cards.mjs +52 -0
  33. package/lib/circling.mjs +189 -0
  34. package/lib/cleanup.mjs +234 -0
  35. package/lib/cloudBoot.mjs +21 -4
  36. package/lib/cloudSave.mjs +46 -5
  37. package/lib/compaction.mjs +8 -1
  38. package/lib/completion.mjs +358 -0
  39. package/lib/computerDevices.mjs +853 -0
  40. package/lib/connectionStatus.mjs +34 -0
  41. package/lib/connectors.mjs +139 -1
  42. package/lib/coordinator.mjs +108 -14
  43. package/lib/coreModels.mjs +36 -12
  44. package/lib/daemon.mjs +2426 -338
  45. package/lib/daemonLock.mjs +103 -0
  46. package/lib/deviceDoor.mjs +308 -0
  47. package/lib/deviceIdentity.mjs +114 -0
  48. package/lib/deviceList.mjs +172 -0
  49. package/lib/deviceSeal.mjs +74 -0
  50. package/lib/dispatcher.mjs +497 -26
  51. package/lib/dispatches.mjs +3 -3
  52. package/lib/environment.mjs +2 -1
  53. package/lib/environments.mjs +67 -41
  54. package/lib/events.mjs +318 -0
  55. package/lib/facts.mjs +170 -0
  56. package/lib/fileSource.mjs +540 -0
  57. package/lib/files.mjs +47 -2
  58. package/lib/gitHost.mjs +39 -1
  59. package/lib/goalCommands.mjs +12 -80
  60. package/lib/handover.mjs +21 -16
  61. package/lib/harnessOffers.mjs +140 -15
  62. package/lib/herdr.mjs +100 -15
  63. package/lib/herdrAppCall.mjs +19 -0
  64. package/lib/herdrCore.mjs +59 -0
  65. package/lib/herdrRuns.mjs +1126 -0
  66. package/lib/hookDialects.mjs +235 -50
  67. package/lib/identityLink.mjs +81 -0
  68. package/lib/inference.mjs +31 -2
  69. package/lib/jamAccess.mjs +82 -0
  70. package/lib/{projectBoard.mjs → jamBoard.mjs} +5 -4
  71. package/lib/{projectGit.mjs → jamGit.mjs} +53 -15
  72. package/lib/jamKey.mjs +274 -0
  73. package/lib/{projectPieces.mjs → jamPieces.mjs} +35 -29
  74. package/lib/{projectSettings.mjs → jamSettings.mjs} +12 -22
  75. package/lib/jamStore.mjs +973 -0
  76. package/lib/jamUpgrade.mjs +112 -0
  77. package/lib/jams.mjs +3079 -0
  78. package/lib/kanban.mjs +13 -7
  79. package/lib/landed.mjs +5 -1
  80. package/lib/library.mjs +41 -22
  81. package/lib/limits.mjs +91 -0
  82. package/lib/lineDiff.mjs +97 -0
  83. package/lib/lineup.mjs +18 -13
  84. package/lib/link.mjs +584 -0
  85. package/lib/localStack.mjs +75 -16
  86. package/lib/localmodels.mjs +58 -78
  87. package/lib/loopBackstop.mjs +2 -1
  88. package/lib/machine.mjs +544 -0
  89. package/lib/machineLink.mjs +446 -0
  90. package/lib/machineRoutes.mjs +68 -19
  91. package/lib/machineRuns.mjs +85 -4
  92. package/lib/machineSeal.mjs +6 -31
  93. package/lib/manager.mjs +134 -12
  94. package/lib/mcp-stdio.mjs +492 -215
  95. package/lib/mcpRelay.mjs +34 -35
  96. package/lib/members.json +1 -1
  97. package/lib/modelRoute.mjs +162 -0
  98. package/lib/nativeHost.mjs +81 -90
  99. package/lib/nativeSenses.mjs +258 -0
  100. package/lib/nerves.mjs +523 -0
  101. package/lib/network.mjs +117 -278
  102. package/lib/networkPlaces.mjs +578 -0
  103. package/lib/nextStep.mjs +95 -0
  104. package/lib/notify.mjs +2 -2
  105. package/lib/nudge.mjs +116 -10
  106. package/lib/originals.mjs +216 -0
  107. package/lib/outsideEvents.mjs +383 -0
  108. package/lib/outsideRuns.mjs +230 -0
  109. package/lib/ownMachines.mjs +674 -256
  110. package/lib/pain.mjs +215 -0
  111. package/lib/pairing.mjs +91 -11
  112. package/lib/paths.mjs +42 -3
  113. package/lib/peerProcess.mjs +21 -7
  114. package/lib/peopleLink.mjs +268 -0
  115. package/lib/personNotices.mjs +3 -2
  116. package/lib/phones.mjs +252 -542
  117. package/lib/placeCards.mjs +282 -0
  118. package/lib/placeChecks.mjs +95 -0
  119. package/lib/placeCommands.mjs +8 -17
  120. package/lib/placeRequests.mjs +152 -0
  121. package/lib/placeStore.mjs +295 -0
  122. package/lib/placeTool.d.ts +12 -0
  123. package/lib/placeTool.js +40 -0
  124. package/lib/places.mjs +63 -14
  125. package/lib/plans.mjs +53 -8
  126. package/lib/presence.mjs +270 -0
  127. package/lib/privateNetwork.d.ts +2 -0
  128. package/lib/privateNetwork.js +93 -0
  129. package/lib/proposals.mjs +300 -0
  130. package/lib/publicFetch.d.ts +32 -0
  131. package/lib/publicFetch.js +248 -0
  132. package/lib/reach.mjs +128 -0
  133. package/lib/rebuildable.mjs +72 -0
  134. package/lib/recall.mjs +216 -0
  135. package/lib/record.mjs +13 -0
  136. package/lib/reflexes.mjs +392 -0
  137. package/lib/relayLimits.mjs +31 -2
  138. package/lib/releaseNotice.mjs +198 -0
  139. package/lib/removeHarness.mjs +15 -4
  140. package/lib/repoLinks.mjs +204 -35
  141. package/lib/runAuthority.mjs +102 -39
  142. package/lib/runBrief.mjs +93 -40
  143. package/lib/runRequests.mjs +52 -14
  144. package/lib/runUsage.mjs +31 -0
  145. package/lib/runWorker.mjs +74 -25
  146. package/lib/runner.mjs +289 -45
  147. package/lib/runtime-install.mjs +37 -8
  148. package/lib/schedules.mjs +171 -47
  149. package/lib/screenWatches.mjs +221 -0
  150. package/lib/sealed.mjs +12 -30
  151. package/lib/sealedThreads.mjs +198 -392
  152. package/lib/secretStore.mjs +178 -0
  153. package/lib/secrets.mjs +11 -0
  154. package/lib/seen.mjs +3 -9
  155. package/lib/selfUpdate.mjs +51 -15
  156. package/lib/senseCall.mjs +1514 -0
  157. package/lib/senseHook.mjs +114 -0
  158. package/lib/senseTools.mjs +1298 -0
  159. package/lib/sessionBriefs.mjs +87 -0
  160. package/lib/sessionControl.mjs +63 -13
  161. package/lib/sessionFiles.mjs +85 -0
  162. package/lib/setupChoices.mjs +12 -3
  163. package/lib/setupMode.mjs +70 -25
  164. package/lib/sharedKeys.mjs +166 -0
  165. package/lib/sleep.mjs +396 -0
  166. package/lib/sources.mjs +306 -0
  167. package/lib/speech.mjs +166 -411
  168. package/lib/spoken.mjs +210 -0
  169. package/lib/steerHook.mjs +3 -1
  170. package/lib/steerQueue.mjs +40 -11
  171. package/lib/store.mjs +323 -130
  172. package/lib/stuck.mjs +85 -7
  173. package/lib/swarm.mjs +157 -49
  174. package/lib/swarmDevices.mjs +25 -85
  175. package/lib/swarmMemory.mjs +93 -9
  176. package/lib/t3.mjs +73 -3
  177. package/lib/taskCommands.mjs +51 -60
  178. package/lib/taskRooms.mjs +30 -4
  179. package/lib/taskRules.json +29 -0
  180. package/lib/taskRules.mjs +21 -0
  181. package/lib/taskRuns.mjs +74 -11
  182. package/lib/team.mjs +2 -1
  183. package/lib/threadActions.mjs +37 -9
  184. package/lib/threadAuthority.mjs +4 -4
  185. package/lib/threadBriefs.mjs +173 -43
  186. package/lib/threadNotes.mjs +320 -0
  187. package/lib/threadRecord.mjs +491 -0
  188. package/lib/threadRuns.mjs +216 -108
  189. package/lib/threadView.mjs +27 -30
  190. package/lib/threadWatches.mjs +1962 -0
  191. package/lib/timeSense.mjs +839 -0
  192. package/lib/tripwires.mjs +454 -0
  193. package/lib/ui.mjs +1 -1
  194. package/lib/vault.mjs +560 -45
  195. package/lib/vaultCommands.mjs +5 -3
  196. package/lib/vaultPeers.mjs +165 -0
  197. package/lib/vaultTools.d.ts +4 -1
  198. package/lib/vaultTools.js +22 -1
  199. package/lib/verdicts.mjs +12 -26
  200. package/lib/versions.mjs +117 -0
  201. package/lib/waitTool.mjs +278 -0
  202. package/lib/wakePicture.mjs +268 -0
  203. package/lib/wakeQueue.mjs +108 -0
  204. package/lib/watchResponses.mjs +533 -0
  205. package/lib/watches.mjs +290 -145
  206. package/lib/windowAsks.mjs +80 -17
  207. package/lib/worktrees.mjs +159 -9
  208. package/npm-shrinkwrap.json +138 -631
  209. package/package.json +7 -6
  210. package/release.json +211 -129
  211. package/lib/callSessions.mjs +0 -51
  212. package/lib/directLink.mjs +0 -349
  213. package/lib/peopleBoard.mjs +0 -131
  214. package/lib/projects.mjs +0 -2917
  215. package/lib/roomChannels.mjs +0 -667
@@ -0,0 +1,415 @@
1
+ [
2
+ {
3
+ "name": "search_screen_semantic",
4
+ "description": "Search the screen history by MEANING (dense-text retrieval over frame annotations and OCR). Use for conceptual recall like 'the error about a missing API key'. Do NOT use it as a parallel fallback for a literal name, exact phrase, URL, ticker, or filename; search_screen_text is the precise primitive for those. Do not append speculative 'or' alternatives or generic category filler to the query. Returns a light manifest of matching frames (ref, timestamp, snippet, score); call get_frames to inspect candidate pixels privately, then show_frames_to_user only for frames that actually match. If inspected candidates are wrong, repeat the same search to continue: refs fetched with get_frames are automatically excluded for the rest of the turn. To continue from an earlier turn, pass those rejected refs in exclude_refs. Use time_hint ONLY when the user explicitly says newest/most recent/last or oldest/older. Do not infer recency from an unbounded request like 'find/show me some screenshots'. For 'the most recent X' / 'the last time I saw X', pass time_hint 'recent' once; do not run repeated searches and compare timestamps. For content the user places at a TIME ('the error I saw yesterday morning'), add from_hours_ago/to_hours_ago to search WITHIN that window — more precise than recall_at_time (which is clock-anchored and ignores content). This searches the PAST buffer, not the live screen: for what is on screen right NOW use device_look, and if this returns nothing for a current-screen question, fall back to device_look rather than retrying search vectors. Search only when the user's message actually references past screen content — an idea, opinion, or general question that doesn't point at something they saw needs no history search at all. And route by where the answer LIVED: something said, decided, or pasted in a chat with you belongs to search_conversations, not pixels — check chat first for past-work questions, then come back here bounded by the chat hit's time if you still need what was on screen.",
5
+ "inputSchema": {
6
+ "type": "object",
7
+ "properties": {
8
+ "query": {
9
+ "type": "string",
10
+ "description": "the CONTENT to find, as one concise description of what the screen showed (e.g. 'error message about a missing API key in a terminal'). Describe the content itself, not a question. Do not append speculative 'or' alternatives or generic category filler that was not part of the request."
11
+ },
12
+ "time_hint": {
13
+ "type": "string",
14
+ "enum": [
15
+ "recent",
16
+ "older"
17
+ ],
18
+ "description": "ONLY when the user's wording explicitly asks for newest/most recent/last or oldest/older: sort the relevance-qualified matches by time. Omit for ordinary requests such as 'find/show me some screenshots', which require pure relevance ranking."
19
+ },
20
+ "from_hours_ago": {
21
+ "type": "number",
22
+ "description": "restrict to a time window: the OLDER edge, in hours before now (e.g. 30 for 'yesterday morning' when it's 2pm)"
23
+ },
24
+ "to_hours_ago": {
25
+ "type": "number",
26
+ "description": "restrict to a time window: the NEWER edge, in hours before now (0 = now; e.g. 20 to close a 'yesterday morning' window)"
27
+ },
28
+ "exclude_refs": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "string"
32
+ },
33
+ "description": "frame ids (ev_frame_…) already inspected and rejected; omit them to continue to the next relevance-qualified page. Repeating a search in the same turn automatically excludes frames fetched with get_frames, so normally pass this only when continuing from an earlier turn."
34
+ },
35
+ "max_frames": {
36
+ "type": "integer",
37
+ "description": "max frames to return (default 4)"
38
+ },
39
+ "device": {
40
+ "type": "string",
41
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
42
+ }
43
+ },
44
+ "required": [
45
+ "query"
46
+ ],
47
+ "additionalProperties": false
48
+ }
49
+ },
50
+ {
51
+ "name": "search_screen_visual",
52
+ "description": "Search the screen history by VISUAL appearance (CLIP image similarity). Use when the look matters more than the words, like 'the green candlestick chart' or 'the dark settings panel'. Returns a light manifest; call get_frames to view the pixels. If inspected candidates are wrong, repeat the same search to continue: refs fetched with get_frames are automatically excluded for the rest of the turn. To continue from an earlier turn, pass those rejected refs in exclude_refs. Use time_hint ONLY when the user explicitly says newest/most recent/last or oldest/older. Do not infer recency from an unbounded request like 'find/show me some screenshots'. For 'the most recent X' / 'the last time I saw X', pass time_hint 'recent' once; do not run repeated searches and compare timestamps. For content the user places at a TIME ('the error I saw yesterday morning'), add from_hours_ago/to_hours_ago to search WITHIN that window — more precise than recall_at_time (which is clock-anchored and ignores content). This searches the PAST buffer, not the live screen: for what is on screen right NOW use device_look, and if this returns nothing for a current-screen question, fall back to device_look rather than retrying search vectors. Search only when the user's message actually references past screen content — an idea, opinion, or general question that doesn't point at something they saw needs no history search at all. And route by where the answer LIVED: something said, decided, or pasted in a chat with you belongs to search_conversations, not pixels — check chat first for past-work questions, then come back here bounded by the chat hit's time if you still need what was on screen.",
53
+ "inputSchema": {
54
+ "type": "object",
55
+ "properties": {
56
+ "query": {
57
+ "type": "string",
58
+ "description": "an image-caption-style description of the scene's LOOK — layout, colors, distinctive elements (e.g. 'dark trading dashboard with a green candlestick chart'), not the text written on it"
59
+ },
60
+ "time_hint": {
61
+ "type": "string",
62
+ "enum": [
63
+ "recent",
64
+ "older"
65
+ ],
66
+ "description": "ONLY when the user's wording explicitly asks for newest/most recent/last or oldest/older: sort the relevance-qualified matches by time. Omit for ordinary requests such as 'find/show me some screenshots', which require pure relevance ranking."
67
+ },
68
+ "from_hours_ago": {
69
+ "type": "number",
70
+ "description": "restrict to a time window: the OLDER edge, in hours before now (e.g. 30 for 'yesterday morning' when it's 2pm)"
71
+ },
72
+ "to_hours_ago": {
73
+ "type": "number",
74
+ "description": "restrict to a time window: the NEWER edge, in hours before now (0 = now; e.g. 20 to close a 'yesterday morning' window)"
75
+ },
76
+ "exclude_refs": {
77
+ "type": "array",
78
+ "items": {
79
+ "type": "string"
80
+ },
81
+ "description": "frame ids (ev_frame_…) already inspected and rejected; omit them to continue to the next relevance-qualified page. Repeating a search in the same turn automatically excludes frames fetched with get_frames, so normally pass this only when continuing from an earlier turn."
82
+ },
83
+ "max_frames": {
84
+ "type": "integer",
85
+ "description": "max frames to return (default 4)"
86
+ },
87
+ "device": {
88
+ "type": "string",
89
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
90
+ }
91
+ },
92
+ "required": [
93
+ "query"
94
+ ],
95
+ "additionalProperties": false
96
+ }
97
+ },
98
+ {
99
+ "name": "search_screen_text",
100
+ "description": "Search the screen history by exact TEXT, domain, or named entity (Unicode-normalized, phrase/proximity-aware OCR with bounded typo tolerance for long words). This is the FIRST and normally ONLY search for literal names, strings, URLs, tickers, or filenames like 'HYPE/USDC' or 'github.com/foo/bar'; do not fan out to semantic search unless this precise search misses and the user described a concept too. Returns a light manifest of matching frames; call get_frames to inspect candidate pixels privately, then show_frames_to_user only for frames that actually match. If inspected candidates are wrong, repeat the same search to continue: refs fetched with get_frames are automatically excluded for the rest of the turn. To continue from an earlier turn, pass those rejected refs in exclude_refs. Use time_hint ONLY when the user explicitly says newest/most recent/last or oldest/older. Do not infer recency from an unbounded request like 'find/show me some screenshots'. For 'the most recent X' / 'the last time I saw X', pass time_hint 'recent' once; do not run repeated searches and compare timestamps. For content the user places at a TIME ('the error I saw yesterday morning'), add from_hours_ago/to_hours_ago to search WITHIN that window — more precise than recall_at_time (which is clock-anchored and ignores content). This searches the PAST buffer, not the live screen: for what is on screen right NOW use device_look, and if this returns nothing for a current-screen question, fall back to device_look rather than retrying search vectors. Search only when the user's message actually references past screen content — an idea, opinion, or general question that doesn't point at something they saw needs no history search at all. And route by where the answer LIVED: something said, decided, or pasted in a chat with you belongs to search_conversations, not pixels — check chat first for past-work questions, then come back here bounded by the chat hit's time if you still need what was on screen.",
101
+ "inputSchema": {
102
+ "type": "object",
103
+ "properties": {
104
+ "query": {
105
+ "type": "string",
106
+ "description": "ONLY the literal string(s) that appeared on screen — a domain, ticker, filename, or exact phrase (e.g. 'reddit.com', 'HYPE/USDC') — with no filler words around them"
107
+ },
108
+ "time_hint": {
109
+ "type": "string",
110
+ "enum": [
111
+ "recent",
112
+ "older"
113
+ ],
114
+ "description": "ONLY when the user's wording explicitly asks for newest/most recent/last or oldest/older: sort the relevance-qualified matches by time. Omit for ordinary requests such as 'find/show me some screenshots', which require pure relevance ranking."
115
+ },
116
+ "from_hours_ago": {
117
+ "type": "number",
118
+ "description": "restrict to a time window: the OLDER edge, in hours before now (e.g. 30 for 'yesterday morning' when it's 2pm)"
119
+ },
120
+ "to_hours_ago": {
121
+ "type": "number",
122
+ "description": "restrict to a time window: the NEWER edge, in hours before now (0 = now; e.g. 20 to close a 'yesterday morning' window)"
123
+ },
124
+ "exclude_refs": {
125
+ "type": "array",
126
+ "items": {
127
+ "type": "string"
128
+ },
129
+ "description": "frame ids (ev_frame_…) already inspected and rejected; omit them to continue to the next relevance-qualified page. Repeating a search in the same turn automatically excludes frames fetched with get_frames, so normally pass this only when continuing from an earlier turn."
130
+ },
131
+ "max_frames": {
132
+ "type": "integer",
133
+ "description": "max frames to return (default 4)"
134
+ },
135
+ "device": {
136
+ "type": "string",
137
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
138
+ }
139
+ },
140
+ "required": [
141
+ "query"
142
+ ],
143
+ "additionalProperties": false
144
+ }
145
+ },
146
+ {
147
+ "name": "recall_at_time",
148
+ "description": "Recall what was on screen at a specific past CLOCK TIME, anchored to the clock rather than content. Use for pure time questions like 'what was I looking at yesterday around 11pm?' or 'an hour ago?'. If the user names CONTENT plus a time ('the API error yesterday morning'), use the appropriate search_screen_* tool with from_hours_ago/to_hours_ago so relevance is evaluated inside that window. Estimate hours_ago from the current time given in context. The recall window is fuzzy and may return the nearest captured frames when nothing exists at the exact anchor; inspect the returned images and honor any drift note. Returned images are private model evidence and are not rendered as user-visible screenshot cards; use show_frames_to_user only for verified frames the user should see.",
149
+ "inputSchema": {
150
+ "type": "object",
151
+ "properties": {
152
+ "hours_ago": {
153
+ "type": "number",
154
+ "description": "how many hours before now to anchor on (fractional ok; e.g. 15 for 'yesterday ~11pm' when it's 2pm, 24 for 'this time yesterday')"
155
+ },
156
+ "max_frames": {
157
+ "type": "integer",
158
+ "description": "max frames to return (default 4)"
159
+ },
160
+ "device": {
161
+ "type": "string",
162
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
163
+ }
164
+ },
165
+ "required": [
166
+ "hours_ago"
167
+ ],
168
+ "additionalProperties": false
169
+ }
170
+ },
171
+ {
172
+ "name": "get_frames",
173
+ "description": "Fetch the actual images for specific frame refs (from a prior search/walk manifest, or from the 'Recent trajectory' block in your context — the lead-up to the user's question; for 'what just happened / a moment ago' questions, fetch the trajectory ref(s) for that moment directly instead of searching). This is the PRIVATE INSPECTION step: discovery tools only return text manifests, and get_frames shows pixels to you without rendering screenshot cards to the user. After inspection, use show_frames_to_user only for verified frames the user asked or would benefit to see. Refs stay valid for the WHOLE conversation: to revisit a frame from any earlier turn's manifest, pass its ref here directly — never re-run a search to find a frame you already have the ref for. At most 10 images fit one model request (across ALL tool calls this step, and newer frames displace older ones), so fetch at most 10 refs per call and review larger sets in sequential batches. RECENT frames (roughly the last 30 minutes of capture, this session) can be re-fetched at HIGH DETAIL: set detail:\"high\" (max 4 refs) when you need to identify someone/something or read fine print in a recent frame — especially to RE-CHECK a frame the user disputes. Older frames fall back to standard resolution with a note.",
174
+ "inputSchema": {
175
+ "type": "object",
176
+ "properties": {
177
+ "refs": {
178
+ "type": "array",
179
+ "items": {
180
+ "type": "string"
181
+ },
182
+ "description": "frame ids (ev_frame_…) to fetch, from a manifest or a look (at most 10 per call; 4 when detail is \"high\")"
183
+ },
184
+ "detail": {
185
+ "type": "string",
186
+ "description": "Set to \"high\" to fetch the frames at high detail (recent frames only — roughly the last 30 min of capture this session; older refs are served at standard resolution). Use for identification, fine print, or re-checking a disputed frame."
187
+ },
188
+ "device": {
189
+ "type": "string",
190
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
191
+ }
192
+ },
193
+ "required": [
194
+ "refs"
195
+ ],
196
+ "additionalProperties": false
197
+ }
198
+ },
199
+ {
200
+ "name": "get_transcript",
201
+ "description": "Read the DURABLE on-device transcript of shared tab audio — everything whisper heard (meetings, calls, videos), kept across sessions for ~30 days. This is the recall surface for SPOKEN content: 'what did they say', meeting recaps, decisions and action items, quotes — including audio from long before the rolling screen ledger's short window. Give the window in hours before now (fractional ok: from_hours_ago 1.5 to_hours_ago 0.5 reads the meeting an hour ago; omit both for the last 30 minutes); optional query returns only lines containing it. Returns timestamped lines, oldest first, with silence gaps marked. An empty result means no tab audio was being captured then (audio flows only on tab shares that include it), NOT that nothing was said. For what is visible on screen use the screen history tools — this reads only what was heard.",
202
+ "inputSchema": {
203
+ "type": "object",
204
+ "properties": {
205
+ "from_hours_ago": {
206
+ "type": "number",
207
+ "description": "window start, hours before now (fractional ok; default 0.5)"
208
+ },
209
+ "to_hours_ago": {
210
+ "type": "number",
211
+ "description": "window end, hours before now (default 0 = now)"
212
+ },
213
+ "query": {
214
+ "type": "string",
215
+ "description": "optional case-insensitive filter — only transcript lines containing this text return"
216
+ },
217
+ "device": {
218
+ "type": "string",
219
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
220
+ }
221
+ },
222
+ "additionalProperties": false
223
+ }
224
+ },
225
+ {
226
+ "name": "query_screen_history",
227
+ "description": "Run a read-only SQL SELECT over the local screen-history metadata tables when the fixed search tools can't express the question — counting, grouping, time-bucketing, cross-frame aggregation ('how many distinct tickers did I see today', 'which hour had the most scene changes', 'frames mentioning X grouped by day'). Tables: screen_frames_meta(ref bigint, ts bigint epoch-ms, trigger text — why the frame was captured: forced|hot-cell|scroll|settle|text-fire|heartbeat, annotation text, tags jsonb array, ocr_text text, entities jsonb array, created_at timestamptz); screen_episodes(id text, start_ts/end_ts bigint epoch-ms, status text, title text, narrative text, outcome text, domains/entities/frame_refs jsonb arrays, frame_count int, boundary_reason text, label_source text — activity-level segments over the frames; may be empty on devices without the episode layer); screen_episode_links(src_id, dst_id, kind text continues|interrupted_by|shares_entity, evidence text). Postgres dialect (PGlite); jsonb functions available. Results are capped at 200 rows — aggregate rather than dump. Rows are metadata only (no images): to SEE a frame, take its ref to get_frames. NOT for semantic/visual similarity (use search_screen_*) and NOT for a specific remembered moment (use recall_at_time).",
228
+ "inputSchema": {
229
+ "type": "object",
230
+ "properties": {
231
+ "sql": {
232
+ "type": "string",
233
+ "description": "a single SELECT statement over the screen-history tables (Postgres dialect; no writes, no other tables)"
234
+ },
235
+ "device": {
236
+ "type": "string",
237
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
238
+ }
239
+ },
240
+ "required": [
241
+ "sql"
242
+ ],
243
+ "additionalProperties": false
244
+ }
245
+ },
246
+ {
247
+ "name": "read_conversation",
248
+ "description": "Read a saved transcript from one of the user's past conversations on their device. The first call returns the most recent window; long conversations include stable olderCursor/newerCursor values, and every part remains reachable by paging. Reuse a returned cursor exactly. If the transcript changes, the old cursor is rejected as stale and you may restart once without it. search_conversations gives you the session id plus a short summary; call this when that summary is thinner than the question needs — exact wording, numbers, code, what was actually decided, or anything the summary only alludes to. Lean toward calling it: you do not need to be sure the detail is there, and a summary that merely mentions a topic is usually not enough to answer about it. The user's LIVE session can be read too — search_conversations marks it current:true; its transcript is complete through the last finished turn. Messages within each window are oldest-first; sourceAvailability says whether the device has the full source.",
249
+ "inputSchema": {
250
+ "type": "object",
251
+ "properties": {
252
+ "session_id": {
253
+ "type": "string",
254
+ "description": "the session id from a search_conversations result"
255
+ },
256
+ "cursor": {
257
+ "type": "string",
258
+ "description": "olderCursor or newerCursor returned by a previous read_conversation call"
259
+ },
260
+ "anchor_turn_id": {
261
+ "type": "string",
262
+ "description": "optional turn id returned by read_conversation to center or bound a window"
263
+ },
264
+ "direction": {
265
+ "type": "string",
266
+ "enum": [
267
+ "around",
268
+ "older",
269
+ "newer"
270
+ ],
271
+ "description": "window direction relative to anchor_turn_id; default around"
272
+ },
273
+ "max_chars": {
274
+ "type": "integer",
275
+ "description": "requested transcript characters for this window (clamped to 1000–8000)"
276
+ },
277
+ "device": {
278
+ "type": "string",
279
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
280
+ }
281
+ },
282
+ "required": [
283
+ "session_id"
284
+ ],
285
+ "additionalProperties": false
286
+ }
287
+ },
288
+ {
289
+ "name": "search_conversations",
290
+ "description": "Search the user's PAST conversations with you (other chat sessions) by topic. Returns the most relevant past sessions, each with its session summary and the specific remembered moments that matched. Invoke when the user refers to a previous conversation or something from another time ('what did we talk about yesterday', 'that plan we made', 'have we discussed X before'). For a time-anchored question ('yesterday', 'this morning', 'last week') ALWAYS pass from_hours_ago/to_hours_ago and order='chronological': every active session is enumerated newest-first even when its words don't match. When hasMore is true, call again with nextCursor unchanged; never paraphrase the query to get another page. A stale_cursor response means the index changed, so restart once without a cursor. Read the likely session with read_conversation before concluding work does not exist. For past questions this comes BEFORE any screen-history search: what was said, decided, or written in a chat is recorded here, while screen search only finds what pixels happened to show. Hits carry when the session was last active — reuse that timestamp to time-bound a follow-up screen search if you still need pixels. Distinct from recall_memories: recall_memories looks up stable facts and preferences about the user; search_conversations finds WHICH past conversation covered a topic and what happened in it. The conversation the user has open RIGHT NOW is included too, marked current:true — for questions about what the user is currently discussing, follow up with read_conversation on that hit's sessionId. Results are background context from past sessions, not current screen truth.",
291
+ "inputSchema": {
292
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
293
+ "type": "object",
294
+ "properties": {
295
+ "query": {
296
+ "type": "string",
297
+ "minLength": 1,
298
+ "description": "The topic, decision, or thing discussed to find in past conversations."
299
+ },
300
+ "limit": {
301
+ "description": "Page size. Defaults to 3 and is capped at 20.",
302
+ "type": "integer",
303
+ "exclusiveMinimum": 0,
304
+ "maximum": 20
305
+ },
306
+ "cursor": {
307
+ "description": "Opaque nextCursor returned by the previous search page. Reuse it exactly; do not edit it.",
308
+ "type": "string",
309
+ "minLength": 1,
310
+ "maxLength": 800
311
+ },
312
+ "order": {
313
+ "description": "Use chronological to enumerate a time window or all sessions newest-first. Defaults to relevance.",
314
+ "type": "string",
315
+ "enum": [
316
+ "relevance",
317
+ "chronological"
318
+ ]
319
+ },
320
+ "from_hours_ago": {
321
+ "description": "Start of a time window: only sessions active within the last N hours. For time-anchored questions ('yesterday', 'this morning', 'last week') ALWAYS pass a window — it also lists every session active in the window even when the topic words don't match, which is how you find work the user describes differently than it was written.",
322
+ "type": "number",
323
+ "exclusiveMinimum": 0
324
+ },
325
+ "to_hours_ago": {
326
+ "description": "End of the time window, in hours ago (0 = now). Use with from_hours_ago, e.g. yesterday = from 48 to 24.",
327
+ "type": "number",
328
+ "minimum": 0
329
+ },
330
+ "device": {
331
+ "type": "string",
332
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
333
+ }
334
+ },
335
+ "required": [
336
+ "query"
337
+ ],
338
+ "additionalProperties": false
339
+ }
340
+ },
341
+ {
342
+ "name": "recall_memories",
343
+ "description": "Recall scoped memories about this user. Invoke ONLY when the user's question requires recalling something they told you earlier (prior turn or session), or when their stable preferences would meaningfully change your answer. DO NOT invoke for questions about the current screen — the screen state is already provided in your context. DO NOT invoke for generic chit-chat or screen-grounded help. Returned memories are background context, not current screen truth.",
344
+ "inputSchema": {
345
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
346
+ "type": "object",
347
+ "properties": {
348
+ "query": {
349
+ "type": "string",
350
+ "minLength": 1,
351
+ "description": "Search query for relevant memories."
352
+ },
353
+ "limit": {
354
+ "description": "Maximum memories to return.",
355
+ "type": "integer",
356
+ "exclusiveMinimum": 0,
357
+ "maximum": 10
358
+ },
359
+ "as_of": {
360
+ "description": "ISO 8601 instant. Omit for what is true now. Set it to see what was true at that time, including facts later corrected.",
361
+ "type": "string",
362
+ "format": "date-time",
363
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
364
+ },
365
+ "device": {
366
+ "type": "string",
367
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
368
+ }
369
+ },
370
+ "required": [
371
+ "query"
372
+ ],
373
+ "additionalProperties": false
374
+ }
375
+ },
376
+ {
377
+ "name": "list_generated_media",
378
+ "description": "List what Harness generated for the user: images (held in a capped store on their device, newest first), videos (from background runs), and documents (docx/pptx/xlsx and other create_document files, from chat and background runs). Image entries carry an id for get_generated_image. Video and document entries carry a `download` URL — fetch it with the SAME Authorization: Bearer header this MCP connection uses (e.g. curl -H \"Authorization: Bearer $TOKEN\" -o report.docx \"<download>\") to save the file; the URL serves raw bytes, so never fetch it into your context.",
379
+ "inputSchema": {
380
+ "type": "object",
381
+ "properties": {
382
+ "limit": {
383
+ "type": "number",
384
+ "description": "max entries per kind (default 20, max 50)"
385
+ },
386
+ "device": {
387
+ "type": "string",
388
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
389
+ }
390
+ },
391
+ "additionalProperties": false
392
+ }
393
+ },
394
+ {
395
+ "name": "get_generated_image",
396
+ "description": "Fetch the pixels of one Harness-generated image by the id from list_generated_media; the image comes back as tool-result content. Images live in a capped on-device store, so an evicted id returns not_found along with the ids that still exist.",
397
+ "inputSchema": {
398
+ "type": "object",
399
+ "properties": {
400
+ "id": {
401
+ "type": "string",
402
+ "description": "the image id from list_generated_media"
403
+ },
404
+ "device": {
405
+ "type": "string",
406
+ "description": "Which of the user's browsers to read: a device id or name from list_devices. Each browser keeps its own screen history and memory. Leave it out for the browser on the computer you run on, else the user's home computer's browser, else the browser they used last."
407
+ }
408
+ },
409
+ "required": [
410
+ "id"
411
+ ],
412
+ "additionalProperties": false
413
+ }
414
+ }
415
+ ]
@@ -4,6 +4,7 @@ import path from "node:path";
4
4
  import { spawn, spawnSync } from "node:child_process";
5
5
  import { randomBytes } from "node:crypto";
6
6
  import { maskReason } from "./secrets.mjs";
7
+ import { updateJson } from "./files.mjs";
7
8
 
8
9
  const { cloud: CLOUD_LIST } = JSON.parse(
9
10
  fs.readFileSync(new URL("./members.json", import.meta.url), "utf8")
@@ -383,17 +384,14 @@ export function createAgentSignIn({
383
384
  return { ok: true };
384
385
  };
385
386
 
386
- const writeJson = (file, value) => {
387
- fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
388
- fs.writeFileSync(file, JSON.stringify(value, null, 2) + "\n", {
389
- mode: 0o600,
390
- });
391
- };
392
- const readJson = (file) => {
387
+ // The agent's own settings file, changed without losing anything else in it (files.mjs updateJson): a file that
388
+ // cannot be read is left as it is, and the person told why.
389
+ const keepIn = (file, change) => {
393
390
  try {
394
- return JSON.parse(fs.readFileSync(file, "utf8"));
395
- } catch {
396
- return {};
391
+ updateJson(file, change);
392
+ return null;
393
+ } catch (error) {
394
+ return { ok: false, error: error.message };
397
395
  }
398
396
  };
399
397
 
@@ -425,10 +423,11 @@ export function createAgentSignIn({
425
423
  if (agent === "claude-code") {
426
424
  // Claude Code reads the env block of its user settings for every run (code.claude.com settings).
427
425
  const file = path.join(home, ".claude", "settings.json");
428
- const settings = readJson(file);
429
- settings.env = { ...(settings.env || {}), ANTHROPIC_API_KEY: value };
430
- writeJson(file, settings);
431
- return { ok: true, provider: "anthropic", key: value };
426
+ const refused = keepIn(file, (settings) => ({
427
+ ...settings,
428
+ env: { ...(settings.env || {}), ANTHROPIC_API_KEY: value },
429
+ }));
430
+ return refused ?? { ok: true, provider: "anthropic", key: value };
432
431
  }
433
432
  const keyed = KEY_FILES[agent];
434
433
  if (!keyed)
@@ -441,11 +440,11 @@ export function createAgentSignIn({
441
440
  "Use a key from Anthropic, OpenAI, OpenRouter or xAI for this agent.",
442
441
  };
443
442
  const file = path.join(home, ...keyed.file);
444
- writeJson(file, {
445
- ...readJson(file),
443
+ const refused = keepIn(file, (saved) => ({
444
+ ...saved,
446
445
  [provider]: { type: keyed.type, key: value },
447
- });
448
- return { ok: true, provider, key: value };
446
+ }));
447
+ return refused ?? { ok: true, provider, key: value };
449
448
  };
450
449
 
451
450
  const close = () => {
@@ -0,0 +1,114 @@
1
+ import fs from "node:fs";
2
+ import { configureAgents } from "./adapters.mjs";
3
+ import { detectAgents } from "./commands.mjs";
4
+ import { readJson, updateJson } from "./files.mjs";
5
+ import { MACHINE_RUNNERS, nameOf } from "./members.mjs";
6
+ import { paths } from "./paths.mjs";
7
+
8
+ // Every agent in the person's swarm keeps Harness wired in, without the person doing anything (owner, November 11:
9
+ // "mcps should be added to needed agents on onboarding"). Setup and an agent joining write the wiring; this keeps it
10
+ // written. An agent update can rewrite its own config and drop Harness's entry, and a new Harness release moves the
11
+ // server the entry starts. Each agent's wiring is recorded with the release it points at and the agent's build (its
12
+ // executable's path and modification time); when either is no longer what it was written for, the wiring is written
13
+ // again by the same code setup uses (configureAgents). A check reads only file times, so it runs at start and each
14
+ // minute; nothing is written while nothing has changed.
15
+
16
+ /** The agent's build as its executable shows it: a reinstall or an update replaces the file. */
17
+ function buildOf(executable) {
18
+ try {
19
+ const real = fs.realpathSync(executable);
20
+ return `${real}@${fs.statSync(real).mtimeMs}`;
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+
26
+ /** What setup or an agent joining just wired, recorded so the daemon's checks start from it. */
27
+ export function wiringOf(states, runtimeRoot, detected = detectAgents()) {
28
+ const executable = new Map(
29
+ detected.map((entry) => [entry.agent, entry.path])
30
+ );
31
+ return Object.fromEntries(
32
+ states
33
+ .filter((state) => state.configured && executable.get(state.agent))
34
+ .map((state) => [
35
+ state.agent,
36
+ { runtimeRoot, build: buildOf(executable.get(state.agent)) },
37
+ ])
38
+ );
39
+ }
40
+
41
+ export function createAgentWiring({
42
+ inSwarm,
43
+ file = paths.config,
44
+ detect = detectAgents,
45
+ configure = configureAgents,
46
+ log = () => {},
47
+ everyMs = 60_000,
48
+ }) {
49
+ const check = () => {
50
+ const config = readJson(file, {});
51
+ const runtimeRoot = config.runtimeRoot;
52
+ if (!runtimeRoot) return [];
53
+ const recorded = config.agentWiring ?? {};
54
+ const rewired = [];
55
+ for (const { agent, path } of detect()) {
56
+ if (!path || !MACHINE_RUNNERS.includes(agent) || !inSwarm(agent))
57
+ continue;
58
+ const build = buildOf(path);
59
+ const wired = recorded[agent];
60
+ if (wired?.runtimeRoot === runtimeRoot && wired.build === build) continue;
61
+ const state = configure({ runtimeRoot, selected: [agent] }).find(
62
+ (entry) => entry.agent === agent
63
+ );
64
+ if (!state?.configured) {
65
+ // Tried again at the next check: the agent may be mid-update.
66
+ log(
67
+ `${nameOf(agent)}: Harness could not be wired in again: ${state?.detail ?? "no answer"}`
68
+ );
69
+ continue;
70
+ }
71
+ updateJson(file, (saved) => ({
72
+ ...saved,
73
+ agentStates: { ...saved.agentStates, [agent]: state },
74
+ agentWiring: {
75
+ ...saved.agentWiring,
76
+ [agent]: { runtimeRoot, build },
77
+ },
78
+ }));
79
+ rewired.push(agent);
80
+ log(
81
+ wired
82
+ ? `${nameOf(agent)} changed since Harness was wired in; wired in again`
83
+ : `${nameOf(agent)}: Harness's wiring recorded`
84
+ );
85
+ }
86
+ return rewired;
87
+ };
88
+ let timer = null;
89
+ return {
90
+ check,
91
+ start() {
92
+ // After the daemon's own start: writing an agent's config runs its command line, which takes a moment.
93
+ setTimeout(() => {
94
+ try {
95
+ check();
96
+ } catch (error) {
97
+ log(`agent wiring: ${error.message}`);
98
+ }
99
+ }, 0).unref?.();
100
+ timer = setInterval(() => {
101
+ try {
102
+ check();
103
+ } catch (error) {
104
+ log(`agent wiring: ${error.message}`);
105
+ }
106
+ }, everyMs);
107
+ timer.unref?.();
108
+ },
109
+ stop() {
110
+ if (timer) clearInterval(timer);
111
+ timer = null;
112
+ },
113
+ };
114
+ }