tryharness 0.7.83 → 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 +191 -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 +52 -0
- 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 +2426 -338
- 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 +1 -1
- 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/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 +211 -129
- 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/lib/boardMirror.mjs
CHANGED
|
@@ -44,6 +44,10 @@ export const MIRRORED = {
|
|
|
44
44
|
board_memory_marks: ["contribution_id"],
|
|
45
45
|
board_observations: ["id"],
|
|
46
46
|
team_notes: ["id"],
|
|
47
|
+
// The person's places and what was done there (networkPlaces.mjs), kept on home: carried like the board, so a
|
|
48
|
+
// computer made home has them and the board's backup restores them. Each place's key stays in home's vault.
|
|
49
|
+
places: ["id"],
|
|
50
|
+
place_acts: ["id"],
|
|
47
51
|
board_files: ["id"],
|
|
48
52
|
// The onchain desk's book (book.mjs): personal, so it is carried only where the board is, sealed in its backup.
|
|
49
53
|
...BOOK_MIRRORED,
|
|
@@ -56,9 +60,18 @@ export const MIRRORED = {
|
|
|
56
60
|
board_specialty_benchmarks: ["agent", "model", "effort", "specialty"],
|
|
57
61
|
// The person's choices for the whole swarm (the dispatcher slot), so they follow home when it moves.
|
|
58
62
|
board_settings: ["key"],
|
|
63
|
+
// What every computer reads the same (facts.mjs). The log of what happened (events.mjs) stays on its own computer.
|
|
64
|
+
board_facts: ["key", "machine"],
|
|
65
|
+
// Watches that belong to threads (threadWatches.mjs): each computer reads the ones that name it.
|
|
66
|
+
board_watches: ["id"],
|
|
67
|
+
// Each agent's next step in each thread (nextStep.mjs), for its next turn on whichever computer.
|
|
68
|
+
board_next_steps: ["goal_id", "agent"],
|
|
59
69
|
};
|
|
70
|
+
// Rows numbered in order within their thread, which readers page through by that number (store.mjs roomPosts).
|
|
71
|
+
const SEQUENCED = { board_contributions: "task_id", board_messages: "task_id" };
|
|
60
72
|
// The person's grants, made on whichever computer was home: never taken from a board a computer kept on its own.
|
|
61
|
-
|
|
73
|
+
// What the swarm may do at a place is the person's grant too (places.allowed).
|
|
74
|
+
const AUTHORITY_TABLES = new Set(["board_standing", "board_offices", "places"]);
|
|
62
75
|
// What says a task may run and on whose word, and who holds it: home's own, never another computer's.
|
|
63
76
|
const TASK_AUTHORITY = ["run_authorized_at", "run_authorized_by", "trust"];
|
|
64
77
|
const TASK_HOLD = [
|
|
@@ -82,6 +95,8 @@ const keyJson = (prefix, columns) =>
|
|
|
82
95
|
|
|
83
96
|
/** The change log and its triggers, made once on every computer, and every row already there counted as changed. */
|
|
84
97
|
function install(db) {
|
|
98
|
+
// One transaction: each statement on its own synced a journal to disk, and the triggers are made on every start.
|
|
99
|
+
db.exec("begin");
|
|
85
100
|
db.exec(`create table if not exists board_changes (
|
|
86
101
|
seq integer primary key autoincrement,
|
|
87
102
|
tbl text not null,
|
|
@@ -130,6 +145,7 @@ function install(db) {
|
|
|
130
145
|
create trigger ${table}_mirror_delete after delete on ${table} begin ${changed("old", 1)} ${forget("old")} end;
|
|
131
146
|
`);
|
|
132
147
|
}
|
|
148
|
+
db.exec("commit");
|
|
133
149
|
if (!db.get("select value from board_meta where key = ?", [FEED])) {
|
|
134
150
|
db.exec("begin immediate");
|
|
135
151
|
try {
|
|
@@ -289,6 +305,9 @@ export function createBoardMirror({
|
|
|
289
305
|
standIn = false,
|
|
290
306
|
// A worker that applies a row's changed columns (one older than them takes whole rows).
|
|
291
307
|
diffs = false,
|
|
308
|
+
// A computer's own changes going to another to be merged: each whole row also names the columns this computer
|
|
309
|
+
// changed in it after `from` (merge keeps the other computer's own changes to the rest).
|
|
310
|
+
withChanged = standIn,
|
|
292
311
|
} = {}) => {
|
|
293
312
|
const standing = standInRecord();
|
|
294
313
|
if (standIn && !standing)
|
|
@@ -332,7 +351,14 @@ export function createBoardMirror({
|
|
|
332
351
|
Object.fromEntries(moved.map((name) => [name, row[name]]))
|
|
333
352
|
),
|
|
334
353
|
}
|
|
335
|
-
: {
|
|
354
|
+
: {
|
|
355
|
+
seq: change.seq,
|
|
356
|
+
tbl: change.tbl,
|
|
357
|
+
row: onWire(row),
|
|
358
|
+
...(withChanged && from > 0
|
|
359
|
+
? { changed: changedSince(change.tbl, change.pk, from) }
|
|
360
|
+
: {}),
|
|
361
|
+
};
|
|
336
362
|
const size = Buffer.byteLength(JSON.stringify(item));
|
|
337
363
|
if (changes.length && bytes + size > PAGE_BYTES) break;
|
|
338
364
|
changes.push(item);
|
|
@@ -389,6 +415,8 @@ export function createBoardMirror({
|
|
|
389
415
|
missed = true;
|
|
390
416
|
break;
|
|
391
417
|
}
|
|
418
|
+
// Part of the listing like any row, or the sweep below takes it out (a listing past one page lost rows this way).
|
|
419
|
+
starting?.get(change.tbl)?.add(JSON.stringify(change.key));
|
|
392
420
|
continue;
|
|
393
421
|
}
|
|
394
422
|
writeRow(change.tbl, change.row);
|
|
@@ -480,16 +508,24 @@ export function createBoardMirror({
|
|
|
480
508
|
if (!bring) removeRow(change.tbl, change.gone);
|
|
481
509
|
continue;
|
|
482
510
|
}
|
|
511
|
+
const key = columns.map((column) => change.row[column]);
|
|
483
512
|
const here = db.get(
|
|
484
513
|
`select * from ${change.tbl} where ${whereKey(columns)}`,
|
|
485
|
-
|
|
514
|
+
key
|
|
486
515
|
);
|
|
487
|
-
if (here &&
|
|
516
|
+
if (here && bring) continue;
|
|
517
|
+
if (here && !hasClock(change.row, here)) {
|
|
518
|
+
mergeUnclocked(change, here, key);
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
if (here && !newer(change.row, here)) continue;
|
|
488
522
|
writeRow(
|
|
489
523
|
change.tbl,
|
|
490
524
|
change.tbl === "board_tasks"
|
|
491
525
|
? withoutAuthority(change.row, here, { bring })
|
|
492
|
-
:
|
|
526
|
+
: here
|
|
527
|
+
? change.row
|
|
528
|
+
: afterTheLast(change.tbl, change.row)
|
|
493
529
|
);
|
|
494
530
|
}
|
|
495
531
|
db.exec("commit");
|
|
@@ -512,17 +548,48 @@ export function createBoardMirror({
|
|
|
512
548
|
}
|
|
513
549
|
return task;
|
|
514
550
|
};
|
|
515
|
-
//
|
|
516
|
-
|
|
551
|
+
// Whether two copies of a row say which is newer: a version every write bumps, or a time of change.
|
|
552
|
+
const hasClock = (incoming, here) =>
|
|
553
|
+
("version" in incoming && "version" in here) ||
|
|
554
|
+
("updated_at" in incoming && "updated_at" in here);
|
|
517
555
|
const newer = (incoming, here) => {
|
|
518
556
|
if ("version" in incoming && "version" in here) {
|
|
519
557
|
if (Number(incoming.version) !== Number(here.version))
|
|
520
558
|
return Number(incoming.version) > Number(here.version);
|
|
521
559
|
return String(incoming.updated_at) > String(here.updated_at);
|
|
522
560
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
561
|
+
return String(incoming.updated_at) > String(here.updated_at);
|
|
562
|
+
};
|
|
563
|
+
// A row with no version or time of change (a thread's state, a goal's sessions, a post), on both computers: nothing
|
|
564
|
+
// says which copy is newer, so each column comes from the computer that changed it. The sender names the columns it
|
|
565
|
+
// changed after it began standing in (since, withChanged); only those are taken, and this board's own changes to the
|
|
566
|
+
// others stay. A post keeps the place it has here, so no reader's place in the thread moves past it. A sender that
|
|
567
|
+
// names none (one from before this, or a row it made itself) is taken whole, as before, but in its place here.
|
|
568
|
+
const mergeUnclocked = (change, here, key) => {
|
|
569
|
+
const placed = SEQUENCED[change.tbl] ? { seq: here.seq } : {};
|
|
570
|
+
if (!Array.isArray(change.changed)) {
|
|
571
|
+
writeRow(change.tbl, { ...change.row, ...placed });
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
const cols = Object.fromEntries(
|
|
575
|
+
change.changed
|
|
576
|
+
.filter((name) => !(name in placed))
|
|
577
|
+
.map((name) => [name, change.row[name]])
|
|
578
|
+
);
|
|
579
|
+
writeColumns(change.tbl, key, cols);
|
|
580
|
+
};
|
|
581
|
+
// A post or message another computer numbered while it stood in, after the last one here in its thread: both
|
|
582
|
+
// computers numbered from the same last post, and a reader that has read past a number would never see one given it.
|
|
583
|
+
const afterTheLast = (table, row) => {
|
|
584
|
+
const parent = SEQUENCED[table];
|
|
585
|
+
if (!parent) return row;
|
|
586
|
+
const last = Number(
|
|
587
|
+
db.get(
|
|
588
|
+
`select coalesce(max(seq), 0) as seq from ${table} where ${parent} = ?`,
|
|
589
|
+
[row[parent]]
|
|
590
|
+
)?.seq ?? 0
|
|
591
|
+
);
|
|
592
|
+
return Number(row.seq) > last ? row : { ...row, seq: last + 1 };
|
|
526
593
|
};
|
|
527
594
|
|
|
528
595
|
/** This computer works on a board of its own: once confirmed, it brings that board to home. */
|
|
@@ -534,7 +601,7 @@ export function createBoardMirror({
|
|
|
534
601
|
// home took them all; the refusal when home said it takes none (answerMergeCall), so this computer stops asking.
|
|
535
602
|
const pushAll = async (after, options) => {
|
|
536
603
|
for (;;) {
|
|
537
|
-
const page = since({ after, feed: feed() });
|
|
604
|
+
const page = since({ after, feed: feed(), withChanged: true });
|
|
538
605
|
const answer = await pushPage(page, options);
|
|
539
606
|
if (answer?.ok !== true) return answer ?? { ok: false };
|
|
540
607
|
after = page.to;
|