tryharness 0.7.53 → 0.7.57
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 +23 -19
- package/assets/dsh-plugin.mjs +72 -0
- package/assets/opencode-plugin.js +4 -3
- package/cli.mjs +484 -90
- package/lib/activity.mjs +10 -10
- package/lib/adapters.mjs +173 -222
- package/lib/agentBinaries.mjs +71 -0
- package/lib/agentRuntimeConfig.mjs +1 -1
- package/lib/agentRuntimes.mjs +34 -18
- package/lib/agentSignIn.mjs +456 -0
- package/lib/answers.mjs +5 -5
- package/lib/archetypes.d.ts +64 -0
- package/lib/archetypes.js +989 -0
- package/lib/asks.mjs +4 -4
- package/lib/audit.mjs +666 -0
- package/lib/backupSetup.mjs +143 -0
- package/lib/boardAccess.mjs +24 -11
- package/lib/boardBackup.mjs +283 -0
- package/lib/boardFileCommands.mjs +6 -6
- package/lib/boardFiles.mjs +13 -12
- package/lib/boardMirror.mjs +124 -25
- package/lib/boardProtocol.json +88 -2
- package/lib/boardWaits.mjs +101 -0
- package/lib/book.mjs +659 -0
- package/lib/bridge.mjs +6 -6
- package/lib/cards.mjs +138 -28
- package/lib/cloudAgents.mjs +216 -0
- package/lib/cloudAi.mjs +1312 -0
- package/lib/cloudAssistants.mjs +242 -0
- package/lib/cloudBoot.mjs +119 -0
- package/lib/cloudSave.mjs +197 -0
- package/lib/cloudSsh.mjs +178 -0
- package/lib/commands.mjs +7 -2
- package/lib/context.mjs +19 -5
- package/lib/contractGate.mjs +399 -0
- package/lib/control-client.mjs +9 -1
- package/lib/controlSocket.mjs +86 -0
- package/lib/coordinator.mjs +252 -144
- package/lib/daemon.mjs +1351 -2767
- package/lib/desk.mjs +240 -0
- package/lib/desktop.mjs +178 -74
- package/lib/directLink.mjs +16 -5
- package/lib/environment.mjs +2 -1
- package/lib/environments.mjs +247 -9
- package/lib/firewall.mjs +9 -9
- package/lib/folders.mjs +20 -16
- package/lib/frames.mjs +2 -3
- package/lib/gitHost.mjs +174 -0
- package/lib/goalCommands.mjs +25 -7
- package/lib/goals.mjs +7 -7
- package/lib/guestRequests.mjs +94 -0
- package/lib/handoffs.mjs +8 -7
- package/lib/handover.mjs +4 -4
- package/lib/harnessModel.mjs +6 -6
- package/lib/harnessOffers.mjs +266 -0
- package/lib/hookDialects.mjs +298 -0
- package/lib/inference.mjs +26 -8
- package/lib/jobAnswers.mjs +190 -0
- package/lib/landed.mjs +887 -0
- package/lib/lane.mjs +42 -11
- package/lib/lessons.mjs +16 -16
- package/lib/library.mjs +3 -3
- package/lib/lineup.mjs +3 -0
- package/lib/linkRelay.mjs +574 -0
- package/lib/live.mjs +284 -13
- package/lib/localAgentAsk.mjs +74 -0
- package/lib/localStack.mjs +536 -0
- package/lib/localmodels.mjs +6 -4
- package/lib/loopBackstop.mjs +4 -4
- package/lib/machineIdentity.mjs +9 -1
- package/lib/machineRoutes.mjs +181 -2
- package/lib/machineRuns.mjs +76 -1
- package/lib/machineSeal.mjs +39 -12
- package/lib/mcp-stdio.mjs +163 -27
- package/lib/mcpRelay.mjs +1 -1
- package/lib/members.json +29 -2
- package/lib/members.mjs +1 -1
- package/lib/models.mjs +85 -31
- package/lib/museSession.mjs +21 -13
- package/lib/nativeHost.mjs +36 -8
- package/lib/neovim.mjs +126 -0
- package/lib/network.mjs +50 -5
- package/lib/notify.mjs +7 -5
- package/lib/nudge.mjs +50 -19
- package/lib/ocr.mjs +9 -9
- package/lib/onboard.mjs +26 -20
- package/lib/oneLine.mjs +7 -7
- package/lib/ownMachines.mjs +1223 -140
- package/lib/pairing.mjs +60 -16
- package/lib/paths.mjs +19 -1
- package/lib/peerProcess.mjs +124 -0
- package/lib/personModel.mjs +89 -0
- package/lib/personNotices.mjs +151 -0
- package/lib/phones.mjs +538 -31
- package/lib/placeCommands.mjs +4 -4
- package/lib/places.mjs +400 -12
- package/lib/profile.mjs +67 -14
- package/lib/projectGit.mjs +158 -14
- package/lib/projectPieces.mjs +902 -0
- package/lib/projectSettings.mjs +7 -4
- package/lib/projects.mjs +384 -62
- package/lib/provenance.mjs +5 -1
- package/lib/proxyLinks.mjs +267 -0
- package/lib/reactions.mjs +7 -5
- package/lib/readiness.mjs +145 -23
- package/lib/record.mjs +128 -0
- package/lib/redact.mjs +4 -4
- package/lib/relayLimits.mjs +62 -0
- package/lib/release.mjs +170 -0
- package/lib/releaseKeys.json +6 -0
- package/lib/repoLinks.mjs +4 -4
- package/lib/roomChannels.mjs +24 -0
- package/lib/roomPage.mjs +1 -1
- package/lib/runAuthority.mjs +101 -0
- package/lib/runBrief.mjs +19 -8
- package/lib/runWorker.mjs +31 -7
- package/lib/runner.mjs +223 -29
- package/lib/runtime-install.mjs +143 -9
- package/lib/schedules.mjs +2 -2
- package/lib/screens.mjs +1 -1
- package/lib/sealed.mjs +11 -2
- package/lib/sealedThreads.mjs +671 -0
- package/lib/secretPatterns.json +1 -1
- package/lib/secrets.mjs +4 -4
- package/lib/seen.mjs +6 -6
- package/lib/serverWords.mjs +175 -0
- package/lib/service.mjs +22 -12
- package/lib/sessionControl.mjs +378 -90
- package/lib/specialties.json +74 -0
- package/lib/specialties.mjs +477 -0
- package/lib/specialtyKeys.d.ts +3 -0
- package/lib/specialtyKeys.js +57 -0
- package/lib/specialtyNotice.mjs +147 -0
- package/lib/specialtySnapshot.mjs +138 -0
- package/lib/speech.mjs +5 -5
- package/lib/store.mjs +420 -36
- package/lib/stuck.mjs +1 -1
- package/lib/swarm.mjs +304 -37
- package/lib/swarmDevices.mjs +319 -0
- package/lib/swarmMemory.mjs +27 -25
- package/lib/t3.mjs +24 -15
- package/lib/taskCommands.mjs +80 -20
- package/lib/taskRooms.mjs +125 -0
- package/lib/taskRuns.mjs +45 -3
- package/lib/team.json +255 -148
- package/lib/team.mjs +554 -190
- package/lib/threadActions.mjs +315 -0
- package/lib/threadAuthority.mjs +101 -0
- package/lib/threadBriefs.mjs +178 -0
- package/lib/threadLine.mjs +116 -0
- package/lib/threadRuns.mjs +209 -50
- package/lib/threadView.mjs +20 -7
- package/lib/usageTotals.mjs +2 -3
- package/lib/vault.mjs +101 -10
- package/lib/vaultCloud.mjs +2 -2
- package/lib/vaultCommands.mjs +15 -6
- package/lib/vaultTools.js +2 -2
- package/lib/verdicts.mjs +328 -0
- package/lib/wakes.mjs +1 -1
- package/lib/watches.mjs +2 -2
- package/lib/windowAsks.mjs +13 -5
- package/lib/worktrees.mjs +157 -25
- package/npm-shrinkwrap.json +1093 -0
- package/package.json +12 -11
- package/release.json +220 -0
- package/lib/modelTiers.json +0 -1183
- package/lib/modelTiers.mjs +0 -133
package/lib/boardMirror.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { BOOK_MIRRORED } from "./book.mjs";
|
|
4
5
|
|
|
5
6
|
// Every computer of the person's swarm keeps the board. Home's is the board; each worker keeps a copy of it in its own
|
|
6
7
|
// board tables, so its agents still read the board when home is out of reach, and a worker standing in for home
|
|
7
|
-
// already holds it
|
|
8
|
-
//
|
|
8
|
+
// already holds it. Every computer stays in step with home as closely as it can, home's board is the canonical one,
|
|
9
|
+
// and the whole swarm works off that one shared board.
|
|
9
10
|
//
|
|
10
11
|
// - Every computer numbers the changes to its board tables (triggers into board_changes: the latest change per row, so
|
|
11
12
|
// the log is never larger than the board). Its feed id names that numbering.
|
|
@@ -15,6 +16,13 @@ import { randomUUID } from "node:crypto";
|
|
|
15
16
|
// writing them to a file first: a computer that was home before keeps its old board there.
|
|
16
17
|
// - Home tells connected workers when its board changed; a worker also catches up after each write it sent home and
|
|
17
18
|
// when home is back.
|
|
19
|
+
// - A computer that worked on a board of its own (a worker not confirmed yet, or one that was home) brings it to home
|
|
20
|
+
// once confirmed, before it follows home: home takes only the rows it lacks, and nothing of home's is removed or
|
|
21
|
+
// overwritten (owner, October 22: a computer set up again must not lose the swarm).
|
|
22
|
+
// - What another computer's changes bring never carries authority (security audit 2026-10-25, M2): a task new to home
|
|
23
|
+
// arrives without the person's Start and with an agent's trust, a task home has keeps home's Start and trust, and
|
|
24
|
+
// merging starts no run. A board brought also comes with nobody holding its tasks, and without its standing
|
|
25
|
+
// permission or appointments; a stand-in, which was home meanwhile, hands those back.
|
|
18
26
|
|
|
19
27
|
/** A worker's call for home's changes (ownMachines.mjs answers it on home, never through the board's own commands). */
|
|
20
28
|
export const MIRROR_COMMAND = "board.mirror.since";
|
|
@@ -37,13 +45,35 @@ export const MIRRORED = {
|
|
|
37
45
|
board_observations: ["id"],
|
|
38
46
|
team_notes: ["id"],
|
|
39
47
|
board_files: ["id"],
|
|
48
|
+
// The onchain desk's book (book.mjs): personal, so it is carried only where the board is, sealed in its backup.
|
|
49
|
+
...BOOK_MIRRORED,
|
|
50
|
+
// The person's specialties, primaries, pins and appointments, and the benchmark specialties each agent was given
|
|
51
|
+
// (specialties.mjs), so the backup restores them and every computer's cards say the same.
|
|
52
|
+
board_specialty_choices: ["agent", "model", "specialty"],
|
|
53
|
+
board_specialty_primary: ["agent"],
|
|
54
|
+
board_pins: ["specialty"],
|
|
55
|
+
board_offices: ["office"],
|
|
56
|
+
board_specialty_benchmarks: ["agent", "model", "effort", "specialty"],
|
|
40
57
|
};
|
|
58
|
+
// The person's grants, made on whichever computer was home: never taken from a board a computer kept on its own.
|
|
59
|
+
const AUTHORITY_TABLES = new Set(["board_standing", "board_offices"]);
|
|
60
|
+
// What says a task may run and on whose word, and who holds it: home's own, never another computer's.
|
|
61
|
+
const TASK_AUTHORITY = ["run_authorized_at", "run_authorized_by", "trust"];
|
|
62
|
+
const TASK_HOLD = [
|
|
63
|
+
"holder",
|
|
64
|
+
"claimed_by",
|
|
65
|
+
"claimed_at",
|
|
66
|
+
"lease_until",
|
|
67
|
+
"claimed_machine",
|
|
68
|
+
];
|
|
41
69
|
// A page stays well under what one sealed call carries (MAX_CT, src/shared/bridge/sealedWire.ts).
|
|
42
70
|
const PAGE_BYTES = 512 * 1024;
|
|
43
71
|
const FEED = "mirror-feed";
|
|
44
72
|
const CURSOR = "mirror-cursor";
|
|
45
73
|
// On a computer standing in as home: whose board it holds and where its own changes began.
|
|
46
74
|
const STAND_IN = "mirror-stand-in";
|
|
75
|
+
// On a computer that worked on a board of its own: it brings that board to home once it is confirmed.
|
|
76
|
+
const BRING = "mirror-bring";
|
|
47
77
|
|
|
48
78
|
const keyJson = (prefix, columns) =>
|
|
49
79
|
`json_array(${columns.map((column) => `${prefix}.${column}`).join(", ")})`;
|
|
@@ -59,7 +89,7 @@ function install(db) {
|
|
|
59
89
|
)`);
|
|
60
90
|
for (const [table, columns] of Object.entries(MIRRORED)) {
|
|
61
91
|
// A delete then an insert, never "insert or replace": the conflict rule of the statement that fired the trigger
|
|
62
|
-
// (a store's "insert or ignore") would override the trigger's own and drop the change
|
|
92
|
+
// (a store's "insert or ignore") would override the trigger's own and drop the change.
|
|
63
93
|
const changed = (prefix, gone) =>
|
|
64
94
|
`delete from board_changes where tbl = '${table}' and pk = ${keyJson(prefix, columns)};
|
|
65
95
|
insert into board_changes(tbl, pk, gone) values('${table}', ${keyJson(prefix, columns)}, ${gone});`;
|
|
@@ -129,7 +159,8 @@ export function createBoardMirror({
|
|
|
129
159
|
fetchPage = async () => null,
|
|
130
160
|
// On a worker that stood in: one page of what it wrote, merged on home; the answer says whether home took it.
|
|
131
161
|
pushPage = async () => null,
|
|
132
|
-
// Where this computer is: "home", "follow" (a worker),
|
|
162
|
+
// Where this computer is: "home", "follow" (a worker), "alone" (a worker not confirmed yet, on its own board), or
|
|
163
|
+
// "return" (home, while another computer stands in for it).
|
|
133
164
|
situation = () => "home",
|
|
134
165
|
// On a computer someone stood in for, once it has the stand-in's changes: Harness gives it home back.
|
|
135
166
|
reclaim = async () => false,
|
|
@@ -326,24 +357,30 @@ export function createBoardMirror({
|
|
|
326
357
|
/**
|
|
327
358
|
* Another computer's changes merged into this board, never overwriting newer work: a task by its version (every
|
|
328
359
|
* write bumps it), a lesson by when it changed, and any other row as the computer that changed it while standing in
|
|
329
|
-
* has it. Nothing here is taken out for being absent from the page.
|
|
360
|
+
* has it. Nothing here is taken out for being absent from the page. A board brought (`bring`) only adds rows this board
|
|
361
|
+
* lacks and removes nothing. Either way a task comes in with this board's authority on it, never the sender's.
|
|
330
362
|
*/
|
|
331
|
-
const merge = (page) => {
|
|
363
|
+
const merge = (page, { bring = false } = {}) => {
|
|
332
364
|
db.exec("begin immediate");
|
|
333
365
|
try {
|
|
334
366
|
for (const change of page.changes ?? []) {
|
|
335
367
|
const columns = MIRRORED[change.tbl];
|
|
336
|
-
if (!columns) continue;
|
|
368
|
+
if (!columns || (bring && AUTHORITY_TABLES.has(change.tbl))) continue;
|
|
337
369
|
if (change.gone) {
|
|
338
|
-
removeRow(change.tbl, change.gone);
|
|
370
|
+
if (!bring) removeRow(change.tbl, change.gone);
|
|
339
371
|
continue;
|
|
340
372
|
}
|
|
341
373
|
const here = db.get(
|
|
342
374
|
`select * from ${change.tbl} where ${whereKey(columns)}`,
|
|
343
375
|
columns.map((column) => change.row[column])
|
|
344
376
|
);
|
|
345
|
-
if (here && !newer(change.row, here)) continue;
|
|
346
|
-
writeRow(
|
|
377
|
+
if (here && (bring || !newer(change.row, here))) continue;
|
|
378
|
+
writeRow(
|
|
379
|
+
change.tbl,
|
|
380
|
+
change.tbl === "board_tasks"
|
|
381
|
+
? withoutAuthority(change.row, here, { bring })
|
|
382
|
+
: change.row
|
|
383
|
+
);
|
|
347
384
|
}
|
|
348
385
|
db.exec("commit");
|
|
349
386
|
merged();
|
|
@@ -353,9 +390,20 @@ export function createBoardMirror({
|
|
|
353
390
|
throw error;
|
|
354
391
|
}
|
|
355
392
|
};
|
|
393
|
+
// A task as another computer sent it, with this board's say over it: the Start and trust home gave it (none for a task
|
|
394
|
+
// new here, so it waits for the person), and, in a brought board, nobody holding it.
|
|
395
|
+
const withoutAuthority = (row, here, { bring }) => {
|
|
396
|
+
const task = { ...row };
|
|
397
|
+
for (const column of TASK_AUTHORITY)
|
|
398
|
+
task[column] = here ? here[column] : column === "trust" ? "agent" : null;
|
|
399
|
+
if (bring) {
|
|
400
|
+
for (const column of TASK_HOLD) task[column] = null;
|
|
401
|
+
if (["claimed", "running"].includes(task.status)) task.status = "open";
|
|
402
|
+
}
|
|
403
|
+
return task;
|
|
404
|
+
};
|
|
356
405
|
// A row with no version or time of change (a thread's state, a goal's sessions, a reaction) is taken from the
|
|
357
|
-
// computer that sent it: only rows it changed while standing in come in a merge (
|
|
358
|
-
// dropped).
|
|
406
|
+
// computer that sent it: only rows it changed while standing in come in a merge (these edits were once dropped).
|
|
359
407
|
const newer = (incoming, here) => {
|
|
360
408
|
if ("version" in incoming && "version" in here) {
|
|
361
409
|
if (Number(incoming.version) !== Number(here.version))
|
|
@@ -367,21 +415,57 @@ export function createBoardMirror({
|
|
|
367
415
|
return true;
|
|
368
416
|
};
|
|
369
417
|
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
418
|
+
/** This computer works on a board of its own: once confirmed, it brings that board to home. */
|
|
419
|
+
const markBring = () => {
|
|
420
|
+
if (!meta(BRING))
|
|
421
|
+
setMeta(BRING, JSON.stringify({ at: new Date().toISOString() }));
|
|
422
|
+
};
|
|
423
|
+
// Pages from `after` to home, the last always sent (empty or not), since home ends what it takes with it. True when
|
|
424
|
+
// home took them all; the refusal when home said it takes none (answerMergeCall), so this computer stops asking.
|
|
425
|
+
const pushAll = async (after, options) => {
|
|
375
426
|
for (;;) {
|
|
376
427
|
const page = since({ after, feed: feed() });
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if (answer?.ok !== true) return false;
|
|
428
|
+
const answer = await pushPage(page, options);
|
|
429
|
+
if (answer?.ok !== true) return answer ?? { ok: false };
|
|
380
430
|
after = page.to;
|
|
381
|
-
if (page.to >= page.head)
|
|
431
|
+
if (page.to >= page.head) return { ok: true };
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
// Home took none of it: the rows only this computer has go to a file when it lists home's board again (sweep).
|
|
435
|
+
const followAfresh = () =>
|
|
436
|
+
db.run("delete from board_meta where key = ?", [CURSOR]);
|
|
437
|
+
|
|
438
|
+
// Confirmed now: the whole board here goes to home, a page at a time, before this computer follows home's.
|
|
439
|
+
const bring = async () => {
|
|
440
|
+
if (!meta(BRING)) return true;
|
|
441
|
+
const answer = await pushAll(0, { bring: true });
|
|
442
|
+
if (answer.ok !== true && answer.code !== "not_armed") {
|
|
443
|
+
log(
|
|
444
|
+
`this computer's board could not go to home yet: ${answer.error || "home did not answer"}`
|
|
445
|
+
);
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
db.run("delete from board_meta where key = ?", [BRING]);
|
|
449
|
+
if (answer.ok) log("brought this computer's board to home");
|
|
450
|
+
else {
|
|
451
|
+
log(`home did not take this computer's board: ${answer.error}`);
|
|
452
|
+
followAfresh();
|
|
382
453
|
}
|
|
454
|
+
return true;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// A stand-in that is a worker again: home gets everything it wrote while standing in, before it follows home again.
|
|
458
|
+
const handOver = async () => {
|
|
459
|
+
const standing = standInRecord();
|
|
460
|
+
if (!standing) return true;
|
|
461
|
+
const answer = await pushAll(standing.from, {});
|
|
462
|
+
if (answer.ok !== true && answer.code !== "not_stand_in") return false;
|
|
383
463
|
db.run("delete from board_meta where key = ?", [STAND_IN]);
|
|
384
|
-
log(`gave home what this computer wrote while it stood in`);
|
|
464
|
+
if (answer.ok) log(`gave home what this computer wrote while it stood in`);
|
|
465
|
+
else {
|
|
466
|
+
log(`home did not take what this computer wrote: ${answer.error}`);
|
|
467
|
+
followAfresh();
|
|
468
|
+
}
|
|
385
469
|
return true;
|
|
386
470
|
};
|
|
387
471
|
|
|
@@ -394,7 +478,12 @@ export function createBoardMirror({
|
|
|
394
478
|
if (!page?.ok || !Array.isArray(page.changes)) {
|
|
395
479
|
// The stand-in is away too, or kept no record of standing in: home is taken back now, and the stand-in hands
|
|
396
480
|
// its changes over when it is back (handOver), rather than the swarm having no home (review, October 21).
|
|
397
|
-
if (page?.ok === false || !standInReachable())
|
|
481
|
+
if (page?.ok === false || !standInReachable()) {
|
|
482
|
+
log(
|
|
483
|
+
`taking home back without the stand-in's changes for now: ${page?.error || "it is out of reach"}`
|
|
484
|
+
);
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
398
487
|
return;
|
|
399
488
|
}
|
|
400
489
|
merge(page);
|
|
@@ -432,9 +521,18 @@ export function createBoardMirror({
|
|
|
432
521
|
again = false;
|
|
433
522
|
const where = situation();
|
|
434
523
|
if (where === "home") continue;
|
|
524
|
+
if (where === "alone") {
|
|
525
|
+
markBring();
|
|
526
|
+
continue;
|
|
527
|
+
}
|
|
435
528
|
if (!(await handOver())) continue;
|
|
436
|
-
|
|
437
|
-
|
|
529
|
+
// Home for a while to a stand-in: it takes home back with the stand-in's changes, and brings nothing.
|
|
530
|
+
if (where === "return") {
|
|
531
|
+
await takeBack();
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
if (!(await bring())) continue;
|
|
535
|
+
await catchUp();
|
|
438
536
|
} while (again);
|
|
439
537
|
} catch (error) {
|
|
440
538
|
log(`the board copy could not catch up with home: ${error.message}`);
|
|
@@ -455,5 +553,6 @@ export function createBoardMirror({
|
|
|
455
553
|
head,
|
|
456
554
|
startStandIn,
|
|
457
555
|
standIn: standInRecord,
|
|
556
|
+
markBring,
|
|
458
557
|
};
|
|
459
558
|
}
|
package/lib/boardProtocol.json
CHANGED
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"board.goal.list": "goals",
|
|
36
36
|
"board.goal.resume": "goals",
|
|
37
37
|
"board.goal.stop": "goals",
|
|
38
|
+
"board.landed.folder": "landed",
|
|
39
|
+
"board.landed.open": "landed",
|
|
40
|
+
"board.landed.thread": "landed",
|
|
38
41
|
"board.list": "task",
|
|
39
42
|
"board.live": "live",
|
|
40
43
|
"board.live.focus": "live",
|
|
@@ -73,6 +76,10 @@
|
|
|
73
76
|
"board.project.share": "projects",
|
|
74
77
|
"board.project.withdraw": "projects",
|
|
75
78
|
"board.project.work": "projects",
|
|
79
|
+
"board.project.verdict": "verdicts",
|
|
80
|
+
"board.project.piece": "projects",
|
|
81
|
+
"board.project.release": "projects",
|
|
82
|
+
"board.project.handoff": "projects",
|
|
76
83
|
"board.prompted": "prompt",
|
|
77
84
|
"board.relay.decide": "relay",
|
|
78
85
|
"board.relay.defaults": "relay",
|
|
@@ -122,6 +129,10 @@
|
|
|
122
129
|
"board.swarm.model": "swarm",
|
|
123
130
|
"board.swarm.models": "swarm",
|
|
124
131
|
"board.swarm.note": "swarm",
|
|
132
|
+
"board.swarm.office": "swarm",
|
|
133
|
+
"board.swarm.offices": "swarm",
|
|
134
|
+
"board.swarm.pin": "swarm",
|
|
135
|
+
"board.swarm.notice": "specialtyNotice",
|
|
125
136
|
"board.swarm.place": "swarm",
|
|
126
137
|
"board.swarm.places": "swarm",
|
|
127
138
|
"board.swarm.post": "swarm",
|
|
@@ -130,8 +141,11 @@
|
|
|
130
141
|
"board.swarm.rounds": "swarm",
|
|
131
142
|
"board.swarm.routing": "swarm",
|
|
132
143
|
"board.swarm.search": "swarm",
|
|
144
|
+
"board.swarm.specialties": "swarm",
|
|
145
|
+
"board.swarm.specialty": "swarm",
|
|
133
146
|
"board.swarm.start": "swarm",
|
|
134
147
|
"board.swarm.start_run": "swarm",
|
|
148
|
+
"board.swarm.steer": "swarm",
|
|
135
149
|
"board.swarm.stop": "swarm",
|
|
136
150
|
"board.swarm.stop_all": "swarm",
|
|
137
151
|
"board.swarm.use_browser": "swarm",
|
|
@@ -181,7 +195,8 @@
|
|
|
181
195
|
"board.native.read": "nativeRequests",
|
|
182
196
|
"board.native.decide": "nativeRequests",
|
|
183
197
|
"board.swarm.links": "swarm",
|
|
184
|
-
"board.swarm.link": "swarm"
|
|
198
|
+
"board.swarm.link": "swarm",
|
|
199
|
+
"board.wait": "waits"
|
|
185
200
|
},
|
|
186
201
|
"families": [
|
|
187
202
|
{
|
|
@@ -197,6 +212,12 @@
|
|
|
197
212
|
"board.swarm."
|
|
198
213
|
]
|
|
199
214
|
},
|
|
215
|
+
{
|
|
216
|
+
"owner": "landed",
|
|
217
|
+
"prefixes": [
|
|
218
|
+
"board.landed."
|
|
219
|
+
]
|
|
220
|
+
},
|
|
200
221
|
{
|
|
201
222
|
"owner": "relay",
|
|
202
223
|
"prefixes": [
|
|
@@ -263,6 +284,18 @@
|
|
|
263
284
|
"prefixes": [
|
|
264
285
|
"board.vault."
|
|
265
286
|
]
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"owner": "desk",
|
|
290
|
+
"prefixes": [
|
|
291
|
+
"board.desk."
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"owner": "audit",
|
|
296
|
+
"prefixes": [
|
|
297
|
+
"board.audit."
|
|
298
|
+
]
|
|
266
299
|
}
|
|
267
300
|
],
|
|
268
301
|
"access": {
|
|
@@ -293,6 +326,7 @@
|
|
|
293
326
|
"board.swarm.file",
|
|
294
327
|
"board.swarm.start",
|
|
295
328
|
"board.swarm.post",
|
|
329
|
+
"board.swarm.steer",
|
|
296
330
|
"board.swarm.stop",
|
|
297
331
|
"board.swarm.stop_all",
|
|
298
332
|
"board.swarm.resume",
|
|
@@ -378,6 +412,7 @@
|
|
|
378
412
|
"board.swarm.file",
|
|
379
413
|
"board.swarm.start",
|
|
380
414
|
"board.swarm.post",
|
|
415
|
+
"board.swarm.steer",
|
|
381
416
|
"board.swarm.stop",
|
|
382
417
|
"board.swarm.stop_all",
|
|
383
418
|
"board.swarm.resume",
|
|
@@ -390,6 +425,8 @@
|
|
|
390
425
|
"board.swarm.use_browser",
|
|
391
426
|
"board.swarm.agents",
|
|
392
427
|
"board.swarm.note",
|
|
428
|
+
"board.swarm.specialty",
|
|
429
|
+
"board.swarm.notice",
|
|
393
430
|
"board.swarm.places",
|
|
394
431
|
"board.swarm.browse",
|
|
395
432
|
"board.swarm.place",
|
|
@@ -431,6 +468,9 @@
|
|
|
431
468
|
"board.project.share",
|
|
432
469
|
"board.project.held",
|
|
433
470
|
"board.project.work",
|
|
471
|
+
"board.project.verdict",
|
|
472
|
+
"board.project.piece",
|
|
473
|
+
"board.project.release",
|
|
434
474
|
"board.project.leave",
|
|
435
475
|
"board.connector.list",
|
|
436
476
|
"board.connector.add",
|
|
@@ -551,6 +591,9 @@
|
|
|
551
591
|
"board.room.search"
|
|
552
592
|
],
|
|
553
593
|
"desktop": [
|
|
594
|
+
"board.audit.week",
|
|
595
|
+
"board.desk.book",
|
|
596
|
+
"board.desk.contract",
|
|
554
597
|
"board.list",
|
|
555
598
|
"board.get",
|
|
556
599
|
"board.children",
|
|
@@ -576,6 +619,7 @@
|
|
|
576
619
|
"board.swarm.file",
|
|
577
620
|
"board.swarm.start",
|
|
578
621
|
"board.swarm.post",
|
|
622
|
+
"board.swarm.steer",
|
|
579
623
|
"board.swarm.stop",
|
|
580
624
|
"board.swarm.stop_all",
|
|
581
625
|
"board.swarm.resume",
|
|
@@ -586,6 +630,12 @@
|
|
|
586
630
|
"board.swarm.discard",
|
|
587
631
|
"board.swarm.agents",
|
|
588
632
|
"board.swarm.note",
|
|
633
|
+
"board.swarm.specialties",
|
|
634
|
+
"board.swarm.specialty",
|
|
635
|
+
"board.swarm.pin",
|
|
636
|
+
"board.swarm.offices",
|
|
637
|
+
"board.swarm.office",
|
|
638
|
+
"board.swarm.notice",
|
|
589
639
|
"board.swarm.lessons",
|
|
590
640
|
"board.swarm.lessons.edit",
|
|
591
641
|
"board.swarm.lessons.remove",
|
|
@@ -636,9 +686,15 @@
|
|
|
636
686
|
"board.swarm.held",
|
|
637
687
|
"machines.list",
|
|
638
688
|
"machines.add",
|
|
689
|
+
"machines.home",
|
|
690
|
+
"machines.models",
|
|
691
|
+
"machines.model",
|
|
639
692
|
"swarm.lineup",
|
|
640
693
|
"swarm.add",
|
|
641
694
|
"swarm.remove",
|
|
695
|
+
"phone.list",
|
|
696
|
+
"phone.link.answer",
|
|
697
|
+
"phone.revoke",
|
|
642
698
|
"board.project.list",
|
|
643
699
|
"board.project.repos",
|
|
644
700
|
"board.repo.find",
|
|
@@ -661,6 +717,9 @@
|
|
|
661
717
|
"board.project.share",
|
|
662
718
|
"board.project.held",
|
|
663
719
|
"board.project.work",
|
|
720
|
+
"board.project.verdict",
|
|
721
|
+
"board.project.piece",
|
|
722
|
+
"board.project.release",
|
|
664
723
|
"board.project.leave",
|
|
665
724
|
"board.place.op",
|
|
666
725
|
"board.connector.list",
|
|
@@ -695,7 +754,11 @@
|
|
|
695
754
|
"board.vault.share",
|
|
696
755
|
"board.vault.unshare",
|
|
697
756
|
"board.vault.import",
|
|
698
|
-
"board.vault.allow"
|
|
757
|
+
"board.vault.allow",
|
|
758
|
+
"board.wait",
|
|
759
|
+
"board.landed.thread",
|
|
760
|
+
"board.landed.folder",
|
|
761
|
+
"board.landed.open"
|
|
699
762
|
],
|
|
700
763
|
"plainPerson": [
|
|
701
764
|
"board.standing.off"
|
|
@@ -708,6 +771,29 @@
|
|
|
708
771
|
"board.goal.get",
|
|
709
772
|
"board.goal.list",
|
|
710
773
|
"board.room.read"
|
|
774
|
+
],
|
|
775
|
+
"browserMachines": [
|
|
776
|
+
"machines.add",
|
|
777
|
+
"machines.list"
|
|
778
|
+
],
|
|
779
|
+
"browserSignIn": [
|
|
780
|
+
"agents.signin.status",
|
|
781
|
+
"agents.signin.start",
|
|
782
|
+
"agents.signin.read",
|
|
783
|
+
"agents.signin.send",
|
|
784
|
+
"agents.signin.stop",
|
|
785
|
+
"agents.signin.key",
|
|
786
|
+
"agents.signin.link",
|
|
787
|
+
"agents.models",
|
|
788
|
+
"agents.model"
|
|
789
|
+
],
|
|
790
|
+
"browserLinks": [
|
|
791
|
+
"links.allow",
|
|
792
|
+
"links.list",
|
|
793
|
+
"links.forget"
|
|
794
|
+
],
|
|
795
|
+
"browserSsh": [
|
|
796
|
+
"ssh.allow"
|
|
711
797
|
]
|
|
712
798
|
},
|
|
713
799
|
"metadata": {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// The board's revision, and whoever waits for it to move. Every surface that shows the board (the buddy over the local
|
|
2
|
+
// socket, the PiP and the phone through Harness) reads it again the moment it changes, rather than on a timer: the
|
|
3
|
+
// relay's state has to reach every device, the PiP and the phone close to instantly.
|
|
4
|
+
//
|
|
5
|
+
// The revision is the board's change log head (boardMirror.mjs: every write to a board table, through any of the
|
|
6
|
+
// daemon's paths, and every page copied from home) with a count of changes kept outside those tables (the T3 Code work
|
|
7
|
+
// listed beside the board). A write the daemon names (`changed`) is seen at once; any other is seen within CHECK_MS,
|
|
8
|
+
// checked only while someone waits or listens.
|
|
9
|
+
|
|
10
|
+
const CHECK_MS = 100;
|
|
11
|
+
// A wait's longest hold: under the buddy's 20 s socket read (packages/desktop/src-tauri/src/daemon.rs), so a quiet
|
|
12
|
+
// board answers before the socket gives up.
|
|
13
|
+
const MOST_HOLD_MS = 15_000;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* `head` reads the change log's newest seq. `onChange` hears each move of the revision, once for all the changes made
|
|
17
|
+
* in one check.
|
|
18
|
+
*/
|
|
19
|
+
export function createBoardWaits({ head }) {
|
|
20
|
+
let outside = 0;
|
|
21
|
+
let seen = head();
|
|
22
|
+
const waiters = new Set();
|
|
23
|
+
const listeners = new Set();
|
|
24
|
+
let timer = null;
|
|
25
|
+
let checkQueued = false;
|
|
26
|
+
|
|
27
|
+
const revision = () => `${seen}.${outside}`;
|
|
28
|
+
|
|
29
|
+
const check = () => {
|
|
30
|
+
const now = head();
|
|
31
|
+
if (now === seen) return;
|
|
32
|
+
seen = now;
|
|
33
|
+
moved();
|
|
34
|
+
};
|
|
35
|
+
const moved = () => {
|
|
36
|
+
const current = revision();
|
|
37
|
+
for (const waiter of [...waiters]) waiter(current);
|
|
38
|
+
for (const listener of [...listeners])
|
|
39
|
+
try {
|
|
40
|
+
listener(current);
|
|
41
|
+
} catch {}
|
|
42
|
+
};
|
|
43
|
+
const keepChecking = () => {
|
|
44
|
+
const wanted = waiters.size > 0 || listeners.size > 0;
|
|
45
|
+
if (wanted && !timer) {
|
|
46
|
+
timer = setInterval(check, CHECK_MS);
|
|
47
|
+
timer.unref?.();
|
|
48
|
+
}
|
|
49
|
+
if (!wanted && timer) {
|
|
50
|
+
clearInterval(timer);
|
|
51
|
+
timer = null;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
revision,
|
|
57
|
+
/** A board write the daemon just made: checked as soon as the current turn of the event loop ends. */
|
|
58
|
+
changed() {
|
|
59
|
+
if (checkQueued) return;
|
|
60
|
+
checkQueued = true;
|
|
61
|
+
setImmediate(() => {
|
|
62
|
+
checkQueued = false;
|
|
63
|
+
check();
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
/** Something shown with the board that is not in its tables changed (the T3 Code work beside it). */
|
|
67
|
+
bump() {
|
|
68
|
+
check();
|
|
69
|
+
outside += 1;
|
|
70
|
+
moved();
|
|
71
|
+
},
|
|
72
|
+
/** The revision once it is not `after`: at once when it already is not, else when it moves or the hold ends. */
|
|
73
|
+
wait({ after, holdMs = MOST_HOLD_MS } = {}) {
|
|
74
|
+
check();
|
|
75
|
+
if (String(after ?? "") !== revision())
|
|
76
|
+
return Promise.resolve(revision());
|
|
77
|
+
const hold = Math.max(0, Math.min(MOST_HOLD_MS, Number(holdMs) || 0));
|
|
78
|
+
return new Promise((resolve) => {
|
|
79
|
+
const done = (current) => {
|
|
80
|
+
clearTimeout(timeout);
|
|
81
|
+
waiters.delete(done);
|
|
82
|
+
keepChecking();
|
|
83
|
+
resolve(current);
|
|
84
|
+
};
|
|
85
|
+
const timeout = setTimeout(() => done(revision()), hold);
|
|
86
|
+
waiters.add(done);
|
|
87
|
+
keepChecking();
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
/** Whether any surface waits on the local socket now: what is shown beside the board is kept fresh meanwhile. */
|
|
91
|
+
watched: () => waiters.size > 0,
|
|
92
|
+
onChange(listener) {
|
|
93
|
+
listeners.add(listener);
|
|
94
|
+
keepChecking();
|
|
95
|
+
return () => {
|
|
96
|
+
listeners.delete(listener);
|
|
97
|
+
keepChecking();
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|