fwdloop 0.33.0 → 0.35.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 +14 -0
- package/bin/fwdloop +18 -2
- package/package.json +1 -1
- package/src/action-line.js +100 -0
- package/src/action-stop.js +44 -0
- package/src/ask.js +9 -2
- package/src/auditchecks.js +6 -4
- package/src/authoring.js +28 -14
- package/src/blockasks.js +3 -2
- package/src/blockassemble.js +40 -21
- package/src/blockdraft.js +8 -13
- package/src/blockpick.js +11 -1
- package/src/checkblock.js +102 -58
- package/src/checked.js +7 -2
- package/src/checklist.js +1 -3
- package/src/checklistsign.js +1 -1
- package/src/checkpick.js +7 -73
- package/src/declaration.js +20 -35
- package/src/drafter.js +281 -208
- package/src/jobkey.js +2 -3
- package/src/noteask.js +62 -0
- package/src/pageask.js +24 -69
- package/src/pagedry.js +27 -4
- package/src/pagemap.js +8 -2
- package/src/pagerules.js +19 -3
- package/src/panel/author.js +63 -36
- package/src/panel/authorcard.js +36 -20
- package/src/panel/data.js +5 -1
- package/src/panel/index.html +66 -37
- package/src/pickrecord.js +42 -54
- package/src/planrebuild.js +16 -6
- package/src/rowedit.js +35 -5
- package/src/rubricstep.js +9 -1
- package/src/runner.js +87 -41
- package/src/runvalues.js +9 -1
- package/src/setup.js +3 -1
- package/src/sheetblock.js +17 -7
- package/src/sheetbuild.js +148 -0
- package/src/sheetchecks.js +3 -2
- package/src/sheetfind.js +4 -4
- package/src/sheetlook.js +15 -4
- package/src/sheetoffer.js +50 -5
- package/src/sheetrows.js +18 -2
- package/src/signed-text.js +1 -5
- package/src/ticket-draft.js +4 -21
- package/src/ticketrows.js +100 -0
- package/src/whole-job.js +27 -11
- package/types/action-line.d.ts +71 -0
- package/types/action-stop.d.ts +36 -0
- package/types/ask.d.ts +3 -2
- package/types/auditchecks.d.ts +2 -1
- package/types/authoring.d.ts +8 -3
- package/types/blockasks.d.ts +1 -2
- package/types/blockassemble.d.ts +20 -3
- package/types/blockdraft.d.ts +4 -12
- package/types/blockpick.d.ts +5 -0
- package/types/checkblock.d.ts +33 -17
- package/types/checked.d.ts +2 -0
- package/types/checklist.d.ts +3 -5
- package/types/checkpick.d.ts +4 -34
- package/types/declaration.d.ts +7 -0
- package/types/drafter.d.ts +23 -356
- package/types/noteask.d.ts +52 -0
- package/types/pageask.d.ts +12 -36
- package/types/pagedry.d.ts +13 -0
- package/types/pagerules.d.ts +7 -0
- package/types/panel/author.d.ts +1 -1
- package/types/panel/authorcard.d.ts +13 -8
- package/types/panel/authorflows.d.ts +4 -4
- package/types/panel/data.d.ts +2 -2
- package/types/panel/jobgrid.d.ts +1 -1
- package/types/pickrecord.d.ts +47 -13
- package/types/rowedit.d.ts +16 -1
- package/types/rubricstep.d.ts +3 -0
- package/types/sheetblock.d.ts +11 -4
- package/types/sheetbuild.d.ts +82 -0
- package/types/sheetchecks.d.ts +2 -1
- package/types/sheetfind.d.ts +2 -2
- package/types/sheetoffer.d.ts +26 -1
- package/types/sheetrows.d.ts +8 -0
- package/types/ticket-draft.d.ts +3 -49
- package/types/ticketrows.d.ts +61 -0
- package/types/whole-job.d.ts +3 -3
- package/src/added-end.js +0 -60
- package/src/repairs.js +0 -38
- package/types/added-end.d.ts +0 -62
- package/types/repairs.d.ts +0 -13
package/src/declaration.js
CHANGED
|
@@ -45,6 +45,7 @@ import { lineRules } from './pagebits.js';
|
|
|
45
45
|
import { OFFERED as OFFERED_RULES } from './checkwords.js';
|
|
46
46
|
import { isColumnChoiceRule } from './sheetoffer.js';
|
|
47
47
|
import { checkListReds } from './checklistsign.js';
|
|
48
|
+
import { ticketListReds } from './ticketrows.js';
|
|
48
49
|
|
|
49
50
|
/** @typedef {import('./types.js').Arbiter} Arbiter */
|
|
50
51
|
/** @typedef {import('./types.js').SignedLine} SignedLine */
|
|
@@ -159,7 +160,7 @@ function checkMcp(declaration, reds) {
|
|
|
159
160
|
/** M12 piece 3 (item 4): the signed label filter, `ticketFilter: {priority?: ['P0'..'P3'], labels?: [names]}`; optional, and only on a job that lists MCP tools.
|
|
160
161
|
* Pure data: code decides at run (src/ticket-labels.js); the drafter may only suggest it and a human signs it.
|
|
161
162
|
* @param {Record<string, any>} declaration @param {string[]} reds */
|
|
162
|
-
function checkTicketFilter(declaration, reds) {
|
|
163
|
+
export function checkTicketFilter(declaration, reds) {
|
|
163
164
|
if (!Object.hasOwn(declaration, 'ticketFilter')) return;
|
|
164
165
|
const f = declaration.ticketFilter;
|
|
165
166
|
if (!isPlainObject(f) || Object.keys(f).length === 0) {
|
|
@@ -186,7 +187,7 @@ function checkTicketFilter(declaration, reds) {
|
|
|
186
187
|
|
|
187
188
|
/** M12 piece 3 (signed item 7): the ticket fields a schedule may watch, `ticketWatch: ['state'|'labels']`; optional, only on a job that lists MCP tools, typed values only.
|
|
188
189
|
* The scheduler compares (src/trigger-tickets.js); the drafter may suggest, a human signs. @param {Record<string, any>} declaration @param {string[]} reds */
|
|
189
|
-
function checkTicketWatch(declaration, reds) {
|
|
190
|
+
export function checkTicketWatch(declaration, reds) {
|
|
190
191
|
if (!Object.hasOwn(declaration, 'ticketWatch')) return;
|
|
191
192
|
const w = declaration.ticketWatch;
|
|
192
193
|
if (!Array.isArray(w) || w.length === 0) { reds.push(`declaration: "ticketWatch" must be a non-empty list of fields (${WATCHABLE.join(' and ')})`); return; }
|
|
@@ -226,7 +227,7 @@ export const SHAPE_KEYS = Object.freeze(['maxWords', 'sections', 'linesPerInvoic
|
|
|
226
227
|
export const MACHINE_SHAPE_KEYS = Object.freeze(['wordsPerSection', 'picked']);
|
|
227
228
|
|
|
228
229
|
const SHAPE_TYPE_CHECKS = Object.freeze({
|
|
229
|
-
// M10 am16: the checks the person picked, set by code (src/
|
|
230
|
+
// M10 am16: the checks the person picked, set by code (src/blockassemble.js), each one a bareguard rule with only that rule's own fields
|
|
230
231
|
picked: {
|
|
231
232
|
expected: 'a non-empty array of checks, each an object with a text rule of bareguard\'s list',
|
|
232
233
|
check: (v) => Array.isArray(v) && v.length > 0 && v.every((c) => isPlainObject(c) && typeof c.rule === 'string' && OFFERED_RULES.includes(c.rule)),
|
|
@@ -560,7 +561,7 @@ function checkShapeBuilds(shape, label, reds, redsBefore) {
|
|
|
560
561
|
}
|
|
561
562
|
|
|
562
563
|
/**
|
|
563
|
-
* M10 am22 (3): `pickedLines` is the record of the fact lines that carry the person's picks: a list of line numbers. Code writes it (src/
|
|
564
|
+
* M10 am22 (3): `pickedLines` is the record of the fact lines that carry the person's picks: a list of line numbers. Code writes it (src/blockassemble.js).
|
|
564
565
|
* @param {Record<string, any>} declaration @param {string[]} reds
|
|
565
566
|
*/
|
|
566
567
|
function checkPickedLines(declaration, reds) {
|
|
@@ -571,7 +572,7 @@ function checkPickedLines(declaration, reds) {
|
|
|
571
572
|
|
|
572
573
|
/**
|
|
573
574
|
* M10 am22: `close.picked` is the checks the person picked for a fact line, kept beside its fact check and run on the answer's `text`. Code sets it (src/checkpick.js
|
|
574
|
-
|
|
575
|
+
* assembleFromBlock); here it must be a green step's, a list of bareguard text rules that builds into a check.
|
|
575
576
|
* It is allowed ONLY on a line the signed plan records in `pickedLines` (written by code from the person's picks); a count on any other fact line is refused.
|
|
576
577
|
* @param {any} step @param {string} label @param {string} effectiveClass @param {string[]} reds @param {Record<string, any>} declaration
|
|
577
578
|
*/
|
|
@@ -818,10 +819,10 @@ export function validateDeclaration(declaration, context = {}) {
|
|
|
818
819
|
reds.push('declaration: "guardrailClasses" must be an object keyed by line number');
|
|
819
820
|
}
|
|
820
821
|
|
|
821
|
-
// --- unjudgeable (
|
|
822
|
+
// --- unjudgeable (M17 am4, C8: a new plan carries none; a plan signed before holds it and is read as signed) ---
|
|
822
823
|
let unjudgeable = {};
|
|
823
824
|
if (!Object.prototype.hasOwnProperty.call(declaration, 'unjudgeable')) {
|
|
824
|
-
|
|
825
|
+
// nothing to read
|
|
825
826
|
} else if (Array.isArray(declaration.unjudgeable) && declaration.unjudgeable.length === 0) {
|
|
826
827
|
// am41 item 1 (F63): an empty list carries no data; it counts as {}. A non-empty list falls to the red below.
|
|
827
828
|
} else if (isPlainObject(declaration.unjudgeable)) {
|
|
@@ -1121,6 +1122,7 @@ export function validateDeclaration(declaration, context = {}) {
|
|
|
1121
1122
|
|
|
1122
1123
|
// M16 item 2: the checks of a list line are the signed list's; a plan carrying one proves it here, at sign and at run start ($0)
|
|
1123
1124
|
reds.push(...checkListReds(declaration));
|
|
1125
|
+
reds.push(...ticketListReds(declaration));
|
|
1124
1126
|
|
|
1125
1127
|
// --- ask slots (ported from poc/m1/slots.mjs's checkAskSlots) --------------
|
|
1126
1128
|
// (a) exactly one hitl step bound to each signed ask line.
|
|
@@ -1206,33 +1208,14 @@ export function validateDeclaration(declaration, context = {}) {
|
|
|
1206
1208
|
reds.push(`declaration: send at line ${n} (steps[${sendIdx}]) is not granted a catalogue primitive of class "write"`);
|
|
1207
1209
|
}
|
|
1208
1210
|
|
|
1209
|
-
//
|
|
1210
|
-
//
|
|
1211
|
-
//
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
const earlierAskLines = askLines.filter((a) => {
|
|
1218
|
-
const askIdx = stepInfo.findIndex((st) => st.fromLine === a);
|
|
1219
|
-
return askIdx !== -1 && askIdx < sendIdx;
|
|
1220
|
-
});
|
|
1221
|
-
if (earlierAskLines.length === 0) {
|
|
1222
|
-
reds.push(`declaration: send at line ${n} (steps[${sendIdx}]) has no signed ask at an earlier line to read from`);
|
|
1223
|
-
} else {
|
|
1224
|
-
const earlierAskEmits = earlierAskLines
|
|
1225
|
-
.map((a) => stepInfo.find((st) => st.fromLine === a))
|
|
1226
|
-
.filter((st) => st !== undefined)
|
|
1227
|
-
.map((st) => st.emits);
|
|
1228
|
-
const readAskEmits = earlierAskEmits.filter((emits) => emits !== null && sendStep.reads.includes(emits));
|
|
1229
|
-
if (readAskEmits.length === 0) {
|
|
1230
|
-
reds.push(`declaration: send at line ${n} (steps[${sendIdx}]) does not read the emits of any earlier signed `
|
|
1231
|
-
+ `ask step (asks at lines ${earlierAskLines.join(', ')})`);
|
|
1232
|
-
} else if (readAskEmits.length >= 2) {
|
|
1233
|
-
reds.push(`declaration: send at line ${n} (steps[${sendIdx}]) reads the emits of more than one earlier signed `
|
|
1234
|
-
+ `ask step (${readAskEmits.join(', ')}) — exactly 1 required`);
|
|
1235
|
-
}
|
|
1211
|
+
// M13 am11: the action ships everything that came before it: it reads the output of the step right before it (by step order, the order the
|
|
1212
|
+
// runner folds over). An Ask there is the artifact accepted at it; any other step's output is checked at run time against the last accept (or the run stops once).
|
|
1213
|
+
// No Ask is needed before the action. (Was: the send must read exactly one earlier signed ask.)
|
|
1214
|
+
const before = sendIdx > 0 ? stepInfo[sendIdx - 1] : null;
|
|
1215
|
+
if (before === null || before.emits === null) {
|
|
1216
|
+
reds.push(`declaration: send at line ${n} (steps[${sendIdx}]) has no step before it to write out`);
|
|
1217
|
+
} else if (!sendStep.reads.includes(before.emits)) {
|
|
1218
|
+
reds.push(`declaration: send at line ${n} (steps[${sendIdx}]) must read the output of the step before it ("${before.emits}"), got [${sendStep.reads.join(', ')}]`);
|
|
1236
1219
|
}
|
|
1237
1220
|
}
|
|
1238
1221
|
|
|
@@ -1244,7 +1227,9 @@ export function validateDeclaration(declaration, context = {}) {
|
|
|
1244
1227
|
// STEP ORDER (a step's position in `declaration.steps`, not its line
|
|
1245
1228
|
// number) since that is the order the runner actually folds over. No
|
|
1246
1229
|
// anchor to check against when there is no signed ask at all.
|
|
1247
|
-
|
|
1230
|
+
// M13 am11: with an action (a signed send) a step after the last Ask is allowed: what goes out is compared with the last accept at run time and the run stops once if it changed
|
|
1231
|
+
// (src/runner.js). A job with no action keeps this rule unchanged.
|
|
1232
|
+
if (askLines.length > 0 && sendLines.length === 0) {
|
|
1248
1233
|
const lastAskLine = Math.max(...askLines);
|
|
1249
1234
|
const lastAskStepIdx = stepInfo.findIndex((st) => st.fromLine === lastAskLine);
|
|
1250
1235
|
if (lastAskStepIdx !== -1) {
|