tryharness 0.7.78 → 0.7.82
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 +21 -1
- package/lib/browserPage.mjs +30 -0
- package/lib/coordinator.mjs +0 -2
- package/lib/daemon.mjs +117 -7
- package/lib/desktop.mjs +7 -1
- package/lib/dispatcher.mjs +12 -2
- package/lib/environments.mjs +4 -11
- package/lib/goalCommands.mjs +18 -8
- package/lib/hookDialects.mjs +2 -1
- package/lib/jobAnswers.mjs +2 -1
- package/lib/kanban.mjs +217 -48
- package/lib/localStack.mjs +24 -9
- package/lib/machineRoutes.mjs +9 -0
- package/lib/machineRuns.mjs +9 -1
- package/lib/manager.mjs +60 -2
- package/lib/mcp-stdio.mjs +9 -3
- package/lib/museSession.mjs +2 -1
- package/lib/nativeHost.mjs +11 -2
- package/lib/network.mjs +20 -0
- package/lib/notify.mjs +48 -16
- package/lib/onboard.mjs +71 -366
- package/lib/ownMachines.mjs +95 -44
- package/lib/pairing.mjs +0 -84
- package/lib/paths.mjs +17 -0
- package/lib/peopleBoard.mjs +131 -0
- package/lib/personNotices.mjs +9 -25
- package/lib/phones.mjs +1 -0
- package/lib/profile.mjs +0 -109
- package/lib/projectBoard.mjs +219 -0
- package/lib/projectPieces.mjs +26 -0
- package/lib/projects.mjs +37 -4
- package/lib/removeHarness.mjs +91 -0
- package/lib/roomChannels.mjs +2 -0
- package/lib/runAuthority.mjs +23 -9
- package/lib/runBrief.mjs +20 -14
- 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/store.mjs +6 -3
- package/lib/swarm.mjs +181 -61
- package/lib/t3.mjs +23 -14
- package/lib/taskCommands.mjs +25 -15
- package/lib/taskRooms.mjs +2 -4
- package/lib/threadActions.mjs +16 -4
- package/lib/threadAuthority.mjs +28 -10
- package/lib/threadRuns.mjs +162 -74
- 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 +64 -55
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
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"board.relay.decide": "relay",
|
|
97
97
|
"board.relay.defaults": "relay",
|
|
98
98
|
"board.relay.list": "relay",
|
|
99
|
+
"board.relay.board": "relay",
|
|
99
100
|
"board.relay.network": "relay",
|
|
100
101
|
"board.relay.peers": "relay",
|
|
101
102
|
"board.relay.request": "relay",
|
|
@@ -362,6 +363,7 @@
|
|
|
362
363
|
"board.template.save",
|
|
363
364
|
"board.template.use",
|
|
364
365
|
"board.relay.list",
|
|
366
|
+
"board.relay.board",
|
|
365
367
|
"board.relay.network",
|
|
366
368
|
"board.relay.decide",
|
|
367
369
|
"board.relay.request",
|
|
@@ -446,6 +448,7 @@
|
|
|
446
448
|
"board.standing.check",
|
|
447
449
|
"board.standing.off",
|
|
448
450
|
"board.relay.list",
|
|
451
|
+
"board.relay.board",
|
|
449
452
|
"board.relay.network",
|
|
450
453
|
"board.relay.decide",
|
|
451
454
|
"board.relay.request",
|
|
@@ -678,6 +681,7 @@
|
|
|
678
681
|
"board.file.get",
|
|
679
682
|
"board.file.share",
|
|
680
683
|
"board.relay.list",
|
|
684
|
+
"board.relay.board",
|
|
681
685
|
"board.relay.network",
|
|
682
686
|
"board.relay.decide",
|
|
683
687
|
"board.relay.request",
|
|
@@ -707,6 +711,21 @@
|
|
|
707
711
|
"swarm.lineup",
|
|
708
712
|
"swarm.add",
|
|
709
713
|
"swarm.remove",
|
|
714
|
+
"setup.signin",
|
|
715
|
+
"setup.cancel",
|
|
716
|
+
"setup.bankr",
|
|
717
|
+
"setup.state",
|
|
718
|
+
"setup.finish",
|
|
719
|
+
"setup.notify",
|
|
720
|
+
"setup.apps",
|
|
721
|
+
"setup.workplace",
|
|
722
|
+
"setup.folders",
|
|
723
|
+
"setup.folder",
|
|
724
|
+
"setup.findFolders",
|
|
725
|
+
"setup.toolCheck",
|
|
726
|
+
"setup.fix",
|
|
727
|
+
"swarm.check",
|
|
728
|
+
"wake.server",
|
|
710
729
|
"phone.list",
|
|
711
730
|
"phone.link.answer",
|
|
712
731
|
"phone.revoke",
|
|
@@ -774,7 +793,8 @@
|
|
|
774
793
|
"board.wait",
|
|
775
794
|
"board.landed.thread",
|
|
776
795
|
"board.landed.folder",
|
|
777
|
-
"board.landed.open"
|
|
796
|
+
"board.landed.open",
|
|
797
|
+
"browser.page"
|
|
778
798
|
],
|
|
779
799
|
"plainPerson": ["board.standing.off"],
|
|
780
800
|
"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/coordinator.mjs
CHANGED
|
@@ -1819,8 +1819,6 @@ export function createCoordinator({
|
|
|
1819
1819
|
store.threadRuns(goalId).some(going) ||
|
|
1820
1820
|
hostedAtWork(goalId).length > 0 ||
|
|
1821
1821
|
busyInT3(thread).length > 0;
|
|
1822
|
-
// A thread started through Harness by an agent that runs elsewhere gets no rounds until the person sets a spend ceiling.
|
|
1823
|
-
if (store.meta(`hosted-thread:${goalId}`)) return;
|
|
1824
1822
|
const local = mode() === "local";
|
|
1825
1823
|
const seenUpTo = () =>
|
|
1826
1824
|
store.roomPosts(goalId, 0, 500).at(-1)?.seq ?? state.lastSeenSeq;
|
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
|
});
|
|
@@ -816,6 +839,8 @@ export async function startDaemon() {
|
|
|
816
839
|
store,
|
|
817
840
|
log,
|
|
818
841
|
onChange: (threadId) => notifyBoard(store.getTask(threadId)),
|
|
842
|
+
// A shared project's room keeps its board in the project's record, the same on every computer in it.
|
|
843
|
+
shared: (threadId) => projects?.boardOf(threadId) ?? null,
|
|
819
844
|
});
|
|
820
845
|
const notifyBoard = (task) => {
|
|
821
846
|
if (!task) return;
|
|
@@ -1050,6 +1075,7 @@ export async function startDaemon() {
|
|
|
1050
1075
|
});
|
|
1051
1076
|
// What this computer hands the person's Harness page through the extension (browserWake.mjs): Harness's tasks they
|
|
1052
1077
|
// let it finish in their browser, sent again when a browser starts listening after this daemon restarted.
|
|
1078
|
+
const browserPage = createBrowserPage();
|
|
1053
1079
|
const browserWake = createBrowserWake({
|
|
1054
1080
|
log,
|
|
1055
1081
|
pending: () =>
|
|
@@ -1335,6 +1361,8 @@ export async function startDaemon() {
|
|
|
1335
1361
|
dispatcher,
|
|
1336
1362
|
goals,
|
|
1337
1363
|
settled: (threadId) => coordinator.resumed(threadId),
|
|
1364
|
+
computerAddress: actions.computerAddress,
|
|
1365
|
+
agentsIn: (text) => mentionsIn(text, ROOM_AGENTS),
|
|
1338
1366
|
handOn: handOnAgent,
|
|
1339
1367
|
post: (entry) => {
|
|
1340
1368
|
const posted = store.roomPost(entry);
|
|
@@ -1449,6 +1477,7 @@ export async function startDaemon() {
|
|
|
1449
1477
|
void memory.heard(thread, post);
|
|
1450
1478
|
};
|
|
1451
1479
|
const goalCommand = createGoalCommands({
|
|
1480
|
+
boardView: (threadId) => kanban.view(threadId),
|
|
1452
1481
|
heardRelayed: (thread, post) => void manager.heard(thread, post),
|
|
1453
1482
|
computerOf,
|
|
1454
1483
|
teams,
|
|
@@ -1991,6 +2020,7 @@ export async function startDaemon() {
|
|
|
1991
2020
|
goalCommand,
|
|
1992
2021
|
stopThreadRuns,
|
|
1993
2022
|
steered: (goalId, agent) => threadRuns.steered(goalId, agent),
|
|
2023
|
+
computerOfRun: (run) => threadRuns.computerOfRun(run),
|
|
1994
2024
|
runningPids,
|
|
1995
2025
|
provenanceFor,
|
|
1996
2026
|
runLog: (runId) => taskFiles(runId).log,
|
|
@@ -2012,6 +2042,17 @@ export async function startDaemon() {
|
|
|
2012
2042
|
available().map((id) => ({ id, about: aboutOf(id), setup: setupOf(id) })),
|
|
2013
2043
|
worktrees,
|
|
2014
2044
|
folders,
|
|
2045
|
+
// The person's other computers, read when a composer or thread names one: ownMachines is made after this.
|
|
2046
|
+
computers: {
|
|
2047
|
+
self: () => ownMachines?.self() ?? machine.id,
|
|
2048
|
+
labelOf: (id) => ownMachines?.labelOf(id) ?? null,
|
|
2049
|
+
foldersOn: (id, question) =>
|
|
2050
|
+
ownMachines?.foldersOn(id, question) ?? {
|
|
2051
|
+
ok: false,
|
|
2052
|
+
error: "your other computers are not reachable",
|
|
2053
|
+
},
|
|
2054
|
+
checkoutOn: (id, folder) => ownMachines?.checkoutOn(id, folder) ?? null,
|
|
2055
|
+
},
|
|
2015
2056
|
runsIn: threadRuns.where,
|
|
2016
2057
|
authorizeRun: (id) =>
|
|
2017
2058
|
boardCommand({ command: "board.run", agent: "user", id }),
|
|
@@ -2158,9 +2199,9 @@ export async function startDaemon() {
|
|
|
2158
2199
|
store,
|
|
2159
2200
|
validAgent,
|
|
2160
2201
|
touchListener,
|
|
2161
|
-
// A task posted
|
|
2202
|
+
// A task posted into a thread is on its board once it exists: on the card it was posted for, or its own (kanban.mjs).
|
|
2162
2203
|
answered: (request, answer) =>
|
|
2163
|
-
request.command === "board.post" && request.
|
|
2204
|
+
request.command === "board.post" && request.parentId && answer?.ok
|
|
2164
2205
|
? kanban.posted(request, answer)
|
|
2165
2206
|
: answer,
|
|
2166
2207
|
machineOf: (request) => request[FROM_MACHINE] ?? machine.id,
|
|
@@ -2712,6 +2753,15 @@ export async function startDaemon() {
|
|
|
2712
2753
|
ownModels,
|
|
2713
2754
|
ownLive,
|
|
2714
2755
|
answerCapability: capabilityCheck.answer,
|
|
2756
|
+
// A composer on home whose message names this computer lists this computer's folders (swarm.mjs board.swarm.places).
|
|
2757
|
+
ownFolders: async (question) =>
|
|
2758
|
+
question.browse !== undefined
|
|
2759
|
+
? folders.browse(question.browse)
|
|
2760
|
+
: {
|
|
2761
|
+
ok: true,
|
|
2762
|
+
places: folders.known({ own: true }),
|
|
2763
|
+
home: os.homedir(),
|
|
2764
|
+
},
|
|
2715
2765
|
answerLink: proxyLinks
|
|
2716
2766
|
? (from, call) => proxyLinks.answer(from, call)
|
|
2717
2767
|
: null,
|
|
@@ -2928,7 +2978,29 @@ export async function startDaemon() {
|
|
|
2928
2978
|
};
|
|
2929
2979
|
// What the control socket answers that no module answers itself, by command.
|
|
2930
2980
|
const controlCommands = {
|
|
2931
|
-
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
|
+
},
|
|
2932
3004
|
doctor: () => ({
|
|
2933
3005
|
ok: true,
|
|
2934
3006
|
status: state,
|
|
@@ -3065,6 +3137,9 @@ export async function startDaemon() {
|
|
|
3065
3137
|
browserWake
|
|
3066
3138
|
.next(request.waitMs)
|
|
3067
3139
|
.then((messages) => ({ ok: true, messages })),
|
|
3140
|
+
// Which page the person is on, from the extension's native host, for the buddy's chip (browserPage.mjs).
|
|
3141
|
+
"browser.page.set": (request) => browserPage.set(request),
|
|
3142
|
+
"browser.page": (request) => browserPage.read(request),
|
|
3068
3143
|
// A Harness page's ask for a link offer, from the extension's native host: it waits for the person's answer here.
|
|
3069
3144
|
"phone.link.ask": (request) =>
|
|
3070
3145
|
phones.linkAsk.request({
|
|
@@ -3102,6 +3177,9 @@ export async function startDaemon() {
|
|
|
3102
3177
|
},
|
|
3103
3178
|
// How Harness wakes the agents it keeps on the server (Grok Bot): read and saved there, never here.
|
|
3104
3179
|
"wake.server": (request) => askHarness("wake", request.input || {}),
|
|
3180
|
+
// Bankr in setup: status, Connect (makes the person's Harness wallet) and Link (a code for their Bankr agent).
|
|
3181
|
+
"setup.bankr": (request) =>
|
|
3182
|
+
askHarness("bankr_setup", { action: String(request.action || "") }),
|
|
3105
3183
|
// Whether agent work is going on here, for the desktop app deciding when the Mac may sleep.
|
|
3106
3184
|
activity: () =>
|
|
3107
3185
|
machineActivity({
|
|
@@ -3207,6 +3285,14 @@ export async function startDaemon() {
|
|
|
3207
3285
|
};
|
|
3208
3286
|
const answerControl = (request) => {
|
|
3209
3287
|
const command = String(request.command || "");
|
|
3288
|
+
// An agent loading its Harness tools, or calling list_agents through them: what setup's tool check listens for
|
|
3289
|
+
// (toolCheck.mjs).
|
|
3290
|
+
if (
|
|
3291
|
+
(command === "agent.toolsListed" || command === "board.swarm.agents") &&
|
|
3292
|
+
request.agent
|
|
3293
|
+
)
|
|
3294
|
+
toolCallsHeard.set(String(request.agent), Date.now());
|
|
3295
|
+
if (command === "agent.toolsListed") return { ok: true };
|
|
3210
3296
|
if (command.startsWith("board.")) return answerBoard(request);
|
|
3211
3297
|
if (local.handles(command)) return local.command(request);
|
|
3212
3298
|
if (Object.hasOwn(controlCommands, command))
|
|
@@ -3217,8 +3303,32 @@ export async function startDaemon() {
|
|
|
3217
3303
|
}
|
|
3218
3304
|
// An agent's call to Harness from its MCP server on this computer, carried on the bridge (mcpRelay.mjs).
|
|
3219
3305
|
if (mcpRelay.handles(command)) return mcpRelay.run(request);
|
|
3306
|
+
if (setupChoices.handles(command)) return setupChoices.answer(request);
|
|
3220
3307
|
return { ok: false, error: "unknown command" };
|
|
3221
3308
|
};
|
|
3309
|
+
// Setup's check that Harness's tools load inside an agent, and its Fix: the agent's Harness entries written again
|
|
3310
|
+
// (lineup.mjs joinAgent, on Harness's own Node), then checked again.
|
|
3311
|
+
const toolCallsHeard = new Map();
|
|
3312
|
+
const heardSince = (agent, at) => (toolCallsHeard.get(agent) ?? 0) >= at;
|
|
3313
|
+
const toolCheck = (agent) =>
|
|
3314
|
+
checkTools(agent, { heardSince, deadlineMs: TOOL_CHECK_DEADLINE_MS });
|
|
3315
|
+
controlCommands["setup.toolCheck"] = (request) =>
|
|
3316
|
+
toolCheck(String(request.target || "")).then((result) => ({
|
|
3317
|
+
ok: true,
|
|
3318
|
+
agent: String(request.target || ""),
|
|
3319
|
+
...result,
|
|
3320
|
+
}));
|
|
3321
|
+
controlCommands["setup.fix"] = (request) => {
|
|
3322
|
+
const agent = String(request.target || "");
|
|
3323
|
+
const joined = lineupCommands.run({ command: "swarm.add", target: agent });
|
|
3324
|
+
if (!joined?.ok) return joined;
|
|
3325
|
+
return controlCommands["setup.toolCheck"](request);
|
|
3326
|
+
};
|
|
3327
|
+
// What the app's setup window and settings choose: where threads open, and which guarded folders search reads.
|
|
3328
|
+
const setupChoices = createSetupChoices({
|
|
3329
|
+
configPath: paths.config,
|
|
3330
|
+
knownFolders: () => folders.known().map((place) => place.path),
|
|
3331
|
+
});
|
|
3222
3332
|
const control = await listenControl({
|
|
3223
3333
|
socketPath: paths.socket,
|
|
3224
3334
|
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
|
@@ -8,7 +8,7 @@ import { provenanceFor } from "./provenance.mjs";
|
|
|
8
8
|
import { DISPATCHER, TAGGED_ONLY, nameOf } from "./members.mjs";
|
|
9
9
|
import { picksIn } from "./models.mjs";
|
|
10
10
|
import { roomPage } from "./roomPage.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { fromCloud, withComputer } from "./machineRoutes.mjs";
|
|
12
12
|
import { callerLimit, HOSTED_CALLER } from "./runAuthority.mjs";
|
|
13
13
|
|
|
14
14
|
export function createGoalCommands({
|
|
@@ -23,6 +23,8 @@ export function createGoalCommands({
|
|
|
23
23
|
flagNote,
|
|
24
24
|
// A post's words as an agent reads them (serverWords.mjs agentText); the person reads every post as written.
|
|
25
25
|
agentText = (post) => post.text,
|
|
26
|
+
// The thread's board as an agent reads it (kanban.mjs view): where the thread's work is managed.
|
|
27
|
+
boardView = () => null,
|
|
26
28
|
heardPerson,
|
|
27
29
|
heardRelayed = () => {},
|
|
28
30
|
inRoom,
|
|
@@ -181,7 +183,13 @@ export function createGoalCommands({
|
|
|
181
183
|
files,
|
|
182
184
|
};
|
|
183
185
|
const page = roomPage(store, goal.id, request);
|
|
184
|
-
return {
|
|
186
|
+
return {
|
|
187
|
+
...view,
|
|
188
|
+
board: boardView(goal.id),
|
|
189
|
+
...page,
|
|
190
|
+
posts: page.posts.map(readable),
|
|
191
|
+
files,
|
|
192
|
+
};
|
|
185
193
|
}
|
|
186
194
|
if (request.command === "board.room.learn") {
|
|
187
195
|
if (!inRoom(goal, agent) || agent === "user")
|
|
@@ -258,7 +266,8 @@ export function createGoalCommands({
|
|
|
258
266
|
text,
|
|
259
267
|
});
|
|
260
268
|
notifyDesktop(
|
|
261
|
-
`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 }
|
|
262
271
|
);
|
|
263
272
|
return {
|
|
264
273
|
ok: true,
|
|
@@ -381,11 +390,12 @@ export function createGoalCommands({
|
|
|
381
390
|
return { ok: true, post, paused: true };
|
|
382
391
|
}
|
|
383
392
|
const told = wakeFor(goal.id, post, agent, wakes, {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
393
|
+
hosted: request.hostedCaller === true,
|
|
394
|
+
// An agent's words from another computer the person drives carry their go as from this one, its run's limits
|
|
395
|
+
// sealed with them (owner, November 2, in place of audit M1); from a cloud computer Harness runs, the guard
|
|
396
|
+
// reads them as words through Harness's server.
|
|
397
|
+
cloud:
|
|
398
|
+
fromCloud(store, request) && !["user", "harness"].includes(agent),
|
|
389
399
|
limited: callerLimit(request),
|
|
390
400
|
window: request.fromWindow === true,
|
|
391
401
|
target: request.targetMachine ?? null,
|
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({
|