tryharness 0.7.44 → 0.7.53
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 +232 -12
- package/cli.mjs +406 -184
- package/lib/actorRoster.mjs +28 -5
- package/lib/adapters.mjs +9 -1
- package/lib/agentRuntimeConfig.mjs +36 -0
- package/lib/agentRuntimes.mjs +560 -0
- package/lib/atlas.mjs +7 -2
- package/lib/boardCommands.mjs +5 -10
- package/lib/boardFileCommands.mjs +2 -1
- package/lib/boardMirror.mjs +459 -0
- package/lib/boardProtocol.json +259 -6
- package/lib/boardTools.mjs +2 -6
- package/lib/bridge.mjs +27 -3
- package/lib/browserWake.mjs +60 -0
- package/lib/cards.mjs +35 -2
- package/lib/commands.mjs +20 -5
- package/lib/connectionTools.d.ts +13 -0
- package/lib/connectionTools.js +45 -0
- package/lib/connectorAuth.mjs +309 -0
- package/lib/connectorCatalog.json +41 -0
- package/lib/connectorCommands.mjs +121 -0
- package/lib/connectorGoogle.mjs +513 -0
- package/lib/connectors.mjs +805 -0
- package/lib/coordinator.mjs +16 -2
- package/lib/coreModels.mjs +78 -0
- package/lib/daemon.mjs +775 -46
- package/lib/desktop.mjs +7 -2
- package/lib/digest.mjs +32 -0
- package/lib/directLink.mjs +283 -0
- package/lib/environments.mjs +595 -0
- package/lib/folders.mjs +2 -2
- package/lib/goalCommands.mjs +61 -12
- package/lib/inference.mjs +263 -152
- package/lib/lessons.mjs +6 -0
- package/lib/lineup.mjs +324 -0
- package/lib/localmodels.mjs +10 -0
- package/lib/machineIdentity.mjs +3 -0
- package/lib/machineRoutes.mjs +40 -2
- package/lib/machineRuns.mjs +30 -3
- package/lib/machineSeal.mjs +69 -10
- package/lib/mcp-stdio.mjs +180 -98
- package/lib/mcpRelay.mjs +119 -0
- package/lib/members.json +12 -0
- package/lib/members.mjs +33 -0
- package/lib/modelMemory.mjs +100 -0
- package/lib/modelTiers.json +1183 -0
- package/lib/modelTiers.mjs +133 -0
- package/lib/models.mjs +41 -8
- package/lib/museSession.mjs +119 -0
- package/lib/nativeHost.mjs +203 -0
- package/lib/network.mjs +38 -1
- package/lib/nudge.mjs +10 -2
- package/lib/onboard.mjs +430 -1
- package/lib/oneclawLocal.mjs +150 -0
- package/lib/ownMachines.mjs +521 -36
- package/lib/pairing.mjs +165 -0
- package/lib/paths.mjs +4 -0
- package/lib/phones.mjs +61 -0
- package/lib/placeCommands.mjs +27 -0
- package/lib/places.mjs +10 -2
- package/lib/plans.mjs +151 -27
- package/lib/profile.mjs +152 -0
- package/lib/projectGit.mjs +328 -0
- package/lib/projectSettings.mjs +120 -0
- package/lib/projects.mjs +2539 -0
- package/lib/readiness.mjs +283 -0
- package/lib/repoLinks.mjs +354 -0
- package/lib/roomChannels.mjs +641 -0
- package/lib/runBrief.mjs +32 -2
- package/lib/runRequests.mjs +157 -0
- package/lib/runWorker.mjs +20 -7
- package/lib/runner.mjs +67 -8
- package/lib/secretPatterns.json +55 -0
- package/lib/secrets.mjs +10 -27
- package/lib/seen.mjs +102 -0
- package/lib/service.mjs +11 -6
- package/lib/sessionControl.mjs +10 -8
- package/lib/sessionIndex.mjs +5 -3
- package/lib/store.mjs +559 -30
- package/lib/subagents.mjs +8 -4
- package/lib/swarm.mjs +379 -38
- package/lib/swarmMemory.mjs +947 -0
- package/lib/t3.mjs +43 -13
- package/lib/taskCommands.mjs +58 -5
- package/lib/taskRuns.mjs +61 -11
- package/lib/team.json +17 -15
- package/lib/team.mjs +68 -18
- package/lib/threadRuns.mjs +50 -7
- package/lib/threadView.mjs +68 -15
- package/lib/tokenizer.mjs +405 -0
- package/lib/ui.mjs +16 -2
- package/lib/usageTotals.mjs +148 -0
- package/lib/vault.mjs +1144 -0
- package/lib/vaultCloud.mjs +117 -0
- package/lib/vaultCommands.mjs +201 -0
- package/lib/vaultTools.d.ts +12 -0
- package/lib/vaultTools.js +42 -0
- package/lib/windowAsks.mjs +42 -0
- package/lib/workFocus.mjs +59 -0
- package/lib/workLinks.mjs +90 -0
- package/package.json +9 -4
package/cli.mjs
CHANGED
|
@@ -12,7 +12,21 @@ import {
|
|
|
12
12
|
mcpClientSnippet,
|
|
13
13
|
removeAgentConfigurations,
|
|
14
14
|
} from "./lib/adapters.mjs";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
addAgents,
|
|
17
|
+
banner,
|
|
18
|
+
checkAgents,
|
|
19
|
+
removeAgent,
|
|
20
|
+
showLineup,
|
|
21
|
+
setupChosen,
|
|
22
|
+
setupT3,
|
|
23
|
+
setupSwarm,
|
|
24
|
+
testAgent,
|
|
25
|
+
walkThrough,
|
|
26
|
+
} from "./lib/onboard.mjs";
|
|
27
|
+
import { agentsHere, createLineup, lineupOf } from "./lib/lineup.mjs";
|
|
28
|
+
import { CHECKABLE, createAgentReadiness } from "./lib/readiness.mjs";
|
|
29
|
+
import { writeBrowserOffer } from "./lib/phones.mjs";
|
|
16
30
|
import { createUi } from "./lib/ui.mjs";
|
|
17
31
|
import pc from "picocolors";
|
|
18
32
|
import { removeLocalWakes } from "./lib/wakes.mjs";
|
|
@@ -20,13 +34,17 @@ import { detectAgents } from "./lib/commands.mjs";
|
|
|
20
34
|
import { daemonRequest } from "./lib/control-client.mjs";
|
|
21
35
|
import { ensureDir, readJson, writeJsonAtomic } from "./lib/files.mjs";
|
|
22
36
|
import { paths } from "./lib/paths.mjs";
|
|
23
|
-
import { currentRuntime, installRuntime } from "./lib/runtime-install.mjs";
|
|
24
37
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
} from "./lib/
|
|
38
|
+
joinSwarm,
|
|
39
|
+
keepJoinCode,
|
|
40
|
+
startPairing,
|
|
41
|
+
waitForApproval,
|
|
42
|
+
} from "./lib/pairing.mjs";
|
|
43
|
+
import { setupProfile } from "./lib/profile.mjs";
|
|
44
|
+
import { currentRuntime, installRuntime } from "./lib/runtime-install.mjs";
|
|
45
|
+
import { installNativeHost, removeNativeHost } from "./lib/nativeHost.mjs";
|
|
46
|
+
import { CORE, coreSizeMb } from "./lib/coreModels.mjs";
|
|
47
|
+
import { MODELS, modelsPresent } from "./lib/localmodels.mjs";
|
|
30
48
|
import {
|
|
31
49
|
installService,
|
|
32
50
|
launcherMissing,
|
|
@@ -122,67 +140,50 @@ async function validateConnection(config) {
|
|
|
122
140
|
}
|
|
123
141
|
}
|
|
124
142
|
|
|
143
|
+
// Whether a browser can open here: not over SSH, and on Linux only with a display.
|
|
144
|
+
const canOpenBrowser = () =>
|
|
145
|
+
!process.env.SSH_CONNECTION &&
|
|
146
|
+
!process.env.SSH_TTY &&
|
|
147
|
+
(process.platform !== "linux" ||
|
|
148
|
+
Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY));
|
|
149
|
+
|
|
150
|
+
// One page in the browser approves this computer and links that browser to it in the same click: the address fragment,
|
|
151
|
+
// which no server sees, carries the pairing code and a browser link setup made for the daemon (phones.mjs).
|
|
125
152
|
async function pair(pairOrigin, agents, ui) {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
153
|
+
const { pairId, code, own } = await startPairing(pairOrigin, agents);
|
|
154
|
+
if (own) keepJoinCode(paths.machine, code);
|
|
155
|
+
const page = `${pairOrigin}/pair`;
|
|
156
|
+
const browser = own && canOpenBrowser();
|
|
157
|
+
const link = browser
|
|
158
|
+
? await writeBrowserOffer({
|
|
159
|
+
identityFile: paths.phoneIdentity,
|
|
160
|
+
offerFile: paths.browserOffer,
|
|
161
|
+
})
|
|
162
|
+
: null;
|
|
163
|
+
const opened =
|
|
164
|
+
browser && openUrl(`${page}#${new URLSearchParams({ c: code })}&${link}`);
|
|
165
|
+
const approve = opened
|
|
166
|
+
? "Your browser just opened. Sign in with your email if it asks, then press Connect. No account yet? Signing in makes one."
|
|
167
|
+
: `Open ${page} in a browser, sign in with your email, and enter this code. No account yet? Signing in makes one.`;
|
|
168
|
+
const elsewhere = own
|
|
169
|
+
? "\nAlready use Harness on another computer? Click the Harness icon in its menu bar, choose Add a Computer, and type this code there instead."
|
|
170
|
+
: "";
|
|
135
171
|
ui.note(
|
|
136
|
-
`${pc.bold(code)}\n\n${pc.dim(
|
|
137
|
-
"
|
|
172
|
+
`${pc.bold(code)}\n\n${pc.dim(approve + elsewhere)}`,
|
|
173
|
+
"Sign in to Harness"
|
|
138
174
|
);
|
|
139
175
|
const spin = ui.spinner();
|
|
140
|
-
spin.start(
|
|
141
|
-
|
|
142
|
-
fetch(pairOrigin + "/api/pair/wait/" + pairId, {
|
|
143
|
-
headers: { accept: "text/event-stream" },
|
|
144
|
-
})
|
|
145
|
-
.then(async (waitResponse) => {
|
|
146
|
-
if (!waitResponse.ok || !waitResponse.body)
|
|
147
|
-
throw new Error("pairing stream failed");
|
|
148
|
-
const reader = waitResponse.body.getReader();
|
|
149
|
-
const decoder = new TextDecoder();
|
|
150
|
-
let buffer = "";
|
|
151
|
-
for (;;) {
|
|
152
|
-
const { done, value } = await reader.read();
|
|
153
|
-
if (done) break;
|
|
154
|
-
buffer += decoder.decode(value, { stream: true });
|
|
155
|
-
const frames = buffer.split("\n\n");
|
|
156
|
-
buffer = frames.pop() || "";
|
|
157
|
-
for (const frame of frames) {
|
|
158
|
-
const line = frame
|
|
159
|
-
.split("\n")
|
|
160
|
-
.find((entry) => entry.startsWith("data: "));
|
|
161
|
-
if (!line) continue;
|
|
162
|
-
const payload = JSON.parse(line.slice(6));
|
|
163
|
-
if (payload.token) {
|
|
164
|
-
resolve(payload.token);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
if (payload.error) {
|
|
168
|
-
reject(new Error(payload.error));
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
reject(new Error("pairing stream ended without approval"));
|
|
174
|
-
})
|
|
175
|
-
.catch(reject);
|
|
176
|
-
}).then(
|
|
177
|
-
(token) => {
|
|
178
|
-
spin.stop("Paired with Harness");
|
|
179
|
-
return token;
|
|
180
|
-
},
|
|
181
|
-
(error) => {
|
|
182
|
-
spin.stop("Pairing did not finish", 2);
|
|
183
|
-
throw error;
|
|
184
|
-
}
|
|
176
|
+
spin.start(
|
|
177
|
+
"Waiting for you to press Connect (the code works for 10 minutes)"
|
|
185
178
|
);
|
|
179
|
+
try {
|
|
180
|
+
const token = await waitForApproval(pairOrigin, pairId);
|
|
181
|
+
spin.stop("Connected to your Harness account");
|
|
182
|
+
return { token, code: own ? code : null, linkOffered: Boolean(link) };
|
|
183
|
+
} catch (error) {
|
|
184
|
+
spin.stop("Pairing did not finish", 2);
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
async function waitForDaemon(timeoutMs = 12_000) {
|
|
@@ -207,28 +208,36 @@ async function waitForDaemon(timeoutMs = 12_000) {
|
|
|
207
208
|
|
|
208
209
|
async function connect() {
|
|
209
210
|
ensureDir(paths.home);
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
.map((entry) => entry.agent);
|
|
211
|
+
// The agents installed here (lineup.mjs). Each coding agent gets its one-line prompt now (readiness.mjs), so the
|
|
212
|
+
// answers come in while the person signs in.
|
|
213
|
+
const here = agentsHere();
|
|
214
214
|
const requested = argv.flatMap((value, index) =>
|
|
215
215
|
value === "--agent" && argv[index + 1] ? [argv[index + 1]] : []
|
|
216
216
|
);
|
|
217
217
|
for (const agent of requested)
|
|
218
|
-
if (!AGENTS.includes(agent))
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
if (![...AGENTS, "openclaw", "hermes"].includes(agent))
|
|
219
|
+
throw new Error(`unknown agent '${agent}'`);
|
|
220
|
+
const removed = readJson(paths.config, {}).swarmRemoved ?? [];
|
|
221
|
+
const readiness = createAgentReadiness();
|
|
222
|
+
const checks = new Map(
|
|
223
|
+
here
|
|
224
|
+
.filter(
|
|
225
|
+
(entry) =>
|
|
226
|
+
CHECKABLE.includes(entry.id) &&
|
|
227
|
+
(requested.length
|
|
228
|
+
? requested.includes(entry.id)
|
|
229
|
+
: !removed.includes(entry.id))
|
|
230
|
+
)
|
|
231
|
+
.map((entry) => [entry.id, readiness.check(entry.id)])
|
|
232
|
+
);
|
|
233
|
+
const found = here
|
|
234
|
+
.filter((entry) => AGENTS.includes(entry.id))
|
|
235
|
+
.map((entry) => entry.id);
|
|
222
236
|
const ui = createUi();
|
|
223
237
|
console.log(`\n${banner(VERSION)}\n`);
|
|
224
238
|
ui.intro(
|
|
225
239
|
`${pc.bgCyan(pc.black(" tryharness "))} Setting up Harness on this computer`
|
|
226
240
|
);
|
|
227
|
-
ui.step(
|
|
228
|
-
installed.length
|
|
229
|
-
? `Found ${installed.join(", ")}`
|
|
230
|
-
: "No supported coding agents found"
|
|
231
|
-
);
|
|
232
241
|
|
|
233
242
|
const pairOrigin = origin();
|
|
234
243
|
let config = readJson(paths.config, {});
|
|
@@ -240,20 +249,44 @@ async function connect() {
|
|
|
240
249
|
ui.success(
|
|
241
250
|
`Connected to Harness ${pc.dim(`· ${new URL(pairOrigin).host}`)}`
|
|
242
251
|
);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
252
|
+
let setupCode = null;
|
|
253
|
+
let linkOffered = false;
|
|
254
|
+
if (!reusable) {
|
|
255
|
+
const paired = await pair(pairOrigin, found, ui);
|
|
256
|
+
setupCode = paired.code;
|
|
257
|
+
linkOffered = paired.linkOffered;
|
|
258
|
+
config = { ...config, origin: pairOrigin, token: paired.token };
|
|
246
259
|
writeJsonAtomic(paths.config, config);
|
|
247
260
|
}
|
|
248
261
|
|
|
262
|
+
// The order is the person's: Harness starts with the agents that answered, so the browser they pressed Connect in
|
|
263
|
+
// links and lists them at once, and only then are they walked through the rest, which join as each answers.
|
|
264
|
+
const before = readJson(paths.config, {});
|
|
265
|
+
const previous = lineupOf(before);
|
|
266
|
+
const { ready, waiting } = await checkAgents({
|
|
267
|
+
ui,
|
|
268
|
+
here,
|
|
269
|
+
checks,
|
|
270
|
+
readiness,
|
|
271
|
+
requested,
|
|
272
|
+
removed,
|
|
273
|
+
});
|
|
274
|
+
// Agents that live elsewhere stay as they were: in a swarm from before the lineup, all of them (they were in it).
|
|
275
|
+
const kept = previous
|
|
276
|
+
? previous.filter((agent) => !here.some((entry) => entry.id === agent))
|
|
277
|
+
: before.agentStates
|
|
278
|
+
? ["grok-bot", "bankr", "quotient", "muse"]
|
|
279
|
+
: [];
|
|
280
|
+
|
|
249
281
|
// The persistent runtime is version-pinned; neither MCP clients nor the login service
|
|
250
282
|
// point into npm's temporary npx cache.
|
|
251
283
|
const spin = ui.spinner();
|
|
252
|
-
spin.start("
|
|
284
|
+
spin.start("Starting Harness on this computer");
|
|
253
285
|
const runtimeRoot = installRuntime({
|
|
254
286
|
sourceRoot: SOURCE_ROOT,
|
|
255
287
|
version: VERSION,
|
|
256
288
|
});
|
|
289
|
+
const selected = ready.filter((agent) => AGENTS.includes(agent));
|
|
257
290
|
const states = configureAgents({ runtimeRoot, selected });
|
|
258
291
|
const stateMap = Object.fromEntries(
|
|
259
292
|
states.map((state) => [state.agent, state])
|
|
@@ -263,43 +296,61 @@ async function connect() {
|
|
|
263
296
|
version: VERSION,
|
|
264
297
|
runtimeRoot,
|
|
265
298
|
agentStates: stateMap,
|
|
299
|
+
swarmAgents: [...new Set([...ready, ...kept])],
|
|
300
|
+
// The daemon downloads the relay's core local models in the background (coreModels.mjs).
|
|
301
|
+
localModels: "download",
|
|
266
302
|
};
|
|
267
303
|
writeJsonAtomic(paths.config, config);
|
|
268
304
|
const service = installService({ runtimeRoot });
|
|
269
|
-
|
|
305
|
+
// The Harness extension in this computer's browsers finds this daemon by itself, so its window links here.
|
|
306
|
+
try {
|
|
307
|
+
installNativeHost({ runtimeRoot });
|
|
308
|
+
} catch (error) {
|
|
309
|
+
ui.warn(
|
|
310
|
+
`The extension cannot find this computer by itself (${error.message}); link the browser with npx tryharness link`
|
|
311
|
+
);
|
|
312
|
+
}
|
|
270
313
|
try {
|
|
271
314
|
await waitForDaemon();
|
|
272
315
|
} catch (error) {
|
|
273
|
-
spin.stop("
|
|
316
|
+
spin.stop("Harness did not connect", 2);
|
|
274
317
|
throw error;
|
|
275
318
|
}
|
|
276
319
|
spin.stop(
|
|
277
|
-
`
|
|
320
|
+
`Harness is running on this computer ${pc.dim(`· ${service.manager}`)}`
|
|
278
321
|
);
|
|
279
|
-
await
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
)
|
|
299
|
-
|
|
322
|
+
await joinSwarm({ ui, code: setupCode, daemonRequest });
|
|
323
|
+
// Harness already runs, so the browser lists the agents while the person tells them who they work for.
|
|
324
|
+
await setupProfile({ ui, origin: pairOrigin, token: config.token });
|
|
325
|
+
const joined = await walkThrough({
|
|
326
|
+
ui,
|
|
327
|
+
waiting,
|
|
328
|
+
readiness,
|
|
329
|
+
join: (agent) =>
|
|
330
|
+
daemonRequest({ command: "swarm.add", target: agent }).catch((error) => ({
|
|
331
|
+
ok: false,
|
|
332
|
+
error: error.message,
|
|
333
|
+
})),
|
|
334
|
+
});
|
|
335
|
+
const chosen = [...ready, ...joined];
|
|
336
|
+
// An agent that joined during the walkthrough was connected by the daemon (lineup.mjs joinAgent), which saved its state.
|
|
337
|
+
const saved = readJson(paths.config, {}).agentStates ?? {};
|
|
338
|
+
await setupChosen({
|
|
339
|
+
chosen,
|
|
340
|
+
here,
|
|
341
|
+
states: states.map((state) => saved[state.agent] ?? state),
|
|
342
|
+
runtimeRoot,
|
|
343
|
+
daemonRequest,
|
|
344
|
+
ui,
|
|
345
|
+
});
|
|
346
|
+
await setupT3({
|
|
347
|
+
ui,
|
|
348
|
+
daemonRequest,
|
|
349
|
+
open: (url) => !has("--print") && canOpenBrowser() && openUrl(url),
|
|
350
|
+
});
|
|
300
351
|
if (!has("--no-desktop")) {
|
|
301
352
|
const spin = ui.spinner();
|
|
302
|
-
spin.start("Getting the
|
|
353
|
+
spin.start("Getting the Harness desktop app");
|
|
303
354
|
const shown = await desktop();
|
|
304
355
|
spin.stop(shown.text, shown.ok ? 0 : 2);
|
|
305
356
|
// The app brings the daemon's launcher: the daemon starts through it from now on (service.mjs).
|
|
@@ -308,56 +359,6 @@ async function connect() {
|
|
|
308
359
|
await waitForDaemon().catch(() => {});
|
|
309
360
|
}
|
|
310
361
|
}
|
|
311
|
-
// The relay's core local models (localmodels.mjs) and the server that runs them come down with setup, so agents get
|
|
312
|
-
// context packs, code search, the handoff firewall and images checked before they leave from the first task. Each file
|
|
313
|
-
// is checked against its pinned hash.
|
|
314
|
-
const core = MODELS.filter((entry) => entry.tier === "core").map(
|
|
315
|
-
(entry) => entry.id
|
|
316
|
-
);
|
|
317
|
-
const localRoot = path.join(paths.home, "local");
|
|
318
|
-
if (modelsPresent(localRoot, core)) ui.success("Local models ready");
|
|
319
|
-
else {
|
|
320
|
-
const download = ui.spinner();
|
|
321
|
-
const size = Math.round(
|
|
322
|
-
MODELS.filter((entry) => core.includes(entry.id))
|
|
323
|
-
.flatMap((entry) => entry.files)
|
|
324
|
-
.reduce((sum, file) => sum + file.size, 0) / 1e6
|
|
325
|
-
);
|
|
326
|
-
download.start(`Downloading the local models (about ${size} MB, once)`);
|
|
327
|
-
// The classifiers run without the model server, so one that cannot start here does not hold them back.
|
|
328
|
-
const failures = [];
|
|
329
|
-
for (const step of [
|
|
330
|
-
() =>
|
|
331
|
-
ensureLlama({
|
|
332
|
-
root: localRoot,
|
|
333
|
-
log: (line) =>
|
|
334
|
-
download.message(
|
|
335
|
-
`Downloading the local models · ${line.slice(0, 40)}`
|
|
336
|
-
),
|
|
337
|
-
}),
|
|
338
|
-
() =>
|
|
339
|
-
ensureModels({
|
|
340
|
-
root: localRoot,
|
|
341
|
-
ids: core,
|
|
342
|
-
log: (line) =>
|
|
343
|
-
download.message(
|
|
344
|
-
`Downloading the local models · ${line.slice(0, 40)}`
|
|
345
|
-
),
|
|
346
|
-
}),
|
|
347
|
-
]) {
|
|
348
|
-
try {
|
|
349
|
-
await step();
|
|
350
|
-
} catch (error) {
|
|
351
|
-
failures.push(error.message);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
if (failures.length)
|
|
355
|
-
download.stop(
|
|
356
|
-
`Local models not ready (${failures.join("; ")}). Agents work as before until the next setup run`,
|
|
357
|
-
2
|
|
358
|
-
);
|
|
359
|
-
else download.stop("Local models ready");
|
|
360
|
-
}
|
|
361
362
|
const failed = states.filter(
|
|
362
363
|
(state) =>
|
|
363
364
|
selected.includes(state.agent) && state.installed && !state.configured
|
|
@@ -367,15 +368,53 @@ async function connect() {
|
|
|
367
368
|
`setup is incomplete for ${failed.map((state) => state.agent).join(", ")}. Nothing was hidden; run npx tryharness doctor after fixing the reported CLI error, then rerun setup.`
|
|
368
369
|
);
|
|
369
370
|
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
);
|
|
375
|
-
|
|
376
|
-
|
|
371
|
+
// The browser you use Harness in on this computer links to this computer; on an added one it works the board home
|
|
372
|
+
// keeps through it, and the agents here can ask it what is on this screen. The page that approved this computer links
|
|
373
|
+
// its browser itself once Harness runs here (pair above), which has had the whole walkthrough to happen.
|
|
374
|
+
try {
|
|
375
|
+
const devices = await daemonRequest({ command: "phone.list" });
|
|
376
|
+
const linked =
|
|
377
|
+
devices.ok &&
|
|
378
|
+
devices.phones.some(
|
|
379
|
+
(device) => device.kind === "browser" && !device.revoked_at
|
|
380
|
+
);
|
|
381
|
+
if (linked) ui.success("Your browser is linked to this computer");
|
|
382
|
+
else if (linkOffered)
|
|
383
|
+
ui.success(
|
|
384
|
+
"Your browser links to this computer from the page you pressed Connect on"
|
|
385
|
+
);
|
|
386
|
+
else if (devices.ok) {
|
|
387
|
+
const offer = await browserLink();
|
|
388
|
+
ui.info(
|
|
389
|
+
offer.opened
|
|
390
|
+
? "Opened Harness in your browser to link it to this computer. The link works once, for 10 minutes."
|
|
391
|
+
: `To talk to this computer's agents from your browser, open this link in it. It works once, for 10 minutes; keep it to yourself:\n${offer.url}`
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
} catch (error) {
|
|
395
|
+
ui.warn(`Browser not linked (${error.message}). Run: npx tryharness link`);
|
|
396
|
+
}
|
|
397
|
+
const library = !readJson(paths.config, {}).libraryOff;
|
|
398
|
+
const modelsHere = modelsPresent(path.join(paths.home, "local"), CORE);
|
|
399
|
+
ui.note(
|
|
400
|
+
[
|
|
401
|
+
...(modelsHere
|
|
402
|
+
? []
|
|
403
|
+
: [
|
|
404
|
+
`Harness downloads its local models (about ${coreSizeMb()} MB) in the background. Your agents work while it does.`,
|
|
405
|
+
]),
|
|
406
|
+
...(library
|
|
407
|
+
? [
|
|
408
|
+
`Your agents here can search your Desktop, Documents and Downloads. That stays on this computer${process.platform === "darwin" ? ", and your Mac asks you once" : ""}. ${pc.dim("Change it: npx tryharness local off")}`,
|
|
409
|
+
]
|
|
410
|
+
: []),
|
|
411
|
+
`Your coding agents start the tasks you ask for in folders they have worked in, up to 10 a day each. Tasks another agent wrote wait for your Start. ${pc.dim("Change it: npx tryharness board standing")}`,
|
|
412
|
+
].join("\n\n"),
|
|
413
|
+
"Good to know"
|
|
414
|
+
);
|
|
415
|
+
ui.outro(
|
|
416
|
+
`Done. Talk to your agents from Harness in your browser: ${pairOrigin}/dashboard`
|
|
377
417
|
);
|
|
378
|
-
ui.outro("Done. You can close this terminal.");
|
|
379
418
|
}
|
|
380
419
|
|
|
381
420
|
// The desktop app: the newest build for this machine, installed and opened. Never fatal; the
|
|
@@ -500,6 +539,12 @@ async function local() {
|
|
|
500
539
|
);
|
|
501
540
|
return;
|
|
502
541
|
}
|
|
542
|
+
if (current.coreModels?.downloading)
|
|
543
|
+
console.log("core models: downloading in the background");
|
|
544
|
+
else if (current.coreModels?.error)
|
|
545
|
+
console.log(
|
|
546
|
+
`core models: the last download failed (${current.coreModels.error}); tried again when the daemon next starts`
|
|
547
|
+
);
|
|
503
548
|
console.log(
|
|
504
549
|
`runs on: ${current.device ? (current.device.gpu ? "GPU" : "CPU") : "not checked yet"}`
|
|
505
550
|
);
|
|
@@ -636,6 +681,24 @@ async function notify() {
|
|
|
636
681
|
);
|
|
637
682
|
}
|
|
638
683
|
|
|
684
|
+
async function usageTotals() {
|
|
685
|
+
const mode = argv[0];
|
|
686
|
+
const config = readJson(paths.config, {});
|
|
687
|
+
if (!["on", "off"].includes(mode)) {
|
|
688
|
+
console.log(
|
|
689
|
+
`usage totals: ${config.usageTotals === false ? "off" : "on"} (tryharness usage-totals on|off)\n` +
|
|
690
|
+
"Once a day this computer tells Harness how much your swarm did the day before, as counts only: tasks posted, finished and failed, handoffs, threads, posts and coordinator rounds, by agent type. No task text, files, folders or computer details are sent, and Harness keeps the counts without your account."
|
|
691
|
+
);
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
writeJsonAtomic(paths.config, { ...config, usageTotals: mode === "on" });
|
|
695
|
+
console.log(
|
|
696
|
+
mode === "on"
|
|
697
|
+
? "usage totals on. Days from today are sent once they end."
|
|
698
|
+
: "usage totals off. Nothing more is sent, and days while it is off are never sent."
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
|
|
639
702
|
async function connectAgent() {
|
|
640
703
|
// Ask another person's listed agent to work an issue with one of ours: a request their Harness shows them.
|
|
641
704
|
const to = String(argv[0] || "");
|
|
@@ -679,15 +742,21 @@ async function connectAgent() {
|
|
|
679
742
|
// new one shows until the person types it on home.
|
|
680
743
|
async function machines() {
|
|
681
744
|
const sub = argv[0];
|
|
682
|
-
if (sub === "confirm") {
|
|
745
|
+
if (sub === "add" || sub === "confirm") {
|
|
683
746
|
const response = await daemonRequest(
|
|
684
|
-
{ command: "machines.
|
|
747
|
+
{ command: "machines.add", code: String(argv[1] || "") },
|
|
685
748
|
30_000
|
|
686
749
|
);
|
|
687
|
-
if (!response.ok) throw new Error(response.error || "not
|
|
688
|
-
console.log(
|
|
689
|
-
|
|
690
|
-
|
|
750
|
+
if (!response.ok) throw new Error(response.error || "not added");
|
|
751
|
+
if (response.state === "approved") console.log(response.note);
|
|
752
|
+
else if (response.state === "waiting")
|
|
753
|
+
console.log(
|
|
754
|
+
`${response.machine || "The computer"} is connected to your account. It joins your swarm by itself as soon as it is online; npx tryharness machines shows when it has.`
|
|
755
|
+
);
|
|
756
|
+
else
|
|
757
|
+
console.log(
|
|
758
|
+
`Added ${response.machine || "the computer"} (key ${response.fingerprint}). Its agents now work on this computer's board, sealed end to end between the two; Harness carries the calls and cannot read them.`
|
|
759
|
+
);
|
|
691
760
|
return;
|
|
692
761
|
}
|
|
693
762
|
if (sub === "name") {
|
|
@@ -709,19 +778,19 @@ async function machines() {
|
|
|
709
778
|
}
|
|
710
779
|
if (sub)
|
|
711
780
|
throw new Error(
|
|
712
|
-
"usage: tryharness machines [
|
|
781
|
+
"usage: tryharness machines [add <code> | name <name> | home]"
|
|
713
782
|
);
|
|
714
783
|
const response = await daemonRequest({ command: "machines.list" });
|
|
715
784
|
if (!response.ok)
|
|
716
785
|
throw new Error(response.error || "the daemon could not list computers");
|
|
717
786
|
const { self, joinCode } = response;
|
|
718
787
|
console.log(
|
|
719
|
-
`This computer: ${self.label} (${self.role === "worker" ? "worker" : "home, holds the board"})${self.fingerprint ? `, key ${self.fingerprint}` : ""}`
|
|
788
|
+
`This computer: ${self.label} (${self.role === "worker" ? "worker" : self.standingInFor ? `standing in as home for ${self.standingInFor} until it is back` : "home, holds the board"})${self.fingerprint ? `, key ${self.fingerprint}` : ""}`
|
|
720
789
|
);
|
|
721
790
|
if (joinCode) {
|
|
722
791
|
const home = response.machines.find((machine) => machine.role === "home");
|
|
723
792
|
console.log(
|
|
724
|
-
`Join code: ${joinCode}\nOn your home computer${home?.label ? ` (${home.label})` : ""}, run: npx tryharness machines
|
|
793
|
+
`Join code: ${joinCode}\nOn your home computer${home?.label ? ` (${home.label})` : ""}, choose Add a Computer in the Harness menu and type it, or run: npx tryharness machines add ${joinCode}`
|
|
725
794
|
);
|
|
726
795
|
}
|
|
727
796
|
if (!response.machines.length) {
|
|
@@ -732,7 +801,7 @@ async function machines() {
|
|
|
732
801
|
}
|
|
733
802
|
for (const machine of response.machines)
|
|
734
803
|
console.log(
|
|
735
|
-
`${String(machine.label || machine.id).padEnd(20)} ${machine.role.padEnd(7)} ${(machine.connected ? "online" : "offline").padEnd(8)} ${machine.confirmed ? "confirmed" : "waiting to join"}${machine.fingerprint ? ` key ${machine.fingerprint}` : ""}${machine.agents?.length ? ` ${machine.agents.join(", ")}` : ""}`
|
|
804
|
+
`${String(machine.label || machine.id).padEnd(20)} ${(machine.standsInForThis ? "home (standing in for this computer)" : machine.role).padEnd(7)} ${(machine.connected ? "online" : "offline").padEnd(8)} ${machine.confirmed ? "confirmed" : "waiting to join"}${machine.connected && machine.confirmed ? (machine.direct ? " reached directly" : " reached through Harness") : ""}${machine.fingerprint ? ` key ${machine.fingerprint}` : ""}${machine.agents?.length ? ` ${machine.agents.join(", ")}` : ""}`
|
|
736
805
|
);
|
|
737
806
|
}
|
|
738
807
|
|
|
@@ -1666,6 +1735,7 @@ function logs() {
|
|
|
1666
1735
|
|
|
1667
1736
|
async function disconnect() {
|
|
1668
1737
|
uninstallService();
|
|
1738
|
+
removeNativeHost();
|
|
1669
1739
|
retireDesktop({});
|
|
1670
1740
|
try {
|
|
1671
1741
|
await daemonRequest({ command: "shutdown" }, 2_000);
|
|
@@ -1710,17 +1780,22 @@ async function lessons() {
|
|
|
1710
1780
|
return;
|
|
1711
1781
|
}
|
|
1712
1782
|
const replaced = has("--replaced");
|
|
1783
|
+
// Lessons the dream read as instructions for one job (swarmMemory.mjs).
|
|
1784
|
+
const retired = has("--retired");
|
|
1713
1785
|
const response = await daemonRequest({
|
|
1714
1786
|
command: "board.swarm.lessons",
|
|
1715
1787
|
agent: "user",
|
|
1716
1788
|
replaced,
|
|
1789
|
+
retired,
|
|
1717
1790
|
});
|
|
1718
1791
|
if (!response.ok) throw new Error(response.error);
|
|
1719
1792
|
if (!response.lessons.length) {
|
|
1720
1793
|
console.log(
|
|
1721
|
-
|
|
1722
|
-
? "No lesson has been
|
|
1723
|
-
:
|
|
1794
|
+
retired
|
|
1795
|
+
? "No lesson has been retired."
|
|
1796
|
+
: replaced
|
|
1797
|
+
? "No lesson has been replaced yet."
|
|
1798
|
+
: "Your swarm has learned nothing from you yet. It learns from what you write in its threads."
|
|
1724
1799
|
);
|
|
1725
1800
|
return;
|
|
1726
1801
|
}
|
|
@@ -1731,9 +1806,11 @@ async function lessons() {
|
|
|
1731
1806
|
? "about the work"
|
|
1732
1807
|
: "about you";
|
|
1733
1808
|
console.log(
|
|
1734
|
-
|
|
1735
|
-
? `
|
|
1736
|
-
:
|
|
1809
|
+
retired
|
|
1810
|
+
? `Retired as instructions for one job (${response.lessons.length}); the dream read them after the work:`
|
|
1811
|
+
: replaced
|
|
1812
|
+
? `Replaced by a later lesson (${response.lessons.length}):`
|
|
1813
|
+
: `What your swarm has learned from you (${response.lessons.length}):`
|
|
1737
1814
|
);
|
|
1738
1815
|
for (const lesson of response.lessons) {
|
|
1739
1816
|
const where =
|
|
@@ -1754,9 +1831,101 @@ async function lessons() {
|
|
|
1754
1831
|
);
|
|
1755
1832
|
}
|
|
1756
1833
|
|
|
1834
|
+
// The swarm's long-running memory (cli/lib/swarmMemory.mjs): what the dream keeps from the work, what was forgotten or
|
|
1835
|
+
// replaced, and the last dream; forget or delete something, bring it back, or dream now.
|
|
1836
|
+
async function memoryCommand() {
|
|
1837
|
+
const [sub, id] = argv;
|
|
1838
|
+
const ask = async (payload) => {
|
|
1839
|
+
const response = await daemonRequest({ agent: "user", ...payload });
|
|
1840
|
+
if (!response.ok) throw new Error(response.error || response.why);
|
|
1841
|
+
return response;
|
|
1842
|
+
};
|
|
1843
|
+
if (sub === "forget" || sub === "delete") {
|
|
1844
|
+
if (!id)
|
|
1845
|
+
throw new Error(
|
|
1846
|
+
"usage: tryharness memory forget <id> | memory delete <post id>"
|
|
1847
|
+
);
|
|
1848
|
+
const { forgotten } = await ask({
|
|
1849
|
+
command: "board.swarm.forget",
|
|
1850
|
+
ids: [id],
|
|
1851
|
+
mode: sub === "delete" ? "purge" : "release",
|
|
1852
|
+
});
|
|
1853
|
+
console.log(
|
|
1854
|
+
sub === "delete"
|
|
1855
|
+
? "Deleted for good: its words are gone from every search, brief and computer."
|
|
1856
|
+
: `Forgotten (${forgotten.map((item) => item.what).join(", ")}): no search or brief brings it back. tryharness memory back ${id} undoes it.`
|
|
1857
|
+
);
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
if (sub === "back") {
|
|
1861
|
+
if (!id) throw new Error("usage: tryharness memory back <post id>");
|
|
1862
|
+
await ask({ command: "board.swarm.unforget", id });
|
|
1863
|
+
console.log("Back in what your agents can find.");
|
|
1864
|
+
return;
|
|
1865
|
+
}
|
|
1866
|
+
if (sub === "dream") {
|
|
1867
|
+
const report = await ask({ command: "board.swarm.dream" });
|
|
1868
|
+
console.log(
|
|
1869
|
+
`Read ${report.read} new fact${report.read === 1 ? "" : "s"}: kept ${report.kept.length}, changed ${report.changed.length}, retired ${report.retired.length} one-job lesson${report.retired.length === 1 ? "" : "s"}, widened ${report.widened.length}.${report.more ? " More is waiting; the next dream reads on." : ""}`
|
|
1870
|
+
);
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
const response = await ask({ command: "board.swarm.memory" });
|
|
1874
|
+
if (!response.observations.length)
|
|
1875
|
+
console.log(
|
|
1876
|
+
"Your swarm keeps nothing from its work yet. It dreams overnight on the charger, or now with tryharness memory dream."
|
|
1877
|
+
);
|
|
1878
|
+
else {
|
|
1879
|
+
console.log(
|
|
1880
|
+
`What your swarm keeps from its work (${response.observations.length}):`
|
|
1881
|
+
);
|
|
1882
|
+
for (const item of response.observations) {
|
|
1883
|
+
const where = item.folder ? `in ${item.folder}` : "everywhere";
|
|
1884
|
+
console.log(
|
|
1885
|
+
` ${item.id.slice(0, 8)} ${item.kind}${item.agent ? ` about ${item.agent}` : ""}, ${where}, borne out ${item.proof} time${item.proof === 1 ? "" : "s"}: ${item.text}`
|
|
1886
|
+
);
|
|
1887
|
+
if (item.quote) console.log(` from "${item.quote}"`);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
const forgotten = response.forgotten.filter(
|
|
1891
|
+
(mark) => mark.state !== "purged"
|
|
1892
|
+
);
|
|
1893
|
+
if (forgotten.length)
|
|
1894
|
+
console.log(
|
|
1895
|
+
`\n${forgotten.length} post${forgotten.length === 1 ? " is" : "s are"} out of what agents find (forgotten or replaced by a later post); tryharness memory back <id> brings one back.`
|
|
1896
|
+
);
|
|
1897
|
+
if (response.dream?.at)
|
|
1898
|
+
console.log(
|
|
1899
|
+
`\nLast dream ${response.dream.at.slice(0, 16).replace("T", " ")}: read ${response.dream.read}, kept ${response.dream.kept.length}, changed ${response.dream.changed.length}, retired ${response.dream.retired.length}, widened ${response.dream.widened.length}.`
|
|
1900
|
+
);
|
|
1901
|
+
console.log(
|
|
1902
|
+
"\nForget one: tryharness memory forget <id>. Delete a post's words for good: tryharness memory delete <post id>. Dream now: tryharness memory dream."
|
|
1903
|
+
);
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1757
1906
|
async function agents() {
|
|
1758
1907
|
const config = readJson(paths.config, {});
|
|
1759
1908
|
const [sub, agent] = argv;
|
|
1909
|
+
// Who is in the swarm, and putting agents in or taking them out (lineup.mjs).
|
|
1910
|
+
if (!sub) {
|
|
1911
|
+
await showLineup({ daemonRequest });
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
if (sub === "add") {
|
|
1915
|
+
const ui = createUi();
|
|
1916
|
+
ui.intro(
|
|
1917
|
+
`${pc.bgCyan(pc.black(" tryharness "))} Add agents to your swarm`
|
|
1918
|
+
);
|
|
1919
|
+
const ok = await addAgents({ daemonRequest, wanted: argv.slice(1), ui });
|
|
1920
|
+
ui.outro(ok ? "Done." : "Not everything was added.");
|
|
1921
|
+
process.exitCode = ok ? 0 : 1;
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
if (sub === "remove") {
|
|
1925
|
+
if (!agent) throw new Error("usage: tryharness agents remove <agent>");
|
|
1926
|
+
process.exitCode = (await removeAgent({ daemonRequest, agent })) ? 0 : 1;
|
|
1927
|
+
return;
|
|
1928
|
+
}
|
|
1760
1929
|
if (sub === "test" && agent) {
|
|
1761
1930
|
process.exitCode = (await testAgent({ agent, daemonRequest })) ? 0 : 1;
|
|
1762
1931
|
return;
|
|
@@ -1777,6 +1946,25 @@ async function agents() {
|
|
|
1777
1946
|
);
|
|
1778
1947
|
return;
|
|
1779
1948
|
}
|
|
1949
|
+
// The person's tier for one agent, over its model's benchmark tier: who may hold the team's important roles.
|
|
1950
|
+
if (sub === "tier") {
|
|
1951
|
+
const tier = argv[2];
|
|
1952
|
+
if (!agent || !tier)
|
|
1953
|
+
throw new Error(
|
|
1954
|
+
"usage: tryharness agents tier <agent> top|middle|bottom|auto"
|
|
1955
|
+
);
|
|
1956
|
+
const response = await daemonRequest({
|
|
1957
|
+
command: "board.swarm.tier",
|
|
1958
|
+
agent: "user",
|
|
1959
|
+
target: agent,
|
|
1960
|
+
tier,
|
|
1961
|
+
});
|
|
1962
|
+
if (!response.ok) throw new Error(response.error);
|
|
1963
|
+
console.log(
|
|
1964
|
+
`${response.agent} is ${response.tier?.level ?? "unknown"} tier: ${response.tier?.because ?? ""}`
|
|
1965
|
+
);
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1780
1968
|
if (sub === "note") {
|
|
1781
1969
|
const text = argv
|
|
1782
1970
|
.slice(2)
|
|
@@ -1895,6 +2083,8 @@ async function agents() {
|
|
|
1895
2083
|
ui,
|
|
1896
2084
|
only,
|
|
1897
2085
|
});
|
|
2086
|
+
// An agent set up by name is in the swarm from now on (lineup.mjs); the daemon reads the change by itself.
|
|
2087
|
+
if (only) createLineup().add(only);
|
|
1898
2088
|
ui.outro("Done.");
|
|
1899
2089
|
}
|
|
1900
2090
|
|
|
@@ -2014,7 +2204,8 @@ async function browserLink() {
|
|
|
2014
2204
|
throw new Error(response.error || "the daemon could not make a link");
|
|
2015
2205
|
return {
|
|
2016
2206
|
url: response.url,
|
|
2017
|
-
opened
|
|
2207
|
+
// openUrl cannot tell whether a browser opened (a missing xdg-open fails later), so a computer with none prints it.
|
|
2208
|
+
opened: !has("--print") && canOpenBrowser() && openUrl(response.url),
|
|
2018
2209
|
};
|
|
2019
2210
|
}
|
|
2020
2211
|
async function link() {
|
|
@@ -2022,7 +2213,7 @@ async function link() {
|
|
|
2022
2213
|
console.log(
|
|
2023
2214
|
opened
|
|
2024
2215
|
? "Opened Harness in your browser to connect it to this computer end to end. The link works once, for 10 minutes."
|
|
2025
|
-
: `
|
|
2216
|
+
: `To talk to this computer's agents from your browser, open this link in it. It works once, for 10 minutes; keep it to yourself:\n\n${url}`
|
|
2026
2217
|
);
|
|
2027
2218
|
console.log(
|
|
2028
2219
|
"Harness then carries what your browser and this computer say to each other sealed, and cannot read it."
|
|
@@ -2084,12 +2275,22 @@ async function t3() {
|
|
|
2084
2275
|
|
|
2085
2276
|
function help() {
|
|
2086
2277
|
console.log(
|
|
2087
|
-
`tryharness ${VERSION}\n\nCommands:\n tryharness set up everything and start the daemon\n tryharness desktop open the Harness desktop app (setup opens it too; --no-desktop skips it)\n tryharness status show daemon, bridge, agent, and index health\n tryharness doctor diagnose the complete connection\n tryharness local [learn] the relay's local models, where they run, what is indexed and the last learning\n tryharness local on|off search over your Desktop, Documents and Downloads by what is in the files (on by default)\n tryharness local add|remove <folder> another folder to search the same way\n tryharness watch [add <name> --run <command> [--every 5m] [--field f | --age f | --count text] [--above n] [--below n] | start <id> | remove <id>]\n watches the relay checks and says out loud only when they are off\n tryharness sync [--agent] rescan local coding history in the background\n tryharness task <id> --follow\n follow a delegated agent run in this terminal\n tryharness board [--all] list open work on the machine's task board\n tryharness board post --for <agent> --objective <text> [--file <brief.md>]\n tryharness board show <id>\n tryharness board post --for codex --objective <text> --run --workspace <dir>\n the daemon runs it and reports back on the task\n tryharness board run <id> authorize a run an agent asked for\n tryharness board release <id>\n tryharness board agents when each agent last read the board\n tryharness board --watch follow the board in this terminal\n tryharness notify on|off desktop notifications for what waits on you\n tryharness board send <task> <message> send a held reply to another person's agent\n tryharness board snippet [<id> share|keep] code an agent elsewhere asked to see; nothing leaves until you share it\n tryharness board auto <task> on|off auto-send replies on that thread\n tryharness board end <task> --outcome <text>\n tryharness board context <task> <query> search everything written about a task\n tryharness goal set --objective <text> [--team a,b] [--workspace <dir>] a goal your agents work together in one room\n tryharness goal [list | show <id> | stop <id> | resume <id>]\n tryharness room <goal> | room post <goal> <text> [--ask agent,agent]\n tryharness swarm rounds [<thread>] what the coordinator saw, chose and cost each round\n tryharness swarm health [<thread>] who decided each day's rounds: Harness, a backup, or no one\n tryharness swarm ceiling <thread> <dollars|off> what a thread may spend of your Harness credits\n tryharness swarm checkin <thread> "<what>" (--in 2h | --at 14:30 | --every 30m | --daily 09:00 [--days mon-fri]) [--wake codex] [--times n] [--until <date>]\n the thread comes back on its own then, waking those agents or its lead\n tryharness swarm checkins [<thread>] [--all] | swarm checkin remove <id>\n tryharness swarm coordinator [harness|local] who coordinates your threads\n tryharness connect <handle/agent> --about <text> ask another person's agent to work an issue with yours, sealed to their computer\n tryharness peers the keys of other people's computers this one has worked with, to compare\n tryharness machines your computers: which holds the board (home) and which work through it; machines
|
|
2278
|
+
`tryharness ${VERSION}\n\nCommands:\n tryharness set up everything and start the daemon\n tryharness desktop open the Harness desktop app (setup opens it too; --no-desktop skips it)\n tryharness status show daemon, bridge, agent, and index health\n tryharness doctor diagnose the complete connection\n tryharness local [learn] the relay's local models, where they run, what is indexed and the last learning\n tryharness local on|off search over your Desktop, Documents and Downloads by what is in the files (on by default)\n tryharness local add|remove <folder> another folder to search the same way\n tryharness watch [add <name> --run <command> [--every 5m] [--field f | --age f | --count text] [--above n] [--below n] | start <id> | remove <id>]\n watches the relay checks and says out loud only when they are off\n tryharness sync [--agent] rescan local coding history in the background\n tryharness task <id> --follow\n follow a delegated agent run in this terminal\n tryharness board [--all] list open work on the machine's task board\n tryharness board post --for <agent> --objective <text> [--file <brief.md>]\n tryharness board show <id>\n tryharness board post --for codex --objective <text> --run --workspace <dir>\n the daemon runs it and reports back on the task\n tryharness board run <id> authorize a run an agent asked for\n tryharness board release <id>\n tryharness board agents when each agent last read the board\n tryharness board --watch follow the board in this terminal\n tryharness notify on|off desktop notifications for what waits on you\n tryharness usage-totals on|off daily counts of your swarm's work, without your account or any text (on by default)\n tryharness board send <task> <message> send a held reply to another person's agent\n tryharness board snippet [<id> share|keep] code an agent elsewhere asked to see; nothing leaves until you share it\n tryharness board auto <task> on|off auto-send replies on that thread\n tryharness board end <task> --outcome <text>\n tryharness board context <task> <query> search everything written about a task\n tryharness goal set --objective <text> [--team a,b] [--workspace <dir>] a goal your agents work together in one room\n tryharness goal [list | show <id> | stop <id> | resume <id>]\n tryharness room <goal> | room post <goal> <text> [--ask agent,agent]\n tryharness swarm rounds [<thread>] what the coordinator saw, chose and cost each round\n tryharness swarm health [<thread>] who decided each day's rounds: Harness, a backup, or no one\n tryharness swarm ceiling <thread> <dollars|off> what a thread may spend of your Harness credits\n tryharness swarm checkin <thread> "<what>" (--in 2h | --at 14:30 | --every 30m | --daily 09:00 [--days mon-fri]) [--wake codex] [--times n] [--until <date>]\n the thread comes back on its own then, waking those agents or its lead\n tryharness swarm checkins [<thread>] [--all] | swarm checkin remove <id>\n tryharness swarm coordinator [harness|local] who coordinates your threads\n tryharness connect <handle/agent> --about <text> ask another person's agent to work an issue with yours, sealed to their computer\n tryharness peers the keys of other people's computers this one has worked with, to compare\n tryharness machines your computers: which holds the board (home) and which work through it; machines add <code> | name <name> | home\n tryharness agents who is in your swarm, and who can be added\n tryharness agents add [<agent>…] put agents in your swarm; with no name, pick from the ones found here\n tryharness agents remove <agent> take an agent out of your swarm\n tryharness agents setup [<agent>] | agents test <agent> how Harness wakes each agent\n tryharness agents cards what each of your agents is told about the others\n tryharness agents note <agent> <text> [--clear] your own note on an agent's card, told to every other agent\n tryharness agents tier <agent> top|middle|bottom|auto who may hold the team's important roles; auto goes by its model's benchmark\n tryharness lessons [--replaced | --retired] | lessons remove <id> | lessons edit <id> "<text>"\n what your swarm learned from your words, to read, change or take out\n tryharness memory [dream | forget <id> | delete <post id> | back <id>]\n what your swarm keeps from its work, overnight; forget, delete or bring back\n tryharness agents models [<agent>] [--refresh] the models each coding agent lists and the one it runs on\n tryharness agents model <agent> <model> [--effort <level>] | auto | default the model it runs on; auto lets Harness pick per run\n tryharness agents routing "<text>" [--clear] how Auto picks models for your swarm\n tryharness connections on|off outside apps (Gmail, Calendar, Slack, Notion, Linear) for your agents; off by default\n tryharness connections connect apps, choose agent access and review approvals (connections catalog for providers)\n tryharness vault your secrets, kept on this computer: agents use them without seeing them (vault add <name> --hosts <host> | allow <agent> <name> | runs <agent> <name> <VARIABLE> | backup <email> | share <name>)\n tryharness mcp grok-bot print the MCP snippet that puts Grok Bot on the board\n tryharness link connect the browser you use Harness in to this computer, end to end (--print shows the link)\n tryharness phone pair show a QR code that pairs your phone with this computer\n tryharness phone list | revoke <id>\n tryharness t3 approve Harness in T3 Code once, so your messages go into its threads (t3 status | t3 forget)\n tryharness logs [--follow]\n tryharness disconnect\n`
|
|
2088
2279
|
);
|
|
2089
2280
|
}
|
|
2090
2281
|
|
|
2091
2282
|
try {
|
|
2092
|
-
|
|
2283
|
+
// Started by Chrome for the Harness extension (nativeHost.mjs); its stdout carries only the framed answers.
|
|
2284
|
+
if (command === "native-host") {
|
|
2285
|
+
const { serveNativeHost } = await import("./lib/nativeHost.mjs");
|
|
2286
|
+
await serveNativeHost({
|
|
2287
|
+
input: process.stdin,
|
|
2288
|
+
output: process.stdout,
|
|
2289
|
+
daemon: (request, timeoutMs) => daemonRequest(request, timeoutMs),
|
|
2290
|
+
});
|
|
2291
|
+
// Chrome closed the port: a listening host would otherwise keep waiting on the daemon.
|
|
2292
|
+
process.exit(0);
|
|
2293
|
+
} else if (
|
|
2093
2294
|
command === "setup" ||
|
|
2094
2295
|
(command === "connect" && (!argv[0] || argv[0].startsWith("-")))
|
|
2095
2296
|
)
|
|
@@ -2106,10 +2307,31 @@ try {
|
|
|
2106
2307
|
else if (command === "room") await room();
|
|
2107
2308
|
else if (command === "swarm") await swarm();
|
|
2108
2309
|
else if (command === "mcp") await mcpSnippet();
|
|
2109
|
-
else if (command === "
|
|
2310
|
+
else if (command === "connections" && ["on", "off"].includes(argv[0])) {
|
|
2311
|
+
// Apps (connected outside accounts) are off until the person turns them on; agents see the connection tool in
|
|
2312
|
+
// the sessions they start after that (mcp-stdio.mjs).
|
|
2313
|
+
const on = argv[0] === "on";
|
|
2314
|
+
writeJsonAtomic(paths.config, {
|
|
2315
|
+
...readJson(paths.config, {}),
|
|
2316
|
+
connectedApps: on,
|
|
2317
|
+
});
|
|
2318
|
+
console.log(
|
|
2319
|
+
on
|
|
2320
|
+
? "Apps are on. Connect one with npx tryharness connections add; agents see them in sessions they start from now on."
|
|
2321
|
+
: "Apps are off. No agent can use a connected app until you turn them on again."
|
|
2322
|
+
);
|
|
2323
|
+
} else if (command === "connections") {
|
|
2324
|
+
const { connectorCommands } = await import("./lib/connectorCommands.mjs");
|
|
2325
|
+
await connectorCommands(argv);
|
|
2326
|
+
} else if (command === "vault") {
|
|
2327
|
+
const { vaultCommands } = await import("./lib/vaultCommands.mjs");
|
|
2328
|
+
await vaultCommands(argv);
|
|
2329
|
+
} else if (command === "notify") await notify();
|
|
2330
|
+
else if (command === "usage-totals") await usageTotals();
|
|
2110
2331
|
else if (command === "phone") await phone();
|
|
2111
2332
|
else if (command === "agents") await agents();
|
|
2112
2333
|
else if (command === "lessons") await lessons();
|
|
2334
|
+
else if (command === "memory") await memoryCommand();
|
|
2113
2335
|
else if (command === "link") await link();
|
|
2114
2336
|
else if (command === "t3") await t3();
|
|
2115
2337
|
else if (command === "peers") await peers();
|