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
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { askerOf } from "./answers.mjs";
|
|
2
|
+
import { TAGGED_ONLY, member, nameOf } from "./members.mjs";
|
|
3
|
+
import { notifyDesktop } from "./notify.mjs";
|
|
4
|
+
import { restrictedRun } from "./runWorker.mjs";
|
|
5
|
+
import { secretReason } from "./secrets.mjs";
|
|
6
|
+
import { conversationOf } from "./taskRooms.mjs";
|
|
7
|
+
import { mentionsIn } from "./threadActions.mjs";
|
|
8
|
+
|
|
9
|
+
// Failures that can change on their own: the person's stop, a run that never started, a run that ended early.
|
|
10
|
+
const TRANSIENT_FAILURES = ["person", "start", "exit"];
|
|
11
|
+
const ENDED = ["done", "failed", "needs_input"];
|
|
12
|
+
const OPEN_RUN = ["open", "claimed", "running", "needs_input"];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A job under a thread changed: its result or question lands in the thread and wakes whoever asked for it.
|
|
16
|
+
*
|
|
17
|
+
* `actions` wakes and asks in the thread (threadActions.mjs); `fromElsewhere(agent)` says whether an agent runs in its
|
|
18
|
+
* own cloud (threadAuthority.mjs), whose answers wake their asker only on the injection guard's reading
|
|
19
|
+
* (`readByGuard`). `files` lists what Harness made for a task (boardFiles.mjs).
|
|
20
|
+
*/
|
|
21
|
+
export function createJobAnswers({
|
|
22
|
+
store,
|
|
23
|
+
roomAgents,
|
|
24
|
+
runsHere,
|
|
25
|
+
fromElsewhere,
|
|
26
|
+
readByGuard,
|
|
27
|
+
actions,
|
|
28
|
+
files,
|
|
29
|
+
notifyBoard,
|
|
30
|
+
}) {
|
|
31
|
+
// What the post says: an answer to an ask follows the ask in the thread, so it stands as said; a job's result names
|
|
32
|
+
// the job. What Harness made for the task is named under its answer, so every agent reading the thread can get it.
|
|
33
|
+
const textOf = (task, goal) => {
|
|
34
|
+
const answer =
|
|
35
|
+
task.status !== "failed" &&
|
|
36
|
+
String(task.result || "").trim() &&
|
|
37
|
+
task.objective.startsWith(`Asked in "${goal.objective}": `);
|
|
38
|
+
const made =
|
|
39
|
+
task.target_agent === "harness"
|
|
40
|
+
? files
|
|
41
|
+
.harnessFilesOf(task.id)
|
|
42
|
+
.map((fileId) => store.file(fileId))
|
|
43
|
+
.filter(Boolean)
|
|
44
|
+
: [];
|
|
45
|
+
const said = answer
|
|
46
|
+
? task.result
|
|
47
|
+
: `${task.status === "done" ? "Finished" : task.status === "failed" ? "Could not finish" : "Asks about"} job "${task.objective}": ${task.result || ""}`;
|
|
48
|
+
return `${said.slice(0, 18_000)}${made.length ? `\n\nFiles: ${made.map(files.fileLine).join("; ")}` : ""}`.slice(
|
|
49
|
+
0,
|
|
50
|
+
20_000
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Asks Harness's turn read while it worked (asks.mjs turnEnded): their askers hear the answer as the task's does.
|
|
55
|
+
const alsoAskedOf = (task) => {
|
|
56
|
+
try {
|
|
57
|
+
return JSON.parse(store.meta(`harness-also-asked:${task.id}`) || "[]");
|
|
58
|
+
} catch {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// A room where only the task's own agent worked closes with the task; one that grew into a conversation stays open.
|
|
64
|
+
const closesWithTask = (goal, task, mentions) =>
|
|
65
|
+
!mentions.length &&
|
|
66
|
+
task.status !== "needs_input" &&
|
|
67
|
+
goal.status === "open" &&
|
|
68
|
+
!store.roomPosts(goal.id, 0, 500).some((entry) => entry.kind === "post") &&
|
|
69
|
+
!store.threadRuns(goal.id).some((run) => OPEN_RUN.includes(run.status));
|
|
70
|
+
|
|
71
|
+
/** `previous` is the task's last seen status, holder and run fields. */
|
|
72
|
+
const changed = (task, previous) => {
|
|
73
|
+
const goal = task.parent_id ? store.getTask(task.parent_id) : null;
|
|
74
|
+
if (
|
|
75
|
+
!goal ||
|
|
76
|
+
goal.kind !== "goal" ||
|
|
77
|
+
task.kind !== "task" ||
|
|
78
|
+
previous?.status === task.status
|
|
79
|
+
)
|
|
80
|
+
return;
|
|
81
|
+
if (!ENDED.includes(task.status)) return;
|
|
82
|
+
const who = task.claimed_by || task.target_agent || "an agent";
|
|
83
|
+
// An answer that came through Harness's server (Bankr's, Quotient's, Harness's server answering for a closed
|
|
84
|
+
// window) wakes no one with the person's go (personsGo).
|
|
85
|
+
const hosted =
|
|
86
|
+
member(who)?.runs === "server" &&
|
|
87
|
+
(who !== "harness" || Boolean(store.meta(`harness-served:${task.id}`)));
|
|
88
|
+
// A job that failed on its own terms (the agent refused it or reported failure, not a run that never started or
|
|
89
|
+
// ended early) is kept, so the next rounds do not hand the same agent the same failing work (coordinator.mjs).
|
|
90
|
+
if (task.status === "failed" && !TRANSIENT_FAILURES.includes(task.failure))
|
|
91
|
+
store.meta(`job-failed:${goal.id}:${who}`, new Date().toISOString());
|
|
92
|
+
// A task's own job: the first in the thread the task opened. Its answer names only its asker (below).
|
|
93
|
+
const root = store.meta(`task-room:${goal.id}`) === task.id;
|
|
94
|
+
const text = textOf(task, goal);
|
|
95
|
+
// Harness's answer wakes the agents it names, as its other posts do: a next step it names for @claude is Claude's.
|
|
96
|
+
// Other agents' answers wake only the asker. An agent Harness names joins the thread, as one the coordinator hands
|
|
97
|
+
// work to does. One that moves money or takes positions is never woken by Harness naming it, even once it is in
|
|
98
|
+
// the thread: only the person's name for it or another agent's ask. (Harness explaining why Bankr failed, with
|
|
99
|
+
// "@bankr" in its words, would otherwise start more Bankr jobs.)
|
|
100
|
+
const named =
|
|
101
|
+
who === "harness" && !root
|
|
102
|
+
? mentionsIn(task.result || "", roomAgents).filter(
|
|
103
|
+
(agent) => agent !== who && !TAGGED_ONLY.includes(agent)
|
|
104
|
+
)
|
|
105
|
+
: [];
|
|
106
|
+
const joining = named.filter((agent) => !goal.goal.team.includes(agent));
|
|
107
|
+
if (joining.length)
|
|
108
|
+
store.setGoalTeam(goal.id, [...goal.goal.team, ...joining]);
|
|
109
|
+
const team = [...goal.goal.team, ...joining];
|
|
110
|
+
// Its asker gets a turn (answers.mjs). In a task's own thread an agent woken on its own channel (OpenClaw, Hermes,
|
|
111
|
+
// Grok Bot, Muse) hears it there, and Harness hears work it posted from a conversation in that conversation; a
|
|
112
|
+
// coding agent here, or Harness otherwise, hears it in this thread.
|
|
113
|
+
const asker = askerOf(task);
|
|
114
|
+
const hearsHere =
|
|
115
|
+
!root ||
|
|
116
|
+
runsHere(asker) ||
|
|
117
|
+
(asker === "harness" && !conversationOf(task));
|
|
118
|
+
const mentions = [
|
|
119
|
+
...new Set([
|
|
120
|
+
...(hearsHere ? [asker] : []),
|
|
121
|
+
...(root ? [] : [...alsoAskedOf(task), ...named]),
|
|
122
|
+
]),
|
|
123
|
+
].filter((agent) => agent && agent !== who && team.includes(agent));
|
|
124
|
+
// The asker's turn on its own task's answer, in the thread the task opened (threadAuthority.mjs threadMayRun).
|
|
125
|
+
const answering = root && mentions.includes(asker) ? asker : null;
|
|
126
|
+
// An answer that carries something like a key is held for the person, as any post is, and the room hears that it
|
|
127
|
+
// was.
|
|
128
|
+
const flag = secretReason(text);
|
|
129
|
+
if (flag) {
|
|
130
|
+
store.roomPost({
|
|
131
|
+
goalId: goal.id,
|
|
132
|
+
author: who,
|
|
133
|
+
kind: "held",
|
|
134
|
+
text,
|
|
135
|
+
machine: task.claimed_machine,
|
|
136
|
+
});
|
|
137
|
+
notifyDesktop(
|
|
138
|
+
`${nameOf(who)}'s answer in a thread was held: it looks like ${flag}.`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
const post = store.roomPost({
|
|
142
|
+
goalId: goal.id,
|
|
143
|
+
author: who,
|
|
144
|
+
kind: flag
|
|
145
|
+
? "note"
|
|
146
|
+
: task.status === "needs_input"
|
|
147
|
+
? "question"
|
|
148
|
+
: "result",
|
|
149
|
+
text: flag
|
|
150
|
+
? `${nameOf(who)}'s answer was held for you: it looks like ${flag}.`
|
|
151
|
+
: text,
|
|
152
|
+
mentions,
|
|
153
|
+
// The computer that did the job, so the thread says which Codex answered.
|
|
154
|
+
machine: task.claimed_machine,
|
|
155
|
+
});
|
|
156
|
+
if (root && closesWithTask(goal, task, mentions)) {
|
|
157
|
+
store.setGoalState(goal.id, {
|
|
158
|
+
status: task.status,
|
|
159
|
+
result: task.result || "",
|
|
160
|
+
});
|
|
161
|
+
} else if (goal.status === "open" && fromElsewhere(who) && !flag)
|
|
162
|
+
// An answer from the person's agents elsewhere wakes its asker on the guard's reading of it, as their posts do.
|
|
163
|
+
void readByGuard(text).then((guard) => {
|
|
164
|
+
if (guard?.verdict === "flag" || guard?.verdict === "hold")
|
|
165
|
+
store.meta(`flagged:${post.id}`, String(guard.score));
|
|
166
|
+
actions.wakeFor(goal.id, post, who, undefined, { guard, answering });
|
|
167
|
+
notifyBoard(store.getTask(goal.id));
|
|
168
|
+
});
|
|
169
|
+
// A restricted job's answer is that run's words: the asker it wakes gets no go from it.
|
|
170
|
+
else if (goal.status === "open")
|
|
171
|
+
actions.wakeFor(goal.id, post, who, undefined, {
|
|
172
|
+
answering,
|
|
173
|
+
hosted,
|
|
174
|
+
limited: restrictedRun(store, task) ? "restricted" : null,
|
|
175
|
+
});
|
|
176
|
+
// Harness is asked by name only in a post (wakeFor); in a task's own thread no round follows the answer, so its
|
|
177
|
+
// answer to work Harness posted is asked of Harness as one.
|
|
178
|
+
if (root && mentions.includes("harness") && goal.status === "open")
|
|
179
|
+
actions.ask(
|
|
180
|
+
goal.id,
|
|
181
|
+
"harness",
|
|
182
|
+
`${who} mentioned you: ${post.text.slice(0, 300)}`,
|
|
183
|
+
who,
|
|
184
|
+
post.text
|
|
185
|
+
);
|
|
186
|
+
notifyBoard(store.getTask(goal.id));
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
return { changed };
|
|
190
|
+
}
|
package/lib/landed.mjs
CHANGED
|
@@ -29,7 +29,7 @@ const WEEK_MS = 7 * 24 * 60 * 60_000;
|
|
|
29
29
|
// An editor gets one diff tab per file: past this many, the rest are a note rather than a wall of tabs.
|
|
30
30
|
const DIFF_FILES = 12;
|
|
31
31
|
const PULL_LINK = /https:\/\/[^\s/]+\/[^\s]+?\/(?:pull|-\/merge_requests)\/\d+/;
|
|
32
|
-
// A repository's view asks git of every checkout of it (on
|
|
32
|
+
// A repository's view asks git of every checkout of it (on one Mac, 37 T3 Code checkouts of one repository at about
|
|
33
33
|
// ten calls of 25-50 ms each): never all at once, and never holding the daemon while git runs.
|
|
34
34
|
const AT_ONCE = 6;
|
|
35
35
|
// The buddy reads a repository's view every 30 s while it shows; one read serves the moments around it.
|
package/lib/lane.mjs
CHANGED
|
@@ -3,16 +3,47 @@ import path from "node:path";
|
|
|
3
3
|
import { readJson, writeJsonAtomic } from "./files.mjs";
|
|
4
4
|
import { paths } from "./paths.mjs";
|
|
5
5
|
|
|
6
|
-
// The person's own model lane, kept on this computer once they let Harness Relay use it
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
6
|
+
// The person's own model lane, kept on this computer once they let Harness Relay use it: the API key or model endpoint
|
|
7
|
+
// their Harness window runs on, so Harness can answer in their swarm's threads while that window is closed. Only their
|
|
8
|
+
// linked Harness window gives it (sealed, phones.mjs), only they can take it back, and it leaves this computer only
|
|
9
|
+
// with a task given to Harness, the way the window sends it with each of its own turns: Harness's server uses it for
|
|
10
|
+
// that task and keeps nothing. An endpoint only this computer reaches (localhost or the person's network) is called
|
|
11
|
+
// from here for Harness's server (`fetch`), and only that endpoint.
|
|
12
12
|
|
|
13
13
|
const PROVIDERS = new Set(["venice", "bankr", "openai", "dot"]);
|
|
14
14
|
export const laneFile = () => path.join(paths.home, "harness-lane.json");
|
|
15
15
|
|
|
16
|
+
// The model API calls Harness's server makes to the person's endpoint (an OpenAI-compatible one: the chat call, and the
|
|
17
|
+
// model list), each with its method, under the endpoint's own path. Any other path on the person's model host (an
|
|
18
|
+
// admin page, another app on the same port) is not a model call (security audit S11).
|
|
19
|
+
const MODEL_CALLS = new Map([
|
|
20
|
+
["/chat/completions", "POST"],
|
|
21
|
+
["/completions", "POST"],
|
|
22
|
+
["/responses", "POST"],
|
|
23
|
+
["/models", "GET"],
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* The address asked for, if it is one of `calls` (Harness's server's: MODEL_CALLS) on the endpoint itself; null
|
|
27
|
+
* otherwise.
|
|
28
|
+
*/
|
|
29
|
+
export function modelCallUrl(baseUrl, url, method, calls = MODEL_CALLS) {
|
|
30
|
+
let base, target;
|
|
31
|
+
try {
|
|
32
|
+
base = new URL(baseUrl);
|
|
33
|
+
target = new URL(String(url));
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
// URL resolves dot segments; an encoded slash, dot or backslash could still mean another path to the endpoint.
|
|
38
|
+
if (/%2e|%2f|%5c/i.test(target.pathname)) return null;
|
|
39
|
+
if (target.origin !== base.origin || target.username || target.password)
|
|
40
|
+
return null;
|
|
41
|
+
const root = base.pathname.replace(/\/+$/, "");
|
|
42
|
+
if (!target.pathname.startsWith(`${root}/`)) return null;
|
|
43
|
+
const call = target.pathname.slice(root.length).replace(/\/+$/, "");
|
|
44
|
+
return calls.get(call) === method ? target.href : null;
|
|
45
|
+
}
|
|
46
|
+
|
|
16
47
|
// The shape Harness's server takes (src/schemas/credentials.ts), checked here so a malformed lane is refused when given.
|
|
17
48
|
function credentialOf(value) {
|
|
18
49
|
if (!value || typeof value !== "object") return null;
|
|
@@ -131,14 +162,14 @@ export function createHarnessLane({
|
|
|
131
162
|
credential?.type === "custom" && credential.endpoint.transport === "relay"
|
|
132
163
|
? credential.endpoint.baseUrl.replace(/\/+$/, "")
|
|
133
164
|
: null;
|
|
134
|
-
|
|
135
|
-
|
|
165
|
+
if (!["GET", "POST"].includes(method))
|
|
166
|
+
return failed(403, `${method} is not a model call`);
|
|
167
|
+
const target = base ? modelCallUrl(base, url, method) : null;
|
|
168
|
+
if (!target)
|
|
136
169
|
return failed(
|
|
137
170
|
403,
|
|
138
|
-
"that address is not
|
|
171
|
+
"that address is not a model call on the endpoint the person let Harness Relay use"
|
|
139
172
|
);
|
|
140
|
-
if (!["GET", "POST"].includes(method))
|
|
141
|
-
return failed(403, `${method} is not a model call`);
|
|
142
173
|
let response;
|
|
143
174
|
try {
|
|
144
175
|
response = await fetchImpl(target, {
|
package/lib/lessons.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
// What the swarm learns from the person, step 2 of its learning. Each post the person writes in a thread is read on
|
|
2
|
-
// Harness's server
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
2
|
+
// Harness's server with the agents' work since they last wrote and the few lessons kept here closest to it. A post that
|
|
3
|
+
// says something lasting comes back as lessons, each standing on the person's exact words: a new one is kept, the same
|
|
4
|
+
// one again adds the new words to it, and an update or a reversal replaces the kept one (which stays as the record of
|
|
5
|
+
// what was). Lessons are about the person (tastes, standards, ways of working), one agent (what it should or should not
|
|
6
|
+
// do), or a kind of work (how it goes well), and hold everywhere or in the thread's folder. They are kept apart from
|
|
7
|
+
// Harness's own memory. Nothing is read on the privacy setting, with this computer off Harness, or from a Harness that
|
|
8
|
+
// does not read lessons (swarm_lessons). Posts are read one at a time, so two quick ones never both add the same
|
|
9
|
+
// lesson.
|
|
10
10
|
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { workSince } from "./reactions.mjs";
|
|
13
13
|
import { fromBlob, toBlob, topK } from "./vectors.mjs";
|
|
14
14
|
|
|
15
|
-
// The kept lessons a post is compared with, closest first. At today's scale that is every lesson: in
|
|
16
|
-
//
|
|
15
|
+
// The kept lessons a post is compared with, closest first. At today's scale that is every lesson: in a replay of
|
|
16
|
+
// real threads, six chosen by words left out the lessons a repeat repeated.
|
|
17
17
|
const KNOWN = 24;
|
|
18
18
|
const POST_CHARS = 4_000;
|
|
19
19
|
|
|
@@ -80,10 +80,10 @@ export function createLessons({
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
const read = async (thread, post) => {
|
|
83
|
-
// Learned from the person's threads, not from a single job's room, where their words settle that job (
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
83
|
+
// Learned from the person's threads, not from a single job's room, where their words settle that job (a room's "the
|
|
84
|
+
// bankr agent will have tools to be able to call the transaction" was once kept as a lasting lesson).
|
|
85
|
+
// No wording separated such answers from wishes when Jev read them; the two among the posts measured were both in
|
|
86
|
+
// task rooms, and none of the person's lasting wishes was.
|
|
87
87
|
if (!readsLessons() || isTaskRoom(thread)) return [];
|
|
88
88
|
const known = await closest(post.text);
|
|
89
89
|
const { before } = workSince(
|
|
@@ -149,8 +149,8 @@ export function createLessons({
|
|
|
149
149
|
};
|
|
150
150
|
if (!fresh.text || !["person", "agent", "work"].includes(fresh.about))
|
|
151
151
|
continue;
|
|
152
|
-
// A lesson about one agent stands only to another about the same agent (
|
|
153
|
-
//
|
|
152
|
+
// A lesson about one agent stands only to another about the same agent (once, "Harness should be generating the
|
|
153
|
+
// videos" read as the opposite of Claude Code's role, and replaced it); the person's and the work's stand to each
|
|
154
154
|
// other, as the writer words the same wish either way (the candy track came back once as each).
|
|
155
155
|
const target = knownIds.has(lesson.match?.id)
|
|
156
156
|
? store.getLesson(lesson.match.id)
|
package/lib/library.mjs
CHANGED
|
@@ -25,11 +25,11 @@ const MAX_BYTES = { image: 20e6, pdf: 200e6, doc: 20e6 };
|
|
|
25
25
|
const Z_GATE = 2.0;
|
|
26
26
|
// A brief nobody asked for takes a file only when it stands out much further, and close to the best one: among 268
|
|
27
27
|
// files, right answers stood 3.9 to 8.2 above the rest and the best answer to a task about something never written 3.9
|
|
28
|
-
// at most, while an unrelated README in second place trailed the right file by more than a point
|
|
28
|
+
// at most, while an unrelated README in second place trailed the right file by more than a point.
|
|
29
29
|
const BRIEF_Z = 4.0;
|
|
30
30
|
const BRIEF_NEAR_BEST = 1.0;
|
|
31
|
-
// Below this many parts the spread says little, and a fixed similarity stands in (
|
|
32
|
-
// 0.68 and up, never-said questions 0.675 at most).
|
|
31
|
+
// Below this many parts the spread says little, and a fixed similarity stands in (in media search, right answers
|
|
32
|
+
// scored 0.68 and up, never-said questions 0.675 at most).
|
|
33
33
|
const MIN_SCALE = 200;
|
|
34
34
|
const FLOOR = { image: 0.7, audio: 0.7, text: 0.7 };
|
|
35
35
|
const SMALL_GROUP = 20;
|
package/lib/lineup.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
import { detectAgents } from "./commands.mjs";
|
|
5
5
|
import { detectLocalAgents, setupHermes, setupOpenClaw } from "./wakes.mjs";
|
|
6
6
|
import { configureAgents } from "./adapters.mjs";
|
|
7
|
+
import { confirmAgentBinary } from "./agentBinaries.mjs";
|
|
7
8
|
import { MACHINE_RUNNERS, nameOf } from "./members.mjs";
|
|
8
9
|
import { paths } from "./paths.mjs";
|
|
9
10
|
import { readJson, writeJsonAtomic } from "./files.mjs";
|
|
@@ -257,6 +258,8 @@ export function joinAgent({
|
|
|
257
258
|
...config,
|
|
258
259
|
agentStates: { ...config.agentStates, [agent]: state },
|
|
259
260
|
});
|
|
261
|
+
// Adding an agent is the person's word on the program it runs as (agentBinaries.mjs).
|
|
262
|
+
confirmAgentBinary(agent, { file });
|
|
260
263
|
} else {
|
|
261
264
|
const result = localSetup[agent]({ runtimeRoot });
|
|
262
265
|
if (!result.ok) return { ok: false, error: result.detail };
|