jsfe 1.10.0 → 1.10.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,sEAQC;AAqED;;;GAGG;AACH,sFAwGC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;mHACmH;AACnH;;;;;;;;;;;;;;;;;;;;;EAeC;AACD;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,sEAQC;AAqED;;;GAGG;AACH,sFAwGC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;mHACmH;AACnH;;;;;;;;;;;;;;;;;;;;;EAeC;AACD;;;;;;;;;;;;;;;;;;;;;;EAgLC"}
|
|
@@ -303,8 +303,9 @@ export function matchInputs(answer, candidates, current, choiceKey) {
|
|
|
303
303
|
// Rule 2: a confirmation is answered only when asked, firm by CONFIRM_WORDS, soft by the wider YES vocabulary.
|
|
304
304
|
const confirmation = ['firm', 'soft'].includes(c.confirmation) ? c.confirmation : '';
|
|
305
305
|
if (confirmation && !isCur(c)) {
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
const would = readInputProfile(c.profile, raw, false);
|
|
307
|
+
if (would)
|
|
308
|
+
refused.push({ form: c.form, name: c.name, rule: 'confirmation_out_of_order', spans: (would.alternatives || [would]).flatMap((x) => x.spans || []) });
|
|
308
309
|
continue;
|
|
309
310
|
}
|
|
310
311
|
else {
|
|
@@ -353,11 +354,11 @@ export function matchInputs(answer, candidates, current, choiceKey) {
|
|
|
353
354
|
return true;
|
|
354
355
|
}
|
|
355
356
|
else if (bare(reading) && fieldOf(reading).profile.kind === 'amount') {
|
|
356
|
-
refused.push({ form: reading.form, name: reading.name, value: reading.value, rule: 'bare_amount_out_of_order' });
|
|
357
|
+
refused.push({ form: reading.form, name: reading.name, value: reading.value, rule: 'bare_amount_out_of_order', spans: reading.spans });
|
|
357
358
|
return false;
|
|
358
359
|
}
|
|
359
360
|
else if (/\d/.test(spanText(reading)) && !wholeRuns(reading)) {
|
|
360
|
-
refused.push({ form: reading.form, name: reading.name, value: reading.value, rule: 'fragment' });
|
|
361
|
+
refused.push({ form: reading.form, name: reading.name, value: reading.value, rule: 'fragment', spans: reading.spans });
|
|
361
362
|
return false;
|
|
362
363
|
}
|
|
363
364
|
else {
|
|
@@ -454,7 +455,12 @@ export function matchInputs(answer, candidates, current, choiceKey) {
|
|
|
454
455
|
const clash = (a, b) => (a.spans || []).some(([s, e]) => (b.spans || []).some(([t, u]) => s < u && t < e));
|
|
455
456
|
const kept = taken.filter((a) => !taken.some((b) => b !== a && clash(a, b)));
|
|
456
457
|
for (const r of taken.filter((a) => !kept.includes(a)))
|
|
457
|
-
refused.push({ form: r.form, name: r.name, value: r.value, rule: 'one_part_two_fields' });
|
|
458
|
+
refused.push({ form: r.form, name: r.name, value: r.value, rule: 'one_part_two_fields', spans: r.spans });
|
|
459
|
+
// A refusal is recorded only when it stopped something: a reading whose part of the answer a structured in-order
|
|
460
|
+
// reading (a key, the code, the amount asked) also claimed would have lost anyway ("2" at PAY or LINK is the key, not
|
|
461
|
+
// an amount refused). A free-text fallback claims everything and does not count.
|
|
462
|
+
const claimed = readings.filter((r) => inOrder(r) && !r.fallback).flatMap((r) => r.spans || []);
|
|
463
|
+
const stopped = refused.filter((x) => !(x.spans || []).some(([s, e]) => claimed.some(([t, u]) => s < u && t < e))).map(({ spans, ...x }) => x);
|
|
458
464
|
// Several fields from one answer: those filled out of order are a compound answer.
|
|
459
465
|
if (kept.length > 1)
|
|
460
466
|
kept.forEach((r) => { if (r.rule === 'out_of_order')
|
|
@@ -462,5 +468,5 @@ export function matchInputs(answer, candidates, current, choiceKey) {
|
|
|
462
468
|
hits.push(...kept.map(({ rule, ...r }) => strip(r)));
|
|
463
469
|
// Why each field was filled other than as the current answer, kept beside the hits so their shape never changes.
|
|
464
470
|
const decisions = kept.filter((r) => r.rule).map((r) => ({ form: r.form, name: r.name, rule: r.rule }));
|
|
465
|
-
return { hits, ambiguous, ...(remaining.length ? { remaining } : {}), ...(
|
|
471
|
+
return { hits, ambiguous, ...(remaining.length ? { remaining } : {}), ...(stopped.length ? { refused: stopped } : {}), ...(decisions.length ? { decisions } : {}) };
|
|
466
472
|
}
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:a185d7c855be017ff45741150eea0f426254c3eb2de5069c5d8f40fec198054b";
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 1.10.1: refusals that stopped something
|
|
2
|
+
|
|
3
|
+
`matchInputs` lists a refused reading only when it stopped something: one whose part of the answer a structured in-order
|
|
4
|
+
reading (a key, the code, the amount asked) also claimed would have lost anyway, so "2" at a menu is its key, not a refused
|
|
5
|
+
amount, and the host's `form_acceptance` counts real leaks. A free-text fallback does not count as a claim. The
|
|
6
|
+
standard-functions test recognizes named function expressions and arrow functions a flow defines for itself.
|
|
7
|
+
|
|
1
8
|
## 1.10.0: context-aware acceptance
|
|
2
9
|
|
|
3
10
|
An answer given out of order fills another question's field only where it is relevant there (reference §5): a confirmation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "TypeScript workflow engine for conversational/automation apps: multi-flow orchestration, interrupt/resume, stack-based control, robust errors, and flexible tool/REST integration.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ron Pinkas",
|