tryharness 0.7.82 → 0.7.86
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 +21 -19
- package/assets/dsh-plugin.mjs +75 -4
- package/assets/herdr-mod/harness/main.js +367 -0
- package/assets/herdr-mod/harness/mod.json +6 -0
- package/assets/opencode-plugin.js +87 -22
- package/assets/pi-extension.ts +81 -2
- package/cli.mjs +544 -208
- package/lib/adapters.mjs +62 -27
- package/lib/agentBinaries.mjs +6 -8
- package/lib/agentClaims.mjs +168 -0
- package/lib/agentReadTools.json +415 -0
- package/lib/agentSignIn.mjs +17 -18
- package/lib/agentWiring.mjs +114 -0
- package/lib/archetypes.js +10 -11
- package/lib/attention.mjs +100 -0
- package/lib/audit.mjs +1 -1
- package/lib/backupSetup.mjs +6 -28
- package/lib/bankrApprovals.mjs +86 -0
- package/lib/boardAccess.mjs +40 -66
- package/lib/boardBackup.mjs +86 -85
- package/lib/boardCommands.mjs +28 -0
- package/lib/boardFileCommands.mjs +29 -36
- package/lib/boardFiles.mjs +83 -15
- package/lib/boardMirror.mjs +78 -11
- package/lib/boardProtocol.json +193 -123
- package/lib/boardThreads.mjs +19 -37
- package/lib/boardTools.mjs +22 -15
- package/lib/boardWatches.mjs +43 -15
- package/lib/bridge.mjs +7 -3
- package/lib/browserAgentTools.mjs +59 -0
- package/lib/browserWake.mjs +0 -6
- package/lib/cards.mjs +57 -2
- package/lib/circling.mjs +189 -0
- package/lib/cleanup.mjs +234 -0
- package/lib/cloudBoot.mjs +21 -4
- package/lib/cloudSave.mjs +46 -5
- package/lib/compaction.mjs +8 -1
- package/lib/completion.mjs +358 -0
- package/lib/computerDevices.mjs +853 -0
- package/lib/connectionStatus.mjs +34 -0
- package/lib/connectors.mjs +139 -1
- package/lib/coordinator.mjs +108 -14
- package/lib/coreModels.mjs +36 -12
- package/lib/daemon.mjs +2435 -333
- package/lib/daemonLock.mjs +103 -0
- package/lib/deviceDoor.mjs +308 -0
- package/lib/deviceIdentity.mjs +114 -0
- package/lib/deviceList.mjs +172 -0
- package/lib/deviceSeal.mjs +74 -0
- package/lib/dispatcher.mjs +497 -26
- package/lib/dispatches.mjs +3 -3
- package/lib/environment.mjs +2 -1
- package/lib/environments.mjs +67 -41
- package/lib/events.mjs +318 -0
- package/lib/facts.mjs +170 -0
- package/lib/fileSource.mjs +540 -0
- package/lib/files.mjs +47 -2
- package/lib/gitHost.mjs +39 -1
- package/lib/goalCommands.mjs +12 -80
- package/lib/handover.mjs +21 -16
- package/lib/harnessOffers.mjs +140 -15
- package/lib/herdr.mjs +100 -15
- package/lib/herdrAppCall.mjs +19 -0
- package/lib/herdrCore.mjs +59 -0
- package/lib/herdrRuns.mjs +1126 -0
- package/lib/hookDialects.mjs +235 -50
- package/lib/identityLink.mjs +81 -0
- package/lib/inference.mjs +31 -2
- package/lib/jamAccess.mjs +82 -0
- package/lib/{projectBoard.mjs → jamBoard.mjs} +5 -4
- package/lib/{projectGit.mjs → jamGit.mjs} +53 -15
- package/lib/jamKey.mjs +274 -0
- package/lib/{projectPieces.mjs → jamPieces.mjs} +35 -29
- package/lib/{projectSettings.mjs → jamSettings.mjs} +12 -22
- package/lib/jamStore.mjs +973 -0
- package/lib/jamUpgrade.mjs +112 -0
- package/lib/jams.mjs +3079 -0
- package/lib/kanban.mjs +13 -7
- package/lib/landed.mjs +5 -1
- package/lib/library.mjs +41 -22
- package/lib/limits.mjs +91 -0
- package/lib/lineDiff.mjs +97 -0
- package/lib/lineup.mjs +18 -13
- package/lib/link.mjs +584 -0
- package/lib/localStack.mjs +75 -16
- package/lib/localmodels.mjs +58 -78
- package/lib/loopBackstop.mjs +2 -1
- package/lib/machine.mjs +544 -0
- package/lib/machineLink.mjs +446 -0
- package/lib/machineRoutes.mjs +68 -19
- package/lib/machineRuns.mjs +85 -4
- package/lib/machineSeal.mjs +6 -31
- package/lib/manager.mjs +134 -12
- package/lib/mcp-stdio.mjs +492 -215
- package/lib/mcpRelay.mjs +34 -35
- package/lib/members.json +2 -2
- package/lib/modelRoute.mjs +162 -0
- package/lib/nativeHost.mjs +81 -90
- package/lib/nativeSenses.mjs +258 -0
- package/lib/nerves.mjs +523 -0
- package/lib/network.mjs +117 -278
- package/lib/networkPlaces.mjs +578 -0
- package/lib/nextStep.mjs +95 -0
- package/lib/notify.mjs +2 -2
- package/lib/nudge.mjs +116 -10
- package/lib/onboard.mjs +6 -6
- package/lib/originals.mjs +216 -0
- package/lib/outsideEvents.mjs +383 -0
- package/lib/outsideRuns.mjs +230 -0
- package/lib/ownMachines.mjs +674 -256
- package/lib/pain.mjs +215 -0
- package/lib/pairing.mjs +91 -11
- package/lib/paths.mjs +42 -3
- package/lib/peerProcess.mjs +21 -7
- package/lib/peopleLink.mjs +268 -0
- package/lib/personNotices.mjs +3 -2
- package/lib/phones.mjs +252 -542
- package/lib/placeCards.mjs +282 -0
- package/lib/placeChecks.mjs +95 -0
- package/lib/placeCommands.mjs +8 -17
- package/lib/placeRequests.mjs +152 -0
- package/lib/placeStore.mjs +295 -0
- package/lib/placeTool.d.ts +12 -0
- package/lib/placeTool.js +40 -0
- package/lib/places.mjs +63 -14
- package/lib/plans.mjs +53 -8
- package/lib/presence.mjs +270 -0
- package/lib/privateNetwork.d.ts +2 -0
- package/lib/privateNetwork.js +93 -0
- package/lib/proposals.mjs +300 -0
- package/lib/publicFetch.d.ts +32 -0
- package/lib/publicFetch.js +248 -0
- package/lib/reach.mjs +128 -0
- package/lib/rebuildable.mjs +72 -0
- package/lib/recall.mjs +216 -0
- package/lib/record.mjs +13 -0
- package/lib/reflexes.mjs +392 -0
- package/lib/relayLimits.mjs +31 -2
- package/lib/releaseNotice.mjs +198 -0
- package/lib/removeHarness.mjs +15 -4
- package/lib/repoLinks.mjs +204 -35
- package/lib/runAuthority.mjs +102 -39
- package/lib/runBrief.mjs +93 -40
- package/lib/runRequests.mjs +52 -14
- package/lib/runUsage.mjs +31 -0
- package/lib/runWorker.mjs +74 -25
- package/lib/runner.mjs +289 -45
- package/lib/runtime-install.mjs +37 -8
- package/lib/schedules.mjs +171 -47
- package/lib/screenWatches.mjs +221 -0
- package/lib/sealed.mjs +12 -30
- package/lib/sealedThreads.mjs +198 -392
- package/lib/secretStore.mjs +178 -0
- package/lib/secrets.mjs +11 -0
- package/lib/seen.mjs +3 -9
- package/lib/selfUpdate.mjs +51 -15
- package/lib/senseCall.mjs +1514 -0
- package/lib/senseHook.mjs +114 -0
- package/lib/senseTools.mjs +1298 -0
- package/lib/sessionBriefs.mjs +87 -0
- package/lib/sessionControl.mjs +63 -13
- package/lib/sessionFiles.mjs +85 -0
- package/lib/setupChoices.mjs +12 -3
- package/lib/setupMode.mjs +70 -25
- package/lib/sharedKeys.mjs +166 -0
- package/lib/sleep.mjs +396 -0
- package/lib/sources.mjs +306 -0
- package/lib/speech.mjs +166 -411
- package/lib/spoken.mjs +210 -0
- package/lib/steerHook.mjs +3 -1
- package/lib/steerQueue.mjs +40 -11
- package/lib/store.mjs +323 -130
- package/lib/stuck.mjs +85 -7
- package/lib/swarm.mjs +157 -49
- package/lib/swarmDevices.mjs +25 -85
- package/lib/swarmMemory.mjs +93 -9
- package/lib/t3.mjs +73 -3
- package/lib/taskCommands.mjs +51 -60
- package/lib/taskRooms.mjs +30 -4
- package/lib/taskRules.json +29 -0
- package/lib/taskRules.mjs +21 -0
- package/lib/taskRuns.mjs +74 -11
- package/lib/team.mjs +2 -1
- package/lib/threadActions.mjs +37 -9
- package/lib/threadAuthority.mjs +4 -4
- package/lib/threadBriefs.mjs +173 -43
- package/lib/threadNotes.mjs +320 -0
- package/lib/threadRecord.mjs +491 -0
- package/lib/threadRuns.mjs +216 -108
- package/lib/threadView.mjs +27 -30
- package/lib/threadWatches.mjs +1962 -0
- package/lib/timeSense.mjs +839 -0
- package/lib/tripwires.mjs +454 -0
- package/lib/ui.mjs +1 -1
- package/lib/vault.mjs +560 -45
- package/lib/vaultCommands.mjs +5 -3
- package/lib/vaultPeers.mjs +165 -0
- package/lib/vaultTools.d.ts +4 -1
- package/lib/vaultTools.js +22 -1
- package/lib/verdicts.mjs +12 -26
- package/lib/versions.mjs +117 -0
- package/lib/waitTool.mjs +278 -0
- package/lib/wakePicture.mjs +268 -0
- package/lib/wakeQueue.mjs +108 -0
- package/lib/watchResponses.mjs +533 -0
- package/lib/watches.mjs +290 -145
- package/lib/windowAsks.mjs +80 -17
- package/lib/worktrees.mjs +159 -9
- package/npm-shrinkwrap.json +138 -631
- package/package.json +7 -6
- package/release.json +212 -130
- package/lib/callSessions.mjs +0 -51
- package/lib/directLink.mjs +0 -349
- package/lib/peopleBoard.mjs +0 -131
- package/lib/projects.mjs +0 -2917
- package/lib/roomChannels.mjs +0 -667
package/cli.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readConfig, updateConfig } from "./lib/secretStore.mjs";
|
|
2
3
|
import { spawn, spawnSync } from "node:child_process";
|
|
3
4
|
import { validateConnection as checkConnection } from "./lib/connection.mjs";
|
|
4
5
|
import fs from "node:fs";
|
|
@@ -6,6 +7,7 @@ import os from "node:os";
|
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { fileURLToPath } from "node:url";
|
|
8
9
|
import { configureAgents, AGENTS } from "./lib/adapters.mjs";
|
|
10
|
+
import { wiringOf } from "./lib/agentWiring.mjs";
|
|
9
11
|
import {
|
|
10
12
|
addAgents,
|
|
11
13
|
banner,
|
|
@@ -22,9 +24,10 @@ import pc from "picocolors";
|
|
|
22
24
|
import { chosenAgents, removeHarnessHere } from "./lib/removeHarness.mjs";
|
|
23
25
|
import { detectAgents } from "./lib/commands.mjs";
|
|
24
26
|
import { PROPOSERS, nameOf } from "./lib/members.mjs";
|
|
25
|
-
import { describeDispatcher } from "./lib/dispatcher.mjs";
|
|
27
|
+
import { describeDispatcher, dispatcherNotReady } from "./lib/dispatcher.mjs";
|
|
28
|
+
import { modelsWanted } from "./lib/coreModels.mjs";
|
|
26
29
|
import { daemonRequest } from "./lib/control-client.mjs";
|
|
27
|
-
import { ensureDir, readJson
|
|
30
|
+
import { ensureDir, readJson } from "./lib/files.mjs";
|
|
28
31
|
import { hostApp, processTable } from "./lib/live.mjs";
|
|
29
32
|
import { noteSetupTerminal } from "./lib/places.mjs";
|
|
30
33
|
import { readScreenFacts, whereSetupShows } from "./lib/screen.mjs";
|
|
@@ -101,19 +104,12 @@ function resumeCommand(agent, sessionId, cwd) {
|
|
|
101
104
|
return cwd ? `cd ${shellQuote(cwd)} && ${command}` : command;
|
|
102
105
|
}
|
|
103
106
|
function origin() {
|
|
104
|
-
const saved =
|
|
107
|
+
const saved = readConfig(paths.config, {});
|
|
105
108
|
return String(
|
|
106
109
|
arg("--origin", saved.origin || "https://tryharness.ai")
|
|
107
110
|
).replace(/\/$/, "");
|
|
108
111
|
}
|
|
109
112
|
|
|
110
|
-
// Whether a browser can open here: not over SSH, and on Linux only with a display.
|
|
111
|
-
const canOpenBrowser = () =>
|
|
112
|
-
!process.env.SSH_CONNECTION &&
|
|
113
|
-
!process.env.SSH_TTY &&
|
|
114
|
-
(process.platform !== "linux" ||
|
|
115
|
-
Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY));
|
|
116
|
-
|
|
117
113
|
async function waitForDaemon(timeoutMs = 12_000) {
|
|
118
114
|
const deadline = Date.now() + timeoutMs;
|
|
119
115
|
let lastError;
|
|
@@ -157,13 +153,27 @@ async function setupState(timeoutMs = 12_000) {
|
|
|
157
153
|
}
|
|
158
154
|
|
|
159
155
|
// Signed in on the screen or with the code on another computer, whichever came first; or setup stopped from the
|
|
160
|
-
// Harness app (Remove Harness), which takes the background service with it.
|
|
161
|
-
|
|
156
|
+
// Harness app (Remove Harness), which takes the background service with it. `onCode` hears the code to compare each
|
|
157
|
+
// time a device starts approving this computer (setupMode.mjs).
|
|
158
|
+
async function untilSignedIn(onCode = () => {}) {
|
|
159
|
+
let shownCode = null;
|
|
162
160
|
for (;;) {
|
|
163
161
|
const status = await daemonRequest({ command: "status" }, 1_000).catch(
|
|
164
162
|
() => null
|
|
165
163
|
);
|
|
166
164
|
if (status && !status.setup) return "signed in";
|
|
165
|
+
if (status?.setup) {
|
|
166
|
+
const state = await daemonRequest(
|
|
167
|
+
{ command: "setup.state" },
|
|
168
|
+
1_000
|
|
169
|
+
).catch(() => null);
|
|
170
|
+
const code = state?.approvalCode ?? null;
|
|
171
|
+
if (code && code !== shownCode) onCode(code);
|
|
172
|
+
shownCode = code;
|
|
173
|
+
}
|
|
174
|
+
// While setup hands over to the daemon proper, nothing answers for a moment. On a computer with no service file to
|
|
175
|
+
// look at (no systemd) that read as the person stopping setup, and told them Harness was off a computer it runs on.
|
|
176
|
+
if (!status && readConfig(paths.config, {}).token) return "signed in";
|
|
167
177
|
if (!status && !serviceRunning()) return "stopped";
|
|
168
178
|
await new Promise((resolve) => setTimeout(resolve, 1_000));
|
|
169
179
|
}
|
|
@@ -232,7 +242,7 @@ async function connect() {
|
|
|
232
242
|
);
|
|
233
243
|
|
|
234
244
|
const pairOrigin = origin();
|
|
235
|
-
let config =
|
|
245
|
+
let config = readConfig(paths.config, {});
|
|
236
246
|
const connection =
|
|
237
247
|
!has("--reconnect") && config.origin === pairOrigin && config.token
|
|
238
248
|
? await checkConnection(config, { version: VERSION })
|
|
@@ -245,9 +255,12 @@ async function connect() {
|
|
|
245
255
|
// Not signed in: the daemon starts without a token and holds a sign-in open for the screen or the code.
|
|
246
256
|
const endCtrlCStop = signedIn ? () => {} : stopSetupOnCtrlC();
|
|
247
257
|
if (!signedIn) {
|
|
248
|
-
|
|
249
|
-
config
|
|
250
|
-
|
|
258
|
+
// Read again as it is written: an unreadable config.json stops setup instead of being replaced.
|
|
259
|
+
updateConfig(paths.config, (current) => {
|
|
260
|
+
const { token: _dropped, ...rest } = current;
|
|
261
|
+
config = { ...rest, origin: pairOrigin };
|
|
262
|
+
return config;
|
|
263
|
+
});
|
|
251
264
|
}
|
|
252
265
|
|
|
253
266
|
// The persistent runtime is version-pinned, so the agents the person already chose are pointed at this release; a
|
|
@@ -264,17 +277,24 @@ async function connect() {
|
|
|
264
277
|
);
|
|
265
278
|
const states = configureAgents({ runtimeRoot, selected: chosen });
|
|
266
279
|
for (const agent of chosen) confirmAgentBinary(agent);
|
|
267
|
-
config
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
...config
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
280
|
+
updateConfig(paths.config, (current) => {
|
|
281
|
+
config = {
|
|
282
|
+
...current,
|
|
283
|
+
version: VERSION,
|
|
284
|
+
runtimeRoot,
|
|
285
|
+
...modelsWanted(config),
|
|
286
|
+
agentStates: {
|
|
287
|
+
...config.agentStates,
|
|
288
|
+
...Object.fromEntries(states.map((state) => [state.agent, state])),
|
|
289
|
+
},
|
|
290
|
+
agentWiring: {
|
|
291
|
+
...config.agentWiring,
|
|
292
|
+
...wiringOf(states, runtimeRoot),
|
|
293
|
+
},
|
|
294
|
+
swarmAgents: config.swarmAgents ?? [],
|
|
295
|
+
};
|
|
296
|
+
return config;
|
|
297
|
+
});
|
|
278
298
|
// The app goes in before the background service, so the service starts through the app's launcher from the first:
|
|
279
299
|
// started by Node, macOS announced it as "Software from Node.js Foundation" (seen November 3).
|
|
280
300
|
const where = whereSetupShows(readScreenFacts({ table }));
|
|
@@ -282,12 +302,13 @@ async function connect() {
|
|
|
282
302
|
if (!signedIn && onScreen)
|
|
283
303
|
await setupDesktop({ sourceRoot: SOURCE_ROOT }).catch(() => null);
|
|
284
304
|
const service = installService({ runtimeRoot });
|
|
285
|
-
// The Harness extension in this computer's browsers
|
|
305
|
+
// The Harness extension in this computer's browsers hears this daemon by itself, so it can open a Harness page
|
|
306
|
+
// for work that waits on one.
|
|
286
307
|
try {
|
|
287
308
|
installNativeHost({ runtimeRoot });
|
|
288
309
|
} catch (error) {
|
|
289
310
|
ui.warn(
|
|
290
|
-
`The extension cannot
|
|
311
|
+
`The Harness extension cannot hear this computer by itself (${error.message}). Your browsers still reach it once they are on your device list.`
|
|
291
312
|
);
|
|
292
313
|
}
|
|
293
314
|
// Only the agents the person chose are set up here; the rest wait for the Harness app, so they are not failures.
|
|
@@ -359,7 +380,11 @@ async function connect() {
|
|
|
359
380
|
);
|
|
360
381
|
const waiting = ui.spinner();
|
|
361
382
|
waiting.start("Waiting for you to sign in");
|
|
362
|
-
const ended = await untilSignedIn()
|
|
383
|
+
const ended = await untilSignedIn((approvalCode) =>
|
|
384
|
+
waiting.message(
|
|
385
|
+
`Connect this computer only if your browser shows ${pc.bold(approvalCode)}`
|
|
386
|
+
)
|
|
387
|
+
);
|
|
363
388
|
endCtrlCStop();
|
|
364
389
|
if (ended === "stopped") {
|
|
365
390
|
waiting.stop("Setup stopped in the Harness app");
|
|
@@ -414,6 +439,21 @@ async function desktop() {
|
|
|
414
439
|
}
|
|
415
440
|
}
|
|
416
441
|
|
|
442
|
+
// What `status` says about npm's newest release, with the command that updates each computer behind it.
|
|
443
|
+
function updateLines(release) {
|
|
444
|
+
if (!release?.latest) return [];
|
|
445
|
+
if (!release.behind.length)
|
|
446
|
+
return [`update: none, ${release.latest} is the newest`];
|
|
447
|
+
return release.behind.map((computer) => {
|
|
448
|
+
const name = computer.here ? "this computer" : computer.label;
|
|
449
|
+
const runs = computer.version ?? "an older version";
|
|
450
|
+
const command = computer.here
|
|
451
|
+
? relayCommand("upgrade")
|
|
452
|
+
: relayCommand(`machines update ${JSON.stringify(computer.label)}`);
|
|
453
|
+
return `update: ${release.latest} is out and ${name} runs ${runs}. Update with: ${command}`;
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
|
|
417
457
|
async function status() {
|
|
418
458
|
const fallback = readJson(paths.status, null);
|
|
419
459
|
let current;
|
|
@@ -442,6 +482,7 @@ async function status() {
|
|
|
442
482
|
console.log(
|
|
443
483
|
`this computer: ${machine.label}, ${machine.role === "worker" ? `a worker${machine.home ? ` for ${machine.home.label} (${machine.home.connected ? "online" : "offline"}${machine.home.confirmed ? "" : `, not confirmed yet: ${relayCommand()} machines`})` : ""}${machine.waiting ? `, ${machine.waiting} waiting to send` : ""}` : "home, holds the board"}`
|
|
444
484
|
);
|
|
485
|
+
for (const line of updateLines(current.release)) console.log(line);
|
|
445
486
|
console.log(
|
|
446
487
|
`history: ${current.indexing ? "indexing" : "ready"}${current.lastIndexedAt ? ` · last scan ${current.lastIndexedAt}` : ""}`
|
|
447
488
|
);
|
|
@@ -603,7 +644,7 @@ async function watch() {
|
|
|
603
644
|
|
|
604
645
|
async function doctor() {
|
|
605
646
|
console.log(`tryharness ${VERSION}`);
|
|
606
|
-
const config =
|
|
647
|
+
const config = readConfig(paths.config, {});
|
|
607
648
|
console.log(
|
|
608
649
|
`pairing: ${{ ok: "valid", rejected: "missing or invalid", unreachable: "kept (Harness did not answer)" }[await checkConnection(config, { version: VERSION })]}`
|
|
609
650
|
);
|
|
@@ -642,14 +683,16 @@ async function sync() {
|
|
|
642
683
|
async function notify() {
|
|
643
684
|
const mode = argv[0];
|
|
644
685
|
if (!["on", "off"].includes(mode)) {
|
|
645
|
-
const config =
|
|
686
|
+
const config = readConfig(paths.config, {});
|
|
646
687
|
console.log(
|
|
647
688
|
`desktop notifications: ${config.notifications === false ? "off" : "on"} (tryharness notify on|off)`
|
|
648
689
|
);
|
|
649
690
|
return;
|
|
650
691
|
}
|
|
651
|
-
|
|
652
|
-
|
|
692
|
+
updateConfig(paths.config, (config) => ({
|
|
693
|
+
...config,
|
|
694
|
+
notifications: mode === "on",
|
|
695
|
+
}));
|
|
653
696
|
console.log(
|
|
654
697
|
`desktop notifications ${mode}. The daemon picks this up on its next change.`
|
|
655
698
|
);
|
|
@@ -657,7 +700,7 @@ async function notify() {
|
|
|
657
700
|
|
|
658
701
|
async function usageTotals() {
|
|
659
702
|
const mode = argv[0];
|
|
660
|
-
const config =
|
|
703
|
+
const config = readConfig(paths.config, {});
|
|
661
704
|
if (!["on", "off"].includes(mode)) {
|
|
662
705
|
console.log(
|
|
663
706
|
`usage totals: ${config.usageTotals === false ? "off" : "on"} (tryharness usage-totals on|off)\n` +
|
|
@@ -665,7 +708,10 @@ async function usageTotals() {
|
|
|
665
708
|
);
|
|
666
709
|
return;
|
|
667
710
|
}
|
|
668
|
-
|
|
711
|
+
updateConfig(paths.config, (saved) => ({
|
|
712
|
+
...saved,
|
|
713
|
+
usageTotals: mode === "on",
|
|
714
|
+
}));
|
|
669
715
|
console.log(
|
|
670
716
|
mode === "on"
|
|
671
717
|
? "usage totals on. Days from today are sent once they end."
|
|
@@ -673,43 +719,82 @@ async function usageTotals() {
|
|
|
673
719
|
);
|
|
674
720
|
}
|
|
675
721
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
)
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
722
|
+
// Friends (docs/jam-plan.md J1): nothing starts between two people until they are friends. The person adds one by
|
|
723
|
+
// their name; the other accepts in Harness, and each computer pins the other's key.
|
|
724
|
+
const FRIEND_USAGE =
|
|
725
|
+
"usage: tryharness friend add <handle> | friend list | friend remove <handle>";
|
|
726
|
+
const handleArg = (value, usage) => {
|
|
727
|
+
const handle = String(value || "")
|
|
728
|
+
.trim()
|
|
729
|
+
.toLowerCase()
|
|
730
|
+
.replace(/^@/, "");
|
|
731
|
+
if (!/^[a-z0-9][a-z0-9-]{2,19}$/.test(handle)) throw new Error(usage);
|
|
732
|
+
return handle;
|
|
733
|
+
};
|
|
734
|
+
const asPerson = async (request) => {
|
|
735
|
+
const response = await daemonRequest({ agent: "user", ...request }, 20_000);
|
|
736
|
+
if (!response.ok) throw new Error(response.error || "Harness refused it");
|
|
737
|
+
return response;
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
async function friend() {
|
|
741
|
+
const sub = argv[0];
|
|
742
|
+
if (sub === "add") {
|
|
743
|
+
const handle = handleArg(argv[1], FRIEND_USAGE);
|
|
744
|
+
const { thread } = await asPerson({
|
|
745
|
+
command: "board.relay.friend",
|
|
746
|
+
handle,
|
|
747
|
+
});
|
|
748
|
+
console.log(
|
|
749
|
+
["accepted", "accepted_pending"].includes(thread?.status)
|
|
750
|
+
? `You and ${handle} are friends.`
|
|
751
|
+
: `Asked ${handle} to be your friend. Once they accept, each of your computers pins the other's key: compare it with them once (${relayCommand()} peers).`
|
|
752
|
+
);
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
if (sub === "remove") {
|
|
756
|
+
const handle = handleArg(argv[1], FRIEND_USAGE);
|
|
757
|
+
await asPerson({ command: "board.relay.unfriend", handle });
|
|
758
|
+
console.log(`You and ${handle} are no longer friends.`);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (sub !== undefined && sub !== "list") throw new Error(FRIEND_USAGE);
|
|
762
|
+
const listed = await asPerson({ command: "board.relay.list" });
|
|
763
|
+
if (!listed.connected)
|
|
764
|
+
console.log("Harness is out of reach; this is what this computer knows.");
|
|
765
|
+
for (const request of listed.requests.incoming)
|
|
766
|
+
console.log(
|
|
767
|
+
`${request.handle.padEnd(20)} asked to be your friend; answer it in Harness`
|
|
768
|
+
);
|
|
769
|
+
for (const request of listed.requests.sent)
|
|
770
|
+
console.log(`${request.handle.padEnd(20)} asked; waiting for them`);
|
|
771
|
+
for (const friend of listed.friends)
|
|
772
|
+
console.log(
|
|
773
|
+
`${friend.handle.padEnd(20)} ${friend.keyChanged ? `key changed: ${relayCommand()} peers trust ${friend.handle}` : friend.fingerprint ? `key ${friend.fingerprint}` : "waiting for their computer's key"}`
|
|
774
|
+
);
|
|
775
|
+
if (
|
|
776
|
+
!listed.friends.length &&
|
|
777
|
+
!listed.requests.incoming.length &&
|
|
778
|
+
!listed.requests.sent.length
|
|
779
|
+
)
|
|
780
|
+
console.log(
|
|
781
|
+
`No friends yet. Add one by their name: ${relayCommand()} friend add <handle>`
|
|
782
|
+
);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// A block drops that person's friend requests unseen and ends the friendship; unblocking lets them ask again.
|
|
786
|
+
async function block(on) {
|
|
787
|
+
const usage = `usage: tryharness ${on ? "block" : "unblock"} <handle>`;
|
|
788
|
+
const handle = handleArg(argv[0], usage);
|
|
789
|
+
await asPerson({
|
|
790
|
+
command: "board.relay.network",
|
|
791
|
+
op: on ? "block" : "unblock",
|
|
792
|
+
handle,
|
|
793
|
+
});
|
|
709
794
|
console.log(
|
|
710
|
-
|
|
711
|
-
? `
|
|
712
|
-
: `
|
|
795
|
+
on
|
|
796
|
+
? `Blocked ${handle}. Their friend requests go nowhere, and any friendship with them ended.`
|
|
797
|
+
: `Unblocked ${handle}. They can send you a friend request again.`
|
|
713
798
|
);
|
|
714
799
|
}
|
|
715
800
|
|
|
@@ -806,6 +891,94 @@ async function steer() {
|
|
|
806
891
|
}
|
|
807
892
|
|
|
808
893
|
// What the agents on this computer are running now, with what to type to follow or steer each.
|
|
894
|
+
// A version of a file Harness kept when another's write replaced it (senseCall.mjs), put back. What is there now is kept
|
|
895
|
+
// in turn, so putting one back can be undone the same way.
|
|
896
|
+
async function restore() {
|
|
897
|
+
const [id, file] = argv;
|
|
898
|
+
if (!id || !file)
|
|
899
|
+
throw new Error(
|
|
900
|
+
`name a kept version and a file: ${relayCommand()} restore <id> <file>`
|
|
901
|
+
);
|
|
902
|
+
const { restoreVersion } = await import("./lib/senseCall.mjs");
|
|
903
|
+
const put = restoreVersion(id, file);
|
|
904
|
+
if (!put.ok) throw new Error(put.error);
|
|
905
|
+
console.log(
|
|
906
|
+
put.replaced
|
|
907
|
+
? `Put ${file} back. What was there is kept: ${relayCommand()} restore ${put.replaced.slice(0, 12)} ${file} brings it back.`
|
|
908
|
+
: `Put ${file} back.`
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
// What the agents wished they could sense: asked for with the wish tool, or checked again and again (each poll is a
|
|
913
|
+
// sense they lacked), most wanted first (docs/senses-plan.md S4.7).
|
|
914
|
+
async function wishes() {
|
|
915
|
+
const answer = await daemonRequest({
|
|
916
|
+
command: "senses.wishes",
|
|
917
|
+
agent: "user",
|
|
918
|
+
});
|
|
919
|
+
if (!answer.ok) throw new Error(answer.error || "wishes unavailable");
|
|
920
|
+
if (!answer.wishes.length) {
|
|
921
|
+
console.log("No agent has wished for a sense yet.");
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
for (const wish of answer.wishes)
|
|
925
|
+
console.log(
|
|
926
|
+
`${wish.count}× ${wish.sense}${wish.why ? ` (${wish.why})` : ""}\n ${wish.kind === "asked" ? "asked by" : "polled by"} ${wish.agents.join(", ")}, last ${new Date(wish.last).toLocaleString()}`
|
|
927
|
+
);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// Where agents pointed the person: a file and line, or a page, with why (docs/senses-plan.md S4.7e).
|
|
931
|
+
async function pointed() {
|
|
932
|
+
const answer = await daemonRequest({
|
|
933
|
+
command: "senses.pointers",
|
|
934
|
+
agent: "user",
|
|
935
|
+
});
|
|
936
|
+
if (!answer.ok) throw new Error(answer.error || "pointers unavailable");
|
|
937
|
+
if (!answer.pointers.length) {
|
|
938
|
+
console.log("No agent has pointed you at anything.");
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
for (const pointer of answer.pointers)
|
|
942
|
+
console.log(
|
|
943
|
+
`${new Date(pointer.at).toLocaleString()} ${pointer.by}: ${pointer.url ?? `${pointer.file}${pointer.line ? `:${pointer.line}` : ""}`}${pointer.why ? `\n ${pointer.why}` : ""}`
|
|
944
|
+
);
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
// What reflexes hold or pause now (docs/senses-plan.md S5), and letting one go with a reason, which is kept.
|
|
948
|
+
async function reflexesCommand() {
|
|
949
|
+
if (argv[0] === "release") {
|
|
950
|
+
const id = argv[1];
|
|
951
|
+
const at = argv.indexOf("--reason");
|
|
952
|
+
const reason = at >= 0 ? argv.slice(at + 1).join(" ") : "";
|
|
953
|
+
if (!id)
|
|
954
|
+
throw new Error(
|
|
955
|
+
`name it: ${relayCommand()} reflex release <id> --reason "<why>"`
|
|
956
|
+
);
|
|
957
|
+
const answer = await daemonRequest({
|
|
958
|
+
command: "senses.release",
|
|
959
|
+
agent: "user",
|
|
960
|
+
id,
|
|
961
|
+
reason,
|
|
962
|
+
});
|
|
963
|
+
if (!answer.ok) throw new Error(answer.error || "could not let it go");
|
|
964
|
+
console.log("Let go.");
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
const answer = await daemonRequest({
|
|
968
|
+
command: "senses.reflexes",
|
|
969
|
+
agent: "user",
|
|
970
|
+
});
|
|
971
|
+
if (!answer.ok) throw new Error(answer.error || "reflexes unavailable");
|
|
972
|
+
if (!answer.reflexes.length) {
|
|
973
|
+
console.log("No reflex holds or pauses anything now.");
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
for (const what of answer.reflexes)
|
|
977
|
+
console.log(
|
|
978
|
+
`${what.id} ${what.kind === "pause" ? `paused \`${what.command}\` (process ${what.pid})` : `holds ${what.sessions.length} session${what.sessions.length === 1 ? "" : "s"}`}: ${what.why}\n since ${new Date(what.at).toLocaleString()}; let go with ${relayCommand()} reflex release ${what.id} --reason "<why>"`
|
|
979
|
+
);
|
|
980
|
+
}
|
|
981
|
+
|
|
809
982
|
async function runs() {
|
|
810
983
|
const answer = await daemonRequest({ command: "runs.here", agent: "user" });
|
|
811
984
|
if (!answer.ok) throw new Error(answer.error || "runs unavailable");
|
|
@@ -822,6 +995,89 @@ async function runs() {
|
|
|
822
995
|
);
|
|
823
996
|
}
|
|
824
997
|
|
|
998
|
+
// The person's devices: every browser, computer, phone and cloud computer on their signed list, read and changed from
|
|
999
|
+
// this computer (computerDevices.mjs). Removing one takes their keys from it.
|
|
1000
|
+
async function devices() {
|
|
1001
|
+
const [sub, ...rest] = argv;
|
|
1002
|
+
if (sub === "rename") {
|
|
1003
|
+
const [named, ...words] = rest;
|
|
1004
|
+
if (!named || !words.length)
|
|
1005
|
+
throw new Error('usage: tryharness devices rename <name> "<new name>"');
|
|
1006
|
+
const answer = await daemonRequest(
|
|
1007
|
+
{
|
|
1008
|
+
command: "devices.rename",
|
|
1009
|
+
agent: "user",
|
|
1010
|
+
device: named,
|
|
1011
|
+
label: words.join(" "),
|
|
1012
|
+
},
|
|
1013
|
+
30_000
|
|
1014
|
+
);
|
|
1015
|
+
if (!answer.ok) throw new Error(answer.error || "not renamed");
|
|
1016
|
+
console.log(`Renamed to ${answer.device.label}.`);
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
if (sub === "remove") {
|
|
1020
|
+
const named = rest.join(" ");
|
|
1021
|
+
if (!named) throw new Error("usage: tryharness devices remove <name>");
|
|
1022
|
+
const answer = await daemonRequest(
|
|
1023
|
+
{ command: "devices.remove", agent: "user", device: named },
|
|
1024
|
+
30_000
|
|
1025
|
+
);
|
|
1026
|
+
if (!answer.ok) throw new Error(answer.error || "not removed");
|
|
1027
|
+
console.log(
|
|
1028
|
+
answer.keysChanged
|
|
1029
|
+
? `Removed ${answer.device.label}. Your keys changed, so it opens nothing new; your friends follow the change by themselves.`
|
|
1030
|
+
: `Removed ${answer.device.label}. It no longer gets your keys; they change the next time one of your devices checks.`
|
|
1031
|
+
);
|
|
1032
|
+
if (answer.recoveryCode)
|
|
1033
|
+
console.log(
|
|
1034
|
+
`\nYour new recovery code (the old one no longer works). Write it down; it is shown only now:\n\n ${pc.bold(answer.recoveryCode)}\n`
|
|
1035
|
+
);
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
if (sub)
|
|
1039
|
+
throw new Error(
|
|
1040
|
+
'usage: tryharness devices [rename <name> "<new name>" | remove <name>]'
|
|
1041
|
+
);
|
|
1042
|
+
const answer = await daemonRequest({ command: "devices.list" }, 30_000);
|
|
1043
|
+
if (!answer.ok)
|
|
1044
|
+
throw new Error(answer.error || "your devices could not be read");
|
|
1045
|
+
const KIND = {
|
|
1046
|
+
browser: "browser",
|
|
1047
|
+
computer: "computer",
|
|
1048
|
+
phone: "phone",
|
|
1049
|
+
cloud: "cloud computer",
|
|
1050
|
+
};
|
|
1051
|
+
for (const device of answer.devices)
|
|
1052
|
+
console.log(
|
|
1053
|
+
`${device.deviceId.slice(0, 8)} ${device.label} ${pc.dim(KIND[device.kind] ?? device.kind)}${device.deviceId === answer.self ? pc.dim(" (this computer)") : ""}`
|
|
1054
|
+
);
|
|
1055
|
+
console.log(
|
|
1056
|
+
pc.dim(
|
|
1057
|
+
`\nRename one: ${relayCommand()} devices rename <name> "<new name>"\nRemove one: ${relayCommand()} devices remove <name>`
|
|
1058
|
+
)
|
|
1059
|
+
);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// The recovery code this computer made for the person, which opens their keys when every device of theirs is gone:
|
|
1063
|
+
// shown once, then forgotten here (computerDevices.mjs).
|
|
1064
|
+
async function recoveryCode() {
|
|
1065
|
+
const answer = await daemonRequest(
|
|
1066
|
+
{ command: "devices.recovery-code", agent: "user" },
|
|
1067
|
+
30_000
|
|
1068
|
+
);
|
|
1069
|
+
if (!answer.ok) throw new Error(answer.error || "not read");
|
|
1070
|
+
if (!answer.recovery) {
|
|
1071
|
+
console.log(
|
|
1072
|
+
"This computer has no recovery code waiting to be shown. Your recovery code was shown where it was made."
|
|
1073
|
+
);
|
|
1074
|
+
return;
|
|
1075
|
+
}
|
|
1076
|
+
console.log(
|
|
1077
|
+
`Your recovery code. Write it down; it is shown only now:\n\n ${pc.bold(answer.recovery.code)}\n`
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
|
|
825
1081
|
// The person's own computers: which one holds the board (home), the others that work through it, and the join code a
|
|
826
1082
|
// new one shows until the person types it on home.
|
|
827
1083
|
async function machines() {
|
|
@@ -837,7 +1093,38 @@ async function machines() {
|
|
|
837
1093
|
30_000
|
|
838
1094
|
);
|
|
839
1095
|
if (!response.ok) throw new Error(response.error || "not added");
|
|
840
|
-
|
|
1096
|
+
// This computer and the new one show one code: the person says whether it matches before anything is added.
|
|
1097
|
+
if (response.state === "compare") {
|
|
1098
|
+
if (!process.stdin.isTTY)
|
|
1099
|
+
throw new Error(
|
|
1100
|
+
"Comparing codes needs you at a terminal: run this again in one."
|
|
1101
|
+
);
|
|
1102
|
+
const { createInterface } = await import("node:readline/promises");
|
|
1103
|
+
const prompt = createInterface({
|
|
1104
|
+
input: process.stdin,
|
|
1105
|
+
output: process.stdout,
|
|
1106
|
+
});
|
|
1107
|
+
const said = await prompt.question(
|
|
1108
|
+
`Does ${response.machine || "the other computer"} show ${response.approvalCode}? (y/n) `
|
|
1109
|
+
);
|
|
1110
|
+
prompt.close();
|
|
1111
|
+
const matched = await daemonRequest(
|
|
1112
|
+
{
|
|
1113
|
+
command: "machines.match",
|
|
1114
|
+
agent: "user",
|
|
1115
|
+
id: response.id,
|
|
1116
|
+
matches: /^y(es)?$/i.test(said.trim()),
|
|
1117
|
+
},
|
|
1118
|
+
60_000
|
|
1119
|
+
);
|
|
1120
|
+
if (!matched.ok) throw new Error(matched.error || "not added");
|
|
1121
|
+
Object.assign(response, matched);
|
|
1122
|
+
}
|
|
1123
|
+
if (response.state === "declined")
|
|
1124
|
+
console.log(
|
|
1125
|
+
`${response.machine || "That computer"} was not added. If you did not start it, someone else may have its code.`
|
|
1126
|
+
);
|
|
1127
|
+
else if (response.state === "approved") console.log(response.note);
|
|
841
1128
|
else if (response.state === "waiting")
|
|
842
1129
|
console.log(
|
|
843
1130
|
`${response.machine || "The computer"} is connected to your account. It joins your swarm by itself as soon as it is online; ${relayCommand()} machines shows when it has.`
|
|
@@ -939,21 +1226,24 @@ async function machines() {
|
|
|
939
1226
|
);
|
|
940
1227
|
return;
|
|
941
1228
|
}
|
|
1229
|
+
// How each computer is reached (docs/one-link-plan.md L4.4): over the link between the two, which works without
|
|
1230
|
+
// Harness, else through Harness while it is online there.
|
|
942
1231
|
for (const machine of response.machines)
|
|
943
1232
|
console.log(
|
|
944
|
-
`${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.
|
|
1233
|
+
`${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.confirmed ? (machine.direct ? " reached directly" : machine.connected ? " reached through Harness" : "") : ""}${machine.linkBrokenSince ? ` link broken since ${new Date(machine.linkBrokenSince).toLocaleString([], { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" })}` : ""}${machine.fingerprint ? ` key ${machine.fingerprint}` : ""}${machine.agents?.length ? ` ${machine.agents.join(", ")}` : ""}`
|
|
945
1234
|
);
|
|
946
1235
|
}
|
|
947
1236
|
|
|
948
|
-
// The keys of
|
|
1237
|
+
// The keys of friends' computers, pinned when the friendship began, and this computer's own.
|
|
949
1238
|
async function peers() {
|
|
1239
|
+
if (argv[0] === "trust") return trustPeer(argv[1]);
|
|
950
1240
|
const response = await daemonRequest({ command: "relay.peers" });
|
|
951
1241
|
if (!response.ok)
|
|
952
1242
|
throw new Error(response.error || "the daemon could not list keys");
|
|
953
1243
|
console.log(`This computer: ${response.mine ?? "no key yet"}`);
|
|
954
1244
|
if (!response.peers.length) {
|
|
955
1245
|
console.log(
|
|
956
|
-
"No
|
|
1246
|
+
"No friends' computers yet. A friend's key is pinned when they accept, or when you accept them."
|
|
957
1247
|
);
|
|
958
1248
|
return;
|
|
959
1249
|
}
|
|
@@ -966,6 +1256,18 @@ async function peers() {
|
|
|
966
1256
|
);
|
|
967
1257
|
}
|
|
968
1258
|
|
|
1259
|
+
// `peers trust <handle>`: a friend's computer key changed (a new home, or theirs was disconnected), and the friendship
|
|
1260
|
+
// waits; this takes the key Harness now gives for them and shows its fingerprint to compare.
|
|
1261
|
+
async function trustPeer(handle) {
|
|
1262
|
+
if (!handle) throw new Error("usage: npx tryharness peers trust <handle>");
|
|
1263
|
+
const response = await daemonRequest({ command: "relay.trust", handle });
|
|
1264
|
+
if (!response.ok)
|
|
1265
|
+
throw new Error(response.error || "the daemon could not trust that key");
|
|
1266
|
+
console.log(
|
|
1267
|
+
`Now using ${response.handle}'s new key ${response.fingerprint}. Read it to them over a channel you trust; it should match what their npx tryharness peers shows as theirs.`
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
|
|
969
1271
|
// One line per section (its priority, name, source, whole size and what was sent), the budget decision, the session,
|
|
970
1272
|
// and for a dry run the brief itself.
|
|
971
1273
|
function printBrief({ task, agent, report, prompt }, dryRun) {
|
|
@@ -1117,28 +1419,16 @@ async function board() {
|
|
|
1117
1419
|
);
|
|
1118
1420
|
return;
|
|
1119
1421
|
}
|
|
1120
|
-
if (sub === "
|
|
1422
|
+
if (sub === "end") {
|
|
1121
1423
|
const id = String(argv[argv.indexOf(sub) + 1] || "");
|
|
1122
|
-
const response =
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
on: argv[argv.indexOf(sub) + 2] !== "off",
|
|
1129
|
-
})
|
|
1130
|
-
: await daemonRequest({
|
|
1131
|
-
command: "board.thread.end",
|
|
1132
|
-
agent,
|
|
1133
|
-
id,
|
|
1134
|
-
outcome: arg("--outcome", ""),
|
|
1135
|
-
});
|
|
1424
|
+
const response = await daemonRequest({
|
|
1425
|
+
command: "board.thread.end",
|
|
1426
|
+
agent,
|
|
1427
|
+
id,
|
|
1428
|
+
outcome: arg("--outcome", ""),
|
|
1429
|
+
});
|
|
1136
1430
|
if (!response.ok) throw new Error(response.error || `${sub} failed`);
|
|
1137
|
-
console.log(
|
|
1138
|
-
sub === "auto"
|
|
1139
|
-
? `Auto-send ${response.thread.auto_send ? "on" : "off"} for ${id.slice(0, 8)}. It turns off again if a reply is flagged.`
|
|
1140
|
-
: `Thread ended; the other side is told.`
|
|
1141
|
-
);
|
|
1431
|
+
console.log(`Conversation ended; your friend is told.`);
|
|
1142
1432
|
return;
|
|
1143
1433
|
}
|
|
1144
1434
|
if (sub === "context") {
|
|
@@ -1366,7 +1656,7 @@ async function board() {
|
|
|
1366
1656
|
});
|
|
1367
1657
|
if (thread.ok) {
|
|
1368
1658
|
console.log(
|
|
1369
|
-
`\
|
|
1659
|
+
`\nmessages with ${thread.thread.with_agent.split("/")[0]}${thread.thread.closed_at ? " (ended)" : ""}`
|
|
1370
1660
|
);
|
|
1371
1661
|
for (const m of thread.messages)
|
|
1372
1662
|
console.log(
|
|
@@ -1510,24 +1800,6 @@ async function goal() {
|
|
|
1510
1800
|
);
|
|
1511
1801
|
return;
|
|
1512
1802
|
}
|
|
1513
|
-
if (sub === "invite") {
|
|
1514
|
-
const response = await daemonRequest(
|
|
1515
|
-
{
|
|
1516
|
-
command: "board.goal.invite",
|
|
1517
|
-
agent,
|
|
1518
|
-
id,
|
|
1519
|
-
to: String(argv[2] || ""),
|
|
1520
|
-
readable: has("--readable"),
|
|
1521
|
-
},
|
|
1522
|
-
20_000
|
|
1523
|
-
);
|
|
1524
|
-
if (!response.ok)
|
|
1525
|
-
throw new Error(response.error || "the invitation was not sent");
|
|
1526
|
-
console.log(
|
|
1527
|
-
`Invited ${argv[2]} as a guest (thread ${String(response.threadId || "").slice(0, 8)}, ${response.status || "requested"}). They see only posts shared with guests, and their replies land in the room.`
|
|
1528
|
-
);
|
|
1529
|
-
return;
|
|
1530
|
-
}
|
|
1531
1803
|
if (sub === "stop" || sub === "resume" || sub === "folder") {
|
|
1532
1804
|
const response = await daemonRequest({
|
|
1533
1805
|
command: `board.goal.${sub}`,
|
|
@@ -1548,7 +1820,7 @@ async function goal() {
|
|
|
1548
1820
|
return;
|
|
1549
1821
|
}
|
|
1550
1822
|
throw new Error(
|
|
1551
|
-
"usage: tryharness goal [list | set --objective <text> [--brief <text>] [--team a,b] [--facilitator <agent>] [--workspace <dir>] [--max-posts n] [--max-wakes n] | show <id> | stop <id> | resume <id> [--max-posts n] | folder <id> <dir>
|
|
1823
|
+
"usage: tryharness goal [list | set --objective <text> [--brief <text>] [--team a,b] [--facilitator <agent>] [--workspace <dir>] [--max-posts n] [--max-wakes n] | show <id> | stop <id> | resume <id> [--max-posts n] | folder <id> <dir>]"
|
|
1552
1824
|
);
|
|
1553
1825
|
}
|
|
1554
1826
|
|
|
@@ -1679,6 +1951,7 @@ async function swarm() {
|
|
|
1679
1951
|
console.log(
|
|
1680
1952
|
`The dispatcher is ${describeDispatcher(response.setting, nameOf)}.`
|
|
1681
1953
|
);
|
|
1954
|
+
if (response.ready === false) console.log(dispatcherNotReady(response));
|
|
1682
1955
|
if (!kind)
|
|
1683
1956
|
console.log(
|
|
1684
1957
|
"To change it: tryharness swarm dispatcher local [your-model.gguf] | surplus <model> | agent <agent> [model] | endpoint <url> [model] (models lists the Surplus ones)"
|
|
@@ -1829,7 +2102,6 @@ async function room() {
|
|
|
1829
2102
|
id: String(words[1] || ""),
|
|
1830
2103
|
text: words.slice(2).join(" "),
|
|
1831
2104
|
ask,
|
|
1832
|
-
shareWithGuests: has("--guests"),
|
|
1833
2105
|
});
|
|
1834
2106
|
if (!response.ok) throw new Error(response.error || "post failed");
|
|
1835
2107
|
console.log(
|
|
@@ -1942,19 +2214,19 @@ function logs() {
|
|
|
1942
2214
|
// config: the agents the boot script installed are connected to the swarm the first time, as setup connects them, and
|
|
1943
2215
|
// then the daemon runs from the installed package itself.
|
|
1944
2216
|
async function cloudStart() {
|
|
1945
|
-
const config =
|
|
2217
|
+
const config = readConfig(paths.config, {});
|
|
1946
2218
|
if (!config.cloud || !config.token)
|
|
1947
2219
|
throw new Error("this is not an enrolled cloud computer");
|
|
1948
2220
|
if (!config.agentStates) {
|
|
1949
2221
|
const states = configureAgents({ runtimeRoot: SOURCE_ROOT });
|
|
1950
|
-
|
|
1951
|
-
...
|
|
2222
|
+
updateConfig(paths.config, (saved) => ({
|
|
2223
|
+
...saved,
|
|
1952
2224
|
version: VERSION,
|
|
1953
2225
|
runtimeRoot: SOURCE_ROOT,
|
|
1954
2226
|
agentStates: Object.fromEntries(
|
|
1955
2227
|
states.map((state) => [state.agent, state])
|
|
1956
2228
|
),
|
|
1957
|
-
});
|
|
2229
|
+
}));
|
|
1958
2230
|
}
|
|
1959
2231
|
const { startDaemon } = await import("./lib/daemon.mjs");
|
|
1960
2232
|
await startDaemon();
|
|
@@ -2155,7 +2427,7 @@ async function memoryCommand() {
|
|
|
2155
2427
|
}
|
|
2156
2428
|
|
|
2157
2429
|
async function agents() {
|
|
2158
|
-
const config =
|
|
2430
|
+
const config = readConfig(paths.config, {});
|
|
2159
2431
|
const [sub, agent] = argv;
|
|
2160
2432
|
// Who is in the swarm, and putting agents in or taking them out (lineup.mjs).
|
|
2161
2433
|
if (!sub) {
|
|
@@ -2333,7 +2605,7 @@ async function agents() {
|
|
|
2333
2605
|
ui.outro("Done.");
|
|
2334
2606
|
}
|
|
2335
2607
|
|
|
2336
|
-
//
|
|
2608
|
+
// A long address makes a large code: drawn two characters per module it
|
|
2337
2609
|
// was 130 columns and wrapped into noise. Half blocks put two rows in one line at one column per
|
|
2338
2610
|
// module (61 columns), and fixed black and white keep it scannable on light and dark themes.
|
|
2339
2611
|
async function terminalQr(text) {
|
|
@@ -2353,46 +2625,31 @@ async function terminalQr(text) {
|
|
|
2353
2625
|
|
|
2354
2626
|
async function phone() {
|
|
2355
2627
|
const sub = argv[0] || "pair";
|
|
2628
|
+
// A phone joins like any of the person's devices (device redesign 1.8g): it signs in to Harness and another of
|
|
2629
|
+
// their devices approves it by comparing codes. The code drawn here holds only Harness's address, no key.
|
|
2356
2630
|
if (sub === "pair") {
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2359
|
-
throw new Error(
|
|
2360
|
-
response.error || "the daemon could not make a pairing code"
|
|
2361
|
-
);
|
|
2362
|
-
const qr = await terminalQr(response.url);
|
|
2631
|
+
const address = `${origin()}/m`;
|
|
2632
|
+
const qr = await terminalQr(address);
|
|
2363
2633
|
console.log(
|
|
2364
|
-
"Scan this with your phone's camera.
|
|
2634
|
+
"Scan this with your phone's camera. It opens Harness there: sign in, then approve the phone from a device you already use by comparing the codes both show.\n"
|
|
2365
2635
|
);
|
|
2366
2636
|
console.log(qr.lines.join("\n"));
|
|
2367
2637
|
if (process.stdout.columns && process.stdout.columns < qr.width)
|
|
2368
2638
|
console.log(
|
|
2369
|
-
`\nThis window is narrower than the code (${qr.width} columns), so it may not scan.
|
|
2370
|
-
);
|
|
2371
|
-
if (has("--link"))
|
|
2372
|
-
console.log(
|
|
2373
|
-
`\n${response.url}\n\nThis link is the pairing secret: open it only on your own phone.`
|
|
2639
|
+
`\nThis window is narrower than the code (${qr.width} columns), so it may not scan. Or open ${address} on your phone.`
|
|
2374
2640
|
);
|
|
2375
|
-
console.log(
|
|
2376
|
-
"\nThe phone talks to this computer through Harness, and Harness only relays sealed messages it cannot read."
|
|
2377
|
-
);
|
|
2378
2641
|
return;
|
|
2379
2642
|
}
|
|
2380
|
-
// What waits for the person on any of their computers: a
|
|
2381
|
-
// `swarm` is from a daemon that keeps the swarm's list; an older one lists only this computer's
|
|
2643
|
+
// What waits for the person on any of their computers: a device an older release left waiting for them.
|
|
2644
|
+
// `swarm` is from a daemon that keeps the swarm's list; an older one lists only this computer's devices.
|
|
2382
2645
|
const listed = () => daemonRequest({ command: "phone.list" });
|
|
2383
2646
|
const swarmOf = (response) =>
|
|
2384
|
-
response.swarm ??
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
...(response.phones ?? []).map((p) => ({
|
|
2391
|
-
...p,
|
|
2392
|
-
at: p.paired_at,
|
|
2393
|
-
state: p.revoked_at ? "removed" : "listed",
|
|
2394
|
-
})),
|
|
2395
|
-
];
|
|
2647
|
+
response.swarm ??
|
|
2648
|
+
(response.phones ?? []).map((p) => ({
|
|
2649
|
+
...p,
|
|
2650
|
+
at: p.paired_at,
|
|
2651
|
+
state: p.revoked_at ? "removed" : "listed",
|
|
2652
|
+
}));
|
|
2396
2653
|
const where = (entry) =>
|
|
2397
2654
|
entry.computerLabel ? ` on ${entry.computerLabel}` : "";
|
|
2398
2655
|
const pick = (entries, prefix, none) => {
|
|
@@ -2423,15 +2680,10 @@ async function phone() {
|
|
|
2423
2680
|
allow: sub === "allow",
|
|
2424
2681
|
});
|
|
2425
2682
|
if (!answer.ok) throw new Error(answer.error);
|
|
2426
|
-
const browser = entry.kind === "ask";
|
|
2427
2683
|
console.log(
|
|
2428
2684
|
sub === "allow"
|
|
2429
|
-
?
|
|
2430
|
-
|
|
2431
|
-
: `${entry.label}${where(entry)} works now. See your devices: npx tryharness phone list`
|
|
2432
|
-
: browser
|
|
2433
|
-
? `${entry.label} was not linked. Harness pages will not ask again today; npx tryharness link links a browser any time.`
|
|
2434
|
-
: `${entry.label}${where(entry)} is disconnected and never worked.`
|
|
2685
|
+
? `${entry.label}${where(entry)} works now. See your devices: npx tryharness phone list`
|
|
2686
|
+
: `${entry.label}${where(entry)} is disconnected and never worked.`
|
|
2435
2687
|
);
|
|
2436
2688
|
return;
|
|
2437
2689
|
}
|
|
@@ -2439,17 +2691,10 @@ async function phone() {
|
|
|
2439
2691
|
const response = await listed();
|
|
2440
2692
|
if (!response.ok)
|
|
2441
2693
|
throw new Error(response.error || "the daemon could not list phones");
|
|
2442
|
-
const
|
|
2443
|
-
for (const entry of entries.filter(
|
|
2444
|
-
(item) => item.kind === "ask" && item.state === "waiting"
|
|
2445
|
-
))
|
|
2446
|
-
console.log(
|
|
2447
|
-
`${entry.label} asks to link to ${entry.computerLabel ?? "this computer"}. Allow it: npx tryharness phone allow ${entry.id.slice(0, 8)} (or deny)`
|
|
2448
|
-
);
|
|
2449
|
-
const devices = entries.filter((item) => item.kind !== "ask");
|
|
2694
|
+
const devices = swarmOf(response);
|
|
2450
2695
|
if (!devices.length) {
|
|
2451
2696
|
console.log(
|
|
2452
|
-
`
|
|
2697
|
+
`No device has reached your computers yet. Add a phone: ${relayCommand()} phone pair. A browser reaches them once you open Harness in it and approve it from a device you already use.`
|
|
2453
2698
|
);
|
|
2454
2699
|
return;
|
|
2455
2700
|
}
|
|
@@ -2476,9 +2721,7 @@ async function phone() {
|
|
|
2476
2721
|
const prefix = String(argv[1] || "");
|
|
2477
2722
|
if (!prefix) throw new Error("usage: tryharness phone revoke <phone id>");
|
|
2478
2723
|
const device = pick(
|
|
2479
|
-
swarmOf(await listed()).filter(
|
|
2480
|
-
(entry) => entry.kind !== "ask" && entry.state !== "removed"
|
|
2481
|
-
),
|
|
2724
|
+
swarmOf(await listed()).filter((entry) => entry.state !== "removed"),
|
|
2482
2725
|
prefix,
|
|
2483
2726
|
"no phone with that id (see: tryharness phone list)"
|
|
2484
2727
|
);
|
|
@@ -2493,13 +2736,10 @@ async function phone() {
|
|
|
2493
2736
|
return;
|
|
2494
2737
|
}
|
|
2495
2738
|
throw new Error(
|
|
2496
|
-
"usage: tryharness phone [pair
|
|
2739
|
+
"usage: tryharness phone [pair | list | allow | deny | revoke <phone id>]"
|
|
2497
2740
|
);
|
|
2498
2741
|
}
|
|
2499
2742
|
|
|
2500
|
-
// A browser joins the way a phone does, by a one-time link this machine makes: its secret and this
|
|
2501
|
-
// machine's key ride in the part of the address no server receives. Once one browser is paired,
|
|
2502
|
-
// this machine answers Harness's calls for the person's board, sessions and runs only sealed.
|
|
2503
2743
|
function openUrl(url) {
|
|
2504
2744
|
const [command, args] =
|
|
2505
2745
|
process.platform === "darwin"
|
|
@@ -2516,31 +2756,6 @@ function openUrl(url) {
|
|
|
2516
2756
|
return false;
|
|
2517
2757
|
}
|
|
2518
2758
|
}
|
|
2519
|
-
async function browserLink() {
|
|
2520
|
-
const response = await daemonRequest({
|
|
2521
|
-
command: "phone.offer",
|
|
2522
|
-
kind: "browser",
|
|
2523
|
-
});
|
|
2524
|
-
if (!response.ok)
|
|
2525
|
-
throw new Error(response.error || "the daemon could not make a link");
|
|
2526
|
-
return {
|
|
2527
|
-
url: response.url,
|
|
2528
|
-
// openUrl cannot tell whether a browser opened (a missing xdg-open fails later), so a computer with none prints it.
|
|
2529
|
-
opened: !has("--print") && canOpenBrowser() && openUrl(response.url),
|
|
2530
|
-
};
|
|
2531
|
-
}
|
|
2532
|
-
async function link() {
|
|
2533
|
-
const { url, opened } = await browserLink();
|
|
2534
|
-
console.log(
|
|
2535
|
-
opened
|
|
2536
|
-
? "Opened Harness in your browser to connect it to this computer end to end. The link works once, for 10 minutes."
|
|
2537
|
-
: `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}`
|
|
2538
|
-
);
|
|
2539
|
-
console.log(
|
|
2540
|
-
"Harness then carries what your browser and this computer say to each other sealed, and cannot read it."
|
|
2541
|
-
);
|
|
2542
|
-
}
|
|
2543
|
-
|
|
2544
2759
|
// Approving Harness in T3 Code (lib/t3.mjs): then what you send your T3 Code sessions from Harness, in the desktop app or
|
|
2545
2760
|
// on your phone, goes straight into their threads. No T3 account; T3's page asks for a pairing code from its settings.
|
|
2546
2761
|
const t3Words = (access) =>
|
|
@@ -2551,6 +2766,119 @@ const t3Words = (access) =>
|
|
|
2551
2766
|
: access.state === "read"
|
|
2552
2767
|
? "Harness was approved in T3 Code to read only, so messages still wait for its sessions to pick them up. Approve it again with the access your threads run with: tryharness t3"
|
|
2553
2768
|
: "Harness's approval in T3 Code ran out. Approve it again: tryharness t3";
|
|
2769
|
+
// The Harness panel inside the Herdr app (a Herdr mod, assets/herdr-mod/harness): what it reads and does, as JSON, so
|
|
2770
|
+
// the panel holds no logic of its own. `install` copies the panel into Herdr's mods folder, at the person's command.
|
|
2771
|
+
async function herdr() {
|
|
2772
|
+
const sub = argv[0];
|
|
2773
|
+
const json = (value) => console.log(JSON.stringify(value));
|
|
2774
|
+
if (sub === "board") {
|
|
2775
|
+
const listed = await daemonRequest({
|
|
2776
|
+
command: "board.swarm.list",
|
|
2777
|
+
agent: "user",
|
|
2778
|
+
sessions: false,
|
|
2779
|
+
});
|
|
2780
|
+
if (!listed.ok) throw new Error(listed.error || "the swarm did not answer");
|
|
2781
|
+
json({
|
|
2782
|
+
threads: (listed.threads ?? []).map((thread) => ({
|
|
2783
|
+
id: thread.id,
|
|
2784
|
+
title: thread.view?.title ?? thread.title ?? thread.objective,
|
|
2785
|
+
line: thread.view?.line ?? null,
|
|
2786
|
+
state: thread.view?.state ?? thread.status ?? null,
|
|
2787
|
+
needsYou: (thread.view?.needsYou ?? []).length,
|
|
2788
|
+
working: (thread.working ?? []).map(nameOf),
|
|
2789
|
+
agents: (thread.agents ?? []).map(nameOf),
|
|
2790
|
+
folder: thread.folder ?? null,
|
|
2791
|
+
space: thread.herdrSpace ?? null,
|
|
2792
|
+
at: thread.updatedAt ?? null,
|
|
2793
|
+
})),
|
|
2794
|
+
});
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2797
|
+
// A thread's latest posts, oldest first, for the panel to show without leaving Herdr.
|
|
2798
|
+
if (sub === "read") {
|
|
2799
|
+
const id = argv[1];
|
|
2800
|
+
if (!id) throw new Error("usage: tryharness herdr read <thread>");
|
|
2801
|
+
const read = await daemonRequest({
|
|
2802
|
+
command: "board.swarm.read",
|
|
2803
|
+
agent: "user",
|
|
2804
|
+
id,
|
|
2805
|
+
});
|
|
2806
|
+
if (!read.ok) throw new Error(read.error || "no such thread");
|
|
2807
|
+
const SHOWN = new Set(["post", "note", "question", "answer", "job"]);
|
|
2808
|
+
json({
|
|
2809
|
+
posts: (read.posts ?? [])
|
|
2810
|
+
.filter((post) => SHOWN.has(post.kind) && String(post.text).trim())
|
|
2811
|
+
.slice(-12)
|
|
2812
|
+
.map((post) => ({
|
|
2813
|
+
by: post.author === "user" ? "You" : nameOf(post.author),
|
|
2814
|
+
text: String(post.text).trim().slice(0, 600),
|
|
2815
|
+
at: post.created_at ?? null,
|
|
2816
|
+
})),
|
|
2817
|
+
});
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2820
|
+
if (sub === "start" || sub === "post") {
|
|
2821
|
+
const [target, ...words] = argv.slice(1);
|
|
2822
|
+
const text = words.join(" ").trim();
|
|
2823
|
+
if (!target || !text)
|
|
2824
|
+
throw new Error(
|
|
2825
|
+
`usage: tryharness herdr ${sub} <${sub === "start" ? "folder" : "thread"}> "<words>"`
|
|
2826
|
+
);
|
|
2827
|
+
const response = await daemonRequest(
|
|
2828
|
+
sub === "start"
|
|
2829
|
+
? {
|
|
2830
|
+
command: "board.swarm.start",
|
|
2831
|
+
agent: "user",
|
|
2832
|
+
text,
|
|
2833
|
+
folder: path.resolve(target),
|
|
2834
|
+
}
|
|
2835
|
+
: { command: "board.swarm.post", agent: "user", id: target, text }
|
|
2836
|
+
);
|
|
2837
|
+
if (!response.ok)
|
|
2838
|
+
throw new Error(response.error || "the swarm did not take it");
|
|
2839
|
+
json({ ok: true, thread: response.thread?.id ?? target });
|
|
2840
|
+
return;
|
|
2841
|
+
}
|
|
2842
|
+
if (sub === "install") {
|
|
2843
|
+
const home =
|
|
2844
|
+
process.env.HERDR_APP_HOME ||
|
|
2845
|
+
path.join(
|
|
2846
|
+
process.env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config"),
|
|
2847
|
+
"herdr-app"
|
|
2848
|
+
);
|
|
2849
|
+
if (!fs.existsSync(home))
|
|
2850
|
+
throw new Error(
|
|
2851
|
+
`Herdr's folder is not here (${home}): open Herdr once, then run this again.`
|
|
2852
|
+
);
|
|
2853
|
+
const into = path.join(home, "mods", "harness");
|
|
2854
|
+
fs.mkdirSync(into, { recursive: true });
|
|
2855
|
+
const from = new URL("./assets/herdr-mod/harness/", import.meta.url);
|
|
2856
|
+
// The panel's own files only: Herdr writes its type files beside a mod it checks.
|
|
2857
|
+
for (const file of ["main.js", "mod.json"])
|
|
2858
|
+
fs.copyFileSync(new URL(file, from), path.join(into, file));
|
|
2859
|
+
// Herdr's built-in layouts never dock a mod on their own (herdr-app src/window.rs): how to show it is the person's.
|
|
2860
|
+
// Herdr's keys are theirs too: suggested, never written for them.
|
|
2861
|
+
console.log(
|
|
2862
|
+
[
|
|
2863
|
+
`The Harness panel is in Herdr (${into}); to remove it, delete that folder.`,
|
|
2864
|
+
"",
|
|
2865
|
+
"Show it:",
|
|
2866
|
+
" beside your terminal now: herdr-app do pane.split --direction right --mod harness",
|
|
2867
|
+
" floating, on a key: add to the global keys in " +
|
|
2868
|
+
path.join(home, "keys.json") +
|
|
2869
|
+
': "ctrl-shift-h": "mod.open:harness"',
|
|
2870
|
+
" docked in every space: use a layout of your own (herdr-app do layout.clone --name main); Herdr docks it there",
|
|
2871
|
+
"",
|
|
2872
|
+
'Its keys, while it shows: "harness.next" (to the thread that most wants you), "harness.ask" (to its box)',
|
|
2873
|
+
].join("\n")
|
|
2874
|
+
);
|
|
2875
|
+
return;
|
|
2876
|
+
}
|
|
2877
|
+
throw new Error(
|
|
2878
|
+
'usage: tryharness herdr board | read <thread> | start <folder> "<words>" | post <thread> "<words>" | install'
|
|
2879
|
+
);
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2554
2882
|
async function t3() {
|
|
2555
2883
|
const sub = argv[0] || "connect";
|
|
2556
2884
|
if (sub === "status") {
|
|
@@ -2628,7 +2956,7 @@ function installedLine() {
|
|
|
2628
2956
|
|
|
2629
2957
|
function help() {
|
|
2630
2958
|
console.log(
|
|
2631
|
-
`tryharness ${VERSION}\n\n${installedLine()}Commands:\n tryharness set up everything and start the daemon\n tryharness upgrade [version] fetch a newer release, check it is signed with Harness's release key, then set it up\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 runs what your agents are running on this computer now\n tryharness steer <thread or run> "<words>" [--agent <agent>]\n tell an agent something while it works\n tryharness ssh [<cloud computer>] [--key <file>] [--print] [-- <command>]\n SSH into your cloud computer with your own key; it wakes if asleep\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 <
|
|
2959
|
+
`tryharness ${VERSION}\n\n${installedLine()}Commands:\n tryharness set up everything and start the daemon\n tryharness upgrade [version] fetch a newer release, check it is signed with Harness's release key, then set it up\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 runs what your agents are running on this computer now\n tryharness restore <id> <file> put back a version of a file another's change replaced (kept 30 days)\n tryharness wishes the senses your agents asked for, or kept checking for themselves\n tryharness pointed where your agents pointed you, and why\n tryharness reflexes what Harness holds or paused to protect the computer or a limit; reflex release <id> --reason "<why>"\n tryharness steer <thread or run> "<words>" [--agent <agent>]\n tell an agent something while it works\n tryharness ssh [<cloud computer>] [--key <file>] [--print] [-- <command>]\n SSH into your cloud computer with your own key; it wakes if asleep\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 <friendship> <message> send a message you wrote to a friend; nothing goes before it\n tryharness board snippet [<id> share|keep] code an agent elsewhere asked to see; nothing leaves until you share it\n tryharness board end <friendship> --outcome <text> end the conversation with a friend\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: Jev, 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 swarm dispatcher [models | local [file.gguf] | surplus <model> | agent <agent> [model] | endpoint <url> [model]]\n what words your threads and checks results: the relay's LFM3-Omni or your own model, a Surplus model, one of your agents, or your endpoint\n tryharness friend add <handle> | friend list | friend remove <handle> your friends: nothing starts with another person until they accept\n tryharness block <handle> | unblock <handle> drop someone's friend requests unseen and end a friendship with them\n tryharness peers the keys of your friends' computers, to compare; peers trust <handle> takes the new key of a friend whose computer changed\n tryharness devices your devices: browsers, computers, phones and cloud computers; devices rename <name> "<new name>" | remove <name>\n tryharness machines your computers: which holds the board (home) and which work through it; machines add <code> [--hosted] | name <name> | home | update <name> [version] | remove <name>\n tryharness backup [on | now | restore | off] an encrypted backup of your board and vault, for Residents, sealed with your keys\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 confirm <agent> the program Harness starts for an agent, after you install it somewhere new\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 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 phone pair show a QR code that opens Harness on your phone, to sign in and approve it\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 herdr install the Harness panel inside the Herdr app: your threads, who works and what waits on you\n tryharness logs [--follow]\n tryharness uninstall [--everything] take Harness off this computer; --everything also deletes your board and history\n`
|
|
2632
2960
|
);
|
|
2633
2961
|
}
|
|
2634
2962
|
|
|
@@ -2663,10 +2991,10 @@ try {
|
|
|
2663
2991
|
// Apps (connected outside accounts) are off until the person turns them on; agents see the connection tool in
|
|
2664
2992
|
// the sessions they start after that (mcp-stdio.mjs).
|
|
2665
2993
|
const on = argv[0] === "on";
|
|
2666
|
-
|
|
2667
|
-
...
|
|
2994
|
+
updateConfig(paths.config, (saved) => ({
|
|
2995
|
+
...saved,
|
|
2668
2996
|
connectedApps: on,
|
|
2669
|
-
});
|
|
2997
|
+
}));
|
|
2670
2998
|
console.log(
|
|
2671
2999
|
on
|
|
2672
3000
|
? `Apps are on. Connect one with ${relayCommand()} connections add; agents see them in sessions they start from now on.`
|
|
@@ -2684,16 +3012,24 @@ try {
|
|
|
2684
3012
|
else if (command === "agents") await agents();
|
|
2685
3013
|
else if (command === "lessons") await lessons();
|
|
2686
3014
|
else if (command === "memory") await memoryCommand();
|
|
2687
|
-
else if (command === "link") await link();
|
|
2688
3015
|
else if (command === "t3") await t3();
|
|
3016
|
+
else if (command === "herdr") await herdr();
|
|
2689
3017
|
else if (command === "peers") await peers();
|
|
2690
3018
|
else if (command === "machines") await machines();
|
|
3019
|
+
else if (command === "devices") await devices();
|
|
3020
|
+
else if (command === "recovery-code") await recoveryCode();
|
|
2691
3021
|
else if (command === "ssh") await ssh();
|
|
2692
3022
|
else if (command === "steer") await steer();
|
|
2693
3023
|
else if (command === "runs") await runs();
|
|
2694
|
-
else if (command === "
|
|
2695
|
-
|
|
2696
|
-
else if (command === "
|
|
3024
|
+
else if (command === "restore") await restore();
|
|
3025
|
+
else if (command === "wishes") await wishes();
|
|
3026
|
+
else if (command === "pointed") await pointed();
|
|
3027
|
+
else if (command === "reflexes" || command === "reflex")
|
|
3028
|
+
await reflexesCommand();
|
|
3029
|
+
else if (command === "backup") await backupCommand({ argv, daemonRequest });
|
|
3030
|
+
else if (command === "friend") await friend();
|
|
3031
|
+
else if (command === "block") await block(true);
|
|
3032
|
+
else if (command === "unblock") await block(false);
|
|
2697
3033
|
else if (command === "desktop") {
|
|
2698
3034
|
const shown = await desktop();
|
|
2699
3035
|
console.log(shown.text);
|