jsfe 1.80.0 → 1.81.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.
- package/dist/helpers/index.d.ts +6 -2
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +4 -3
- package/dist/helpers/match-inputs.d.ts +0 -5
- package/dist/helpers/match-inputs.d.ts.map +1 -1
- package/dist/helpers/match-inputs.js +2 -24
- package/dist/helpers/numbers.d.ts +35 -0
- package/dist/helpers/numbers.d.ts.map +1 -0
- package/dist/helpers/numbers.js +189 -0
- package/dist/helpers/spoken-money.d.ts +4 -0
- package/dist/helpers/spoken-money.d.ts.map +1 -1
- package/dist/helpers/spoken-money.js +4 -0
- package/dist/runtime-identity.js +1 -1
- package/package.json +1 -1
package/dist/helpers/index.d.ts
CHANGED
|
@@ -95,6 +95,8 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
95
95
|
export { readArgument };
|
|
96
96
|
export { groundAmount };
|
|
97
97
|
export { joinSpokenNumbers };
|
|
98
|
+
export { findNumbers };
|
|
99
|
+
export { assignNumbers };
|
|
98
100
|
export { readInputProfile };
|
|
99
101
|
export { formAcceptanceTrace };
|
|
100
102
|
export { resolveFormInputs };
|
|
@@ -244,7 +246,9 @@ import { matchInputs } from './match-inputs.js';
|
|
|
244
246
|
import { readFormAnswer } from './match-inputs.js';
|
|
245
247
|
import { readArgument } from './match-inputs.js';
|
|
246
248
|
import { groundAmount } from './match-inputs.js';
|
|
247
|
-
import { joinSpokenNumbers } from './
|
|
249
|
+
import { joinSpokenNumbers } from './numbers.js';
|
|
250
|
+
import { findNumbers } from './numbers.js';
|
|
251
|
+
import { assignNumbers } from './numbers.js';
|
|
248
252
|
import { readInputProfile } from './match-inputs.js';
|
|
249
253
|
import { formAcceptanceTrace } from './match-inputs.js';
|
|
250
254
|
import { resolveFormInputs } from './form-state.js';
|
|
@@ -302,5 +306,5 @@ import { sendables } from './sendables.js';
|
|
|
302
306
|
import { chatTranscript } from './sendables.js';
|
|
303
307
|
import { conversationCopy } from './sendables.js';
|
|
304
308
|
import { CONVERSATION_KEY } from './sendables.js';
|
|
305
|
-
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, 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 };
|
|
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 };
|
|
306
310
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":"
|
|
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;sCAAnB,mBAAmB;8BATzJ,qBAAqB;6BAEkJ,aAAa;8BAAb,aAAa;yBAAb,aAAa;+BAAb,aAAa;8BAAb,aAAa;6BAAb,aAAa;+BAAb,aAAa;kCAAb,aAAa;+BAAb,aAAa;+BAAb,aAAa;2BAAb,aAAa;kCAAb,aAAa;0BACb,cAAc;mCAAd,cAAc;4BAAd,cAAc;0BAAd,cAAc;0BAAd,cAAc;uCAAd,cAAc;+BAAd,cAAc;sBAAd,cAAc;0BAAd,cAAc;iCAAd,cAAc;gCAAd,cAAc;sCAAd,cAAc;wCAC3K,cAAc;6BACiC,cAAc;wBAAd,cAAc;wBAAd,cAAc;+BAAd,cAAc;0BAAd,cAAc;4BAAd,cAAc;4BACzE,iBAAiB;+BACd,uBAAuB;mCACC,kBAAkB;mCAAlB,kBAAkB;qCAxB+I,mBAAmB;yCAAnB,mBAAmB;8BAAnB,mBAAmB;iCAAnB,mBAAmB;oCAAnB,mBAAmB;kCAAnB,mBAAmB;wCAAnB,mBAAmB;gCAAnB,mBAAmB;iCAAnB,mBAAmB;mCAAnB,mBAAmB;gCAe1I,mBAAmB;mCAAnB,mBAAmB;sCAAnB,mBAAmB;qCAAnB,mBAAmB;4BAUgD,mBAAmB;+BAAnB,mBAAmB;6BAAnB,mBAAmB;6BAAnB,mBAAmB;kCAKzH,cAAc;4BAAd,cAAc;8BAAd,cAAc;iCALwF,mBAAmB;oCAAnB,mBAAmB;kCACijB,iBAAiB;iCAAjB,iBAAiB;gCAAjB,iBAAiB;8BAAjB,iBAAiB;+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;4BAG7B,iBAAiB;oCAAjB,iBAAiB;iCAFI,oBAAoB;iCAApB,oBAAoB;kCAApB,oBAAoB;iCA9BM,gBAAgB;0BAAhB,gBAAgB;+BAAhB,gBAAgB;iCAAhB,gBAAgB;iCAAhB,gBAAgB"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -31,13 +31,14 @@ import { anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb
|
|
|
31
31
|
import { dateToWords } from './date-words.js';
|
|
32
32
|
import { amountToSpeech } from './amount-to-speech.js';
|
|
33
33
|
import { validateCardNumber, validateExpiration } from './card-checks.js';
|
|
34
|
-
import { matchInputs, readFormAnswer, readArgument, groundAmount,
|
|
34
|
+
import { matchInputs, readFormAnswer, readArgument, groundAmount, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, readInputProfile, formAcceptanceTrace } from './match-inputs.js';
|
|
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
38
|
import { joinSpokenDigits, spokenDigitsText, wholeSpokenNumber } from './spoken-digits.js';
|
|
39
|
+
import { findNumbers, assignNumbers, joinSpokenNumbers } from './numbers.js';
|
|
39
40
|
import { urlToSpeech, textWithUrlToSpeech } from './url-speech.js';
|
|
40
|
-
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, 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, };
|
|
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, };
|
|
41
42
|
/** The functions flows call by name, ready to spread into a host's approved functions. */
|
|
42
43
|
export const STANDARD_FUNCTIONS = {
|
|
43
44
|
continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse,
|
|
@@ -45,7 +46,7 @@ export const STANDARD_FUNCTIONS = {
|
|
|
45
46
|
clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome,
|
|
46
47
|
readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho,
|
|
47
48
|
readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
|
|
48
|
-
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, 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,
|
|
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,
|
|
49
50
|
validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, wholeSpokenNumber,
|
|
50
51
|
registerSendable, sendables, chatTranscript, conversationCopy,
|
|
51
52
|
};
|
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
* values: the answers include card numbers and codes. The host clears it at the start of a turn.
|
|
5
5
|
*/
|
|
6
6
|
export function formAcceptanceTrace(previous: any, matches: any): any;
|
|
7
|
-
/** The text with every number written as the caller said it, whole: each spoken run (DIGIT_RUN) joined into its digits
|
|
8
|
-
* ("323 571 3211" → "3235713211", "0 7 13" → "0713", "56, 0 8 17 58" → "56081758"). A reader that splits numbers itself
|
|
9
|
-
* reads pieces of one number as separate values (prod 2026-11-17: a phone typed "323 5713211" became account 5713211;
|
|
10
|
-
* 11-18: the year of a spoken date became an SSN's last four). Reading this text instead, a value is only ever a whole number. */
|
|
11
|
-
export function joinSpokenNumbers(raw: any): string;
|
|
12
7
|
/**
|
|
13
8
|
* One input's reading of the answer: { value, evidence } or null. `evidence` is what the answer spent on it (digits
|
|
14
9
|
* or words), so two inputs that claim the same part of the answer are told apart from a compound answer.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,sEAQC;AA8FD;;;GAGG;AACH,sFAiIC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;mHACmH;AAEnH,iEAEC;AAGD,gGAOC;AAYD,kDAGC;AAED;;;;;;;GAOG;AACH;;;;SAcC;AACD;;;;;GAKG;AACH;;;;;;;;;;;;;;;;;;;;;;EAaC;AACD;;;;;;;;;;;;;;;;;;;;;;EAeC;AACD;;;;;;;;;;;;;;;;;;;;;;;EAgXC"}
|
|
@@ -15,6 +15,7 @@ import { readSpokenMoney } from './spoken-money.js';
|
|
|
15
15
|
import { readMoneyAmount, isPartialMoneyAnswer } from './money.js';
|
|
16
16
|
import { pickProviderQuestion } from './form-sources.js';
|
|
17
17
|
import { spokenDigitsText, wholeSpokenNumber } from './spoken-digits.js';
|
|
18
|
+
import { DIGIT_RUN } from './numbers.js';
|
|
18
19
|
/**
|
|
19
20
|
* This turn's acceptance decisions for the host to log, appended per match: fields filled out of order, in a compound
|
|
20
21
|
* answer or as an invited input, and every refused reading, by form, field and rule. Field names and rules only, never
|
|
@@ -34,33 +35,10 @@ export function formAcceptanceTrace(previous, matches) {
|
|
|
34
35
|
function unescape(answer) {
|
|
35
36
|
return String(answer ?? '').replace(/\\(['"\\])/g, '$1');
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
* joins it, and so does a comma (or a period and a space) after a group of one to three digits: speech-to-text writes the
|
|
39
|
-
* pauses between spoken groups that way (prod 2026-10-31: the ZIP 92610 said as "926, 1 0.", the code as "7, 9, 984. 5."). A comma after a
|
|
40
|
-
* longer number separates two numbers ("92610, 56035214"). */
|
|
41
|
-
const DIGIT_RUN = /\d(?:[\s.-]?\d|(?<=(?:^|\D)\d{1,3})(?:,\s?|\.\s)(?=\d))*/g;
|
|
38
|
+
// DIGIT_RUN, the run of digits as said, lives with the number finder (numbers.js), so the rule is written once.
|
|
42
39
|
function digitRuns(raw) {
|
|
43
40
|
return (raw.match(DIGIT_RUN) || []).map((r) => r.replace(/\D/g, ''));
|
|
44
41
|
}
|
|
45
|
-
/** The text with every number written as the caller said it, whole: each spoken run (DIGIT_RUN) joined into its digits
|
|
46
|
-
* ("323 571 3211" → "3235713211", "0 7 13" → "0713", "56, 0 8 17 58" → "56081758"). A reader that splits numbers itself
|
|
47
|
-
* reads pieces of one number as separate values (prod 2026-11-17: a phone typed "323 5713211" became account 5713211;
|
|
48
|
-
* 11-18: the year of a spoken date became an SSN's last four). Reading this text instead, a value is only ever a whole number. */
|
|
49
|
-
export function joinSpokenNumbers(raw) {
|
|
50
|
-
return String(raw ?? '').replace(DIGIT_RUN, (m) => {
|
|
51
|
-
const digits = m.replace(/\D/g, '');
|
|
52
|
-
// The same number said twice is a restart, not a longer number ("6119 6119": the caller repeating it, or the transcript
|
|
53
|
-
// doubling it): when the run's groups split into two identical halves of four digits or more, it is that number once.
|
|
54
|
-
const groups = m.split(/\D+/).filter(Boolean);
|
|
55
|
-
for (let i = 1; i < groups.length; i++) {
|
|
56
|
-
const a = groups.slice(0, i).join(''), b = groups.slice(i).join('');
|
|
57
|
-
if (a === b && a.length >= 4)
|
|
58
|
-
return a;
|
|
59
|
-
else { /* not a repeat at this boundary */ }
|
|
60
|
-
}
|
|
61
|
-
return digits;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
42
|
// A pause speech-to-text writes between spoken groups (DIGIT_RUN joins across it).
|
|
65
43
|
const PAUSE = /,\s?|\.\s/;
|
|
66
44
|
// A choice reads its keys without the comma join: "1, 2" names two keys, not 12.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every number in the answer, in order: [{value, said, start, end, restarts}]. value is the complete number's digits; said the
|
|
3
|
+
* text it was read from (start/end index the answer); restarts the readings of the number once when the caller repeated it
|
|
4
|
+
* (restartsOf), else []. Number words
|
|
5
|
+
* are numbers ("one thousand and 3" → 1003, "cinco cinco cinco" → 555); every other word separates two numbers.
|
|
6
|
+
*/
|
|
7
|
+
export function findNumbers(answer: any): {
|
|
8
|
+
value: string;
|
|
9
|
+
said: string;
|
|
10
|
+
start: any;
|
|
11
|
+
end: any;
|
|
12
|
+
restarts: any[];
|
|
13
|
+
}[];
|
|
14
|
+
/**
|
|
15
|
+
* Which numbers are which, by the caller's tests: kinds = {name: (digits) => false | true | normalized value}. One value per kind.
|
|
16
|
+
* A number is read by every test its complete digits pass and, for a restart, every test the number once passes. A number
|
|
17
|
+
* read more than one way is ambiguous, and so is a kind given two different values: those kinds take no value, so the caller
|
|
18
|
+
* asks (the longest match wins only when it is the only match: "5603 5603" is an 8-digit account or SSN 5603 said twice).
|
|
19
|
+
* A number no test reads is ignored here; the caller decides whether that means asking again.
|
|
20
|
+
* → {values: {name: value}, ambiguous: [names], unread: [numbers]}
|
|
21
|
+
*/
|
|
22
|
+
export function assignNumbers(numbers: any, kinds: any): {
|
|
23
|
+
values: {};
|
|
24
|
+
ambiguous: any[];
|
|
25
|
+
unread: any[];
|
|
26
|
+
};
|
|
27
|
+
/** The answer with each number written as its digits (a restart as the number once unless {restarts: false}), for a reader
|
|
28
|
+
* that reads text: "323 5713211" → "3235713211", "one thousand and 3" → "1003". */
|
|
29
|
+
export function joinSpokenNumbers(answer: any, options?: {}): string;
|
|
30
|
+
/** A run of digits as said: spoken digits come apart ("4 3 2 1", "555-123-4567"), so a single space, dash or dot inside a run
|
|
31
|
+
* joins it, and so does a comma (or a period and a space) after a group of one to three digits: speech-to-text writes the
|
|
32
|
+
* pauses between spoken groups that way (prod 2026-10-31: the ZIP 92610 said as "926, 1 0.", the code as "7, 9, 984. 5."). A
|
|
33
|
+
* comma after a longer number separates two numbers ("92610, 56035214"). */
|
|
34
|
+
export const DIGIT_RUN: RegExp;
|
|
35
|
+
//# sourceMappingURL=numbers.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one number finder (owner 2026-11-19): every number in an answer, each read complete, as said. A value is only ever a
|
|
3
|
+
* complete number (spaces, pauses and punctuation inside it allowed) or a qualified restart, never a piece of one: a reader
|
|
4
|
+
* that took pieces read a phone typed "323 5713211" as account 5713211 (prod 2026-11-17) and the year of a spoken date as an
|
|
5
|
+
* SSN's last four (11-18).
|
|
6
|
+
*
|
|
7
|
+
* findNumbers finds; it never decides what a number is. The caller's own tests decide that (assignNumbers), so a tenant's
|
|
8
|
+
* proprietary identifier is one more test, not a matcher here. Shape reading only; part of jsfe/helpers, imports a sibling.
|
|
9
|
+
*/
|
|
10
|
+
import { cardinalWords, isNumberWord, plainWord } from './spoken-money.js';
|
|
11
|
+
/** A run of digits as said: spoken digits come apart ("4 3 2 1", "555-123-4567"), so a single space, dash or dot inside a run
|
|
12
|
+
* joins it, and so does a comma (or a period and a space) after a group of one to three digits: speech-to-text writes the
|
|
13
|
+
* pauses between spoken groups that way (prod 2026-10-31: the ZIP 92610 said as "926, 1 0.", the code as "7, 9, 984. 5."). A
|
|
14
|
+
* comma after a longer number separates two numbers ("92610, 56035214"). */
|
|
15
|
+
export const DIGIT_RUN = /\d(?:[\s.-]?\d|(?<=(?:^|\D)\d{1,3})(?:,\s?|\.\s)(?=\d))*/g;
|
|
16
|
+
const DIGIT_WORDS = { zero: 0, one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9,
|
|
17
|
+
cero: 0, uno: 1, dos: 2, tres: 3, cuatro: 4, cinco: 5, seis: 6, siete: 7, ocho: 8, nueve: 9 };
|
|
18
|
+
// Words that are a number only next to another number word: an article alone ("una cuenta", "a payment") is not one.
|
|
19
|
+
const ARTICLES = new Set(['a', 'an', 'un', 'una']);
|
|
20
|
+
const CONNECTORS = new Set(['and', 'y']);
|
|
21
|
+
const SCALES = [[1000000, ['million', 'millon', 'millones']], [1000, ['thousand', 'mil']], [100, ['hundred', 'cien', 'ciento']]];
|
|
22
|
+
/** Number words in the answer, each run with its digits: "one thousand and 3" → 1003, "cinco cinco cinco" → 555. */
|
|
23
|
+
function wordNumbers(raw) {
|
|
24
|
+
const tokens = [...raw.matchAll(/\p{L}+|\d+/gu)].map((m) => ({ word: plainWord(m[0]), start: m.index, end: m.index + m[0].length }));
|
|
25
|
+
const gapOk = (a, b) => /^[\s-]*$/.test(raw.slice(a.end, b.start));
|
|
26
|
+
const found = [];
|
|
27
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
28
|
+
const first = tokens[i].word;
|
|
29
|
+
if (!isNumberWord(first) || CONNECTORS.has(first)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
else { /* a run starts here */ }
|
|
33
|
+
let j = i;
|
|
34
|
+
while (j + 1 < tokens.length && isNumberWord(tokens[j + 1].word) && gapOk(tokens[j], tokens[j + 1]))
|
|
35
|
+
j++;
|
|
36
|
+
while (j > i && (CONNECTORS.has(tokens[j].word) || ARTICLES.has(tokens[j].word)))
|
|
37
|
+
j--;
|
|
38
|
+
const words = tokens.slice(i, j + 1).map((t) => t.word);
|
|
39
|
+
if (words.length === 1 && ARTICLES.has(words[0])) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
else { /* a number word */ }
|
|
43
|
+
let value = cardinalWords(words);
|
|
44
|
+
let digits = value === null ? null : String(value);
|
|
45
|
+
if (digits === null && words.every((w) => Object.hasOwn(DIGIT_WORDS, w))) {
|
|
46
|
+
digits = words.map((w) => DIGIT_WORDS[w]).join(''); // digits said one by one
|
|
47
|
+
}
|
|
48
|
+
else { /* a cardinal, or not a number */ }
|
|
49
|
+
if (digits === null) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
else { /* read */ }
|
|
53
|
+
// A digit said after a scale word completes it: "one thousand and 3", "mil 3", "two hundred 5".
|
|
54
|
+
let end = tokens[j].end;
|
|
55
|
+
let k = j + 1;
|
|
56
|
+
if (value !== null && k < tokens.length && CONNECTORS.has(tokens[k].word) && gapOk(tokens[j], tokens[k]))
|
|
57
|
+
k++;
|
|
58
|
+
else { /* no connector */ }
|
|
59
|
+
const tail = tokens[k];
|
|
60
|
+
const scale = value === null ? 0 : (SCALES.find(([size, names]) => words.some((w) => names.includes(w)) && value % size === 0)?.[0] || 0);
|
|
61
|
+
if (scale && tail && /^\d+$/.test(tail.word) && gapOk(tokens[k - 1], tail) && Number(tail.word) < scale) {
|
|
62
|
+
digits = String(value + Number(tail.word));
|
|
63
|
+
end = tail.end;
|
|
64
|
+
j = k;
|
|
65
|
+
}
|
|
66
|
+
else { /* nothing completes it */ }
|
|
67
|
+
found.push({ start: tokens[i].start, end, digits });
|
|
68
|
+
i = j;
|
|
69
|
+
}
|
|
70
|
+
return found;
|
|
71
|
+
}
|
|
72
|
+
/** A caller on the phone repeats themselves (owner 2026-11-19), so a run may hold a restart: the number once.
|
|
73
|
+
* - The whole number said twice ("6119 6119", "04 13 1955 04 13 1955"): two identical halves of four digits or more.
|
|
74
|
+
* - Its last part said again ("323 571 3211 3211"): trailing groups that repeat the digits just before them, three digits
|
|
75
|
+
* or more (one repeated digit is no restart: "5 6 0 3 3" may be the number).
|
|
76
|
+
* - A false start ("57. 57, 21, 80."): digits cut off at a pause the transcript marks (a comma or a period), then the number
|
|
77
|
+
* again from its start (the rule the OTP reader has used since 2026-11-18, otpDigits).
|
|
78
|
+
* A restart is only a candidate: assignNumbers takes it when the whole number fits nothing, and asks when both fit. */
|
|
79
|
+
function restartsOf(said) {
|
|
80
|
+
const groups = said.split(/\D+/).filter(Boolean);
|
|
81
|
+
const pauses = said.match(/\D+/g) || []; // pauses[i - 1] separates groups[i - 1] and groups[i]
|
|
82
|
+
const found = new Set();
|
|
83
|
+
for (let i = 1; i < groups.length; i++) {
|
|
84
|
+
const before = groups.slice(0, i).join(''), after = groups.slice(i).join('');
|
|
85
|
+
if (before === after && before.length >= 4) {
|
|
86
|
+
found.add(before);
|
|
87
|
+
}
|
|
88
|
+
else if (after.length >= 3 && before.length > after.length && before.endsWith(after)) {
|
|
89
|
+
found.add(before);
|
|
90
|
+
}
|
|
91
|
+
else if (/[,.]/.test(pauses[i - 1] || '') && after.length > before.length && after.startsWith(before)) {
|
|
92
|
+
found.add(after);
|
|
93
|
+
}
|
|
94
|
+
else { /* no repeat at this boundary */ }
|
|
95
|
+
}
|
|
96
|
+
return [...found];
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Every number in the answer, in order: [{value, said, start, end, restarts}]. value is the complete number's digits; said the
|
|
100
|
+
* text it was read from (start/end index the answer); restarts the readings of the number once when the caller repeated it
|
|
101
|
+
* (restartsOf), else []. Number words
|
|
102
|
+
* are numbers ("one thousand and 3" → 1003, "cinco cinco cinco" → 555); every other word separates two numbers.
|
|
103
|
+
*/
|
|
104
|
+
export function findNumbers(answer) {
|
|
105
|
+
const raw = String(answer ?? '');
|
|
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
|
+
const lines = raw.replace(/[\r\n]/g, '|');
|
|
108
|
+
// Number words become their digits first, so a number said partly in words joins like any other ("five five five 1212").
|
|
109
|
+
let text = '';
|
|
110
|
+
const origin = [];
|
|
111
|
+
let from = 0;
|
|
112
|
+
for (const w of wordNumbers(lines)) {
|
|
113
|
+
for (let i = from; i < w.start; i++) {
|
|
114
|
+
text += lines[i];
|
|
115
|
+
origin.push(i);
|
|
116
|
+
}
|
|
117
|
+
for (const d of w.digits) {
|
|
118
|
+
text += d;
|
|
119
|
+
origin.push(w.start);
|
|
120
|
+
}
|
|
121
|
+
origin[origin.length - 1] = w.end - 1;
|
|
122
|
+
from = w.end;
|
|
123
|
+
}
|
|
124
|
+
for (let i = from; i < raw.length; i++) {
|
|
125
|
+
text += lines[i];
|
|
126
|
+
origin.push(i);
|
|
127
|
+
}
|
|
128
|
+
return [...text.matchAll(DIGIT_RUN)].map((m) => {
|
|
129
|
+
const said = m[0].replace(/[\s.,-]+$/, '');
|
|
130
|
+
const start = origin[m.index], end = origin[m.index + said.length - 1] + 1;
|
|
131
|
+
return { value: said.replace(/\D/g, ''), said: raw.slice(start, end), start, end, restarts: restartsOf(said) };
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Which numbers are which, by the caller's tests: kinds = {name: (digits) => false | true | normalized value}. One value per kind.
|
|
136
|
+
* A number is read by every test its complete digits pass and, for a restart, every test the number once passes. A number
|
|
137
|
+
* read more than one way is ambiguous, and so is a kind given two different values: those kinds take no value, so the caller
|
|
138
|
+
* asks (the longest match wins only when it is the only match: "5603 5603" is an 8-digit account or SSN 5603 said twice).
|
|
139
|
+
* A number no test reads is ignored here; the caller decides whether that means asking again.
|
|
140
|
+
* → {values: {name: value}, ambiguous: [names], unread: [numbers]}
|
|
141
|
+
*/
|
|
142
|
+
export function assignNumbers(numbers, kinds) {
|
|
143
|
+
const seen = {}, ambiguous = new Set(), unread = [];
|
|
144
|
+
const read = (test, digits) => { const r = test(digits); return r === true ? digits : r ? String(r) : ''; };
|
|
145
|
+
for (const n of numbers || []) {
|
|
146
|
+
const readings = [];
|
|
147
|
+
for (const [kind, test] of Object.entries(kinds || {})) {
|
|
148
|
+
const whole = read(test, n.value);
|
|
149
|
+
if (whole)
|
|
150
|
+
readings.push([kind, whole]);
|
|
151
|
+
else { /* the complete number is not this kind */ }
|
|
152
|
+
for (const restart of n.restarts || []) {
|
|
153
|
+
const once = read(test, restart);
|
|
154
|
+
if (once)
|
|
155
|
+
readings.push([kind, once]);
|
|
156
|
+
else { /* not this kind */ }
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (readings.length === 1) {
|
|
160
|
+
(seen[readings[0][0]] ||= new Set()).add(readings[0][1]);
|
|
161
|
+
}
|
|
162
|
+
else if (readings.length > 1) {
|
|
163
|
+
readings.forEach(([kind]) => ambiguous.add(kind));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
unread.push(n);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const values = {};
|
|
170
|
+
for (const [kind, set] of Object.entries(seen)) {
|
|
171
|
+
if (set.size === 1 && !ambiguous.has(kind))
|
|
172
|
+
values[kind] = [...set][0];
|
|
173
|
+
else
|
|
174
|
+
ambiguous.add(kind);
|
|
175
|
+
}
|
|
176
|
+
return { values, ambiguous: [...ambiguous], unread };
|
|
177
|
+
}
|
|
178
|
+
/** The answer with each number written as its digits (a restart as the number once unless {restarts: false}), for a reader
|
|
179
|
+
* that reads text: "323 5713211" → "3235713211", "one thousand and 3" → "1003". */
|
|
180
|
+
export function joinSpokenNumbers(answer, options = {}) {
|
|
181
|
+
const raw = String(answer ?? '');
|
|
182
|
+
const restarts = options?.restarts !== false;
|
|
183
|
+
let out = '', from = 0;
|
|
184
|
+
for (const n of findNumbers(raw)) {
|
|
185
|
+
out += raw.slice(from, n.start) + (restarts && n.restarts.length === 1 ? n.restarts[0] : n.value);
|
|
186
|
+
from = n.end;
|
|
187
|
+
}
|
|
188
|
+
return out + raw.slice(from);
|
|
189
|
+
}
|
|
@@ -17,4 +17,8 @@ export function readSpokenMoney(answer: any): {
|
|
|
17
17
|
start: number;
|
|
18
18
|
end: number;
|
|
19
19
|
}[];
|
|
20
|
+
/** For the number finder (numbers.js), so the cardinal grammar lives here once: a run of number words' value, or null. */
|
|
21
|
+
export function cardinalWords(words: any): any;
|
|
22
|
+
export function isNumberWord(word: any): boolean;
|
|
23
|
+
export function plainWord(word: any): any;
|
|
20
24
|
//# sourceMappingURL=spoken-money.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spoken-money.d.ts","sourceRoot":"","sources":["../../src/helpers/spoken-money.js"],"names":[],"mappings":"AAqDA;wHACwH;AACxH;;;;;;;;;;;EA+BC;AAED;;;;IAAkF"}
|
|
1
|
+
{"version":3,"file":"spoken-money.d.ts","sourceRoot":"","sources":["../../src/helpers/spoken-money.js"],"names":[],"mappings":"AAqDA;wHACwH;AACxH;;;;;;;;;;;EA+BC;AAED;;;;IAAkF;AAElF,0HAA0H;AAC1H,+CAAqG;AACrG,iDAAmE;AACnE,0CAAqD"}
|
|
@@ -141,3 +141,7 @@ export function scanSpokenMoney(answer) {
|
|
|
141
141
|
return { readings, invalid };
|
|
142
142
|
}
|
|
143
143
|
export function readSpokenMoney(answer) { return scanSpokenMoney(answer).readings; }
|
|
144
|
+
/** For the number finder (numbers.js), so the cardinal grammar lives here once: a run of number words' value, or null. */
|
|
145
|
+
export function cardinalWords(words) { return words.some(word => /\d/.test(word)) ? null : cardinal(words); }
|
|
146
|
+
export function isNumberWord(word) { return NUMBER_WORDS.has(word); }
|
|
147
|
+
export function plainWord(word) { return plain(word); }
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:1b727c897b055e1f8084fffdf3f305aff21a6f44788da5192d9825203c3dd001";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.81.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",
|