jsfe 1.79.0 → 1.80.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/forms/send-copy-flow.d.ts.map +1 -1
- package/dist/forms/send-copy-flow.js +18 -1
- package/dist/helpers/index.d.ts +3 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +3 -3
- package/dist/helpers/match-inputs.d.ts +5 -0
- package/dist/helpers/match-inputs.d.ts.map +1 -1
- package/dist/helpers/match-inputs.js +19 -0
- package/dist/runtime-identity.js +1 -1
- package/docs/architecture-guide.md +66 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"AAoKA,0BAAgC"}
|
|
@@ -40,10 +40,11 @@ const sendCopy = defineWorker({
|
|
|
40
40
|
{ name: 'item', type: 'string', enum_from: 'sendables', description: "What the user asks to have sent: the reply or document they name or point to. 'That', 'it', 'this', 'eso' or 'lo que me dijo' is the latest reply; the whole chat, conversation or transcript ('toda la conversación') is the whole conversation." },
|
|
41
41
|
{ name: 'medium', type: 'string', enum: ['text', 'email'], description: "How the user asks to have it sent: text for a text message or SMS ('mensaje', 'texto'), email for an email ('correo')." },
|
|
42
42
|
{ name: 'destination', type: 'string', description: 'The phone number or email address the user gave to send it to, as given.' },
|
|
43
|
+
{ name: 'other_destination', type: 'boolean', description: "true when the user asks to send it to a different, new or other phone number or email than their own, without saying what it is ('another number', 'a different email', 'otro número', 'a mi otro correo'); false when they give the number or email, or name none." },
|
|
43
44
|
],
|
|
44
45
|
variables: vars({
|
|
45
46
|
noop: false, sc_items: [], sc_key: '', sc_item: null, sc_last: null, sc_last_head: '', sc_offer_q: '', sc_offer_q_es: '', sc_doc_list: '', sc_email: '', sc_phone: '',
|
|
46
|
-
sc_medium: '', sc_medium_q: '', sc_medium_q_es: '', sc_given: '', sc_media: [], sc_forced: '', sc_to: '', sc_subject: '', sc_content: '', sc_sent: false,
|
|
47
|
+
sc_medium: '', sc_medium_q: '', sc_medium_q_es: '', sc_given: '', sc_other: false, sc_media: [], sc_forced: '', sc_to: '', sc_subject: '', sc_content: '', sc_sent: false,
|
|
47
48
|
}),
|
|
48
49
|
steps: [
|
|
49
50
|
set('sc_items', 'sc_items', 'sendables(cargo)'),
|
|
@@ -91,6 +92,22 @@ const sendCopy = defineWorker({
|
|
|
91
92
|
})),
|
|
92
93
|
when('sc_ask_medium_read', '!sc_medium', set('sc_medium_pick', 'sc_medium', "cargo.choice === 'text' || cargo.choice === 'email' ? cargo.choice : ''")),
|
|
93
94
|
when('sc_no_medium_end', '!sc_medium', end('sc_no_medium_done')),
|
|
95
|
+
// another number or email, not given (prod 2026-11-19 14:57: "Can you text it to another number?" was texted to the
|
|
96
|
+
// number on file again): asked here, before any sender or the number on file is used
|
|
97
|
+
set('sc_other', 'sc_other', "typeof other_destination !== 'undefined' && other_destination === true && !(sc_medium === 'email' ? sc_email : sc_phone)"),
|
|
98
|
+
when('sc_other_number', "sc_other && sc_medium === 'text'", call('sc_other_number_call', 'ask-choice', {
|
|
99
|
+
question: 'What phone number should I text it to?', question_es: '¿A qué número de teléfono se lo envío?',
|
|
100
|
+
choices: [], accept_other: true, expect: 'number', digits: { min: 10, max: 11 },
|
|
101
|
+
})),
|
|
102
|
+
when('sc_other_number_read', "sc_other && sc_medium === 'text'", set('sc_other_number_set', 'sc_phone', "readPhone(cargo.choiceText || '')")),
|
|
103
|
+
when('sc_other_number_bad', "sc_other && sc_medium === 'text' && !sc_phone", say('sc_other_number_bad_say', "Sorry, I couldn't read that phone number." + ANYTHING_ELSE, 'Lo siento, no pude entender ese número de teléfono.' + ANYTHING_ELSE_ES)),
|
|
104
|
+
when('sc_other_number_end', "sc_other && sc_medium === 'text' && !sc_phone", end('sc_other_number_done', { outcome: 'unresolved', reason: 'no_phone_number' })),
|
|
105
|
+
when('sc_other_email_clear', "sc_other && sc_medium === 'email'", effect('sc_other_email_clear_set', "cargo.email = ''")),
|
|
106
|
+
when('sc_other_email', "sc_other && sc_medium === 'email'", call('sc_other_email_call', 'ask-email', {
|
|
107
|
+
question: 'What email address should I send it to?', question_es: '¿A qué correo electrónico se lo envío?', on_file: '',
|
|
108
|
+
})),
|
|
109
|
+
when('sc_other_email_read', "sc_other && sc_medium === 'email'", set('sc_other_email_set', 'sc_email', "cargo.email && validateEmail(String(cargo.email)) ? String(cargo.email) : ''")),
|
|
110
|
+
when('sc_other_email_end', "sc_other && sc_medium === 'email' && !sc_email", end('sc_other_email_done')),
|
|
94
111
|
// a sender item: its flow collects what it needs (destination, identity) and tells the caller every outcome
|
|
95
112
|
set('sc_given', 'sc_given', "sc_medium === 'email' ? sc_email : sc_phone"),
|
|
96
113
|
when('sc_sender_reset', '!!sc_item.sender', effect('sc_sender_reset_set', 'cargo.copyHandled = false')),
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -94,6 +94,7 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
94
94
|
export { readFormAnswer };
|
|
95
95
|
export { readArgument };
|
|
96
96
|
export { groundAmount };
|
|
97
|
+
export { joinSpokenNumbers };
|
|
97
98
|
export { readInputProfile };
|
|
98
99
|
export { formAcceptanceTrace };
|
|
99
100
|
export { resolveFormInputs };
|
|
@@ -243,6 +244,7 @@ import { matchInputs } from './match-inputs.js';
|
|
|
243
244
|
import { readFormAnswer } from './match-inputs.js';
|
|
244
245
|
import { readArgument } from './match-inputs.js';
|
|
245
246
|
import { groundAmount } from './match-inputs.js';
|
|
247
|
+
import { joinSpokenNumbers } from './match-inputs.js';
|
|
246
248
|
import { readInputProfile } from './match-inputs.js';
|
|
247
249
|
import { formAcceptanceTrace } from './match-inputs.js';
|
|
248
250
|
import { resolveFormInputs } from './form-state.js';
|
|
@@ -300,5 +302,5 @@ import { sendables } from './sendables.js';
|
|
|
300
302
|
import { chatTranscript } from './sendables.js';
|
|
301
303
|
import { conversationCopy } from './sendables.js';
|
|
302
304
|
import { CONVERSATION_KEY } from './sendables.js';
|
|
303
|
-
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, 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 };
|
|
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 };
|
|
304
306
|
//# 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;q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@ 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, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, readInputProfile, formAcceptanceTrace } from './match-inputs.js';
|
|
34
|
+
import { matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, 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
39
|
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, 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, };
|
|
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
41
|
/** The functions flows call by name, ready to spread into a host's approved functions. */
|
|
42
42
|
export const STANDARD_FUNCTIONS = {
|
|
43
43
|
continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse,
|
|
@@ -45,7 +45,7 @@ export const STANDARD_FUNCTIONS = {
|
|
|
45
45
|
clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome,
|
|
46
46
|
readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho,
|
|
47
47
|
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, 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,
|
|
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
49
|
validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, wholeSpokenNumber,
|
|
50
50
|
registerSendable, sendables, chatTranscript, conversationCopy,
|
|
51
51
|
};
|
|
@@ -4,6 +4,11 @@
|
|
|
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;
|
|
7
12
|
/**
|
|
8
13
|
* One input's reading of the answer: { value, evidence } or null. `evidence` is what the answer spent on it (digits
|
|
9
14
|
* 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":"AAkBA;;;;GAIG;AACH,sEAQC;
|
|
1
|
+
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,sEAQC;AAeD;;;kIAGkI;AAClI,oDAYC;AAoFD;;;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"}
|
|
@@ -42,6 +42,25 @@ const DIGIT_RUN = /\d(?:[\s.-]?\d|(?<=(?:^|\D)\d{1,3})(?:,\s?|\.\s)(?=\d))*/g;
|
|
|
42
42
|
function digitRuns(raw) {
|
|
43
43
|
return (raw.match(DIGIT_RUN) || []).map((r) => r.replace(/\D/g, ''));
|
|
44
44
|
}
|
|
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
|
+
}
|
|
45
64
|
// A pause speech-to-text writes between spoken groups (DIGIT_RUN joins across it).
|
|
46
65
|
const PAUSE = /,\s?|\.\s/;
|
|
47
66
|
// A choice reads its keys without the comma join: "1, 2" names two keys, not 12.
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:a59686f93c7ccb6644b3c9e7c30f5890b22fd0b22172f47acea3317d4d6cf723";
|
|
@@ -327,8 +327,14 @@ rules should decide.
|
|
|
327
327
|
|
|
328
328
|
**How the values are taken:**
|
|
329
329
|
|
|
330
|
-
- Each value is read by the readers as if said alone, then validated and stored like a typed answer, with the same
|
|
330
|
+
- Each value is read by the readers as if said alone, then validated and stored like a typed answer, with the same
|
|
331
331
|
acknowledgement, attempts and confirmation. A value read at a confirmation changes the form, which is confirmed again.
|
|
332
|
+
- An AMOUNT's digits come only from the caller's own words (jsfe 1.77). A model's amount (these arguments, or an
|
|
333
|
+
activation parameter intent detection extracted) is taken only where the caller said it as a whole number, read from
|
|
334
|
+
those words with their money mark (`groundAmount`); a number the caller did not say, or a piece of one ("43" in
|
|
335
|
+
"43, 4, 97"), is not taken.
|
|
336
|
+
- Extraction reads the latest message and the assistant's last message only, never the caller's earlier words (jsfe
|
|
337
|
+
1.78.1): a ZIP code said at an earlier question is never taken as a later request's phone number.
|
|
332
338
|
- Nothing read: the question is asked again, as without the declaration. Extraction failing behaves the same.
|
|
333
339
|
- Two readings of one input that differ take nothing: the question is asked again.
|
|
334
340
|
- A picked choice is applied first, then its arguments. An argument that answers the choice's own exclusive group
|
|
@@ -414,6 +420,60 @@ Each stage is one `aiCallback` call that carries instructions for both a classif
|
|
|
414
420
|
either, or race both. JSFE builds both sets of instructions and decodes both answers (`jsfe/host`), which keeps a
|
|
415
421
|
production host and a test harness on one implementation.
|
|
416
422
|
|
|
423
|
+
### Who reads what: options and descriptions
|
|
424
|
+
|
|
425
|
+
Every model in a turn decides from a closed list, and it sees only what is declared to it. Most "the model chose wrong"
|
|
426
|
+
symptoms are an option that was never offered, or offered under words that do not describe it. Check this first.
|
|
427
|
+
|
|
428
|
+
| Reader | Decides | Reads | Never sees |
|
|
429
|
+
| --- | --- | --- | --- |
|
|
430
|
+
| Deterministic readers | keys, numbers, emails, whole-answer phrases | the reply, against the question asked and what it invites | anything not a whole, exact match |
|
|
431
|
+
| Reply ranker | what a reply does with the question asked | each offered choice's `label`; without one, its key and up to six worded `phrases` | a choice's `description`; any option not offered |
|
|
432
|
+
| Stage 1 (intent) | which primary flow starts, or None | each primary's `description` | workers; parameters |
|
|
433
|
+
| Stage 2 (intent) and argument extraction | a flow's or a pick's arguments | each parameter's `description`; for a closed choice, each choice's `description`, else its `label` | the caller's earlier messages |
|
|
434
|
+
|
|
435
|
+
**What the ranker is offered at each kind of question:**
|
|
436
|
+
|
|
437
|
+
- **A form question with a `choice` profile:** its choices, the choices of the chain's other `choice` inputs the reader
|
|
438
|
+
would accept, and a person. A firm confirmation's YES, a `current_only` choice at another question, and text are
|
|
439
|
+
never offered.
|
|
440
|
+
- **A form question with any other profile** (`pattern`, `text`, `digits`, `amount`…): no options of its own; the chain's
|
|
441
|
+
other `choice` inputs, the built-in verdicts (`answers`, `abort`, `new_request`, `irrelevant`, `concern` where
|
|
442
|
+
declared) and a person.
|
|
443
|
+
- **A flow's contextual DISPATCH** (`onResponse: "continue"`): ONLY the step's `responseChoices`, plus the built-in
|
|
444
|
+
verdicts. Code after the DISPATCH that reads the reply for other options is reachable only when a reader reads them
|
|
445
|
+
first.
|
|
446
|
+
- **A provider menu** (`whole_phrases`): every fact with phrases, every action, `done` and a person.
|
|
447
|
+
|
|
448
|
+
**The traps, each seen in production:**
|
|
449
|
+
|
|
450
|
+
1. **An option handled only by a word list or a regex is invisible to the ranker.** Said as the whole reply, the reader
|
|
451
|
+
takes it. Inside a sentence the ranker cannot pick it, so the reply becomes `answers` or `irrelevant` and the question
|
|
452
|
+
is asked again. Example (2026-11-19): "It's okay, I wanna say thank you for your time" at a product list was not
|
|
453
|
+
read as DONE, because DONE was a regex after the DISPATCH and not in its `responseChoices`. **Fix:** declare it as a
|
|
454
|
+
choice with a label.
|
|
455
|
+
2. **A choice without a label is offered as its key and phrases.** A key like `4` or `other_method` tells the model
|
|
456
|
+
nothing. Every offered choice needs a `label` written for the ranker: what the caller does or asks, and what it is
|
|
457
|
+
not.
|
|
458
|
+
3. **The ranker and stage 2 read different fields.** `label` is the ranker's; `description` is stage 2's. A choice that
|
|
459
|
+
can be both picked at its question and extracted from a first message needs both. Editing one never changes the
|
|
460
|
+
other.
|
|
461
|
+
4. **A reply that fits no offered option is `answers`.** It is not routed anywhere: the question is asked again, counted
|
|
462
|
+
as an attempt. "Asked the same question again" usually means a missing option, not a reader defect. Example
|
|
463
|
+
(2026-11-19): a refund question at the order-status prompt heard the delivery line again until the order prompt
|
|
464
|
+
offered `other`.
|
|
465
|
+
5. **Stage 1 reads only descriptions, so a description is a routing rule.** One that reads as "any mention of X"
|
|
466
|
+
starts its flow on a question about X. Write the trigger as an action or a report, and give the near misses a
|
|
467
|
+
`Not:` with the right flow (or None). Example (2026-11-19): "Quería saber sobre la tarjeta doblada" started a
|
|
468
|
+
damaged-card case until ServiceCase's `Not:` said that asking about one is None.
|
|
469
|
+
6. **A reader that is too wide takes what the ranker should decide.** Readers are tight and exact on purpose: a whole
|
|
470
|
+
answer, or a signature that fits only one field. A reader widened to catch a phrase inside a sentence will also
|
|
471
|
+
catch it where it means something else. Widen the declared options instead, and let the ranker read the sentence.
|
|
472
|
+
|
|
473
|
+
**Diagnosing a wrong verdict:** read the turn's `reply_rank` (the verdict and its scores; the row does not list what was offered) and the step's offered
|
|
474
|
+
choices as the set declares them. Was the right option offered? Was its label written for this reply? Only when both
|
|
475
|
+
are yes is it the model's judgement, which is measured live (n of N) before anything changes.
|
|
476
|
+
|
|
417
477
|
## 5. Why the transactions stay safe
|
|
418
478
|
|
|
419
479
|
The conversational freedom above never reaches the transaction directly. These are the guarantees, and where each one
|
|
@@ -547,11 +607,13 @@ it from the company's documents.
|
|
|
547
607
|
6. **Sensitive decisions are bound.** Any action that charges, cancels or cannot be reversed declares
|
|
548
608
|
`confirm: {exact: true}`: it runs only on the exact values the caller confirmed. How the YES is read is separate: a
|
|
549
609
|
charge is asked as a firm confirmation, everything else softly, unless the form declares `confirm.confirmation`.
|
|
550
|
-
7. **
|
|
610
|
+
7. **Every option a caller may say is declared where the ranker sees it,** with a label written for the ranker. A word
|
|
611
|
+
list or a regex is a fast path for a whole answer, never the only way to an option.
|
|
612
|
+
8. **Descriptions are for detection only.** A primary's description says what starts it and what does not; caller
|
|
551
613
|
wording belongs in questions and fact renderers.
|
|
552
|
-
|
|
614
|
+
9. **`call` for a closed sub-task, `DISPATCH` for what the caller asked for.** A loop that grows the stack is a design
|
|
553
615
|
bug, and the validator refuses it.
|
|
554
|
-
|
|
616
|
+
10. **Test journeys, not just units.** Run the real engine on the real set: in order, out of order, all at once,
|
|
555
617
|
corrected, a mid-form question, a change of subject, a decline, voice and text, every language.
|
|
556
618
|
|
|
557
619
|
## Where to read next
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.80.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",
|