tryharness 0.7.66 → 0.7.68
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/cli.mjs +12 -36
- package/lib/boardFileCommands.mjs +5 -7
- package/lib/boardFiles.mjs +5 -0
- package/lib/boardProtocol.json +3 -0
- package/lib/boardWaits.mjs +6 -0
- package/lib/connection.mjs +39 -0
- package/lib/context.mjs +34 -20
- package/lib/contextWorker.mjs +199 -0
- package/lib/coordinator.mjs +23 -9
- package/lib/daemon.mjs +54 -8
- package/lib/directLink.mjs +30 -16
- package/lib/environment.mjs +54 -69
- package/lib/files.mjs +35 -0
- package/lib/frames.mjs +5 -9
- package/lib/goalCommands.mjs +13 -10
- package/lib/kept.mjs +131 -0
- package/lib/landed.mjs +1 -34
- package/lib/library.mjs +18 -11
- package/lib/live.mjs +30 -11
- package/lib/localStack.mjs +17 -13
- package/lib/mcp-stdio.mjs +1 -1
- package/lib/openHere.mjs +36 -0
- package/lib/openRequests.mjs +56 -0
- package/lib/ownMachines.mjs +96 -1
- package/lib/phones.mjs +29 -4
- package/lib/places.mjs +44 -11
- package/lib/portCalls.mjs +54 -0
- package/lib/runBrief.mjs +1 -1
- package/lib/sealed.mjs +37 -0
- package/lib/sessionControl.mjs +47 -14
- package/lib/sessionIndex.mjs +11 -3
- package/lib/store.mjs +139 -29
- package/lib/swarm.mjs +88 -35
- package/lib/swarmMemory.mjs +39 -16
- package/lib/team.mjs +18 -13
- package/lib/threadBriefs.mjs +19 -8
- package/lib/threadView.mjs +3 -1
- package/npm-shrinkwrap.json +14 -14
- package/package.json +4 -4
- package/release.json +41 -35
package/lib/swarm.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { kept } from "./kept.mjs";
|
|
5
5
|
import { readRunSteps } from "./runner.mjs";
|
|
6
6
|
import { createSubagents } from "./subagents.mjs";
|
|
7
7
|
import { MACHINE_RUNNERS, member, nameOf, resolveMember } from "./members.mjs";
|
|
@@ -99,37 +99,58 @@ export function nativeSessionId(agent, sessionId) {
|
|
|
99
99
|
: bare;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
const ps = spawnSync("ps", ["-axo", "pid=,comm="], { encoding: "utf8" });
|
|
107
|
-
if (ps.status !== 0) return null;
|
|
102
|
+
// Each running coding agent's process and the folder it works in, as kept.mjs steps; null when the machine cannot say.
|
|
103
|
+
function* agentProcessSteps() {
|
|
104
|
+
const ps = yield ["ps", ["-axo", "pid=,comm="]];
|
|
105
|
+
if (ps === null) return null;
|
|
108
106
|
const byPid = new Map();
|
|
109
|
-
for (const line of ps.
|
|
107
|
+
for (const line of ps.split("\n")) {
|
|
110
108
|
const match = line.trim().match(/^(\d+)\s+(.+)$/);
|
|
111
|
-
if (!match
|
|
109
|
+
if (!match) continue;
|
|
112
110
|
const agent = Object.keys(PROCESS_NAMES).find(
|
|
113
111
|
(name) => path.basename(match[2]) === PROCESS_NAMES[name]
|
|
114
112
|
);
|
|
115
113
|
if (agent) byPid.set(match[1], agent);
|
|
116
114
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const lsof = spawnSync(
|
|
115
|
+
if (!byPid.size) return [];
|
|
116
|
+
const lsof = yield [
|
|
120
117
|
"lsof",
|
|
121
118
|
["-a", "-d", "cwd", "-Fn", "-p", [...byPid.keys()].join(",")],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
// A process gone since ps makes lsof fail, after it lists the others.
|
|
120
|
+
{ anyStatus: true },
|
|
121
|
+
];
|
|
122
|
+
if (lsof === null) return null;
|
|
123
|
+
const found = [];
|
|
125
124
|
let pid = null;
|
|
126
|
-
for (const line of lsof.
|
|
125
|
+
for (const line of lsof.split("\n")) {
|
|
127
126
|
if (line.startsWith("p")) pid = line.slice(1);
|
|
128
|
-
else if (line.startsWith("n") && byPid.has(pid))
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
else if (line.startsWith("n") && byPid.has(pid))
|
|
128
|
+
found.push({
|
|
129
|
+
pid: Number(pid),
|
|
130
|
+
agent: byPid.get(pid),
|
|
131
|
+
cwd: line.slice(1),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return found;
|
|
135
|
+
}
|
|
136
|
+
// The buddy's thread list asks on every read; ps and lsof run beside the daemon's thread once this is a few seconds old.
|
|
137
|
+
const agentProcessesKept = kept(agentProcessSteps, {
|
|
138
|
+
freshMs: 3_000,
|
|
139
|
+
staleMs: 30_000,
|
|
140
|
+
keyOf: () => "all",
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
// The folder each running coding agent works in, by agent, leaving out the runs the daemon started itself.
|
|
144
|
+
// Null when the machine cannot say, and every session then counts as open in a terminal.
|
|
145
|
+
export function agentProcessCwds(exclude = new Set()) {
|
|
146
|
+
if (process.platform === "win32") return null;
|
|
147
|
+
const found = agentProcessesKept();
|
|
148
|
+
if (!found) return null;
|
|
149
|
+
const cwds = new Map();
|
|
150
|
+
for (const { pid, agent, cwd } of found) {
|
|
151
|
+
if (exclude.has(pid)) continue;
|
|
152
|
+
if (!cwds.has(agent)) cwds.set(agent, new Set());
|
|
153
|
+
cwds.get(agent).add(cwd);
|
|
133
154
|
}
|
|
134
155
|
return cwds;
|
|
135
156
|
}
|
|
@@ -230,9 +251,11 @@ export function createSwarm({
|
|
|
230
251
|
const usd = Number(value);
|
|
231
252
|
return Number.isFinite(usd) && usd >= 0 ? usd : undefined;
|
|
232
253
|
};
|
|
254
|
+
// A turn on another computer of a thread with no folder runs in that computer's scratch folder (scratch.mjs).
|
|
233
255
|
const awaitingStart = (run) =>
|
|
234
256
|
run.status === "open" &&
|
|
235
|
-
Boolean(run.run_workspace)
|
|
257
|
+
(Boolean(run.run_workspace) ||
|
|
258
|
+
(run.kind === "wake" && Boolean(run.target_machine))) &&
|
|
236
259
|
!run.run_authorized_at;
|
|
237
260
|
const isDir = (folder) =>
|
|
238
261
|
typeof folder === "string" &&
|
|
@@ -951,13 +974,16 @@ export function createSwarm({
|
|
|
951
974
|
}
|
|
952
975
|
// The swarm's shared memory, for any of the person's agents: what any agent wrote in any thread, and the coding
|
|
953
976
|
// sessions on this machine. A caller limited to its own threads (a hosted agent while the machine is sealed) gets only those.
|
|
977
|
+
// With `thread`, that thread alone (goalCommands.mjs board.room.search), and no sessions.
|
|
954
978
|
if (command === "board.swarm.search") {
|
|
955
979
|
const query = String(request.query || "")
|
|
956
980
|
.trim()
|
|
957
981
|
.slice(0, 500);
|
|
958
982
|
if (!query) return { ok: false, error: "search needs a query" };
|
|
983
|
+
const thread = request.thread ? String(request.thread) : null;
|
|
959
984
|
const hosted = Boolean(request.teamOnly) || request.hostedCaller === true;
|
|
960
|
-
const sessions =
|
|
985
|
+
const sessions =
|
|
986
|
+
hosted || thread ? [] : store.search({ query, limit: 5 });
|
|
961
987
|
if (!memory)
|
|
962
988
|
return { ok: true, threads: [], sessions, lessons: [], weak: true };
|
|
963
989
|
return {
|
|
@@ -965,6 +991,7 @@ export function createSwarm({
|
|
|
965
991
|
.recall(query, {
|
|
966
992
|
agent,
|
|
967
993
|
teamOnly: Boolean(request.teamOnly),
|
|
994
|
+
thread,
|
|
968
995
|
hosted,
|
|
969
996
|
everyFolder: true,
|
|
970
997
|
})
|
|
@@ -1439,27 +1466,53 @@ export function createSwarm({
|
|
|
1439
1466
|
);
|
|
1440
1467
|
worktrees.inPlace(thread.id);
|
|
1441
1468
|
}
|
|
1442
|
-
const opened = store.getTask(thread.id);
|
|
1443
1469
|
const first = store.roomPost({
|
|
1444
1470
|
goalId: thread.id,
|
|
1445
1471
|
author: "user",
|
|
1446
1472
|
kind: "post",
|
|
1447
1473
|
text,
|
|
1448
|
-
mentions: addressed(
|
|
1474
|
+
mentions: addressed(store.getTask(thread.id), text),
|
|
1449
1475
|
});
|
|
1450
|
-
|
|
1476
|
+
return { id: thread.id, first };
|
|
1477
|
+
};
|
|
1478
|
+
const hear = ({ id, first }) => {
|
|
1479
|
+
const opened = store.getTask(id);
|
|
1480
|
+
wakeFor(id, first, "user");
|
|
1451
1481
|
if (!to) heardBy(opened, first, text);
|
|
1452
1482
|
heardPerson(opened, first);
|
|
1453
|
-
notifyBoard(store.getTask(thread.id));
|
|
1454
|
-
return { ok: true, thread: summary(store.getTask(thread.id)) };
|
|
1455
1483
|
};
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
:
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1484
|
+
const started = ({ id }) => {
|
|
1485
|
+
notifyBoard(store.getTask(id));
|
|
1486
|
+
return { ok: true, thread: summary(store.getTask(id)) };
|
|
1487
|
+
};
|
|
1488
|
+
if (folder || !needsFolder([...team])) {
|
|
1489
|
+
const thread = begin(folder);
|
|
1490
|
+
hear(thread);
|
|
1491
|
+
return started(thread);
|
|
1492
|
+
}
|
|
1493
|
+
// Harness's folder pick is a model call, and Harness's server waits 10 s for this computer's answer to a window's
|
|
1494
|
+
// call: a start held for a slow pick reached the window as "your computer is not connected" while the thread went
|
|
1495
|
+
// on to start, and the person sent it again. A pick already made (the composer's preview of this message) is
|
|
1496
|
+
// settled before the next turn of the event loop; any other starts the thread now, its agents woken once the
|
|
1497
|
+
// pick lands. A folder the person chose meanwhile stands.
|
|
1498
|
+
const suggestion = folders.suggest(text, [...team]);
|
|
1499
|
+
const notYet = new Promise((resolve) => setImmediate(resolve, null));
|
|
1500
|
+
return {
|
|
1501
|
+
pending: Promise.race([suggestion, notYet]).then((suggested) => {
|
|
1502
|
+
const thread = begin(suggested?.folder ?? null);
|
|
1503
|
+
if (suggested) hear(thread);
|
|
1504
|
+
else
|
|
1505
|
+
void suggestion.then(({ folder: picked }) => {
|
|
1506
|
+
const now = store.getTask(thread.id);
|
|
1507
|
+
if (now?.status !== "open") return;
|
|
1508
|
+
if (picked && !now.goal.workspace)
|
|
1509
|
+
store.setGoalFolder(thread.id, path.resolve(picked));
|
|
1510
|
+
hear(thread);
|
|
1511
|
+
notifyBoard(store.getTask(thread.id));
|
|
1512
|
+
});
|
|
1513
|
+
return started(thread);
|
|
1514
|
+
}),
|
|
1515
|
+
};
|
|
1463
1516
|
}
|
|
1464
1517
|
// What the swarm learned from the person (lessons.mjs), the person's to read: only the person gets this far.
|
|
1465
1518
|
if (command === "board.swarm.lessons")
|
package/lib/swarmMemory.mjs
CHANGED
|
@@ -111,6 +111,13 @@ export function createSwarmMemory({
|
|
|
111
111
|
.map((thread) => thread.id)
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
+
// The threads a search reads, or null for every one: the asker's own (`teamOnly`), one thread, or both.
|
|
115
|
+
const scopeOf = ({ agent, teamOnly, thread }) => {
|
|
116
|
+
const own = teamOnly ? threadsOf(agent) : null;
|
|
117
|
+
if (!thread) return own;
|
|
118
|
+
return !own || own.has(thread) ? new Set([thread]) : new Set();
|
|
119
|
+
};
|
|
120
|
+
|
|
114
121
|
const holdsIn = (item, folder) =>
|
|
115
122
|
!item.folder ||
|
|
116
123
|
(folder && path.resolve(item.folder) === path.resolve(folder));
|
|
@@ -174,14 +181,16 @@ export function createSwarmMemory({
|
|
|
174
181
|
|
|
175
182
|
/**
|
|
176
183
|
* What the memory holds for a query, best first: { posts, observations, lessons, weak }. `teamOnly` limits posts to
|
|
177
|
-
* the threads `agent` is on; `
|
|
178
|
-
*
|
|
184
|
+
* the threads `agent` is on; `thread` to one thread, with its jobs, and the observations and lessons that stand on
|
|
185
|
+
* it; `hosted` also leaves out the person's lessons and observations; `exclude(post)` drops posts the asker already
|
|
186
|
+
* has (the room it is in).
|
|
179
187
|
*/
|
|
180
188
|
const recall = async (
|
|
181
189
|
query,
|
|
182
190
|
{
|
|
183
191
|
agent = null,
|
|
184
192
|
teamOnly = false,
|
|
193
|
+
thread = null,
|
|
185
194
|
hosted = false,
|
|
186
195
|
folder = null,
|
|
187
196
|
// An agent's own search (swarm_memory) reads every folder, as its posts do; a brief keeps to the work's folder.
|
|
@@ -196,10 +205,11 @@ export function createSwarmMemory({
|
|
|
196
205
|
.trim()
|
|
197
206
|
.slice(0, QUERY_CHARS);
|
|
198
207
|
if (!text) return { posts: [], observations: [], lessons: [], weak: true };
|
|
199
|
-
const threads = teamOnly
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const
|
|
208
|
+
const threads = scopeOf({ agent, teamOnly, thread });
|
|
209
|
+
// Both searches rank within the threads in scope, so a thread's posts are not crowded out by the whole swarm's.
|
|
210
|
+
const inScope = threads ? store.memoryIdsIn(threads) : null;
|
|
211
|
+
const allowed = (row) => !exclude(row);
|
|
212
|
+
const words = store.memoryWords(text, POOL, { threads }).filter(allowed);
|
|
203
213
|
let meaning = [];
|
|
204
214
|
let best = null;
|
|
205
215
|
const [vector] = (await embed([text], "query")) ?? [];
|
|
@@ -222,7 +232,9 @@ export function createSwarmMemory({
|
|
|
222
232
|
}
|
|
223
233
|
const hits = topK(
|
|
224
234
|
vector,
|
|
225
|
-
[...cache.rows]
|
|
235
|
+
[...cache.rows]
|
|
236
|
+
.filter(([id]) => !inScope || inScope.has(id))
|
|
237
|
+
.map(([id, row]) => ({ id, vector: row })),
|
|
226
238
|
POOL * 2
|
|
227
239
|
);
|
|
228
240
|
// memoryPosts drops anything marked since it was cached, and keeps the hits' order.
|
|
@@ -273,7 +285,15 @@ export function createSwarmMemory({
|
|
|
273
285
|
}
|
|
274
286
|
ordered.push(row);
|
|
275
287
|
}
|
|
276
|
-
|
|
288
|
+
// The query's own words found as they are (an error code, a commit, a file name) are a match whatever their
|
|
289
|
+
// meaning scores.
|
|
290
|
+
const verbatim = words.some((row) =>
|
|
291
|
+
String(row.text).toLowerCase().includes(text.toLowerCase())
|
|
292
|
+
);
|
|
293
|
+
const weak =
|
|
294
|
+
!verbatim && (best === null ? words.length === 0 : best < WEAK_BELOW);
|
|
295
|
+
const standsOnThread = (item) =>
|
|
296
|
+
!thread || item.evidence.some((entry) => entry.goalId === thread);
|
|
277
297
|
return {
|
|
278
298
|
posts: ordered.slice(0, limit).map(viewOf),
|
|
279
299
|
observations: hosted
|
|
@@ -287,7 +307,7 @@ export function createSwarmMemory({
|
|
|
287
307
|
});
|
|
288
308
|
const shown = new Set(closest.map((observation) => observation.id));
|
|
289
309
|
return [
|
|
290
|
-
...closest,
|
|
310
|
+
...closest.filter(standsOnThread),
|
|
291
311
|
...(followThreads
|
|
292
312
|
? threadObservations(found, {
|
|
293
313
|
folder,
|
|
@@ -300,13 +320,16 @@ export function createSwarmMemory({
|
|
|
300
320
|
})(),
|
|
301
321
|
lessons: hosted
|
|
302
322
|
? []
|
|
303
|
-
: store
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
323
|
+
: store
|
|
324
|
+
.lessonsMatching(text, 5)
|
|
325
|
+
.filter(standsOnThread)
|
|
326
|
+
.map((lesson) => ({
|
|
327
|
+
about: lesson.about,
|
|
328
|
+
agent: lesson.agent,
|
|
329
|
+
text: lesson.text,
|
|
330
|
+
quote: lesson.evidence.at(-1)?.quote ?? null,
|
|
331
|
+
thread: lesson.evidence.at(-1)?.goalId ?? null,
|
|
332
|
+
})),
|
|
310
333
|
weak,
|
|
311
334
|
// The closest post's similarity, when meaning was used: what `weak` was judged on.
|
|
312
335
|
nearest: best,
|
package/lib/team.mjs
CHANGED
|
@@ -209,7 +209,7 @@ export function createTeam({ store, log = () => {} }) {
|
|
|
209
209
|
const stepsOfNow = (current) => pieceOf(current)?.steps ?? [];
|
|
210
210
|
|
|
211
211
|
// Where each step began and who held it, so a run is marked with the step it worked.
|
|
212
|
-
const started = (current, step) => {
|
|
212
|
+
const started = (current, step, at = now()) => {
|
|
213
213
|
const entry = stepsOfNow(current).find((s) => s.id === step);
|
|
214
214
|
return entry
|
|
215
215
|
? [
|
|
@@ -219,7 +219,7 @@ export function createTeam({ store, log = () => {} }) {
|
|
|
219
219
|
step,
|
|
220
220
|
specialty: entry.specialty,
|
|
221
221
|
agents: entry.agents,
|
|
222
|
-
at
|
|
222
|
+
at,
|
|
223
223
|
},
|
|
224
224
|
].slice(-40)
|
|
225
225
|
: (current.history ?? []);
|
|
@@ -272,13 +272,15 @@ export function createTeam({ store, log = () => {} }) {
|
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
274
|
* Keep the route the round proposed, starting at its first step, and say in the thread who holds what. `named`: the
|
|
275
|
-
* agents the person tagged in the message; `pins`: specialty -> the agent the person pinned for it
|
|
276
|
-
*
|
|
275
|
+
* agents the person tagged in the message; `pins`: specialty -> the agent the person pinned for it; `since`: when the
|
|
276
|
+
* person sent the message the route answers. Its first step began then, not when the round finished: an agent the
|
|
277
|
+
* person tagged starts at once and may report before the route is kept, and that run is the step's work. Returns the
|
|
278
|
+
* plan kept, or null when the proposal named nothing usable.
|
|
277
279
|
*/
|
|
278
280
|
const set = (
|
|
279
281
|
goalId,
|
|
280
282
|
proposed,
|
|
281
|
-
{ members, named = [], pins = {}, by, post }
|
|
283
|
+
{ members, named = [], pins = {}, by, post, since = null }
|
|
282
284
|
) => {
|
|
283
285
|
const checked = validPlan(proposed, { members, named, pins });
|
|
284
286
|
if (!checked) {
|
|
@@ -297,10 +299,11 @@ export function createTeam({ store, log = () => {} }) {
|
|
|
297
299
|
by,
|
|
298
300
|
at: now(),
|
|
299
301
|
};
|
|
302
|
+
const begun = since ?? now();
|
|
300
303
|
const kept = {
|
|
301
304
|
...fresh,
|
|
302
|
-
stepAt:
|
|
303
|
-
history: started(fresh, steps[0].id),
|
|
305
|
+
stepAt: begun,
|
|
306
|
+
history: started(fresh, steps[0].id, begun),
|
|
304
307
|
};
|
|
305
308
|
write(goalId, kept);
|
|
306
309
|
post?.(
|
|
@@ -473,21 +476,23 @@ export function createTeam({ store, log = () => {} }) {
|
|
|
473
476
|
};
|
|
474
477
|
|
|
475
478
|
/**
|
|
476
|
-
* Agents were
|
|
477
|
-
* moves to the earliest step of the piece one of them holds, so the route goes on from there.
|
|
479
|
+
* Agents were given work outside the route (the person wrote to them, or a free round picked one) at `at`: the
|
|
480
|
+
* thread moves to the earliest step of the piece one of them holds, so the route goes on from there. The step they
|
|
481
|
+
* are already on begins again only for work given after it began: the agents the person tagged in the message a new
|
|
482
|
+
* route answers had it when the route began, and may have reported since.
|
|
478
483
|
*/
|
|
479
|
-
const acted = (goalId, agents) => {
|
|
484
|
+
const acted = (goalId, agents, at = now()) => {
|
|
480
485
|
const current = read(goalId);
|
|
481
486
|
if (!current || !agents.length) return;
|
|
482
487
|
const step = stepsOfNow(current).find((s) =>
|
|
483
488
|
s.agents.some((holder) => agents.includes(holder))
|
|
484
489
|
);
|
|
485
490
|
if (step && step.id !== current.step) moveTo(goalId, step.id);
|
|
486
|
-
else if (step)
|
|
491
|
+
else if (step && at > (current.stepAt ?? ""))
|
|
487
492
|
write(goalId, {
|
|
488
493
|
...current,
|
|
489
|
-
stepAt:
|
|
490
|
-
history: started(current, step.id),
|
|
494
|
+
stepAt: at,
|
|
495
|
+
history: started(current, step.id, at),
|
|
491
496
|
});
|
|
492
497
|
};
|
|
493
498
|
|
package/lib/threadBriefs.mjs
CHANGED
|
@@ -48,18 +48,29 @@ export function createThreadBriefs({
|
|
|
48
48
|
return onMachine(post.author, computer && oneLine(computer));
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
const postLine = (post) =>
|
|
52
|
+
`[${post.seq}] ${writerOf(post)}${post.kind !== "post" ? ` (${post.kind})` : ""}${otherPersonNote(post)}${flagNote(post)}: ${agentText(post).slice(0, 1_200)}${agentText(post).length > 1_200 ? " [cut short: read_room has all of it]" : ""}`;
|
|
53
|
+
|
|
51
54
|
// The thread's newest posts, and where the ones before them are: the agent reads further back (read_room with
|
|
52
|
-
// before, swarm_memory with the thread) when its work needs more.
|
|
55
|
+
// before, swarm_memory with the thread) when its work needs more. The person's own posts further back come too: a
|
|
56
|
+
// change of plan in the middle of a long thread is theirs to make, and recency alone dropped it from the brief.
|
|
53
57
|
const roomDigest = (goalId, limit = 30) => {
|
|
54
58
|
const { posts, earlierBefore } = store.recentRoomPosts(goalId, { limit });
|
|
55
|
-
const
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
const person = earlierBefore
|
|
60
|
+
? store.personRoomPosts(goalId, { before: earlierBefore })
|
|
61
|
+
: { posts: [], more: false };
|
|
62
|
+
const said = person.posts.length
|
|
63
|
+
? [
|
|
64
|
+
`(What the person said before [${earlierBefore}]${person.more ? ", their newest posts there" : ""}:)`,
|
|
65
|
+
...person.posts.map(postLine),
|
|
66
|
+
]
|
|
67
|
+
: [];
|
|
59
68
|
const earlier = earlierBefore
|
|
60
|
-
? `(
|
|
69
|
+
? `(Other earlier posts, before [${earlierBefore}], are not shown: read_room with before ${earlierBefore} goes back through them, and swarm_memory with search and this thread finds one by what it says.)`
|
|
61
70
|
: "";
|
|
62
|
-
return [earlier, ...
|
|
71
|
+
return [...said, earlier, ...posts.map(postLine)]
|
|
72
|
+
.filter(Boolean)
|
|
73
|
+
.join("\n");
|
|
63
74
|
};
|
|
64
75
|
|
|
65
76
|
// The thread's goal as an agent's brief says it, when it has one.
|
|
@@ -99,7 +110,7 @@ export function createThreadBriefs({
|
|
|
99
110
|
`- Read the thread (read_room, id ${task.id}: its newest posts, and before a post number for the ones earlier) and search it (swarm_memory with search and thread ${task.id}) before starting. Without thread, swarm_memory searches what any of the person's agents did before, in any thread or session; with remember, it adds what you learned for all of them.`,
|
|
100
111
|
`- Share findings, partial work and what is left with post_to_room (id ${task.id}).`,
|
|
101
112
|
`- Files the work is about go in the thread, whoever made them: attach_file (id ${task.id}) with the file's path on this computer. A teammate's file is listed by read_room; open it with get_file.`,
|
|
102
|
-
|
|
113
|
+
'- Need help, a second opinion or something only another agent can do, or handing the next step to the agent whose turn it is? Post to the room with that agent\'s name in ask, say exactly what you need, then stop: you are woken again when it answers you by name. Naming an agent without ask ("Next: @codex", a thanks, a credit) does not wake it: the thread then waits for Harness to pass it on. The agents you can ask:',
|
|
103
114
|
...roster
|
|
104
115
|
.cardsFor(
|
|
105
116
|
roster.available().filter((name) => name !== agent),
|
package/lib/threadView.mjs
CHANGED
|
@@ -110,9 +110,11 @@ export function createThreadView({
|
|
|
110
110
|
return null;
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
+
// A turn on another computer of a thread with no folder runs in that computer's scratch folder (scratch.mjs).
|
|
113
114
|
const awaitingStart = (run) =>
|
|
114
115
|
run.status === "open" &&
|
|
115
|
-
Boolean(run.run_workspace)
|
|
116
|
+
(Boolean(run.run_workspace) ||
|
|
117
|
+
(run.kind === "wake" && Boolean(run.target_machine))) &&
|
|
116
118
|
!run.run_authorized_at;
|
|
117
119
|
// What a run was asked, without the thread's title in front of it.
|
|
118
120
|
const askOf = (run) => {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tryharness",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.68",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "tryharness",
|
|
9
|
-
"version": "0.7.
|
|
9
|
+
"version": "0.7.68",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@agentclientprotocol/sdk": "2.0.0",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"node": ">=18"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"tryharness-desktop-darwin-arm64": "0.7.
|
|
36
|
-
"tryharness-desktop-darwin-x64": "0.7.
|
|
37
|
-
"tryharness-desktop-linux-x64": "0.7.
|
|
35
|
+
"tryharness-desktop-darwin-arm64": "0.7.68",
|
|
36
|
+
"tryharness-desktop-darwin-x64": "0.7.68",
|
|
37
|
+
"tryharness-desktop-linux-x64": "0.7.68"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"node_modules/@agentclientprotocol/sdk": {
|
|
@@ -1051,9 +1051,9 @@
|
|
|
1051
1051
|
}
|
|
1052
1052
|
},
|
|
1053
1053
|
"node_modules/tryharness-desktop-darwin-arm64": {
|
|
1054
|
-
"version": "0.7.
|
|
1055
|
-
"resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-arm64/-/tryharness-desktop-darwin-arm64-0.7.
|
|
1056
|
-
"integrity": "sha512-
|
|
1054
|
+
"version": "0.7.68",
|
|
1055
|
+
"resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-arm64/-/tryharness-desktop-darwin-arm64-0.7.68.tgz",
|
|
1056
|
+
"integrity": "sha512-pgDth8NUnEwyzUzRLhKXctklEIZK8R46vhrMKaBjPjBU/+aicRhYSjc0yAkLpEFULa+H9hcFJWwrGuVCZZf7oA==",
|
|
1057
1057
|
"cpu": [
|
|
1058
1058
|
"arm64"
|
|
1059
1059
|
],
|
|
@@ -1064,9 +1064,9 @@
|
|
|
1064
1064
|
]
|
|
1065
1065
|
},
|
|
1066
1066
|
"node_modules/tryharness-desktop-darwin-x64": {
|
|
1067
|
-
"version": "0.7.
|
|
1068
|
-
"resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-x64/-/tryharness-desktop-darwin-x64-0.7.
|
|
1069
|
-
"integrity": "sha512-
|
|
1067
|
+
"version": "0.7.68",
|
|
1068
|
+
"resolved": "https://registry.npmjs.org/tryharness-desktop-darwin-x64/-/tryharness-desktop-darwin-x64-0.7.68.tgz",
|
|
1069
|
+
"integrity": "sha512-NuPSOYHLi3SSkgP8wynqfdwTZdz7VCmKisA/qg1ccmN6vitskKn6eAmB47I46mZFymEAzUUbzB83WrZRk1xLZA==",
|
|
1070
1070
|
"cpu": [
|
|
1071
1071
|
"x64"
|
|
1072
1072
|
],
|
|
@@ -1077,9 +1077,9 @@
|
|
|
1077
1077
|
]
|
|
1078
1078
|
},
|
|
1079
1079
|
"node_modules/tryharness-desktop-linux-x64": {
|
|
1080
|
-
"version": "0.7.
|
|
1081
|
-
"resolved": "https://registry.npmjs.org/tryharness-desktop-linux-x64/-/tryharness-desktop-linux-x64-0.7.
|
|
1082
|
-
"integrity": "sha512-
|
|
1080
|
+
"version": "0.7.68",
|
|
1081
|
+
"resolved": "https://registry.npmjs.org/tryharness-desktop-linux-x64/-/tryharness-desktop-linux-x64-0.7.68.tgz",
|
|
1082
|
+
"integrity": "sha512-sWzsWbRdP54hVs2+3QTh95ofuM431RNvaYPuRTrQbRc9ic2Y4XitrlF5BWt+v6GfJ7trAyi5cEP+KAWRx7/h+g==",
|
|
1083
1083
|
"cpu": [
|
|
1084
1084
|
"x64"
|
|
1085
1085
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tryharness",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.68",
|
|
4
4
|
"description": "Harness Relay: the daemon that turns the agents on this machine into your personal swarm. Memory, history, and work handed between any of them.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tryharness": "cli.mjs"
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"zod": "4.6.7"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"tryharness-desktop-darwin-arm64": "0.7.
|
|
52
|
-
"tryharness-desktop-darwin-x64": "0.7.
|
|
53
|
-
"tryharness-desktop-linux-x64": "0.7.
|
|
51
|
+
"tryharness-desktop-darwin-arm64": "0.7.68",
|
|
52
|
+
"tryharness-desktop-darwin-x64": "0.7.68",
|
|
53
|
+
"tryharness-desktop-linux-x64": "0.7.68"
|
|
54
54
|
}
|
|
55
55
|
}
|