fwdloop 0.29.0 → 0.31.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/package.json +2 -2
- package/src/added-end.js +60 -0
- package/src/authoring.js +14 -8
- package/src/checked.js +11 -9
- package/src/checkpick.js +67 -6
- package/src/checkwords.js +5 -0
- package/src/citedcheck.js +14 -0
- package/src/closers.js +32 -2
- package/src/declaration.js +49 -2
- package/src/draft-steps.js +3 -3
- package/src/drafter.js +41 -9
- package/src/jobkey.js +3 -1
- package/src/model-step.js +14 -8
- package/src/pageask.js +36 -5
- package/src/panel/author.js +17 -6
- package/src/panel/authorcard.js +12 -8
- package/src/panel/data.js +5 -3
- package/src/panel/index.html +42 -10
- package/src/panel/result.js +2 -1
- package/src/plain-checks.js +15 -3
- package/src/provider.js +1 -1
- package/src/repairs.js +38 -0
- package/src/runner.js +47 -10
- package/src/setup.js +11 -5
- package/src/sheetblock.js +2 -1
- package/src/sheetfind.js +3 -1
- package/src/ticket-draft.js +2 -2
- package/src/ticket-labels.js +2 -2
- package/src/try-checks.js +13 -3
- package/src/whole-job.js +71 -0
- package/types/added-end.d.ts +62 -0
- package/types/authoring.d.ts +2 -1
- package/types/checkpick.d.ts +35 -0
- package/types/checkwords.d.ts +4 -0
- package/types/citedcheck.d.ts +6 -0
- package/types/closers.d.ts +4 -2
- package/types/declaration.d.ts +3 -0
- package/types/drafter.d.ts +16 -0
- package/types/model-step.d.ts +18 -3
- package/types/pageask.d.ts +12 -2
- package/types/panel/data.d.ts +1 -1
- package/types/panel/jobgrid.d.ts +1 -1
- package/types/plain-checks.d.ts +9 -1
- package/types/repairs.d.ts +13 -0
- package/types/sheetfind.d.ts +1 -0
- package/types/try-checks.d.ts +1 -7
- package/types/whole-job.d.ts +70 -0
package/types/declaration.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export function checkSendLineGuardrail(lines: any[], arbiter: {
|
|
|
42
42
|
export function guardrailWordsPerSection(guardrail: any): number | null;
|
|
43
43
|
/** M4e amendment 7 item 1: the first "<N> sections" in a guardrail (N digits, or the words one..ten), or null. */
|
|
44
44
|
export function guardrailSectionCount(guardrail: any): any;
|
|
45
|
+
/** M10 amendment 23: the first "<N> bullets / list items / items / lines / points" in a guardrail (N digits, or the words one..ten; not a price like "$5 per item"), or null. */
|
|
46
|
+
export function guardrailItemCount(guardrail: any): any;
|
|
45
47
|
/** M4e amendment 15 item 2: for each line whose guardrail gives a size for each section, a section count AND a word number,
|
|
46
48
|
* size x count more than the LARGEST word number (no possible pick fits) is a red naming the line and the numbers. $0; run before any model
|
|
47
49
|
* call, when there is no AI pick yet (amendment 29). After the draft the AI's `maxWords` is checked in checkShapeFitsJobLine. */
|
|
@@ -111,6 +113,7 @@ export const FLOW_TYPES: readonly string[];
|
|
|
111
113
|
export const SHAPE_KEYS: readonly string[];
|
|
112
114
|
/** Shape keys only the MACHINE sets (M4e amendment 15): read from the line's guardrail, never offered to the drafter's model. */
|
|
113
115
|
export const MACHINE_SHAPE_KEYS: readonly string[];
|
|
116
|
+
export function isCountGuardrail(guardrail: any): boolean;
|
|
114
117
|
export type Arbiter = import("./types.js").Arbiter;
|
|
115
118
|
export type SignedLine = import("./types.js").SignedLine;
|
|
116
119
|
export type CatalogueEntry = import("./types.js").CatalogueEntry;
|
package/types/drafter.d.ts
CHANGED
|
@@ -967,6 +967,22 @@ export function normalizeQuestions(raw: any, failedLines: any): {
|
|
|
967
967
|
kept: any[];
|
|
968
968
|
dropped: any[];
|
|
969
969
|
};
|
|
970
|
+
/**
|
|
971
|
+
* The job lines as the page look may see them (no count rule), and `toOriginal`, which takes a look fact's / dropped entry's visible rule number back to the guardrail's own number.
|
|
972
|
+
* @param {{n: number, text: string, rule?: string}[]} jobLines
|
|
973
|
+
*/
|
|
974
|
+
export function hideCounts(jobLines: {
|
|
975
|
+
n: number;
|
|
976
|
+
text: string;
|
|
977
|
+
rule?: string;
|
|
978
|
+
}[]): {
|
|
979
|
+
seenLines: {
|
|
980
|
+
rule?: string | undefined;
|
|
981
|
+
n: number;
|
|
982
|
+
text: string;
|
|
983
|
+
}[];
|
|
984
|
+
toOriginal: (f: any) => any;
|
|
985
|
+
};
|
|
970
986
|
export function buildSystemPrompt({ menu, lines, arbiter, factsInfo }: {
|
|
971
987
|
menu: any;
|
|
972
988
|
lines: any;
|
package/types/model-step.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export function isTransportFailure(err: any): boolean;
|
|
|
15
15
|
* only (plus, for a green step that quotes a saved page, the form of its answer).
|
|
16
16
|
* `stepClass` is `'green' | 'softgreen' | 'hitl' | null | undefined`; `cited` is true for that green step.
|
|
17
17
|
*/
|
|
18
|
-
/** @param {string|null|undefined} stepClass @param {boolean} [cited] @param {any[]|null} [sheet] M10b piece 2: the step's `close.sheet` (its claim boxes become the answer) */
|
|
19
|
-
export function buildEmitArtifactSchema(stepClass: string | null | undefined, cited?: boolean, sheet?: any[] | null): Readonly<{
|
|
18
|
+
/** @param {string|null|undefined} stepClass @param {boolean} [cited] @param {any[]|null} [sheet] M10b piece 2: the step's `close.sheet` (its claim boxes become the answer) @param {boolean} [withText] M10 am22: a fact step with the person's picks also answers in `text` (the picks read it) */
|
|
19
|
+
export function buildEmitArtifactSchema(stepClass: string | null | undefined, cited?: boolean, sheet?: any[] | null, withText?: boolean): Readonly<{
|
|
20
20
|
type: "object";
|
|
21
21
|
properties: {
|
|
22
22
|
done: {
|
|
@@ -93,6 +93,19 @@ export function buildEmitArtifactSchema(stepClass: string | null | undefined, ci
|
|
|
93
93
|
type: string[];
|
|
94
94
|
description: string;
|
|
95
95
|
};
|
|
96
|
+
text: {
|
|
97
|
+
type: string;
|
|
98
|
+
};
|
|
99
|
+
} | {
|
|
100
|
+
done: {
|
|
101
|
+
type: string;
|
|
102
|
+
description: string;
|
|
103
|
+
};
|
|
104
|
+
blocker: {
|
|
105
|
+
type: string[];
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
text?: undefined;
|
|
96
109
|
};
|
|
97
110
|
required: string[];
|
|
98
111
|
additionalProperties: boolean;
|
|
@@ -106,7 +119,7 @@ export function buildEmitArtifactSchema(stepClass: string | null | undefined, ci
|
|
|
106
119
|
* @param {{in:number,out:number}} [opts.rates]
|
|
107
120
|
* @param {string} [opts.modelId]
|
|
108
121
|
* @param {Record<string,string|undefined>} [opts.env] - the merged shell+keys-file env the key is read from (default process.env).
|
|
109
|
-
* @returns {(executorContext:object, grantedTools:Record<string,any>, stepMeta?:{class?:string, attempt?:number, step?:string|null, cited?:any, sheet?:any[]|null, thinkingMode?:'on'|'off'}, seam?:{stopRequested?:() => boolean}) => Promise<any>}
|
|
122
|
+
* @returns {(executorContext:object, grantedTools:Record<string,any>, stepMeta?:{class?:string, attempt?:number, step?:string|null, cited?:any, sheet?:any[]|null, withText?:boolean, picked?:any[]|null, thinkingMode?:'on'|'off'}, seam?:{stopRequested?:() => boolean}) => Promise<any>}
|
|
110
123
|
*/
|
|
111
124
|
export function makeLiveModelStep({ slot, model, spendPath, provider: injectedProvider, rates: injectedRates, modelId: injectedModelId, env, }: {
|
|
112
125
|
slot?: string | undefined;
|
|
@@ -125,6 +138,8 @@ export function makeLiveModelStep({ slot, model, spendPath, provider: injectedPr
|
|
|
125
138
|
step?: string | null;
|
|
126
139
|
cited?: any;
|
|
127
140
|
sheet?: any[] | null;
|
|
141
|
+
withText?: boolean;
|
|
142
|
+
picked?: any[] | null;
|
|
128
143
|
thinkingMode?: "on" | "off";
|
|
129
144
|
}, seam?: {
|
|
130
145
|
stopRequested?: () => boolean;
|
package/types/pageask.d.ts
CHANGED
|
@@ -7,6 +7,16 @@ export function moneyAs(f: any, n: string | number, symbolFirst: boolean): strin
|
|
|
7
7
|
export function ruleWords(f: any): string;
|
|
8
8
|
/** @param {unknown} q a recorded question @returns {string|null} the reading a reading ask proposed, or null when it was another kind of question */
|
|
9
9
|
export function readingOfQuestion(q: unknown): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* M10 am29: a look question as the PANEL shows it: the code's own answer words (`Answer "agree"…` / `answer "drop it"…`) cut off the end, because the buttons and the box say it.
|
|
12
|
+
* Only the known tails are cut, matched exactly as a suffix (never a pattern over the prose); a question that ends in none of them is returned whole. The stored question is never changed.
|
|
13
|
+
* @param {{question: string, line: number, source?: string}} q @returns {string}
|
|
14
|
+
*/
|
|
15
|
+
export function panelQuestionText(q: {
|
|
16
|
+
question: string;
|
|
17
|
+
line: number;
|
|
18
|
+
source?: string;
|
|
19
|
+
}): string;
|
|
10
20
|
/**
|
|
11
21
|
* The early asks CODE forces before any paid drafting, from the look's own result. One ask per rule text on a line; readings first, then can't-check
|
|
12
22
|
* asks, each in line order. The caller applies the cap and the answer gate.
|
|
@@ -46,7 +56,7 @@ export function tooManyAsksText(asks: {
|
|
|
46
56
|
* 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
57
|
* 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
58
|
* 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
|
|
59
|
+
* @param {{source?: string, ask?: string, proposal?: string|null, check?: Record<string, any>}} q @param {unknown} typed @param {'agree'|'drop'|'rule'} [choice] M10 am29: the button used; absent = today's words reading (CLI, old files)
|
|
50
60
|
* @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)
|
|
51
61
|
*/
|
|
52
62
|
export function ruleOfAnswer(q: {
|
|
@@ -54,7 +64,7 @@ export function ruleOfAnswer(q: {
|
|
|
54
64
|
ask?: string;
|
|
55
65
|
proposal?: string | null;
|
|
56
66
|
check?: Record<string, any>;
|
|
57
|
-
}, typed: unknown): {
|
|
67
|
+
}, typed: unknown, choice?: "agree" | "drop" | "rule"): {
|
|
58
68
|
rule: string | null;
|
|
59
69
|
left: boolean;
|
|
60
70
|
check?: Record<string, any>;
|
package/types/panel/data.d.ts
CHANGED
|
@@ -756,7 +756,7 @@ export function getJobGrid({ root, flow, catalogue, now, }: {
|
|
|
756
756
|
name: string;
|
|
757
757
|
title: string | null;
|
|
758
758
|
number: number | null;
|
|
759
|
-
bucket: "
|
|
759
|
+
bucket: "wait" | "done" | "skip" | "stop";
|
|
760
760
|
glyph: string;
|
|
761
761
|
at: number;
|
|
762
762
|
ex: "r" | "n" | "g" | "q";
|
package/types/panel/jobgrid.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export function buildJobGrid({ runs, anyway, now }: {
|
|
|
69
69
|
name: string;
|
|
70
70
|
title: string | null;
|
|
71
71
|
number: number | null;
|
|
72
|
-
bucket: "
|
|
72
|
+
bucket: "wait" | "done" | "skip" | "stop";
|
|
73
73
|
glyph: string;
|
|
74
74
|
at: number;
|
|
75
75
|
ex: "r" | "n" | "g" | "q";
|
package/types/plain-checks.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M4d amendment 38 item 1: the ONE decision of which red is explained: the first red a `first` rule matches, else the first red (am15 item 3).
|
|
3
|
+
* @param {ReadonlyArray<string>} reds
|
|
4
|
+
* @returns {string|undefined}
|
|
5
|
+
*/
|
|
6
|
+
export function pickPlanRed(reds: ReadonlyArray<string>): string | undefined;
|
|
1
7
|
/**
|
|
2
8
|
* @param {unknown} raw one raw refusal text
|
|
3
9
|
* @returns {{ say: string, reason: string, fix: string, raw: string }}
|
|
@@ -8,15 +14,17 @@ export function plainPlanCheck(raw: unknown): {
|
|
|
8
14
|
fix: string;
|
|
9
15
|
raw: string;
|
|
10
16
|
};
|
|
11
|
-
/** @type {ReadonlyArray<{re: RegExp, say: string|null, fix: string}>} `say` null = the checker's own sentence, as it is without its "declaration: " prefix */
|
|
17
|
+
/** @type {ReadonlyArray<{re: RegExp, say: string|null, fix: string, first?: boolean}>} `say` null = the checker's own sentence, as it is without its "declaration: " prefix */
|
|
12
18
|
export const PLAN_CHECK_RULES: ReadonlyArray<{
|
|
13
19
|
re: RegExp;
|
|
14
20
|
say: string | null;
|
|
15
21
|
fix: string;
|
|
22
|
+
first?: boolean;
|
|
16
23
|
}>;
|
|
17
24
|
export const GENERIC_SAY: "One of the checks on the plan failed.";
|
|
18
25
|
export const GENERIC_FIX: "Draft again.";
|
|
19
26
|
export function pageRules(): {
|
|
27
|
+
first?: boolean | undefined;
|
|
20
28
|
re: string;
|
|
21
29
|
say: string | null;
|
|
22
30
|
}[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {any} declaration the drafter's declaration (not changed) @param {{sources?: {role?: string, kind?: string}[]}} arbiter
|
|
3
|
+
* @returns {{declaration: any, repaired: string[]}}
|
|
4
|
+
*/
|
|
5
|
+
export function repairDeclaration(declaration: any, arbiter: {
|
|
6
|
+
sources?: {
|
|
7
|
+
role?: string;
|
|
8
|
+
kind?: string;
|
|
9
|
+
}[];
|
|
10
|
+
}): {
|
|
11
|
+
declaration: any;
|
|
12
|
+
repaired: string[];
|
|
13
|
+
};
|
package/types/sheetfind.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export function findColumn(csvText: string, word: string): FoundHeader | FoundAs
|
|
|
13
13
|
/** a column fits when a plain number fills at least this share of the rows (F71 (b)) */
|
|
14
14
|
export const FIT_RATIO: 0.9;
|
|
15
15
|
export function columnQuestion(word: string, found: FoundAsk, line: number): string;
|
|
16
|
+
export function columnTail(line: number): string;
|
|
16
17
|
/**
|
|
17
18
|
* the word IS a column (nothing to ask)
|
|
18
19
|
*/
|
package/types/try-checks.d.ts
CHANGED
|
@@ -42,13 +42,7 @@ export function closeRecords(step: any, artifact: any, closed: {
|
|
|
42
42
|
ok: boolean;
|
|
43
43
|
result: string | null;
|
|
44
44
|
}>;
|
|
45
|
-
}):
|
|
46
|
-
n: number;
|
|
47
|
-
text: string;
|
|
48
|
-
ok: boolean;
|
|
49
|
-
result: string | null;
|
|
50
|
-
source: string;
|
|
51
|
-
}[];
|
|
45
|
+
}): any[];
|
|
52
46
|
export const EVERY_STEP: "every step";
|
|
53
47
|
export function lineSource(step: {
|
|
54
48
|
fromLine?: unknown;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The index of the Ask that shows the whole job: the Ask the added send reads, only when the plan has the am8 added `write it out`. A job signed before am8
|
|
3
|
+
* (its send line is the person's own words) finds -1 and keeps today's behaviour exactly.
|
|
4
|
+
* @param {{ steps: { fromLine: number, goal: string, emits?: string, reads?: string[] }[], askLines: Map<number, any>, sendLines: Map<number, any> }} p
|
|
5
|
+
* @returns {number} -1 = none
|
|
6
|
+
*/
|
|
7
|
+
export function wholeJobAskIndex({ steps, askLines, sendLines }: {
|
|
8
|
+
steps: {
|
|
9
|
+
fromLine: number;
|
|
10
|
+
goal: string;
|
|
11
|
+
emits?: string;
|
|
12
|
+
reads?: string[];
|
|
13
|
+
}[];
|
|
14
|
+
askLines: Map<number, any>;
|
|
15
|
+
sendLines: Map<number, any>;
|
|
16
|
+
}): number;
|
|
17
|
+
/**
|
|
18
|
+
* @param {{ steps: { fromLine: number, goal: string, emits?: string }[], askLines: Map<number, any>, lastAskIndex: number,
|
|
19
|
+
* readResult: (id: string) => ({ ok: true, value: any } | { ok: false, missing: true } | { ok: false, missing: false, red: string }) }} p
|
|
20
|
+
* @returns {{ ok: true, value: { text: string } } | { ok: false, red: string }}
|
|
21
|
+
*/
|
|
22
|
+
export function wholeJobText({ steps, askLines, lastAskIndex, readResult }: {
|
|
23
|
+
steps: {
|
|
24
|
+
fromLine: number;
|
|
25
|
+
goal: string;
|
|
26
|
+
emits?: string;
|
|
27
|
+
}[];
|
|
28
|
+
askLines: Map<number, any>;
|
|
29
|
+
lastAskIndex: number;
|
|
30
|
+
readResult: (id: string) => ({
|
|
31
|
+
ok: true;
|
|
32
|
+
value: any;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
missing: true;
|
|
36
|
+
} | {
|
|
37
|
+
ok: false;
|
|
38
|
+
missing: false;
|
|
39
|
+
red: string;
|
|
40
|
+
});
|
|
41
|
+
}): {
|
|
42
|
+
ok: true;
|
|
43
|
+
value: {
|
|
44
|
+
text: string;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
ok: false;
|
|
48
|
+
red: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* M13 am9 item 4: the plan shows the last Ask as reading every step. Code sets the Ask's `reads` to every work step's emits before it (the nearest one first, so a
|
|
52
|
+
* redo still re-runs the step just before the Ask; the rest in job order). Only a plan with the am8 added end; any other plan comes back as it was.
|
|
53
|
+
* @template {{ fromLine: number, goal: string, emits?: string, reads?: string[], primitives?: string[] }} S
|
|
54
|
+
* @param {S[]} steps @param {{ asks?: { line: number }[], sends?: { line: number }[] }} arbiter
|
|
55
|
+
* @returns {S[]}
|
|
56
|
+
*/
|
|
57
|
+
export function readEveryStep<S extends {
|
|
58
|
+
fromLine: number;
|
|
59
|
+
goal: string;
|
|
60
|
+
emits?: string;
|
|
61
|
+
reads?: string[];
|
|
62
|
+
primitives?: string[];
|
|
63
|
+
}>(steps: S[], arbiter: {
|
|
64
|
+
asks?: {
|
|
65
|
+
line: number;
|
|
66
|
+
}[];
|
|
67
|
+
sends?: {
|
|
68
|
+
line: number;
|
|
69
|
+
}[];
|
|
70
|
+
}): S[];
|