@wrenautomation/birdwatch 0.29.0 → 0.30.1
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 +36 -53
- package/dist/app/cli.js +5 -2
- package/dist/app/cli.js.map +1 -1
- package/dist/app/config.d.ts +5 -0
- package/dist/app/config.js +53 -0
- package/dist/app/config.js.map +1 -0
- package/dist/app/engine-cli.d.ts +2 -8
- package/dist/app/engine-cli.js +34 -164
- package/dist/app/engine-cli.js.map +1 -1
- package/dist/app/index.d.ts +3 -3
- package/dist/app/index.js +3 -3
- package/dist/app/index.js.map +1 -1
- package/dist/document/extract.d.ts +1 -1
- package/dist/document/types.d.ts +2 -2
- package/dist/document/types.js +2 -2
- package/dist/engine/agent.d.ts +12 -10
- package/dist/engine/agent.js +42 -30
- package/dist/engine/agent.js.map +1 -1
- package/dist/engine/context.d.ts +9 -0
- package/dist/engine/{runner.js → context.js} +10 -78
- package/dist/engine/context.js.map +1 -0
- package/dist/engine/index.d.ts +2 -2
- package/dist/engine/index.js +2 -2
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/judge.d.ts +1 -1
- package/dist/engine/plan.d.ts +4 -4
- package/dist/engine/plan.js +4 -4
- package/dist/engine/plan.js.map +1 -1
- package/dist/{plan → engine}/plans/index.d.ts +4 -2
- package/dist/engine/plans/index.js +104 -0
- package/dist/engine/plans/index.js.map +1 -0
- package/dist/engine/ports.d.ts +9 -57
- package/dist/engine/ports.js +3 -3
- package/dist/engine/ports.js.map +1 -1
- package/dist/engine/recall.d.ts +1 -1
- package/dist/engine/state.d.ts +0 -3
- package/dist/engine/state.js +1 -25
- package/dist/engine/state.js.map +1 -1
- package/dist/engine/steps.d.ts +20 -20
- package/dist/engine/steps.js +42 -167
- package/dist/engine/steps.js.map +1 -1
- package/dist/engine/tree.d.ts +9 -2
- package/dist/engine/tree.js +16 -0
- package/dist/engine/tree.js.map +1 -1
- package/dist/{plan → engine}/types.d.ts +14 -165
- package/dist/{plan → engine}/types.js +18 -73
- package/dist/engine/types.js.map +1 -0
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/ledger/files.d.ts +1 -1
- package/dist/ledger/files.js +1 -1
- package/dist/ledger/files.js.map +1 -1
- package/dist/ledger/ledger.d.ts +2 -2
- package/dist/ledger/records.d.ts +139 -139
- package/dist/ledger/records.js +6 -6
- package/dist/ledger/records.js.map +1 -1
- package/dist/sources/arxiv.d.ts +1 -1
- package/dist/sources/google.d.ts +1 -1
- package/dist/sources/paste.d.ts +1 -1
- package/dist/sources/sites.d.ts +1 -1
- package/package.json +4 -8
- package/dist/engine/runner.d.ts +0 -30
- package/dist/engine/runner.js.map +0 -1
- package/dist/plan/index.d.ts +0 -7
- package/dist/plan/index.js +0 -8
- package/dist/plan/index.js.map +0 -1
- package/dist/plan/model.d.ts +0 -6
- package/dist/plan/model.js +0 -7
- package/dist/plan/model.js.map +0 -1
- package/dist/plan/plan.d.ts +0 -31
- package/dist/plan/plan.js +0 -87
- package/dist/plan/plan.js.map +0 -1
- package/dist/plan/plans/index.js +0 -236
- package/dist/plan/plans/index.js.map +0 -1
- package/dist/plan/render.d.ts +0 -41
- package/dist/plan/render.js +0 -75
- package/dist/plan/render.js.map +0 -1
- package/dist/plan/review.d.ts +0 -11
- package/dist/plan/review.js +0 -39
- package/dist/plan/review.js.map +0 -1
- package/dist/plan/triage.d.ts +0 -18
- package/dist/plan/triage.js +0 -65
- package/dist/plan/triage.js.map +0 -1
- package/dist/plan/types.js.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* source shows for free, because the engine depends on the planner and not the reverse.
|
|
2
|
+
* The ask and its plan file: what to look for, who asked, the tuned recipe per ask kind (sources,
|
|
3
|
+
* budget, tree guide). The agent plans; these are its shapes. `HitView` is a hit's free fields;
|
|
4
|
+
* the ledger's records extend these, so old ledgers still parse.
|
|
6
5
|
*/
|
|
7
6
|
import { z } from "zod";
|
|
8
7
|
export declare const AskKind: z.ZodEnum<{
|
|
@@ -13,7 +12,7 @@ export declare const AskKind: z.ZodEnum<{
|
|
|
13
12
|
site: "site";
|
|
14
13
|
}>;
|
|
15
14
|
export type AskKind = z.infer<typeof AskKind>;
|
|
16
|
-
/** Who wrote a record:
|
|
15
|
+
/** Who wrote a record: the agent or a person. */
|
|
17
16
|
export declare const From: z.ZodEnum<{
|
|
18
17
|
ai: "ai";
|
|
19
18
|
human: "human";
|
|
@@ -71,30 +70,6 @@ export declare const Query: z.ZodObject<{
|
|
|
71
70
|
by: z.ZodString;
|
|
72
71
|
}, z.core.$strip>;
|
|
73
72
|
export type Query = z.infer<typeof Query>;
|
|
74
|
-
/** Queries from one proposer. The model is one; a plan file, a teammate or a second model are others. */
|
|
75
|
-
export declare const Proposal: z.ZodObject<{
|
|
76
|
-
from: z.ZodEnum<{
|
|
77
|
-
ai: "ai";
|
|
78
|
-
human: "human";
|
|
79
|
-
}>;
|
|
80
|
-
by: z.ZodString;
|
|
81
|
-
queries: z.ZodArray<z.ZodObject<{
|
|
82
|
-
kind: z.ZodEnum<{
|
|
83
|
-
video: "video";
|
|
84
|
-
channel: "channel";
|
|
85
|
-
web: "web";
|
|
86
|
-
person: "person";
|
|
87
|
-
site: "site";
|
|
88
|
-
}>;
|
|
89
|
-
why: z.ZodString;
|
|
90
|
-
site: z.ZodOptional<z.ZodString>;
|
|
91
|
-
terms: z.ZodString;
|
|
92
|
-
facet: z.ZodOptional<z.ZodString>;
|
|
93
|
-
tier: z.ZodOptional<z.ZodNumber>;
|
|
94
|
-
needs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
95
|
-
}, z.core.$strip>>;
|
|
96
|
-
}, z.core.$strip>;
|
|
97
|
-
export type Proposal = z.infer<typeof Proposal>;
|
|
98
73
|
/** One query as a leaf of the tree: what a person would type, and why. */
|
|
99
74
|
export declare const Leaf: z.ZodObject<{
|
|
100
75
|
terms: z.ZodString;
|
|
@@ -149,10 +124,9 @@ export declare const Budget: z.ZodObject<{
|
|
|
149
124
|
}, z.core.$strip>;
|
|
150
125
|
export type Budget = z.infer<typeof Budget>;
|
|
151
126
|
/**
|
|
152
|
-
* The recipe for one ask kind: the
|
|
153
|
-
* tuned like an SOP, stored beside the ledger.
|
|
154
|
-
*
|
|
155
|
-
* also `{gaps}` and `{checks}`.
|
|
127
|
+
* The recipe for one ask kind: the sources it may use, the budget, the tree guide. Versioned and
|
|
128
|
+
* tuned like an SOP, stored beside the ledger. A file from before 0.30.0 carries the old
|
|
129
|
+
* model planner's prompts: parsing drops them.
|
|
156
130
|
*/
|
|
157
131
|
export declare const PlanFile: z.ZodObject<{
|
|
158
132
|
id: z.ZodString;
|
|
@@ -164,9 +138,6 @@ export declare const PlanFile: z.ZodObject<{
|
|
|
164
138
|
site: "site";
|
|
165
139
|
}>;
|
|
166
140
|
version: z.ZodNumber;
|
|
167
|
-
propose: z.ZodString;
|
|
168
|
-
triage: z.ZodString;
|
|
169
|
-
review: z.ZodString;
|
|
170
141
|
sources: z.ZodArray<z.ZodString>;
|
|
171
142
|
budget: z.ZodObject<{
|
|
172
143
|
queries: z.ZodNumber;
|
|
@@ -175,6 +146,7 @@ export declare const PlanFile: z.ZodObject<{
|
|
|
175
146
|
checks: z.ZodDefault<z.ZodNumber>;
|
|
176
147
|
}, z.core.$strip>;
|
|
177
148
|
age: z.ZodOptional<z.ZodString>;
|
|
149
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
178
150
|
tree: z.ZodOptional<z.ZodObject<{
|
|
179
151
|
facets: z.ZodArray<z.ZodObject<{
|
|
180
152
|
name: z.ZodString;
|
|
@@ -189,7 +161,7 @@ export declare const PlanFile: z.ZodObject<{
|
|
|
189
161
|
}, z.core.$strip>>;
|
|
190
162
|
}, z.core.$strip>;
|
|
191
163
|
export type PlanFile = z.infer<typeof PlanFile>;
|
|
192
|
-
/** What a source, channel or proposer yielded before. The
|
|
164
|
+
/** What a source, channel or proposer yielded before. The files ledger writes it. */
|
|
193
165
|
export declare const YieldRow: z.ZodObject<{
|
|
194
166
|
by: z.ZodOptional<z.ZodString>;
|
|
195
167
|
source: z.ZodOptional<z.ZodString>;
|
|
@@ -207,7 +179,7 @@ export declare const YieldRow: z.ZodObject<{
|
|
|
207
179
|
kept: z.ZodNumber;
|
|
208
180
|
}, z.core.$strip>;
|
|
209
181
|
export type YieldRow = z.infer<typeof YieldRow>;
|
|
210
|
-
/** What
|
|
182
|
+
/** What a round was planned from, kept with its snapshot. */
|
|
211
183
|
export declare const Snapshot: z.ZodObject<{
|
|
212
184
|
at: z.ZodString;
|
|
213
185
|
known: z.ZodArray<z.ZodString>;
|
|
@@ -219,66 +191,6 @@ export declare const Snapshot: z.ZodObject<{
|
|
|
219
191
|
yieldRows: z.ZodNumber;
|
|
220
192
|
}, z.core.$strip>;
|
|
221
193
|
export type Snapshot = z.infer<typeof Snapshot>;
|
|
222
|
-
export declare const Plan: z.ZodObject<{
|
|
223
|
-
ask: z.ZodObject<{
|
|
224
|
-
text: z.ZodString;
|
|
225
|
-
kind: z.ZodEnum<{
|
|
226
|
-
video: "video";
|
|
227
|
-
channel: "channel";
|
|
228
|
-
web: "web";
|
|
229
|
-
person: "person";
|
|
230
|
-
site: "site";
|
|
231
|
-
}>;
|
|
232
|
-
known: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
233
|
-
premises: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
234
|
-
steer: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
235
|
-
open: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
236
|
-
criteria: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
237
|
-
name: z.ZodString;
|
|
238
|
-
question: z.ZodString;
|
|
239
|
-
}, z.core.$strip>>>;
|
|
240
|
-
site: z.ZodOptional<z.ZodString>;
|
|
241
|
-
}, z.core.$strip>;
|
|
242
|
-
round: z.ZodNumber;
|
|
243
|
-
queries: z.ZodArray<z.ZodObject<{
|
|
244
|
-
kind: z.ZodEnum<{
|
|
245
|
-
video: "video";
|
|
246
|
-
channel: "channel";
|
|
247
|
-
web: "web";
|
|
248
|
-
person: "person";
|
|
249
|
-
site: "site";
|
|
250
|
-
}>;
|
|
251
|
-
terms: z.ZodString;
|
|
252
|
-
site: z.ZodOptional<z.ZodString>;
|
|
253
|
-
why: z.ZodString;
|
|
254
|
-
facet: z.ZodOptional<z.ZodString>;
|
|
255
|
-
tier: z.ZodOptional<z.ZodNumber>;
|
|
256
|
-
needs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
257
|
-
from: z.ZodEnum<{
|
|
258
|
-
ai: "ai";
|
|
259
|
-
human: "human";
|
|
260
|
-
}>;
|
|
261
|
-
by: z.ZodString;
|
|
262
|
-
}, z.core.$strip>>;
|
|
263
|
-
sources: z.ZodArray<z.ZodString>;
|
|
264
|
-
budget: z.ZodObject<{
|
|
265
|
-
queries: z.ZodNumber;
|
|
266
|
-
reads: z.ZodNumber;
|
|
267
|
-
rounds: z.ZodNumber;
|
|
268
|
-
checks: z.ZodDefault<z.ZodNumber>;
|
|
269
|
-
}, z.core.$strip>;
|
|
270
|
-
snapshot: z.ZodObject<{
|
|
271
|
-
at: z.ZodString;
|
|
272
|
-
known: z.ZodArray<z.ZodString>;
|
|
273
|
-
planFile: z.ZodObject<{
|
|
274
|
-
id: z.ZodString;
|
|
275
|
-
version: z.ZodNumber;
|
|
276
|
-
}, z.core.$strip>;
|
|
277
|
-
model: z.ZodNullable<z.ZodString>;
|
|
278
|
-
yieldRows: z.ZodNumber;
|
|
279
|
-
}, z.core.$strip>;
|
|
280
|
-
}, z.core.$strip>;
|
|
281
|
-
export type Plan = z.infer<typeof Plan>;
|
|
282
194
|
/** A hit as a source shows it for free: no read has happened. `sources` is every source that returned it. */
|
|
283
195
|
export declare const HitView: z.ZodObject<{
|
|
284
196
|
url: z.ZodString;
|
|
@@ -293,17 +205,6 @@ export declare const HitView: z.ZodObject<{
|
|
|
293
205
|
export type HitView = z.infer<typeof HitView>;
|
|
294
206
|
/** A hit as a caller may pass it: `sources` optional. */
|
|
295
207
|
export type HitViewIn = z.input<typeof HitView>;
|
|
296
|
-
export declare const Triage: z.ZodObject<{
|
|
297
|
-
url: z.ZodString;
|
|
298
|
-
read: z.ZodBoolean;
|
|
299
|
-
why: z.ZodString;
|
|
300
|
-
from: z.ZodEnum<{
|
|
301
|
-
ai: "ai";
|
|
302
|
-
human: "human";
|
|
303
|
-
}>;
|
|
304
|
-
by: z.ZodString;
|
|
305
|
-
}, z.core.$strip>;
|
|
306
|
-
export type Triage = z.infer<typeof Triage>;
|
|
307
208
|
/** The extractor's word on one read document: how much of the ask it served, what is still missing. */
|
|
308
209
|
export declare const Verdict: z.ZodObject<{
|
|
309
210
|
url: z.ZodString;
|
|
@@ -316,63 +217,11 @@ export declare const Verdict: z.ZodObject<{
|
|
|
316
217
|
gap: z.ZodOptional<z.ZodString>;
|
|
317
218
|
}, z.core.$strip>;
|
|
318
219
|
export type Verdict = z.infer<typeof Verdict>;
|
|
319
|
-
/** What one round came to, as counts, verdicts and notes. The runner fills it; the planner reads it. */
|
|
320
|
-
export declare const Round: z.ZodObject<{
|
|
321
|
-
ask: z.ZodObject<{
|
|
322
|
-
text: z.ZodString;
|
|
323
|
-
kind: z.ZodEnum<{
|
|
324
|
-
video: "video";
|
|
325
|
-
channel: "channel";
|
|
326
|
-
web: "web";
|
|
327
|
-
person: "person";
|
|
328
|
-
site: "site";
|
|
329
|
-
}>;
|
|
330
|
-
known: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
331
|
-
premises: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
332
|
-
steer: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
333
|
-
open: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
334
|
-
criteria: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
335
|
-
name: z.ZodString;
|
|
336
|
-
question: z.ZodString;
|
|
337
|
-
}, z.core.$strip>>>;
|
|
338
|
-
site: z.ZodOptional<z.ZodString>;
|
|
339
|
-
}, z.core.$strip>;
|
|
340
|
-
round: z.ZodNumber;
|
|
341
|
-
budget: z.ZodObject<{
|
|
342
|
-
queries: z.ZodNumber;
|
|
343
|
-
reads: z.ZodNumber;
|
|
344
|
-
rounds: z.ZodNumber;
|
|
345
|
-
checks: z.ZodDefault<z.ZodNumber>;
|
|
346
|
-
}, z.core.$strip>;
|
|
347
|
-
hits: z.ZodNumber;
|
|
348
|
-
reads: z.ZodNumber;
|
|
349
|
-
proposed: z.ZodNumber;
|
|
350
|
-
kept: z.ZodNumber;
|
|
351
|
-
found: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
352
|
-
notes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
353
|
-
verdicts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
354
|
-
url: z.ZodString;
|
|
355
|
-
quality: z.ZodEnum<{
|
|
356
|
-
rich: "rich";
|
|
357
|
-
thin: "thin";
|
|
358
|
-
off: "off";
|
|
359
|
-
empty: "empty";
|
|
360
|
-
}>;
|
|
361
|
-
gap: z.ZodOptional<z.ZodString>;
|
|
362
|
-
}, z.core.$strip>>>;
|
|
363
|
-
gaps: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
364
|
-
checks: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
365
|
-
earlier: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
366
|
-
hits: z.ZodNumber;
|
|
367
|
-
kept: z.ZodNumber;
|
|
368
|
-
}, z.core.$strip>>>;
|
|
369
|
-
}, z.core.$strip>;
|
|
370
|
-
export type Round = z.infer<typeof Round>;
|
|
371
220
|
export declare const Step: z.ZodEnum<{
|
|
372
|
-
triage: "triage";
|
|
373
|
-
read: "read";
|
|
374
221
|
plan: "plan";
|
|
375
222
|
fetch: "fetch";
|
|
223
|
+
triage: "triage";
|
|
224
|
+
read: "read";
|
|
376
225
|
extract: "extract";
|
|
377
226
|
}>;
|
|
378
227
|
export type Step = z.infer<typeof Step>;
|
|
@@ -384,10 +233,10 @@ export declare const Edge: z.ZodObject<{
|
|
|
384
233
|
back: "back";
|
|
385
234
|
}>;
|
|
386
235
|
to: z.ZodOptional<z.ZodEnum<{
|
|
387
|
-
triage: "triage";
|
|
388
|
-
read: "read";
|
|
389
236
|
plan: "plan";
|
|
390
237
|
fetch: "fetch";
|
|
238
|
+
triage: "triage";
|
|
239
|
+
read: "read";
|
|
391
240
|
extract: "extract";
|
|
392
241
|
}>>;
|
|
393
242
|
why: z.ZodString;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* source shows for free, because the engine depends on the planner and not the reverse.
|
|
2
|
+
* The ask and its plan file: what to look for, who asked, the tuned recipe per ask kind (sources,
|
|
3
|
+
* budget, tree guide). The agent plans; these are its shapes. `HitView` is a hit's free fields;
|
|
4
|
+
* the ledger's records extend these, so old ledgers still parse.
|
|
6
5
|
*/
|
|
7
6
|
import { z } from "zod";
|
|
8
7
|
export const AskKind = z.enum(["web", "video", "channel", "person", "site"]);
|
|
9
|
-
/** Who wrote a record:
|
|
8
|
+
/** Who wrote a record: the agent or a person. */
|
|
10
9
|
export const From = z.enum(["ai", "human"]);
|
|
11
10
|
/**
|
|
12
11
|
* One yes-or-no test a good source passes, named: the judge answers it on every hit and every
|
|
@@ -20,13 +19,13 @@ export const Criterion = z.object({
|
|
|
20
19
|
export const Ask = z.object({
|
|
21
20
|
text: z.string().min(1),
|
|
22
21
|
kind: AskKind,
|
|
23
|
-
/** Facts already in hand, one line each: the
|
|
22
|
+
/** Facts already in hand, one line each: the plan looks past them. */
|
|
24
23
|
known: z.array(z.string()).default([]),
|
|
25
24
|
/** Lines taken as given with no source behind them: the plan tests each, never looks past it. */
|
|
26
25
|
premises: z.array(z.string()).default([]),
|
|
27
|
-
/** What the person said along the way, one line each:
|
|
26
|
+
/** What the person said along the way, one line each: the brief shows it first. */
|
|
28
27
|
steer: z.array(z.string()).default([]),
|
|
29
|
-
/** What the last round left open, one line each: its
|
|
28
|
+
/** What the last round left open, one line each: its edge's why, its gaps. The next plan looks there first. */
|
|
30
29
|
open: z.array(z.string()).default([]),
|
|
31
30
|
/** The person's tests of a good source; empty: none. */
|
|
32
31
|
criteria: z.array(Criterion).default([]),
|
|
@@ -49,12 +48,6 @@ export const Query = z.object({
|
|
|
49
48
|
/** Model id, plan file id or a person's name. */
|
|
50
49
|
by: z.string(),
|
|
51
50
|
});
|
|
52
|
-
/** Queries from one proposer. The model is one; a plan file, a teammate or a second model are others. */
|
|
53
|
-
export const Proposal = z.object({
|
|
54
|
-
from: From,
|
|
55
|
-
by: z.string(),
|
|
56
|
-
queries: z.array(Query.omit({ from: true, by: true })),
|
|
57
|
-
});
|
|
58
51
|
/** One query as a leaf of the tree: what a person would type, and why. */
|
|
59
52
|
export const Leaf = z.object({
|
|
60
53
|
terms: z.string().min(1),
|
|
@@ -83,36 +76,31 @@ export const TreeGuide = z.object({
|
|
|
83
76
|
thin: z.number().int().nonnegative(),
|
|
84
77
|
});
|
|
85
78
|
export const Budget = z.object({
|
|
86
|
-
/** Queries per round
|
|
79
|
+
/** Queries per round: a guard rail the brief shows, never a cap. */
|
|
87
80
|
queries: z.number().int().positive(),
|
|
88
81
|
/** Documents to read per round. */
|
|
89
82
|
reads: z.number().int().positive(),
|
|
90
|
-
/** Rounds before
|
|
83
|
+
/** Rounds before a review should stop: a guard rail; past it the why says why. */
|
|
91
84
|
rounds: z.number().int().positive(),
|
|
92
85
|
/** Kept findings per round that a model checks against their document: a sample spread across the documents. 0: none. */
|
|
93
86
|
checks: z.number().int().nonnegative().default(3),
|
|
94
87
|
});
|
|
95
88
|
/**
|
|
96
|
-
* The recipe for one ask kind: the
|
|
97
|
-
* tuned like an SOP, stored beside the ledger.
|
|
98
|
-
*
|
|
99
|
-
* also `{gaps}` and `{checks}`.
|
|
89
|
+
* The recipe for one ask kind: the sources it may use, the budget, the tree guide. Versioned and
|
|
90
|
+
* tuned like an SOP, stored beside the ledger. A file from before 0.30.0 carries the old
|
|
91
|
+
* model planner's prompts: parsing drops them.
|
|
100
92
|
*/
|
|
101
93
|
export const PlanFile = z.object({
|
|
102
94
|
id: z.string().min(1),
|
|
103
95
|
kind: AskKind,
|
|
104
96
|
version: z.number().int().positive(),
|
|
105
|
-
/** Asks the model for queries. Must say to answer with `{"queries":[{"terms","why","site?"}]}`. */
|
|
106
|
-
propose: z.string().min(1),
|
|
107
|
-
/** Asks the model to read or skip each hit. Must say to answer with `{"hits":[{"url","read","why"}]}`. */
|
|
108
|
-
triage: z.string().min(1),
|
|
109
|
-
/** Asks the model which edge to take after a round. Must say to answer with `{"next","to?","why"}`. */
|
|
110
|
-
review: z.string().min(1),
|
|
111
97
|
/** Source names a run may use, in order of preference. A run can narrow the list, never widen it. */
|
|
112
98
|
sources: z.array(z.string()),
|
|
113
99
|
budget: Budget,
|
|
114
|
-
/** How much a source's age counts for this kind, one sentence
|
|
100
|
+
/** How much a source's age counts for this kind, one sentence the brief shows. Never a cutoff. */
|
|
115
101
|
age: z.string().optional(),
|
|
102
|
+
/** What the agent heeds for this kind when it plans and triages, one line each. Absent: the kind's default. */
|
|
103
|
+
rules: z.array(z.string().min(1)).optional(),
|
|
116
104
|
/** The facets a query tree of this kind covers. Absent on a file from before version 6: the kind's default. */
|
|
117
105
|
tree: TreeGuide.optional(),
|
|
118
106
|
/**
|
|
@@ -128,7 +116,7 @@ export const PlanFile = z.object({
|
|
|
128
116
|
})
|
|
129
117
|
.optional(),
|
|
130
118
|
});
|
|
131
|
-
/** What a source, channel or proposer yielded before. The
|
|
119
|
+
/** What a source, channel or proposer yielded before. The files ledger writes it. */
|
|
132
120
|
export const YieldRow = z.object({
|
|
133
121
|
by: z.string().optional(),
|
|
134
122
|
source: z.string().optional(),
|
|
@@ -139,7 +127,7 @@ export const YieldRow = z.object({
|
|
|
139
127
|
proposed: z.number().int().nonnegative(),
|
|
140
128
|
kept: z.number().int().nonnegative(),
|
|
141
129
|
});
|
|
142
|
-
/** What
|
|
130
|
+
/** What a round was planned from, kept with its snapshot. */
|
|
143
131
|
export const Snapshot = z.object({
|
|
144
132
|
at: z.string(),
|
|
145
133
|
known: z.array(z.string()),
|
|
@@ -147,14 +135,6 @@ export const Snapshot = z.object({
|
|
|
147
135
|
model: z.string().nullable(),
|
|
148
136
|
yieldRows: z.number().int().nonnegative(),
|
|
149
137
|
});
|
|
150
|
-
export const Plan = z.object({
|
|
151
|
-
ask: Ask,
|
|
152
|
-
round: z.number().int().positive(),
|
|
153
|
-
queries: z.array(Query),
|
|
154
|
-
sources: z.array(z.string()),
|
|
155
|
-
budget: Budget,
|
|
156
|
-
snapshot: Snapshot,
|
|
157
|
-
});
|
|
158
138
|
/** A hit as a source shows it for free: no read has happened. `sources` is every source that returned it. */
|
|
159
139
|
export const HitView = z.object({
|
|
160
140
|
url: z.string().min(1),
|
|
@@ -166,50 +146,15 @@ export const HitView = z.object({
|
|
|
166
146
|
date: z.string().optional(),
|
|
167
147
|
snippet: z.string().optional(),
|
|
168
148
|
sources: z.array(z.string()).default([]),
|
|
169
|
-
/** The judge's yes odds by question (serves, each criterion): a hint the
|
|
149
|
+
/** The judge's yes odds by question (serves, each criterion): a hint the brief shows. */
|
|
170
150
|
odds: z.record(z.string(), z.number()).optional(),
|
|
171
151
|
});
|
|
172
|
-
export const Triage = z.object({
|
|
173
|
-
url: z.string(),
|
|
174
|
-
read: z.boolean(),
|
|
175
|
-
/** The model's line on a read; a skip's is fixed text, so the model writes none. */
|
|
176
|
-
why: z.string(),
|
|
177
|
-
from: From,
|
|
178
|
-
by: z.string(),
|
|
179
|
-
});
|
|
180
152
|
/** The extractor's word on one read document: how much of the ask it served, what is still missing. */
|
|
181
153
|
export const Verdict = z.object({
|
|
182
154
|
url: z.string(),
|
|
183
155
|
quality: z.enum(["rich", "thin", "off", "empty"]),
|
|
184
156
|
gap: z.string().optional(),
|
|
185
157
|
});
|
|
186
|
-
/** What one round came to, as counts, verdicts and notes. The runner fills it; the planner reads it. */
|
|
187
|
-
export const Round = z.object({
|
|
188
|
-
ask: Ask,
|
|
189
|
-
round: z.number().int().positive(),
|
|
190
|
-
budget: Budget,
|
|
191
|
-
hits: z.number().int().nonnegative(),
|
|
192
|
-
reads: z.number().int().nonnegative(),
|
|
193
|
-
proposed: z.number().int().nonnegative(),
|
|
194
|
-
kept: z.number().int().nonnegative(),
|
|
195
|
-
/** What the kept findings say, one line each: the planner sees what is answered. */
|
|
196
|
-
found: z.array(z.string()).default([]),
|
|
197
|
-
/** What went wrong or ran out, one line each. */
|
|
198
|
-
notes: z.array(z.string()).default([]),
|
|
199
|
-
/** The extractor's verdict on each document read this round: the planner sees what the reads were worth. */
|
|
200
|
-
verdicts: z.array(Verdict).default([]),
|
|
201
|
-
/** What a step or a person said the round lacks, one line each, the step or the person first. */
|
|
202
|
-
gaps: z.array(z.string()).default([]),
|
|
203
|
-
/** The sample check: whether each checked finding's quote backs it, one line each. */
|
|
204
|
-
checks: z.array(z.string()).default([]),
|
|
205
|
-
/** Each earlier round's new hits and kept findings: the review sees the trend, and decides. */
|
|
206
|
-
earlier: z
|
|
207
|
-
.array(z.object({
|
|
208
|
-
hits: z.number().int().nonnegative(),
|
|
209
|
-
kept: z.number().int().nonnegative(),
|
|
210
|
-
}))
|
|
211
|
-
.default([]),
|
|
212
|
-
});
|
|
213
158
|
export const Step = z.enum(["plan", "fetch", "triage", "read", "extract"]);
|
|
214
159
|
/** The edge out of a round. `again` is a new round from `plan`; `back` reruns one step of this round. */
|
|
215
160
|
export const Edge = z.object({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/engine/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,M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,QAAQ,EAAE;IACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,IAAI;IACV,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAC;AAGH,OAAO,EAAE,CAAC,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* birdwatch: research from the open web, one step per command, every record
|
|
3
|
-
* doors: `./engine` (the
|
|
4
|
-
* `./sources` (SearXNG, Exa, Google, arXiv, yt-dlp, the
|
|
5
|
-
* paste, the ledger), `./ledger` (the records, a folder of
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
2
|
+
* birdwatch: research from the open web, driven by an agent one step per command, every record
|
|
3
|
+
* in a ledger. Five doors: `./engine` (the ask and plan files, the source port, registry, run
|
|
4
|
+
* state, the steps and the agent commands), `./sources` (SearXNG, Exa, Google, arXiv, yt-dlp, the
|
|
5
|
+
* site readers, the fetcher, the ladder, a paste, the ledger), `./ledger` (the records, a folder of
|
|
6
|
+
* JSON lines per run per writer, yield rows), `./document` (`Document`, `Finding`, `Proof`, readers
|
|
7
|
+
* by media, the claim extractor) and this root (the engine's CLI commands, `addEngineCommands`,
|
|
8
|
+
* for a host that mounts them on its own program). Reading the web and files is
|
|
9
|
+
* `@wrenautomation/read`'s; every model call goes through `@wrenautomation/models`. Design: wren's
|
|
10
|
+
* `designs/2026-10-26-research-engine.md`.
|
|
11
11
|
*/
|
|
12
12
|
export * from "./app/index.js";
|
|
13
13
|
export * from "./engine/index.js";
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* birdwatch: research from the open web, one step per command, every record
|
|
3
|
-
* doors: `./engine` (the
|
|
4
|
-
* `./sources` (SearXNG, Exa, Google, arXiv, yt-dlp, the
|
|
5
|
-
* paste, the ledger), `./ledger` (the records, a folder of
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
2
|
+
* birdwatch: research from the open web, driven by an agent one step per command, every record
|
|
3
|
+
* in a ledger. Five doors: `./engine` (the ask and plan files, the source port, registry, run
|
|
4
|
+
* state, the steps and the agent commands), `./sources` (SearXNG, Exa, Google, arXiv, yt-dlp, the
|
|
5
|
+
* site readers, the fetcher, the ladder, a paste, the ledger), `./ledger` (the records, a folder of
|
|
6
|
+
* JSON lines per run per writer, yield rows), `./document` (`Document`, `Finding`, `Proof`, readers
|
|
7
|
+
* by media, the claim extractor) and this root (the engine's CLI commands, `addEngineCommands`,
|
|
8
|
+
* for a host that mounts them on its own program). Reading the web and files is
|
|
9
|
+
* `@wrenautomation/read`'s; every model call goes through `@wrenautomation/models`. Design: wren's
|
|
10
|
+
* `designs/2026-10-26-research-engine.md`.
|
|
11
11
|
*/
|
|
12
12
|
export * from "./app/index.js";
|
|
13
13
|
export * from "./engine/index.js";
|
package/dist/ledger/files.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AskKind, PlanFile } from "../
|
|
1
|
+
import { type AskKind, PlanFile } from "../engine/types.js";
|
|
2
2
|
import { type Filter, type Ledger, type YieldFilter } from "./ledger.js";
|
|
3
3
|
import { LedgerRecord } from "./records.js";
|
|
4
4
|
/** A line the backend could not read: a partial last line from a killed writer, or a record it does not know. */
|
package/dist/ledger/files.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { appendFile, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
8
8
|
import { join } from "node:path";
|
|
9
|
-
import { PlanFile } from "../
|
|
9
|
+
import { PlanFile } from "../engine/types.js";
|
|
10
10
|
import { matches, yieldRows } from "./ledger.js";
|
|
11
11
|
import { byTime, LedgerRecord } from "./records.js";
|
|
12
12
|
const safe = (name) => name.replace(/[^A-Za-z0-9._-]+/g, "-");
|
package/dist/ledger/files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/ledger/files.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAgB,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/ledger/files.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAgB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAA4B,OAAO,EAAoB,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AASpD,MAAM,IAAI,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;AAE9E,MAAM,MAAM,GAAG,KAAK,EAAE,GAAW,EAAqB,EAAE;IACtD,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAAyB,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,CAAC;QAC5D,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,OAAO,WAAW;IAMX;IACA;IANX,2FAA2F;IAClF,QAAQ,GAAc,EAAE,CAAC;IAElC,sGAAsG;I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D,CAAC;IAED,sGAAsG;IACtG,KAAK,CAAC,QAAQ,CAAC,IAAa;QAC1B,IAAI,CAAC;YACH,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACjF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAK,GAAyB,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAC9D,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAAkB;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/ledger/ledger.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The ledger contract: four calls every backend answers. `append` one record; `trace` one run's
|
|
3
3
|
* records in time order; `scan` records across runs by a filter; `yield` what sources, proposers,
|
|
4
|
-
* channels and ask kinds yielded, as the
|
|
4
|
+
* channels and ask kinds yielded, as the yield rows. The yield is a fold over records, shared here
|
|
5
5
|
* so the files backend and a database compute the same rows (a database may do it in SQL).
|
|
6
6
|
*/
|
|
7
|
-
import type { AskKind, PlanFile, YieldRow } from "../
|
|
7
|
+
import type { AskKind, PlanFile, YieldRow } from "../engine/types.js";
|
|
8
8
|
import { type From, type LedgerRecord, type RecordOf, type RecordType, type Step } from "./records.js";
|
|
9
9
|
export interface Filter {
|
|
10
10
|
run?: string;
|