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/coordinator.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { LOCAL_DECIDERS, askLocalAgent } from "./localAgentAsk.mjs";
|
|
3
2
|
import { roundFields } from "./cards.mjs";
|
|
4
3
|
import { MACHINE_RUNNERS, MEMBERS, TAGGED_ONLY, nameOf } from "./members.mjs";
|
|
5
4
|
import { LEAD_TIMES } from "./schedules.mjs";
|
|
@@ -14,13 +13,13 @@ import { TEAM } from "./team.mjs";
|
|
|
14
13
|
// agent, a question for the person, a part left behind, a pause. Every round is recorded with its facts and cost.
|
|
15
14
|
// The person's own message to the swarm (`@swarm`, or one in a thread that names no agent) gets its round at once, even
|
|
16
15
|
// while agents work, and every agent with a part in it is brought in together (an assembly). When Harness cannot decide
|
|
17
|
-
// that round, or finds no part for anyone in it, every agent that can work there hears the message as the
|
|
18
|
-
//
|
|
16
|
+
// that round, or finds no part for anyone in it, every agent that can work there hears the message as the person wrote
|
|
17
|
+
// it: Harness is never the only way the person's words reach their swarm.
|
|
19
18
|
// A round Harness cannot decide (an error, a dropped connection) is decided by a backup: the person's coding agents on
|
|
20
|
-
// this computer with their tools off, most finished work first
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
19
|
+
// this computer with their tools off, most finished work first, because the main orchestrator cannot be flaky and needs
|
|
20
|
+
// a backup. The same rules hold whoever decides: the swarm acts on its own and asks the person only for spending past
|
|
21
|
+
// the thread's limit, something outward-facing or hard to undo, a secret or a change to what the goal is for; a
|
|
22
|
+
// question already put to them waits for its answer.
|
|
24
23
|
|
|
25
24
|
const CODING = new Set(MACHINE_RUNNERS);
|
|
26
25
|
// The agents with a read-only switch (runner.mjs, review in the roster): only they can be handed a review.
|
|
@@ -31,12 +30,14 @@ const REVIEWERS = new Set(
|
|
|
31
30
|
const TAGGED = new Set(TAGGED_ONLY);
|
|
32
31
|
const TRANSCRIPT_POSTS = 30;
|
|
33
32
|
// The goal's own updates go to the round as the goal itself (goals.mjs), not as posts. (A goal room's opening post,
|
|
34
|
-
// kind goal, is the person's request and stays.)
|
|
35
|
-
|
|
33
|
+
// kind goal, is the person's request and stays.) A guest's words are a stranger's: they start no round and are not in
|
|
34
|
+
// one, so a round never hands work on with the person's go because of them (security audit P6, October 25); the
|
|
35
|
+
// agents read them in the thread, marked as another person's.
|
|
36
|
+
const QUIET_KINDS = new Set(["note", "held", "round", "goal_update", "guest"]);
|
|
36
37
|
// What a question to the person may be about (src/server/swarm/coordinator.ts ASK_KIND); anything else an agent decides.
|
|
37
38
|
const ASK_CATEGORIES = new Set(["spend", "outward", "secret", "scope"]);
|
|
38
39
|
// Words cut short of the server's limits: the scrub before sending can make a cut text longer than it was ("$2.40"
|
|
39
|
-
// becomes "[AMOUNT_1]"), which once took a round past the limit
|
|
40
|
+
// becomes "[AMOUNT_1]"), which once took a round past the limit.
|
|
40
41
|
const RELATED_CHARS = 3_600,
|
|
41
42
|
OBJECTIVE_CHARS = 450,
|
|
42
43
|
RESULT_CHARS = 3_600,
|
|
@@ -52,8 +53,8 @@ const COORDINATOR_KINDS = new Set(["question", "open_item"]);
|
|
|
52
53
|
/**
|
|
53
54
|
* Who a post in a thread is from, as a round or a task reads it: "coordinator" for the thread's coordinator (its
|
|
54
55
|
* questions, hand-ons and assemblies), told apart from Harness the agent, whose results, files and progress stay
|
|
55
|
-
* "harness"
|
|
56
|
-
*
|
|
56
|
+
* "harness" in every case: when the two were not told apart, answers to the coordinator's questions brought Harness
|
|
57
|
+
* the agent in.
|
|
57
58
|
*/
|
|
58
59
|
export const speakerOf = (store, thread, post) =>
|
|
59
60
|
post.author === thread.goal.facilitator &&
|
|
@@ -93,69 +94,8 @@ Routing, when \`team\` is null or \`team.nextPiece\` is given, and \`teamMembers
|
|
|
93
94
|
"; "
|
|
94
95
|
)}; combine also runs when several agents make. At light the work goes straight to one maker. Anything the person depends on, or that moves money, is careful at least. Make may have several agents side by side, only when its parts are independent; every other step has one. Check and judge never go to a maker, judge never to the framer, and combine is one agent, never a vote. An agent the person tagged fills a step, Make unless they said otherwise; a pin in \`pins\` (specialty: agent) holds the step that asks for that specialty. An agent with work running or waiting elsewhere is less available. When you route, hand on to the agents of the route's first step. Specialty ids: ${SPECIALTIES.map((specialty) => specialty.id).join(", ")}.`;
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const prompt = `${LOCAL_PROMPT}\n\n${JSON.stringify(facts)}`;
|
|
99
|
-
const invocation =
|
|
100
|
-
agent === "codex"
|
|
101
|
-
? {
|
|
102
|
-
command: "codex",
|
|
103
|
-
args: [
|
|
104
|
-
"exec",
|
|
105
|
-
"--json",
|
|
106
|
-
"--sandbox",
|
|
107
|
-
"read-only",
|
|
108
|
-
"--skip-git-repo-check",
|
|
109
|
-
"-",
|
|
110
|
-
],
|
|
111
|
-
stdin: prompt,
|
|
112
|
-
}
|
|
113
|
-
: {
|
|
114
|
-
command: "claude",
|
|
115
|
-
args: ["-p", prompt, "--output-format", "json", "--tools", ""],
|
|
116
|
-
};
|
|
117
|
-
let child;
|
|
118
|
-
try {
|
|
119
|
-
child = spawn(invocation.command, invocation.args, { cwd: os.tmpdir() });
|
|
120
|
-
} catch (error) {
|
|
121
|
-
reject(error);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
// An agent that exits before reading the prompt breaks the pipe; its exit code rejects below.
|
|
125
|
-
child.stdin.on("error", () => {});
|
|
126
|
-
child.stdin.end(invocation.stdin ?? "");
|
|
127
|
-
let out = "";
|
|
128
|
-
child.stdout.on("data", (chunk) => {
|
|
129
|
-
out += chunk;
|
|
130
|
-
});
|
|
131
|
-
child.on("error", reject);
|
|
132
|
-
child.on("close", (code) => {
|
|
133
|
-
if (code !== 0) {
|
|
134
|
-
reject(new Error(`${agent} exited with code ${code}`));
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
// Claude answers one JSON object with its text in `result`; Codex streams events, its words in agent_message.
|
|
138
|
-
let text = "";
|
|
139
|
-
for (const line of out.split("\n")) {
|
|
140
|
-
try {
|
|
141
|
-
const event = JSON.parse(line);
|
|
142
|
-
if (typeof event.result === "string") text = event.result;
|
|
143
|
-
if (
|
|
144
|
-
event.type === "item.completed" &&
|
|
145
|
-
event.item?.type === "agent_message"
|
|
146
|
-
)
|
|
147
|
-
text = event.item.text;
|
|
148
|
-
} catch {}
|
|
149
|
-
}
|
|
150
|
-
const match = text.match(/\{[\s\S]*\}/);
|
|
151
|
-
try {
|
|
152
|
-
resolve(JSON.parse(match ? match[0] : text));
|
|
153
|
-
} catch {
|
|
154
|
-
reject(new Error(`${agent} did not answer in the agreed shape`));
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
}
|
|
97
|
+
const localDecision = (agent, facts) =>
|
|
98
|
+
askLocalAgent(agent, `${LOCAL_PROMPT}\n\n${JSON.stringify(facts)}`);
|
|
159
99
|
|
|
160
100
|
// A question's choices as a coordinator gave them, kept only in the agreed shape: one to four, each with two to four
|
|
161
101
|
// options and at most one recommended.
|
|
@@ -181,7 +121,7 @@ const choicesOf = (value) => {
|
|
|
181
121
|
};
|
|
182
122
|
|
|
183
123
|
// An agent whose job in a thread just failed on its own terms is not offered that thread's next rounds for a while
|
|
184
|
-
// (
|
|
124
|
+
// (the lead once handed Bankr the same over-size job three times in two minutes). The person or another agent
|
|
185
125
|
// can still ask it by name.
|
|
186
126
|
const FAILED_REST_MS = 10 * 60_000;
|
|
187
127
|
|
|
@@ -222,6 +162,11 @@ export function createCoordinator({
|
|
|
222
162
|
placeable = () => true,
|
|
223
163
|
// A post from the other side of a shared project (projects.mjs): their own swarm sorts it, so it starts no round here.
|
|
224
164
|
fromPartner = () => false,
|
|
165
|
+
// This computer's reading of the words a round Harness's server decided (serverWords.mjs).
|
|
166
|
+
serverWords = null,
|
|
167
|
+
// The coding agent here the person picked to coordinate (LOCAL_DECIDERS), or null: decides first when Harness does
|
|
168
|
+
// not, and reads first what Harness's server decided.
|
|
169
|
+
pick = () => null,
|
|
225
170
|
}) {
|
|
226
171
|
const failedHereLately = (threadId, agent) => {
|
|
227
172
|
const at = Date.parse(store.meta(`job-failed:${threadId}:${agent}`) || "");
|
|
@@ -249,20 +194,25 @@ export function createCoordinator({
|
|
|
249
194
|
pinnedFor(store, specialty.id),
|
|
250
195
|
]).filter(([, agent]) => agent)
|
|
251
196
|
);
|
|
252
|
-
// The backups, in the order they are tried: coding agents on this computer,
|
|
253
|
-
// turn as a backup failed after the others.
|
|
197
|
+
// The backups, in the order they are tried: coding agents on this computer, the one the person picked first, then most
|
|
198
|
+
// finished work first, one whose last turn as a backup failed after the others.
|
|
254
199
|
const backups = () => {
|
|
255
200
|
const record = new Map(
|
|
256
201
|
roster().map((card) => [card.id, card.record?.done ?? 0])
|
|
257
202
|
);
|
|
203
|
+
const picked = pick();
|
|
258
204
|
return localAgents()
|
|
259
|
-
.filter((agent) => agent
|
|
205
|
+
.filter((agent) => LOCAL_DECIDERS.includes(agent))
|
|
260
206
|
.map((agent) => ({
|
|
261
207
|
agent,
|
|
208
|
+
picked: agent === picked ? 1 : 0,
|
|
262
209
|
done: record.get(agent) ?? 0,
|
|
263
210
|
failedLast: store.meta(`coordinator-backup-failed:${agent}`) ? 1 : 0,
|
|
264
211
|
}))
|
|
265
|
-
.sort(
|
|
212
|
+
.sort(
|
|
213
|
+
(a, b) =>
|
|
214
|
+
b.picked - a.picked || a.failedLast - b.failedLast || b.done - a.done
|
|
215
|
+
)
|
|
266
216
|
.map((entry) => entry.agent);
|
|
267
217
|
};
|
|
268
218
|
const stateOf = (goalId) =>
|
|
@@ -297,7 +247,7 @@ export function createCoordinator({
|
|
|
297
247
|
seq: post.seq,
|
|
298
248
|
author: speakerOf(store, thread, post),
|
|
299
249
|
kind: post.kind,
|
|
300
|
-
text: post.text.slice(0, POST_CHARS),
|
|
250
|
+
text: (serverWords?.agentText(post) ?? post.text).slice(0, POST_CHARS),
|
|
301
251
|
}));
|
|
302
252
|
const runs = store.threadRuns(thread.id);
|
|
303
253
|
const since = state.lastRoundAt ?? "";
|
|
@@ -333,12 +283,12 @@ export function createCoordinator({
|
|
|
333
283
|
...runs.filter(waitsForWindow),
|
|
334
284
|
...harnessQueued(thread.id),
|
|
335
285
|
];
|
|
336
|
-
// Every agent the person can ask, each with its card (cards.mjs); a coding agent only where the thread has a folder
|
|
337
|
-
// to work in. Harness stays one while its part here waits for a window, its card saying so, so that what is
|
|
338
|
-
// is never handed to another agent meanwhile (
|
|
286
|
+
// Every agent the person can ask, each with its card (cards.mjs); a coding agent only where the thread has a folder
|
|
287
|
+
// for it to work in. Harness stays one while its part here waits for a window, its card saying so, so that what is
|
|
288
|
+
// Harness's is never handed to another agent meanwhile (Harness's stills once went to Claude Code).
|
|
339
289
|
// An assembly leaves out the agents the person named, who already have their words, and never offers Bankr or
|
|
340
|
-
// Quotient on a guess: only once they are in the thread (
|
|
341
|
-
//
|
|
290
|
+
// Quotient on a guess: only once they are in the thread (when it did, a message that mentioned Bankr's agent gave
|
|
291
|
+
// Bankr the part meant for Claude Code).
|
|
342
292
|
// Each card's receipts go only to a Harness that takes them (the same release as frames); an older one would refuse the round.
|
|
343
293
|
const framesTaken = mode() === "local" || serverHas("swarm_frame");
|
|
344
294
|
const causesTaken = mode() === "local" || serverHas("swarm_failure_causes");
|
|
@@ -355,8 +305,8 @@ export function createCoordinator({
|
|
|
355
305
|
!failedHereLately(thread.id, candidate.id) &&
|
|
356
306
|
(!CODING.has(candidate.id) ||
|
|
357
307
|
placeable(candidate.id, thread.goal.workspace)) &&
|
|
358
|
-
// In every round, not only an assembly
|
|
359
|
-
//
|
|
308
|
+
// In every round, not only an assembly: otherwise Bankr scored 0.33 to 0.38 as the agent to hand a production
|
|
309
|
+
// keeper fix to.
|
|
360
310
|
!(
|
|
361
311
|
TAGGED.has(candidate.id) &&
|
|
362
312
|
!thread.goal.team.includes(candidate.id) &&
|
|
@@ -596,7 +546,7 @@ export function createCoordinator({
|
|
|
596
546
|
}
|
|
597
547
|
if (!decision.met && !decision.goalState) return false;
|
|
598
548
|
// A team that checks its work reaches its goal, or hands it to the person, only on code its last check passed: a
|
|
599
|
-
// change since, or no passing check yet, leaves the goal working (
|
|
549
|
+
// change since, or no passing check yet, leaves the goal working ("Ready for your review" was once posted
|
|
600
550
|
// with 1 of 3 checks met).
|
|
601
551
|
const unchecked =
|
|
602
552
|
keepsTeams() && !team.checkedNow(thread.id, headOf(thread.id));
|
|
@@ -779,13 +729,15 @@ export function createCoordinator({
|
|
|
779
729
|
store.meta(HELD, JSON.stringify(still));
|
|
780
730
|
};
|
|
781
731
|
|
|
732
|
+
// `withheld`: this computer stopped the server's words, which `given` no longer holds ({ reason, asks, forPerson }).
|
|
782
733
|
const apply = (
|
|
783
734
|
thread,
|
|
784
735
|
given,
|
|
785
736
|
coordinator,
|
|
786
737
|
candidates,
|
|
787
738
|
asked = null,
|
|
788
|
-
rules = keepsGoals()
|
|
739
|
+
rules = keepsGoals(),
|
|
740
|
+
withheld = null
|
|
789
741
|
) => {
|
|
790
742
|
endRoute(thread, given);
|
|
791
743
|
if (applyGoal(thread, given, coordinator)) return;
|
|
@@ -793,8 +745,8 @@ export function createCoordinator({
|
|
|
793
745
|
const planned = applyTeamPlan(thread, given, coordinator, asked);
|
|
794
746
|
const decision = guardQuestion(thread, given, candidates, rules);
|
|
795
747
|
// The person's message is never met with silence: a round that brings no one in and asks them nothing lets the
|
|
796
|
-
// agents hear it as they wrote it, as with `@swarm
|
|
797
|
-
//
|
|
748
|
+
// agents hear it as they wrote it, as with `@swarm`. That is the fallback whenever Jev does not understand the
|
|
749
|
+
// message. A message naming an agent is not silent: that agent has it.
|
|
798
750
|
// A team whose first step the person's named agents hold is under way: they have the message already.
|
|
799
751
|
const unheard =
|
|
800
752
|
Boolean(asked) &&
|
|
@@ -874,10 +826,18 @@ export function createCoordinator({
|
|
|
874
826
|
handOnOrHold(
|
|
875
827
|
thread,
|
|
876
828
|
part.agent,
|
|
877
|
-
|
|
829
|
+
withheld
|
|
830
|
+
? part.text
|
|
831
|
+
: `${coordinator} asked you: ${part.text.slice(0, 300)}`,
|
|
878
832
|
{ review: part.review, words: part.text },
|
|
879
833
|
coordinator
|
|
880
834
|
);
|
|
835
|
+
if (withheld)
|
|
836
|
+
saidWithheld(
|
|
837
|
+
thread,
|
|
838
|
+
withheld,
|
|
839
|
+
worded.map((part) => part.agent)
|
|
840
|
+
);
|
|
881
841
|
notifyBoard(store.getTask(thread.id));
|
|
882
842
|
return;
|
|
883
843
|
}
|
|
@@ -889,6 +849,8 @@ export function createCoordinator({
|
|
|
889
849
|
text: String(decision.text).slice(0, 4_000),
|
|
890
850
|
});
|
|
891
851
|
// Its decisions as choices a surface can offer as taps (threadView.mjs); the words stand alone without them.
|
|
852
|
+
if (asked && withheld?.forPerson)
|
|
853
|
+
serverWords.mark(asked.id, withheld.reason);
|
|
892
854
|
const choices = choicesOf(decision.choices);
|
|
893
855
|
if (asked && choices.length)
|
|
894
856
|
store.meta(`question-choices:${asked.id}`, JSON.stringify(choices));
|
|
@@ -917,14 +879,32 @@ export function createCoordinator({
|
|
|
917
879
|
handOnOrHold(
|
|
918
880
|
thread,
|
|
919
881
|
agent,
|
|
920
|
-
`${coordinator} asked you: ${text.slice(0, 300)}`,
|
|
882
|
+
withheld ? text : `${coordinator} asked you: ${text.slice(0, 300)}`,
|
|
921
883
|
{ review, words: text },
|
|
922
884
|
coordinator
|
|
923
885
|
);
|
|
924
|
-
|
|
886
|
+
if (withheld) saidWithheld(thread, withheld, [agent]);
|
|
887
|
+
} else if (withheld) saidWithheld(thread, withheld, []);
|
|
925
888
|
notifyBoard(store.getTask(thread.id));
|
|
926
889
|
};
|
|
927
890
|
|
|
891
|
+
// The thread says what was left out and why, each time this computer stops the server's words.
|
|
892
|
+
const saidWithheld = (thread, { reason, asks }, agents) =>
|
|
893
|
+
postAsCoordinator({
|
|
894
|
+
goalId: thread.id,
|
|
895
|
+
author: thread.goal.facilitator,
|
|
896
|
+
kind: "note",
|
|
897
|
+
text: serverWords.note(reason, agents.map(nameOf), asks),
|
|
898
|
+
});
|
|
899
|
+
// What this computer reads a server-decided round's words with: the person's own posts in the thread, and the coding
|
|
900
|
+
// agents here that may read them (serverWords.mjs).
|
|
901
|
+
const readingFor = (goalId) => ({
|
|
902
|
+
person: store
|
|
903
|
+
.roomPosts(goalId, 0, 500)
|
|
904
|
+
.filter((post) => post.author === "user" && post.kind === "post"),
|
|
905
|
+
readers: backups(),
|
|
906
|
+
});
|
|
907
|
+
|
|
928
908
|
// The person wrote while agents work: Harness asks only whether that changed what they want, and writes the goal's new
|
|
929
909
|
// version if so; what to do next waits for the thread to go quiet (October 16: a change the person made while Claude
|
|
930
910
|
// Code worked reached the goal 13 minutes later, when Codex's turn after it had ended). Once for each of their posts.
|
|
@@ -971,6 +951,13 @@ export function createCoordinator({
|
|
|
971
951
|
});
|
|
972
952
|
if (!decision?.goal) return;
|
|
973
953
|
const now = store.getTask(thread.id);
|
|
954
|
+
const screened = serverWords
|
|
955
|
+
? await serverWords.screen({ goal: decision.goal }, readingFor(thread.id))
|
|
956
|
+
: { reason: null };
|
|
957
|
+
if (screened.reason) {
|
|
958
|
+
saidWithheld(now, screened, []);
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
974
961
|
applyGoal(now, { goal: decision.goal }, now.goal.facilitator);
|
|
975
962
|
store.meta(`goal-kept:${thread.id}`, String(newest));
|
|
976
963
|
};
|
|
@@ -990,7 +977,7 @@ export function createCoordinator({
|
|
|
990
977
|
!fromPartner(goalId, post)
|
|
991
978
|
);
|
|
992
979
|
// A turn T3 Code is running for one of the thread's agents counts as work going on, though Harness did not start it
|
|
993
|
-
// (
|
|
980
|
+
// (the coordinator once told Claude Code to "continue" three times while it worked in T3).
|
|
994
981
|
const active =
|
|
995
982
|
store.threadRuns(goalId).some(going) || busyInT3(thread).length > 0;
|
|
996
983
|
// A thread started through Harness by an agent that runs elsewhere gets no rounds until the person sets a spend ceiling.
|
|
@@ -1141,13 +1128,28 @@ export function createCoordinator({
|
|
|
1141
1128
|
thread,
|
|
1142
1129
|
`${harnessCould(error)}; ${nameOf(decidedBy)} coordinated it.`
|
|
1143
1130
|
);
|
|
1131
|
+
// A round Harness's server decided keeps the person's go, so its words reach the agents only once this computer read
|
|
1132
|
+
// them (serverWords.mjs); rounds decided on this computer are this computer's own words.
|
|
1133
|
+
let withheld = null;
|
|
1134
|
+
if (decidedBy === "harness" && serverWords) {
|
|
1135
|
+
const { reason, asks } = await serverWords.screen(
|
|
1136
|
+
decision,
|
|
1137
|
+
readingFor(goalId)
|
|
1138
|
+
);
|
|
1139
|
+
if (reason) {
|
|
1140
|
+
const stripped = serverWords.strip(decision, lastSeq);
|
|
1141
|
+
decision = stripped.decision;
|
|
1142
|
+
withheld = { reason, asks, forPerson: stripped.forPerson };
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1144
1145
|
apply(
|
|
1145
1146
|
store.getTask(goalId),
|
|
1146
1147
|
decision,
|
|
1147
1148
|
thread.goal.facilitator,
|
|
1148
1149
|
gathered.candidates,
|
|
1149
1150
|
asked,
|
|
1150
|
-
decidedBy === "harness" ? keepsGoals() : true
|
|
1151
|
+
decidedBy === "harness" ? keepsGoals() : true,
|
|
1152
|
+
withheld
|
|
1151
1153
|
);
|
|
1152
1154
|
};
|
|
1153
1155
|
|
|
@@ -1159,8 +1161,8 @@ export function createCoordinator({
|
|
|
1159
1161
|
: `Harness could not decide this round (${why})`;
|
|
1160
1162
|
};
|
|
1161
1163
|
|
|
1162
|
-
// The coordinator's note, unless the thread's newest post already says the same: a repeat after new work is said
|
|
1163
|
-
// (
|
|
1164
|
+
// The coordinator's note, unless the thread's newest post already says the same: a repeat after new work is said
|
|
1165
|
+
// again (a repeated error once said nothing, and the thread stopped with no one told).
|
|
1164
1166
|
const noteOnce = (thread, text) => {
|
|
1165
1167
|
const newest = store.roomPosts(thread.id, 0, 500).at(-1);
|
|
1166
1168
|
if (newest?.kind === "note" && newest.text === text) return;
|
|
@@ -1186,7 +1188,7 @@ export function createCoordinator({
|
|
|
1186
1188
|
};
|
|
1187
1189
|
|
|
1188
1190
|
/** The person resumed a paused thread: its round looks at where it stands, though only notes came in since
|
|
1189
|
-
* (
|
|
1191
|
+
* (a resume once reopened a thread that then sat with Codex's handoff unread). */
|
|
1190
1192
|
const resumed = (goalId) => {
|
|
1191
1193
|
store.meta(`coordinator-resumed:${goalId}`, "1");
|
|
1192
1194
|
poke(goalId);
|