tryharness 0.7.54 → 0.7.57
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.
- package/README.md +15 -16
- package/cli.mjs +377 -62
- package/lib/activity.mjs +10 -10
- package/lib/adapters.mjs +16 -0
- package/lib/agentBinaries.mjs +71 -0
- package/lib/agentRuntimeConfig.mjs +1 -1
- package/lib/agentRuntimes.mjs +9 -3
- package/lib/agentSignIn.mjs +271 -41
- package/lib/answers.mjs +5 -5
- package/lib/archetypes.d.ts +64 -0
- package/lib/archetypes.js +989 -0
- package/lib/asks.mjs +4 -4
- package/lib/audit.mjs +36 -13
- package/lib/backupSetup.mjs +4 -2
- package/lib/boardAccess.mjs +17 -11
- package/lib/boardBackup.mjs +6 -6
- package/lib/boardFileCommands.mjs +6 -6
- package/lib/boardFiles.mjs +13 -12
- package/lib/boardMirror.mjs +82 -47
- package/lib/boardProtocol.json +30 -1
- package/lib/boardWaits.mjs +2 -3
- package/lib/book.mjs +6 -6
- package/lib/bridge.mjs +5 -5
- package/lib/cards.mjs +2 -2
- package/lib/cloudAgents.mjs +216 -0
- package/lib/cloudAi.mjs +1312 -0
- package/lib/cloudAssistants.mjs +242 -0
- package/lib/cloudBoot.mjs +81 -86
- package/lib/cloudSave.mjs +197 -0
- package/lib/cloudSsh.mjs +178 -0
- package/lib/context.mjs +3 -3
- package/lib/contractGate.mjs +34 -12
- package/lib/control-client.mjs +9 -1
- package/lib/controlSocket.mjs +86 -0
- package/lib/coordinator.mjs +103 -101
- package/lib/daemon.mjs +1128 -2865
- package/lib/desk.mjs +7 -6
- package/lib/desktop.mjs +72 -68
- package/lib/directLink.mjs +16 -5
- package/lib/environment.mjs +2 -1
- package/lib/environments.mjs +14 -6
- package/lib/firewall.mjs +9 -9
- package/lib/folders.mjs +18 -14
- package/lib/frames.mjs +2 -3
- package/lib/gitHost.mjs +3 -3
- package/lib/goalCommands.mjs +25 -7
- package/lib/goals.mjs +7 -7
- package/lib/guestRequests.mjs +94 -0
- package/lib/handoffs.mjs +8 -7
- package/lib/handover.mjs +4 -4
- package/lib/harnessModel.mjs +6 -6
- package/lib/harnessOffers.mjs +266 -0
- package/lib/inference.mjs +26 -8
- package/lib/jobAnswers.mjs +190 -0
- package/lib/landed.mjs +1 -1
- package/lib/lane.mjs +42 -11
- package/lib/lessons.mjs +16 -16
- package/lib/library.mjs +3 -3
- package/lib/lineup.mjs +3 -0
- package/lib/linkRelay.mjs +574 -0
- package/lib/localAgentAsk.mjs +74 -0
- package/lib/localStack.mjs +536 -0
- package/lib/localmodels.mjs +6 -4
- package/lib/loopBackstop.mjs +4 -4
- package/lib/machineIdentity.mjs +9 -1
- package/lib/machineRoutes.mjs +181 -2
- package/lib/machineRuns.mjs +76 -1
- package/lib/machineSeal.mjs +39 -12
- package/lib/mcp-stdio.mjs +96 -26
- package/lib/mcpRelay.mjs +1 -1
- package/lib/members.json +13 -0
- package/lib/members.mjs +1 -1
- package/lib/models.mjs +77 -23
- package/lib/museSession.mjs +6 -1
- package/lib/nativeHost.mjs +35 -7
- package/lib/network.mjs +50 -5
- package/lib/notify.mjs +7 -5
- package/lib/nudge.mjs +3 -3
- package/lib/ocr.mjs +9 -9
- package/lib/onboard.mjs +26 -20
- package/lib/oneLine.mjs +7 -7
- package/lib/ownMachines.mjs +928 -149
- package/lib/pairing.mjs +33 -6
- package/lib/paths.mjs +15 -1
- package/lib/peerProcess.mjs +124 -0
- package/lib/personModel.mjs +3 -3
- package/lib/personNotices.mjs +151 -0
- package/lib/phones.mjs +490 -38
- package/lib/placeCommands.mjs +4 -4
- package/lib/places.mjs +70 -2
- package/lib/profile.mjs +67 -14
- package/lib/projectGit.mjs +158 -14
- package/lib/projectPieces.mjs +902 -0
- package/lib/projectSettings.mjs +7 -4
- package/lib/projects.mjs +384 -62
- package/lib/provenance.mjs +5 -1
- package/lib/proxyLinks.mjs +267 -0
- package/lib/reactions.mjs +7 -5
- package/lib/readiness.mjs +12 -7
- package/lib/record.mjs +19 -6
- package/lib/redact.mjs +4 -4
- package/lib/relayLimits.mjs +62 -0
- package/lib/release.mjs +170 -0
- package/lib/releaseKeys.json +6 -0
- package/lib/repoLinks.mjs +4 -4
- package/lib/roomChannels.mjs +24 -0
- package/lib/roomPage.mjs +1 -1
- package/lib/runAuthority.mjs +101 -0
- package/lib/runBrief.mjs +19 -8
- package/lib/runWorker.mjs +14 -5
- package/lib/runner.mjs +215 -25
- package/lib/runtime-install.mjs +143 -9
- package/lib/schedules.mjs +2 -2
- package/lib/screens.mjs +1 -1
- package/lib/sealed.mjs +11 -2
- package/lib/sealedThreads.mjs +671 -0
- package/lib/secretPatterns.json +1 -1
- package/lib/secrets.mjs +4 -4
- package/lib/seen.mjs +6 -6
- package/lib/serverWords.mjs +175 -0
- package/lib/service.mjs +22 -12
- package/lib/sessionControl.mjs +6 -6
- package/lib/specialties.mjs +6 -6
- package/lib/specialtyKeys.js +4 -5
- package/lib/specialtyNotice.mjs +7 -7
- package/lib/specialtySnapshot.mjs +5 -5
- package/lib/speech.mjs +5 -5
- package/lib/store.mjs +140 -39
- package/lib/stuck.mjs +1 -1
- package/lib/swarm.mjs +167 -16
- package/lib/swarmDevices.mjs +319 -0
- package/lib/swarmMemory.mjs +27 -25
- package/lib/t3.mjs +13 -13
- package/lib/taskCommands.mjs +44 -11
- package/lib/taskRooms.mjs +125 -0
- package/lib/taskRuns.mjs +36 -1
- package/lib/team.mjs +41 -18
- package/lib/threadActions.mjs +315 -0
- package/lib/threadAuthority.mjs +101 -0
- package/lib/threadBriefs.mjs +178 -0
- package/lib/threadLine.mjs +2 -2
- package/lib/threadRuns.mjs +138 -43
- package/lib/threadView.mjs +5 -5
- package/lib/usageTotals.mjs +2 -3
- package/lib/vault.mjs +101 -10
- package/lib/vaultCloud.mjs +2 -2
- package/lib/vaultCommands.mjs +15 -6
- package/lib/vaultTools.js +2 -2
- package/lib/verdicts.mjs +328 -0
- package/lib/wakes.mjs +1 -1
- package/lib/watches.mjs +2 -2
- package/lib/windowAsks.mjs +13 -5
- package/lib/worktrees.mjs +112 -18
- package/npm-shrinkwrap.json +1093 -0
- package/package.json +11 -10
- package/release.json +220 -0
package/lib/machineRoutes.mjs
CHANGED
|
@@ -18,6 +18,12 @@ const LOCAL_OWNERS = new Set([
|
|
|
18
18
|
"nativeRequests",
|
|
19
19
|
]);
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Set on a board request by ownMachines.mjs alone, on home: the other computer the call came from. JSON cannot carry
|
|
23
|
+
* it, so no caller names a computer it is not on, and a request that has it came from another of the person's computers.
|
|
24
|
+
*/
|
|
25
|
+
export const FROM_MACHINE = Symbol("the computer a board call came from");
|
|
26
|
+
|
|
21
27
|
/** Whether a worker sends this board command to home. */
|
|
22
28
|
export const goesHome = (command) =>
|
|
23
29
|
String(command).startsWith("board.") &&
|
|
@@ -26,8 +32,8 @@ export const goesHome = (command) =>
|
|
|
26
32
|
!LOCAL_OWNERS.has(boardCommandOwner(String(command)));
|
|
27
33
|
|
|
28
34
|
// Writes an agent need not wait on: while home is out of reach the worker keeps them, sealed, and sends them when it is
|
|
29
|
-
// back. A post is one: any computer can start a task
|
|
30
|
-
//
|
|
35
|
+
// back. A post is one: any computer can start a task, with its id chosen there. A claim waits for its answer instead,
|
|
36
|
+
// since two computers could take the same task.
|
|
31
37
|
const QUEUEABLE = new Set([
|
|
32
38
|
"board.post",
|
|
33
39
|
"board.report",
|
|
@@ -133,3 +139,176 @@ export function withComputer(post, computerOf) {
|
|
|
133
139
|
const computer = computerOf(post.machine);
|
|
134
140
|
return computer ? { ...post, computer } : post;
|
|
135
141
|
}
|
|
142
|
+
|
|
143
|
+
// ---- what another of the person's computers may ask home to do (security audit 2026-10-25, M1) ----
|
|
144
|
+
|
|
145
|
+
// A worker's own upkeep with home, whoever it names: telling home its folders, taking and reporting the runs home keeps
|
|
146
|
+
// for its agents, the environment grants home's vault lends a run there (vault.mjs checks those itself).
|
|
147
|
+
const UPKEEP = new Set([
|
|
148
|
+
"board.machine.info",
|
|
149
|
+
"board.machine.runnable",
|
|
150
|
+
"board.machine.take",
|
|
151
|
+
"board.machine.session",
|
|
152
|
+
"board.machine.step",
|
|
153
|
+
"board.machine.finish",
|
|
154
|
+
"board.vault.env",
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
// What an agent on another computer does on home's board: what its Harness tools call there (mcp-stdio.mjs).
|
|
158
|
+
const AGENT_WORK = new Set([
|
|
159
|
+
"board.list",
|
|
160
|
+
"board.get",
|
|
161
|
+
"board.children",
|
|
162
|
+
"board.agents",
|
|
163
|
+
"board.post",
|
|
164
|
+
"board.claim",
|
|
165
|
+
"board.release",
|
|
166
|
+
"board.report",
|
|
167
|
+
"board.answer",
|
|
168
|
+
"board.context.add",
|
|
169
|
+
"board.context.search",
|
|
170
|
+
"board.trace",
|
|
171
|
+
"board.wait",
|
|
172
|
+
"board.wallet",
|
|
173
|
+
"board.standing.check",
|
|
174
|
+
"board.file.add",
|
|
175
|
+
"board.file.get",
|
|
176
|
+
"board.thread.read",
|
|
177
|
+
"board.thread.post",
|
|
178
|
+
"board.goal.list",
|
|
179
|
+
"board.goal.get",
|
|
180
|
+
"board.goal.finish",
|
|
181
|
+
"board.room.read",
|
|
182
|
+
"board.room.post",
|
|
183
|
+
"board.room.search",
|
|
184
|
+
"board.room.learn",
|
|
185
|
+
"board.swarm.list",
|
|
186
|
+
"board.swarm.read",
|
|
187
|
+
"board.swarm.agents",
|
|
188
|
+
"board.swarm.models",
|
|
189
|
+
"board.swarm.search",
|
|
190
|
+
"board.swarm.memory",
|
|
191
|
+
"board.swarm.forget",
|
|
192
|
+
"board.swarm.unforget",
|
|
193
|
+
"board.swarm.lessons",
|
|
194
|
+
"board.swarm.start",
|
|
195
|
+
"board.swarm.stop",
|
|
196
|
+
"board.swarm.note",
|
|
197
|
+
"board.swarm.health",
|
|
198
|
+
"board.swarm.rounds",
|
|
199
|
+
"board.swarm.checkins",
|
|
200
|
+
"board.swarm.checkin",
|
|
201
|
+
"board.swarm.checkin.remove",
|
|
202
|
+
"board.plan.add",
|
|
203
|
+
"board.template.list",
|
|
204
|
+
"board.template.get",
|
|
205
|
+
"board.template.use",
|
|
206
|
+
"board.project.plan",
|
|
207
|
+
"board.project.propose",
|
|
208
|
+
"board.desk.book",
|
|
209
|
+
"board.connector.list",
|
|
210
|
+
"board.connector.tools",
|
|
211
|
+
"board.connector.call",
|
|
212
|
+
"board.connector.result",
|
|
213
|
+
// A secret used through home, never handed over (vault.mjs keeps its own rules for another computer's agents).
|
|
214
|
+
"board.vault.list",
|
|
215
|
+
"board.vault.use",
|
|
216
|
+
]);
|
|
217
|
+
|
|
218
|
+
// The person at a computer they drive from does the board's work there as on home: posts, runs, answers, stops,
|
|
219
|
+
// threads. How the swarm is set up (standing permission, spend ceilings, connectors' grants, the vault, the relay
|
|
220
|
+
// network, the desk's book, partners on projects, offices) is changed only on home itself or a phone paired with it.
|
|
221
|
+
const PERSON_WORK = new Set([
|
|
222
|
+
...AGENT_WORK,
|
|
223
|
+
"board.run",
|
|
224
|
+
"board.remove",
|
|
225
|
+
"board.standing",
|
|
226
|
+
"board.file.share",
|
|
227
|
+
"board.thread.send",
|
|
228
|
+
"board.thread.discard",
|
|
229
|
+
"board.thread.auto",
|
|
230
|
+
"board.thread.end",
|
|
231
|
+
"board.goal.create",
|
|
232
|
+
"board.goal.stop",
|
|
233
|
+
"board.goal.resume",
|
|
234
|
+
"board.goal.folder",
|
|
235
|
+
"board.goal.invite",
|
|
236
|
+
"board.swarm.file",
|
|
237
|
+
"board.swarm.post",
|
|
238
|
+
"board.swarm.stop_all",
|
|
239
|
+
"board.swarm.resume",
|
|
240
|
+
"board.swarm.folder",
|
|
241
|
+
"board.swarm.coordinator",
|
|
242
|
+
"board.swarm.diff",
|
|
243
|
+
"board.swarm.merge",
|
|
244
|
+
"board.swarm.discard",
|
|
245
|
+
"board.swarm.start_run",
|
|
246
|
+
"board.swarm.steer",
|
|
247
|
+
"board.swarm.use_browser",
|
|
248
|
+
"board.swarm.places",
|
|
249
|
+
"board.swarm.browse",
|
|
250
|
+
"board.swarm.place",
|
|
251
|
+
"board.swarm.held",
|
|
252
|
+
"board.swarm.follow",
|
|
253
|
+
"board.swarm.seen",
|
|
254
|
+
"board.swarm.context",
|
|
255
|
+
"board.swarm.links",
|
|
256
|
+
"board.swarm.link",
|
|
257
|
+
"board.swarm.lessons.edit",
|
|
258
|
+
"board.swarm.lessons.remove",
|
|
259
|
+
"board.swarm.lessons.undo",
|
|
260
|
+
"board.swarm.specialties",
|
|
261
|
+
"board.swarm.offices",
|
|
262
|
+
"board.swarm.notice",
|
|
263
|
+
"board.swarm.model",
|
|
264
|
+
"board.swarm.specialty",
|
|
265
|
+
"board.swarm.pin",
|
|
266
|
+
"board.swarm.routing",
|
|
267
|
+
"board.plan.edit",
|
|
268
|
+
"board.plan.remove",
|
|
269
|
+
"board.plan.run",
|
|
270
|
+
"board.template.check",
|
|
271
|
+
"board.template.save",
|
|
272
|
+
"board.template.remove",
|
|
273
|
+
"board.project.list",
|
|
274
|
+
"board.project.read",
|
|
275
|
+
"board.project.answer",
|
|
276
|
+
"board.project.held",
|
|
277
|
+
"board.project.note",
|
|
278
|
+
"board.project.work",
|
|
279
|
+
"board.project.repos",
|
|
280
|
+
"board.project.agents",
|
|
281
|
+
"board.project.goal",
|
|
282
|
+
"board.project.retry",
|
|
283
|
+
"board.landed.thread",
|
|
284
|
+
"board.landed.folder",
|
|
285
|
+
"board.environments.list",
|
|
286
|
+
"board.relay.list",
|
|
287
|
+
"board.relay.seen",
|
|
288
|
+
"board.connector.operations",
|
|
289
|
+
"board.place.op",
|
|
290
|
+
]);
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Whether home answers this call from another of the person's computers, or why not. `agent` is what the call names:
|
|
294
|
+
* "user" (the person at that computer, only where they drive from it, or Harness in their window there), or an agent
|
|
295
|
+
* that runs on the person's computers; never a server member or another person. `drives`: the person paired that computer by typing its code; a
|
|
296
|
+
* hosted computer (a cloud computer) is agents only. Null when home answers it.
|
|
297
|
+
*/
|
|
298
|
+
export function computerMay({ command, agent, drives }) {
|
|
299
|
+
const asked = String(command || "");
|
|
300
|
+
if (UPKEEP.has(asked)) return null;
|
|
301
|
+
// Harness in a window linked to that computer acts for the person there, so it has the same limits.
|
|
302
|
+
if (agent === "user" || agent === "harness") {
|
|
303
|
+
if (!drives)
|
|
304
|
+
return "That computer runs agents only, so nothing it sends acts as you.";
|
|
305
|
+
return PERSON_WORK.has(asked)
|
|
306
|
+
? null
|
|
307
|
+
: `${asked} changes how your swarm is set up: do it on your home computer, or a phone paired with it.`;
|
|
308
|
+
}
|
|
309
|
+
if (member(agent)?.road !== "local")
|
|
310
|
+
return `${agent} does not run on that computer.`;
|
|
311
|
+
return AGENT_WORK.has(asked)
|
|
312
|
+
? null
|
|
313
|
+
: `An agent on another of your computers cannot call ${asked} on home.`;
|
|
314
|
+
}
|
package/lib/machineRuns.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
import path from "node:path";
|
|
3
|
+
import { within } from "./folders.mjs";
|
|
2
4
|
import { provenanceLine } from "./provenance.mjs";
|
|
3
5
|
|
|
4
6
|
// On a worker: the work home keeps for this computer's agents, run here. The person's Start (or a thread's authority)
|
|
@@ -12,8 +14,31 @@ import { provenanceLine } from "./provenance.mjs";
|
|
|
12
14
|
// own run worker tells its steps, runWorker.mjs), the latest standing for those between. Nothing is told while a run
|
|
13
15
|
// takes no step, and a step home could not hear is not kept: the last one it heard stands, as for a computer offline.
|
|
14
16
|
const STEP_NOTICE_MS = 1_000;
|
|
17
|
+
// An agent's session id as this computer's agents name theirs; never one an agent's command line would read as a flag.
|
|
18
|
+
const SESSION_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/;
|
|
19
|
+
//
|
|
20
|
+
// Home lists the work; this computer decides where it runs (security audit 2026-10-25, M6). A run starts only in a folder
|
|
21
|
+
// this computer knows: one its own agents' sessions or T3 Code worked in, or a folder inside one. Any other folder home
|
|
22
|
+
// names (another place on this disk, a folder of home's) is refused, and home's board says so, so the person sees why.
|
|
23
|
+
|
|
24
|
+
const real = (dir) => {
|
|
25
|
+
try {
|
|
26
|
+
return fs.realpathSync(dir);
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
15
31
|
|
|
16
|
-
export function createMachineRuns({
|
|
32
|
+
export function createMachineRuns({
|
|
33
|
+
callHome,
|
|
34
|
+
taskRuns,
|
|
35
|
+
agents,
|
|
36
|
+
knownFolders = () => [],
|
|
37
|
+
log,
|
|
38
|
+
// The model and effort the run starts with, from the person's choice here (models.mjs createModelRouter): a choice
|
|
39
|
+
// for an agent is kept on the computer that runs it, so it is read here, not on home.
|
|
40
|
+
modelFor = async () => null,
|
|
41
|
+
}) {
|
|
17
42
|
const active = new Map();
|
|
18
43
|
const steps = new Map();
|
|
19
44
|
let asking = false;
|
|
@@ -74,6 +99,7 @@ export function createMachineRuns({ callHome, taskRuns, agents, log }) {
|
|
|
74
99
|
const agent = task.target_agent;
|
|
75
100
|
log(`running ${agent}'s task ${task.id} from your home computer`);
|
|
76
101
|
const secrets = await secretsFor(task, agent);
|
|
102
|
+
const chosen = await modelFor(task, agent).catch(() => null);
|
|
77
103
|
// Sent again with the finish: the two calls go to home at once, and a finish that arrives first closes the run to
|
|
78
104
|
// the session call (two-machines: home kept no session, one run in four).
|
|
79
105
|
let session = null;
|
|
@@ -84,6 +110,13 @@ export function createMachineRuns({ callHome, taskRuns, agents, log }) {
|
|
|
84
110
|
title: String(task.objective || "").slice(0, 120),
|
|
85
111
|
brief: briefOf(task),
|
|
86
112
|
cwd: task.run_workspace,
|
|
113
|
+
...(chosen?.model ? { model: chosen.model } : {}),
|
|
114
|
+
...(chosen?.effort ? { effort: chosen.effort } : {}),
|
|
115
|
+
...(chosen?.model && chosen.limits ? { limits: chosen.limits } : {}),
|
|
116
|
+
// The turn after one the person's steer stopped here goes on in that turn's session (home names it).
|
|
117
|
+
...(SESSION_ID.test(task.resumeSession ?? "")
|
|
118
|
+
? { resumeSession: task.resumeSession }
|
|
119
|
+
: {}),
|
|
87
120
|
...secrets,
|
|
88
121
|
},
|
|
89
122
|
(kind, text, extra) => {
|
|
@@ -120,6 +153,43 @@ export function createMachineRuns({ callHome, taskRuns, agents, log }) {
|
|
|
120
153
|
);
|
|
121
154
|
};
|
|
122
155
|
|
|
156
|
+
// Why this computer will not run a task where home put it, or null when it will.
|
|
157
|
+
const refusalFor = (task) => {
|
|
158
|
+
const folder =
|
|
159
|
+
typeof task.run_workspace === "string" &&
|
|
160
|
+
path.isAbsolute(task.run_workspace)
|
|
161
|
+
? real(task.run_workspace)
|
|
162
|
+
: null;
|
|
163
|
+
if (
|
|
164
|
+
folder &&
|
|
165
|
+
knownFolders().some((known) => {
|
|
166
|
+
const root = real(known);
|
|
167
|
+
return root && within(folder, root);
|
|
168
|
+
})
|
|
169
|
+
)
|
|
170
|
+
return null;
|
|
171
|
+
return `This computer runs work from your home computer only in a folder its own agents have worked in, and ${task.run_workspace || "no folder"} is not one. Start it there in one of this computer's folders.`;
|
|
172
|
+
};
|
|
173
|
+
// Taken in its agent's name and ended at once with the reason, so home's board shows why it did not run here.
|
|
174
|
+
const refuse = async (task, reason) => {
|
|
175
|
+
log(`did not run task ${task.id} from your home computer: ${reason}`);
|
|
176
|
+
const taken = await callHome({
|
|
177
|
+
command: "board.machine.take",
|
|
178
|
+
agent: task.target_agent,
|
|
179
|
+
id: task.id,
|
|
180
|
+
expectedVersion: task.version,
|
|
181
|
+
});
|
|
182
|
+
if (!taken?.ok) return;
|
|
183
|
+
await callHome({
|
|
184
|
+
command: "board.machine.finish",
|
|
185
|
+
agent: task.target_agent,
|
|
186
|
+
id: task.id,
|
|
187
|
+
status: "failed",
|
|
188
|
+
result: reason,
|
|
189
|
+
failure: "start",
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
|
|
123
193
|
/** Ask home for this computer's authorized work and start what has a free folder. */
|
|
124
194
|
const check = async () => {
|
|
125
195
|
if (!agents.length) return;
|
|
@@ -135,6 +205,11 @@ export function createMachineRuns({ callHome, taskRuns, agents, log }) {
|
|
|
135
205
|
agents,
|
|
136
206
|
});
|
|
137
207
|
for (const task of answer?.ok ? answer.tasks : []) {
|
|
208
|
+
const refused = refusalFor(task);
|
|
209
|
+
if (refused) {
|
|
210
|
+
await refuse(task, refused);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
138
213
|
const slot = slotOf(task);
|
|
139
214
|
if (active.has(slot)) continue;
|
|
140
215
|
const taken = await callHome({
|
package/lib/machineSeal.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createHmac, randomBytes } from "node:crypto";
|
|
1
|
+
import { createHmac, pbkdf2, randomBytes, scrypt } from "node:crypto";
|
|
2
|
+
import { promisify } from "node:util";
|
|
2
3
|
import {
|
|
3
4
|
channelKey,
|
|
4
5
|
constantTimeEqual,
|
|
@@ -14,11 +15,16 @@ import {
|
|
|
14
15
|
// - Each computer has its static ECDH identity (phone-identity.json). The two keys of a home and a worker give one
|
|
15
16
|
// AES-256-GCM key for the pair; every message binds its direction, the worker's id and its request id.
|
|
16
17
|
// - Keys are pinned once (own_machines) by the join handshake: the worker shows a join code, the person types it on
|
|
17
|
-
// home, and each side proves it holds the code by an HMAC over both computers' ids and keys
|
|
18
|
-
// code, so it cannot stand in for either computer with a key of its own.
|
|
18
|
+
// home, and each side proves it holds the code by an HMAC over both computers' ids and keys, keyed by scrypt of the
|
|
19
|
+
// code. Harness never sees the code, so it cannot stand in for either computer with a key of its own.
|
|
19
20
|
// - Setup shows one 16-character code that is both the pairing code and the join code. Harness hears only its first 4
|
|
20
21
|
// characters, to find the waiting computer, and a verifier only the whole code makes, so approving it needs the
|
|
21
22
|
// code the person read; the 12 characters it never hears keep the join's 60 secret bits.
|
|
23
|
+
// - Harness sees each proof and verifier, so each is made slow to guess from (security audit 2026-10-25, M7: one HMAC
|
|
24
|
+
// let 60 bits be searched offline in about 1e4 to 1e5 GPU hours). The verifier is PBKDF2-SHA256 at 600,000 rounds
|
|
25
|
+
// (OWASP's figure for it), because the browser makes the same one and Web Crypto has PBKDF2 but no scrypt; the join
|
|
26
|
+
// proofs, made only here, are keyed by scrypt (N 2^15, r 8, p 1: 32 MiB a guess). Not a PAKE: node:crypto has none,
|
|
27
|
+
// and one made up here would be new cryptography.
|
|
22
28
|
// - A call is refused when it is stale (five minutes either way, seven days for a write queued while the worker was
|
|
23
29
|
// offline), replayed, or sealed for another worker or direction.
|
|
24
30
|
|
|
@@ -54,24 +60,45 @@ export function normalizeJoinCode(text) {
|
|
|
54
60
|
export const isPairCode = (code) =>
|
|
55
61
|
code?.replace(/-/g, "").length === PAIR_LENGTH;
|
|
56
62
|
|
|
63
|
+
// The browser's twin is src/shared/pairCode.ts pairApproval: the same rounds and salt, or approval in a browser fails.
|
|
64
|
+
export const PAIR_VERIFIER_ROUNDS = 600_000;
|
|
65
|
+
const SCRYPT = { N: 2 ** 15, r: 8, p: 1, maxmem: 64 * 1024 * 1024 };
|
|
66
|
+
const pbkdf2Async = promisify(pbkdf2);
|
|
67
|
+
const scryptAsync = promisify(scrypt);
|
|
68
|
+
|
|
57
69
|
/** What Harness hears of a pairing code: the part it finds the waiting computer by, and proof of the whole code. */
|
|
58
|
-
export function pairClaim(code) {
|
|
70
|
+
export async function pairClaim(code) {
|
|
59
71
|
const normal = normalizeJoinCode(code);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
72
|
+
const lookup = normal.slice(0, LOOKUP_LENGTH);
|
|
73
|
+
const verifier = await pbkdf2Async(
|
|
74
|
+
normal,
|
|
75
|
+
`HSC1-pair-verifier\n${lookup}`,
|
|
76
|
+
PAIR_VERIFIER_ROUNDS,
|
|
77
|
+
32,
|
|
78
|
+
"sha256"
|
|
79
|
+
);
|
|
80
|
+
return { lookup, verifier: verifier.toString("base64url") };
|
|
66
81
|
}
|
|
67
82
|
|
|
83
|
+
// A code's join key, made once per code: a waiting computer hears a guess at most JOIN_TRIES times, and home tries one
|
|
84
|
+
// typed code on each computer waiting to join.
|
|
85
|
+
const joinKeys = new Map();
|
|
86
|
+
const joinKey = (code) => {
|
|
87
|
+
const normal = normalizeJoinCode(code) ?? "";
|
|
88
|
+
if (!joinKeys.has(normal)) {
|
|
89
|
+
if (joinKeys.size > 32) joinKeys.clear();
|
|
90
|
+
joinKeys.set(normal, scryptAsync(normal, "HSC1-join-key", 32, SCRYPT));
|
|
91
|
+
}
|
|
92
|
+
return joinKeys.get(normal);
|
|
93
|
+
};
|
|
94
|
+
|
|
68
95
|
/** What a side of the join proves: it holds the code, over both computers' ids and keys. */
|
|
69
|
-
export function joinProof(
|
|
96
|
+
export async function joinProof(
|
|
70
97
|
code,
|
|
71
98
|
side,
|
|
72
99
|
{ homeId, homeKey, workerId, workerKey }
|
|
73
100
|
) {
|
|
74
|
-
return createHmac("sha256",
|
|
101
|
+
return createHmac("sha256", await joinKey(code))
|
|
75
102
|
.update(
|
|
76
103
|
`HSC1-join\n${side}\n${homeId}\n${homeKey}\n${workerId}\n${workerKey}`
|
|
77
104
|
)
|
package/lib/mcp-stdio.mjs
CHANGED
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
} from "./mcpRelay.mjs";
|
|
14
14
|
import { boardNudge, HANDSHAKE_LIMIT, startedByAnother } from "./nudge.mjs";
|
|
15
15
|
import { nameOf } from "./members.mjs";
|
|
16
|
+
import { ARCHETYPE_TOOL, archetypeBrief, readArchetype } from "./archetypes.js";
|
|
17
|
+
import { readProfile } from "./profile.mjs";
|
|
16
18
|
|
|
17
19
|
const agentIndex = process.argv.indexOf("--agent");
|
|
18
20
|
const agent = agentIndex >= 0 ? process.argv[agentIndex + 1] : "codex";
|
|
@@ -34,6 +36,7 @@ let input = "";
|
|
|
34
36
|
let chain = Promise.resolve();
|
|
35
37
|
|
|
36
38
|
const LOCAL_TOOLS = [
|
|
39
|
+
ARCHETYPE_TOOL,
|
|
37
40
|
...(appsOn ? [CONNECTION_TOOL] : []),
|
|
38
41
|
{
|
|
39
42
|
name: "list_tasks",
|
|
@@ -202,7 +205,7 @@ const LOCAL_TOOLS = [
|
|
|
202
205
|
contract: {
|
|
203
206
|
type: "object",
|
|
204
207
|
description:
|
|
205
|
-
'contract: {"action": "view" | "start" | "file_build" | "check" | "judge" | "deploy" | "verify", "contract": its id, ...}: start {strategy, name, chain, one_go, build_chain}; file_build {source, runtime_code, build_task}; check {
|
|
208
|
+
'contract: {"action": "view" | "start" | "file_build" | "check" | "judge" | "deploy" | "verify", "contract": its id, ...}: start {strategy, name, chain, one_go, build_chain}; file_build {source, runtime_code, build_task}; check {sha256, passed} and judge {sha256, accepted}, each from inside the run that did it (Harness records the model that run is on); deploy {thread}; verify {address, chain}',
|
|
206
209
|
},
|
|
207
210
|
},
|
|
208
211
|
required: ["action"],
|
|
@@ -458,7 +461,7 @@ const LOCAL_TOOLS = [
|
|
|
458
461
|
{
|
|
459
462
|
name: "plan_work",
|
|
460
463
|
description:
|
|
461
|
-
"In a project shared with another person's swarm: say what you plan to build before you change code for it (summary, and the files or interfaces it touches), or that your piece is done. Your plan is checked against what the two people decided and the other side's work; the answer says whether to go ahead, or that it clashes and waits until the two sides agree a fix.",
|
|
464
|
+
"In a project shared with another person's swarm: say what you plan to build before you change code for it (summary, and the files or interfaces it touches), or that your piece is done. Your plan is checked against what the two people decided and the other side's work; the answer says whether to go ahead, or that it clashes and waits until the two sides agree a fix. With open, put up a piece (summary) with the specialty it needs for any swarm in the room to claim instead. With hand_to, pass the piece you hold to another agent; you stay accountable until it reports.",
|
|
462
465
|
inputSchema: {
|
|
463
466
|
type: "object",
|
|
464
467
|
properties: {
|
|
@@ -480,6 +483,27 @@ const LOCAL_TOOLS = [
|
|
|
480
483
|
type: "boolean",
|
|
481
484
|
description: "true when you are dropping this piece",
|
|
482
485
|
},
|
|
486
|
+
open: {
|
|
487
|
+
type: "boolean",
|
|
488
|
+
description:
|
|
489
|
+
"true to put the summary up as an open piece, owned by no one, for any swarm in the room to claim",
|
|
490
|
+
},
|
|
491
|
+
specialty: {
|
|
492
|
+
type: "string",
|
|
493
|
+
description:
|
|
494
|
+
"with open: the specialty the piece needs, by its id (for example debugging, web-research, onchain-trading)",
|
|
495
|
+
},
|
|
496
|
+
effects: {
|
|
497
|
+
type: "array",
|
|
498
|
+
items: { type: "string" },
|
|
499
|
+
description:
|
|
500
|
+
"with open: side effects the piece has, such as financial_onchain or code_deployment",
|
|
501
|
+
},
|
|
502
|
+
hand_to: {
|
|
503
|
+
type: "string",
|
|
504
|
+
description:
|
|
505
|
+
"pass the piece you hold to this agent: one of your swarm's by name, or the other side's by its full name (igor/codex)",
|
|
506
|
+
},
|
|
483
507
|
},
|
|
484
508
|
required: ["id"],
|
|
485
509
|
additionalProperties: false,
|
|
@@ -830,14 +854,29 @@ const BOARD_CALLS = {
|
|
|
830
854
|
ask: Array.isArray(args.ask) ? args.ask : [],
|
|
831
855
|
shareWithGuests: args.share_with_guests === true,
|
|
832
856
|
}),
|
|
833
|
-
plan_work: (args) =>
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
857
|
+
plan_work: (args) =>
|
|
858
|
+
args.hand_to
|
|
859
|
+
? {
|
|
860
|
+
command: "board.project.handoff",
|
|
861
|
+
id: String(args.id || ""),
|
|
862
|
+
to: String(args.hand_to),
|
|
863
|
+
}
|
|
864
|
+
: args.open === true
|
|
865
|
+
? {
|
|
866
|
+
command: "board.project.piece",
|
|
867
|
+
id: String(args.id || ""),
|
|
868
|
+
summary: args.summary,
|
|
869
|
+
specialty: args.specialty,
|
|
870
|
+
effects: Array.isArray(args.effects) ? args.effects : [],
|
|
871
|
+
}
|
|
872
|
+
: {
|
|
873
|
+
command: "board.project.plan",
|
|
874
|
+
id: String(args.id || ""),
|
|
875
|
+
summary: args.summary,
|
|
876
|
+
touches: Array.isArray(args.touches) ? args.touches : undefined,
|
|
877
|
+
done: args.done === true,
|
|
878
|
+
stopped: args.stopped === true,
|
|
879
|
+
},
|
|
841
880
|
propose: (args) => ({
|
|
842
881
|
command: "board.project.propose",
|
|
843
882
|
id: String(args.id || ""),
|
|
@@ -846,9 +885,8 @@ const BOARD_CALLS = {
|
|
|
846
885
|
changes: Array.isArray(args.changes) ? args.changes : [],
|
|
847
886
|
decision: args.decision ?? null,
|
|
848
887
|
}),
|
|
849
|
-
// One tool for the swarm's memory, so an agent never weighs which of several near-identical tools to call
|
|
850
|
-
//
|
|
851
|
-
// one thread's with `thread`.
|
|
888
|
+
// One tool for the swarm's memory, so an agent never weighs which of several near-identical tools to call: `remember`
|
|
889
|
+
// adds a note (board.room.learn), `search` reads the whole swarm's memory, or one thread's with `thread`.
|
|
852
890
|
swarm_memory: (args) => {
|
|
853
891
|
const thread = String(args.thread || "");
|
|
854
892
|
if (Boolean(args.search) === Boolean(args.remember))
|
|
@@ -1164,28 +1202,59 @@ const SEARCHES = [
|
|
|
1164
1202
|
"search_screen",
|
|
1165
1203
|
"compare_screens",
|
|
1166
1204
|
];
|
|
1167
|
-
// watch_video and listen, measured through this server on an Apple M5 Pro (64 GB), 3 samples each
|
|
1168
|
-
//
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1205
|
+
// watch_video and listen, measured through this server on an Apple M5 Pro (64 GB), 3 samples each: the slowest calls
|
|
1206
|
+
// the tools allow, 10 minutes of speech with Parakeet and a 10-minute stretch at 40 frames, took 24 to 25 s (Apple's
|
|
1207
|
+
// transcriber 14 to 15 s); 120 s leaves room for a slower computer or a busy model queue. Unmeasured on Intel and
|
|
1208
|
+
// Linux.
|
|
1171
1209
|
const MEDIA_DEADLINE_MS = 120_000;
|
|
1172
1210
|
|
|
1173
1211
|
/** How long a call waits for the daemon. */
|
|
1174
1212
|
function deadlineFor(name) {
|
|
1175
1213
|
if (name === "watch_video" || name === "listen") return MEDIA_DEADLINE_MS;
|
|
1176
|
-
// A website's answer takes what it takes and no deadline was measured for any
|
|
1177
|
-
// deadline governs, and the daemon stops the website call when this one hangs up.
|
|
1214
|
+
// A website's answer takes what it takes and no deadline was measured for any, and none is set unmeasured: the
|
|
1215
|
+
// agent's own call deadline governs, and the daemon stops the website call when this one hangs up.
|
|
1178
1216
|
if (name === "use_secret") return 0;
|
|
1179
|
-
// With no Harness window open, the computer wakes the hidden page and waits up to WAKE_DEADLINE_MS (
|
|
1180
|
-
//
|
|
1217
|
+
// With no Harness window open, the computer wakes the hidden page and waits up to WAKE_DEADLINE_MS (one minute), then
|
|
1218
|
+
// the window answers within Harness's own deadline for it (15 s, kept in step with Harness's server).
|
|
1181
1219
|
if (name === "search_screen") return WAKE_DEADLINE_MS + 15_000;
|
|
1182
1220
|
if (SEARCHES.includes(name)) return 20_000;
|
|
1183
1221
|
return 5_000;
|
|
1184
1222
|
}
|
|
1185
1223
|
|
|
1224
|
+
// Harness checks the account's Resident tier, so a paired agent reads its archetype there and gets
|
|
1225
|
+
// the live data skills. Unpaired or offline, the procedures still answer here without live data.
|
|
1226
|
+
async function hostedArchetype(request) {
|
|
1227
|
+
const config = readJson(paths.config, {});
|
|
1228
|
+
if (!config.origin || !config.token) return null;
|
|
1229
|
+
try {
|
|
1230
|
+
const answer = await daemonRequest(
|
|
1231
|
+
{ command: "mcp.call", rpc: request },
|
|
1232
|
+
MCP_CALL_DEADLINE_MS
|
|
1233
|
+
);
|
|
1234
|
+
if (!answer?.ok) return null;
|
|
1235
|
+
const payload = JSON.parse(String(answer.body ?? ""));
|
|
1236
|
+
return payload?.result ? payload : null;
|
|
1237
|
+
} catch {
|
|
1238
|
+
return null;
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1186
1242
|
async function localCall(request) {
|
|
1187
1243
|
const name = request.params?.name;
|
|
1188
1244
|
const args = request.params?.arguments || {};
|
|
1245
|
+
if (name === "archetype") {
|
|
1246
|
+
const hosted = restricted ? null : await hostedArchetype(request);
|
|
1247
|
+
if (hosted) return hosted;
|
|
1248
|
+
const result = readArchetype(restricted ? null : readProfile(), args);
|
|
1249
|
+
return {
|
|
1250
|
+
jsonrpc: "2.0",
|
|
1251
|
+
id: request.id,
|
|
1252
|
+
result: {
|
|
1253
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
1254
|
+
isError: !result.ok,
|
|
1255
|
+
},
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1189
1258
|
if (name === "save_generated_media")
|
|
1190
1259
|
return saveGeneratedMedia(request, args.download);
|
|
1191
1260
|
const call = BOARD_CALLS[name](args);
|
|
@@ -1262,14 +1331,15 @@ const LOCAL_INSTRUCTIONS =
|
|
|
1262
1331
|
// The queue and swarm get what is left of the client's limit (nudge.mjs HANDSHAKE_LIMIT) after Harness's own
|
|
1263
1332
|
// instructions and, when connected, the server's ahead of them, so the client never cuts the end off.
|
|
1264
1333
|
async function handshakeInstructions(server = "") {
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1334
|
+
const archetype = restricted ? "" : archetypeBrief(readProfile());
|
|
1335
|
+
const instructions = [LOCAL_INSTRUCTIONS, archetype]
|
|
1336
|
+
.filter(Boolean)
|
|
1337
|
+
.join("\n\n");
|
|
1338
|
+
const ahead = (server ? server.length + 2 : 0) + instructions.length + 2;
|
|
1267
1339
|
const queue = await boardNudge(agent, undefined, {
|
|
1268
1340
|
budget: Math.max(0, HANDSHAKE_LIMIT - ahead),
|
|
1269
1341
|
});
|
|
1270
|
-
const local = queue
|
|
1271
|
-
? `${LOCAL_INSTRUCTIONS}\n\n${queue}`
|
|
1272
|
-
: LOCAL_INSTRUCTIONS;
|
|
1342
|
+
const local = queue ? `${instructions}\n\n${queue}` : instructions;
|
|
1273
1343
|
return server ? `${server}\n\n${local}` : local;
|
|
1274
1344
|
}
|
|
1275
1345
|
function localInitialize(request) {
|
package/lib/mcpRelay.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { pipeline } from "node:stream/promises";
|
|
|
5
5
|
import { paths } from "./paths.mjs";
|
|
6
6
|
|
|
7
7
|
// How long an agent's call to Harness may take, end to end: the deadline every such call had when the agent's MCP
|
|
8
|
-
// server posted to /api/mcp itself (mcp-stdio.mjs
|
|
8
|
+
// server posted to /api/mcp itself (an earlier mcp-stdio.mjs), kept as it was, not measured again.
|
|
9
9
|
export const MCP_CALL_DEADLINE_MS = 90_000;
|
|
10
10
|
export const RELAY_NOT_RUNNING =
|
|
11
11
|
"Harness relay is not running on this computer: run npx tryharness";
|
package/lib/members.json
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
+
"cloud": [
|
|
4
|
+
{ "agent": "claude-code", "command": "claude", "install": { "npm": "@anthropic-ai/claude-code" }, "signIn": "link-code", "plan": "Claude", "harness": true },
|
|
5
|
+
{ "agent": "codex", "command": "codex", "install": { "npm": "@openai/codex" }, "signIn": "code", "plan": "ChatGPT", "harness": true },
|
|
6
|
+
{ "agent": "opencode", "command": "opencode", "install": { "npm": "opencode-ai" }, "signIn": "settings", "harness": true },
|
|
7
|
+
{ "agent": "pi", "command": "pi", "install": { "npm": "@mariozechner/pi-coding-agent" }, "signIn": "settings", "harness": true },
|
|
8
|
+
{ "agent": "cursor", "command": "cursor-agent", "install": { "script": "https://cursor.com/install" }, "signIn": "link", "plan": "Cursor" },
|
|
9
|
+
{ "agent": "grok-build", "command": "grok", "install": { "script": "https://x.ai/cli/install.sh" }, "signIn": "code", "plan": "Grok" },
|
|
10
|
+
{ "agent": "kilo", "command": "kilo", "install": { "npm": "@kilocode/cli" }, "signIn": "settings", "harness": true },
|
|
11
|
+
{ "agent": "muse-code", "command": "muse", "install": { "script": "https://dev.meta.ai/install.sh" }, "signIn": "code", "plan": "Meta" },
|
|
12
|
+
{ "agent": "antigravity", "command": "agy", "install": { "script": "https://antigravity.google/cli/install.sh" }, "signIn": "link-code", "plan": "Google" },
|
|
13
|
+
{ "agent": "openclaw", "command": "openclaw", "install": { "npm": "openclaw@2026.10.5" }, "signIn": "assistant", "harness": true },
|
|
14
|
+
{ "agent": "hermes", "command": "hermes", "install": { "script": "https://hermes-agent.nousresearch.com/install.sh", "args": ["--skip-setup"] }, "signIn": "assistant", "harness": true }
|
|
15
|
+
],
|
|
3
16
|
"members": [
|
|
4
17
|
{ "id": "harness", "name": "Harness", "aliases": [], "road": "server", "home": "cloud", "runs": "server", "target": true, "wake": "run",
|
|
5
18
|
"about": "answers and researches with its own tools, makes the images and videos a thread needs (attached there for every agent), and works in the person's browser while their Harness window is open",
|
package/lib/members.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { paths } from "./paths.mjs";
|
|
|
5
5
|
// live (home), who runs their work (runs), whether others may hand them work (target) and how they are told work is
|
|
6
6
|
// waiting (wake). The server reads the same file (src/shared/members.ts). A caller on this machine names itself
|
|
7
7
|
// (--agent) and is taken at its word: anything running as the person could read a token kept for it, so none is
|
|
8
|
-
// kept
|
|
8
|
+
// kept. A call through Harness is never taken for a member on this machine (hostedCaller).
|
|
9
9
|
const ROSTER = JSON.parse(
|
|
10
10
|
readFileSync(new URL("./members.json", import.meta.url), "utf8")
|
|
11
11
|
);
|