jsfe 1.93.2 → 1.94.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 +17 -7
- package/dist/helpers/index.d.ts +2 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +2 -2
- package/dist/helpers/sendables.d.ts +8 -4
- package/dist/helpers/sendables.d.ts.map +1 -1
- package/dist/helpers/sendables.js +18 -7
- package/dist/runtime-identity.js +1 -1
- 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":"AAoLA,0BAAgC"}
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* - A sender item runs its flow with {medium, destination, args} (destination: only what the caller gave): the sender
|
|
13
13
|
* collects the rest, sets cargo.copyHandled = true as it takes over and tells the caller every outcome. Without it (a
|
|
14
14
|
* missing sender) SendCopy says it could not send. A sender's declared media limit the medium (statement: email).
|
|
15
|
+
* - The web chat link (WEB_LINK_KEY, owner 2026-11-26: "can I continue this on my computer?") is made at send time by the
|
|
16
|
+
* host's get-web-chat-link tool. With no medium or destination named it is texted to the caller's number, else emailed to
|
|
17
|
+
* the email on file, else the medium is asked; any number or email the caller names is used, as for any item.
|
|
15
18
|
* No authentication gate here (owner rule: an authenticated caller's chat and documents are theirs to send anywhere;
|
|
16
19
|
* before authentication no reply holds account data). A sender flow gates its own document.
|
|
17
20
|
*/
|
|
@@ -31,23 +34,23 @@ const TEXT_WORDS = ['1', 'text', 'texto', 'sms', 'message', 'text message', 'men
|
|
|
31
34
|
const TEXT_MAX = 1600;
|
|
32
35
|
const EMAIL_WORDS = ['2', 'email', 'e-mail', 'mail', 'correo', 'correo electrónico', 'correo electronico', 'email address'];
|
|
33
36
|
const sendCopy = defineWorker({
|
|
34
|
-
contract: { role: 'router', summary: 'Sends a reply, registered document
|
|
37
|
+
contract: { role: 'router', summary: 'Sends a reply, registered document, the whole conversation or a link to continue it on the web, as the caller picks, by text or email, through the system send workers or the document\'s sender flow' },
|
|
35
38
|
id: 'send-copy',
|
|
36
39
|
name: 'SendCopy',
|
|
37
|
-
version: '1.
|
|
40
|
+
version: '1.2.0',
|
|
38
41
|
primary: true,
|
|
39
42
|
prompt: 'Send a copy',
|
|
40
43
|
prompt_es: 'Enviar una copia',
|
|
41
|
-
description: "Asks to be sent something by text or email, whatever it is ('email me that', 'text me the case number', 'send me the receipt', 'can I have that emailed to me', 'send me a copy of this chat', 'mándame eso por mensaje', 'me lo puede mandar por correo'). Not: continuing the conversation by text (SwitchToText).",
|
|
44
|
+
description: "Asks to be sent something by text or email, whatever it is ('email me that', 'text me the case number', 'send me the receipt', 'can I have that emailed to me', 'send me a copy of this chat', 'mándame eso por mensaje', 'me lo puede mandar por correo'), or asks to continue this conversation on the web or another device ('can I continue this on my computer?', 'send me a link to continue on the web', '¿puedo seguir esto en mi computadora?'). Not: continuing the conversation by text (SwitchToText).",
|
|
42
45
|
parameters: [
|
|
43
|
-
{ 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." },
|
|
46
|
+
{ 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; continuing on the web, a computer or another device is the link to continue on the web." },
|
|
44
47
|
{ 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')." },
|
|
45
48
|
{ name: 'destination', type: 'string', description: 'The phone number or email address the user gave to send it to, as given.' },
|
|
46
49
|
{ 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." },
|
|
47
50
|
],
|
|
48
51
|
variables: vars({
|
|
49
52
|
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: '',
|
|
50
|
-
sc_medium: '', sc_medium_q: '', sc_medium_q_es: '', sc_given: '', sc_other: false, sc_too_long: false, sc_media: [], sc_forced: '', sc_to: '', sc_subject: '', sc_content: '', sc_sent: false,
|
|
53
|
+
sc_medium: '', sc_medium_q: '', sc_medium_q_es: '', sc_given: '', sc_other: false, sc_too_long: false, sc_media: [], sc_forced: '', sc_to: '', sc_subject: '', sc_content: '', sc_sent: false, sc_link: '',
|
|
51
54
|
}),
|
|
52
55
|
steps: [
|
|
53
56
|
set('sc_items', 'sc_items', 'sendables(cargo)'),
|
|
@@ -78,9 +81,16 @@ const sendCopy = defineWorker({
|
|
|
78
81
|
set('sc_email', 'sc_email', "(String(typeof destination === 'string' ? destination : '').match(/[^\\s@]+@[^\\s@]+\\.[^\\s@]+/) || [''])[0].replace(/[.,;:]+$/, '')"),
|
|
79
82
|
set('sc_phone', 'sc_phone', "readPhone(typeof destination === 'string' ? destination : '')"),
|
|
80
83
|
set('sc_medium', 'sc_medium', "typeof medium === 'string' && (medium === 'text' || medium === 'email') ? medium : sc_email ? 'email' : sc_phone ? 'text' : ''"),
|
|
84
|
+
// the web chat link: texted to the caller's number when nothing was named, else emailed to the email on file
|
|
85
|
+
when('sc_link_text', "sc_item.kind === 'web_link' && !sc_medium && !!cargo.twilioNumber && !!textDestination(cargo)", set('sc_link_text_set', 'sc_medium', "'text'")),
|
|
86
|
+
when('sc_link_email', "sc_item.kind === 'web_link' && !sc_medium && validateEmail(String(cargo.otp_email || ''))", set('sc_link_email_set', 'sc_email', 'String(cargo.otp_email)')),
|
|
87
|
+
when('sc_link_email_medium', "sc_item.kind === 'web_link' && !sc_medium && !!sc_email", set('sc_link_email_medium_set', 'sc_medium', "'email'")),
|
|
88
|
+
when('sc_link', "sc_item.kind === 'web_link'", { id: 'sc_link_call', type: 'CALL-TOOL', tool: 'get-web-chat-link', variable: 'sc_link', args: {}, onFail: set('sc_link_failed', 'sc_link', "''") }),
|
|
89
|
+
when('sc_link_none', "sc_item.kind === 'web_link' && !sc_link", say('sc_link_none_say', "Sorry, I couldn't make a link to continue on the web." + ANYTHING_ELSE, 'Lo siento, no pude crear un enlace para continuar en la web.' + ANYTHING_ELSE_ES)),
|
|
90
|
+
when('sc_link_none_end', "sc_item.kind === 'web_link' && !sc_link", end('sc_link_none_done', { outcome: 'unresolved', reason: 'no_web_link' })),
|
|
81
91
|
// the media this item can go by: a sender's declared media; content by text only where the line has a sender and it
|
|
82
92
|
// fits one text message (TEXT_MAX), else by email
|
|
83
|
-
set('sc_content', 'sc_content', "sc_item.kind === 'conversation' ? conversationCopy(cargo.chatTurns, language) : String(sc_item.content || '')"),
|
|
93
|
+
set('sc_content', 'sc_content', "sc_item.kind === 'conversation' ? conversationCopy(cargo.chatTurns, language) : sc_item.kind === 'web_link' ? (language === 'es' ? 'Continúe nuestra conversación en la web: ' : 'Continue our conversation on the web: ') + sc_link : String(sc_item.content || '')"),
|
|
84
94
|
set('sc_too_long', 'sc_too_long', `!sc_item.sender && sc_content.length > ${TEXT_MAX}`),
|
|
85
95
|
set('sc_media', 'sc_media', "Array.isArray(sc_item.media) && sc_item.media.length ? sc_item.media : ((sc_item.sender || cargo.twilioNumber) && !sc_too_long ? ['text', 'email'] : ['email'])"),
|
|
86
96
|
set('sc_forced', 'sc_forced', "sc_media.length === 1 && !!sc_medium && sc_medium !== sc_media[0] ? sc_media[0] : ''"),
|
|
@@ -147,7 +157,7 @@ const sendCopy = defineWorker({
|
|
|
147
157
|
when('sc_email_read', "sc_medium === 'email' && !sc_to", set('sc_email_pick', 'sc_to', "cargo.email && validateEmail(String(cargo.email)) ? String(cargo.email) : ''")),
|
|
148
158
|
when('sc_email_none_end', "sc_medium === 'email' && !sc_to", end('sc_email_none_done')),
|
|
149
159
|
// send: a sender item runs its flow (it tells the caller); content goes as is
|
|
150
|
-
set('sc_subject', 'sc_subject', "language === 'es' ? 'Su copia de nuestra conversación' : sc_item.kind === 'conversation' ? 'Your copy of our conversation' : 'Your copy from our conversation'"),
|
|
160
|
+
set('sc_subject', 'sc_subject', "sc_item.kind === 'web_link' ? (language === 'es' ? 'Continúe nuestra conversación en la web' : 'Continue our conversation on the web') : language === 'es' ? 'Su copia de nuestra conversación' : sc_item.kind === 'conversation' ? 'Your copy of our conversation' : 'Your copy from our conversation'"),
|
|
151
161
|
when('sc_send_text', "sc_medium === 'text'", call('sc_send_text_call', 'send-text', { message: '{{sc_content}}' })),
|
|
152
162
|
when('sc_send_email', "sc_medium === 'email'", call('sc_send_email_call', 'send-email-message', { to: '{{sc_to}}', subject: '{{sc_subject}}', message: '{{sc_content}}', cc: '' })),
|
|
153
163
|
set('sc_sent', 'sc_sent', "sc_medium === 'text' ? cargo.textSent === true : cargo.emailSent === true"),
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -314,5 +314,6 @@ import { sendables } from './sendables.js';
|
|
|
314
314
|
import { chatTranscript } from './sendables.js';
|
|
315
315
|
import { conversationCopy } from './sendables.js';
|
|
316
316
|
import { CONVERSATION_KEY } from './sendables.js';
|
|
317
|
-
|
|
317
|
+
import { WEB_LINK_KEY } from './sendables.js';
|
|
318
|
+
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, isReaderFiller, 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, WEB_LINK_KEY };
|
|
318
319
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CACyC,iCAAiC;+BAIoO,wBAAwB;2CAHxP,0BAA0B;qCAA1B,0BAA0B;gCAA1B,0BAA0B;mCAC8F,qBAAqB;kCAArB,qBAAqB;iCAArB,qBAAqB;qCAArB,qBAAqB;iCAArB,qBAAqB;wCAArB,qBAAqB;mCAArB,qBAAqB;oCAArB,qBAAqB;6CAArB,qBAAqB;qCACvG,wBAAwB;2CAAxB,wBAAwB;+CAAxB,wBAAwB;uCAAxB,wBAAwB;gCACkK,wBAAwB;4BAAxB,wBAAwB;8BAAxB,wBAAwB;iCAAxB,wBAAwB;gCAAxB,wBAAwB;0CAAxB,wBAAwB;gCAAxB,wBAAwB;iCAAxB,wBAAwB;oCAAxB,wBAAwB;6BAAxB,wBAAwB;uCAAxB,wBAAwB;sCAAxB,wBAAwB;sCAAxB,wBAAwB;+BAAxB,wBAAwB;wCAAxB,wBAAwB;gCAoBvM,YAAY;8BAAZ,YAAY;kCAAZ,YAAY;uCAAZ,YAAY;qCAAZ,YAAY;qCAAZ,YAAY;gCAnB3G,mBAAmB;gCA2BiH,mBAAmB;4BAAnB,mBAAmB;sCAAnB,mBAAmB;8BATzJ,qBAAqB;6BAEmL,aAAa;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B,iBAAiB;8CAAjB,iBAAiB;sCAAjB,iBAAiB;uCAAjB,iBAAiB;iCAAjB,iBAAiB;oCAAjB,iBAAiB;kCAAjB,iBAAiB;mCAAjB,iBAAiB;oCAAjB,iBAAiB;wCAAjB,iBAAiB;sCAAjB,iBAAiB;kCAAjB,iBAAiB;sCAAjB,iBAAiB;sCAAjB,iBAAiB;sCAAjB,iBAAiB;gCAAjB,iBAAiB;6BAAjB,iBAAiB;yBAAjB,iBAAiB;gCAAjB,iBAAiB;iCAAjB,iBAAiB;oCAAjB,iBAAiB;gCAAjB,iBAAiB;kCAAjB,iBAAiB;oCAAjB,iBAAiB;8BAAjB,iBAAiB;wCAAjB,iBAAiB;mCAAjB,iBAAiB;qCAAjB,iBAAiB;mCAAjB,iBAAiB;oCAAjB,iBAAiB;iCAAjB,iBAAiB;kCAAjB,iBAAiB;yBACzqB,gBAAgB;yBAAhB,gBAAgB;gCAAhB,gBAAgB;4BAAhB,gBAAgB;8BAAhB,gBAAgB;+BACnC,iBAAiB;8BAAjB,iBAAiB;8BAAjB,iBAAiB;4BAI7B,iBAAiB;oCAAjB,iBAAiB;iCAHiB,oBAAoB;iCAApB,oBAAoB;kCAApB,oBAAoB;4BAApB,oBAAoB;iCA9BO,gBAAgB;0BAAhB,gBAAgB;+BAAhB,gBAAgB;iCAAhB,gBAAgB;iCAAhB,gBAAgB;6BAAhB,gBAAgB"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { formProposalPolicy, stageFormProposal, nextFormProposal, formProposalRe
|
|
|
5
5
|
import { formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor } from './proposal-contract.js';
|
|
6
6
|
import { cancelFormTask, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome } from './form-conversation.js';
|
|
7
7
|
import { takeChoiceOffer } from './choice-offer.js';
|
|
8
|
-
import { registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY } from './sendables.js';
|
|
8
|
+
import { registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY, WEB_LINK_KEY } from './sendables.js';
|
|
9
9
|
import { consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified } from './form-actions.js';
|
|
10
10
|
/**
|
|
11
11
|
* jsfe/helpers — the functions JSFE's system flows call from expressions, in ONE place for every host: reading an
|
|
@@ -39,7 +39,7 @@ import { joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone } fr
|
|
|
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, pickWholeChoice, withoutPromptEcho, isReaderFiller, 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, };
|
|
42
|
+
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, isReaderFiller, 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, WEB_LINK_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,
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
export function registerSendable(cargo: any, entry: any): boolean;
|
|
7
7
|
/**
|
|
8
8
|
* Everything the caller may ask to be sent now: the registered documents, the whole conversation (once the assistant has
|
|
9
|
-
* replied),
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* replied), the web chat link (off the web chat: cargo.voice, or channel voice / sms / whatsapp / email), then the last
|
|
10
|
+
* REPLY_COUNT non-empty assistant turns of cargo.chatTurns, newest last. Each item is {key, label, label_es?, kind, media?,
|
|
11
|
+
* content | sender+args}; the conversation is {key: CONVERSATION_KEY, kind: 'conversation'} with no content
|
|
12
|
+
* (conversationCopy makes it; SendCopy texts it when it fits one message, else emails it), and the link {key: WEB_LINK_KEY,
|
|
13
|
+
* kind: 'web_link'} with none (SendCopy asks the host's get-web-chat-link tool for it). A reply's key is "reply-<n>" (its
|
|
14
|
+
* turn number) and its label "Reply <n>: <first 120 characters>".
|
|
13
15
|
*/
|
|
14
16
|
export function sendables(cargo: any): any[];
|
|
15
17
|
/**
|
|
@@ -38,4 +40,6 @@ export function sendableDeclarationError(sendable: any): string;
|
|
|
38
40
|
export function syncDeclaredSendables(cargo: any, flows: any): void;
|
|
39
41
|
/** The whole conversation's key in sendables(cargo); like "reply-<n>", no flow may register or declare it. */
|
|
40
42
|
export const CONVERSATION_KEY: "conversation";
|
|
43
|
+
/** The web chat link's key in sendables(cargo); reserved like CONVERSATION_KEY. */
|
|
44
|
+
export const WEB_LINK_KEY: "web-link";
|
|
41
45
|
//# sourceMappingURL=sendables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendables.d.ts","sourceRoot":"","sources":["../../src/helpers/sendables.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sendables.d.ts","sourceRoot":"","sources":["../../src/helpers/sendables.js"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,kEAqCC;AAED;;;;;;;;GAQG;AACH,6CAeC;AAED;;;GAGG;AACH,wEAOC;AAGD;;;;;;GAMG;AACH,mEAwBC;AAED;;;GAGG;AACH,gEAeC;AAED;;;;GAIG;AACH,oEAsBC;AArLD,8GAA8G;AAC9G,+BAAgC,cAAc,CAAC;AAC/C,mFAAmF;AACnF,2BAA4B,UAAU,CAAC"}
|
|
@@ -9,13 +9,19 @@
|
|
|
9
9
|
* {n, role, text, source?}); nothing registers them. chatTranscript(turns) formats that list as "role: text" lines.
|
|
10
10
|
* Once the assistant has replied, the whole conversation is offered too (key CONVERSATION_KEY, email only): it carries no
|
|
11
11
|
* content, because its text is the caller's language's copy, conversationCopy(cargo.chatTurns, language), made at send time.
|
|
12
|
+
* Off the web chat (a call, SMS, WhatsApp, email) a link that continues this conversation on the web is offered too (key
|
|
13
|
+
* WEB_LINK_KEY, owner 2026-11-26): no content either, since the host's get-web-chat-link tool makes the link at send time.
|
|
12
14
|
*/
|
|
13
15
|
const REPLY_COUNT = 6;
|
|
14
16
|
const REPLY_LABEL_CHARS = 120;
|
|
15
17
|
/** The whole conversation's key in sendables(cargo); like "reply-<n>", no flow may register or declare it. */
|
|
16
18
|
export const CONVERSATION_KEY = 'conversation';
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
+
/** The web chat link's key in sendables(cargo); reserved like CONVERSATION_KEY. */
|
|
20
|
+
export const WEB_LINK_KEY = 'web-link';
|
|
21
|
+
const RESERVED_KEYS = `a key starting with "reply-", "${CONVERSATION_KEY}" or "${WEB_LINK_KEY}"`;
|
|
22
|
+
const reservedKey = (key) => key.startsWith('reply-') || key === CONVERSATION_KEY || key === WEB_LINK_KEY;
|
|
23
|
+
/** The channels a caller is not on the web chat in, where a link to continue on the web is offered. */
|
|
24
|
+
const OFF_WEB_CHANNELS = ['voice', 'sms', 'whatsapp', 'email'];
|
|
19
25
|
const SPEAKERS = { en: { user: 'You', assistant: 'Assistant' }, es: { user: 'Usted', assistant: 'Asistente' } };
|
|
20
26
|
const isText = (value) => typeof value === 'string' && value.trim() !== '';
|
|
21
27
|
const MEDIA = ['text', 'email'];
|
|
@@ -78,10 +84,12 @@ export function registerSendable(cargo, entry) {
|
|
|
78
84
|
}
|
|
79
85
|
/**
|
|
80
86
|
* Everything the caller may ask to be sent now: the registered documents, the whole conversation (once the assistant has
|
|
81
|
-
* replied),
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
87
|
+
* replied), the web chat link (off the web chat: cargo.voice, or channel voice / sms / whatsapp / email), then the last
|
|
88
|
+
* REPLY_COUNT non-empty assistant turns of cargo.chatTurns, newest last. Each item is {key, label, label_es?, kind, media?,
|
|
89
|
+
* content | sender+args}; the conversation is {key: CONVERSATION_KEY, kind: 'conversation'} with no content
|
|
90
|
+
* (conversationCopy makes it; SendCopy texts it when it fits one message, else emails it), and the link {key: WEB_LINK_KEY,
|
|
91
|
+
* kind: 'web_link'} with none (SendCopy asks the host's get-web-chat-link tool for it). A reply's key is "reply-<n>" (its
|
|
92
|
+
* turn number) and its label "Reply <n>: <first 120 characters>".
|
|
85
93
|
*/
|
|
86
94
|
export function sendables(cargo) {
|
|
87
95
|
const documents = Array.isArray(cargo?.sendables) ? cargo.sendables.filter((item) => isText(item?.key)).map((item) => (item.args ? { ...item, args: { ...item.args } } : { ...item })) : [];
|
|
@@ -94,7 +102,10 @@ export function sendables(cargo) {
|
|
|
94
102
|
const conversation = replies.length
|
|
95
103
|
? [{ key: CONVERSATION_KEY, label: 'The whole conversation', label_es: 'Toda nuestra conversación', kind: 'conversation' }]
|
|
96
104
|
: [];
|
|
97
|
-
|
|
105
|
+
const webLink = cargo?.voice === true || OFF_WEB_CHANNELS.includes(cargo?.channel)
|
|
106
|
+
? [{ key: WEB_LINK_KEY, label: 'A link to continue this conversation on the web', label_es: 'Un enlace para continuar esta conversación en la web', kind: 'web_link' }]
|
|
107
|
+
: [];
|
|
108
|
+
return [...documents, ...conversation, ...webLink, ...replies];
|
|
98
109
|
}
|
|
99
110
|
/**
|
|
100
111
|
* The conversation as the caller receives a copy of it: "You: …" / "Assistant: …" ("Usted" / "Asistente" in Spanish),
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:e79e2190dd5898c56afed262ef1d0db775ad798fe91843a5736b8d7c5f555007";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.94.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",
|