@wrenautomation/raven 0.15.1 → 0.17.0
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/dist/app/cli.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/plan.js +2 -2
- package/dist/render.d.ts +18 -0
- package/dist/render.js +19 -0
- package/dist/triage.js +2 -2
- package/dist/types.d.ts +3 -0
- package/dist/types.js +2 -0
- package/package.json +2 -2
package/dist/app/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ import { modelFromSpec, SPEC_NAMES } from "@wrenautomation/models/spec";
|
|
|
13
13
|
import { Command } from "commander";
|
|
14
14
|
import { plan } from "../plan.js";
|
|
15
15
|
import { defaultPlanFile, PLAN_KINDS } from "../plans/index.js";
|
|
16
|
+
import { withPremises } from "../render.js";
|
|
16
17
|
import { review } from "../review.js";
|
|
17
18
|
import { triage } from "../triage.js";
|
|
18
19
|
import { AskKind, HitView, Plan, PlanFile, Round, YieldRow, z } from "../types.js";
|
|
@@ -56,9 +57,9 @@ withModel(program
|
|
|
56
57
|
.option("--round <n>", "round number", "1")).action(async (text, o) => {
|
|
57
58
|
const kind = AskKind.parse(o.kind);
|
|
58
59
|
const ask = {
|
|
60
|
+
...withPremises({ known: o.known, premises: [] }),
|
|
59
61
|
text,
|
|
60
62
|
kind,
|
|
61
|
-
known: o.known,
|
|
62
63
|
steer: o.steer,
|
|
63
64
|
open: [],
|
|
64
65
|
...(o.site ? { site: o.site } : {}),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { fill } from "./model.js";
|
|
2
2
|
export { mergeProposals, type PlanInput, plan, propose, proposePrompt } from "./plan.js";
|
|
3
3
|
export { ageOf, defaultPlanFile, PLAN_KINDS, TREE, treeOf } from "./plans/index.js";
|
|
4
|
-
export { renderHits, renderYield } from "./render.js";
|
|
4
|
+
export { renderHits, renderKnown, renderYield, sourced, withPremises } from "./render.js";
|
|
5
5
|
export { review, reviewPrompt } from "./review.js";
|
|
6
6
|
export { dedupeHits, triage, triagePrompt } from "./triage.js";
|
|
7
7
|
export * from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { fill } from "./model.js";
|
|
2
2
|
export { mergeProposals, plan, propose, proposePrompt } from "./plan.js";
|
|
3
3
|
export { ageOf, defaultPlanFile, PLAN_KINDS, TREE, treeOf } from "./plans/index.js";
|
|
4
|
-
export { renderHits, renderYield } from "./render.js";
|
|
4
|
+
export { renderHits, renderKnown, renderYield, sourced, withPremises } from "./render.js";
|
|
5
5
|
export { review, reviewPrompt } from "./review.js";
|
|
6
6
|
export { dedupeHits, triage, triagePrompt } from "./triage.js";
|
|
7
7
|
export * from "./types.js";
|
package/dist/plan.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fill } from "./model.js";
|
|
2
2
|
import { defaultPlanFile } from "./plans/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { renderKnown, renderOpen, renderSteer, renderYield } from "./render.js";
|
|
4
4
|
import { z, } from "./types.js";
|
|
5
5
|
const ProposalAnswer = z.object({
|
|
6
6
|
queries: z.array(z.object({ terms: z.string(), why: z.string(), site: z.string().optional() })),
|
|
@@ -13,7 +13,7 @@ export function proposePrompt(ask, planFile, yieldRows, now) {
|
|
|
13
13
|
site: ask.site ?? "",
|
|
14
14
|
steer: renderSteer(ask.steer),
|
|
15
15
|
open: renderOpen(ask.open),
|
|
16
|
-
known:
|
|
16
|
+
known: renderKnown(ask),
|
|
17
17
|
yield: renderYield(yieldRows),
|
|
18
18
|
});
|
|
19
19
|
}
|
package/dist/render.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
/** Text the prompts take: what is known, what yielded, what a hit shows for free. */
|
|
2
2
|
import type { HitView, YieldRow } from "./types.js";
|
|
3
3
|
export declare const lines: (xs: readonly string[], none?: string) => string;
|
|
4
|
+
/** A line with a URL or a ledger id on it: a fact someone can go and check. */
|
|
5
|
+
export declare const sourced: (line: string) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The ask with each known line that names no source moved to its premises. A run seeded with
|
|
8
|
+
* "the buyer is X" plans inside X unless something tests X; a sourced line is looked past.
|
|
9
|
+
*/
|
|
10
|
+
export declare function withPremises<A extends {
|
|
11
|
+
known?: readonly string[];
|
|
12
|
+
premises?: readonly string[];
|
|
13
|
+
}>(ask: A): A & {
|
|
14
|
+
known: string[];
|
|
15
|
+
premises: string[];
|
|
16
|
+
};
|
|
17
|
+
/** The known lines, then the premises under their own heading, or nothing more. */
|
|
18
|
+
export declare const renderKnown: (ask: {
|
|
19
|
+
known: readonly string[];
|
|
20
|
+
premises?: readonly string[];
|
|
21
|
+
}) => string;
|
|
4
22
|
/** "The person says:" and their lines, or nothing: a prompt pays for the heading only when there is one. */
|
|
5
23
|
export declare const renderSteer: (steer: readonly string[] | undefined) => string;
|
|
6
24
|
/** What the last round left open, under its heading, or nothing. */
|
package/dist/render.js
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
export const lines = (xs, none = "(nothing)") => xs.length ? xs.map((x) => `- ${x}`).join("\n") : none;
|
|
2
|
+
/** A line with a URL or a ledger id on it: a fact someone can go and check. */
|
|
3
|
+
export const sourced = (line) => /https?:\/\/\S|\b[0-9A-HJKMNP-TV-Z]{26}\b/.test(line);
|
|
4
|
+
/**
|
|
5
|
+
* The ask with each known line that names no source moved to its premises. A run seeded with
|
|
6
|
+
* "the buyer is X" plans inside X unless something tests X; a sourced line is looked past.
|
|
7
|
+
*/
|
|
8
|
+
export function withPremises(ask) {
|
|
9
|
+
const known = ask.known ?? [];
|
|
10
|
+
return {
|
|
11
|
+
...ask,
|
|
12
|
+
known: known.filter(sourced),
|
|
13
|
+
premises: [...new Set([...(ask.premises ?? []), ...known.filter((l) => !sourced(l))])],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** The known lines, then the premises under their own heading, or nothing more. */
|
|
17
|
+
export const renderKnown = (ask) => lines(ask.known) +
|
|
18
|
+
(ask.premises?.length
|
|
19
|
+
? `\nTaken as given, with no source (test each one: it may be wrong):\n${lines(ask.premises)}`
|
|
20
|
+
: "");
|
|
2
21
|
/** "The person says:" and their lines, or nothing: a prompt pays for the heading only when there is one. */
|
|
3
22
|
export const renderSteer = (steer) => steer?.length ? `The person says:\n${lines(steer)}\n` : "";
|
|
4
23
|
/** What the last round left open, under its heading, or nothing. */
|
package/dist/triage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fill } from "./model.js";
|
|
2
2
|
import { ageOf, defaultPlanFile } from "./plans/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { renderAge, renderHits, renderKnown, renderOpen, renderSteer, renderYield, } from "./render.js";
|
|
4
4
|
import { HitView, z, } from "./types.js";
|
|
5
5
|
const TriageAnswer = z.object({
|
|
6
6
|
hits: z.array(z.object({ url: z.string(), read: z.boolean(), why: z.string().nullable().optional() })),
|
|
@@ -35,7 +35,7 @@ export function triagePrompt(hits, plan, planFile, yieldRows) {
|
|
|
35
35
|
steer: renderSteer(plan.ask.steer),
|
|
36
36
|
open: renderOpen(plan.ask.open),
|
|
37
37
|
age: renderAge(ageOf(planFile)),
|
|
38
|
-
known:
|
|
38
|
+
known: renderKnown(plan.ask),
|
|
39
39
|
yield: renderYield(yieldRows),
|
|
40
40
|
hits: renderHits(hits),
|
|
41
41
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare const Ask: z.ZodObject<{
|
|
|
30
30
|
site: "site";
|
|
31
31
|
}>;
|
|
32
32
|
known: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
33
|
+
premises: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
33
34
|
steer: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
34
35
|
open: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
35
36
|
site: z.ZodOptional<z.ZodString>;
|
|
@@ -207,6 +208,7 @@ export declare const Plan: z.ZodObject<{
|
|
|
207
208
|
site: "site";
|
|
208
209
|
}>;
|
|
209
210
|
known: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
211
|
+
premises: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
210
212
|
steer: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
211
213
|
open: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
212
214
|
site: z.ZodOptional<z.ZodString>;
|
|
@@ -298,6 +300,7 @@ export declare const Round: z.ZodObject<{
|
|
|
298
300
|
site: "site";
|
|
299
301
|
}>;
|
|
300
302
|
known: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
303
|
+
premises: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
301
304
|
steer: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
302
305
|
open: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
303
306
|
site: z.ZodOptional<z.ZodString>;
|
package/dist/types.js
CHANGED
|
@@ -14,6 +14,8 @@ export const Ask = z.object({
|
|
|
14
14
|
kind: AskKind,
|
|
15
15
|
/** Facts already in hand, one line each: the planner looks past them. */
|
|
16
16
|
known: z.array(z.string()).default([]),
|
|
17
|
+
/** Lines taken as given with no source behind them: the plan tests each, never looks past it. */
|
|
18
|
+
premises: z.array(z.string()).default([]),
|
|
17
19
|
/** What the person said along the way, one line each: every prompt renders it first. */
|
|
18
20
|
steer: z.array(z.string()).default([]),
|
|
19
21
|
/** What the last round left open, one line each: its review's why, its gaps. The planner looks there first. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrenautomation/raven",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Ask in, plan out. The planner of Wren's research engine: typed queries with who proposed them and why, proposals merged into one plan under a plan file per ask kind, read-or-skip on hits, and the edge to take after a round. Pure functions and prompts; the model is injected.",
|
|
5
5
|
"license": "PolyForm-Strict-1.0.0",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"commander": "15.0.0",
|
|
34
34
|
"zod": "4.6.5",
|
|
35
|
-
"@wrenautomation/models": "0.
|
|
35
|
+
"@wrenautomation/models": "0.17.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"typecheck": "tsc --noEmit",
|