jsfe 1.10.4 → 1.10.6

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":"AAuLA;;;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,6EAyGC;;;;;;;;AA1ZD,qCAKiD"}
1
+ {"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AAmMA;;;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,6EAyGC;;;;;;;;AAnaD,qCAKiD"}
@@ -18,6 +18,9 @@ export const ANSWER_WORDS = {
18
18
  'si', 'sí', 'claro', 'claro que sí', 'claro que si', 'seguro', 'por favor', 'correcto', 'está bien', 'esta bien', 'de acuerdo',
19
19
  'estoy de acuerdo', 'dale', 'por supuesto', 'bueno', 'confirmo', 'confirmado', 'apruebo', 'aprobado', 'adelante', 'hazlo',
20
20
  'procede', 'perfecto', 'exacto', 'eso es', 'así es', 'asi es',
21
+ // the offered thing, pointed at (prod 2026-10-25 17:46: "Ese está bien." to "¿Se lo envío a …?" was not a yes)
22
+ 'ese mismo', 'esa misma', 'eso mismo', 'el mismo', 'la misma', "that's the one", 'that is the one',
23
+ 'the same one',
21
24
  // agreeing to what the question offers: "Sí, quiero continuar" to "diga SÍ para continuar" (replay of prod, 2026-10-14).
22
25
  // A bare "I want" / "quiero" is never a confirmation (owner decision 2026-10-15): "Quiero pagar" at the express offer,
23
26
  // which charges on its YES, was a YES because 'pagar' is that choice's own word.
@@ -76,6 +79,10 @@ const THANKS = ['thanks', 'thank you', 'thank you so much', 'thanks a lot', 'gra
76
79
  const ACKNOWLEDGEMENTS = ['ok', 'okay', 'okey', 'está bien', 'esta bien', 'bueno', 'fine', "that's fine", 'alright', 'all right',
77
80
  'perfect', 'perfecto', 'sounds good', 'great', 'excelente', 'muy bien'].map(normalize).map((w) => w.split(' '));
78
81
  const CONFIRM_FILLER = CONFIRM_WORDS.map(normalize).map((w) => w.split(' '));
82
+ // At a soft question (a yes choice that does not charge or cancel), a word pointing at the offered thing may lead the YES:
83
+ // "ese está bien", "esa sí", "that one is fine". It is never a YES alone; a firm question stays strict.
84
+ const POINTERS = ['ese', 'esa', 'eso', 'esos', 'esas', 'ese es', 'esa es', 'that', 'this', 'that one', 'this one', 'that one is',
85
+ 'this one is', 'that is', 'this is'].map(normalize).map((w) => w.split(' '));
79
86
  // articles and possessives in front of an exact choice's own words ("Yes, the full balance", "Sí, el saldo completo")
80
87
  const ARTICLES = ['the', 'my', 'el', 'la', 'mi'].map((w) => [w]);
81
88
  const YES_SET = new Set(ANSWER_WORDS.yes.map(normalize));
@@ -176,6 +183,9 @@ function textRequest(input, words, extra) {
176
183
  * when `yesOk`, a YES word ("yes 1", "sí, 1"). Owner decision 2026-10-15: "Yes 1" at "tell me the product number" was
177
184
  * missed. Anything else around the key ("no 1", "1 or 2", "I paid 1 already") is not that key.
178
185
  */
186
+ // Words that name the key itself when said right before it: "el número 4", "opción 2", "number 4", "the 4" (prod
187
+ // 2026-10-25 18:25: "Número 4" and "El número 4" at a numbered product list were not understood, twice).
188
+ const KEY_NAMES = new Set(['number', 'numero', 'option', 'opcion', 'item', 'choice', 'the', 'el', 'la'].map(normalize));
179
189
  function keyWithOnlyCourtesy(b, key, yesOk) {
180
190
  const tk = String(b).replace(/\./g, ' ').split(' ').filter(Boolean);
181
191
  const at = tk.reduce((acc, t, i) => (t === key ? [...acc, i] : acc), []);
@@ -183,7 +193,10 @@ function keyWithOnlyCourtesy(b, key, yesOk) {
183
193
  return false;
184
194
  }
185
195
  else {
186
- const rest = tk.filter((t, i) => i !== at[0]).join(' ');
196
+ let from = at[0];
197
+ while (from > 0 && at[0] - from < 2 && KEY_NAMES.has(tk[from - 1]))
198
+ from--;
199
+ const rest = tk.filter((t, i) => i < from || i > at[0]).join(' ');
187
200
  return onlyAffirmative(rest, yesOk ? ANSWER_WORDS.yes : [], false);
188
201
  }
189
202
  }
@@ -409,7 +422,7 @@ export function pickChoice(answer, choices, acceptOther) {
409
422
  if (c.exact === true && /[?¿]/.test(raw)) {
410
423
  // not this choice
411
424
  }
412
- else if (strict.some(keyed) || onlyAffirmative(b, [...strict.filter((w) => !isKey(w)), ...(c.key === 'yes' && c.exact !== true ? THANKS : [])], true, c.exact === true ? (c.key === 'yes' ? ACKNOWLEDGEMENTS : [...ACKNOWLEDGEMENTS, ...CONFIRM_FILLER, ...ARTICLES]) : [])) {
425
+ else if (strict.some(keyed) || onlyAffirmative(b, [...strict.filter((w) => !isKey(w)), ...(c.key === 'yes' && c.exact !== true ? THANKS : [])], true, c.exact === true ? (c.key === 'yes' ? ACKNOWLEDGEMENTS : [...ACKNOWLEDGEMENTS, ...CONFIRM_FILLER, ...ARTICLES]) : (c.key === 'yes' ? POINTERS : []))) {
413
426
  found = c.key;
414
427
  break;
415
428
  }
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:32e5bd91d0c35d60c3126334ae4d931bd988af19be6acd7fcdb9023794e61840";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:ec8330acadcdcdf499278ebaacbd0f4ab3810a67be977d710ce77d40a8978a68";
@@ -1,3 +1,16 @@
1
+ ## 1.10.6: pointing at the offered thing
2
+
3
+ At a soft question (a yes choice that does not charge or cancel), a word pointing at the offered thing may lead the YES:
4
+ "ese está bien", "esa sí", "that one is fine" (prod 2026-10-25 17:46: "Ese está bien." to "¿Se lo envío a …?" was not a
5
+ yes and the caller lost the flow). "ese mismo", "el mismo", "that's the one" are soft YES phrases. A pointing word alone is
6
+ never a YES, and a firm question stays strict.
7
+
8
+ ## 1.10.5: a key named before it
9
+
10
+ At a numbered choice, a word naming the key said right before it picks the key: "el número 4", "opción 2", "number 4", "the
11
+ 4" (`keyWithOnlyCourtesy`; prod 2026-10-25 18:25, "Número 4" and "El número 4" at a numbered product list were not
12
+ understood, twice, and the caller lost the flow). A number anywhere else in a sentence is still not a key.
13
+
1
14
  ## 1.10.4: forms that must complete
2
15
 
3
16
  `must_complete:true` on a form or a field (a field inherits it from any enclosing form; `false` on a field opts out): an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.10.4",
3
+ "version": "1.10.6",
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",