jsfe 1.81.0 → 1.81.2

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.
@@ -2,7 +2,7 @@
2
2
  export function setTaskGate(cargo: any, form: any, gate: any, active: any): boolean;
3
3
  /** Normalize spoken digits without interpreting numbers embedded in unrelated words. */
4
4
  export function serviceDigits(text: any): string;
5
- export function otpDigits(text: any): string;
5
+ export function otpDigits(text: any): any;
6
6
  export function contactPrompt(cargo: any, options: any, callerAllowed: any, partial?: boolean, es?: boolean): string;
7
7
  /** The line a ranked pick at the contact question is answered with, before the question again (owner 2026-11-18). */
8
8
  export function rankedContactLine(kind: any, options: any, cargo: any, es?: boolean): string;
@@ -1 +1 @@
1
- {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAgDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAiBC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAMC;AAkHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AA0JD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AAzQD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AA4RzC,0BAAsK"}
1
+ {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAkDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,0CAWC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAMC;AAkHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AA0JD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AAzQD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AA4RzC,0BAAsK"}
@@ -3,6 +3,8 @@ import { defineWorker, defineForm } from './contracts.js';
3
3
  import { OTP_EXPIRY_MS } from '../helpers/otp-check.js';
4
4
  // maskEmail is a standard function: these functions run as flow expressions too, where it is in scope by name.
5
5
  import { maskEmail, emailAttempt } from '../helpers/contact.js';
6
+ // findNumbers/assignNumbers are standard functions too: otpDigits runs as a flow expression, where they are in scope by name.
7
+ import { findNumbers, assignNumbers } from '../helpers/numbers.js';
6
8
  // an answer that tries to give an email is never a phone number (prod 2026-11-17); inlined, so it needs no host function
7
9
  const emailTry = `(${emailAttempt.toString()})(contact_text)`;
8
10
  const vars = o => Object.fromEntries(Object.entries(o).map(([k, v]) => [k, { type: Array.isArray(v) ? 'array' : v === null || typeof v === 'object' ? 'object' : typeof v, value: v }]));
@@ -77,26 +79,17 @@ export function serviceDigits(text) {
77
79
  return String(text || '').replace(/[a-záéíóúñ]+/gi, word => Object.hasOwn(words, word.toLowerCase()) ? words[word.toLowerCase()] : word);
78
80
  }
79
81
  export function otpDigits(text) {
80
- const map = { zero: '0', cero: '0', one: '1', uno: '1', two: '2', dos: '2', three: '3', tres: '3', four: '4', cuatro: '4', five: '5', cinco: '5', six: '6', seis: '6', seven: '7', siete: '7', eight: '8', ocho: '8', nine: '9', nueve: '9' };
81
- const filler = new Set(['el', 'mi', 'es', 'codigo', 'code', 'is', 'my', 'the', 'numero', 'number', 'a', 'ver']);
82
- const tokens = String(text || '').toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').split(/[\s,.;:!?-]+/).filter(t => t && !filler.has(t));
83
- const spoken = tokens.length && tokens.some(t => Object.hasOwn(map, t)) && tokens.every(t => /^\d+$/.test(t) || Object.hasOwn(map, t)) ? tokens.map(t => map[t] ?? t).join('') : '';
84
- if (spoken.length === 6)
85
- return spoken;
86
- // A caller who restarts the code ("57. 57, 21, 80.") or says it twice gives the code last (owner 2026-11-18). Only an answer
87
- // that is nothing but digits: the same six twice, or a restart that ends at a pause the transcript marks (a period or
88
- // comma) and is how the last six begin. A number said digit by digit, a single run, or one with other words is left as it was.
89
- if (tokens.length && tokens.every(t => /^\d+$/.test(t) || Object.hasOwn(map, t))) {
90
- const all = tokens.map(t => map[t] ?? t).join(''), cut = all.length - 6, head = all.slice(0, cut), tail = all.slice(cut);
91
- const marked = String(text || '').toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').split(/[.,;]/).map(p => p.split(/\s+/).filter(t => t && !filler.has(t)).map(t => map[t] ?? t).join('')).filter(Boolean);
92
- let at = 0;
93
- const pauses = new Set(marked.map(p => (at += p.length)));
94
- const twice = cut === 6 && head === tail && tokens.length >= 2, restart = cut > 0 && cut < 6 && pauses.has(cut) && tail.startsWith(head);
95
- if (twice || restart)
96
- return tail;
97
- }
98
- else { /* other words: read as before */ }
99
- return String(text || '').replace(/\D/g, '');
82
+ // The code is ONE complete six-digit number, or the caller's restart of it ("57. 57, 21, 80.", or said twice), read by the
83
+ // number finder (owner 2026-11-19). The OTP form reads the result three ways: six characters verify; any other non-empty
84
+ // result says "I was expecting a 6-digit code" and counts a format miss (ended at 3); '' is an answer without digits. So any
85
+ // other answer returns the digits it holds, as before, except pieces separated by words that glue to six: they are never a
86
+ // code ("572 and then 180" is "572180?", a format miss). Runs inside a flow expression, so findNumbers/assignNumbers are the
87
+ // standard functions.
88
+ const numbers = findNumbers(String(text || '')), read = assignNumbers(numbers, { code: v => v.length === 6 });
89
+ if (read.values.code)
90
+ return read.values.code;
91
+ const digits = numbers.map(n => n.value).join('');
92
+ return digits.length === 6 ? digits + '?' : digits;
100
93
  }
101
94
  export function contactPrompt(cargo, options, callerAllowed, partial = false, es = false) {
102
95
  if (partial)
@@ -1 +1 @@
1
- {"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AAsNA;;;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;;;;;;;;AA3gBD,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;;;;;;;;AA/gBD,qCAKwE"}
@@ -67,6 +67,10 @@ const plainVowels = (s) => s.replace(/[áàâä]/g, 'a').replace(/[éèêë]/g,
67
67
  /** Unescapes what the engine escaped, lowercases, drops punctuation but keeps * @ ., and drops accents (not ñ). */
68
68
  const normalize = (s) => plainVowels(String(s ?? '').replace(/\\(['"\\])/g, '$1').toLowerCase().replace(/[^\w\s*@.áéíóúüñàâäèêëìîïòôöùû]+/g, ''))
69
69
  .replace(AGREEING, ' ').replace(/\s+/g, ' ').trim();
70
+ // The agent key 0, pressed or spoken: a whole answer that is one digit's word, with or without a closing period, is that digit
71
+ // (owner 2026-11-19; speech-to-text writes "Zero." as often as "0"). Every other digit word already reads as its digit where
72
+ // digits are read (choice keys, the number finder); only these literal "0" comparisons missed it.
73
+ const isZeroKey = (b) => b === '0' || /^(?:zero|cero)\.?$/.test(b);
70
74
  const NEGATION_SET = new Set(NEGATIONS.map(plainVowels));
71
75
  const hasNegation = (s) => String(s).split(' ').some((t) => NEGATION_SET.has(t));
72
76
  // Said around an answer without changing it: politeness, filler, a form of address.
@@ -231,7 +235,7 @@ export function isAnswer(input, kind, extra = []) {
231
235
  if (!b) {
232
236
  return false;
233
237
  }
234
- else if (kind === 'agent' && b === '0') {
238
+ else if (kind === 'agent' && isZeroKey(b)) {
235
239
  return true;
236
240
  }
237
241
  else if (kind === 'exit' && b === '*') {
@@ -279,7 +283,7 @@ export function isGlobalExit(input) {
279
283
  export function isAgentRequest(input) {
280
284
  // the period normalize() keeps for emails is not part of the answer at its ends ("Operator." on a call, 2026-10-17)
281
285
  const b = normalize(input).replace(/^[.\s]+|[.\s]+$/g, '');
282
- return b === '0' || (!hasNegation(b) && AGENT_ONLY.test(b));
286
+ return isZeroKey(b) || (!hasNegation(b) && AGENT_ONLY.test(b));
283
287
  }
284
288
  // A spoken or typed number: a digit, or a number word (ASR usually writes digits, not always).
285
289
  const NUMBER_WORD = /\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|hundred|thousand|cero|uno|una|dos|tres|cuatro|cinco|seis|siete|ocho|nueve|diez|once|doce|trece|catorce|quince|dieciséis|dieciseis|diecisiete|dieciocho|diecinueve|veinte|veinti\w+|treinta|cuarenta|cincuenta|sesenta|setenta|ochenta|noventa|cien|ciento|cientos|mil)\b/;
@@ -585,7 +589,7 @@ export function pickChoice(answer, choices, acceptOther) {
585
589
  else if (blocked && noChoice) {
586
590
  return noChoice;
587
591
  }
588
- else if ((b === '0' && !amount) || (!hasNegation(b) && !b.includes('@') && (AGENT_ONLY.test(b) || (!acceptOther && matchesChoice(b, ANSWER_WORDS.agent.filter((w) => !AGENT_AMBIGUOUS.has(w))))))) {
592
+ else if ((isZeroKey(b) && !amount) || (!hasNegation(b) && !b.includes('@') && (AGENT_ONLY.test(b) || (!acceptOther && matchesChoice(b, ANSWER_WORDS.agent.filter((w) => !AGENT_AMBIGUOUS.has(w))))))) {
589
593
  return '__agent';
590
594
  }
591
595
  else if (b === '*' || (acceptOther ? /^(exit|quit|salir|abort)( please| por favor)?$/ : /^(exit|quit|salir|abort|cancel|cancelar)( please| por favor)?$/).test(b)) {
@@ -97,6 +97,7 @@ export namespace STANDARD_FUNCTIONS {
97
97
  export { joinSpokenNumbers };
98
98
  export { findNumbers };
99
99
  export { assignNumbers };
100
+ export { addressDraft };
100
101
  export { readInputProfile };
101
102
  export { formAcceptanceTrace };
102
103
  export { resolveFormInputs };
@@ -249,6 +250,7 @@ import { groundAmount } from './match-inputs.js';
249
250
  import { joinSpokenNumbers } from './numbers.js';
250
251
  import { findNumbers } from './numbers.js';
251
252
  import { assignNumbers } from './numbers.js';
253
+ import { addressDraft } from './address.js';
252
254
  import { readInputProfile } from './match-inputs.js';
253
255
  import { formAcceptanceTrace } from './match-inputs.js';
254
256
  import { resolveFormInputs } from './form-state.js';
@@ -306,5 +308,5 @@ import { sendables } from './sendables.js';
306
308
  import { chatTranscript } from './sendables.js';
307
309
  import { conversationCopy } from './sendables.js';
308
310
  import { CONVERSATION_KEY } from './sendables.js';
309
- 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, 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 };
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 };
310
312
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CACyC,iCAAiC;+BAIoO,wBAAwB;2CAHxP,0BAA0B;qCAA1B,0BAA0B;gCAA1B,0BAA0B;mCAC8F,qBAAqB;kCAArB,qBAAqB;iCAArB,qBAAqB;qCAArB,qBAAqB;iCAArB,qBAAqB;wCAArB,qBAAqB;mCAArB,qBAAqB;oCAArB,qBAAqB;6CAArB,qBAAqB;qCACvG,wBAAwB;2CAAxB,wBAAwB;+CAAxB,wBAAwB;uCAAxB,wBAAwB;gCACkK,wBAAwB;4BAAxB,wBAAwB;8BAAxB,wBAAwB;iCAAxB,wBAAwB;gCAAxB,wBAAwB;0CAAxB,wBAAwB;gCAAxB,wBAAwB;iCAAxB,wBAAwB;oCAAxB,wBAAwB;6BAAxB,wBAAwB;uCAAxB,wBAAwB;sCAAxB,wBAAwB;sCAAxB,wBAAwB;+BAAxB,wBAAwB;wCAAxB,wBAAwB;gCAoBvM,YAAY;8BAAZ,YAAY;kCAAZ,YAAY;uCAAZ,YAAY;qCAAZ,YAAY;qCAAZ,YAAY;gCAnB3G,mBAAmB;gCA2BiH,mBAAmB;4BAAnB,mBAAmB;sCAAn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BAAiB;+BAAjB,iBAAiB;iCAAjB,iBAAiB;8CAAjB,iBAAiB;sCAAjB,iBAAiB;uCAAjB,iBAAiB;iCAAjB,iBAAiB;oCAAjB,iBAAiB;kCAAjB,iBAAiB;mCAAjB,iBAAiB;oCAAjB,iBAAiB;wCAAjB,iBAAiB;sCAAjB,iBAAiB;kCAAjB,iBAAiB;sCAAjB,iBAAiB;sCAAjB,iBAAiB;sCAAjB,iBAAiB;gCAAjB,iBAAiB;6BAAjB,iBAAiB;yBAAjB,iBAAiB;gCAAjB,iBAAiB;iCAAjB,iBAAiB;oCAAjB,iBAAiB;gCAAjB,iBAAiB;kCAAjB,iBAAiB;oCAAjB,iBAAiB;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;iCAHI,oBAAoB;iCAApB,oBAAoB;kCAApB,oBAAoB;iCA9BM,gBAAgB;0BAAhB,gBAAgB;+BAAhB,gBAAgB;iCAAhB,gBAAgB;iCAAhB,gBAAgB"}
@@ -37,8 +37,9 @@ import { checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS } from
37
37
  import { validateDigits, validatePhone, validateEmail } from './validators.js';
38
38
  import { joinSpokenDigits, spokenDigitsText, wholeSpokenNumber } from './spoken-digits.js';
39
39
  import { findNumbers, assignNumbers, joinSpokenNumbers } from './numbers.js';
40
+ import { addressDraft } from './address.js';
40
41
  import { urlToSpeech, textWithUrlToSpeech } from './url-speech.js';
41
- 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, 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, 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
43
  /** The functions flows call by name, ready to spread into a host's approved functions. */
43
44
  export const STANDARD_FUNCTIONS = {
44
45
  continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse,
@@ -46,7 +47,7 @@ export const STANDARD_FUNCTIONS = {
46
47
  clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome,
47
48
  readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho,
48
49
  readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
49
- 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, 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,
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,
50
51
  validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, wholeSpokenNumber,
51
52
  registerSendable, sendables, chatTranscript, conversationCopy,
52
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/helpers/numbers.js"],"names":[],"mappings":"AAoFA;;;;;GAKG;AACH;;;;;;IAoBC;AAED;;;;;;;GAOG;AACH;;;;EA0BC;AAED;mFACmF;AACnF,qEASC;AApJD;;;4EAG4E;AAC5E,+BAAqF"}
1
+ {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/helpers/numbers.js"],"names":[],"mappings":"AAoFA;;;;;GAKG;AACH;;;;;;IAqBC;AAED;;;;;;;GAOG;AACH;;;;EA0BC;AAED;mFACmF;AACnF,qEASC;AArJD;;;4EAG4E;AAC5E,+BAAqF"}
@@ -106,28 +106,32 @@ export function findNumbers(answer) {
106
106
  // A line break separates two numbers, as a word does (prod WhatsApp 2026-10-18: a date, then the account on the next line).
107
107
  const lines = raw.replace(/[\r\n]/g, '|');
108
108
  // Number words become their digits first, so a number said partly in words joins like any other ("five five five 1212").
109
+ // Each character of text maps back to the answer: firstOf where a number starting on it begins, lastOf where one ending on it
110
+ // ends (a word's digits all begin at the word and end with it).
109
111
  let text = '';
110
- const origin = [];
112
+ const firstOf = [], lastOf = [];
111
113
  let from = 0;
112
114
  for (const w of wordNumbers(lines)) {
113
115
  for (let i = from; i < w.start; i++) {
114
116
  text += lines[i];
115
- origin.push(i);
117
+ firstOf.push(i);
118
+ lastOf.push(i);
116
119
  }
117
120
  for (const d of w.digits) {
118
121
  text += d;
119
- origin.push(w.start);
122
+ firstOf.push(w.start);
123
+ lastOf.push(w.end - 1);
120
124
  }
121
- origin[origin.length - 1] = w.end - 1;
122
125
  from = w.end;
123
126
  }
124
127
  for (let i = from; i < raw.length; i++) {
125
128
  text += lines[i];
126
- origin.push(i);
129
+ firstOf.push(i);
130
+ lastOf.push(i);
127
131
  }
128
132
  return [...text.matchAll(DIGIT_RUN)].map((m) => {
129
133
  const said = m[0].replace(/[\s.,-]+$/, '');
130
- const start = origin[m.index], end = origin[m.index + said.length - 1] + 1;
134
+ const start = firstOf[m.index], end = lastOf[m.index + said.length - 1] + 1;
131
135
  return { value: said.replace(/\D/g, ''), said: raw.slice(start, end), start, end, restarts: restartsOf(said) };
132
136
  });
133
137
  }
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:1b727c897b055e1f8084fffdf3f305aff21a6f44788da5192d9825203c3dd001";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:bb1babc51b4174455afca1da5de8d831eecd1e4d5835962d2b16c2280c778395";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.81.0",
3
+ "version": "1.81.2",
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",