jsfe 1.10.6 → 1.10.7
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":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AA4MA;;;GAGG;AACH,wEAkBC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AAiBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAmCC;AAUD;;;;;;;;;GASG;AACH,6EA4GC;;;;;;;;AA/aD,qCAKiD"}
|
package/dist/helpers/answer.js
CHANGED
|
@@ -94,7 +94,7 @@ const phraseAt = (tokens, i, phrase) => phrase.every((w, j) => tokens[i + j] ===
|
|
|
94
94
|
* words from `words` — at least one of them. A YES that acts must be the whole answer (owner rule, 2026-10-14): "Yeah, sure,
|
|
95
95
|
* thank you" and "Sí, claro, por favor" are YES; "yes, pay it" and "I made payments by 1" are not.
|
|
96
96
|
*/
|
|
97
|
-
function onlyAffirmative(b, words, needOne = true, filler = []) {
|
|
97
|
+
function onlyAffirmative(b, words, needOne = true, filler = [], courtesyWords = COURTESY) {
|
|
98
98
|
if (!words.length && needOne) {
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
@@ -108,7 +108,7 @@ function onlyAffirmative(b, words, needOne = true, filler = []) {
|
|
|
108
108
|
let saw = false;
|
|
109
109
|
while (i < tk.length) {
|
|
110
110
|
const yes = own.filter((p) => at(i, p)).sort((x, y) => y.length - x.length)[0];
|
|
111
|
-
const courtesy = yes ? null : [...
|
|
111
|
+
const courtesy = yes ? null : [...courtesyWords, ...filler].filter((p) => at(i, p)).sort((x, y) => y.length - x.length)[0];
|
|
112
112
|
if (yes) {
|
|
113
113
|
i += yes.length;
|
|
114
114
|
saw = true;
|
|
@@ -183,6 +183,15 @@ function textRequest(input, words, extra) {
|
|
|
183
183
|
* when `yesOk`, a YES word ("yes 1", "sí, 1"). Owner decision 2026-10-15: "Yes 1" at "tell me the product number" was
|
|
184
184
|
* missed. Anything else around the key ("no 1", "1 or 2", "I paid 1 already") is not that key.
|
|
185
185
|
*/
|
|
186
|
+
// The only words a firm YES's key may carry besides CONFIRM words (owner rule 2026-10-25): "1, por favor", "sí, 1".
|
|
187
|
+
const PLEASE_THANKS = ['please', 'por favor', ...THANKS].map(normalize).map((w) => w.split(' '));
|
|
188
|
+
/** A firm key: the key alone, or beside please/thanks and firm CONFIRM words only ("Sí, 1" — owner 2026-10-15 and
|
|
189
|
+
* 2026-10-25). Never a soft YES word, an acknowledgement, a key-naming word, a form of address or filler beside it. */
|
|
190
|
+
function firmKey(b, key) {
|
|
191
|
+
const tk = String(b).replace(/\./g, ' ').split(' ').filter(Boolean);
|
|
192
|
+
const at = tk.reduce((acc, t, i) => (t === key ? [...acc, i] : acc), []);
|
|
193
|
+
return at.length === 1 && onlyAffirmative(tk.filter((t, i) => i !== at[0]).join(' '), CONFIRM_WORDS, false, [], PLEASE_THANKS);
|
|
194
|
+
}
|
|
186
195
|
// Words that name the key itself when said right before it: "el número 4", "opción 2", "number 4", "the 4" (prod
|
|
187
196
|
// 2026-10-25 18:25: "Número 4" and "El número 4" at a numbered product list were not understood, twice).
|
|
188
197
|
const KEY_NAMES = new Set(['number', 'numero', 'option', 'opcion', 'item', 'choice', 'the', 'el', 'la'].map(normalize));
|
|
@@ -417,7 +426,10 @@ export function pickChoice(answer, choices, acceptOther) {
|
|
|
417
426
|
const strict = all.filter((w) => c.exact === true || /^[0-9*#]$/.test(String(w).trim()) || YES_SET.has(normalize(w)))
|
|
418
427
|
.filter((w) => !(amount && /^\d+$/.test(String(w).trim())));
|
|
419
428
|
const isKey = (w) => /^[0-9*#]$/.test(String(w).trim());
|
|
420
|
-
const
|
|
429
|
+
const firm = c.key === 'yes' && c.exact === true;
|
|
430
|
+
const keyed = (w) => isKey(w) && (firm
|
|
431
|
+
? firmKey(b, String(w).trim()) || (spoken !== b && firmKey(spoken, String(w).trim()))
|
|
432
|
+
: matchesChoice(raw, [w]) || keyWithOnlyCourtesy(b, String(w).trim(), !isNoType(c)) || (spoken !== b && keyWithOnlyCourtesy(spoken, String(w).trim(), !isNoType(c))));
|
|
421
433
|
// A question is not a confirmation: "sure?" or "1?" never picks a choice that charges or cancels.
|
|
422
434
|
if (c.exact === true && /[?¿]/.test(raw)) {
|
|
423
435
|
// not this choice
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:7d7eed4421d54620c8003db7ad362a4ecfb2689e8fcaf050e43fd93912f6e914";
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 1.10.7: a firm question's key in minimal context
|
|
2
|
+
|
|
3
|
+
At a firm question (a yes choice that charges or cancels), its key confirms only alone or beside please/thanks or a CONFIRM
|
|
4
|
+
word: "1", "uno", "1, por favor", "Sí, 1" (owner rule 2026-10-25). It no longer confirms beside a soft YES word or an
|
|
5
|
+
acknowledgement ("1 está bien", "ok 1"), a key-naming word ("opción 1", "el número 1", which 1.10.5 had admitted) or other
|
|
6
|
+
filler ("um, 1"). Firm YES words are unchanged ("Sí, está bien" still confirms).
|
|
7
|
+
|
|
1
8
|
## 1.10.6: pointing at the offered thing
|
|
2
9
|
|
|
3
10
|
At a soft question (a yes choice that does not charge or cancel), a word pointing at the offered thing may lead the YES:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.7",
|
|
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",
|