tryharness 0.7.81 → 0.7.83
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 +4 -3
- package/assets/install.sh +104 -0
- package/cli.mjs +203 -321
- package/lib/adapters.mjs +7 -6
- package/lib/agentRuntimes.mjs +2 -1
- package/lib/backupSetup.mjs +0 -52
- package/lib/boardProtocol.json +19 -1
- package/lib/browserPage.mjs +30 -0
- package/lib/cards.mjs +5 -2
- package/lib/daemon.mjs +103 -5
- package/lib/desktop.mjs +7 -1
- package/lib/dispatcher.mjs +12 -2
- package/lib/environments.mjs +4 -11
- package/lib/goalCommands.mjs +2 -1
- package/lib/hookDialects.mjs +2 -1
- package/lib/jobAnswers.mjs +2 -1
- package/lib/localStack.mjs +24 -9
- package/lib/mcp-stdio.mjs +6 -0
- package/lib/members.json +1 -1
- package/lib/museSession.mjs +2 -1
- package/lib/nativeHost.mjs +11 -2
- package/lib/network.mjs +1 -0
- package/lib/notify.mjs +48 -16
- package/lib/onboard.mjs +71 -366
- package/lib/ownMachines.mjs +4 -1
- package/lib/pairing.mjs +0 -84
- package/lib/paths.mjs +17 -0
- package/lib/personNotices.mjs +9 -25
- package/lib/profile.mjs +0 -109
- package/lib/projects.mjs +18 -4
- package/lib/removeHarness.mjs +91 -0
- package/lib/roomChannels.mjs +2 -0
- package/lib/runner.mjs +3 -3
- package/lib/runtime-install.mjs +22 -2
- package/lib/screen.mjs +133 -0
- package/lib/selfUpdate.mjs +6 -6
- package/lib/service.mjs +120 -7
- package/lib/sessionControl.mjs +10 -0
- package/lib/setupChoices.mjs +400 -0
- package/lib/setupMode.mjs +137 -0
- package/lib/t3.mjs +23 -14
- package/lib/threadActions.mjs +2 -1
- package/lib/toolCheck.mjs +136 -0
- package/lib/ui.mjs +15 -1
- package/lib/wakes.mjs +3 -3
- package/npm-shrinkwrap.json +14 -14
- package/package.json +4 -4
- package/release.json +49 -42
package/lib/adapters.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
removeSessionHooks,
|
|
11
11
|
sessionHooksPath,
|
|
12
12
|
} from "./hookDialects.mjs";
|
|
13
|
+
import { harnessNode } from "./paths.mjs";
|
|
13
14
|
|
|
14
15
|
export const AGENTS = MACHINE_RUNNERS;
|
|
15
16
|
|
|
@@ -94,7 +95,7 @@ export function detectMcpClients({
|
|
|
94
95
|
export function mcpClientSnippet({
|
|
95
96
|
runtimeRoot,
|
|
96
97
|
client,
|
|
97
|
-
nodePath =
|
|
98
|
+
nodePath = harnessNode(),
|
|
98
99
|
}) {
|
|
99
100
|
return {
|
|
100
101
|
mcpServers: {
|
|
@@ -115,7 +116,7 @@ export function mcpClientSnippet({
|
|
|
115
116
|
function installAsset(
|
|
116
117
|
source,
|
|
117
118
|
target,
|
|
118
|
-
{ runtimeRoot, nodePath =
|
|
119
|
+
{ runtimeRoot, nodePath = harnessNode(), agent = "" }
|
|
119
120
|
) {
|
|
120
121
|
ensureDir(path.dirname(target));
|
|
121
122
|
const text = fs
|
|
@@ -186,7 +187,7 @@ function writeDshRows(homeDir, { mcpPath } = {}) {
|
|
|
186
187
|
" config:",
|
|
187
188
|
" serverName: harness",
|
|
188
189
|
" transport: stdio",
|
|
189
|
-
` command: ${JSON.stringify(
|
|
190
|
+
` command: ${JSON.stringify(harnessNode())}`,
|
|
190
191
|
` args: ${JSON.stringify([mcpPath, "--agent", "dsh"])}`,
|
|
191
192
|
" env: {}",
|
|
192
193
|
" - id: tryharness",
|
|
@@ -262,14 +263,14 @@ function addMcpServer(agent, executable, { mcpPath, homeDir, execute }) {
|
|
|
262
263
|
if (setup.file) {
|
|
263
264
|
writeMcpEntry(setup.file(homeDir), {
|
|
264
265
|
...setup.entry,
|
|
265
|
-
command:
|
|
266
|
+
command: harnessNode(),
|
|
266
267
|
args: server,
|
|
267
268
|
});
|
|
268
269
|
if (setup.enable) execute(executable, setup.enable);
|
|
269
270
|
return { ok: true };
|
|
270
271
|
}
|
|
271
272
|
execute(executable, setup.remove);
|
|
272
|
-
return execute(executable, [...setup.add, "--",
|
|
273
|
+
return execute(executable, [...setup.add, "--", harnessNode(), ...server]);
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
function removeMcpServer(agent, executable, { homeDir, execute }) {
|
|
@@ -357,7 +358,7 @@ export function configureAgents({
|
|
|
357
358
|
"add",
|
|
358
359
|
"harness",
|
|
359
360
|
"--",
|
|
360
|
-
|
|
361
|
+
harnessNode(),
|
|
361
362
|
mcpPath,
|
|
362
363
|
"--agent",
|
|
363
364
|
agent,
|
package/lib/agentRuntimes.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { agentEnvironment } from "./agentnode.mjs";
|
|
|
7
7
|
import { agentBinary } from "./agentBinaries.mjs";
|
|
8
8
|
import { runtimeOf } from "./agentRuntimeConfig.mjs";
|
|
9
9
|
import { openMuseSession } from "./museSession.mjs";
|
|
10
|
+
import { harnessNode } from "./paths.mjs";
|
|
10
11
|
|
|
11
12
|
const progress = (emit, observe, kind, text) => {
|
|
12
13
|
observe(
|
|
@@ -282,7 +283,7 @@ async function runAcp(task, runtime, hooks) {
|
|
|
282
283
|
: [
|
|
283
284
|
{
|
|
284
285
|
name: "harness",
|
|
285
|
-
command:
|
|
286
|
+
command: harnessNode(),
|
|
286
287
|
args: [
|
|
287
288
|
fileURLToPath(new URL("./mcp-stdio.mjs", import.meta.url)),
|
|
288
289
|
"--agent",
|
package/lib/backupSetup.mjs
CHANGED
|
@@ -27,58 +27,6 @@ async function askPassphrase(ui, { twice }) {
|
|
|
27
27
|
return first;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/** Setup's step, on home only: bring a Resident's board back, or offer to start backing it up. */
|
|
31
|
-
export async function offerBackup({ ui, daemonRequest, role, boardIsEmpty }) {
|
|
32
|
-
if (role !== "home") return;
|
|
33
|
-
const status = await daemonRequest({ command: "backup.status" }).catch(
|
|
34
|
-
() => null
|
|
35
|
-
);
|
|
36
|
-
if (!status?.ok || status.entitled === null) return;
|
|
37
|
-
if (status.entitled === false) {
|
|
38
|
-
ui.info(
|
|
39
|
-
"Your board stays on this computer. With Resident, Harness also keeps an encrypted backup of it, so a new computer can bring it back."
|
|
40
|
-
);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (status.on) return;
|
|
44
|
-
if (!ui.interactive) return;
|
|
45
|
-
if (status.latest && boardIsEmpty) {
|
|
46
|
-
ui.info(
|
|
47
|
-
`You have a backup of your board from ${status.latest.fromLabel || "another computer"}, ${when(status.latest.createdAt)}.`
|
|
48
|
-
);
|
|
49
|
-
for (let tries = 0; tries < 3; tries++) {
|
|
50
|
-
const passphrase = await askPassphrase(ui, { twice: false });
|
|
51
|
-
if (!passphrase) break;
|
|
52
|
-
const restored = await daemonRequest(
|
|
53
|
-
{ command: "backup.restore", passphrase },
|
|
54
|
-
120_000
|
|
55
|
-
);
|
|
56
|
-
if (restored.ok) {
|
|
57
|
-
ui.success(
|
|
58
|
-
`Your board is back (${restored.rows} items). It goes on backing up from this computer.`
|
|
59
|
-
);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
ui.warn(restored.error || "That backup could not be opened.");
|
|
63
|
-
if (restored.code !== "wrong_passphrase") break;
|
|
64
|
-
}
|
|
65
|
-
ui.info(`To try again later: ${relayCommand()} backup restore`);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const yes = await ui.confirm({
|
|
69
|
-
message:
|
|
70
|
-
"Keep an encrypted backup of your board with Harness? A new computer can bring it back with your passphrase; Harness cannot read it.",
|
|
71
|
-
initialValue: true,
|
|
72
|
-
});
|
|
73
|
-
if (!yes) return;
|
|
74
|
-
const passphrase = await askPassphrase(ui, { twice: true });
|
|
75
|
-
if (!passphrase) return;
|
|
76
|
-
const on = await daemonRequest({ command: "backup.on", passphrase }, 120_000);
|
|
77
|
-
if (on.ok)
|
|
78
|
-
ui.success("Your board is backed up, sealed with your passphrase.");
|
|
79
|
-
else ui.warn(on.error || "The backup did not start.");
|
|
80
|
-
}
|
|
81
|
-
|
|
82
30
|
/** npx tryharness backup [on | now | restore | off] */
|
|
83
31
|
export async function backupCommand({ argv, ui, daemonRequest }) {
|
|
84
32
|
const sub = argv[0];
|
package/lib/boardProtocol.json
CHANGED
|
@@ -711,6 +711,23 @@
|
|
|
711
711
|
"swarm.lineup",
|
|
712
712
|
"swarm.add",
|
|
713
713
|
"swarm.remove",
|
|
714
|
+
"setup.signin",
|
|
715
|
+
"setup.cancel",
|
|
716
|
+
"setup.bankr",
|
|
717
|
+
"setup.state",
|
|
718
|
+
"setup.finish",
|
|
719
|
+
"tour.state",
|
|
720
|
+
"tour.done",
|
|
721
|
+
"setup.notify",
|
|
722
|
+
"setup.apps",
|
|
723
|
+
"setup.workplace",
|
|
724
|
+
"setup.folders",
|
|
725
|
+
"setup.folder",
|
|
726
|
+
"setup.findFolders",
|
|
727
|
+
"setup.toolCheck",
|
|
728
|
+
"setup.fix",
|
|
729
|
+
"swarm.check",
|
|
730
|
+
"wake.server",
|
|
714
731
|
"phone.list",
|
|
715
732
|
"phone.link.answer",
|
|
716
733
|
"phone.revoke",
|
|
@@ -778,7 +795,8 @@
|
|
|
778
795
|
"board.wait",
|
|
779
796
|
"board.landed.thread",
|
|
780
797
|
"board.landed.folder",
|
|
781
|
-
"board.landed.open"
|
|
798
|
+
"board.landed.open",
|
|
799
|
+
"browser.page"
|
|
782
800
|
],
|
|
783
801
|
"plainPerson": ["board.standing.off"],
|
|
784
802
|
"plainHarnessReads": [
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Which page the person is on, as the Harness extension tells this computer (the extension's computerPage.js, through
|
|
2
|
+
// nativeHost.mjs), for the buddy's chip on their next message. It holds only a web page's title and link, in memory, and
|
|
3
|
+
// only the person's own buddy reads it: an agent sees a page only when the person sends one with their words.
|
|
4
|
+
const MAX_TITLE = 500;
|
|
5
|
+
const MAX_URL = 2_000;
|
|
6
|
+
|
|
7
|
+
/** A page as the extension may tell it, or null for anything else. */
|
|
8
|
+
function pageOf(page) {
|
|
9
|
+
if (typeof page?.title !== "string" || typeof page?.url !== "string")
|
|
10
|
+
return null;
|
|
11
|
+
if (!/^https?:\/\//.test(page.url) || page.url.length > MAX_URL) return null;
|
|
12
|
+
return { title: page.title.slice(0, MAX_TITLE), url: page.url };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function createBrowserPage() {
|
|
16
|
+
let page = null;
|
|
17
|
+
return {
|
|
18
|
+
/** From the native host, which names no agent; an agent cannot say what the person is looking at. */
|
|
19
|
+
set(request) {
|
|
20
|
+
if (request.agent) return { ok: false, error: "only the browser says" };
|
|
21
|
+
page = pageOf(request.page);
|
|
22
|
+
return { ok: true };
|
|
23
|
+
},
|
|
24
|
+
read(request) {
|
|
25
|
+
if (request.agent !== "user")
|
|
26
|
+
return { ok: false, error: "only the person reads this" };
|
|
27
|
+
return { ok: true, page };
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
package/lib/cards.mjs
CHANGED
|
@@ -20,6 +20,7 @@ const ANSWERS = {
|
|
|
20
20
|
email: "woken by email when work is posted",
|
|
21
21
|
webhook: "woken when work is posted",
|
|
22
22
|
"local-webhook": "woken when work is posted",
|
|
23
|
+
listen: "woken when work is posted",
|
|
23
24
|
schedule: "picks work up on its own schedule",
|
|
24
25
|
none: "only when the person next talks to it",
|
|
25
26
|
};
|
|
@@ -28,8 +29,10 @@ export const answersFor = (entry) =>
|
|
|
28
29
|
? "not set up yet: work posted for it waits until the person sets it up in Harness"
|
|
29
30
|
: entry.setup?.state === "not_answering"
|
|
30
31
|
? "not answering right now: work posted for it waits until it does"
|
|
31
|
-
:
|
|
32
|
-
|
|
32
|
+
: entry.setup?.how === "listen" && entry.setup.detail
|
|
33
|
+
? entry.setup.detail
|
|
34
|
+
: (ANSWERS[entry.setup?.how ?? member(entry.id)?.wake] ??
|
|
35
|
+
"when it next looks");
|
|
33
36
|
|
|
34
37
|
const NOTE_LIMIT = 300;
|
|
35
38
|
const noteKey = (id) => `agent-note:${id}`;
|
package/lib/daemon.mjs
CHANGED
|
@@ -112,7 +112,14 @@ import {
|
|
|
112
112
|
RUN_CALLER,
|
|
113
113
|
} from "./runAuthority.mjs";
|
|
114
114
|
import { createActorRoster } from "./actorRoster.mjs";
|
|
115
|
-
import { createLineup, createLineupCommands } from "./lineup.mjs";
|
|
115
|
+
import { agentsHere, createLineup, createLineupCommands } from "./lineup.mjs";
|
|
116
|
+
import { untilSignedIn } from "./setupMode.mjs";
|
|
117
|
+
import { createSetupChoices } from "./setupChoices.mjs";
|
|
118
|
+
import { checkTools, TOOL_CHECK_DEADLINE_MS } from "./toolCheck.mjs";
|
|
119
|
+
import { AGENTS } from "./adapters.mjs";
|
|
120
|
+
|
|
121
|
+
// Where a computer signs in when setup has not said otherwise.
|
|
122
|
+
const DEFAULT_ORIGIN = "https://tryharness.ai";
|
|
116
123
|
import {
|
|
117
124
|
CHECKABLE,
|
|
118
125
|
SIGN_IN,
|
|
@@ -150,6 +157,7 @@ import { createDirectLink } from "./directLink.mjs";
|
|
|
150
157
|
import { readsFromCopy } from "./machineRoutes.mjs";
|
|
151
158
|
import { createConnectors } from "./connectors.mjs";
|
|
152
159
|
import { createBrowserWake } from "./browserWake.mjs";
|
|
160
|
+
import { createBrowserPage } from "./browserPage.mjs";
|
|
153
161
|
import { createWindowAsks } from "./windowAsks.mjs";
|
|
154
162
|
import { createSeen } from "./seen.mjs";
|
|
155
163
|
import { createAuditor } from "./audit.mjs";
|
|
@@ -227,6 +235,12 @@ function stuckThresholds() {
|
|
|
227
235
|
|
|
228
236
|
export async function startDaemon() {
|
|
229
237
|
ensureDir(paths.home);
|
|
238
|
+
// One daemon per computer. While setup's daemon hands over to the app's background item, the item's own one starts
|
|
239
|
+
// and finds the other still answering: it leaves, and launchd starts it again once the other has gone.
|
|
240
|
+
if (await daemonAnswers(paths.socket)) {
|
|
241
|
+
appendLog(paths.log, "another Harness daemon is running here; leaving it");
|
|
242
|
+
process.exit(0);
|
|
243
|
+
}
|
|
230
244
|
// Started by the Harness app's launcher (HarnessDaemon.swift): if it goes, this goes too, so the daemon launchd starts
|
|
231
245
|
// next is the only one. The agents this daemon starts do not inherit the mark.
|
|
232
246
|
const launcher = Number(process.env.HARNESS_LAUNCHER_PID);
|
|
@@ -235,9 +249,17 @@ export async function startDaemon() {
|
|
|
235
249
|
setInterval(() => {
|
|
236
250
|
if (process.ppid !== launcher) process.exit(0);
|
|
237
251
|
}, 5_000).unref();
|
|
252
|
+
// Not signed in yet: Harness runs anyway, so the buddy can show setup, and carries on from here once signed in.
|
|
253
|
+
if (!readJson(paths.config, {}).token)
|
|
254
|
+
await untilSignedIn({
|
|
255
|
+
paths,
|
|
256
|
+
origin: readJson(paths.config, {}).origin || DEFAULT_ORIGIN,
|
|
257
|
+
agents: agentsHere()
|
|
258
|
+
.filter((entry) => AGENTS.includes(entry.id))
|
|
259
|
+
.map((entry) => entry.id),
|
|
260
|
+
log: (line) => appendLog(paths.log, line),
|
|
261
|
+
});
|
|
238
262
|
const config = readJson(paths.config, {});
|
|
239
|
-
if (!config.origin || !config.token)
|
|
240
|
-
throw new Error("Harness is not paired. Run: npx tryharness");
|
|
241
263
|
// node-sqlite3-wasm locks with a directory that exists only during a transaction. A daemon
|
|
242
264
|
// killed mid-transaction leaves it behind and every later open fails "database is locked";
|
|
243
265
|
// with no daemon answering, nothing can hold it.
|
|
@@ -786,7 +808,8 @@ export async function startDaemon() {
|
|
|
786
808
|
}
|
|
787
809
|
if (first)
|
|
788
810
|
notices.notify(
|
|
789
|
-
`${nameOf(agent)} is not answering its wakes (${detail}). Its work waits until it does
|
|
811
|
+
`${nameOf(agent)} is not answering its wakes (${detail}). Its work waits until it does.`,
|
|
812
|
+
{ thread: threads[0] }
|
|
790
813
|
);
|
|
791
814
|
},
|
|
792
815
|
});
|
|
@@ -1052,6 +1075,7 @@ export async function startDaemon() {
|
|
|
1052
1075
|
});
|
|
1053
1076
|
// What this computer hands the person's Harness page through the extension (browserWake.mjs): Harness's tasks they
|
|
1054
1077
|
// let it finish in their browser, sent again when a browser starts listening after this daemon restarted.
|
|
1078
|
+
const browserPage = createBrowserPage();
|
|
1055
1079
|
const browserWake = createBrowserWake({
|
|
1056
1080
|
log,
|
|
1057
1081
|
pending: () =>
|
|
@@ -2954,7 +2978,43 @@ export async function startDaemon() {
|
|
|
2954
2978
|
};
|
|
2955
2979
|
// What the control socket answers that no module answers itself, by command.
|
|
2956
2980
|
const controlCommands = {
|
|
2957
|
-
status: () => ({
|
|
2981
|
+
status: () => ({
|
|
2982
|
+
ok: true,
|
|
2983
|
+
...state,
|
|
2984
|
+
counts: store.counts(),
|
|
2985
|
+
// The app shows its setup until the person finishes it there (setup.finish). A computer set up before the app
|
|
2986
|
+
// had setup has no such mark, and nothing left to set up.
|
|
2987
|
+
setupDone: readJson(paths.config, {}).setupDone !== false,
|
|
2988
|
+
}),
|
|
2989
|
+
// "Tell me when an agent needs me" in setup: off stops desktop notices (notify.mjs), never the board's own.
|
|
2990
|
+
"setup.notify": (request) => {
|
|
2991
|
+
writeJsonAtomic(paths.config, {
|
|
2992
|
+
...readJson(paths.config, {}),
|
|
2993
|
+
desktopNotices: request.on !== false,
|
|
2994
|
+
});
|
|
2995
|
+
return { ok: true };
|
|
2996
|
+
},
|
|
2997
|
+
"setup.finish": () => {
|
|
2998
|
+
writeJsonAtomic(paths.config, {
|
|
2999
|
+
...readJson(paths.config, {}),
|
|
3000
|
+
setupDone: true,
|
|
3001
|
+
});
|
|
3002
|
+
return { ok: true };
|
|
3003
|
+
},
|
|
3004
|
+
// The buddy's tour: once, on the computer that holds the swarm, after setup. `setup` says it may still come due.
|
|
3005
|
+
"tour.state": () => {
|
|
3006
|
+
const config = readJson(paths.config, {});
|
|
3007
|
+
const setup = config.setupDone === false;
|
|
3008
|
+
const home = machine.role !== "worker";
|
|
3009
|
+
return { ok: true, setup, due: home && !setup && !config.tourDone };
|
|
3010
|
+
},
|
|
3011
|
+
"tour.done": () => {
|
|
3012
|
+
writeJsonAtomic(paths.config, {
|
|
3013
|
+
...readJson(paths.config, {}),
|
|
3014
|
+
tourDone: true,
|
|
3015
|
+
});
|
|
3016
|
+
return { ok: true };
|
|
3017
|
+
},
|
|
2958
3018
|
doctor: () => ({
|
|
2959
3019
|
ok: true,
|
|
2960
3020
|
status: state,
|
|
@@ -3091,6 +3151,9 @@ export async function startDaemon() {
|
|
|
3091
3151
|
browserWake
|
|
3092
3152
|
.next(request.waitMs)
|
|
3093
3153
|
.then((messages) => ({ ok: true, messages })),
|
|
3154
|
+
// Which page the person is on, from the extension's native host, for the buddy's chip (browserPage.mjs).
|
|
3155
|
+
"browser.page.set": (request) => browserPage.set(request),
|
|
3156
|
+
"browser.page": (request) => browserPage.read(request),
|
|
3094
3157
|
// A Harness page's ask for a link offer, from the extension's native host: it waits for the person's answer here.
|
|
3095
3158
|
"phone.link.ask": (request) =>
|
|
3096
3159
|
phones.linkAsk.request({
|
|
@@ -3128,6 +3191,9 @@ export async function startDaemon() {
|
|
|
3128
3191
|
},
|
|
3129
3192
|
// How Harness wakes the agents it keeps on the server (Grok Bot): read and saved there, never here.
|
|
3130
3193
|
"wake.server": (request) => askHarness("wake", request.input || {}),
|
|
3194
|
+
// Bankr in setup: status, Connect (makes the person's Harness wallet) and Link (a code for their Bankr agent).
|
|
3195
|
+
"setup.bankr": (request) =>
|
|
3196
|
+
askHarness("bankr_setup", { action: String(request.action || "") }),
|
|
3131
3197
|
// Whether agent work is going on here, for the desktop app deciding when the Mac may sleep.
|
|
3132
3198
|
activity: () =>
|
|
3133
3199
|
machineActivity({
|
|
@@ -3233,6 +3299,14 @@ export async function startDaemon() {
|
|
|
3233
3299
|
};
|
|
3234
3300
|
const answerControl = (request) => {
|
|
3235
3301
|
const command = String(request.command || "");
|
|
3302
|
+
// An agent loading its Harness tools, or calling list_agents through them: what setup's tool check listens for
|
|
3303
|
+
// (toolCheck.mjs).
|
|
3304
|
+
if (
|
|
3305
|
+
(command === "agent.toolsListed" || command === "board.swarm.agents") &&
|
|
3306
|
+
request.agent
|
|
3307
|
+
)
|
|
3308
|
+
toolCallsHeard.set(String(request.agent), Date.now());
|
|
3309
|
+
if (command === "agent.toolsListed") return { ok: true };
|
|
3236
3310
|
if (command.startsWith("board.")) return answerBoard(request);
|
|
3237
3311
|
if (local.handles(command)) return local.command(request);
|
|
3238
3312
|
if (Object.hasOwn(controlCommands, command))
|
|
@@ -3243,8 +3317,32 @@ export async function startDaemon() {
|
|
|
3243
3317
|
}
|
|
3244
3318
|
// An agent's call to Harness from its MCP server on this computer, carried on the bridge (mcpRelay.mjs).
|
|
3245
3319
|
if (mcpRelay.handles(command)) return mcpRelay.run(request);
|
|
3320
|
+
if (setupChoices.handles(command)) return setupChoices.answer(request);
|
|
3246
3321
|
return { ok: false, error: "unknown command" };
|
|
3247
3322
|
};
|
|
3323
|
+
// Setup's check that Harness's tools load inside an agent, and its Fix: the agent's Harness entries written again
|
|
3324
|
+
// (lineup.mjs joinAgent, on Harness's own Node), then checked again.
|
|
3325
|
+
const toolCallsHeard = new Map();
|
|
3326
|
+
const heardSince = (agent, at) => (toolCallsHeard.get(agent) ?? 0) >= at;
|
|
3327
|
+
const toolCheck = (agent) =>
|
|
3328
|
+
checkTools(agent, { heardSince, deadlineMs: TOOL_CHECK_DEADLINE_MS });
|
|
3329
|
+
controlCommands["setup.toolCheck"] = (request) =>
|
|
3330
|
+
toolCheck(String(request.target || "")).then((result) => ({
|
|
3331
|
+
ok: true,
|
|
3332
|
+
agent: String(request.target || ""),
|
|
3333
|
+
...result,
|
|
3334
|
+
}));
|
|
3335
|
+
controlCommands["setup.fix"] = (request) => {
|
|
3336
|
+
const agent = String(request.target || "");
|
|
3337
|
+
const joined = lineupCommands.run({ command: "swarm.add", target: agent });
|
|
3338
|
+
if (!joined?.ok) return joined;
|
|
3339
|
+
return controlCommands["setup.toolCheck"](request);
|
|
3340
|
+
};
|
|
3341
|
+
// What the app's setup window and settings choose: where threads open, and which guarded folders search reads.
|
|
3342
|
+
const setupChoices = createSetupChoices({
|
|
3343
|
+
configPath: paths.config,
|
|
3344
|
+
knownFolders: () => folders.known().map((place) => place.path),
|
|
3345
|
+
});
|
|
3248
3346
|
const control = await listenControl({
|
|
3249
3347
|
socketPath: paths.socket,
|
|
3250
3348
|
answer: answerControl,
|
package/lib/desktop.mjs
CHANGED
|
@@ -256,6 +256,12 @@ export function installDesktop({
|
|
|
256
256
|
return { target, updated: true };
|
|
257
257
|
}
|
|
258
258
|
|
|
259
|
+
/** Whether setup installed the app here before, so an upgrade keeps it on the same release. */
|
|
260
|
+
export function desktopInstalled() {
|
|
261
|
+
const recorded = readJson(marker(), {}).path;
|
|
262
|
+
return Boolean(recorded && fs.existsSync(recorded));
|
|
263
|
+
}
|
|
264
|
+
|
|
259
265
|
/** Whether this login can show a window at all: not a server reached over SSH. */
|
|
260
266
|
export function canShowDesktop({
|
|
261
267
|
env = process.env,
|
|
@@ -286,7 +292,7 @@ export function openDesktop({
|
|
|
286
292
|
child.unref();
|
|
287
293
|
}
|
|
288
294
|
|
|
289
|
-
const BUNDLE_ID = "ai.tryharness.desktop";
|
|
295
|
+
export const BUNDLE_ID = "ai.tryharness.desktop";
|
|
290
296
|
// The app's own uninstall run (UNINSTALL_ARG in the app's lib.rs) takes out what macOS registered for it, the
|
|
291
297
|
// Lid-Closed power helper and its backstop job, which nothing outside the app can remove. Buddies up to 0.7.53 don't
|
|
292
298
|
// know the argument and would open instead.
|
package/lib/dispatcher.mjs
CHANGED
|
@@ -3,6 +3,8 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { askLocalAgent, DISPATCH_AGENTS } from "./localAgentAsk.mjs";
|
|
5
5
|
import { ensureModels, modelById, modelsPresent } from "./localmodels.mjs";
|
|
6
|
+
import { readJson } from "./files.mjs";
|
|
7
|
+
import { paths } from "./paths.mjs";
|
|
6
8
|
|
|
7
9
|
// The dispatcher slot (owner, November 1): "manager - it is its own slot", "lfm slot should act as a dispatcher not an
|
|
8
10
|
// orchestrator", "facilitator is dispatcher". Jev decides who takes the work, where and how; the dispatcher carries the
|
|
@@ -154,11 +156,17 @@ const ownEntry = (file) => {
|
|
|
154
156
|
// Where the person's own models are found for the Swarm tab's list: these folders, a few levels down. A path typed
|
|
155
157
|
// there reaches any other (no file dialog, owner rule: folders are typed or listed, never opened by the OS).
|
|
156
158
|
const MODEL_FOLDERS = ["models", "Downloads", "Documents", "Desktop"];
|
|
159
|
+
// macOS asks before Harness reads these three; only the ones the person picked in setup are read (localStack.mjs).
|
|
160
|
+
const ASKED_FOLDERS = new Set(["Downloads", "Documents", "Desktop"]);
|
|
161
|
+
const pickedFolders = () => {
|
|
162
|
+
const picked = readJson(paths.config, {}).searchFolders;
|
|
163
|
+
return Array.isArray(picked) ? picked : [...ASKED_FOLDERS];
|
|
164
|
+
};
|
|
157
165
|
const MODEL_DEPTH = 3;
|
|
158
166
|
const SKIPPED = new Set(["node_modules", ".git", "Library", ".Trash"]);
|
|
159
167
|
|
|
160
168
|
/** The .gguf model files under the person's usual folders, largest first; projectors (mmproj) are parts, not models. */
|
|
161
|
-
export function ownModelFiles(home = os.homedir()) {
|
|
169
|
+
export function ownModelFiles(home = os.homedir(), picked = pickedFolders()) {
|
|
162
170
|
const found = [];
|
|
163
171
|
const walk = (dir, depth) => {
|
|
164
172
|
let entries = [];
|
|
@@ -179,7 +187,9 @@ export function ownModelFiles(home = os.homedir()) {
|
|
|
179
187
|
found.push({ file: at, bytes: fs.statSync(at).size });
|
|
180
188
|
}
|
|
181
189
|
};
|
|
182
|
-
for (const folder of MODEL_FOLDERS)
|
|
190
|
+
for (const folder of MODEL_FOLDERS)
|
|
191
|
+
if (!ASKED_FOLDERS.has(folder) || picked.includes(folder))
|
|
192
|
+
walk(path.join(home, folder), 1);
|
|
183
193
|
return found.sort((a, b) => b.bytes - a.bytes).slice(0, 20);
|
|
184
194
|
}
|
|
185
195
|
|
package/lib/environments.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { detectAgents } from "./commands.mjs";
|
|
4
4
|
import { member, nameOf } from "./members.mjs";
|
|
5
|
-
import { t3Access, t3Tool } from "./t3.mjs";
|
|
5
|
+
import { t3Access, t3Step, t3Tool } from "./t3.mjs";
|
|
6
6
|
import { t3Checkouts, t3Committers, t3Link } from "./places.mjs";
|
|
7
7
|
|
|
8
8
|
const DRIVER_AGENT = {
|
|
@@ -623,17 +623,10 @@ export function createEnvironments({
|
|
|
623
623
|
model: { model: entry.model, effort: null, by: "T3 Code" },
|
|
624
624
|
subagents: [],
|
|
625
625
|
steps: items
|
|
626
|
-
.
|
|
627
|
-
|
|
628
|
-
item.type !== "reasoning" &&
|
|
629
|
-
item.type !== "user_message" &&
|
|
630
|
-
item.text
|
|
631
|
-
)
|
|
626
|
+
.map(t3Step)
|
|
627
|
+
.filter(Boolean)
|
|
632
628
|
.slice(-10)
|
|
633
|
-
.map((
|
|
634
|
-
kind: item.type === "assistant_message" ? "say" : "do",
|
|
635
|
-
text: item.text.slice(0, 1_000),
|
|
636
|
-
})),
|
|
629
|
+
.map((step) => ({ ...step, text: step.text.slice(0, 1_000) })),
|
|
637
630
|
});
|
|
638
631
|
}
|
|
639
632
|
if (!authorized() || grant !== readGrant)
|
package/lib/goalCommands.mjs
CHANGED
|
@@ -266,7 +266,8 @@ export function createGoalCommands({
|
|
|
266
266
|
text,
|
|
267
267
|
});
|
|
268
268
|
notifyDesktop(
|
|
269
|
-
`A post by ${nameOf(agent)} in a thread was held: it looks like ${flag}
|
|
269
|
+
`A post by ${nameOf(agent)} in a thread was held: it looks like ${flag}.`,
|
|
270
|
+
{ thread: goal.id }
|
|
270
271
|
);
|
|
271
272
|
return {
|
|
272
273
|
ok: true,
|
package/lib/hookDialects.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { ensureDir, readJson } from "./files.mjs";
|
|
5
5
|
import { steerRoot } from "./steerQueue.mjs";
|
|
6
|
+
import { harnessNode } from "./paths.mjs";
|
|
6
7
|
|
|
7
8
|
// How each agent runs session hooks: the file it reads them from, that file's shape, and what it does with a hook's
|
|
8
9
|
// output. Harness hooks three moments, by the names Claude Code gave them: a session starting (its board notice, where it
|
|
@@ -267,7 +268,7 @@ export function installSessionHooks(
|
|
|
267
268
|
{
|
|
268
269
|
runtimeRoot,
|
|
269
270
|
homeDir = os.homedir(),
|
|
270
|
-
nodePath =
|
|
271
|
+
nodePath = harnessNode(),
|
|
271
272
|
env = process.env,
|
|
272
273
|
}
|
|
273
274
|
) {
|
package/lib/jobAnswers.mjs
CHANGED
|
@@ -137,7 +137,8 @@ export function createJobAnswers({
|
|
|
137
137
|
machine: task.claimed_machine,
|
|
138
138
|
});
|
|
139
139
|
notifyDesktop(
|
|
140
|
-
`${nameOf(who)}'s answer in a thread was held: it looks like ${flag}
|
|
140
|
+
`${nameOf(who)}'s answer in a thread was held: it looks like ${flag}.`,
|
|
141
|
+
{ thread: goal.id }
|
|
141
142
|
);
|
|
142
143
|
}
|
|
143
144
|
const post = store.roomPost({
|
package/lib/localStack.mjs
CHANGED
|
@@ -155,18 +155,33 @@ export function createLocalStack({
|
|
|
155
155
|
};
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const config = readJson(configPath, {});
|
|
161
|
-
const added = Array.isArray(config.localFolders) ? config.localFolders : [];
|
|
162
|
-
const own = OWN_FOLDERS.map((name) => path.join(os.homedir(), name));
|
|
163
|
-
return [...new Set([...own, ...added])].filter(
|
|
158
|
+
const existing = (folders) =>
|
|
159
|
+
[...new Set(folders)].filter(
|
|
164
160
|
(folder) => typeof folder === "string" && fs.existsSync(folder)
|
|
165
161
|
);
|
|
162
|
+
const added = (config) =>
|
|
163
|
+
Array.isArray(config.localFolders) ? config.localFolders : [];
|
|
164
|
+
// Where people keep their own files and the folders they added (tryharness local add), searched or not: what is
|
|
165
|
+
// in them stays on their computers when shared.
|
|
166
|
+
const ownFolders = () =>
|
|
167
|
+
existing([
|
|
168
|
+
...OWN_FOLDERS.map((name) => path.join(os.homedir(), name)),
|
|
169
|
+
...added(readJson(configPath, {})),
|
|
170
|
+
]);
|
|
171
|
+
// The folders the library searches, which the person picked in setup (`searchFolders`, names of Desktop, Documents
|
|
172
|
+
// and Downloads): macOS asks before Harness may read each of those, so one never picked is never read. A computer
|
|
173
|
+
// set up before setup asked searches all three, unless search is off.
|
|
174
|
+
const libraryFolders = () => {
|
|
175
|
+
const config = readJson(configPath, {});
|
|
176
|
+
if (config.libraryOff === true) return [];
|
|
177
|
+
const picked = Array.isArray(config.searchFolders)
|
|
178
|
+
? OWN_FOLDERS.filter((name) => config.searchFolders.includes(name))
|
|
179
|
+
: OWN_FOLDERS;
|
|
180
|
+
return existing([
|
|
181
|
+
...picked.map((name) => path.join(os.homedir(), name)),
|
|
182
|
+
...added(config),
|
|
183
|
+
]);
|
|
166
184
|
};
|
|
167
|
-
// The folders the library searches: the person's own, unless they turned search off.
|
|
168
|
-
const libraryFolders = () =>
|
|
169
|
-
readJson(configPath, {}).libraryOff === true ? [] : ownFolders();
|
|
170
185
|
/** Whether a file is in one of the person's own folders, after links are followed. */
|
|
171
186
|
const inOwnFolder = (file) => {
|
|
172
187
|
let real;
|
package/lib/mcp-stdio.mjs
CHANGED
|
@@ -1465,6 +1465,12 @@ async function relay(line) {
|
|
|
1465
1465
|
return;
|
|
1466
1466
|
}
|
|
1467
1467
|
if (request.method === "notifications/initialized") return;
|
|
1468
|
+
// The agent loading Harness's tools: what setup's tool check needs to hear, whether or not the agent's model then
|
|
1469
|
+
// calls one (a small local model can answer without calling anything).
|
|
1470
|
+
if (request.method === "tools/list")
|
|
1471
|
+
daemonRequest({ command: "agent.toolsListed", agent }, 2_000).catch(
|
|
1472
|
+
() => {}
|
|
1473
|
+
);
|
|
1468
1474
|
|
|
1469
1475
|
const config = readJson(paths.config, {});
|
|
1470
1476
|
if (!config.origin || !config.token) {
|
package/lib/members.json
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"fixedRole": { "specialty": "prediction-markets", "role": "analyst" },
|
|
65
65
|
"about": "prediction markets research: one search over the markets it tracks, with their odds and rules",
|
|
66
66
|
"where": "on Harness's server", "limits": "Takes no positions from a task. Cannot see files on this computer." },
|
|
67
|
-
{ "id": "muse", "name": "Muse", "aliases": [], "road": "hosted", "home": "cloud", "runs": "self", "target": true, "wake": "
|
|
67
|
+
{ "id": "muse", "name": "Muse", "aliases": [], "road": "hosted", "home": "cloud", "runs": "self", "target": true, "wake": "listen",
|
|
68
68
|
"about": "writing and creative drafts",
|
|
69
69
|
"where": "in Meta's cloud", "limits": "Cannot see files on this computer unless one is attached with share_with_cloud, and cannot run anything here." },
|
|
70
70
|
{ "id": "openclaw", "name": "OpenClaw", "aliases": ["open claw"], "road": "local", "home": "machine", "runs": "self", "target": true, "wake": "local-webhook",
|
package/lib/museSession.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { harnessNode } from "./paths.mjs";
|
|
2
3
|
|
|
3
4
|
/** One owned Muse session, including tools and frames sent during its opening handshake. */
|
|
4
5
|
export async function openMuseSession({
|
|
@@ -70,7 +71,7 @@ export async function openMuseSession({
|
|
|
70
71
|
harness: {
|
|
71
72
|
transport: "stdio",
|
|
72
73
|
mode: "required",
|
|
73
|
-
command:
|
|
74
|
+
command: harnessNode(),
|
|
74
75
|
args: [
|
|
75
76
|
fileURLToPath(new URL("./mcp-stdio.mjs", import.meta.url)),
|
|
76
77
|
"--agent",
|
package/lib/nativeHost.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 { paths } from "./paths.mjs";
|
|
4
|
+
import { harnessNode, paths } from "./paths.mjs";
|
|
5
5
|
|
|
6
6
|
// The Harness extension finds the daemon on its own computer through Chrome's native messaging: Chrome starts this
|
|
7
7
|
// host for the extension, one message in and one answer out, so the Harness window links to the computer it runs on
|
|
@@ -61,7 +61,7 @@ const manifestFor = (program) => ({
|
|
|
61
61
|
*/
|
|
62
62
|
export function installNativeHost({
|
|
63
63
|
runtimeRoot,
|
|
64
|
-
nodePath =
|
|
64
|
+
nodePath = harnessNode(),
|
|
65
65
|
platform = process.platform,
|
|
66
66
|
home = os.homedir(),
|
|
67
67
|
folders = browserFolders(platform, home),
|
|
@@ -142,6 +142,13 @@ export async function serveNativeHost({
|
|
|
142
142
|
}
|
|
143
143
|
return { ok: true, listening: true };
|
|
144
144
|
}
|
|
145
|
+
// The page the person is on (the extension's computerPage.js), for the buddy's chip.
|
|
146
|
+
if (message?.type === "active-page") {
|
|
147
|
+
await daemon({ command: "browser.page.set", page: message.page }).catch(
|
|
148
|
+
() => null
|
|
149
|
+
);
|
|
150
|
+
return { ok: true };
|
|
151
|
+
}
|
|
145
152
|
try {
|
|
146
153
|
if (message?.type === "this-computer") {
|
|
147
154
|
const found = await daemon({ command: "phone.identity" });
|
|
@@ -221,6 +228,8 @@ export async function serveNativeHost({
|
|
|
221
228
|
}
|
|
222
229
|
}
|
|
223
230
|
closed = true;
|
|
231
|
+
// The browser went: no page is the one the person is on any more.
|
|
232
|
+
await daemon({ command: "browser.page.set", page: null }).catch(() => null);
|
|
224
233
|
}
|
|
225
234
|
|
|
226
235
|
export function writeMessage(output, message) {
|