@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
package/README.md
CHANGED
|
@@ -7,23 +7,22 @@ run read. `skills/birdwatch/SKILL.md` (in this repo) is how an agent drives it.
|
|
|
7
7
|
|
|
8
8
|
Reading the web and files (the fetch ladder, HTML and PDF to text, video) is
|
|
9
9
|
[`@wrenautomation/read`](https://github.com/wrenautomation/engine/tree/main/packages/read)'s. Every model call goes through
|
|
10
|
-
[`@wrenautomation/models`](https://github.com/wrenautomation/engine/tree/main/packages/models). Until 0.29.0 this was three packages: raven (
|
|
11
|
-
|
|
10
|
+
[`@wrenautomation/models`](https://github.com/wrenautomation/engine/tree/main/packages/models). Until 0.29.0 this was three packages: raven (a model planner, gone at 0.30.0: the
|
|
11
|
+
agent plans), falcon (`./document`) and weaver (the engine, sources, ledger and CLI).
|
|
12
12
|
|
|
13
13
|
| Import | Does |
|
|
14
14
|
|---|---|
|
|
15
|
-
| `@wrenautomation/birdwatch/engine` | `Source` (a name, `search` and/or `open`, a cost), `registry` and the plan's allow-list; the agent's calls (`planRound`, `search`, `open`, `extract`, `check`, `add`, `accept`, `brief`), one step each; the judge's passes (`judgeHits`, `judgeDocuments`, `judgeFindings`, `judgeStats`); `
|
|
15
|
+
| `@wrenautomation/birdwatch/engine` | `Source` (a name, `search` and/or `open`, a cost), `registry` and the plan's allow-list; the agent's calls (`planRound`, `search`, `open`, `extract`, `check`, `add`, `accept`, `brief`), one step each; the judge's passes (`judgeHits`, `judgeDocuments`, `judgeFindings`, `judgeStats`); `fold` rebuilds a run's state from its records, so a step run again skips what is done; `Transient`, the failure worth another try; the ask and plan file shapes (`Ask`, `PlanFile`, `Query`, `QueryTree`, `Edge`, `Snapshot`) and a stock plan file per ask kind (`web`, `video`, `channel`, `person`, `site`: sources, budget, `age`, `rules`, the query tree's guide) |
|
|
16
16
|
| `@wrenautomation/birdwatch/sources` | `searxng`, `exa` (search), `youtube` (search and read, yt-dlp), `fetcher` (open, the polite fetcher), `ladder` (open, autobrowse's fetch ladder up to a browser), `reddit` and `facebook` (open a thread or a group post through autobrowse's site routes), `google` (Google's own page through the desk's browser: each result a hit, the AI Overview one hit with its text as the snippet, each page it cites a hit), `arxiv` (search and read: the API inside `BIRDWATCH_ARXIV_CATEGORIES`, each hit led by its OpenAlex citation count and comment; the paper read whole from its HTML, else its PDF; one call per 3 s), `paste` (a person's URLs), `ledger` (hits earlier runs saw). A query with a `site` skips a searcher that cannot keep to it (`Source.keeps`: `youtube` keeps to YouTube only). A follow (`Source.follows`, `follow`) lists a page's author's posts (`youtube`: a channel's uploads, from a video or the channel, and a TikTok profile; `reddit`: a user's top posts and comments) or pages like it (`exa`: findSimilar) |
|
|
17
17
|
| `@wrenautomation/birdwatch/ledger` | the records (`query`, `hit`, `document`, `finding`, `verdict`, `call`, `spend`, `snapshot`, `edge`, `done`, `steer`, `gap`, `check`, `pattern`, `found`, `judge`, `person`), `FilesLedger` (a folder: `runs/<run>/<writer>.jsonl`, `plans/<kind>.json`), `MemoryLedger`, yield rows per source, person, channel and kind |
|
|
18
|
-
| `@wrenautomation/birdwatch/plan` | the planner: `plan` (an ask, proposals and yield rows in; typed queries out, each with `why`, `from`, `by`), `triage` (read or skip per hit), `review` (the edge after a round: `stop`, `again`, `back`), the shapes (`Ask`, `Plan`, `PlanFile`, `Query`, `Edge`, `Snapshot`), a stock plan file per ask kind (`web`, `video`, `channel`, `person`, `site`: prompts, sources, budget, `age`, the query tree's guide), the renderers. Pure functions and prompts; the model is injected. The runner uses all of it; an agent makes the three decisions itself and uses the shapes |
|
|
19
18
|
| `@wrenautomation/birdwatch/document` | the document side: `Document`, `Finding`, `Proof`, `Verdict` (zod), readers by media (`html`, `pdf`, `text`), `claimExtractor` (findings that quote the document, through the gate, and a verdict on the document: its quality and the ask's gap; no cap on findings or their length, and an answer the model's output cap cut is continued from its last kept quote), the `Model` seam it takes and the `Cut` a model throws when its cap cut an answer |
|
|
20
19
|
|
|
21
|
-
Every record carries `from` (ai, human or tool) and `by` (
|
|
22
|
-
person
|
|
23
|
-
|
|
24
|
-
`birdwatch learn <kind>` writes its next version from what a run taught
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
Every record carries `from` (ai, human or tool) and `by` (an agent or model id, a source, a
|
|
21
|
+
person). A person's keep or drop is the same record as the agent's. The plan file in
|
|
22
|
+
`plans/<kind>.json` beside the ledger (sources, budget, age, rules, the tree guide) is where a run
|
|
23
|
+
learns: `birdwatch learn <kind>` writes its next version from what a run taught, on the person's
|
|
24
|
+
agreement; a kind with no tuned file runs the stock one (`birdwatch plans <kind>` prints it).
|
|
25
|
+
`brief.guide` shows the kind's age sentence and rules to the agent.
|
|
27
26
|
|
|
28
27
|
## CLI
|
|
29
28
|
|
|
@@ -41,12 +40,9 @@ COHERE_API_KEY=... npx birdwatch watch talk.mp4 # spee
|
|
|
41
40
|
npx birdwatch plans web > ledger/plans/web.json # a stock plan file, to tune
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
records. `run` is the runner: the planner's prompts make those decisions and the loop runs alone. Both
|
|
48
|
-
write the same ledger, so `run --resume` takes over a run an agent started and `brief` reads a
|
|
49
|
-
run the runner made. Every command prints JSON.
|
|
43
|
+
An agent (Claude Code, or any agent with a shell) drives the engine one command at a time: it
|
|
44
|
+
plans, triages, reviews and stops in its own head, and the engine does the fixed work (search,
|
|
45
|
+
open, extract behind the quote gate, check) and keeps the records. Every command prints JSON.
|
|
50
46
|
|
|
51
47
|
```sh
|
|
52
48
|
export BIRDWATCH_AGENT=claude-code # the agent's id on every record it writes
|
|
@@ -115,21 +111,14 @@ hit with the facets that found it, most first; `brief.tree` shows every try with
|
|
|
115
111
|
|
|
116
112
|
The agent reads for itself: `show <run> <document>` prints a document's stored text, `add
|
|
117
113
|
finding` writes what it read behind the same quote gate, `add check` its own check. `extract` and
|
|
118
|
-
`check` put a model behind the same gate instead, for bulk
|
|
119
|
-
the same records.
|
|
114
|
+
`check` put a model behind the same gate instead, for bulk; both paths write the same records.
|
|
120
115
|
|
|
121
|
-
The
|
|
116
|
+
The person, through the agent or by hand:
|
|
122
117
|
|
|
123
118
|
```sh
|
|
124
|
-
|
|
125
|
-
npx birdwatch
|
|
126
|
-
npx birdwatch
|
|
127
|
-
npx birdwatch run --resume 01M5YS... --url https://a.example/report # from the step it stopped on; same --url, same --model
|
|
128
|
-
npx birdwatch run "..." --pause # stop after each round's review
|
|
129
|
-
npx birdwatch add steer 01M5YS... "numbers only; skip vendor pages" --human # what you say, first in every prompt after
|
|
130
|
-
npx birdwatch run --resume 01M5YS... --pause # the next round, steered
|
|
131
|
-
npx birdwatch add gap 01M5YS... "no UK numbers yet" --human # what the run lacks: its review and next plan read it
|
|
132
|
-
npx birdwatch add edge 01M5YS... back --to fetch --why "searxng was down" --human # rerun one step of the round; then --resume
|
|
119
|
+
npx birdwatch add steer 01M5YS... "numbers only; skip vendor pages" --human # what you say: the brief shows it first
|
|
120
|
+
npx birdwatch add gap 01M5YS... "no UK numbers yet" --human # what the run lacks: the next plan reads it
|
|
121
|
+
npx birdwatch add edge 01M5YS... back --to fetch --why "searxng was down" --human # the step to run again
|
|
133
122
|
npx birdwatch trace 01M5YS... --type finding spend # the run's records, JSON lines
|
|
134
123
|
npx birdwatch add call 01M5YS... 01M5YT... drop --why "a forecast, not a result" --human # a call in your name
|
|
135
124
|
npx birdwatch yield --source exa # hits, reads, proposed, kept
|
|
@@ -141,8 +130,7 @@ The model is `anthropic` by default (Claude Haiku direct, `ANTHROPIC_API_KEY`; `
|
|
|
141
130
|
anthropic:sonnet|opus|id` for another), `--model gateway[:alias]` for Wren's LLM gateway
|
|
142
131
|
(`WREN_LLM_GATEWAY_URL`, `WREN_LLM_GATEWAY_TOKEN`), or any command that reads a prompt on stdin
|
|
143
132
|
and prints the answer (`claude -p --output-format json` is Claude Code headless). The model does
|
|
144
|
-
the bulk (extract, check);
|
|
145
|
-
comes next (plan, triage, review): `anthropic:sonnet` when the model is Haiku, else the model. Sources come
|
|
133
|
+
the bulk (extract, check) only; the agent decides. Sources come
|
|
146
134
|
from the environment: `SEARXNG_URL` (and `SEARXNG_TOKEN`, a bearer, for an instance behind a
|
|
147
135
|
proxy), `EXA_API_KEY` (or `_1..n`), `GEMINI_API_KEY` for videos without captions,
|
|
148
136
|
`BIRDWATCH_CONTACT` for the fetcher and `arxiv` (no contact, no page opens; `OPENALEX_API_KEY`, free, gives `arxiv` its own citation budget, and `SEMANTIC_SCHOLAR_API_KEY`, free, its own rate for `--as refs`; `--sources arxiv` names it, since no stock plan file does), and for the ladder either
|
|
@@ -191,24 +179,21 @@ that still cannot go on writes no `done`, and `run` waits and resumes it, five t
|
|
|
191
179
|
before it exits 2. Searches, reads and extracts fan out (four reads or extracts at a time);
|
|
192
180
|
each document's records land as its batch settles, and a step run again skips what its records
|
|
193
181
|
show done. An extract that fails for good (the model's answer would not parse, a 400) stops the
|
|
194
|
-
step with its findings so far on record and
|
|
182
|
+
step with its findings so far on record and exits 2: `extract` again asks only for the
|
|
195
183
|
documents without a verdict. A model answer the output cap cut is not a failure: the whole
|
|
196
184
|
findings before the cut go through the gate and the model is asked again for the rest of the
|
|
197
185
|
document, with those findings known (`./document`'s `Cut`; the `spend` carries both calls' tokens).
|
|
198
186
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
a round past `budget.rounds` parks the run the same way (`parked` says so, no exit code): the
|
|
204
|
-
budget is a guard rail, not a stop rule. `--resume` goes one more round; `plan --run` opens it
|
|
205
|
-
by hand.
|
|
187
|
+
Between rounds the person reads `brief` (or the agent tells them), keeps or drops findings (`add
|
|
188
|
+
call`), and steers the run with free text (`add steer`). Every `steer` record shows first in the
|
|
189
|
+
brief and in the extract's prompt of the rounds after it. `budget.rounds` is a guard
|
|
190
|
+
rail, not a stop rule: past it, the edge's why says why one more round is worth it.
|
|
206
191
|
|
|
207
192
|
The steps talk in English records. A query every searcher answered with no new hit, and a kept
|
|
208
193
|
hit no source could open (a 403, a block the ladder could not pass), each write a `gap`; so does
|
|
209
194
|
`add gap`. The round's review reads the gaps and a person's keep or drop with its why; the next
|
|
210
195
|
round's plan reads them, and the review's why on `again`, under "The last round left open".
|
|
211
|
-
`add edge back --to <step>` writes a person's edge: the fold takes it like the
|
|
196
|
+
`add edge back --to <step>` writes a person's edge: the fold takes it like the agent's. A `pattern`
|
|
212
197
|
(`add pattern`) is what several kept findings say together, in the agent's words; its count of
|
|
213
198
|
distinct sites is computed from the findings' proofs, never claimed, and `brief.patterns` lists
|
|
214
199
|
them for the report. A run can be a child (`--parent <run> --why`): its snapshot names the parent, its plan reads
|
|
@@ -258,16 +243,14 @@ gates on it yet.
|
|
|
258
243
|
From 0.25.0 the judge reads a page whole: the body to its references (an appendix stays), in
|
|
259
244
|
parts of 64,000 characters, 4 at most, each answer the most yes of any part. Jev's input is
|
|
260
245
|
cheap (about $0.04 per million tokens), so a paper costs about a tenth of a cent. A run's
|
|
261
|
-
criteria (`--criterion name="question"`, on `
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
and each test) as a hint. Their mean sorts `hits.uncalled` and `documents.toExtract`; `brief.judge.criteria` gives each one's AUC against
|
|
246
|
+
criteria (`--criterion name="question"`, on `plan`) are the person's own yes-or-no tests of a
|
|
247
|
+
good source: the judge asks each one on every hit and every page, and the brief shows its odds
|
|
248
|
+
on each hit (serves and each test) as a hint. Their mean sorts `hits.uncalled` and `documents.toExtract`; `brief.judge.criteria` gives each one's AUC against
|
|
265
249
|
"a finding on it was kept", on hits and on pages. A sort and a hint, never a gate.
|
|
266
250
|
|
|
267
251
|
From 0.27.0 the extractor reads the body too (the reference list holds no finding). Each review
|
|
268
252
|
sees every earlier round's new hits and kept findings, and decides when to stop. A paper's
|
|
269
|
-
`follow --as refs` and `--as citers` list what it cites and what cites it.
|
|
270
|
-
triage and review on Sonnet while Haiku does the bulk. A check (25 papers, Sonnet as reference):
|
|
253
|
+
`follow --as refs` and `--as citers` list what it cites and what cites it. A check (25 papers, Sonnet as reference):
|
|
271
254
|
on the whole page, Jev's criteria odds rank Sonnet's yes over its no with AUC 0.94 to 1.00; on the
|
|
272
255
|
abstract, 0.77 to 1.00.
|
|
273
256
|
|
|
@@ -308,21 +291,21 @@ The engine, with your own model and sources:
|
|
|
308
291
|
|
|
309
292
|
```ts
|
|
310
293
|
import { claimExtractor } from "@wrenautomation/birdwatch/document";
|
|
311
|
-
import { registry,
|
|
294
|
+
import { extract, open, planRound, registry, search } from "@wrenautomation/birdwatch/engine";
|
|
312
295
|
import { FilesLedger, ulids } from "@wrenautomation/birdwatch/ledger";
|
|
313
296
|
import { exa, fetcherSource } from "@wrenautomation/birdwatch/sources";
|
|
314
297
|
|
|
315
298
|
const ledger = new FilesLedger("./ledger", "will");
|
|
316
299
|
const sources = registry(exa({ keys }), fetcherSource({ fetcher }));
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
);
|
|
321
|
-
|
|
300
|
+
const deps = { sources, ledger, model, extractor: claimExtractor, clock: () => new Date(), ids: ulids(), writer: "will" };
|
|
301
|
+
const agent = { from: "ai" as const, by: "my-agent" };
|
|
302
|
+
const { run } = await planRound(deps, { ask: { text: "how do staffing firms win repeat clients", kind: "web" }, planFile, model: model.id });
|
|
303
|
+
await search(deps, run, [{ terms: "staffing repeat client rate", why: "the ask's words" }], agent);
|
|
304
|
+
await open(deps, run, { urls: ["https://a.example/report"], why: "a survey" }, agent);
|
|
305
|
+
await extract(deps, run); // findings, each with its proof: a quote on a page the run read
|
|
322
306
|
```
|
|
323
307
|
|
|
324
|
-
|
|
325
|
-
passes a few and calls again with `resume`. A host with its own ledger, sources or model mounts
|
|
308
|
+
A host with its own ledger, sources or model mounts
|
|
326
309
|
the same commands: `addEngineCommands(program, { ledger, sources, model, extractor })` from
|
|
327
310
|
`@wrenautomation/birdwatch` (wren's `research` command is these over Postgres).
|
|
328
311
|
|
package/dist/app/cli.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* text and links, `watch <video>` what a video file shows and says. `plans [kind]` prints a stock
|
|
7
7
|
* plan file to tune. Keys come from the environment: COHERE_API_KEY (or COHERE_API_KEY_1..n),
|
|
8
8
|
* GEMINI_API_KEY. The engine's commands are in `engine-cli.ts`: the agent's (`plan`, `search`,
|
|
9
|
-
* `open`, `extract`, `check`, `add`, `brief`), the
|
|
9
|
+
* `open`, `extract`, `check`, `add`, `brief`), the plan file's (`learn`) and
|
|
10
10
|
* the ledger's (`trace`, `yield`, `sources`). A person's word goes through `add ... --human`.
|
|
11
11
|
*/
|
|
12
12
|
import { readFile } from "node:fs/promises";
|
|
@@ -14,8 +14,11 @@ import { PoliteFetcher, userAgent } from "@wrenautomation/read/fetch";
|
|
|
14
14
|
import { htmlText, pdfText, readPage } from "@wrenautomation/read/text";
|
|
15
15
|
import { cohereEye, cohereSpeech, flatPlaylist, frameCounts, geminiVideo, readVideo, readYoutube, renderWatched, watchFile, } from "@wrenautomation/read/video";
|
|
16
16
|
import { Command } from "commander";
|
|
17
|
-
import { AskKind, defaultPlanFile, PLAN_KINDS } from "../plan
|
|
17
|
+
import { AskKind, defaultPlanFile, PLAN_KINDS } from "../engine/plan.js";
|
|
18
|
+
import { loadConfig } from "./config.js";
|
|
18
19
|
import { addEngineCommands, keys } from "./engine-cli.js";
|
|
20
|
+
// before any command reads its env defaults
|
|
21
|
+
loadConfig();
|
|
19
22
|
const program = new Command()
|
|
20
23
|
.name("birdwatch")
|
|
21
24
|
.description("research from the open web: the engine's steps, its ledger, and its readers");
|
package/dist/app/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/app/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;GASG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EACL,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,aAAa,EAEb,SAAS,GACV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","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AC,CAAC,CAAC;;QACjD,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC,CAAC;AAEL,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAE3B,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACtD,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const configPath: (env?: NodeJS.ProcessEnv) => string;
|
|
2
|
+
/** What the config would set, from its text and a file reader. */
|
|
3
|
+
export declare function configVars(text: string, read: (file: string) => string): Record<string, string>;
|
|
4
|
+
/** Fills the env from the config, never over a set variable. The config's path, or null. */
|
|
5
|
+
export declare function loadConfig(env?: NodeJS.ProcessEnv): string | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The machine's config: which env files birdwatch reads its keys from, so an agent's shell
|
|
3
|
+
* needs no wrapper. `~/.config/birdwatch/config.json` (or BIRDWATCH_CONFIG):
|
|
4
|
+
* `{ "env": ["/path/llm.env"], "keys": ["EXA_API_KEY*", "RESTATE_INGRESS_URL=WREN_RESTATE_INGRESS_URL"], "vars": { "BIRDWATCH_CONTACT": "..." } }`.
|
|
5
|
+
* `keys` limits what is taken (a trailing `*` takes a prefix; `A=B` takes B as A); absent, all.
|
|
6
|
+
* A variable already set always wins. Values are never printed.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { parseEnv } from "node:util";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
const Config = z.object({
|
|
14
|
+
env: z.array(z.string()).default([]),
|
|
15
|
+
keys: z.array(z.string()).optional(),
|
|
16
|
+
vars: z.record(z.string(), z.string()).default({}),
|
|
17
|
+
});
|
|
18
|
+
export const configPath = (env = process.env) => env.BIRDWATCH_CONFIG ?? join(homedir(), ".config", "birdwatch", "config.json");
|
|
19
|
+
/** What the config would set, from its text and a file reader. */
|
|
20
|
+
export function configVars(text, read) {
|
|
21
|
+
const c = Config.parse(JSON.parse(text));
|
|
22
|
+
const all = {};
|
|
23
|
+
for (const file of c.env)
|
|
24
|
+
Object.assign(all, parseEnv(read(file)));
|
|
25
|
+
const out = {};
|
|
26
|
+
if (!c.keys)
|
|
27
|
+
Object.assign(out, all);
|
|
28
|
+
else
|
|
29
|
+
for (const k of c.keys) {
|
|
30
|
+
const [to, from] = k.includes("=") ? k.split("=", 2) : [k, k];
|
|
31
|
+
if (from.endsWith("*")) {
|
|
32
|
+
const p = from.slice(0, -1);
|
|
33
|
+
for (const [n, v] of Object.entries(all))
|
|
34
|
+
if (n.startsWith(p) && v !== undefined)
|
|
35
|
+
out[n] = v;
|
|
36
|
+
}
|
|
37
|
+
else if (all[from] !== undefined)
|
|
38
|
+
out[to] = all[from];
|
|
39
|
+
}
|
|
40
|
+
return { ...out, ...c.vars };
|
|
41
|
+
}
|
|
42
|
+
/** Fills the env from the config, never over a set variable. The config's path, or null. */
|
|
43
|
+
export function loadConfig(env = process.env) {
|
|
44
|
+
const path = configPath(env);
|
|
45
|
+
if (!existsSync(path))
|
|
46
|
+
return null;
|
|
47
|
+
const vars = configVars(readFileSync(path, "utf8"), (f) => readFileSync(f, "utf8"));
|
|
48
|
+
for (const [k, v] of Object.entries(vars))
|
|
49
|
+
if (env[k] === undefined)
|
|
50
|
+
env[k] = v;
|
|
51
|
+
return path;
|
|
52
|
+
}
|
|
53
|
+
//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C;QAAE,OAAO,IAAI,CAAC;IACnC,MAAM,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACpF,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAChF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/app/engine-cli.d.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Model } from "@wrenautomation/models";
|
|
2
2
|
import { type Judge } from "@wrenautomation/models/judge";
|
|
3
3
|
import type { Command } from "commander";
|
|
4
4
|
import type { Extractor } from "../document/index.js";
|
|
5
5
|
import { costOf, type Sources } from "../engine/index.js";
|
|
6
|
+
import { type AskKind, Criterion } from "../engine/plan.js";
|
|
6
7
|
import { FilesLedger, type Ledger, type Problem } from "../ledger/index.js";
|
|
7
|
-
import { type AskKind, Criterion } from "../plan/index.js";
|
|
8
|
-
/** Resumes `run` makes on its own after a transient failure. */
|
|
9
|
-
export declare const RESUMES = 5;
|
|
10
8
|
export { costOf };
|
|
11
|
-
/** The pause before a resume: to `retryAfter` (five minutes at most), else 15 s per resume so far. */
|
|
12
|
-
export declare function resumeWaitMs(n: number, retryAfter: string | undefined, now?: number): number;
|
|
13
9
|
/** `NAME`, then `NAME_1`, `NAME_2`, ... in order: a fleet of keys for one vendor. */
|
|
14
10
|
export declare function keys(printed: NodeJS.ProcessEnv, name: string): string[];
|
|
15
11
|
/** `name=question` lines as criteria; a name the judge already asks, or a repeat, fails. */
|
|
@@ -31,8 +27,6 @@ export interface EngineCliDeps {
|
|
|
31
27
|
/** The judge for a `--judge` spec; the default is models' `judgeFromSpec`. */
|
|
32
28
|
judge?(spec: string, printed: NodeJS.ProcessEnv): Judge | null;
|
|
33
29
|
extractor?: Extractor;
|
|
34
|
-
/** The pause before a resume; a test passes a stub. */
|
|
35
|
-
sleep?(ms: number): Promise<void>;
|
|
36
30
|
}
|
|
37
31
|
/** The sources this machine can run, from the environment. */
|
|
38
32
|
export declare function sourcesHere(printed: NodeJS.ProcessEnv, ledger: FilesLedger, ytDlp: string, warn?: (line: string) => void): Sources;
|