tryharness 0.7.71 → 0.7.72
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 +13 -8
- package/cli.mjs +27 -12
- package/lib/asks.mjs +2 -0
- package/lib/coordinator.mjs +52 -4
- package/lib/daemon.mjs +14 -8
- package/lib/goalCommands.mjs +14 -35
- package/lib/live.mjs +25 -3
- package/lib/machineRuns.mjs +42 -22
- package/lib/ownMachines.mjs +79 -6
- package/lib/plans.mjs +7 -1
- package/lib/projectSettings.mjs +11 -1
- package/lib/projects.mjs +20 -4
- package/lib/promptFlow.mjs +36 -1
- package/lib/runAuthority.mjs +103 -22
- package/lib/runWorker.mjs +44 -14
- package/lib/runner.mjs +183 -26
- package/lib/selfUpdate.mjs +41 -0
- package/lib/serverWords.mjs +11 -11
- package/lib/sessionControl.mjs +3 -2
- package/lib/store.mjs +25 -11
- package/lib/swarm.mjs +3 -0
- package/lib/taskCommands.mjs +36 -9
- package/lib/threadActions.mjs +9 -1
- package/lib/threadAuthority.mjs +21 -14
- package/lib/threadRuns.mjs +22 -8
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/release.json +29 -28
package/README.md
CHANGED
|
@@ -350,14 +350,19 @@ authorizes it with `tryharness board run <id>`) is claimed by the daemon in that
|
|
|
350
350
|
run non-interactively through the same runner as a delegated run, and reported back on the
|
|
351
351
|
task with the result and the agent's session id; `tryharness task <id> --follow` works on it.
|
|
352
352
|
One run per agent at a time; a daemon restart marks a running task unknown.
|
|
353
|
-
A coding agent also starts, without `board run`, the tasks you or
|
|
354
|
-
folder
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
353
|
+
A coding agent also starts, without `board run`, the tasks you, Harness or any of your own agents post for it, in
|
|
354
|
+
any folder below your home (your home folder itself and anything outside it are not covered; links are followed).
|
|
355
|
+
That is on by default, and the daemon says so once when it first starts with it. Its limits are the ones you set:
|
|
356
|
+
off, named folders and a daily cap, or `--from` to choose which of your agents may start it. By default there is no
|
|
357
|
+
daily cap; instead, past 10 hand-offs in a row between your agents with no word from you, the next one waits. Words the local injection guard
|
|
358
|
+
reads as orders aimed at your agents, or words through Harness's server it could not read, also wait; a flag is only
|
|
359
|
+
a label. A task with no folder runs in its thread's scratch folder, and your Start always works on one that waits.
|
|
360
|
+
Different agents work in one folder side by side; one agent takes one turn at a time there. A task Claude Code or
|
|
361
|
+
Codex posts from a session you typed in counts as yours. Work another person's agents ask for runs held in: Claude
|
|
362
|
+
Code or Codex in restricted mode in a copy of the folder, with none of your credentials, screen, memory,
|
|
363
|
+
conversations, library, wallet or secrets in reach and no network. It reads only its own folder, git's folder for
|
|
364
|
+
its repository and the programs it builds with, nothing else of yours, until you press Start; Pi and OpenCode wait
|
|
365
|
+
for you. `tryharness board standing` shows it; `tryharness board standing <agent> <folder>...
|
|
361
366
|
[--cap <n>]` names the folders instead; `tryharness board standing <agent> off` and `on` turn it off or back to
|
|
362
367
|
the default. An interactive
|
|
363
368
|
claim carries a lease (default 60 minutes); a lapsed lease shows the claim as stale and only
|
package/cli.mjs
CHANGED
|
@@ -449,7 +449,7 @@ async function connect() {
|
|
|
449
449
|
`Your agents here can search your Desktop, Documents and Downloads. That stays on this computer${process.platform === "darwin" ? ", and your Mac asks you once" : ""}. ${pc.dim(`Change it: ${relayCommand()} local off`)}`,
|
|
450
450
|
]
|
|
451
451
|
: []),
|
|
452
|
-
`Your coding agents start the tasks you ask for in
|
|
452
|
+
`Your coding agents start the tasks you and your own agents ask for, in any folder below your home, without a Start. Work someone else's agents ask for runs held in its own folder: it reads nothing else of yours and has no network until you press Start. ${pc.dim(`Change it: ${relayCommand()} board standing`)}`,
|
|
453
453
|
].join("\n\n"),
|
|
454
454
|
"Good to know"
|
|
455
455
|
);
|
|
@@ -924,6 +924,24 @@ async function machines() {
|
|
|
924
924
|
console.log(`This computer is now called ${response.label}.`);
|
|
925
925
|
return;
|
|
926
926
|
}
|
|
927
|
+
if (sub === "update") {
|
|
928
|
+
// `machines update <name> [version]`: that computer fetches the release (the newest by default), checks it is
|
|
929
|
+
// signed with Harness's release key and sets it up; asked from home over the pair's sealed line.
|
|
930
|
+
const named = argv.slice(1);
|
|
931
|
+
const version = /^(\d+\.\d+\.\d+|latest)$/.test(named.at(-1) ?? "")
|
|
932
|
+
? named.pop()
|
|
933
|
+
: "latest";
|
|
934
|
+
const computer = named.join(" ").trim();
|
|
935
|
+
if (!computer)
|
|
936
|
+
throw new Error("usage: tryharness machines update <name> [version]");
|
|
937
|
+
const response = await daemonRequest(
|
|
938
|
+
{ command: "machines.update", agent: "user", computer, version },
|
|
939
|
+
20_000
|
|
940
|
+
);
|
|
941
|
+
if (!response.ok) throw new Error(response.error || "not updated");
|
|
942
|
+
console.log(`${computer}: ${response.note}`);
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
927
945
|
if (sub === "remove") {
|
|
928
946
|
const computer = argv.slice(1).join(" ").trim();
|
|
929
947
|
if (!computer) throw new Error("usage: tryharness machines remove <name>");
|
|
@@ -1245,10 +1263,9 @@ async function board() {
|
|
|
1245
1263
|
);
|
|
1246
1264
|
return;
|
|
1247
1265
|
}
|
|
1248
|
-
// Standing permission: a coding agent starts the tasks you or
|
|
1249
|
-
//
|
|
1250
|
-
//
|
|
1251
|
-
// --from (Grok Bot, Muse) in a thread; --from none takes them back.
|
|
1266
|
+
// Standing permission: a coding agent starts the tasks you, Harness or any of your own agents post for it without a
|
|
1267
|
+
// Start. On by default in any folder below home; name folders and a daily cap instead, turn it off, or back on to the
|
|
1268
|
+
// default. --from names which of your agents may start it; --from none takes them all back.
|
|
1252
1269
|
if (sub === "standing") {
|
|
1253
1270
|
const rest = argv
|
|
1254
1271
|
.slice(argv.indexOf(sub) + 1)
|
|
@@ -1314,18 +1331,16 @@ async function board() {
|
|
|
1314
1331
|
}
|
|
1315
1332
|
const where =
|
|
1316
1333
|
rule.mode === "default"
|
|
1317
|
-
? rule.
|
|
1318
|
-
|
|
1319
|
-
: "in folders you have used it in (none yet)"
|
|
1320
|
-
: `in ${rule.workspaces.join(", ")}`;
|
|
1334
|
+
? `in any folder below your home, ${rule.runs_today} today`
|
|
1335
|
+
: `in ${rule.workspaces.join(", ")}; ${rule.runs_today} of ${rule.daily_cap} today`;
|
|
1321
1336
|
const everyone = PROPOSERS.every((name) =>
|
|
1322
1337
|
rule.proposers?.includes(name)
|
|
1323
1338
|
);
|
|
1324
1339
|
const from = rule.proposers?.length
|
|
1325
|
-
? `, and on
|
|
1340
|
+
? `, and on asks from ${everyone ? "any of your agents" : rule.proposers.join(", ")} (stop: ${relayCommand()} board standing ${rule.agent} --from none)`
|
|
1326
1341
|
: "";
|
|
1327
1342
|
console.log(
|
|
1328
|
-
`${rule.agent} starts tasks from you or Harness without asking${from}, ${where}
|
|
1343
|
+
`${rule.agent} starts tasks from you or Harness without asking${from}, ${where}. Turn it off: ${relayCommand()} board standing ${rule.agent} off`
|
|
1329
1344
|
);
|
|
1330
1345
|
}
|
|
1331
1346
|
return;
|
|
@@ -2667,7 +2682,7 @@ function installedLine() {
|
|
|
2667
2682
|
|
|
2668
2683
|
function help() {
|
|
2669
2684
|
console.log(
|
|
2670
|
-
`tryharness ${VERSION}\n\n${installedLine()}Commands:\n tryharness set up everything and start the daemon\n tryharness upgrade [version] fetch a newer release, check it is signed with Harness's release key, then set it up\n tryharness desktop open the Harness desktop app (setup opens it too; --no-desktop skips it)\n tryharness status show daemon, bridge, agent, and index health\n tryharness doctor diagnose the complete connection\n tryharness local [learn] the relay's local models, where they run, what is indexed and the last learning\n tryharness local on|off search over your Desktop, Documents and Downloads by what is in the files (on by default)\n tryharness local add|remove <folder> another folder to search the same way\n tryharness watch [add <name> --run <command> [--every 5m] [--field f | --age f | --count text] [--above n] [--below n] | start <id> | remove <id>]\n watches the relay checks and says out loud only when they are off\n tryharness sync [--agent] rescan local coding history in the background\n tryharness task <id> --follow\n follow a delegated agent run in this terminal\n tryharness runs what your agents are running on this computer now\n tryharness steer <thread or run> "<words>" [--agent <agent>]\n tell an agent something while it works\n tryharness ssh [<cloud computer>] [--key <file>] [--print] [-- <command>]\n SSH into your cloud computer with your own key; it wakes if asleep\n tryharness board [--all] list open work on the machine's task board\n tryharness board post --for <agent> --objective <text> [--file <brief.md>]\n tryharness board show <id>\n tryharness board post --for codex --objective <text> --run --workspace <dir>\n the daemon runs it and reports back on the task\n tryharness board run <id> authorize a run an agent asked for\n tryharness board release <id>\n tryharness board agents when each agent last read the board\n tryharness board --watch follow the board in this terminal\n tryharness notify on|off desktop notifications for what waits on you\n tryharness usage-totals on|off daily counts of your swarm's work, without your account or any text (on by default)\n tryharness board send <task> <message> send a held reply to another person's agent\n tryharness board snippet [<id> share|keep] code an agent elsewhere asked to see; nothing leaves until you share it\n tryharness board auto <task> on|off auto-send replies on that thread\n tryharness board end <task> --outcome <text>\n tryharness board context <task> <query> search everything written about a task\n tryharness goal set --objective <text> [--team a,b] [--workspace <dir>] a goal your agents work together in one room\n tryharness goal [list | show <id> | stop <id> | resume <id>]\n tryharness room <goal> | room post <goal> <text> [--ask agent,agent]\n tryharness swarm rounds [<thread>] what the coordinator saw, chose and cost each round\n tryharness swarm health [<thread>] who decided each day's rounds: Harness, a backup, or no one\n tryharness swarm ceiling <thread> <dollars|off> what a thread may spend of your Harness credits\n tryharness swarm checkin <thread> "<what>" (--in 2h | --at 14:30 | --every 30m | --daily 09:00 [--days mon-fri]) [--wake codex] [--times n] [--until <date>]\n the thread comes back on its own then, waking those agents or its lead\n tryharness swarm checkins [<thread>] [--all] | swarm checkin remove <id>\n tryharness swarm coordinator [harness|local] who coordinates your threads\n tryharness connect <handle/agent> --about <text> ask another person's agent to work an issue with yours, sealed to their computer\n tryharness peers the keys of other people's computers this one has worked with, to compare\n tryharness machines your computers: which holds the board (home) and which work through it; machines add <code> [--hosted] | name <name> | home | remove <name>\n tryharness backup [on | now | restore | off] an encrypted backup of your board, for Residents; only your passphrase opens it\n tryharness agents who is in your swarm, and who can be added\n tryharness agents add [<agent>…] put agents in your swarm; with no name, pick from the ones found here\n tryharness agents remove <agent> take an agent out of your swarm\n tryharness agents confirm <agent> the program Harness starts for an agent, after you install it somewhere new\n tryharness agents setup [<agent>] | agents test <agent> how Harness wakes each agent\n tryharness agents cards what each of your agents is told about the others\n tryharness agents note <agent> <text> [--clear] your own note on an agent's card, told to every other agent\n tryharness lessons [--replaced | --retired] | lessons remove <id> | lessons edit <id> "<text>"\n what your swarm learned from your words, to read, change or take out\n tryharness memory [dream | forget <id> | delete <post id> | back <id>]\n what your swarm keeps from its work, overnight; forget, delete or bring back\n tryharness agents models [<agent>] [--refresh] the models each coding agent lists and the one it runs on\n tryharness agents model <agent> <model> [--effort <level>] | auto | default the model it runs on; auto lets Harness pick per run\n tryharness agents routing "<text>" [--clear] how Auto picks models for your swarm\n tryharness connections on|off outside apps (Gmail, Calendar, Slack, Notion, Linear) for your agents; off by default\n tryharness connections connect apps, choose agent access and review approvals (connections catalog for providers)\n tryharness vault your secrets, kept on this computer: agents use them without seeing them (vault add <name> --hosts <host> | allow <agent> <name> | runs <agent> <name> <VARIABLE> | backup <email> | share <name>)\n tryharness mcp grok-bot print the MCP snippet that puts Grok Bot on the board\n tryharness link connect the browser you use Harness in to this computer, end to end (--print shows the link)\n tryharness phone pair show a QR code that pairs your phone with this computer\n tryharness phone list | revoke <id>\n tryharness t3 approve Harness in T3 Code once, so your messages go into its threads (t3 status | t3 forget)\n tryharness logs [--follow]\n tryharness uninstall [--everything] take Harness off this computer; --everything also deletes your board and history\n`
|
|
2685
|
+
`tryharness ${VERSION}\n\n${installedLine()}Commands:\n tryharness set up everything and start the daemon\n tryharness upgrade [version] fetch a newer release, check it is signed with Harness's release key, then set it up\n tryharness desktop open the Harness desktop app (setup opens it too; --no-desktop skips it)\n tryharness status show daemon, bridge, agent, and index health\n tryharness doctor diagnose the complete connection\n tryharness local [learn] the relay's local models, where they run, what is indexed and the last learning\n tryharness local on|off search over your Desktop, Documents and Downloads by what is in the files (on by default)\n tryharness local add|remove <folder> another folder to search the same way\n tryharness watch [add <name> --run <command> [--every 5m] [--field f | --age f | --count text] [--above n] [--below n] | start <id> | remove <id>]\n watches the relay checks and says out loud only when they are off\n tryharness sync [--agent] rescan local coding history in the background\n tryharness task <id> --follow\n follow a delegated agent run in this terminal\n tryharness runs what your agents are running on this computer now\n tryharness steer <thread or run> "<words>" [--agent <agent>]\n tell an agent something while it works\n tryharness ssh [<cloud computer>] [--key <file>] [--print] [-- <command>]\n SSH into your cloud computer with your own key; it wakes if asleep\n tryharness board [--all] list open work on the machine's task board\n tryharness board post --for <agent> --objective <text> [--file <brief.md>]\n tryharness board show <id>\n tryharness board post --for codex --objective <text> --run --workspace <dir>\n the daemon runs it and reports back on the task\n tryharness board run <id> authorize a run an agent asked for\n tryharness board release <id>\n tryharness board agents when each agent last read the board\n tryharness board --watch follow the board in this terminal\n tryharness notify on|off desktop notifications for what waits on you\n tryharness usage-totals on|off daily counts of your swarm's work, without your account or any text (on by default)\n tryharness board send <task> <message> send a held reply to another person's agent\n tryharness board snippet [<id> share|keep] code an agent elsewhere asked to see; nothing leaves until you share it\n tryharness board auto <task> on|off auto-send replies on that thread\n tryharness board end <task> --outcome <text>\n tryharness board context <task> <query> search everything written about a task\n tryharness goal set --objective <text> [--team a,b] [--workspace <dir>] a goal your agents work together in one room\n tryharness goal [list | show <id> | stop <id> | resume <id>]\n tryharness room <goal> | room post <goal> <text> [--ask agent,agent]\n tryharness swarm rounds [<thread>] what the coordinator saw, chose and cost each round\n tryharness swarm health [<thread>] who decided each day's rounds: Harness, a backup, or no one\n tryharness swarm ceiling <thread> <dollars|off> what a thread may spend of your Harness credits\n tryharness swarm checkin <thread> "<what>" (--in 2h | --at 14:30 | --every 30m | --daily 09:00 [--days mon-fri]) [--wake codex] [--times n] [--until <date>]\n the thread comes back on its own then, waking those agents or its lead\n tryharness swarm checkins [<thread>] [--all] | swarm checkin remove <id>\n tryharness swarm coordinator [harness|local] who coordinates your threads\n tryharness connect <handle/agent> --about <text> ask another person's agent to work an issue with yours, sealed to their computer\n tryharness peers the keys of other people's computers this one has worked with, to compare\n tryharness machines your computers: which holds the board (home) and which work through it; machines add <code> [--hosted] | name <name> | home | update <name> [version] | remove <name>\n tryharness backup [on | now | restore | off] an encrypted backup of your board, for Residents; only your passphrase opens it\n tryharness agents who is in your swarm, and who can be added\n tryharness agents add [<agent>…] put agents in your swarm; with no name, pick from the ones found here\n tryharness agents remove <agent> take an agent out of your swarm\n tryharness agents confirm <agent> the program Harness starts for an agent, after you install it somewhere new\n tryharness agents setup [<agent>] | agents test <agent> how Harness wakes each agent\n tryharness agents cards what each of your agents is told about the others\n tryharness agents note <agent> <text> [--clear] your own note on an agent's card, told to every other agent\n tryharness lessons [--replaced | --retired] | lessons remove <id> | lessons edit <id> "<text>"\n what your swarm learned from your words, to read, change or take out\n tryharness memory [dream | forget <id> | delete <post id> | back <id>]\n what your swarm keeps from its work, overnight; forget, delete or bring back\n tryharness agents models [<agent>] [--refresh] the models each coding agent lists and the one it runs on\n tryharness agents model <agent> <model> [--effort <level>] | auto | default the model it runs on; auto lets Harness pick per run\n tryharness agents routing "<text>" [--clear] how Auto picks models for your swarm\n tryharness connections on|off outside apps (Gmail, Calendar, Slack, Notion, Linear) for your agents; off by default\n tryharness connections connect apps, choose agent access and review approvals (connections catalog for providers)\n tryharness vault your secrets, kept on this computer: agents use them without seeing them (vault add <name> --hosts <host> | allow <agent> <name> | runs <agent> <name> <VARIABLE> | backup <email> | share <name>)\n tryharness mcp grok-bot print the MCP snippet that puts Grok Bot on the board\n tryharness link connect the browser you use Harness in to this computer, end to end (--print shows the link)\n tryharness phone pair show a QR code that pairs your phone with this computer\n tryharness phone list | revoke <id>\n tryharness t3 approve Harness in T3 Code once, so your messages go into its threads (t3 status | t3 forget)\n tryharness logs [--follow]\n tryharness uninstall [--everything] take Harness off this computer; --everything also deletes your board and history\n`
|
|
2671
2686
|
);
|
|
2672
2687
|
}
|
|
2673
2688
|
|
package/lib/asks.mjs
CHANGED
|
@@ -111,6 +111,8 @@ export function createAsks({
|
|
|
111
111
|
agent: ask.agent,
|
|
112
112
|
objective: objectiveOf(thread, ask),
|
|
113
113
|
result: `Could not be asked: ${reason}`.slice(0, 4_000),
|
|
114
|
+
// When, so a round reads the failure as the agent's answer to the job posted for it (coordinator.mjs).
|
|
115
|
+
at: new Date().toISOString(),
|
|
114
116
|
},
|
|
115
117
|
].slice(-5)
|
|
116
118
|
)
|
package/lib/coordinator.mjs
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { LOCAL_DECIDERS, askLocalAgent } from "./localAgentAsk.mjs";
|
|
2
2
|
import { roundFields } from "./cards.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
CLOUD_HOMED,
|
|
5
|
+
MACHINE_RUNNERS,
|
|
6
|
+
MEMBERS,
|
|
7
|
+
TAGGED_ONLY,
|
|
8
|
+
nameOf,
|
|
9
|
+
} from "./members.mjs";
|
|
4
10
|
import { LEAD_TIMES } from "./schedules.mjs";
|
|
5
11
|
import { SPECIALTIES, pinnedFor, specialtyName } from "./specialties.mjs";
|
|
6
12
|
import { TEAM } from "./team.mjs";
|
|
@@ -170,6 +176,33 @@ export function createCoordinator({
|
|
|
170
176
|
// not, and reads first what Harness's server decided.
|
|
171
177
|
pick = () => null,
|
|
172
178
|
}) {
|
|
179
|
+
// Agents on Harness's server (Bankr, Quotient, Muse) keep their tasks there, not on this board (asks.mjs), so whether
|
|
180
|
+
// one is at work in a thread is read from the thread itself: a job posted for it that it has not answered since. Its
|
|
181
|
+
// result, its question and its failure each land as its own post (jobAnswers.mjs); an ask that never reached Harness
|
|
182
|
+
// is a failed ask. Read from the board alone, Bankr looked idle while it worked, and the round handed it the same
|
|
183
|
+
// purchase again.
|
|
184
|
+
const hostedAtWork = (goalId) => {
|
|
185
|
+
const { posts } = store.recentRoomPosts(goalId, { limit: 500 });
|
|
186
|
+
const answeredAt = (agent) =>
|
|
187
|
+
[
|
|
188
|
+
posts.findLast((post) => post.author === agent)?.created_at,
|
|
189
|
+
...failedAsks(goalId)
|
|
190
|
+
.filter((failure) => failure.agent === agent)
|
|
191
|
+
.map((failure) => failure.at),
|
|
192
|
+
].reduce((newest, at) => (at && at > newest ? at : newest), "");
|
|
193
|
+
return CLOUD_HOMED.filter((agent) => {
|
|
194
|
+
const job = posts.findLast(
|
|
195
|
+
(post) => post.kind === "job" && post.mentions.includes(agent)
|
|
196
|
+
);
|
|
197
|
+
return Boolean(job) && job.created_at > answeredAt(agent);
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
// Whether the agent already holds work in the thread, here or on Harness's server.
|
|
201
|
+
const holdsWork = (goalId, agent) =>
|
|
202
|
+
store
|
|
203
|
+
.threadRuns(goalId)
|
|
204
|
+
.some((run) => run.target_agent === agent && going(run)) ||
|
|
205
|
+
hostedAtWork(goalId).includes(agent);
|
|
173
206
|
const failedHereLately = (threadId, agent) => {
|
|
174
207
|
const at = Date.parse(store.meta(`job-failed:${threadId}:${agent}`) || "");
|
|
175
208
|
return Date.now() - at < FAILED_REST_MS;
|
|
@@ -273,7 +306,11 @@ export function createCoordinator({
|
|
|
273
306
|
objective: run.objective,
|
|
274
307
|
result: String(run.result || ""),
|
|
275
308
|
})),
|
|
276
|
-
...failedAsks(thread.id),
|
|
309
|
+
...failedAsks(thread.id).map(({ agent, objective, result }) => ({
|
|
310
|
+
agent,
|
|
311
|
+
objective,
|
|
312
|
+
result,
|
|
313
|
+
})),
|
|
277
314
|
]
|
|
278
315
|
.slice(-5)
|
|
279
316
|
.map((job) => ({
|
|
@@ -436,7 +473,8 @@ export function createCoordinator({
|
|
|
436
473
|
progress: {
|
|
437
474
|
runsFinished,
|
|
438
475
|
newResults,
|
|
439
|
-
stillRunning:
|
|
476
|
+
stillRunning:
|
|
477
|
+
runs.filter(going).length + hostedAtWork(thread.id).length,
|
|
440
478
|
roundsWithoutProgress: state.withoutProgress,
|
|
441
479
|
failedJobs,
|
|
442
480
|
// A Harness that does not know the field would refuse the round: it goes only to one that takes Harness's tasks.
|
|
@@ -1021,6 +1059,14 @@ export function createCoordinator({
|
|
|
1021
1059
|
const agent = review
|
|
1022
1060
|
? independentReviewer(thread, decision.agent, candidates, coordinator)
|
|
1023
1061
|
: decision.agent;
|
|
1062
|
+
// Work that became the agent's while the round was decided (a reading of the server's words takes seconds) is
|
|
1063
|
+
// not handed to it again: Bankr was handed the same purchase twice, and a round begun on a new thread's title
|
|
1064
|
+
// posted "@claude-code (review, no changes)" after the person's own ask had started Claude Code, whose turn did
|
|
1065
|
+
// the review instead (live, October 31). The person's new message is new work, and still reaches it.
|
|
1066
|
+
if (!asked && holdsWork(thread.id, agent)) {
|
|
1067
|
+
notifyBoard(store.getTask(thread.id));
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1024
1070
|
if (!thread.goal.team.includes(agent))
|
|
1025
1071
|
store.setGoalTeam(thread.id, [...thread.goal.team, agent]);
|
|
1026
1072
|
const text = String(decision.text).slice(0, 4_000);
|
|
@@ -1138,7 +1184,9 @@ export function createCoordinator({
|
|
|
1138
1184
|
// A turn T3 Code is running for one of the thread's agents counts as work going on, though Harness did not start it
|
|
1139
1185
|
// (the coordinator once told Claude Code to "continue" three times while it worked in T3).
|
|
1140
1186
|
const active =
|
|
1141
|
-
store.threadRuns(goalId).some(going) ||
|
|
1187
|
+
store.threadRuns(goalId).some(going) ||
|
|
1188
|
+
hostedAtWork(goalId).length > 0 ||
|
|
1189
|
+
busyInT3(thread).length > 0;
|
|
1142
1190
|
// A thread started through Harness by an agent that runs elsewhere gets no rounds until the person sets a spend ceiling.
|
|
1143
1191
|
if (store.meta(`hosted-thread:${goalId}`)) return;
|
|
1144
1192
|
const local = mode() === "local";
|
package/lib/daemon.mjs
CHANGED
|
@@ -125,6 +125,7 @@ import { createProxyLinks } from "./proxyLinks.mjs";
|
|
|
125
125
|
import { createCloudSsh } from "./cloudSsh.mjs";
|
|
126
126
|
import { loadMachine, saveMachine } from "./machineIdentity.mjs";
|
|
127
127
|
import { createOwnMachines, FROM_MACHINE } from "./ownMachines.mjs";
|
|
128
|
+
import { startUpdate } from "./selfUpdate.mjs";
|
|
128
129
|
import { createBoardBackup } from "./boardBackup.mjs";
|
|
129
130
|
import { createMachineRuns } from "./machineRuns.mjs";
|
|
130
131
|
import { createPlans } from "./plans.mjs";
|
|
@@ -885,11 +886,10 @@ export async function startDaemon() {
|
|
|
885
886
|
for (const id of store.backfillContributions())
|
|
886
887
|
log(`context: backfilled task ${id}`);
|
|
887
888
|
|
|
888
|
-
// Standing permission, decided when a task is posted: a run the person asked for (themselves
|
|
889
|
-
// for a coding agent installed here, in a folder the permission covers,
|
|
890
|
-
// By default it covers
|
|
891
|
-
//
|
|
892
|
-
// covered folder leads out of it.
|
|
889
|
+
// Standing permission, decided when a task is posted: a run the person asked for (themselves, through Harness or
|
|
890
|
+
// through any of their own agents), for a coding agent installed here, in a folder the permission covers, starts
|
|
891
|
+
// without a Start. By default it covers any folder below home, with no daily limit; the person may name folders and a
|
|
892
|
+
// limit instead (runAuthority.mjs covers). Links are followed, so no path inside a covered folder leads out of it.
|
|
893
893
|
const authority = createRunAuthority({ store, installedAgents });
|
|
894
894
|
const { RUNNERS } = authority;
|
|
895
895
|
const threadAuthority = createThreadAuthority({
|
|
@@ -1481,7 +1481,6 @@ export async function startDaemon() {
|
|
|
1481
1481
|
replaceHeld,
|
|
1482
1482
|
sendThreadMessage: sealed.sendMessage,
|
|
1483
1483
|
setupNote,
|
|
1484
|
-
slotOf: (...args) => slotOf(...args),
|
|
1485
1484
|
state,
|
|
1486
1485
|
store,
|
|
1487
1486
|
swarmCommand: (...args) => swarmCommand(...args),
|
|
@@ -2342,7 +2341,7 @@ export async function startDaemon() {
|
|
|
2342
2341
|
});
|
|
2343
2342
|
// A session's agent hears its work again after its context is compacted (compaction.mjs, the session hook).
|
|
2344
2343
|
const compaction = createCompaction({ store, goals });
|
|
2345
|
-
const { activeRuns,
|
|
2344
|
+
const { activeRuns, whyWaiting, runBoard } = worker;
|
|
2346
2345
|
|
|
2347
2346
|
// The agents the person picked for this cloud computer, installed here and joined to the swarm (cloudAgents.mjs).
|
|
2348
2347
|
const cloudSave = config.cloud
|
|
@@ -2626,6 +2625,8 @@ export async function startDaemon() {
|
|
|
2626
2625
|
? (from, call) => proxyLinks.answer(from, call)
|
|
2627
2626
|
: null,
|
|
2628
2627
|
ownSsh: cloudSsh?.allow ?? null,
|
|
2628
|
+
ownUpdate: (spec) => startUpdate(spec, { from: DAEMON_VERSION, log }),
|
|
2629
|
+
runningVersion: DAEMON_VERSION,
|
|
2629
2630
|
onNotice: (notice) => {
|
|
2630
2631
|
// Home stopped a run on this computer (the person stopped or removed its task).
|
|
2631
2632
|
if (typeof notice?.stop === "string") stopAgentTask(notice.stop);
|
|
@@ -2653,7 +2654,6 @@ export async function startDaemon() {
|
|
|
2653
2654
|
callHome: (request) => ownMachines.callHome(request),
|
|
2654
2655
|
taskRuns,
|
|
2655
2656
|
agents: installedAgents,
|
|
2656
|
-
// Only in a folder this computer's own agents' sessions or T3 Code worked in, never just one home names.
|
|
2657
2657
|
knownFolders: () => folders.known({ own: true }).map((place) => place.path),
|
|
2658
2658
|
// A folder-less thread's files, as this computer's copy of the board lists them (boardMirror.mjs).
|
|
2659
2659
|
threadFileIds: (threadId) => {
|
|
@@ -2896,6 +2896,12 @@ export async function startDaemon() {
|
|
|
2896
2896
|
? ownMachines.remove(request.computer)
|
|
2897
2897
|
: { ok: false, error: "only the person removes a computer" }
|
|
2898
2898
|
),
|
|
2899
|
+
// tryharness machines update: one of the person's computers fetches a newer signed release and sets it up.
|
|
2900
|
+
"machines.update": onMachines((request) =>
|
|
2901
|
+
request.agent === "user"
|
|
2902
|
+
? ownMachines.update(request)
|
|
2903
|
+
: { ok: false, error: "only the person updates a computer" }
|
|
2904
|
+
),
|
|
2899
2905
|
"machines.models": onMachines((request) =>
|
|
2900
2906
|
ownMachines.models({ refresh: request.refresh === true })
|
|
2901
2907
|
),
|
package/lib/goalCommands.mjs
CHANGED
|
@@ -34,7 +34,6 @@ export function createGoalCommands({
|
|
|
34
34
|
replaceHeld,
|
|
35
35
|
sendThreadMessage,
|
|
36
36
|
setupNote,
|
|
37
|
-
slotOf,
|
|
38
37
|
state,
|
|
39
38
|
store,
|
|
40
39
|
swarmCommand,
|
|
@@ -177,8 +176,8 @@ export function createGoalCommands({
|
|
|
177
176
|
if (!inRoom(goal, agent) || agent === "user")
|
|
178
177
|
return { ok: false, error: `${agent} is not on this goal's team` };
|
|
179
178
|
if (!teams) return { ok: false, error: "the daemon is still starting" };
|
|
180
|
-
// A note goes to every agent of the swarm, so it is checked like a post: never a secret,
|
|
181
|
-
//
|
|
179
|
+
// A note goes to every agent of the swarm, so it is checked like a post: never a secret, and words the guard flags
|
|
180
|
+
// stay out of the swarm's shared memory.
|
|
182
181
|
const said = `${request.text ?? ""}\n${request.reason ?? ""}`;
|
|
183
182
|
const flag = secretReason(said);
|
|
184
183
|
if (flag)
|
|
@@ -187,12 +186,6 @@ export function createGoalCommands({
|
|
|
187
186
|
error: `not saved: it looks like ${flag}, and a note is shared with every agent`,
|
|
188
187
|
};
|
|
189
188
|
const save = (verdict) => {
|
|
190
|
-
if (verdict?.verdict === "hold")
|
|
191
|
-
return {
|
|
192
|
-
ok: false,
|
|
193
|
-
error:
|
|
194
|
-
"not saved: it reads like instructions aimed at the person's agents",
|
|
195
|
-
};
|
|
196
189
|
const kept = teams.learn(goal.id, agent, {
|
|
197
190
|
text: request.text,
|
|
198
191
|
reason: request.reason,
|
|
@@ -200,8 +193,9 @@ export function createGoalCommands({
|
|
|
200
193
|
});
|
|
201
194
|
if (!kept.ok) return kept;
|
|
202
195
|
learned(goal.id, agent, `${request.text} (${request.reason})`);
|
|
203
|
-
// Pushed to the swarm's memory unless the guard flagged it: a
|
|
204
|
-
|
|
196
|
+
// Pushed to the swarm's memory unless the guard flagged it or read it as orders: such a note stays with its role
|
|
197
|
+
// in this folder.
|
|
198
|
+
if (verdict?.verdict !== "flag" && verdict?.verdict !== "hold")
|
|
205
199
|
remembered(goal, agent, {
|
|
206
200
|
...kept.note,
|
|
207
201
|
replaces: request.replaces ? String(request.replaces) : null,
|
|
@@ -262,29 +256,13 @@ export function createGoalCommands({
|
|
|
262
256
|
note: HELD_NOTE(flag),
|
|
263
257
|
};
|
|
264
258
|
}
|
|
265
|
-
// An agent's post is read by the injection guard first (firewall.mjs)
|
|
266
|
-
//
|
|
259
|
+
// An agent's post is read by the injection guard first (firewall.mjs) and posted with a flag every reader of the
|
|
260
|
+
// room sees when it may carry instructions. It is never held for the person: the guard cannot tell agents
|
|
261
|
+
// coordinating from planted orders, and on the person's board it held ordinary posts. Words it reads as orders
|
|
262
|
+
// start no one on them (threadAuthority.mjs, threadActions.mjs).
|
|
267
263
|
const guarded =
|
|
268
264
|
agent !== "user" && agent !== "harness" && localReady(["guard"]);
|
|
269
265
|
const publish = (verdict) => {
|
|
270
|
-
if (verdict?.verdict === "hold") {
|
|
271
|
-
const held = store.roomPost({
|
|
272
|
-
goalId: goal.id,
|
|
273
|
-
author: agent,
|
|
274
|
-
machine,
|
|
275
|
-
kind: "held",
|
|
276
|
-
text,
|
|
277
|
-
});
|
|
278
|
-
notifyDesktop(
|
|
279
|
-
`A post by ${nameOf(agent)} in a thread was held: it reads like instructions aimed at your agents.`
|
|
280
|
-
);
|
|
281
|
-
return {
|
|
282
|
-
ok: true,
|
|
283
|
-
post: { ...held, kind: "held" },
|
|
284
|
-
held: "instructions aimed at the person's agents",
|
|
285
|
-
note: HELD_NOTE("instructions aimed at the person's agents"),
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
266
|
// Anyone in the thread can bring in any of the person's agents. The person and Harness do it by naming them. An
|
|
289
267
|
// agent does it by asking (`ask`), and its answer wakes whoever is waiting on it; any other name in an agent's
|
|
290
268
|
// words is a reference, like a thanks, and wakes no one.
|
|
@@ -343,7 +321,7 @@ export function createGoalCommands({
|
|
|
343
321
|
});
|
|
344
322
|
replaceHeld(goal.id, agent, post);
|
|
345
323
|
if (agent === "user") heardPerson(goal, post);
|
|
346
|
-
if (verdict?.verdict === "flag")
|
|
324
|
+
if (verdict?.verdict === "flag" || verdict?.verdict === "hold")
|
|
347
325
|
store.meta(`flagged:${post.id}`, String(verdict.score));
|
|
348
326
|
// Shared with guests: the post goes out on each guest's thread, held for the owner unless that thread auto-sends.
|
|
349
327
|
if (request.shareWithGuests === true)
|
|
@@ -392,9 +370,10 @@ export function createGoalCommands({
|
|
|
392
370
|
const wake = store
|
|
393
371
|
.threadRuns(goal.id)
|
|
394
372
|
.find((run) => run.target_agent === name && run.status === "open");
|
|
373
|
+
// The asker's own turn in the wake's folder holds a hand-off it asked for (runWorker.mjs askerHolds).
|
|
395
374
|
const holder =
|
|
396
|
-
wake &&
|
|
397
|
-
getActiveRuns().get(
|
|
375
|
+
wake?.run_workspace &&
|
|
376
|
+
getActiveRuns().get(`${path.resolve(wake.run_workspace)}:${agent}`);
|
|
398
377
|
return holder?.agent === agent
|
|
399
378
|
? `${nameOf(name)} starts when your turn ends: you work in the same folder, one at a time. End your turn now; you are woken when ${nameOf(name)} answers you.`
|
|
400
379
|
: null;
|
|
@@ -425,7 +404,7 @@ export function createGoalCommands({
|
|
|
425
404
|
localEvent(
|
|
426
405
|
"guard",
|
|
427
406
|
verdict?.verdict === "hold"
|
|
428
|
-
? `
|
|
407
|
+
? `flagged a post by ${nameOf(agent)} that read like orders`
|
|
429
408
|
: verdict?.verdict === "flag"
|
|
430
409
|
? `flagged a post by ${nameOf(agent)}`
|
|
431
410
|
: `checked a post by ${nameOf(agent)}`,
|
package/lib/live.mjs
CHANGED
|
@@ -38,6 +38,8 @@ const TABLE_STALE_MS = 30_000;
|
|
|
38
38
|
|
|
39
39
|
function* processSteps() {
|
|
40
40
|
const table = new Map();
|
|
41
|
+
// When it was read: a session recorded after it may name a process it does not hold yet (liveSessions).
|
|
42
|
+
table.readAt = Date.now();
|
|
41
43
|
const ps = yield [PS, ["-axo", "pid=,ppid=,tty=,comm="]];
|
|
42
44
|
for (const line of (ps || "").split("\n")) {
|
|
43
45
|
const match = line.trim().match(/^(\d+)\s+(\d+)\s+(\S+)\s+(.+)$/);
|
|
@@ -194,7 +196,7 @@ export function sessionOfProcess(agent, pid, recent = []) {
|
|
|
194
196
|
export function liveSessions({
|
|
195
197
|
exclude = new Set(),
|
|
196
198
|
recent = [],
|
|
197
|
-
table =
|
|
199
|
+
table: given = null,
|
|
198
200
|
reported = [],
|
|
199
201
|
} = {}) {
|
|
200
202
|
const sessions = [];
|
|
@@ -203,8 +205,28 @@ export function liveSessions({
|
|
|
203
205
|
try {
|
|
204
206
|
files = fs.readdirSync(records).filter((name) => name.endsWith(".json"));
|
|
205
207
|
} catch {}
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
+
const recorded = files.map((name) => {
|
|
209
|
+
const file = path.join(records, name);
|
|
210
|
+
let changedAt = 0;
|
|
211
|
+
try {
|
|
212
|
+
changedAt = fs.statSync(file).mtimeMs;
|
|
213
|
+
} catch {}
|
|
214
|
+
return { record: readJson(file, null), changedAt };
|
|
215
|
+
});
|
|
216
|
+
// A session recorded after the kept reading names a process that reading may not hold yet: the table is read now
|
|
217
|
+
// for it. Read only from the kept one, a session that had just started was left out of the one answer a phone asked
|
|
218
|
+
// for, and nothing asked again (it read Claude Code as idle while T3 Code waited on it).
|
|
219
|
+
let table = given ?? processTable();
|
|
220
|
+
const started = recorded
|
|
221
|
+
.filter(
|
|
222
|
+
({ record, changedAt }) =>
|
|
223
|
+
record?.pid &&
|
|
224
|
+
!table.has(record.pid) &&
|
|
225
|
+
changedAt >= (table.readAt ?? 0)
|
|
226
|
+
)
|
|
227
|
+
.map(({ record }) => record.pid);
|
|
228
|
+
if (started.length) table = processTable({ having: started });
|
|
229
|
+
for (const { record } of recorded) {
|
|
208
230
|
if (
|
|
209
231
|
!record?.pid ||
|
|
210
232
|
!table.has(record.pid) ||
|
package/lib/machineRuns.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { within } from "./folders.mjs";
|
|
4
5
|
import { provenanceLine } from "./provenance.mjs";
|
|
@@ -9,7 +10,7 @@ import { prepareScratch, threadScratch } from "./scratch.mjs";
|
|
|
9
10
|
// is home's to give and stays on home's board; a worker only asks home for what is authorized for it, takes each task
|
|
10
11
|
// in its agent's name, runs it here through the same runner as any run (taskRuns.mjs), and reports back to home, which
|
|
11
12
|
// keeps the report while home is out of reach. Asked when home is back, when home says there is work, and when a run
|
|
12
|
-
// ends; never on a timer. One run per folder at a time, as on home.
|
|
13
|
+
// ends; never on a timer. One run per agent per folder at a time, as on home.
|
|
13
14
|
//
|
|
14
15
|
// Home's stuck sweep (stuck.mjs) reads when each run last took a step. A run here has no record on home, so each new
|
|
15
16
|
// step is told to home, sealed like every call: the first at once, then at most one a second per run (the rate home's
|
|
@@ -19,9 +20,11 @@ const STEP_NOTICE_MS = 1_000;
|
|
|
19
20
|
// An agent's session id as this computer's agents name theirs; never one an agent's command line would read as a flag.
|
|
20
21
|
const SESSION_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/;
|
|
21
22
|
//
|
|
22
|
-
// Home lists the work; this computer decides where it runs (security audit 2026-10-25, M6). A run starts
|
|
23
|
-
// this computer
|
|
24
|
-
//
|
|
23
|
+
// Home lists the work; this computer decides where it runs (security audit 2026-10-25, M6). A run starts in a folder of
|
|
24
|
+
// this computer's below its home, as the person's own agents here may (owner, October 31: work they kicked off runs, it
|
|
25
|
+
// does not wait on folders they never limited), or in one its own agents' sessions or T3 Code worked in. A thread's turn naming home itself or above it, or this computer's
|
|
26
|
+
// scratch folder for the thread, works in that scratch folder. Any other folder home names (one this disk does not
|
|
27
|
+
// have, a folder of home's) is refused, and home's board says so, so the person sees why.
|
|
25
28
|
|
|
26
29
|
const real = (dir) => {
|
|
27
30
|
try {
|
|
@@ -35,6 +38,7 @@ export function createMachineRuns({
|
|
|
35
38
|
callHome,
|
|
36
39
|
taskRuns,
|
|
37
40
|
agents,
|
|
41
|
+
// Folders this computer's own agents' sessions or T3 Code worked in, which count wherever they are.
|
|
38
42
|
knownFolders = () => [],
|
|
39
43
|
// The files of a thread, by id, as this computer's copy of the board has them: a folder-less thread's turn gets them
|
|
40
44
|
// in its scratch folder.
|
|
@@ -68,17 +72,35 @@ export function createMachineRuns({
|
|
|
68
72
|
clearTimeout(steps.get(taskId)?.timer);
|
|
69
73
|
steps.delete(taskId);
|
|
70
74
|
};
|
|
75
|
+
const home = real(os.homedir());
|
|
76
|
+
// An existing folder of this computer's below its home; home itself and above it never are.
|
|
77
|
+
const belowHome = (dir) => {
|
|
78
|
+
const folder = real(dir);
|
|
79
|
+
return Boolean(folder && home && folder !== home && within(folder, home));
|
|
80
|
+
};
|
|
71
81
|
// A thread with no folder: its turn here works in that thread's scratch folder on this computer (scratch.mjs), as
|
|
72
|
-
// does a task naming no folder that home says goes there (taskCommands.mjs forWorker)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
// does a task naming no folder that home says goes there (taskCommands.mjs forWorker), and a thread's turn naming
|
|
83
|
+
// home or above it, or this computer's scratch path for it (a ComfyUI picture asked for in /home/saltorious once
|
|
84
|
+
// failed to start).
|
|
85
|
+
const inScratch = (task) => {
|
|
86
|
+
if (!task.parent_id) return false;
|
|
87
|
+
if (!task.run_workspace)
|
|
88
|
+
return (
|
|
89
|
+
task.kind === "wake" || (task.kind === "task" && task.scratch === true)
|
|
90
|
+
);
|
|
91
|
+
const named = path.resolve(task.run_workspace);
|
|
92
|
+
const folder = real(named);
|
|
93
|
+
return (
|
|
94
|
+
named === threadScratch(task.parent_id) ||
|
|
95
|
+
Boolean(folder && home && within(home, folder))
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
// One turn per agent per folder, other agents side by side (runWorker.mjs slotOf).
|
|
77
99
|
const slotOf = (task) =>
|
|
78
|
-
task
|
|
79
|
-
?
|
|
80
|
-
:
|
|
81
|
-
?
|
|
100
|
+
inScratch(task)
|
|
101
|
+
? `${threadScratch(task.parent_id)}:${task.target_agent}`
|
|
102
|
+
: task.run_workspace
|
|
103
|
+
? `${path.resolve(task.run_workspace)}:${task.target_agent}`
|
|
82
104
|
: task.target_agent;
|
|
83
105
|
// The thread's files, from home, put in the scratch folder; one home cannot send is left out.
|
|
84
106
|
const scratchFor = async (task) => {
|
|
@@ -197,15 +219,13 @@ export function createMachineRuns({
|
|
|
197
219
|
path.isAbsolute(task.run_workspace)
|
|
198
220
|
? real(task.run_workspace)
|
|
199
221
|
: null;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
return null;
|
|
208
|
-
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.`;
|
|
222
|
+
const known = (dir) =>
|
|
223
|
+
knownFolders().some((place) => {
|
|
224
|
+
const root = real(place);
|
|
225
|
+
return root && within(dir, root);
|
|
226
|
+
});
|
|
227
|
+
if (folder && (belowHome(folder) || known(folder))) return null;
|
|
228
|
+
return `${task.run_workspace || "No folder"} is not a folder on this computer below your home or one its agents worked in, so it could not start here.`;
|
|
209
229
|
};
|
|
210
230
|
// Taken in its agent's name and ended at once with the reason, so home's board shows why it did not run here.
|
|
211
231
|
const refuse = async (task, reason) => {
|