jsfe 1.90.0 → 1.91.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.
@@ -145,6 +145,7 @@ export namespace STANDARD_FUNCTIONS {
145
145
  export { textWithUrlToSpeech };
146
146
  export { joinSpokenDigits };
147
147
  export { wholeSpokenNumber };
148
+ export { numberAlone };
148
149
  export { registerSendable };
149
150
  export { sendables };
150
151
  export { chatTranscript };
@@ -303,10 +304,11 @@ import { textWithUrlToSpeech } from './url-speech.js';
303
304
  import { joinSpokenDigits } from './spoken-digits.js';
304
305
  import { spokenDigitsText } from './spoken-digits.js';
305
306
  import { wholeSpokenNumber } from './spoken-digits.js';
307
+ import { numberAlone } from './spoken-digits.js';
306
308
  import { registerSendable } from './sendables.js';
307
309
  import { sendables } from './sendables.js';
308
310
  import { chatTranscript } from './sendables.js';
309
311
  import { conversationCopy } from './sendables.js';
310
312
  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 };
313
+ 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, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY };
312
314
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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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;iCAHiB,oBAAoB;iCAApB,oBAAoB;kCAApB,oBAAoB;4BAApB,oBAAoB;iCA9BP,gBAAgB;0BAAhB,gBAAgB;+BAAhB,gBAAgB;iCAAhB,gBAAgB;iCAAhB,gBAAgB"}
@@ -35,11 +35,11 @@ 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, 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,
@@ -48,6 +48,6 @@ export const STANDARD_FUNCTIONS = {
48
48
  readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, 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:12b7415283ddd8f6d0f359c9a16e568cdb7d0c22f756fb1d76963213d6eaa3c7";
@@ -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. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.90.0",
3
+ "version": "1.91.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",