jsfe 1.90.0 → 1.92.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.
@@ -279,7 +279,7 @@ export const FLOWS = [
279
279
  "id": "ac_late_code_check",
280
280
  "type": "SET",
281
281
  "variable": "ac_late",
282
- "value": "(function(t, c) { if (typeof form_context !== 'undefined' && form_context && form_context.form) { var fc=form_context, chain=formInputChain(cargo.forms,fc.form,cargo), read=readFormAnswer(t,chain,Array.isArray(fc.names)&&fc.names.length>1?{form:fc.form,names:fc.names}:{form:fc.form,name:fc.current},'',fc.questions||[]); if(read.hits.length || read.ambiguous.length || read.questions.length || (read.clarify || []).length) return false; } t = String(t || '').trim(); c = String(c || ''); if (c.length !== 6) { return false; } var rest = t.replace(/^(?:(?:el|mi|the|my)\\s+)?(?:c[oó]digo|code)(?:\\s+(?:es|is|era|was))?\\s*[:,.-]?\\s*/i, ''); if (!/^[\\d\\s.,-]+$/.test(rest)) { return false; } var d = rest.replace(/\\D/g, ''); return d.length >= 2 && d.length <= 6 && c.indexOf(d) >= 0; })(ac_answer, ac_code)"
282
+ "value": "(function(t, c) { if (typeof form_context !== 'undefined' && form_context && form_context.form) { var fc=form_context, chain=formInputChain(cargo.forms,fc.form,cargo), read=readFormAnswer(t,chain,Array.isArray(fc.names)&&fc.names.length>1?{form:fc.form,names:fc.names}:{form:fc.form,name:fc.current},'',fc.questions||[]); if(read.hits.length || read.ambiguous.length || read.questions.length || (read.clarify || []).length) return false; } t = String(t || '').trim(); c = String(c || ''); if (c.length !== 6) { return false; } var rest = t.replace(/^(?:(?:el|mi|the|my)\\s+)?(?:c[oó]digo|code)(?:\\s+(?:es|is|era|was))?\\s*[:,.-]?\\s*/i, ''); if (!numberAlone(rest)) { return false; } var d = rest.replace(/\\D/g, ''); return d.length >= 2 && d.length <= 6 && c.indexOf(d) >= 0; })(ac_answer, ac_code)"
283
283
  },
284
284
  {
285
285
  "id": "ac_late_code_reask",
@@ -486,7 +486,7 @@ const collectInput = {
486
486
  // short of the input's minimum the next question is "Go on." Anything that is not digits drops the partial. A complete
487
487
  // first answer is not joined: the reader reads it as typed (a card in groups is one number; a card then its security
488
488
  // code is two, matchInputs numericSplit; owner 2026-11-20).
489
- SET('ci_partial_join', 'ci_partial', "(function () { var state = cargo.forms[form]; if (!ci_spec || ci_spec.accumulate !== true || !ci_spec.digits) return ''; var said = String(cargo.choiceText || '').trim(); var data = state.data = state.data || {}; var key = '__partial_' + current; if (!/^[0-9][0-9\\s.,-]*$/.test(said)) { delete data[key]; return ''; } var joined = String(data[key] || '') + said.replace(/[^0-9]/g, ''); var starts = ci_spec.accumulate_first ? new RegExp(ci_spec.accumulate_first) : null; if (!data[key] && starts && !starts.test(joined)) return ''; if (joined.length < Number(ci_spec.digits.min || 0)) { data[key] = joined; var fb = state.feedback || {}; fb[current] = 'partial'; state.feedback = fb; return 'hold'; } if (!data[key]) return ''; delete data[key]; cargo.choiceText = joined; cargo.choice = joined; return 'joined'; })()"),
489
+ SET('ci_partial_join', 'ci_partial', "(function () { var state = cargo.forms[form]; if (!ci_spec || ci_spec.accumulate !== true || !ci_spec.digits) return ''; var said = String(cargo.choiceText || '').trim(); var data = state.data = state.data || {}; var key = '__partial_' + current; var digits = numberAlone(said); if (!digits) { delete data[key]; return ''; } var joined = String(data[key] || '') + digits; var starts = ci_spec.accumulate_first ? new RegExp(ci_spec.accumulate_first) : null; if (!data[key] && starts && !starts.test(joined)) return ''; if (joined.length < Number(ci_spec.digits.min || 0)) { data[key] = joined; var fb = state.feedback || {}; fb[current] = 'partial'; state.feedback = fb; return 'hold'; } if (!data[key]) return ''; delete data[key]; cargo.choiceText = joined; cargo.choice = joined; return 'joined'; })()"),
490
490
  // An email at a known provider said without its ending ("Cecilia 41, at Yahoo."): it is kept and the caller is asked
491
491
  // only what comes after the provider; an ending alone on the next turn completes it, any other reply drops it
492
492
  // (owner 2026-11-18, prod 11-18 17:30). An unknown domain is never guessed: the address is asked again.
@@ -61,6 +61,13 @@ export function isReaderFiller(text: any, templateWords?: any[]): any;
61
61
  * whole answer is an agent request and EXIT only on exit/quit/salir/abort (cancel is an answer there).
62
62
  */
63
63
  export function pickChoice(answer: any, choices: any, acceptOther: any): any;
64
+ /**
65
+ * pickChoice for a flow's own word reader, tight (owner 2026-11-24: a word inside a sentence never decides; the reply ranker
66
+ * does). A choice's phrase picks only when the rest of the answer is courtesy, connecting words, numbers or `templateWords`
67
+ * (isReaderFiller, the rule of profile.whole_phrases); otherwise ''. Keys, YES words and agent/exit picks are pickChoice's
68
+ * (already whole-answer). "where is my order, please" picks; "it says delivered but I never got it" does not.
69
+ */
70
+ export function pickWholeChoice(answer: any, choices: any, templateWords?: any[]): any;
64
71
  export namespace ANSWER_WORDS {
65
72
  let yes: string[];
66
73
  let no: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AA0NA;;;GAGG;AACH,wEAkBC;AAED,qHAAqH;AACrH,+CAGC;AAED;;;;GAIG;AACH,mDAIC;AAED;;;;GAIG;AACH,kDAIC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AAuBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAqCC;AAqBD,oEAqBC;AASD,gJAAgJ;AAChJ,sEAGC;AAED;;;;;;;;;GASG;AACH,6EA4GC;;;;;;;;AA/gBD,qCAKwE"}
1
+ {"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AA0NA;;;GAGG;AACH,wEAkBC;AAED,qHAAqH;AACrH,+CAGC;AAED;;;;GAIG;AACH,mDAIC;AAED;;;;GAIG;AACH,kDAIC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AAuBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAqCC;AAqBD,oEAqBC;AASD,gJAAgJ;AAChJ,sEAGC;AAED;;;;;;;;;GASG;AACH,6EA4GC;AAED;;;;;GAKG;AACH,uFAeC;;;;;;;;AAtiBD,qCAKwE"}
@@ -599,3 +599,27 @@ export function pickChoice(answer, choices, acceptOther) {
599
599
  return '';
600
600
  }
601
601
  }
602
+ /**
603
+ * pickChoice for a flow's own word reader, tight (owner 2026-11-24: a word inside a sentence never decides; the reply ranker
604
+ * does). A choice's phrase picks only when the rest of the answer is courtesy, connecting words, numbers or `templateWords`
605
+ * (isReaderFiller, the rule of profile.whole_phrases); otherwise ''. Keys, YES words and agent/exit picks are pickChoice's
606
+ * (already whole-answer). "where is my order, please" picks; "it says delivered but I never got it" does not.
607
+ */
608
+ export function pickWholeChoice(answer, choices, templateWords = []) {
609
+ const key = pickChoice(answer, choices, false);
610
+ const choice = (Array.isArray(choices) ? choices : []).find((c) => c && c.key === key);
611
+ if (!key || !choice) {
612
+ return key;
613
+ }
614
+ else {
615
+ const plain = (x) => ' ' + normalize(String(x ?? '').replace(/[^\p{L}\p{N}'\s]/gu, ' ')).replace(/\s+/g, ' ').trim() + ' ';
616
+ const said = plain(answer);
617
+ const hit = (choice.phrases ?? choice.words ?? []).map(plain).filter((p) => p.trim() && said.includes(p)).sort((a, b) => b.length - a.length)[0];
618
+ if (!hit) {
619
+ return key; // a key, a YES word or a spoken key: pickChoice reads those only as the whole answer
620
+ }
621
+ else {
622
+ return isReaderFiller(said.replace(hit, ' '), templateWords) ? key : '';
623
+ }
624
+ }
625
+ }
@@ -3,7 +3,7 @@ export function sharedSandbox(): any;
3
3
  export const EXPRESSION_LIMITS: Readonly<{
4
4
  memoryBytes: number;
5
5
  stackBytes: number;
6
- timeoutMs: 500;
6
+ steps: 1000;
7
7
  }>;
8
8
  export class ExpressionSandbox {
9
9
  constructor(limits?: {});
@@ -14,8 +14,8 @@ export class ExpressionSandbox {
14
14
  compiled: Map<any, any>;
15
15
  released: boolean;
16
16
  };
17
- timeoutMs: 500;
18
- deadline: number;
17
+ stepLimit: 1000;
18
+ steps: number;
19
19
  depth: number;
20
20
  generation: number;
21
21
  owned: any[];
@@ -44,7 +44,7 @@ export class ExpressionSandbox {
44
44
  callback(index: any): (...args: any[]) => any;
45
45
  /** Calls a sandbox function with host arguments, inside the current evaluation. */
46
46
  call(f: any, args: any): any;
47
- /** One evaluation: a deadline, a fresh object table, every handle released at the end. */
47
+ /** One evaluation: a step budget, a fresh object table, every handle released at the end. */
48
48
  scope(run: any, approved: any): any;
49
49
  compile(source: any): any;
50
50
  hostGet(idH: any, kH: any): any;
@@ -1 +1 @@
1
- {"version":3,"file":"expression-sandbox.d.ts","sourceRoot":"","sources":["../../src/helpers/expression-sandbox.js"],"names":[],"mappings":"AA6dA,4FAA4F;AAC5F,qCAA8E;AArc9E;;;;GAA0H;AA4K1H;IACG,yBAuCC;IAjCE;;;;;;MAAc;IACd,eAA0B;IAC1B,iBAAiB;IACjB,cAAc;IACd,mBAAmB;IACnB,aAAe;IACf,cAAoB;IACpB,gBAAkB;IAAE,yBAA0B;IAC9C,YAAc;IAAE,qBAAsB;IACtC,iCAA+B;IAC/B,8BAA+B;IAK/B,SAAc;IAcd,SAAoB;IAMvB,kFAAkF;IAClF,gBAA4D;IAE5D,sCAOC;IAED,iBAAwC;IAExC,kFAAkF;IAClF,6BAGC;IAGD,iBAsBC;IAED,kEAAkE;IAClE,qBAIC;IAGD,iBAmBC;IAED,8BASC;IAED,qBAGC;IAED,iFAAiF;IACjF,uBAEW,GAAG,WAAI,SAKjB;IAED,mFAAmF;IACnF,6BAQC;IAED,0FAA0F;IAC1F,oCAuBC;IAED,0BAYC;IAGD,gCAGC;IACD,yCAKC;IACD,gCAAkI;IAClI,gCAAiI;IACjI,wBAA+G;IAC/G,gCAKC;IACD,oDAYC;IAGD,wHAAwH;IACxH,gFAYC;IAED;wHACoH;IACpH;;;;;YA+BC;CACH"}
1
+ {"version":3,"file":"expression-sandbox.d.ts","sourceRoot":"","sources":["../../src/helpers/expression-sandbox.js"],"names":[],"mappings":"AAkeA,4FAA4F;AAC5F,qCAA8E;AArc9E;;;;GAAuH;AA4KvH;IACG,yBAuCC;IAjCE;;;;;;MAAc;IACd,gBAAsB;IACtB,cAAe;IACf,cAAc;IACd,mBAAmB;IACnB,aAAe;IACf,cAAoB;IACpB,gBAAkB;IAAE,yBAA0B;IAC9C,YAAc;IAAE,qBAAsB;IACtC,iCAA+B;IAC/B,8BAA+B;IAK/B,SAAc;IAcd,SAAoB;IAMvB,kFAAkF;IAClF,gBAA4D;IAE5D,sCAOC;IAED,iBAAwC;IAExC,kFAAkF;IAClF,6BAGC;IAGD,iBAsBC;IAED,kEAAkE;IAClE,qBAIC;IAGD,iBAmBC;IAED,8BASC;IAED,qBAGC;IAED,iFAAiF;IACjF,uBAEW,GAAG,WAAI,SAKjB;IAED,mFAAmF;IACnF,6BAQC;IAED,6FAA6F;IAC7F,oCAuBC;IAED,0BAYC;IAGD,gCAGC;IACD,yCAKC;IACD,gCAAkI;IAClI,gCAAiI;IACjI,wBAA+G;IAC/G,gCAKC;IACD,oDAYC;IAGD,wHAAwH;IACxH,gFAYC;IAED;wHACoH;IACpH;;;;;YA+BC;CACH"}
@@ -21,7 +21,12 @@ const UNDEF = MARK + 'u', ABSENT = MARK + 'a';
21
21
  const BUILTINS = new Set(['Object', 'Date', 'Math', 'String', 'Number', 'Boolean', 'Array', 'JSON']);
22
22
  const identifier = /^[A-Za-z_$][\w$]*$/;
23
23
  const COMPILED_CACHE = 1000;
24
- export const EXPRESSION_LIMITS = Object.freeze({ memoryBytes: 256 * 1024 * 1024, stackBytes: 1024 * 1024, timeoutMs: 500 });
24
+ // steps: the interrupt handler's calls in one evaluation, which QuickJS makes at a fixed count of executed bytecode, so the
25
+ // limit is the expression's own work: the same verdict on any machine, under any load, and a trusted helper the expression
26
+ // calls (readFormAnswer, matchInputs) is not counted. Measured 2026-11-24 over 7.29 M evaluations (all AIDevelopment flow
27
+ // suites and jsfe's): at most 6 steps, 99.99% at 3 or fewer; a runaway loop makes 1.7-30 steps per ms, so 1,000 stops one
28
+ // within ~30-600 ms.
29
+ export const EXPRESSION_LIMITS = Object.freeze({ memoryBytes: 256 * 1024 * 1024, stackBytes: 1024 * 1024, steps: 1000 });
25
30
  // Guest runtime. The host functions it is given are captured and removed from the global object before anything else
26
31
  // runs; its API is the script's completion value, never a global.
27
32
  const GUEST = String.raw `(function () {
@@ -196,14 +201,14 @@ const guestError = (ctx, handle) => {
196
201
  };
197
202
  export class ExpressionSandbox {
198
203
  constructor(limits = {}) {
199
- const { memoryBytes, stackBytes, timeoutMs } = { ...EXPRESSION_LIMITS, ...limits };
204
+ const { memoryBytes, stackBytes, steps } = { ...EXPRESSION_LIMITS, ...limits };
200
205
  const rt = QuickJS.newRuntime();
201
206
  rt.setMemoryLimit(memoryBytes);
202
207
  rt.setMaxStackSize(stackBytes);
203
208
  const res = { rt, ctx: null, handles: [], compiled: new Map(), released: false };
204
209
  this.res = res;
205
- this.timeoutMs = timeoutMs;
206
- this.deadline = 0;
210
+ this.stepLimit = steps;
211
+ this.steps = -1; // -1 outside an evaluation: nothing is counted or interrupted
207
212
  this.depth = 0;
208
213
  this.generation = 0;
209
214
  this.owned = [];
@@ -215,7 +220,16 @@ export class ExpressionSandbox {
215
220
  this.namespaces = new WeakMap(); // a named-function namespace -> its guest object
216
221
  this.namespaceCache = new Map(); // compiled once per source (see defineNamespace)
217
222
  const self = new WeakRef(this);
218
- rt.setInterruptHandler(() => { const s = self.deref(); return !s || (s.deadline !== 0 && Date.now() > s.deadline); });
223
+ rt.setInterruptHandler(() => { const s = self.deref(); if (!s) {
224
+ return true;
225
+ }
226
+ else if (s.steps < 0) {
227
+ return false;
228
+ }
229
+ else {
230
+ s.steps++;
231
+ return s.steps > s.stepLimit;
232
+ } });
219
233
  const ctx = rt.newContext();
220
234
  res.ctx = ctx;
221
235
  this.ctx = ctx;
@@ -390,7 +404,7 @@ export class ExpressionSandbox {
390
404
  const encoded = this.own(this.guest('enc', r.value));
391
405
  return this.inn(JSON.parse(this.ctx.getString(encoded)));
392
406
  }
393
- /** One evaluation: a deadline, a fresh object table, every handle released at the end. */
407
+ /** One evaluation: a step budget, a fresh object table, every handle released at the end. */
394
408
  scope(run, approved) {
395
409
  const outer = this.depth === 0;
396
410
  const previousApproved = this.approved;
@@ -400,7 +414,7 @@ export class ExpressionSandbox {
400
414
  if (this.res.released)
401
415
  throw new Error('expression sandbox released');
402
416
  this.generation++;
403
- this.deadline = Date.now() + this.timeoutMs;
417
+ this.steps = 0;
404
418
  }
405
419
  this.depth++;
406
420
  try {
@@ -410,7 +424,7 @@ export class ExpressionSandbox {
410
424
  this.depth--;
411
425
  this.approved = previousApproved;
412
426
  if (outer) {
413
- this.deadline = 0;
427
+ this.steps = -1;
414
428
  for (const h of this.owned)
415
429
  if (h.alive)
416
430
  h.dispose();
@@ -52,6 +52,7 @@ export namespace STANDARD_FUNCTIONS {
52
52
  export { isAmountAnswer };
53
53
  export { amountInAnswer };
54
54
  export { pickChoice };
55
+ export { pickWholeChoice };
55
56
  export { withoutPromptEcho };
56
57
  export { readEmail };
57
58
  export { emailWithoutEnding };
@@ -145,6 +146,7 @@ export namespace STANDARD_FUNCTIONS {
145
146
  export { textWithUrlToSpeech };
146
147
  export { joinSpokenDigits };
147
148
  export { wholeSpokenNumber };
149
+ export { numberAlone };
148
150
  export { registerSendable };
149
151
  export { sendables };
150
152
  export { chatTranscript };
@@ -205,6 +207,7 @@ import { isSpelledFragment } from './answer.js';
205
207
  import { isAmountAnswer } from './answer.js';
206
208
  import { amountInAnswer } from './answer.js';
207
209
  import { pickChoice } from './answer.js';
210
+ import { pickWholeChoice } from './answer.js';
208
211
  import { withoutPromptEcho } from './answer.js';
209
212
  import { readEmail } from './contact.js';
210
213
  import { emailWithoutEnding } from './contact.js';
@@ -303,10 +306,11 @@ import { textWithUrlToSpeech } from './url-speech.js';
303
306
  import { joinSpokenDigits } from './spoken-digits.js';
304
307
  import { spokenDigitsText } from './spoken-digits.js';
305
308
  import { wholeSpokenNumber } from './spoken-digits.js';
309
+ import { numberAlone } from './spoken-digits.js';
306
310
  import { registerSendable } from './sendables.js';
307
311
  import { sendables } from './sendables.js';
308
312
  import { chatTranscript } from './sendables.js';
309
313
  import { conversationCopy } from './sendables.js';
310
314
  import { CONVERSATION_KEY } from './sendables.js';
311
- export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY };
315
+ export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY };
312
316
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B;8BAAjB,iBAAiB;wCAAjB,iBAAiB;mCAAjB,iBAAiB;qCAAjB,iBAAiB;mCAAjB,iBAAiB;oCAAjB,iBAAiB;iCAAjB,iBAAiB;kCAAjB,iBAAiB;yBACzqB,gBAAgB;yBAAhB,gBAAgB;gCAAhB,gBAAgB;4BAAhB,gBAAgB;8BAAhB,gBAAgB;+BACnC,iBAAiB;8BAAjB,iBAAiB;8BAAjB,iBAAiB;4BAI7B,iBAAiB;oCAAjB,iBAAiB;iCAHiB,oBAAoB;iCAApB,oBAAoB;kCAApB,oBAAoB;4BAApB,oBAAoB;iCA9BP,gBAAgB;0BAAhB,gBAAgB;+BAAhB,gBAAgB;iCAAhB,gBAAgB;iCAAhB,gBAAgB"}
@@ -24,7 +24,7 @@ import { consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFo
24
24
  import { sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion } from './form-sources.js';
25
25
  import { matchesChoice } from './matches-choice.js';
26
26
  import { readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions } from './money.js';
27
- import { ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho } from './answer.js';
27
+ import { ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho } from './answer.js';
28
28
  import { readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational } from './contact.js';
29
29
  import { normalizeAndFindCapture } from './capture.js';
30
30
  import { anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb } from './phrases.js';
@@ -35,19 +35,19 @@ import { matchInputs, readFormAnswer, readArgument, groundAmount, saysConfirmWor
35
35
  import { resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance } from './form-state.js';
36
36
  import { checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS } from './otp-check.js';
37
37
  import { validateDigits, validatePhone, validateEmail } from './validators.js';
38
- import { joinSpokenDigits, spokenDigitsText, wholeSpokenNumber } from './spoken-digits.js';
38
+ import { joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone } from './spoken-digits.js';
39
39
  import { findNumbers, assignNumbers, joinSpokenNumbers } from './numbers.js';
40
40
  import { addressDraft } from './address.js';
41
41
  import { urlToSpeech, textWithUrlToSpeech } from './url-speech.js';
42
- export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY, };
42
+ export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY, };
43
43
  /** The functions flows call by name, ready to spread into a host's approved functions. */
44
44
  export const STANDARD_FUNCTIONS = {
45
45
  continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse,
46
46
  formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor,
47
47
  clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome,
48
- readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho,
48
+ readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho,
49
49
  readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
50
50
  normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance,
51
- validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, wholeSpokenNumber,
51
+ validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, wholeSpokenNumber, numberAlone,
52
52
  registerSendable, sendables, chatTranscript, conversationCopy,
53
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,sEAQC;AA4ED;;;GAGG;AACH,sFAiIC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;mHACmH;AAEnH,iEAEC;AAID,gGAQC;AAYD,kDAGC;AAED;;;;;;;GAOG;AACH;;;;SAcC;AACD;;;;;GAKG;AACH;;;;;;;;;;;;;;;;;;;;;;EAaC;AACD;;;;;;;;;;;;;;;;;;;;;;EAeC;AAyDD;;;;;;;;;;;;;;;;;;;;;;;EAiZC"}
1
+ {"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,sEAQC;AA4ED;;;GAGG;AACH,sFAuIC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;mHACmH;AAEnH,iEAEC;AAID,gGAQC;AAYD,kDAGC;AAED;;;;;;;GAOG;AACH;;;;SAcC;AACD;;;;;GAKG;AACH;;;;;;;;;;;;;;;;;;;;;;EAaC;AACD;;;;;;;;;;;;;;;;;;;;;;EAeC;AAyDD;;;;;;;;;;;;;;;;;;;;;;;EAiZC"}
@@ -8,13 +8,13 @@
8
8
  * Tenant-agnostic shape reading only (the same class as pickChoice / readIdentifier). Conversation behaviour stays in
9
9
  * the flows. Part of jsfe/helpers; imports only siblings.
10
10
  */
11
- import { matchesChoice } from './matches-choice.js';
11
+ import { matchesChoice, answerCore } from './matches-choice.js';
12
12
  import { pickChoice, amountInAnswer, isAmountAnswer, isReaderFiller, ANSWER_WORDS, CONFIRM_WORDS } from './answer.js';
13
13
  import { readEmail, readPhone, readInternationalPhone, readIdentifier, emailSpans } from './contact.js';
14
14
  import { readSpokenMoney } from './spoken-money.js';
15
15
  import { readMoneyAmount, isPartialMoneyAnswer } from './money.js';
16
16
  import { pickProviderQuestion } from './form-sources.js';
17
- import { spokenDigitsText, wholeSpokenNumber } from './spoken-digits.js';
17
+ import { spokenDigitsText, wholeSpokenNumber, numberAlone } from './spoken-digits.js';
18
18
  import { DIGIT_RUN, findNumbers, assignNumbers, NUMBER_KINDS, presetValid } from './numbers.js';
19
19
  import { expirationDigits, validateExpiration } from './card-checks.js';
20
20
  /**
@@ -226,8 +226,8 @@ export function readInputProfile(profile, answer, isCurrent = true) {
226
226
  let fits = [...new Set(digitRuns(source).filter((d) => d.length >= min && d.length <= max))];
227
227
  // At its own question, an answer of digits and separators alone is one number when its length fits ("4111, 1111,
228
228
  // 1111, 1111": a card read in groups of four).
229
- const whole = source.replace(/\D/g, '');
230
- if (!fits.length && isCurrent && /^[\d\s.,-]+$/.test(source.trim()) && whole.length >= min && whole.length <= max) {
229
+ const whole = numberAlone(source);
230
+ if (!fits.length && isCurrent && whole && whole.length >= min && whole.length <= max) {
231
231
  fits = [whole];
232
232
  }
233
233
  else { /* read by runs */ }
@@ -239,8 +239,13 @@ export function readInputProfile(profile, answer, isCurrent = true) {
239
239
  }
240
240
  }
241
241
  else if (kind === 'pattern') {
242
+ // The pattern reads the answer without punctuation at its edges, as speech-to-text adds it ("3 noches.", "¿3 noches?");
243
+ // profile.raw_answer: true reads the answer as given (free text whose value is the caller's whole sentence).
242
244
  // spoken_digits: the pattern reads a number said in pieces as one number ("5 0 9 Lazy Lane", "apt 2 0 4").
243
- const said = profile.spoken_digits ? spokenDigitsText(raw, profile.spoken_digits) : { text: raw, at: (i) => i };
245
+ const core = profile.raw_answer === true ? { text: raw, start: 0 } : answerCore(raw);
246
+ const spoken = (text) => (profile.spoken_digits ? spokenDigitsText(text, profile.spoken_digits) : { text, at: (i) => i });
247
+ const inner = spoken(core.text);
248
+ const said = { text: inner.text, at: (i) => core.start + inner.at(i) };
244
249
  let m = null;
245
250
  try {
246
251
  m = new RegExp(profile.regex, profile.flags || 'i').exec(said.text);
@@ -254,7 +259,8 @@ export function readInputProfile(profile, answer, isCurrent = true) {
254
259
  return { value: v, spans: [[said.at(start), said.at(start + v.length - 1) + 1]], evidence: [`p:${String(v).toLowerCase()}`] };
255
260
  }
256
261
  else {
257
- return isCurrent && profile.accept_other === true && raw.trim() ? { value: said.text.trim(), fallback: true, spans: [[0, raw.length]] } : null;
262
+ // accept_other keeps the answer as given, as before
263
+ return isCurrent && profile.accept_other === true && raw.trim() ? { value: spoken(raw).text.trim(), fallback: true, spans: [[0, raw.length]] } : null;
258
264
  }
259
265
  }
260
266
  else if (kind === 'text') {
@@ -418,7 +424,7 @@ function digitsSpan(raw, value, from) {
418
424
  // asked input a complete value beside at least one other input and consumes every digit; otherwise null and the answer reads
419
425
  // as before (a card said in groups, a card spoken over two turns, a lone ZIP). → {name: {value, spans}} | null
420
426
  function numericSplit(raw, list, own) {
421
- if (!own || own.profile.kind !== 'digits' || !/^[\d\s.,-]+[.!]?$/.test(raw.trim()))
427
+ if (!own || own.profile.kind !== 'digits' || !numberAlone(raw))
422
428
  return null;
423
429
  const numeric = list.filter((c) => c.form === own.form && !c.confirmation && (NUMBER_KINDS.includes(c.field) || c.profile.kind === 'digits'));
424
430
  if (numeric.length < 2)
@@ -561,7 +567,7 @@ export function matchInputs(answer, candidates, current, choiceKey) {
561
567
  // A choice is excluded (a digit it does not offer reaches the invited amount, rule 4), and so is an amount.
562
568
  const bareDigits = raw.replace(/\D/g, '');
563
569
  const shapeOf = own && own.digits && !['choice', 'amount', 'text'].includes(own.profile.kind) ? own.digits : null;
564
- if (shapeOf && bareDigits && /^[\d\s.,/-]+$/.test(raw.trim()) && !isAmountAnswer(raw) && bareDigits.length >= Number(shapeOf.min || 1) && bareDigits.length <= Number(shapeOf.max || shapeOf.min || 1)
570
+ if (shapeOf && bareDigits && numberAlone(raw, { slash: true }) && !isAmountAnswer(raw) && bareDigits.length >= Number(shapeOf.min || 1) && bareDigits.length <= Number(shapeOf.max || shapeOf.min || 1)
565
571
  && !readings.some((reading) => reading.current || invited(reading))) {
566
572
  readings.push({ form: own.form, name: own.name, value: bareDigits, ...(own.validator ? {} : { invalid: true }), known: false, repeatedChoice: false, wholeChoice: false, choice: false, narrative: false, resetOn: [], spans: [[0, raw.length]], keypad: false, fallback: false,
567
573
  group: own.group, exclusive: own.exclusive === true, level: forms.indexOf(own.scope || own.form), current: true, confirm: Array.isArray(own.confirm_against) ? own.confirm_against : [] });
@@ -1,26 +1,12 @@
1
1
  /**
2
- * Strict word-aware option matching for flow CASE conditions (APPROVED_FUNCTIONS.matchesChoice) —
3
- * replaces the substring `.some(choice => input.includes(choice))` idiom, whose false positives broke
4
- * branch routing ('si' inside "imposible"/"así" matched YES, prod-observed 2026-08-09).
5
- *
6
- * Rules (deliberately NO fuzzy/prefix matching):
7
- * - single-word choice: exact word membership
8
- * - multi-word choice: exact word-sequence containment
9
- * - plurals/inflections: enumerate them explicitly in the choice list
10
- * - a keypad key (one digit, * or #) matches ONLY an answer that is exactly that key, never a key
11
- * inside a longer answer (owner rule): "I made payments by 1," at "press 1 to pay" charged the full
12
- * amount due on dev, 2026-10-14
13
- * - an ELONGATED word the user typed is forgiven (2026-10-01): a repeated vowel or any letter typed
14
- * 3+ times collapses — "Sii" matches 'si', "nadaaaa" 'nada', "yesss" 'yes'. A typed "Sii" at the
15
- * authentication retry menu ended the conversation in contact-support. Only the user's word is
16
- * collapsed, and only against an option word with no doubled letter of its own. Measured on a
17
- * week of prod prompts (scratch replay, 98 option lists × 23,692 prompts):
18
- * · collapsing BOTH sides: rejected — 'all' → 'al' made "servicio al cliente" (138 turns) pick
19
- * the "all" option, and 'mm' → 'm' made "I'm" a filler;
20
- * · collapsing every doubled letter of the user's word: rejected — "mess" matched Spanish
21
- * 'mes' and "Mall" 'mal'. A doubled consonant is real spelling, so "okk" stays unmatched.
22
- *
23
- * Zero imports, so scripts/tests/matches-choice.mjs runs the real implementation.
2
+ * The answer without punctuation at its edges, and where that core starts in the answer: {text, start}.
3
+ * questions: true also removes ? and ¿ (matchesChoice's keypad keys, as before: "1?" is the key 1).
24
4
  */
5
+ export function answerCore(input: any, { questions }?: {
6
+ questions?: boolean | undefined;
7
+ }): {
8
+ text: string;
9
+ start: number;
10
+ };
25
11
  export function matchesChoice(input: any, choices: any): boolean;
26
12
  //# sourceMappingURL=matches-choice.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"matches-choice.d.ts","sourceRoot":"","sources":["../../src/helpers/matches-choice.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,iEAiCC"}
1
+ {"version":3,"file":"matches-choice.d.ts","sourceRoot":"","sources":["../../src/helpers/matches-choice.js"],"names":[],"mappings":"AA8BA;;;GAGG;AACH;;;;;EAIC;AAED,iEAiCC"}
@@ -22,6 +22,20 @@
22
22
  *
23
23
  * Zero imports, so scripts/tests/matches-choice.mjs runs the real implementation.
24
24
  */
25
+ // Punctuation and spaces at an answer's edges, as speech-to-text adds them ("3 noches.", "California,"). A question mark
26
+ // stays: a question is not an answer ("¿No es en diciembre?" at the return date). Quotes stay: a quoted command is not
27
+ // the caller's own (speech-to-text adds none).
28
+ const ANSWER_EDGES = /^[\s.,;:!¡]+|[\s.,;:!¡]+$/g;
29
+ const ANSWER_EDGES_AND_QUESTION = /^[\s.,;:!?¿¡'"]+|[\s.,;:!?¿¡'"]+$/g;
30
+ /**
31
+ * The answer without punctuation at its edges, and where that core starts in the answer: {text, start}.
32
+ * questions: true also removes ? and ¿ (matchesChoice's keypad keys, as before: "1?" is the key 1).
33
+ */
34
+ export function answerCore(input, { questions = false } = {}) {
35
+ const raw = String(input ?? '');
36
+ const text = raw.replace(questions ? ANSWER_EDGES_AND_QUESTION : ANSWER_EDGES, '');
37
+ return { text, start: text ? raw.indexOf(text) : 0 };
38
+ }
25
39
  export function matchesChoice(input, choices) {
26
40
  if (!input || !Array.isArray(choices)) {
27
41
  return false;
@@ -40,7 +54,7 @@ export function matchesChoice(input, choices) {
40
54
  return choices.some(choice => {
41
55
  const choiceWords = tokenize(choice);
42
56
  if (/^[0-9*#]$/.test(String(choice).trim())) {
43
- return String(input).replace(/^[\s.,;:!?¿¡'"]+|[\s.,;:!?¿¡'"]+$/g, '') === String(choice).trim();
57
+ return answerCore(input, { questions: true }).text === String(choice).trim();
44
58
  }
45
59
  else if (choiceWords.length === 0) {
46
60
  return false;
@@ -6,7 +6,16 @@ export function spokenDigitsText(input: any, mode?: boolean): {
6
6
  export function joinSpokenDigits(input: any, mode?: boolean): string;
7
7
  /**
8
8
  * A whole answer that is one number said digit by digit reads as that number: "6 5 4 6", "6, 5, 4, 6.", "6-5-4-6", "6. 5. 4. 6.".
9
- * Anything else comes back as it was. A period with no space after it stays a decimal point ("4.5").
9
+ * Punctuation at its edges aside (answerCore). Anything else comes back as it was. A period with no space after it stays a
10
+ * decimal point ("4.5").
10
11
  */
11
12
  export function wholeSpokenNumber(input: any): string;
13
+ /**
14
+ * The one test of "this answer is a number alone" (owner 2026-11-24): digits and the separators speech-to-text puts between
15
+ * them (spaces, . , -; with slash: true also /, as in "07/29"), punctuation at the answer's edges aside (answerCore: "4111,
16
+ * 1111, 1111, 1111.", "799604!"). A question mark is not an edge: "1234?" is not a number alone. → its digits, or ''.
17
+ */
18
+ export function numberAlone(input: any, { slash }?: {
19
+ slash?: boolean | undefined;
20
+ }): string;
12
21
  //# sourceMappingURL=spoken-digits.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spoken-digits.d.ts","sourceRoot":"","sources":["../../src/helpers/spoken-digits.js"],"names":[],"mappings":"AAoBA,mHAAmH;AACnH;;;EAyBC;AAED,qEAEC;AAED;;;GAGG;AACH,sDAGC"}
1
+ {"version":3,"file":"spoken-digits.d.ts","sourceRoot":"","sources":["../../src/helpers/spoken-digits.js"],"names":[],"mappings":"AAsBA,mHAAmH;AACnH;;;EAyBC;AAED,qEAEC;AAED;;;;GAIG;AACH,sDAIC;AAED;;;;GAIG;AACH;;WAGC"}
@@ -4,8 +4,9 @@
4
4
  * A dash joins only single digits: "12-34 Main St" is a hyphenated house number, not a pause.
5
5
  *
6
6
  * mode true: any run of groups of up to three digits. mode 'house_number': the first group has at most two digits,
7
- * because "509 12 Ave" is a house number and a numbered street. Part of jsfe/helpers; zero imports.
7
+ * because "509 12 Ave" is a house number and a numbered street. Part of jsfe/helpers.
8
8
  */
9
+ import { answerCore } from './matches-choice.js';
9
10
  const RUN = /(?<![\w.,-])\d{1,3}(?:(?:[ \t]+|,\s*|\.\s+|-)\d{1,3})+(?![\w-])/g;
10
11
  const joins = (run, mode) => {
11
12
  const groups = run.split(/\D+/);
@@ -59,9 +60,20 @@ export function joinSpokenDigits(input, mode = true) {
59
60
  }
60
61
  /**
61
62
  * A whole answer that is one number said digit by digit reads as that number: "6 5 4 6", "6, 5, 4, 6.", "6-5-4-6", "6. 5. 4. 6.".
62
- * Anything else comes back as it was. A period with no space after it stays a decimal point ("4.5").
63
+ * Punctuation at its edges aside (answerCore). Anything else comes back as it was. A period with no space after it stays a
64
+ * decimal point ("4.5").
63
65
  */
64
66
  export function wholeSpokenNumber(input) {
65
67
  const text = String(input ?? '');
66
- return /^\s*\d(?:(?:\s+|,\s*|-|\.\s+)\d)+[\s.]*$/.test(text) ? text.replace(/\D/g, '') : text;
68
+ const core = answerCore(text).text;
69
+ return /^\d(?:(?:\s+|,\s*|-|\.\s+)\d)+$/.test(core) ? core.replace(/\D/g, '') : text;
70
+ }
71
+ /**
72
+ * The one test of "this answer is a number alone" (owner 2026-11-24): digits and the separators speech-to-text puts between
73
+ * them (spaces, . , -; with slash: true also /, as in "07/29"), punctuation at the answer's edges aside (answerCore: "4111,
74
+ * 1111, 1111, 1111.", "799604!"). A question mark is not an edge: "1234?" is not a number alone. → its digits, or ''.
75
+ */
76
+ export function numberAlone(input, { slash = false } = {}) {
77
+ const core = answerCore(input).text;
78
+ return (slash ? /^[\d\s.,\/-]*\d[\d\s.,\/-]*$/ : /^[\d\s.,-]*\d[\d\s.,-]*$/).test(core) ? core.replace(/\D/g, '') : '';
67
79
  }
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:2da4505cfef524d9ab9a5b9975111726f6885c8f7ef6fb63130ccd3abc6d6b5d";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:0476062be5f39ae4a8e4509c87fa8381d08105852a61d92c5f72889a76bb18b6";
@@ -199,7 +199,7 @@ Profiles:
199
199
  | `choice` | `choices:[{key,phrases,label?,label_es?,keys?,exact?,neutral?,negative?,current_only?}]`; optional `accept_other` (with `other_needs_letter`: other text only with a letter, such as a city; with `other_needs_digit`: only with a digit, such as an account number, so a word that is no choice goes to the reply ranker), `numeric_values`, `narrative`, `whole_phrases`, `template_words`. |
200
200
  | `digits` | `min`, `max`: one unambiguous digit run of that length. |
201
201
  | `identifier` | `pattern`: permitted account identifier shape. |
202
- | `pattern` | `regex`, optional `flags`, `group`; optional `accept_other` for the current field only, `whole_phrases`, `template_words`; `spoken_digits` (`true`, or `'house_number'` when a numbered street can follow) reads a number said in pieces as one number ("5 0 9 Lazy Lane", "apt 2 0 4"), required on any pattern that reads digits. |
202
+ | `pattern` | `regex`, optional `flags`, `group`; optional `accept_other` for the current field only, `whole_phrases`, `template_words`; `spoken_digits` (`true`, or `'house_number'` when a numbered street can follow) reads a number said in pieces as one number ("5 0 9 Lazy Lane", "apt 2 0 4"), required on any pattern that reads digits. The regex reads the answer without spaces and `. , ; : ! ¡` at its edges ("3 noches." reads as "3 noches"); `?`, `¿` and quotes stay: a question is not an answer, and a quoted command is not the caller's own. `raw_answer: true` reads the answer as given, for free text whose value is the caller's whole sentence. |
203
203
  | `phone`, `email` | Typed readers; email `literal:true` preserves an explicit visible address token in surrounding prose. An email at hotmail, yahoo, outlook, icloud or aol said without its ending is held and only the ending is asked ("What comes after yahoo? For example, dot com."); the ending alone completes it, any other reply drops it. gmail is completed as gmail.com; an unknown domain is never guessed. |
204
204
  | `amount` | `min`, `max`, optional `marked:true` or `marked:"out_of_order"`; optional `money:{currency:"USD",cardinals:true,intent:"payment"}`. |
205
205
  | `text` | Current-field text fallback; `narrative:true` retains a substantive answer alongside independent structured fields. |
@@ -288,7 +288,7 @@ An unreadable answer with any words goes to the reply ranker, offered the questi
288
288
 
289
289
  `confirm_edit: true` on a `text` input of the form that holds a value: the read-back also offers the ranker ADD (the reply is appended to that text) and REPLACE (the reply takes its place, a leading "no," dropped); the form is then confirmed again.
290
290
 
291
- `whole_phrases: true` on a `choice`, or on a `pattern` that reads words: a word reading picks only when the whole reply is accounted for by its phrase, another input's argument (digits, an amount, a card), courtesy, connecting words and the input's `template_words` ("pay $50 with my Visa card"). Anything else goes to the reply ranker, offered the choices as above. Keypad keys and digit readings are arguments and read as before. Off by default.
291
+ `whole_phrases: true` on a `choice`, or on a `pattern` that reads words: a word reading picks only when the whole reply is accounted for by its phrase, another input's argument (digits, an amount, a card), courtesy, connecting words and the input's `template_words` ("pay $50 with my Visa card"). Anything else goes to the reply ranker, offered the choices as above. Keypad keys and digit readings are arguments and read as before. Off by default. A flow's own word reader gets the same rule from `pickWholeChoice(answer, choices, templateWords)`: `pickChoice`'s pick, kept only when the rest of the answer is courtesy, connecting words, numbers or `templateWords`, else `''` (the reply ranker reads it).
292
292
 
293
293
  A choice marked `current_only` is read only at its own question: neither the word reader nor the reply ranker offers it while another question is asked (a route's `done` or `switch` is never picked for a NO or a sub account said at the amount question). Written cents (`72.45`, `$72.45`, `287,15`) are an amount by shape: out of order they fill an open amount, and beside another field's reading (`51:72.45` at a sub account question) they are that amount, never digits of a security code or ZIP code.
294
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.90.0",
3
+ "version": "1.92.0",
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",