tryharness 0.7.67 → 0.7.69
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/lib/boardFileCommands.mjs +5 -7
- package/lib/boardFiles.mjs +5 -0
- package/lib/boardProtocol.json +50 -64
- package/lib/boardWaits.mjs +6 -0
- package/lib/cards.mjs +13 -1
- package/lib/comfyExecution.mjs +545 -0
- package/lib/context.mjs +34 -20
- package/lib/contextWorker.mjs +199 -0
- package/lib/coordinator.mjs +224 -22
- package/lib/daemon.mjs +196 -14
- package/lib/dispatchContract.json +313 -0
- package/lib/dispatchTools.js +87 -0
- package/lib/dispatches.mjs +975 -0
- package/lib/environment.mjs +54 -69
- package/lib/files.mjs +35 -0
- package/lib/frames.mjs +5 -9
- package/lib/goalCommands.mjs +13 -10
- package/lib/kept.mjs +131 -0
- package/lib/landed.mjs +1 -34
- package/lib/library.mjs +18 -11
- package/lib/live.mjs +30 -11
- package/lib/localAgentAsk.mjs +27 -4
- package/lib/localStack.mjs +17 -13
- package/lib/machineRoutes.mjs +5 -0
- package/lib/machineRuns.mjs +2 -1
- package/lib/mcp-stdio.mjs +42 -1
- package/lib/openHere.mjs +36 -0
- package/lib/openRequests.mjs +56 -0
- package/lib/ownMachines.mjs +232 -24
- package/lib/phones.mjs +29 -4
- package/lib/places.mjs +44 -11
- package/lib/portCalls.mjs +54 -0
- package/lib/promptDecider.mjs +471 -0
- package/lib/promptFlow.mjs +562 -0
- package/lib/promptScopes.mjs +670 -0
- package/lib/provenance.mjs +3 -2
- package/lib/runAuthority.mjs +14 -2
- package/lib/runBrief.mjs +2 -2
- package/lib/runWorker.mjs +25 -5
- package/lib/runner.mjs +62 -6
- package/lib/sealed.mjs +37 -0
- package/lib/sessionControl.mjs +47 -14
- package/lib/sessionIndex.mjs +11 -3
- package/lib/store.mjs +362 -40
- package/lib/swarm.mjs +85 -34
- package/lib/swarmMemory.mjs +39 -16
- package/lib/taskCommands.mjs +125 -1
- package/lib/team.json +10 -0
- package/lib/team.mjs +287 -26
- package/lib/threadBriefs.mjs +43 -31
- package/lib/threadRuns.mjs +47 -3
- package/npm-shrinkwrap.json +14 -14
- package/package.json +4 -4
- package/release.json +55 -43
|
@@ -6,6 +6,7 @@ import { paths } from "./paths.mjs";
|
|
|
6
6
|
export function createBoardFileCommands({
|
|
7
7
|
FILE_LIMITS,
|
|
8
8
|
FILE_PART_BYTES,
|
|
9
|
+
RAW_FILE_PART_BYTES,
|
|
9
10
|
MAX_FILE_BYTES,
|
|
10
11
|
MB,
|
|
11
12
|
blobPath,
|
|
@@ -174,20 +175,17 @@ export function createBoardFileCommands({
|
|
|
174
175
|
// whole file, which the checks in plainBoard read as a whole.
|
|
175
176
|
if (request.offset !== undefined && !request.hostedCaller) {
|
|
176
177
|
const offset = Number(request.offset),
|
|
177
|
-
length = Number(request.length ?? FILE_PART_BYTES)
|
|
178
|
+
length = Number(request.length ?? FILE_PART_BYTES),
|
|
179
|
+
most = request.raw === true ? RAW_FILE_PART_BYTES : FILE_PART_BYTES;
|
|
178
180
|
if (!Number.isSafeInteger(offset) || offset < 0 || offset >= file.bytes)
|
|
179
181
|
return {
|
|
180
182
|
ok: false,
|
|
181
183
|
error: "offset must be a byte within the file",
|
|
182
184
|
};
|
|
183
|
-
if (
|
|
184
|
-
!Number.isSafeInteger(length) ||
|
|
185
|
-
length < 1 ||
|
|
186
|
-
length > FILE_PART_BYTES
|
|
187
|
-
)
|
|
185
|
+
if (!Number.isSafeInteger(length) || length < 1 || length > most)
|
|
188
186
|
return {
|
|
189
187
|
ok: false,
|
|
190
|
-
error: `a part is 1 to ${
|
|
188
|
+
error: `a part is 1 to ${most} bytes`,
|
|
191
189
|
};
|
|
192
190
|
const part = Buffer.alloc(Math.min(length, file.bytes - offset));
|
|
193
191
|
const fd = fs.openSync(blobPath(file.sha256), "r");
|
package/lib/boardFiles.mjs
CHANGED
|
@@ -45,6 +45,10 @@ export const MAX_FILE_BYTES = Math.max(
|
|
|
45
45
|
);
|
|
46
46
|
// One part of a file read through the sealed channel: 512 KiB is 683 KiB as base64, inside a sealed answer's 1 MB.
|
|
47
47
|
export const FILE_PART_BYTES = 512 * 1024;
|
|
48
|
+
// A part sealed as bytes for a phone that asks for it (sealed.mjs sealFilePart): no base64 inside the seal, so a part
|
|
49
|
+
// nearly twice the size still fits the sealed wire's 1.4 MB (src/shared/bridge/sealedWire.ts MAX_CT), and a video
|
|
50
|
+
// takes half the round trips.
|
|
51
|
+
export const RAW_FILE_PART_BYTES = 960 * 1024;
|
|
48
52
|
// The most files one search across the person's threads answers with.
|
|
49
53
|
const FOUND_FILES = 20;
|
|
50
54
|
const fileLimit = (mime, bytes) =>
|
|
@@ -597,6 +601,7 @@ export function createBoardFiles({
|
|
|
597
601
|
const command = createBoardFileCommands({
|
|
598
602
|
FILE_LIMITS,
|
|
599
603
|
FILE_PART_BYTES,
|
|
604
|
+
RAW_FILE_PART_BYTES,
|
|
600
605
|
MAX_FILE_BYTES,
|
|
601
606
|
MB,
|
|
602
607
|
blobPath,
|
package/lib/boardProtocol.json
CHANGED
|
@@ -17,6 +17,22 @@
|
|
|
17
17
|
"board.answer": "task",
|
|
18
18
|
"board.audio.listen": "tools",
|
|
19
19
|
"board.children": "task",
|
|
20
|
+
"board.dispatch.scope.create": "task",
|
|
21
|
+
"board.dispatch.scope.read": "task",
|
|
22
|
+
"board.dispatch.scope.list": "task",
|
|
23
|
+
"board.dispatch.scope.revoke": "task",
|
|
24
|
+
"board.dispatch.propose": "task",
|
|
25
|
+
"board.dispatch.prompt": "task",
|
|
26
|
+
"board.prompt.start": "task",
|
|
27
|
+
"board.prompt.status": "task",
|
|
28
|
+
"board.prompt.cancel": "task",
|
|
29
|
+
"board.prompt.receipt": "task",
|
|
30
|
+
"board.dispatch.workspace": "task",
|
|
31
|
+
"board.dispatch.view": "task",
|
|
32
|
+
"board.dispatch.apply": "task",
|
|
33
|
+
"board.dispatch.advisory": "task",
|
|
34
|
+
"board.dispatch.advisories": "task",
|
|
35
|
+
"board.dispatch.revoke": "task",
|
|
20
36
|
"board.claim": "task",
|
|
21
37
|
"board.code.search": "tools",
|
|
22
38
|
"board.context.add": "task",
|
|
@@ -41,6 +57,7 @@
|
|
|
41
57
|
"board.list": "task",
|
|
42
58
|
"board.live": "live",
|
|
43
59
|
"board.live.focus": "live",
|
|
60
|
+
"board.live.opens": "live",
|
|
44
61
|
"board.live.place": "live",
|
|
45
62
|
"board.live.read": "live",
|
|
46
63
|
"board.live.say": "live",
|
|
@@ -202,101 +219,67 @@
|
|
|
202
219
|
"families": [
|
|
203
220
|
{
|
|
204
221
|
"owner": "goals",
|
|
205
|
-
"prefixes": [
|
|
206
|
-
"board.goal.",
|
|
207
|
-
"board.room."
|
|
208
|
-
]
|
|
222
|
+
"prefixes": ["board.goal.", "board.room."]
|
|
209
223
|
},
|
|
210
224
|
{
|
|
211
225
|
"owner": "swarm",
|
|
212
|
-
"prefixes": [
|
|
213
|
-
"board.swarm."
|
|
214
|
-
]
|
|
226
|
+
"prefixes": ["board.swarm."]
|
|
215
227
|
},
|
|
216
228
|
{
|
|
217
229
|
"owner": "landed",
|
|
218
|
-
"prefixes": [
|
|
219
|
-
"board.landed."
|
|
220
|
-
]
|
|
230
|
+
"prefixes": ["board.landed."]
|
|
221
231
|
},
|
|
222
232
|
{
|
|
223
233
|
"owner": "relay",
|
|
224
|
-
"prefixes": [
|
|
225
|
-
"board.relay."
|
|
226
|
-
]
|
|
234
|
+
"prefixes": ["board.relay."]
|
|
227
235
|
},
|
|
228
236
|
{
|
|
229
237
|
"owner": "place",
|
|
230
|
-
"prefixes": [
|
|
231
|
-
"board.place."
|
|
232
|
-
]
|
|
238
|
+
"prefixes": ["board.place."]
|
|
233
239
|
},
|
|
234
240
|
{
|
|
235
241
|
"owner": "live",
|
|
236
|
-
"prefixes": [
|
|
237
|
-
"board.live"
|
|
238
|
-
]
|
|
242
|
+
"prefixes": ["board.live"]
|
|
239
243
|
},
|
|
240
244
|
{
|
|
241
245
|
"owner": "watch",
|
|
242
|
-
"prefixes": [
|
|
243
|
-
"board.watch."
|
|
244
|
-
]
|
|
246
|
+
"prefixes": ["board.watch."]
|
|
245
247
|
},
|
|
246
248
|
{
|
|
247
249
|
"owner": "thread",
|
|
248
|
-
"prefixes": [
|
|
249
|
-
"board.thread."
|
|
250
|
-
]
|
|
250
|
+
"prefixes": ["board.thread."]
|
|
251
251
|
},
|
|
252
252
|
{
|
|
253
253
|
"owner": "file",
|
|
254
|
-
"prefixes": [
|
|
255
|
-
"board.file."
|
|
256
|
-
]
|
|
254
|
+
"prefixes": ["board.file."]
|
|
257
255
|
},
|
|
258
256
|
{
|
|
259
257
|
"owner": "plans",
|
|
260
|
-
"prefixes": [
|
|
261
|
-
"board.plan.",
|
|
262
|
-
"board.template."
|
|
263
|
-
]
|
|
258
|
+
"prefixes": ["board.plan.", "board.template."]
|
|
264
259
|
},
|
|
265
260
|
{
|
|
266
261
|
"owner": "projects",
|
|
267
|
-
"prefixes": [
|
|
268
|
-
"board.project."
|
|
269
|
-
]
|
|
262
|
+
"prefixes": ["board.project."]
|
|
270
263
|
},
|
|
271
264
|
{
|
|
272
265
|
"owner": "environments",
|
|
273
|
-
"prefixes": [
|
|
274
|
-
"board.environments."
|
|
275
|
-
]
|
|
266
|
+
"prefixes": ["board.environments."]
|
|
276
267
|
},
|
|
277
268
|
{
|
|
278
269
|
"owner": "nativeRequests",
|
|
279
|
-
"prefixes": [
|
|
280
|
-
"board.native."
|
|
281
|
-
]
|
|
270
|
+
"prefixes": ["board.native."]
|
|
282
271
|
},
|
|
283
272
|
{
|
|
284
273
|
"owner": "vault",
|
|
285
|
-
"prefixes": [
|
|
286
|
-
"board.vault."
|
|
287
|
-
]
|
|
274
|
+
"prefixes": ["board.vault."]
|
|
288
275
|
},
|
|
289
276
|
{
|
|
290
277
|
"owner": "desk",
|
|
291
|
-
"prefixes": [
|
|
292
|
-
"board.desk."
|
|
293
|
-
]
|
|
278
|
+
"prefixes": ["board.desk."]
|
|
294
279
|
},
|
|
295
280
|
{
|
|
296
281
|
"owner": "audit",
|
|
297
|
-
"prefixes": [
|
|
298
|
-
"board.audit."
|
|
299
|
-
]
|
|
282
|
+
"prefixes": ["board.audit."]
|
|
300
283
|
}
|
|
301
284
|
],
|
|
302
285
|
"access": {
|
|
@@ -393,7 +376,10 @@
|
|
|
393
376
|
"board.swarm.specialty",
|
|
394
377
|
"board.swarm.pin",
|
|
395
378
|
"board.swarm.offices",
|
|
396
|
-
"board.swarm.office"
|
|
379
|
+
"board.swarm.office",
|
|
380
|
+
"board.prompt.start",
|
|
381
|
+
"board.prompt.status",
|
|
382
|
+
"board.prompt.cancel"
|
|
397
383
|
],
|
|
398
384
|
"browserPerson": [
|
|
399
385
|
"board.list",
|
|
@@ -515,7 +501,10 @@
|
|
|
515
501
|
"board.vault.share",
|
|
516
502
|
"board.vault.unshare",
|
|
517
503
|
"board.vault.import",
|
|
518
|
-
"board.vault.allow"
|
|
504
|
+
"board.vault.allow",
|
|
505
|
+
"board.prompt.start",
|
|
506
|
+
"board.prompt.status",
|
|
507
|
+
"board.prompt.cancel"
|
|
519
508
|
],
|
|
520
509
|
"harnessBrowser": [
|
|
521
510
|
"board.list",
|
|
@@ -662,6 +651,7 @@
|
|
|
662
651
|
"board.live.say",
|
|
663
652
|
"board.live.read",
|
|
664
653
|
"board.live.focus",
|
|
654
|
+
"board.live.opens",
|
|
665
655
|
"t3.connect",
|
|
666
656
|
"t3.status",
|
|
667
657
|
"voice.status",
|
|
@@ -702,6 +692,7 @@
|
|
|
702
692
|
"machines.model",
|
|
703
693
|
"machines.live",
|
|
704
694
|
"machines.live.read",
|
|
695
|
+
"machines.live.open",
|
|
705
696
|
"swarm.lineup",
|
|
706
697
|
"swarm.add",
|
|
707
698
|
"swarm.remove",
|
|
@@ -772,11 +763,12 @@
|
|
|
772
763
|
"board.wait",
|
|
773
764
|
"board.landed.thread",
|
|
774
765
|
"board.landed.folder",
|
|
775
|
-
"board.landed.open"
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
"board.
|
|
766
|
+
"board.landed.open",
|
|
767
|
+
"board.prompt.start",
|
|
768
|
+
"board.prompt.status",
|
|
769
|
+
"board.prompt.cancel"
|
|
779
770
|
],
|
|
771
|
+
"plainPerson": ["board.standing.off"],
|
|
780
772
|
"plainHarnessReads": [
|
|
781
773
|
"board.list",
|
|
782
774
|
"board.get",
|
|
@@ -812,14 +804,8 @@
|
|
|
812
804
|
"agents.models",
|
|
813
805
|
"agents.model"
|
|
814
806
|
],
|
|
815
|
-
"browserLinks": [
|
|
816
|
-
|
|
817
|
-
"links.list",
|
|
818
|
-
"links.forget"
|
|
819
|
-
],
|
|
820
|
-
"browserSsh": [
|
|
821
|
-
"ssh.allow"
|
|
822
|
-
]
|
|
807
|
+
"browserLinks": ["links.allow", "links.list", "links.forget"],
|
|
808
|
+
"browserSsh": ["ssh.allow"]
|
|
823
809
|
},
|
|
824
810
|
"metadata": {
|
|
825
811
|
"task": [
|
package/lib/boardWaits.mjs
CHANGED
|
@@ -23,6 +23,8 @@ export function createBoardWaits({ head }) {
|
|
|
23
23
|
const listeners = new Set();
|
|
24
24
|
let timer = null;
|
|
25
25
|
let checkQueued = false;
|
|
26
|
+
// When a surface last waited on the local socket: one between two waits is still there.
|
|
27
|
+
let waitedAt = 0;
|
|
26
28
|
|
|
27
29
|
const revision = () => `${seen}.${outside}`;
|
|
28
30
|
|
|
@@ -71,12 +73,14 @@ export function createBoardWaits({ head }) {
|
|
|
71
73
|
},
|
|
72
74
|
/** The revision once it is not `after`: at once when it already is not, else when it moves or the hold ends. */
|
|
73
75
|
wait({ after, holdMs = MOST_HOLD_MS } = {}) {
|
|
76
|
+
waitedAt = Date.now();
|
|
74
77
|
check();
|
|
75
78
|
if (String(after ?? "") !== revision())
|
|
76
79
|
return Promise.resolve(revision());
|
|
77
80
|
const hold = Math.max(0, Math.min(MOST_HOLD_MS, Number(holdMs) || 0));
|
|
78
81
|
return new Promise((resolve) => {
|
|
79
82
|
const done = (current) => {
|
|
83
|
+
waitedAt = Date.now();
|
|
80
84
|
clearTimeout(timeout);
|
|
81
85
|
waiters.delete(done);
|
|
82
86
|
keepChecking();
|
|
@@ -89,6 +93,8 @@ export function createBoardWaits({ head }) {
|
|
|
89
93
|
},
|
|
90
94
|
/** Whether any surface waits on the local socket now: what is shown beside the board is kept fresh meanwhile. */
|
|
91
95
|
watched: () => waiters.size > 0,
|
|
96
|
+
/** When a surface last waited on the local socket, or stopped waiting (0: none yet). */
|
|
97
|
+
waitedAt: () => (waiters.size > 0 ? Date.now() : waitedAt),
|
|
92
98
|
onChange(listener) {
|
|
93
99
|
listeners.add(listener);
|
|
94
100
|
keepChecking();
|
package/lib/cards.mjs
CHANGED
|
@@ -92,7 +92,12 @@ export const roundFields = (card) => ({
|
|
|
92
92
|
// `lessons`: what the person has said about each agent (lessons.mjs), left off a card going to a caller off this computer.
|
|
93
93
|
export function swarmCards(store, entries, { home, lessons = true } = {}) {
|
|
94
94
|
const work = new Map();
|
|
95
|
-
|
|
95
|
+
const rows = store.agentWork();
|
|
96
|
+
const recent = rows
|
|
97
|
+
.slice()
|
|
98
|
+
.sort((a, b) => Date.parse(b.started_at) - Date.parse(a.started_at))
|
|
99
|
+
.slice(0, RECENT);
|
|
100
|
+
for (const row of rows) {
|
|
96
101
|
const entry = work.get(row.agent) ?? {
|
|
97
102
|
done: 0,
|
|
98
103
|
failed: 0,
|
|
@@ -146,6 +151,13 @@ export function swarmCards(store, entries, { home, lessons = true } = {}) {
|
|
|
146
151
|
about: roster.about ?? "",
|
|
147
152
|
limits: roster.limits ?? null,
|
|
148
153
|
where: roster.where ?? null,
|
|
154
|
+
editsFiles: roster.runs === "machine",
|
|
155
|
+
recentSelections: {
|
|
156
|
+
count: recent.filter((row) => row.agent === entry.id).length,
|
|
157
|
+
outOf: recent.length,
|
|
158
|
+
lastAt:
|
|
159
|
+
recent.find((row) => row.agent === entry.id)?.started_at ?? null,
|
|
160
|
+
},
|
|
149
161
|
...(roster.runs === "machine"
|
|
150
162
|
? {
|
|
151
163
|
review: roster.review === true,
|