@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.
Files changed (84) hide show
  1. package/README.md +36 -53
  2. package/dist/app/cli.js +5 -2
  3. package/dist/app/cli.js.map +1 -1
  4. package/dist/app/config.d.ts +5 -0
  5. package/dist/app/config.js +53 -0
  6. package/dist/app/config.js.map +1 -0
  7. package/dist/app/engine-cli.d.ts +2 -8
  8. package/dist/app/engine-cli.js +34 -164
  9. package/dist/app/engine-cli.js.map +1 -1
  10. package/dist/app/index.d.ts +3 -3
  11. package/dist/app/index.js +3 -3
  12. package/dist/app/index.js.map +1 -1
  13. package/dist/document/extract.d.ts +1 -1
  14. package/dist/document/types.d.ts +2 -2
  15. package/dist/document/types.js +2 -2
  16. package/dist/engine/agent.d.ts +12 -10
  17. package/dist/engine/agent.js +42 -30
  18. package/dist/engine/agent.js.map +1 -1
  19. package/dist/engine/context.d.ts +9 -0
  20. package/dist/engine/{runner.js → context.js} +10 -78
  21. package/dist/engine/context.js.map +1 -0
  22. package/dist/engine/index.d.ts +2 -2
  23. package/dist/engine/index.js +2 -2
  24. package/dist/engine/index.js.map +1 -1
  25. package/dist/engine/judge.d.ts +1 -1
  26. package/dist/engine/plan.d.ts +4 -4
  27. package/dist/engine/plan.js +4 -4
  28. package/dist/engine/plan.js.map +1 -1
  29. package/dist/{plan → engine}/plans/index.d.ts +4 -2
  30. package/dist/engine/plans/index.js +104 -0
  31. package/dist/engine/plans/index.js.map +1 -0
  32. package/dist/engine/ports.d.ts +9 -57
  33. package/dist/engine/ports.js +3 -3
  34. package/dist/engine/ports.js.map +1 -1
  35. package/dist/engine/recall.d.ts +1 -1
  36. package/dist/engine/state.d.ts +0 -3
  37. package/dist/engine/state.js +1 -25
  38. package/dist/engine/state.js.map +1 -1
  39. package/dist/engine/steps.d.ts +20 -20
  40. package/dist/engine/steps.js +42 -167
  41. package/dist/engine/steps.js.map +1 -1
  42. package/dist/engine/tree.d.ts +9 -2
  43. package/dist/engine/tree.js +16 -0
  44. package/dist/engine/tree.js.map +1 -1
  45. package/dist/{plan → engine}/types.d.ts +14 -165
  46. package/dist/{plan → engine}/types.js +18 -73
  47. package/dist/engine/types.js.map +1 -0
  48. package/dist/index.d.ts +9 -9
  49. package/dist/index.js +9 -9
  50. package/dist/ledger/files.d.ts +1 -1
  51. package/dist/ledger/files.js +1 -1
  52. package/dist/ledger/files.js.map +1 -1
  53. package/dist/ledger/ledger.d.ts +2 -2
  54. package/dist/ledger/records.d.ts +139 -139
  55. package/dist/ledger/records.js +6 -6
  56. package/dist/ledger/records.js.map +1 -1
  57. package/dist/sources/arxiv.d.ts +1 -1
  58. package/dist/sources/google.d.ts +1 -1
  59. package/dist/sources/paste.d.ts +1 -1
  60. package/dist/sources/sites.d.ts +1 -1
  61. package/package.json +4 -8
  62. package/dist/engine/runner.d.ts +0 -30
  63. package/dist/engine/runner.js.map +0 -1
  64. package/dist/plan/index.d.ts +0 -7
  65. package/dist/plan/index.js +0 -8
  66. package/dist/plan/index.js.map +0 -1
  67. package/dist/plan/model.d.ts +0 -6
  68. package/dist/plan/model.js +0 -7
  69. package/dist/plan/model.js.map +0 -1
  70. package/dist/plan/plan.d.ts +0 -31
  71. package/dist/plan/plan.js +0 -87
  72. package/dist/plan/plan.js.map +0 -1
  73. package/dist/plan/plans/index.js +0 -236
  74. package/dist/plan/plans/index.js.map +0 -1
  75. package/dist/plan/render.d.ts +0 -41
  76. package/dist/plan/render.js +0 -75
  77. package/dist/plan/render.js.map +0 -1
  78. package/dist/plan/review.d.ts +0 -11
  79. package/dist/plan/review.js +0 -39
  80. package/dist/plan/review.js.map +0 -1
  81. package/dist/plan/triage.d.ts +0 -18
  82. package/dist/plan/triage.js +0 -65
  83. package/dist/plan/triage.js.map +0 -1
  84. package/dist/plan/types.js.map +0 -1
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * The engine: ports (`Source`, `Deps`), the source registry and allow-list, the canonical URL,
3
- * the run state as a fold of the ledger, the step table and the runner that interprets it.
3
+ * the ask and plan files, the run state as a fold of the ledger, the steps and the agent commands.
4
4
  */
5
5
  export * from "./agent.js";
6
6
  export * from "./canonical.js";
7
+ export * from "./context.js";
7
8
  export * from "./cost.js";
8
9
  export * from "./judge.js";
9
10
  export * from "./people.js";
10
11
  export * from "./plan.js";
11
12
  export * from "./ports.js";
12
13
  export * from "./recall.js";
13
- export * from "./runner.js";
14
14
  export * from "./state.js";
15
15
  export * from "./steps.js";
16
16
  export * from "./view.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { type Judged, type Questions } from "@wrenautomation/models/judge";
9
9
  import { type FindingRecord, type SourceClass } from "../ledger/records.js";
10
- import type { Criterion } from "../plan/index.js";
10
+ import type { Criterion } from "./plan.js";
11
11
  import { type RunState } from "./state.js";
12
12
  import type { StepContext } from "./steps.js";
13
13
  /** Judge calls in flight at once. */
@@ -1,6 +1,6 @@
1
1
  /**
2
- * The planner's names a host needs to drive the engine (the plan file, the ask, the records'
3
- * shapes). The model seam is `@wrenautomation/models`'. The planner's `From` and `Step` stay out:
4
- * the ledger's are wider.
2
+ * The names a host needs to drive the engine: the plan file, the ask, the records' shapes. The
3
+ * model seam is `@wrenautomation/models`'. `From` and `Step` stay out: the ledger's are wider.
5
4
  */
6
- export { type Ask, type AskKind, type Budget, defaultPlanFile, type Edge, type HitView, PLAN_KINDS, type Plan, type PlanFile, type Proposal, type Query, type Round, type Snapshot, type Verdict, } from "../plan/index.js";
5
+ export { ageOf, defaultPlanFile, PLAN_KINDS, rulesOf, TREE, treeOf } from "./plans/index.js";
6
+ export { Ask, AskKind, Budget, Criterion, Edge, HitView, type HitViewIn, PlanFile, Query, QueryTree, Snapshot, TreeGuide, Verdict, YieldRow, } from "./types.js";
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The planner's names a host needs to drive the engine (the plan file, the ask, the records'
3
- * shapes). The model seam is `@wrenautomation/models`'. The planner's `From` and `Step` stay out:
4
- * the ledger's are wider.
2
+ * The names a host needs to drive the engine: the plan file, the ask, the records' shapes. The
3
+ * model seam is `@wrenautomation/models`'. `From` and `Step` stay out: the ledger's are wider.
5
4
  */
6
- export { defaultPlanFile, PLAN_KINDS, } from "../plan/index.js";
5
+ export { ageOf, defaultPlanFile, PLAN_KINDS, rulesOf, TREE, treeOf } from "./plans/index.js";
6
+ export { Ask, AskKind, Budget, Criterion, Edge, HitView, PlanFile, Query, QueryTree, Snapshot, TreeGuide, Verdict, YieldRow, } from "./types.js";
7
7
  //# sourceMappingURL=plan.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/engine/plan.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAIL,eAAe,EAGf,UAAU,GAQX,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/engine/plan.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EACL,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,EACT,IAAI,EACJ,OAAO,EAEP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,GACT,MAAM,YAAY,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The default plan file per ask kind. A copy of one, tuned and stored beside a ledger, is how
3
- * a run learns: the recipe changes, the planner does not. `birdwatch plans <kind>` prints one to start from.
3
+ * a run learns: the recipe changes, the agent reads it. `birdwatch plans <kind>` prints one to start from.
4
4
  */
5
5
  import { type AskKind, type PlanFile, type TreeGuide } from "../types.js";
6
6
  /**
@@ -10,8 +10,10 @@ import { type AskKind, type PlanFile, type TreeGuide } from "../types.js";
10
10
  export declare const TREE: TreeGuide;
11
11
  /** The default plan file for a kind, validated, as a fresh copy. */
12
12
  export declare function defaultPlanFile(kind: AskKind): PlanFile;
13
- /** The plan file's word on age; a stored file from before version 4 takes its kind's default. Version 5: the review no longer says "at most". Version 6: `tree`, the query tree's guide. */
13
+ /** The plan file's word on age; a stored file from before version 4 takes its kind's default. Version 5: the review no longer says "at most". Version 6: `tree`, the query tree's guide. 0.30.0 dropped the prompts with no bump: the agent never read them. */
14
14
  export declare const ageOf: (planFile: PlanFile) => string | undefined;
15
+ /** The plan file's rules for the agent; a stored file from before 0.30.0 takes its kind's default. */
16
+ export declare const rulesOf: (planFile: PlanFile) => string[];
15
17
  /** The plan file's guide for a query tree; a stored file from before version 6 takes its kind's default. */
16
18
  export declare const treeOf: (planFile: PlanFile) => TreeGuide;
17
19
  export declare const PLAN_KINDS: AskKind[];
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The default plan file per ask kind. A copy of one, tuned and stored beside a ledger, is how
3
+ * a run learns: the recipe changes, the agent reads it. `birdwatch plans <kind>` prints one to start from.
4
+ */
5
+ import { PlanFile as PlanFileShape, } from "../types.js";
6
+ /**
7
+ * The five sides a researcher covers before the reads start. One tree per round; the agent
8
+ * fills each facet with tries, in order of what it expects to work.
9
+ */
10
+ export const TREE = {
11
+ facets: [
12
+ { name: "number", why: "a figure: a rate, a price, a count, a date" },
13
+ { name: "how", why: "how it is done: a method, a step list, a tool" },
14
+ { name: "who", why: "who does it or buys it, in their own words" },
15
+ { name: "counter", why: "the case against: what fails, who says no" },
16
+ {
17
+ name: "primary",
18
+ why: "the source itself: a study, a filing, a transcript, the maker's own page",
19
+ },
20
+ ],
21
+ thin: 3,
22
+ };
23
+ const web = {
24
+ id: "birdwatch/web",
25
+ kind: "web",
26
+ version: 6,
27
+ sources: ["searxng", "exa", "google"],
28
+ budget: { queries: 3, reads: 6, rounds: 3, checks: 3 },
29
+ tree: TREE,
30
+ age: "Prices, tools and numbers that move: prefer the last two years. A principle or a method can be old.",
31
+ rules: [
32
+ "Each facet's tries reach different kinds of source: a survey or benchmark with numbers, a trade publication or association, people in the field (forums, Reddit, reviews), a government statistic.",
33
+ "Put a year in a query only when fresh numbers matter.",
34
+ "Keep primary sources and people in the field over listicles and aggregators.",
35
+ ],
36
+ };
37
+ const video = {
38
+ id: "birdwatch/video",
39
+ kind: "video",
40
+ version: 6,
41
+ sources: ["youtube", "podcasts"],
42
+ budget: { queries: 3, reads: 4, rounds: 2, checks: 3 },
43
+ tree: TREE,
44
+ age: "Tools and platforms: prefer the last two years. A talk on a principle can be old.",
45
+ rules: [
46
+ "Each facet's tries reach different kinds of speaker: a practitioner who shows the work, a conference talk, an interview or podcast, a critic or reviewer.",
47
+ "Drop a clip under 60 seconds unless the ask is about short-form video. Videos of 5 to 60 minutes hold the most.",
48
+ "A channel that yielded nothing before is a reason to drop.",
49
+ ],
50
+ };
51
+ const channel = {
52
+ id: "birdwatch/channel",
53
+ kind: "channel",
54
+ version: 6,
55
+ sources: ["searxng", "youtube", "exa"],
56
+ budget: { queries: 3, reads: 6, rounds: 2, checks: 3 },
57
+ tree: TREE,
58
+ age: "A channel that has not posted in the last year counts for little.",
59
+ rules: [
60
+ "Each facet's tries reach different kinds of channel: a creator on video, a writer or newsletter, a podcast, a community.",
61
+ "Keep the channel's own page over a page about it.",
62
+ ],
63
+ };
64
+ const person = {
65
+ id: "birdwatch/person",
66
+ kind: "person",
67
+ version: 6,
68
+ sources: ["searxng", "exa", "linkedin", "google"],
69
+ budget: { queries: 4, reads: 6, rounds: 2, checks: 3 },
70
+ tree: TREE,
71
+ age: "What they do now: prefer the latest pages. Their history can be old.",
72
+ rules: [
73
+ "Name the person or company in each query, as the ask writes it.",
74
+ "Each facet's tries reach different kinds of page: their own site or profile, an interview or talk, press or reviews, a filing or directory.",
75
+ "Drop a page about a different person or company with the same name.",
76
+ "Keep what they wrote or said over what a directory copied.",
77
+ ],
78
+ };
79
+ const site = {
80
+ id: "birdwatch/site",
81
+ kind: "site",
82
+ version: 6,
83
+ sources: ["sitemap", "searxng", "fetch"],
84
+ budget: { queries: 4, reads: 8, rounds: 2, checks: 3 },
85
+ tree: TREE,
86
+ age: "When two pages of the site disagree, the later one counts.",
87
+ rules: [
88
+ "Each facet's tries reach different parts of the site: its product or service pages, its pricing, its blog or help, its people.",
89
+ "Drop a URL off the site.",
90
+ ],
91
+ };
92
+ const DEFAULTS = { web, video, channel, person, site };
93
+ /** The default plan file for a kind, validated, as a fresh copy. */
94
+ export function defaultPlanFile(kind) {
95
+ return PlanFileShape.parse(structuredClone(DEFAULTS[kind]));
96
+ }
97
+ /** The plan file's word on age; a stored file from before version 4 takes its kind's default. Version 5: the review no longer says "at most". Version 6: `tree`, the query tree's guide. 0.30.0 dropped the prompts with no bump: the agent never read them. */
98
+ export const ageOf = (planFile) => planFile.age ?? DEFAULTS[planFile.kind].age;
99
+ /** The plan file's rules for the agent; a stored file from before 0.30.0 takes its kind's default. */
100
+ export const rulesOf = (planFile) => planFile.rules ?? DEFAULTS[planFile.kind].rules ?? [];
101
+ /** The plan file's guide for a query tree; a stored file from before version 6 takes its kind's default. */
102
+ export const treeOf = (planFile) => planFile.tree ?? DEFAULTS[planFile.kind].tree;
103
+ export const PLAN_KINDS = Object.keys(DEFAULTS);
104
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/engine/plans/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAGL,QAAQ,IAAI,aAAa,GAE1B,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAc;IAC7B,MAAM,EAAE;QACN,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,4CAA4C,EAAE;QACrE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,+CAA+C,EAAE;QACrE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,4CAA4C,EAAE;QAClE,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,2CAA2C,EAAE;QACrE;YACE,IAAI,EAAE,SAAS;YACf,GAAG,EAAE,0EAA0E;SAChF;KACF;IACD,IAAI,EAAE,CAAC;CACR,CAAC;AAEF,MAAM,GAAG,GAAa;IACpB,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,KAAK;IACX,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC;IACrC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;IACtD,IAAI,EAAE,IAAI;IACV,GAAG,EA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C;AAE/D,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAc,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The ports the runner is given, as one plain `deps` object. A source is one file that answers
3
- * `search` (hits for a query) or `open` (a hit read whole) or both; the registry holds them by
4
- * name and the plan's allow-list picks per run. The model is the planner's, the extractor
2
+ * The ports each agent command is given, as one plain `deps` object. A source is one file that
3
+ * answers `search` (hits for a query) or `open` (a hit read whole) or both; the registry holds
4
+ * them by name and the plan's allow-list picks per run. The model is the bulk extract and check's, the extractor
5
5
  * `./document`'s, the ledger `./ledger`'s. Nothing here reaches the network: the adapters in `src/sources` do.
6
6
  */
7
7
  import type { Model } from "@wrenautomation/models";
@@ -10,7 +10,7 @@ import type { Document, Extractor } from "../document/index.js";
10
10
  import type { Ids } from "../ledger/ids.js";
11
11
  import type { Ledger } from "../ledger/ledger.js";
12
12
  import type { CostKind, FollowAs, From, HitRecord, QueryRecord } from "../ledger/records.js";
13
- import type { Criterion, HitViewIn, PlanFile, Proposal } from "../plan/index.js";
13
+ import type { HitViewIn } from "./types.js";
14
14
  export interface Source {
15
15
  name: string;
16
16
  kind: "search" | "open" | "both";
@@ -24,7 +24,7 @@ export interface Source {
24
24
  * searcher that would answer from everywhere. Absent: it keeps to any site.
25
25
  */
26
26
  keeps?(site: string): boolean;
27
- /** Hits as the source shows them for free. Throw on failure: the runner writes the spend. */
27
+ /** Hits as the source shows them for free. Throw on failure: the engine writes the spend. */
28
28
  search?(query: QueryRecord): Promise<HitViewIn[]>;
29
29
  /** Whether it lists that page's own posts (`posts`) or pages like it (`similar`). */
30
30
  follows?(as: FollowAs, url: string): boolean;
@@ -43,7 +43,7 @@ export interface Source {
43
43
  first?: true;
44
44
  /**
45
45
  * The hit read whole. Throw with the reason when it was fetched and nothing usable came back
46
- * (a 403, a block, no reader for the media): the runner writes the spend `ok: false` with the
46
+ * (a 403, a block, no reader for the media): the engine writes the spend `ok: false` with the
47
47
  * reason and the next opener gets its turn.
48
48
  */
49
49
  open?(hit: HitRecord): Promise<Document>;
@@ -55,66 +55,18 @@ export declare function pick(sources: Sources, names: readonly string[]): Source
55
55
  export interface Deps {
56
56
  sources: Sources;
57
57
  ledger: Ledger;
58
- /** null: no model. The plan is the proposals given; every hit is read; nothing is extracted. */
58
+ /** The bulk extract and check's model; null: none, and those two commands fail. */
59
59
  model: Model | null;
60
- /** The steps that decide what comes next (plan, triage, review) take it; absent: `model`. */
61
- decider?: Model | null;
62
60
  extractor: Extractor;
63
61
  /** Cheap typed answers on every hit, page and finding: a hint and a router. Absent or null: none. */
64
62
  judge?: Judge | null;
65
63
  clock: () => Date;
66
64
  ids: Ids;
67
- /** `by` on the records the runner itself writes. */
68
- runner: string;
65
+ /** `by` on the records the engine itself writes: this terminal's writer. */
66
+ writer: string;
69
67
  /** The pause between tries of a call that failed with a Transient; `setTimeout` by default. A test passes a stub. */
70
68
  sleep?: (ms: number) => Promise<void>;
71
69
  }
72
- export interface RunOptions {
73
- /** Absent on a resume: the first snapshot has it. */
74
- ask?: {
75
- text: string;
76
- kind: PlanFile["kind"];
77
- known?: string[];
78
- /** What the ask takes as given; a known line with no source joins them. */
79
- premises?: string[];
80
- /** The person's tests of a good source: the judge asks each on every hit and page. */
81
- criteria?: Criterion[];
82
- /** What the person says at the start; `steer` records add to it between rounds. */
83
- steer?: string[];
84
- site?: string;
85
- };
86
- /** The ledger's tuned plan file for the ask's kind; the stock one when absent. */
87
- planFile?: PlanFile;
88
- /** Queries from people or other models, merged with the model's in round 1. */
89
- proposals?: readonly Proposal[];
90
- /** Narrows the plan file's sources for this run. */
91
- sources?: readonly string[];
92
- /** Openers let in only to open and follow, never to search. Absent: the last snapshot's. */
93
- opens?: readonly string[];
94
- /** A new run's parent, and why this child: `--parent`. */
95
- parent?: {
96
- run: string;
97
- why: string;
98
- };
99
- /** An earlier run to continue. */
100
- resume?: string;
101
- /** A run id for a new run; `deps.ids()` when absent. */
102
- run?: string;
103
- /** Called after each step, for a progress line. */
104
- onStep?: (event: StepEvent) => void;
105
- /** Steps to run before returning, whatever the pointer says: 64 by default. A loop that advances a run a little per pass passes a few. */
106
- steps?: number;
107
- /** Stop after each round's review when it says `again`: the person steers, then resumes. */
108
- pause?: boolean;
109
- }
110
- export interface StepEvent {
111
- run: string;
112
- round: number;
113
- step: string;
114
- ok: boolean;
115
- note?: string;
116
- ms: number;
117
- }
118
70
  /**
119
71
  * The searchers a query goes to: all of them, or for a site-scoped query those that keep to it.
120
72
  * A follow goes to the sources that follow its URL that way.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The ports the runner is given, as one plain `deps` object. A source is one file that answers
3
- * `search` (hits for a query) or `open` (a hit read whole) or both; the registry holds them by
4
- * name and the plan's allow-list picks per run. The model is the planner's, the extractor
2
+ * The ports each agent command is given, as one plain `deps` object. A source is one file that
3
+ * answers `search` (hits for a query) or `open` (a hit read whole) or both; the registry holds
4
+ * them by name and the plan's allow-list picks per run. The model is the bulk extract and check's, the extractor
5
5
  * `./document`'s, the ledger `./ledger`'s. Nothing here reaches the network: the adapters in `src/sources` do.
6
6
  */
7
7
  export const registry = (...sources) => new Map(sources.map((s) => [s.name, s]));
@@ -1 +1 @@
1
- {"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/engine/ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkDH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,OAAiB,EAAW,EAAE,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpG,sGAAsG;AACtG,MAAM,UAAU,IAAI,CAAC,OAAgB,EAAE,KAAwB;IAC7D,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAA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AAQ,GAAG,EAAE,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * still holds, puts it in `known` or reads the source again (WA-934, option A).
7
7
  */
8
8
  import { type Ledger } from "../ledger/ledger.js";
9
- import type { AskKind } from "../plan/index.js";
9
+ import type { AskKind } from "./plan.js";
10
10
  export interface Recalled {
11
11
  finding: string;
12
12
  run: string;
@@ -1,5 +1,4 @@
1
1
  import { type CallRecord, type CheckRecord, type ClassRecord, type DeadRecord, type DocumentRecord, type DraftRecord, type EdgeRecord, type FindingRecord, type FoundRecord, type GapRecord, type HitRecord, type JudgeRecord, type LedgerRecord, type PatternRecord, type PersonRecord, type QueryRecord, type SnapshotRecord, type SourceClass, type SpendRecord, type SteerRecord, type Step, type VerdictRecord } from "../ledger/records.js";
2
- import { Plan } from "../plan/index.js";
3
2
  export interface Pointer {
4
3
  round: number;
5
4
  step: Step;
@@ -52,8 +51,6 @@ export interface RunState {
52
51
  }
53
52
  /** Records must be in time order. */
54
53
  export declare function fold(run: string, records: readonly LedgerRecord[]): RunState;
55
- /** The plan of a round as the planner made it, rebuilt from its snapshot and queries. */
56
- export declare function planOf(state: RunState, round: number): Plan;
57
54
  /** A finding stays kept unless its latest call is a drop. */
58
55
  export declare const kept: (state: RunState, f: FindingRecord) => boolean;
59
56
  /** What the run has found so far: the kept findings' sentences with their URLs, oldest first. */
@@ -1,12 +1,11 @@
1
1
  /**
2
2
  * A run's state is the fold of its records, never held between steps: every step reads the
3
- * trace again. The fold gives the ask, the round, the plan as the planner made it, what each step
3
+ * trace again. The fold gives the ask, the round, the plan, what each step
4
4
  * has handled, and the pointer: the next step to run, from the `done` and `edge` records.
5
5
  */
6
6
  import { hostOf } from "../document/index.js";
7
7
  import { latestCalls, ofType } from "../ledger/ledger.js";
8
8
  import { STEPS, } from "../ledger/records.js";
9
- import { Plan } from "../plan/index.js";
10
9
  const after = (step) => STEPS[STEPS.indexOf(step) + 1] ?? null;
11
10
  /** Records must be in time order. */
12
11
  export function fold(run, records) {
@@ -71,29 +70,6 @@ export function fold(run, records) {
71
70
  called: latestCalls(records),
72
71
  };
73
72
  }
74
- const inRound = (round) => (r) => r.round === round;
75
- /** The plan of a round as the planner made it, rebuilt from its snapshot and queries. */
76
- export function planOf(state, round) {
77
- const s = ofType(state.records, "snapshot").filter(inRound(round)).at(-1);
78
- if (!s)
79
- throw new Error(`round ${round} has no snapshot`);
80
- const { ask, sources, budget, known, planFile, model, yieldRows, at } = s;
81
- return Plan.parse({
82
- ask,
83
- round,
84
- queries: state.queries.filter(inRound(round)).map((q) => ({
85
- kind: q.kind,
86
- terms: q.terms,
87
- ...(q.site ? { site: q.site } : {}),
88
- why: q.why,
89
- from: q.from === "tool" ? "ai" : q.from,
90
- by: q.by,
91
- })),
92
- sources,
93
- budget,
94
- snapshot: { at, known, planFile, model, yieldRows },
95
- });
96
- }
97
73
  /** A finding stays kept unless its latest call is a drop. */
98
74
  export const kept = (state, f) => state.called.get(f.id) !== "drop";
99
75
  /** What the run has found so far: the kept findings' sentences with their URLs, oldest first. */
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/engine/state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAoBL,KAAK,GAIN,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAsDxC,MAAM,KAAK,GAAG,CAAC,IAAU,EAAe,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC;AAElF,qCAAqC;AACrC,MAAM,UAAU,IAAI,CAAC,GAAW,EAAE,OAAgC;IAChE,IAAI,IAAI,GAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,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IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE3D,kFAAkF;AAClF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAqC,EAAW,EAAE,CACvE,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,WAAW,CAAC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  /**
2
- * The step table: one typed call per step, records in, records out. The runner interprets it in
3
- * order; wren's executor mounts the same table as stations. A step reads the fold, calls ports,
4
- * and appends records; it holds nothing between calls. Source calls fan out (per query across
2
+ * The fixed steps the agent commands run: search, read, extract, check. A step reads the fold,
3
+ * calls ports, and appends records; it holds nothing between calls. Source calls fan out (per query across
5
4
  * the searchers; reads and extracts a few at a time) and their records land in order, so a
6
5
  * trace reads the same whatever answered first. A step runs again after a transient failure
7
6
  * from where its records say it got to: a search with an ok spend, a hit with a document, a
@@ -10,12 +9,12 @@
10
9
  import { type Model } from "@wrenautomation/models";
11
10
  import type { EntryType, Judged, JudgeFailure, Questions } from "@wrenautomation/models/judge";
12
11
  import type { DocumentRecord, Envelope, FindingRecord, From, HitRecord, LedgerRecord, Step } from "../ledger/records.js";
13
- import { type Deps, type RunOptions, type Source } from "./ports.js";
12
+ import { type Deps, type Source } from "./ports.js";
14
13
  import { type RunState } from "./state.js";
15
14
  import { type Parent } from "./tree.js";
15
+ import { HitView, type HitViewIn } from "./types.js";
16
16
  export interface StepContext {
17
17
  deps: Deps;
18
- options: RunOptions;
19
18
  /** The run's model, wrapped so every ask writes a spend; a Transient after the tries run out. */
20
19
  model: Model | null;
21
20
  /** The same model, its spends marked with the record they are about. */
@@ -56,8 +55,23 @@ export declare const PARALLEL = 4;
56
55
  * keep or drop on its findings (often written after the review, between rounds).
57
56
  */
58
57
  export declare const openAfter: (state: RunState, round: number) => string[];
58
+ /** A line with a URL or a ledger id on it: a fact someone can go and check. */
59
+ export declare const sourced: (line: string) => boolean;
59
60
  /**
60
- * What a round's plan reads, for the agent's plan and the runner's alike: the known lines (what
61
+ * The ask with each known line that names no source moved to its premises. A run seeded with
62
+ * "the buyer is X" plans inside X unless something tests X; a sourced line is looked past.
63
+ */
64
+ export declare function withPremises<A extends {
65
+ known?: readonly string[];
66
+ premises?: readonly string[];
67
+ }>(ask: A): A & {
68
+ known: string[];
69
+ premises: string[];
70
+ };
71
+ /** One hit per url, sources merged, order of first sight. */
72
+ export declare function dedupeHits(hits: readonly HitViewIn[]): HitView[];
73
+ /**
74
+ * What a round's plan reads: the known lines (what
61
75
  * the ask brought, what the run kept, then what its children found), the premises, and what is
62
76
  * open (the last round's holes, children still going). A new child also reads what its parent
63
77
  * and siblings found.
@@ -71,13 +85,8 @@ export declare function planAsk(deps: Pick<Deps, "ledger">, state: RunState, bas
71
85
  premises: string[];
72
86
  open: string[];
73
87
  }>;
74
- export declare const planStep: StepFn;
75
88
  export declare const fetchStep: StepFn;
76
- export declare const triageStep: StepFn;
77
- export declare const readStep: StepFn;
78
- /** Opens `hits`, each by the first opener that has it; the agent's `open` passes its own list. */
79
89
  export declare function readHits(ctx: StepContext, state: RunState, wanted: readonly HitRecord[]): Promise<StepResult>;
80
- export declare const extractStep: StepFn;
81
90
  /** Extracts `docs` with the extractor on the run's model; the agent's `extract` passes its own list. */
82
91
  export declare function extractDocuments(ctx: StepContext, state: RunState, docs: readonly DocumentRecord[]): Promise<StepResult>;
83
92
  /**
@@ -86,13 +95,4 @@ export declare function extractDocuments(ctx: StepContext, state: RunState, docs
86
95
  * drop call; one that holds gets a check record. The share that fails is the review's read on
87
96
  * the extract. A check record is the checkpoint: a rerun checks only the rest of the sample.
88
97
  */
89
- export declare const checkStep: StepFn;
90
- /**
91
- * Checks `findings` against their documents; the agent's `check` passes its own sample. The
92
- * judge first reads every kept, unchecked finding with a quote; each one it doubts joins the
93
- * sample. A judge's yes never takes a finding out of it. A fail's fix (a narrower sentence on
94
- * the same quote) passes the gate and a second check before it lands as a new finding.
95
- */
96
98
  export declare function checkSample(ctx: StepContext, state: RunState, sample: readonly FindingRecord[]): Promise<StepResult>;
97
- export declare const reviewStep: StepFn;
98
- export declare const STEP_TABLE: Record<Step, StepFn>;