fwdloop 0.28.0 → 0.29.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/README.md +1 -1
- package/bin/fwdloop +27 -5
- package/package.json +3 -3
- package/src/ask.js +1 -1
- package/src/audit-fold.js +9 -1
- package/src/authoring.js +11 -4
- package/src/checked.js +5 -2
- package/src/checkpick.js +257 -0
- package/src/checkwords.js +24 -0
- package/src/closers.js +8 -1
- package/src/declaration.js +53 -3
- package/src/drafter.js +114 -33
- package/src/learn.js +1 -1
- package/src/learnstore.js +6 -6
- package/src/memo.js +120 -0
- package/src/model-step.js +89 -17
- package/src/pageask.js +9 -6
- package/src/pagedropwords.js +9 -0
- package/src/panel/author.js +31 -9
- package/src/panel/authorcard.js +51 -2
- package/src/panel/data.js +12 -7
- package/src/panel/index.html +137 -59
- package/src/panel/result.js +28 -7
- package/src/panel/server.js +2 -1
- package/src/pickrecord.js +146 -0
- package/src/plain-checks.js +1 -0
- package/src/provider.js +4 -1
- package/src/runfile.js +4 -2
- package/src/runner.js +82 -30
- package/src/send.js +71 -4
- package/src/setup.js +13 -1
- package/types/ask.d.ts +2 -1
- package/types/audit-fold.d.ts +13 -2
- package/types/authoring.d.ts +6 -2
- package/types/checked.d.ts +7 -2
- package/types/checkpick.d.ts +149 -0
- package/types/checkwords.d.ts +14 -0
- package/types/closers.d.ts +2 -1
- package/types/declaration.d.ts +9 -0
- package/types/drafter.d.ts +12 -25
- package/types/learn.d.ts +1 -0
- package/types/learnstore.d.ts +2 -3
- package/types/memo.d.ts +15 -0
- package/types/model-step.d.ts +5 -0
- package/types/pageask.d.ts +9 -2
- package/types/pagedropwords.d.ts +1 -0
- package/types/panel/author.d.ts +1 -1
- package/types/panel/authorcard.d.ts +41 -0
- package/types/panel/result.d.ts +9 -3
- package/types/pickrecord.d.ts +88 -0
- package/types/runfile.d.ts +7 -2
- package/types/runner.d.ts +16 -5
- package/types/send.d.ts +10 -2
- package/types/setup.d.ts +1 -56
- package/src/attemptdiff.js +0 -118
- package/types/attemptdiff.d.ts +0 -38
package/types/ask.d.ts
CHANGED
|
@@ -227,7 +227,7 @@ export function readAcceptedHashesByEmits(runDir: string): {
|
|
|
227
227
|
/**
|
|
228
228
|
* @param {string} runDir
|
|
229
229
|
* @returns {{ archived: true, asks: Array<{ askId: string, question?: string, askedAt?: string, expiresAt?: string,
|
|
230
|
-
* evidence: ReturnType<typeof readAskEvidence>,
|
|
230
|
+
* evidence: ReturnType<typeof readAskEvidence>, emits?: string,
|
|
231
231
|
* answer: { status: string, reason?: string, answeredAt?: string, why?: string } }> } | { archived: false, why: string }}
|
|
232
232
|
*/
|
|
233
233
|
export function listArchivedAsks(runDir: string): {
|
|
@@ -238,6 +238,7 @@ export function listArchivedAsks(runDir: string): {
|
|
|
238
238
|
askedAt?: string;
|
|
239
239
|
expiresAt?: string;
|
|
240
240
|
evidence: ReturnType<typeof readAskEvidence>;
|
|
241
|
+
emits?: string;
|
|
241
242
|
answer: {
|
|
242
243
|
status: string;
|
|
243
244
|
reason?: string;
|
package/types/audit-fold.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export function humanWords(r: any): string | null;
|
|
|
13
13
|
* The fold of one step, or `null` for a step with nothing new to show (an old run, or a step that is neither a model step with records nor an ask).
|
|
14
14
|
* @param {{rows:any[], tryMarks:string[], closeClass:string|null}} group `deriveAuditGroups`' group for the step
|
|
15
15
|
* @param {ReturnType<typeof loadDiaries>} d
|
|
16
|
-
* @param {{about?: string|null}} [info] `about`: the file an ask is about
|
|
16
|
+
* @param {{about?: string|null, rerun?: {words: string}|null}} [info] `about`: the file an ask is about; `rerun`: this run's reason for starting (run.json), given for its first step only
|
|
17
17
|
*/
|
|
18
18
|
export function deriveFold(group: {
|
|
19
19
|
rows: any[];
|
|
@@ -21,11 +21,21 @@ export function deriveFold(group: {
|
|
|
21
21
|
closeClass: string | null;
|
|
22
22
|
}, d: ReturnType<typeof loadDiaries>, info?: {
|
|
23
23
|
about?: string | null;
|
|
24
|
+
rerun?: {
|
|
25
|
+
words: string;
|
|
26
|
+
} | null;
|
|
24
27
|
}): {
|
|
25
28
|
who: string;
|
|
26
29
|
tally: string | null;
|
|
27
30
|
tries: any[];
|
|
28
|
-
rows:
|
|
31
|
+
rows: {
|
|
32
|
+
round: null;
|
|
33
|
+
try: any;
|
|
34
|
+
action: string;
|
|
35
|
+
path: string | null;
|
|
36
|
+
decision: string;
|
|
37
|
+
at: any;
|
|
38
|
+
}[];
|
|
29
39
|
counts: {
|
|
30
40
|
rounds: number;
|
|
31
41
|
tools: number;
|
|
@@ -52,3 +62,4 @@ export function summaryLines(d: ReturnType<typeof loadDiaries>): {
|
|
|
52
62
|
calls: string;
|
|
53
63
|
checks: string;
|
|
54
64
|
};
|
|
65
|
+
export function rerunWords(words: string): string;
|
package/types/authoring.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export function specHash({ proseText, declarationText, inputFactsText, readoutTe
|
|
|
23
23
|
* answer file counts as no answer. No questions file = `{ questions: [], open: [] }`.
|
|
24
24
|
* @param {string} planDir
|
|
25
25
|
* A question the page look raised (M10 piece 3) also carries `source: 'look'`, `ask` ('reading' | 'cant-check'), `ruleNo`, `ruleText` and `proposal`; an answer file carries `at`.
|
|
26
|
-
* @returns {{ questions: {k:number, line:number, question:string, answer:string|null, at?:string, rule?:string|null, source?:string, ask?:string, ruleNo?:number, ruleText?:string, proposal?:string|null}[], open: {k:number, line:number, question:string, answer:null}[] }}
|
|
26
|
+
* @returns {{ questions: {k:number, line:number, question:string, answer:string|null, at?:string, rule?:string|null, source?:string, ask?:string, ruleNo?:number, ruleText?:string, proposal?:string|null, check?:Record<string, any>, pairRule?:number}[], open: {k:number, line:number, question:string, answer:null}[] }}
|
|
27
27
|
*/
|
|
28
28
|
export function readQuestions(planDir: string): {
|
|
29
29
|
questions: {
|
|
@@ -38,6 +38,8 @@ export function readQuestions(planDir: string): {
|
|
|
38
38
|
ruleNo?: number;
|
|
39
39
|
ruleText?: string;
|
|
40
40
|
proposal?: string | null;
|
|
41
|
+
check?: Record<string, any>;
|
|
42
|
+
pairRule?: number;
|
|
41
43
|
}[];
|
|
42
44
|
open: {
|
|
43
45
|
k: number;
|
|
@@ -95,7 +97,7 @@ export function draftKeyRefusal(slot: string, env: Record<string, string | undef
|
|
|
95
97
|
* Test seam: `provider`/`rates`/`modelId` are injected; without them a live provider is built.
|
|
96
98
|
* `onResult({ ok })` (M4d am32): called once, after the spend is booked and just before the result files are written (the CLI gives its monthly hold back there).
|
|
97
99
|
*/
|
|
98
|
-
export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, proseRead, flowType, mcpServer, mcpPick, mcpServers, }: {
|
|
100
|
+
export function draftToDir({ proseFile, dir, root, name, slot, model, draftThinking, keyNames, env, provider, rates, modelId, noQuestions, onResult, fetchPage, leftRules, checkPicks, carriedPicks, proseRead, flowType, mcpServer, mcpPick, mcpServers, }: {
|
|
99
101
|
proseFile: any;
|
|
100
102
|
dir: any;
|
|
101
103
|
root: any;
|
|
@@ -112,6 +114,8 @@ export function draftToDir({ proseFile, dir, root, name, slot, model, draftThink
|
|
|
112
114
|
onResult: any;
|
|
113
115
|
fetchPage: any;
|
|
114
116
|
leftRules: any;
|
|
117
|
+
checkPicks: any;
|
|
118
|
+
carriedPicks: any;
|
|
115
119
|
proseRead: any;
|
|
116
120
|
flowType?: "mcp" | "plain" | "tickets" | undefined;
|
|
117
121
|
mcpServer?: string | undefined;
|
package/types/checked.d.ts
CHANGED
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
* One entry per step, in plan order: the plain sentences for what its typed close checks.
|
|
3
3
|
* M10b piece 4: with `lines` (the signed job lines) a step that reads a sheet also carries `sheet`, its line's block (src/sheetblock.js `sheetLineBlocks`: guardrails,
|
|
4
4
|
* Checked with `covers`, Not checked), and its sentences are only the lead sentence; the surfaces draw the block. Without `lines` the older one-row-per-check sentences.
|
|
5
|
-
* @param {{ steps?: any[] }} declaration @param {{ hasAsk?: boolean, askLines?: number[], lines?: any[], csvRoles?: string[] }} [opts] hasAsk = the job has a signed ask line (so "you check it at the ask" is true);
|
|
5
|
+
* @param {{ steps?: any[] }} declaration @param {{ hasAsk?: boolean, askLines?: number[], lines?: any[], csvRoles?: string[], keptChecks?: {line: number, check: any}[], keptWords?: string }} [opts] hasAsk = the job has a signed ask line (so "you check it at the ask" is true);
|
|
6
6
|
* askLines = the job lines of the signed asks, which also lets a step after the LAST ask read "you check it after you accept" (am41 item 2, am42: the ONE place for these words)
|
|
7
7
|
* @returns {{ step: number, line: number|null, goal: string, class: string, sentences: string[], sheet?: ReturnType<typeof sheetLineBlocks>[number] }[]}
|
|
8
8
|
*/
|
|
9
9
|
export function checkedLines(declaration: {
|
|
10
10
|
steps?: any[];
|
|
11
|
-
}, { hasAsk, askLines, lines, csvRoles }?: {
|
|
11
|
+
}, { hasAsk, askLines, lines, csvRoles, keptChecks, keptWords }?: {
|
|
12
12
|
hasAsk?: boolean;
|
|
13
13
|
askLines?: number[];
|
|
14
14
|
lines?: any[];
|
|
15
15
|
csvRoles?: string[];
|
|
16
|
+
keptChecks?: {
|
|
17
|
+
line: number;
|
|
18
|
+
check: any;
|
|
19
|
+
}[];
|
|
20
|
+
keptWords?: string;
|
|
16
21
|
}): {
|
|
17
22
|
step: number;
|
|
18
23
|
line: number | null;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every guardrail rule on a step line (not a signed ask or send line) that this call settles, in line order. `rule` is the rule's number on its line (the one
|
|
3
|
+
* number `leftRules`, `ruleNo` and the answers use); a repeated text on a line is one rule here, asked once.
|
|
4
|
+
* @param {{n: number, guardrail?: string}[]} lines `parseSignedText`'s lines @param {{asks?: {line: number}[], sends?: {line: number}[], sources?: any[]}} arbiter
|
|
5
|
+
* @returns {{line: number, rule: number, text: string}[]}
|
|
6
|
+
*/
|
|
7
|
+
export function scopedRules(lines: {
|
|
8
|
+
n: number;
|
|
9
|
+
guardrail?: string;
|
|
10
|
+
}[], arbiter: {
|
|
11
|
+
asks?: {
|
|
12
|
+
line: number;
|
|
13
|
+
}[];
|
|
14
|
+
sends?: {
|
|
15
|
+
line: number;
|
|
16
|
+
}[];
|
|
17
|
+
sources?: any[];
|
|
18
|
+
}): {
|
|
19
|
+
line: number;
|
|
20
|
+
rule: number;
|
|
21
|
+
text: string;
|
|
22
|
+
}[];
|
|
23
|
+
/**
|
|
24
|
+
* Keep a suggestion only if its rule is on bareguard's list, it carries only that rule's own fields, every number in it is a number the guardrail names and
|
|
25
|
+
* every word in it is a word of the guardrail. Anything else is dropped, with the reason. `none` is a drop with the reason `none`.
|
|
26
|
+
* @param {string} guardrail @param {any} sug the model's entry for this guardrail
|
|
27
|
+
* @returns {{kept: true, check: Record<string, any>}|{kept: false, why: string}}
|
|
28
|
+
*/
|
|
29
|
+
export function keepOrDrop(guardrail: string, sug: any): {
|
|
30
|
+
kept: true;
|
|
31
|
+
check: Record<string, any>;
|
|
32
|
+
} | {
|
|
33
|
+
kept: false;
|
|
34
|
+
why: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The user message: the job's lines, and under a line only the guardrails this call settles, numbered by their rule number on the line.
|
|
38
|
+
* @param {{n: number, text: string}[]} lines @param {{line: number, rule: number, text: string}[]} scoped @returns {string}
|
|
39
|
+
*/
|
|
40
|
+
export function suggestUserText(lines: {
|
|
41
|
+
n: number;
|
|
42
|
+
text: string;
|
|
43
|
+
}[], scoped: {
|
|
44
|
+
line: number;
|
|
45
|
+
rule: number;
|
|
46
|
+
text: string;
|
|
47
|
+
}[]): string;
|
|
48
|
+
/**
|
|
49
|
+
* What the call's answer comes to, one row per scoped guardrail: the check kept (or null) and why it was dropped. A guardrail the answer never mentions is
|
|
50
|
+
* dropped as `no entry`; an entry for a guardrail that was not sent is ignored.
|
|
51
|
+
* @param {{line: number, rule: number, text: string}[]} scoped @param {any} args the tool call's arguments
|
|
52
|
+
* @returns {{line: number, rule: number, text: string, check: Record<string, any>|null, why: string|null}[]}
|
|
53
|
+
*/
|
|
54
|
+
export function rowsFromAnswer(scoped: {
|
|
55
|
+
line: number;
|
|
56
|
+
rule: number;
|
|
57
|
+
text: string;
|
|
58
|
+
}[], args: any): {
|
|
59
|
+
line: number;
|
|
60
|
+
rule: number;
|
|
61
|
+
text: string;
|
|
62
|
+
check: Record<string, any> | null;
|
|
63
|
+
why: string | null;
|
|
64
|
+
}[];
|
|
65
|
+
/**
|
|
66
|
+
* The asks for the rows: `Line n, guardrail "<…>": I propose <check in plain words>.` for a kept check, `Line n, guardrail "<…>": I can't check this. Your own words, or
|
|
67
|
+
* Not checked?` when nothing was kept. A proposal is not counted toward am1's cap; a can't-check ask is (am16 (5)).
|
|
68
|
+
* @param {ReturnType<typeof rowsFromAnswer>} rows
|
|
69
|
+
* @returns {{pairRule?: number, line: number, rule: number, source: 'look', ask: 'check'|'no-check', ruleText: string, question: string, reading?: string, check?: Record<string, any>, counted: boolean}[]}
|
|
70
|
+
*/
|
|
71
|
+
export function checkAsks(rows: ReturnType<typeof rowsFromAnswer>): {
|
|
72
|
+
pairRule?: number;
|
|
73
|
+
line: number;
|
|
74
|
+
rule: number;
|
|
75
|
+
source: "look";
|
|
76
|
+
ask: "check" | "no-check";
|
|
77
|
+
ruleText: string;
|
|
78
|
+
question: string;
|
|
79
|
+
reading?: string;
|
|
80
|
+
check?: Record<string, any>;
|
|
81
|
+
counted: boolean;
|
|
82
|
+
}[];
|
|
83
|
+
/**
|
|
84
|
+
* @typedef {{line: number, rule: number, check: Record<string, any>|null, added?: string, own?: boolean}} Pick
|
|
85
|
+
* `check` = the check the person agreed to (null for their own words); `added` = the `~` rule the answer wrote on the line; `own` = their own words
|
|
86
|
+
*/
|
|
87
|
+
/**
|
|
88
|
+
* Settle every scoped rule against the person's answers: a rule with a picked check is checked; the `~` line an agree wrote is covered by that pick; every other
|
|
89
|
+
* rule is Not checked, with the reason (`person-left` = they chose it, `own-words` = they gave their own words, `no-pick` = nothing was picked).
|
|
90
|
+
* @param {ReturnType<typeof scopedRules>} rules @param {Pick[]} picks @param {{line: number, rule: number}[]} left
|
|
91
|
+
* @returns {{checks: Map<number, Record<string, any>[]>, notes: {line: number, rule: number, text: string, reason: 'person-left'|'own-words'|'no-pick'}[]}}
|
|
92
|
+
*/
|
|
93
|
+
export function settleRules(rules: ReturnType<typeof scopedRules>, picks: Pick[], left: {
|
|
94
|
+
line: number;
|
|
95
|
+
rule: number;
|
|
96
|
+
}[]): {
|
|
97
|
+
checks: Map<number, Record<string, any>[]>;
|
|
98
|
+
notes: {
|
|
99
|
+
line: number;
|
|
100
|
+
rule: number;
|
|
101
|
+
text: string;
|
|
102
|
+
reason: "person-left" | "own-words" | "no-pick";
|
|
103
|
+
}[];
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Overwrite the drafter's check on every step of a line this call settles (a green step, which another signed part settles, is left alone): a line with picked checks
|
|
107
|
+
* is softgreen and carries exactly those checks; a line with none is hitl. Whatever `close.shape` the drafter wrote is gone. Pure: returns a new declaration.
|
|
108
|
+
* @param {any} declaration @param {ReturnType<typeof scopedRules>} rules @param {ReturnType<typeof settleRules>} settled
|
|
109
|
+
* @param {(note: {line: number, reason: 'person-left'|'own-words'|'no-pick'}) => string} sentence the one table's words for a reason
|
|
110
|
+
*/
|
|
111
|
+
export function applyPicks(declaration: any, rules: ReturnType<typeof scopedRules>, settled: ReturnType<typeof settleRules>, sentence: (note: {
|
|
112
|
+
line: number;
|
|
113
|
+
reason: "person-left" | "own-words" | "no-pick";
|
|
114
|
+
}) => string): any;
|
|
115
|
+
/** the one tool the suggestion call is forced to use */
|
|
116
|
+
export const SUGGEST_TOOL: "suggest_checks";
|
|
117
|
+
export function hasRoutingInput(sources: any[] | undefined): boolean;
|
|
118
|
+
export function codeScope(sources: any[] | undefined, g: string): "in" | "out";
|
|
119
|
+
export const SUGGEST_SYSTEM: string;
|
|
120
|
+
/** the forced tool's parameter schema: one `anyOf` variant per offered rule, plus `none` */
|
|
121
|
+
export const SUGGEST_SCHEMA: Readonly<{
|
|
122
|
+
type: "object";
|
|
123
|
+
properties: {
|
|
124
|
+
checks: {
|
|
125
|
+
type: string;
|
|
126
|
+
description: string;
|
|
127
|
+
items: {
|
|
128
|
+
anyOf: any[];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
required: string[];
|
|
133
|
+
additionalProperties: false;
|
|
134
|
+
}>;
|
|
135
|
+
/** the can't-check ask, as the signed words say it */
|
|
136
|
+
export const CANT_CHECK_WORDS: "I can't check this. Your own words, or Not checked?";
|
|
137
|
+
/**
|
|
138
|
+
* `check` = the check the person agreed to (null for their own words); `added` = the `~` rule the answer wrote on the line; `own` = their own words
|
|
139
|
+
*/
|
|
140
|
+
export type Pick = {
|
|
141
|
+
line: number;
|
|
142
|
+
rule: number;
|
|
143
|
+
check: Record<string, any> | null;
|
|
144
|
+
added?: string;
|
|
145
|
+
own?: boolean;
|
|
146
|
+
};
|
|
147
|
+
import { plainWords } from './checkwords.js';
|
|
148
|
+
import { OFFERED } from './checkwords.js';
|
|
149
|
+
export { plainWords, OFFERED };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The check in plain words, one fixed phrase per rule: the ask, the `~` line an agree writes, the plan card and the Audit all read this one function.
|
|
3
|
+
* @param {{rule: string, value?: number, size?: number, wordsPerSection?: number, names?: string[], phrases?: string[]}} c @returns {string}
|
|
4
|
+
*/
|
|
5
|
+
export function plainWords(c: {
|
|
6
|
+
rule: string;
|
|
7
|
+
value?: number;
|
|
8
|
+
size?: number;
|
|
9
|
+
wordsPerSection?: number;
|
|
10
|
+
names?: string[];
|
|
11
|
+
phrases?: string[];
|
|
12
|
+
}): string;
|
|
13
|
+
/** the rules of bareguard's list a person may pick here (text rules only: the ones a plain answer can be judged by) */
|
|
14
|
+
export const OFFERED: readonly string[];
|
package/types/closers.d.ts
CHANGED
|
@@ -52,12 +52,13 @@ export function buildSoftgreenRubric(shape: Record<string, any>): ReturnType<typ
|
|
|
52
52
|
* A gap it has no sentence for is still a red, worded generically, never dropped.
|
|
53
53
|
*
|
|
54
54
|
* @param {any[]} gaps
|
|
55
|
-
* @param {{ linesPerInvoice?: number, mustCarry?: string[] }} shape
|
|
55
|
+
* @param {{ linesPerInvoice?: number, mustCarry?: string[], picked?: any[] }} shape
|
|
56
56
|
* @returns {{ red: string, reds: string[] }}
|
|
57
57
|
*/
|
|
58
58
|
export function renderSoftgreenGaps(gaps: any[], shape: {
|
|
59
59
|
linesPerInvoice?: number;
|
|
60
60
|
mustCarry?: string[];
|
|
61
|
+
picked?: any[];
|
|
61
62
|
}): {
|
|
62
63
|
red: string;
|
|
63
64
|
reds: string[];
|
package/types/declaration.d.ts
CHANGED
|
@@ -29,6 +29,15 @@ export function checkShapes(declaration: any): {
|
|
|
29
29
|
* there is none. Code does not decide which one is the limit: the AI picks `maxWords` and the validator checks the pick is one of these
|
|
30
30
|
* (M4e amendments 28 + 29). A "<n> words each" / "<n> words per section" is the per-section size (amendment 15), never listed here. */
|
|
31
31
|
export function guardrailWordNumbers(guardrail: any): number[];
|
|
32
|
+
/** M10 amendment 14 item 2: every standalone number in a guardrail's own text (digits not joined to letters: "P1" and "250ish" are not one; "1,000" and "2.5" are one number each). */
|
|
33
|
+
export function guardrailStandaloneNumbers(guardrail: any): number[];
|
|
34
|
+
/** M10 amendment 14 item 1: the send line (a signed send) is where the accepted result is written out and no AI runs, so a guardrail under it is refused at $0, naming the line.
|
|
35
|
+
* Pure; the card (src/panel/authorcard.js checkCard) and the drafter's pre-flight both call it. @param {any[]} lines `parseSignedText`'s lines @param {{sends?: {line: number}[]}} arbiter */
|
|
36
|
+
export function checkSendLineGuardrail(lines: any[], arbiter: {
|
|
37
|
+
sends?: {
|
|
38
|
+
line: number;
|
|
39
|
+
}[];
|
|
40
|
+
}): string[];
|
|
32
41
|
/** M4e amendment 15 item 1: the "<n> words each" / "<n> words per section" size in a guardrail ("about 250 words each", "250ish each" -> 250), or null. */
|
|
33
42
|
export function guardrailWordsPerSection(guardrail: any): number | null;
|
|
34
43
|
/** M4e amendment 7 item 1: the first "<N> sections" in a guardrail (N digits, or the words one..ten), or null. */
|
package/types/drafter.d.ts
CHANGED
|
@@ -91,12 +91,6 @@ export function buildDeclarationSchema(menu: any[], { sheets, ticket }?: {
|
|
|
91
91
|
enum: string[];
|
|
92
92
|
description: string;
|
|
93
93
|
};
|
|
94
|
-
shape: {
|
|
95
|
-
type: string;
|
|
96
|
-
properties: {};
|
|
97
|
-
additionalProperties: boolean;
|
|
98
|
-
description: string;
|
|
99
|
-
};
|
|
100
94
|
cited: Readonly<{
|
|
101
95
|
type: "object";
|
|
102
96
|
description: "only on a green step that checks quotes from a web page or a document input: the facts every result must hold. Omit on any other step";
|
|
@@ -337,12 +331,6 @@ export function buildDeclarationSchema(menu: any[], { sheets, ticket }?: {
|
|
|
337
331
|
enum: string[];
|
|
338
332
|
description: string;
|
|
339
333
|
};
|
|
340
|
-
shape: {
|
|
341
|
-
type: string;
|
|
342
|
-
properties: {};
|
|
343
|
-
additionalProperties: boolean;
|
|
344
|
-
description: string;
|
|
345
|
-
};
|
|
346
334
|
cited: Readonly<{
|
|
347
335
|
type: "object";
|
|
348
336
|
description: "only on a green step that checks quotes from a web page or a document input: the facts every result must hold. Omit on any other step";
|
|
@@ -578,12 +566,6 @@ export function buildRoundSchema(menu: any[], { questions, sheets, ticket }?: {
|
|
|
578
566
|
enum: string[];
|
|
579
567
|
description: string;
|
|
580
568
|
};
|
|
581
|
-
shape: {
|
|
582
|
-
type: string;
|
|
583
|
-
properties: {};
|
|
584
|
-
additionalProperties: boolean;
|
|
585
|
-
description: string;
|
|
586
|
-
};
|
|
587
569
|
cited: Readonly<{
|
|
588
570
|
type: "object";
|
|
589
571
|
description: "only on a green step that checks quotes from a web page or a document input: the facts every result must hold. Omit on any other step";
|
|
@@ -831,12 +813,6 @@ export function buildRoundSchema(menu: any[], { questions, sheets, ticket }?: {
|
|
|
831
813
|
enum: string[];
|
|
832
814
|
description: string;
|
|
833
815
|
};
|
|
834
|
-
shape: {
|
|
835
|
-
type: string;
|
|
836
|
-
properties: {};
|
|
837
|
-
additionalProperties: boolean;
|
|
838
|
-
description: string;
|
|
839
|
-
};
|
|
840
816
|
cited: Readonly<{
|
|
841
817
|
type: "object";
|
|
842
818
|
description: "only on a green step that checks quotes from a web page or a document input: the facts every result must hold. Omit on any other step";
|
|
@@ -1020,7 +996,7 @@ export function goalForLine(fromLine: any, lines: any): any;
|
|
|
1020
996
|
* `learnHints` (M8 item 5a): the earlier runs' notes block (src/learnstore.js hintsForRun), appended to the drafter's system prompt; null = nothing.
|
|
1021
997
|
* `look` / `pageLooks` (M10 item 3) are there when the job signs a web page: the kept facts (with their `reading`, the input a later ask reads), every drop, and per page its address, sha256 and the AI's map. Each drop is also a line in `notChecked`.
|
|
1022
998
|
*/
|
|
1023
|
-
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, learnHints, mcpServers, flowType, mcp, }: {
|
|
999
|
+
export function draft({ proseText, slot, model, provider: injected, rates: injectedRates, modelId: injectedModelId, env, priorSpend, skills, makeProviderFn, onBook, offerQuestions, draftThinking, draftDir, fetchPage, leftRules, checkPicks, carriedPicks, onPickRecord, learnHints, mcpServers, flowType, mcp, }: {
|
|
1024
1000
|
proseText: any;
|
|
1025
1001
|
slot: any;
|
|
1026
1002
|
model: any;
|
|
@@ -1040,6 +1016,17 @@ export function draft({ proseText, slot, model, provider: injected, rates: injec
|
|
|
1040
1016
|
line: number;
|
|
1041
1017
|
rule: number;
|
|
1042
1018
|
}[] | undefined;
|
|
1019
|
+
checkPicks?: import("./checkpick.js").Pick[] | undefined;
|
|
1020
|
+
carriedPicks?: import("./pickrecord.js").Entry[] | undefined;
|
|
1021
|
+
onPickRecord?: ((r: {
|
|
1022
|
+
picks: import("./pickrecord.js").Entry[];
|
|
1023
|
+
kept: {
|
|
1024
|
+
line: number;
|
|
1025
|
+
rule: number;
|
|
1026
|
+
ruleText: string;
|
|
1027
|
+
check: Record<string, any> | null;
|
|
1028
|
+
}[];
|
|
1029
|
+
}) => void) | null | undefined;
|
|
1043
1030
|
learnHints?: {
|
|
1044
1031
|
text: string;
|
|
1045
1032
|
ids: string[];
|
package/types/learn.d.ts
CHANGED
|
@@ -343,6 +343,7 @@ export const SUSPECT_KEEP: 100;
|
|
|
343
343
|
* src/authoring.js; a test fails if the two drift apart). Anything else in a bracket is NOT a kind.
|
|
344
344
|
*/
|
|
345
345
|
export const ALLOWED_KINDS: readonly string[];
|
|
346
|
+
export function nameOf(g: string): string;
|
|
346
347
|
export function keyOfCard(c: {
|
|
347
348
|
check: string;
|
|
348
349
|
kinds: string[];
|
package/types/learnstore.d.ts
CHANGED
|
@@ -110,15 +110,14 @@ export function eventsOfRun(runDir: string, workflow: string): {
|
|
|
110
110
|
* with a signed ask included; there is no hold. It runs whether `learningHints` is on or off. `questions` (bareloop's stageQuestionsByName) is, here, the failing check's own text from
|
|
111
111
|
* the run's diary.jsonl, so a check with no checks row there (a run from before am29) has no `meaning`.
|
|
112
112
|
* Borrowed-from: bareloop src/learnstore.js@v0.47.0:124 (learnAtRunEnd).
|
|
113
|
-
* @param {{home?: string, workflow: string, runId: string, runDir: string,
|
|
113
|
+
* @param {{home?: string, workflow: string, runId: string, runDir: string, now?: Date}} o
|
|
114
114
|
* @returns {{wrote: boolean, counted: number, held: number, problem: string|null, noise: string|null, cards: number}}
|
|
115
115
|
*/
|
|
116
|
-
export function learnAtRunEnd({ home, workflow, runId, runDir,
|
|
116
|
+
export function learnAtRunEnd({ home, workflow, runId, runDir, now }: {
|
|
117
117
|
home?: string;
|
|
118
118
|
workflow: string;
|
|
119
119
|
runId: string;
|
|
120
120
|
runDir: string;
|
|
121
|
-
specHash: string | null;
|
|
122
121
|
now?: Date;
|
|
123
122
|
}): {
|
|
124
123
|
wrote: boolean;
|
package/types/memo.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The memo for the try about to run, as text; `''` when nothing has happened yet in this run (no human line, no earlier try).
|
|
3
|
+
* @param {string|null} runDir the run's folder (null = no record = nothing happened)
|
|
4
|
+
* @param {{step: string|null, cap?: number}} o `step` = the step the try belongs to (names its earlier tries and tells a retry from a later step's first try)
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
export function buildMemo(runDir: string | null, { step, cap }: {
|
|
8
|
+
step: string | null;
|
|
9
|
+
cap?: number;
|
|
10
|
+
}): string;
|
|
11
|
+
/** M14 am1 item 2: the memo's fixed words */
|
|
12
|
+
export const MEMO_HEADING: "What happened so far in this run (written by code, from the record)";
|
|
13
|
+
export const MEMO_CUT_NOTE: "(older lines cut to fit)";
|
|
14
|
+
/** M14 item 5 */
|
|
15
|
+
export const MEMO_CAP: 4000;
|
package/types/model-step.d.ts
CHANGED
|
@@ -133,3 +133,8 @@ export const LIVE_PROVIDER_OPTIONS: Readonly<{
|
|
|
133
133
|
timeoutMs: 300000;
|
|
134
134
|
deadlineMs: 240000;
|
|
135
135
|
}>;
|
|
136
|
+
/** M4d am37: the one fixed line a step that answered in text is sent, from code; the model never writes it and it never changes. */
|
|
137
|
+
export const NUDGE: "You answered in text. Call emit_artifact now with that answer; do not reply in text.";
|
|
138
|
+
/** M4d am37: a provider that says it does not send `toolChoice` (`makeProvider` sets the flag from the row's shape) ignores a forced call; round 2 then sends the line unforced and a save there is the fallback. */
|
|
139
|
+
/** Ruling A (hamr 2026-11-03): the fixed say on the audit row of a try whose forced call was refused with no usage returned; it books $0. */
|
|
140
|
+
export const FORCED_REFUSED_SAY: "refused, no bill returned";
|
package/types/pageask.d.ts
CHANGED
|
@@ -44,22 +44,29 @@ export function tooManyAsksText(asks: {
|
|
|
44
44
|
* What a typed answer to a look ask does, the ONE place that decides (the panel's answer route, the setup record and the Result tab all read it).
|
|
45
45
|
* `agree` / `yes` to a reading ask takes the code's reading; `drop it` to a can't-check ask leaves the rule Not checked (no `~` line); anything else is the
|
|
46
46
|
* person's own words, taken word for word with newlines folded to spaces. A question that is not a look ask is never changed: its answer is its rule.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
47
|
+
* M10 am16: a shape guardrail's ask (`ask: 'check'` proposes a check, `'no-check'` found none) takes the same words: `agree` takes the proposal (and the check it
|
|
48
|
+
* carries, `check`), `drop it` leaves the rule Not checked (either kind), anything else is the person's own words (`own`: a `~` rule on the line, no check).
|
|
49
|
+
* @param {{source?: string, ask?: string, proposal?: string|null, check?: Record<string, any>}} q @param {unknown} typed
|
|
50
|
+
* @returns {{rule: string|null, left: boolean, check?: Record<string, any>, own?: boolean}} `rule` = the words written as a new `~` rule (null when the rule is left Not checked)
|
|
49
51
|
*/
|
|
50
52
|
export function ruleOfAnswer(q: {
|
|
51
53
|
source?: string;
|
|
52
54
|
ask?: string;
|
|
53
55
|
proposal?: string | null;
|
|
56
|
+
check?: Record<string, any>;
|
|
54
57
|
}, typed: unknown): {
|
|
55
58
|
rule: string | null;
|
|
56
59
|
left: boolean;
|
|
60
|
+
check?: Record<string, any>;
|
|
61
|
+
own?: boolean;
|
|
57
62
|
};
|
|
58
63
|
/** the most asks before drafting; more than this is a job to rewrite, not a questionnaire (am1) */
|
|
59
64
|
export const MAX_LOOK_ASKS: 3;
|
|
60
65
|
/** the answer that drops a `~` rule the page cannot check: the person types it (any case, a closing full stop allowed) */
|
|
61
66
|
export const DROP_IT: "drop it";
|
|
62
67
|
export function isDropIt(text: unknown): boolean;
|
|
68
|
+
/** the answers that accept the code's reading of a rule; anything else the person types is their own reading */
|
|
69
|
+
export const AGREE_WORDS: string[];
|
|
63
70
|
export function isAgree(text: unknown): boolean;
|
|
64
71
|
export function stripAgreeLead(text: string): string;
|
|
65
72
|
/**
|
package/types/pagedropwords.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ export function splitReadNotes(items: string[] | null | undefined, signed?: stri
|
|
|
37
37
|
/** The names of the facts a signed declaration checks (every cited fact of every step). Pure. @param {any} declaration @returns {string[]} */
|
|
38
38
|
export function signedFactNames(declaration: any): string[];
|
|
39
39
|
export function leftRuleLine(rule: string): string;
|
|
40
|
+
export function pickNoteLine(rule: string, reason: "no-pick" | "own-words"): string;
|
|
40
41
|
export type Dropped = import("./pagerules.js").Dropped;
|
package/types/panel/author.d.ts
CHANGED
|
@@ -377,7 +377,7 @@ export function createAuthor(opts: {
|
|
|
377
377
|
* `POST /api/author/:id/answer` body `{ k, answer }` (M4e amendments 24, 25): the human's answer to the plan's question `k` of `n`, one at a time.
|
|
378
378
|
* A blank answer is refused and the question stays open; there is no skip. The answer is written ONCE ('wx') as `<plan>/answer-<k>.json`. After
|
|
379
379
|
* the LAST answer the plan is drafted again as a fresh plain `fwdloop draft --no-questions` child (it never asks), from the submitted card with
|
|
380
|
-
* each answer added word for word as a `~` guardrail under its line (the one `
|
|
380
|
+
* each answer added word for word as a `~` guardrail under its line (the one `applyAnswers`, then the one `cardToProse`). It is booked as
|
|
381
381
|
* an answer redraft (`redraft-<n>.json`), not a revise: it uses none of the 2. Synchronous, like `revise`; a refusal at $0 writes nothing.
|
|
382
382
|
* @param {string} id @param {any} body
|
|
383
383
|
*/
|
|
@@ -36,6 +36,47 @@ export function appendAnswersToJob(job: string, answers: {
|
|
|
36
36
|
job: string;
|
|
37
37
|
added: number;
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* M10 am21: the submitted job box with ONE `~` line of a job line replaced by the words of an answer (the edited added line the ask was about). Pure.
|
|
41
|
+
* @param {string} job @param {number} line the job line (step) number @param {string} oldText the `~` words to replace (case and spacing aside) @param {string} newText
|
|
42
|
+
* @returns {{ job: string, replaced: boolean }}
|
|
43
|
+
*/
|
|
44
|
+
export function replaceRuleOnJob(job: string, line: number, oldText: string, newText: string): {
|
|
45
|
+
job: string;
|
|
46
|
+
replaced: boolean;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* THE one writer of what a set of answers does to the job box and to the picks (M4e am24, M10 am16 (4), M10 am21): an answer is one more `~` line under its job line
|
|
50
|
+
* (`appendAnswersToJob`), EXCEPT the answer to an ask about an edited added line (`pairRule`), which REPLACES that line's words (the old added line never comes back).
|
|
51
|
+
* Picks and left rules are numbered as the asks carried them; an edited-line pick is kept under its source's number (`pairRule`), with the edited words as `added`.
|
|
52
|
+
* @param {string} job @param {{line: number, rule: string|null, left: boolean, check?: Record<string, any>|null, own?: boolean, ruleNo?: number, ruleText?: string, ask?: string, pairRule?: number}[]} all
|
|
53
|
+
* @returns {{job: string, added: number, picks: {line: number, rule: number|undefined, check: Record<string, any>|null, added: string, own?: boolean}[], left: {line: number, rule: number|undefined}[]}}
|
|
54
|
+
*/
|
|
55
|
+
export function applyAnswers(job: string, all: {
|
|
56
|
+
line: number;
|
|
57
|
+
rule: string | null;
|
|
58
|
+
left: boolean;
|
|
59
|
+
check?: Record<string, any> | null;
|
|
60
|
+
own?: boolean;
|
|
61
|
+
ruleNo?: number;
|
|
62
|
+
ruleText?: string;
|
|
63
|
+
ask?: string;
|
|
64
|
+
pairRule?: number;
|
|
65
|
+
}[]): {
|
|
66
|
+
job: string;
|
|
67
|
+
added: number;
|
|
68
|
+
picks: {
|
|
69
|
+
line: number;
|
|
70
|
+
rule: number | undefined;
|
|
71
|
+
check: Record<string, any> | null;
|
|
72
|
+
added: string;
|
|
73
|
+
own?: boolean;
|
|
74
|
+
}[];
|
|
75
|
+
left: {
|
|
76
|
+
line: number;
|
|
77
|
+
rule: number | undefined;
|
|
78
|
+
}[];
|
|
79
|
+
};
|
|
39
80
|
/**
|
|
40
81
|
* THE one place a step's `~` lines become its guardrail: several `~` lines under one step are ONE continuous guardrail (hamr ruling 2026-10-09),
|
|
41
82
|
* each part verbatim (trimmed), in typed order, joined by "; ". An answer (am24) is one more `~` line, so it joins here too. The signed-text parser
|
package/types/panel/result.d.ts
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
* @param {any} arbiter @returns {boolean}
|
|
4
4
|
*/
|
|
5
5
|
export function isResultRun(arbiter: any): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* M15 item 1: the ONE decider of the Result tab and of its cards. Every job has it; a Tickets MCP job keeps what it had (M13 am2: the grid, and M10's cards only when
|
|
8
|
+
* it reads a page, a CSV or a .docx). Read off the signed declaration and arbiter.
|
|
9
|
+
* @param {any} arbiter @param {any} declaration @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
export function hasResultCards(arbiter: any, declaration: any): boolean;
|
|
6
12
|
/** The run's check type: its distinct close classes, in step order (`hitl + softgreen`). `—` for a declaration with none.
|
|
7
13
|
* @param {any} declaration @returns {string} */
|
|
8
14
|
export function checkTypeOf(declaration: any): string;
|
|
@@ -55,9 +61,9 @@ export function readDelivered(rec: {
|
|
|
55
61
|
buf: null;
|
|
56
62
|
};
|
|
57
63
|
/**
|
|
58
|
-
* The files this run's signed sends wrote: for each signed send whose send step ended green in the audit, the file `<flow>-<runId>-<emits>.
|
|
59
|
-
* in the signed folder
|
|
60
|
-
* send itself checked). No accepted hash = recorded as null, which reads as "changed", never as ok.
|
|
64
|
+
* The files this run's signed sends wrote: for each signed send whose send step ended green in the audit, the file `<flow>-<runId>-<emits>.md`
|
|
65
|
+
* in the signed folder with the sha256 the send recorded for it (M15), or, for a send older than M15, `.json` with the sha256 the human's accept recorded for the ask that
|
|
66
|
+
* send reads (`readAcceptedHashesByEmits`, the same record the send itself checked). No accepted hash = recorded as null, which reads as "changed", never as ok.
|
|
61
67
|
* @returns {{path: string, dir: string|null, name: string, sha256: string|null}[]}
|
|
62
68
|
*/
|
|
63
69
|
export function deliveredOf({ arbiter, declaration, runDir, root, flow, runId, auditRows, }: {
|