jsfe 1.77.1 → 1.78.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/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +14 -3
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +8 -4
- package/dist/helpers/contact.d.ts +13 -0
- package/dist/helpers/contact.d.ts.map +1 -1
- package/dist/helpers/contact.js +36 -0
- package/dist/helpers/form-conversation.d.ts.map +1 -1
- package/dist/helpers/form-conversation.js +4 -0
- package/dist/helpers/index.d.ts +7 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +3 -3
- package/dist/runtime-identity.js +1 -1
- package/docs/copilot-reference.md +3 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA6HA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAsGD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EC;AACD;;;GAGG;AACH;;;;;;EAGC;
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA6HA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAsGD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EC;AACD;;;GAGG;AACH;;;;;;EAGC;AAunBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAh8BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmJ9G,4CAEqI;AAwgCrI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
|
package/dist/forms/flows.js
CHANGED
|
@@ -478,6 +478,10 @@ const collectInput = {
|
|
|
478
478
|
// `accumulate` (opt-in, digit inputs): a number said in groups across turns ("4347", "6971 2210"…) is kept and joined;
|
|
479
479
|
// short of the input's minimum the next question is "Go on." Anything that is not digits drops the partial.
|
|
480
480
|
SET('ci_partial_join', 'ci_partial', "(function () { var state = cargo.forms[form]; if (!ci_spec || ci_spec.accumulate !== true || !ci_spec.digits) return ''; var said = String(cargo.choiceText || '').trim(); var data = state.data = state.data || {}; var key = '__partial_' + current; if (!/^[0-9][0-9\\s.,-]*$/.test(said)) { delete data[key]; return ''; } var joined = String(data[key] || '') + said.replace(/[^0-9]/g, ''); var starts = ci_spec.accumulate_first ? new RegExp(ci_spec.accumulate_first) : null; if (!data[key] && starts && !starts.test(joined)) return ''; if (joined.length < Number(ci_spec.digits.min || 0)) { data[key] = joined; var fb = state.feedback || {}; fb[current] = 'partial'; state.feedback = fb; return 'hold'; } delete data[key]; cargo.choiceText = joined; cargo.choice = joined; return 'joined'; })()"),
|
|
481
|
+
// An email at a known provider said without its ending ("Cecilia 41, at Yahoo."): it is kept and the caller is asked
|
|
482
|
+
// only what comes after the provider; an ending alone on the next turn completes it, any other reply drops it
|
|
483
|
+
// (owner 2026-11-18, prod 11-18 17:30). An unknown domain is never guessed: the address is asked again.
|
|
484
|
+
SET('ci_email_join', 'ci_partial', "ci_partial ? ci_partial : (function () { var state = cargo.forms[form]; var email = !!ci_spec && (ci_spec.profile && ci_spec.profile.kind === 'email' || (ci_spec.any_of || []).some(function (i) { return i.profile && i.profile.kind === 'email'; })); if (!email) return ''; var data = state.data = state.data || {}; var key = '__email_' + current; var said = String(cargo.choiceText || '').trim(); var held = String(data[key] || ''); delete data[key]; var end = held ? emailEnding(said) : ''; if (end) { cargo.choiceText = held + end; cargo.choice = held + end; return 'joined'; } var part = emailWithoutEnding(said); if (!part) return ''; data[key] = part; var fb = state.feedback || {}; fb[current] = 'email_ending'; state.feedback = fb; return 'hold'; })()"),
|
|
481
485
|
WHEN('ci_partial_hold', "ci_partial === 'hold'", END('ci_partial_wait')),
|
|
482
486
|
// A whole NO at a question that does not read it, in a form (or a sub-form of one) that declares `on_no`: that
|
|
483
487
|
// form's worker answers it (a payment starts its selection again), instead of any field or the reply ranker; the
|
|
@@ -699,7 +703,7 @@ const readFormChoice = {
|
|
|
699
703
|
const readConfirmReply = {
|
|
700
704
|
id: 'read-confirm-reply', name: 'ReadConfirmReply', version: '1.4.0', scope: 'isolated', description: 'Rank an unreadable answer to a confirmation: it declines (NO), picks another of the form\'s choices (a correction, read as that input\'s answer), says a named field read back is wrong (confirm.named_fields: that input is asked again), asks for a person, or is asked again; a withdrawal or a new request leaves with saved form progress. A soft confirmation is also offered YES, which confirms; a firm one never is.',
|
|
701
705
|
parameters: [{ name: 'form', type: 'string' }, { name: 'confirmation', type: 'string' }, { name: 'question', type: 'string' }, { name: 'question_es', type: 'string' }, { name: 'named_fields', type: 'boolean' }, { name: 'reply_context', type: 'string' }, { name: 'rank_parameters', type: 'array' }, { name: 'invites', type: 'array' }],
|
|
702
|
-
variables: vars({ confirmation: '', question: '', question_es: '', asked: '', ranked: [], reply: null, chain: null, others: [], fields: [], field: null, picked: null, reading: null, named_fields: false, prompt: null, field_arguments: [], corrections: [], reply_context: '', stay: false, rank_parameters: [], invites: [], rank_params: [], args: null }),
|
|
706
|
+
variables: vars({ confirmation: '', question: '', question_es: '', asked: '', ranked: [], reply: null, chain: null, others: [], fields: [], field: null, picked: null, reading: null, named_fields: false, prompt: null, field_arguments: [], corrections: [], reply_context: '', stay: false, rank_parameters: [], invites: [], rank_params: [], edits: [], edit: null, edit_hits: [], args: null }),
|
|
703
707
|
steps: [
|
|
704
708
|
SET('confirm_asked', 'asked', "(language === 'es' && question_es ? question_es : question)+(reply_context ? ' '+reply_context : '')"),
|
|
705
709
|
SET('confirm_stay', 'stay', "formMustComplete(cargo,form,'__confirm')"),
|
|
@@ -713,7 +717,11 @@ const readConfirmReply = {
|
|
|
713
717
|
SET('confirm_fields', 'fields', "named_fields === true || named_fields === 'true' ? (chain || []).filter(function(i){var v=cargo.forms[form] && cargo.forms[form].values;return i.form===form && !i.confirmation && Array.isArray(i.names) && i.names.length && v && (v[i.name]!==undefined && v[i.name]!==null && v[i.name]!=='' || i.declinable===true && Object.prototype.hasOwnProperty.call(v,i.name) && v[i.name]===null);}).map(function(i){var l=String(i.label || i.names[0]),none=cargo.forms[form].values[i.name]===null;return {key:'field:'+i.name,label:none ? 'gives a '+l+' (the read back has none)' : 'says the '+l+' read back is wrong, or gives a different '+l,owner:{form:i.form,name:i.name}};}) : []"),
|
|
714
718
|
// A correction may name several fields ('it is Long Beach, apartment 4'): any field's pick extracts every named field's new value.
|
|
715
719
|
SET('confirm_field_arguments', 'field_arguments', "fields.map(function(c){var i=(chain || []).filter(function(i){return i.form===c.owner.form && i.name===c.owner.name;})[0];var l=String(i.label || i.names[0]);return {name:c.owner.name,type:'string',description:'The correct '+(i.argument_description || l)+' the caller gives now. Leave it empty when they give none.'};})"),
|
|
716
|
-
|
|
720
|
+
// An input with confirm_edit (a text input; owner 2026-11-18, prod 11-18 CA57c8d5: an unauthorized-purchase case read back
|
|
721
|
+
// with only its date, and the amount and a second charge said after it were 'not caught' three times): its read-back may be
|
|
722
|
+
// added to or replaced in the caller's own words. ADD appends the reply, REPLACE puts it in place; the form is confirmed again.
|
|
723
|
+
SET('confirm_edits', 'edits', "(chain || []).filter(function(i){var v=cargo.forms[form] && cargo.forms[form].values;return i.form===form && i.confirm_edit===true && i.profile && i.profile.kind==='text' && v && typeof v[i.name]==='string' && !!v[i.name].trim();}).reduce(function(all,i){var l=String(i.label || i.name);return all.concat([{key:'add:'+i.name,label:'add: gives more details for the '+l+' read back, keeping what it says',owner:{form:i.form,name:i.name},mode:'add'},{key:'replace:'+i.name,label:'replace: says the '+l+' read back is wrong and gives a different one instead',owner:{form:i.form,name:i.name},mode:'replace'}]);},[])"),
|
|
724
|
+
rankedChoices('confirm_ranked_choices', "(confirmation==='soft' ? [{key:'yes',label:'yes: agrees to what the question asks to confirm'}] : []).concat([{key:'no',label:'no: declines or refuses what the question asks to confirm'}]).concat(others.map(function(c){return Object.assign({key:c.key,label:c.label},c.parameters ? {parameters:c.parameters.map(function(p){return {name:p.name,type:p.type || 'string',description:p.description};})} : {});})).concat(fields.map(function(c){return {key:c.key,label:c.label,parameters:field_arguments};})).concat(edits.map(function(c){return {key:c.key,label:c.label};}))"),
|
|
717
725
|
// confirm.rank_parameters: values extracted when the ranker says the reply answers (owner 2026-11-06), read as RANK_ARGUMENTS_JS says
|
|
718
726
|
SET('confirm_rank_params', 'rank_params', "(Array.isArray(rank_parameters) ? rank_parameters : []).map(function(p){return {name:p.name,type:p.type || 'string',description:p.description};})"),
|
|
719
727
|
rankedDispatch('confirm_dispatch', 'confirmation_not_matched', true, 'rank_params'),
|
|
@@ -742,8 +750,11 @@ const readConfirmReply = {
|
|
|
742
750
|
SET('confirm_corrections', 'corrections', "field && reply.arguments ? fields.reduce(function(all,c){var said=String(reply.arguments[c.owner.name] || '').trim();return said ? all.concat(enrichFormMatches(readArgument(said, cargo.choiceText, chain, c.owner, said), chain, form, [c.owner.name], c.owner.name).hits) : all;},[]) : []"),
|
|
743
751
|
WHEN('confirm_correct', 'corrections.length', FLOW('confirm_correct_accept', 'collect-input-accept', 'call', { hits: '{{corrections}}' })),
|
|
744
752
|
WHEN('confirm_field_reset', 'field && !corrections.length', SIDE('confirm_field_ask', '(resetFormInputs(cargo, field.owner.form, [field.owner.name]), true)')),
|
|
753
|
+
SET('confirm_edit', 'edit', "edits.filter(function(c){return reply && c.key===reply.key;})[0] || null"),
|
|
754
|
+
SET('confirm_edit_hits', 'edit_hits', "(function(){if(!edit)return [];var said=String(cargo.choiceText || '').trim();if(!said)return [];var old=String((cargo.forms[edit.owner.form].values || {})[edit.owner.name] || '').trim();var value=edit.mode==='add' ? old.replace(/[\\s.]+$/,'')+'. '+said : said.replace(/^(?:no|nope)\\s*[,.!]\\s*/i,'');return enrichFormMatches(readArgument(value, cargo.choiceText, chain, edit.owner, ''), chain, form, [edit.owner.name], edit.owner.name).hits;})()"),
|
|
755
|
+
WHEN('confirm_edit_accept', 'edit_hits.length', FLOW('confirm_edit_accept_flow', 'collect-input-accept', 'call', { hits: '{{edit_hits}}' })),
|
|
745
756
|
WHEN('confirm_args_accept', '!picked && args.hits.length', FLOW('confirm_args_accept_flow', 'collect-input-accept', 'call', { hits: '{{args.hits}}' })),
|
|
746
|
-
SIDE('confirm_ranked', "(cargo.confirmRanked=reading && reading.hits.length || field || args.hits.length ? 'changed' : reply && (reply.key==='yes' || reply.key==='no') ? reply.key : 'none',true)")
|
|
757
|
+
SIDE('confirm_ranked', "(cargo.confirmRanked=reading && reading.hits.length || field || args.hits.length || edit_hits.length ? 'changed' : reply && (reply.key==='yes' || reply.key==='no') ? reply.key : 'none',true)")
|
|
747
758
|
]
|
|
748
759
|
};
|
|
749
760
|
const collectContextualAnswer = formFlow({ id: 'collect-contextual-answer', name: 'CollectContextualAnswer', description: 'Collect one open-ended answer using contextual DISPATCH and preserve the caller wording.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAgDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAiBC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAMC;AAkHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AA0JD,8EAGC;
|
|
1
|
+
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAgDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAiBC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAMC;AAkHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AA0JD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AAzQD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AA4RzC,0BAAsK"}
|
|
@@ -445,17 +445,21 @@ export function emailReadback(address, voice, es = false) {
|
|
|
445
445
|
return (es ? 'Tengo ' : 'I have ') + said + (es ? '. ¿Es correcto? ' : '. Is that right? ') + (es ? voice ? 'Presione 1 o diga' : 'Escriba' : voice ? 'Press 1 or say' : 'Type') + (es ? ' SÍ, o ' : ' YES, or ') + (es ? voice ? 'presione 2 o diga' : 'escriba' : voice ? 'press 2 or say' : 'type') + (es ? ' NO.' : ' NO.');
|
|
446
446
|
}
|
|
447
447
|
const email = worker('ask-email', 'AskEmail', 'Collect an email through shared FORM matching, retaining field-specific spelling and readback behavior.', { scope: 'isolated', parameters: [param('question', 'English email question'), param('question_es', 'Spanish email question'), param('on_file', 'Known email offered by OK'), param('attempt', 'Retry attempt'), param('why', 'invalid, retry or more'), param('confirm', 'Read back a caller-supplied known address'), param('parent_form', 'Owning task FORM instance'), param('email_state', 'Internal field protocol state', 'object')], variables: vars({ question: '', question_es: '', on_file: '', attempt: '', why: '', confirm: '', parent_form: '', email_state: null, email_question: '', email_question_es: '', email_raw: '', email_found: '', email_spelling: false, email_new: false, email_choice: '', email_readback: '', email_readback_es: '', email_choices: EMAIL_CHOICES, email_profiles_base: [{ name: 'email_address', label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' } }, { ...raw, form_client: false }], email_profiles: [], email_confirm_profiles: [{ name: 'decision', label: 'email confirmation', label_es: 'confirmación de correo', profile: { kind: 'choice', choices: [{ key: 'no', phrases: ['2', 'no', 'wrong', 'incorrect', 'incorrecto'] }, { key: 'yes', phrases: ['1', 'yes', 'sí', 'si', 'correct', 'correcto'] }] } }, raw] }), contract: { role: 'collector', summary: 'Email field spelling and readback service', result: { path: 'cargo.email', type: 'string' } }, steps: [
|
|
448
|
-
set('email_protocol', 'email_state', "email_state || {question:question,question_es:question_es || question,on_file:on_file,confirm:confirm === true || confirm === 'true',attempt:Number(attempt || 0),why:why,draft:why === 'more'?String(cargo.emailDraft || ''):'',parent_form:parent_form}"),
|
|
448
|
+
set('email_protocol', 'email_state', "email_state || {question:question,question_es:question_es || question,on_file:on_file,confirm:confirm === true || confirm === 'true',attempt:Number(attempt || 0),why:why,draft:why === 'more'?String(cargo.emailDraft || ''):'',ending:'',parent_form:parent_form}"),
|
|
449
449
|
set('email_profiles', 'email_profiles', "email_profiles_base.concat(email_state.on_file ? [{name:'known_email_choice',label:'email destination choice',label_es:'opción de destino del correo',profile:{kind:'choice',choices:[{key:'ok',phrases:email_choices.ok},{key:'another',phrases:email_choices.another}]}}] : [])"),
|
|
450
|
-
set('email_question', 'email_question', "email_state.why === 'more' ? 'Got it. Go on.' : (email_state.attempt>0 ? email_state.why === 'retry' ? \"Okay, let's try again. \" : \"That doesn't look like an email address. \" : '')+email_state.question"),
|
|
451
|
-
set('email_question_es', 'email_question_es', "email_state.why === 'more' ? 'Entendido. Continúe.' : (email_state.attempt>0 ? email_state.why === 'retry' ? 'De acuerdo, intentemos de nuevo. ' : 'Eso no parece un correo electrónico. ' : '')+email_state.question_es"),
|
|
450
|
+
set('email_question', 'email_question', "email_state.why === 'ending' ? 'What comes after '+email_state.ending.split('@')[1]+'? For example, dot com.' : email_state.why === 'more' ? 'Got it. Go on.' : (email_state.attempt>0 ? email_state.why === 'retry' ? \"Okay, let's try again. \" : \"That doesn't look like an email address. \" : '')+email_state.question"),
|
|
451
|
+
set('email_question_es', 'email_question_es', "email_state.why === 'ending' ? '¿Qué sigue después de '+email_state.ending.split('@')[1]+'? Por ejemplo, punto com.' : email_state.why === 'more' ? 'Entendido. Continúe.' : (email_state.attempt>0 ? email_state.why === 'retry' ? 'De acuerdo, intentemos de nuevo. ' : 'Eso no parece un correo electrónico. ' : '')+email_state.question_es"),
|
|
452
452
|
call('email_collect', 'collect-service-answer', { profiles: '{{email_profiles}}', question: '{{email_question}}', question_es: '{{email_question_es}}', keypad: { min: 1, max: 1 }, parent_form: '{{email_state.parent_form}}', context: 'email', context_es: 'correo' }),
|
|
453
453
|
set('email_raw', 'email_raw', 'String(cargo.serviceAnswer.raw || "")'),
|
|
454
454
|
cases('email_command', { "condition: isAgentRequest(email_raw)": call('email_agent', 'live-agent-requested', undefined, 'reboot'), "condition: isExitRequest(email_raw)": call('email_exit', 'contact-support', { support_context: 'email', support_context_es: 'correo' }, 'reboot'), default: effect('email_is_answer', 'true') }),
|
|
455
455
|
set('email_choice', 'email_choice', "pickChoice(email_raw,[{key:'ok',phrases:email_choices.ok},{key:'another',phrases:email_choices.another}],false)"),
|
|
456
456
|
when('email_other_request_clear', "!email_choice && !readEmail(email_raw) && isOtherRequest(email_raw,'email')", effect('email_other_request_draft', "(email_state.draft='',cargo.emailDraft='',cargo.email='',true)")),
|
|
457
457
|
when('email_other_request', "!email_choice && !readEmail(email_raw) && isOtherRequest(email_raw,'email')", { id: 'email_dispatch_request', type: 'DISPATCH' }),
|
|
458
|
-
set('email_parse', 'email_found', "(email_state.draft ? readEmail(email_state.draft+' '+email_raw) : '') || readEmail(email_raw) || (email_choice === 'ok' && email_state.on_file ? String(email_state.on_file).toLowerCase() : '')"),
|
|
458
|
+
set('email_parse', 'email_found', "(email_state.ending && emailEnding(email_raw) ? email_state.ending+emailEnding(email_raw) : '') || (email_state.draft ? readEmail(email_state.draft+' '+email_raw) : '') || readEmail(email_raw) || (email_choice === 'ok' && email_state.on_file ? String(email_state.on_file).toLowerCase() : '')"),
|
|
459
|
+
// a known provider without its ending (owner 2026-11-18): only what comes after the provider is asked; any other reply drops it
|
|
460
|
+
effect('email_ending_drop', "(email_state.ending='',email_state.why=email_state.why === 'ending' ? '' : email_state.why,true)"),
|
|
461
|
+
when('email_keep_ending', "!email_found && !email_choice && !!emailWithoutEnding(email_raw)", effect('email_ending_draft', "(email_state.ending=emailWithoutEnding(email_raw),email_state.why='ending',email_state.draft='',cargo.emailDraft='',true)")),
|
|
462
|
+
when('email_ask_ending', "!email_found && !!email_state.ending", call('email_ending_field', 'ask-email', { email_state: '{{email_state}}' }, 'replace')),
|
|
459
463
|
set('email_fragment', 'email_spelling', "!email_found && !email_choice && isSpelledFragment(email_raw) && email_state.draft.length<200"),
|
|
460
464
|
when('email_keep_spelling', 'email_spelling', effect('email_draft', "(email_state.draft=(email_state.draft+' '+email_raw).trim(),email_state.why='more',cargo.emailDraft=email_state.draft,true)")),
|
|
461
465
|
when('email_more', 'email_spelling', call('email_more_field', 'ask-email', { email_state: '{{email_state}}' }, 'replace')),
|
|
@@ -10,6 +10,19 @@
|
|
|
10
10
|
export function readEmail(text: any, { literal }?: {
|
|
11
11
|
literal?: boolean | undefined;
|
|
12
12
|
}): string;
|
|
13
|
+
/**
|
|
14
|
+
* An address at a known provider said without its ending ("Cecilia 41, at Yahoo."): its name and provider
|
|
15
|
+
* ("cecilia41@yahoo"), so the caller is asked only for what comes after the provider (owner 2026-11-18, prod 11-18 17:30:
|
|
16
|
+
* the whole address was asked again). gmail is completed by readEmail; an unknown domain is never guessed, so it is ''.
|
|
17
|
+
*/
|
|
18
|
+
export function emailWithoutEnding(text: any): string;
|
|
19
|
+
/**
|
|
20
|
+
* The ending a caller gives on its own after being asked what comes after the provider ("Punto com.", "dot net",
|
|
21
|
+
* ".com", "com", "punto com punto mx"): ".com", ".net", ".es", ".com.mx" … or '' for any other reply. Whole reply only.
|
|
22
|
+
*/
|
|
23
|
+
export function emailEnding(text: any): string;
|
|
24
|
+
/** An address as it is read back: on a call letter by letter, with at / dot (arroba / punto) said as words. */
|
|
25
|
+
export function emailSaid(address: any, voice: any, es?: boolean): string;
|
|
13
26
|
/**
|
|
14
27
|
* True when an answer tries to give an email address that could not be read: an @, "arroba", or a known provider's name
|
|
15
28
|
* ("at gmail", "Yahoo"), so the caller hears the email was incomplete rather than that a phone number was invalid (prod
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../src/helpers/contact.js"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AACH;;WAiDC;AAoBD;;;;GAIG;AACH,iDAEC;AAID;;;;;GAKG;AACH,0CAWC;AAED;;;;;GAKG;AACH,0DAgBC;AAED,qHAAqH;AACrH,2DAIC;AAED;;;;GAIG;AACH;;;SAmBC;AAED;;;GAGG;AACH,sDAOC;AAED;;;;;GAKG;AACH,yEAUC;AAQD;;;;;GAKG;AACH,qDAIC;AAED,mHAAmH;AACnH,oDAIC"}
|
|
1
|
+
{"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../src/helpers/contact.js"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AACH;;WAiDC;AAED;;;;GAIG;AACH,sDASC;AAED;;;GAGG;AACH,+CASC;AAED,+GAA+G;AAC/G,0EAGC;AAoBD;;;;GAIG;AACH,iDAEC;AAID;;;;;GAKG;AACH,0CAWC;AAED;;;;;GAKG;AACH,0DAgBC;AAED,qHAAqH;AACrH,2DAIC;AAED;;;;GAIG;AACH;;;SAmBC;AAED;;;GAGG;AACH,sDAOC;AAED;;;;;GAKG;AACH,yEAUC;AAQD;;;;;GAKG;AACH,qDAIC;AAED,mHAAmH;AACnH,oDAIC"}
|
package/dist/helpers/contact.js
CHANGED
|
@@ -76,6 +76,42 @@ export function readEmail(text, { literal = false } = {}) {
|
|
|
76
76
|
return /^[a-z0-9][a-z0-9._%+-]*@[a-z0-9.-]+\.[a-z]{2,}$/.test(email) && (!guessed || /[a-z]/i.test(local.join(''))) ? email : '';
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* An address at a known provider said without its ending ("Cecilia 41, at Yahoo."): its name and provider
|
|
81
|
+
* ("cecilia41@yahoo"), so the caller is asked only for what comes after the provider (owner 2026-11-18, prod 11-18 17:30:
|
|
82
|
+
* the whole address was asked again). gmail is completed by readEmail; an unknown domain is never guessed, so it is ''.
|
|
83
|
+
*/
|
|
84
|
+
export function emailWithoutEnding(text) {
|
|
85
|
+
const t = String(text ?? '').trim().replace(/[.,;:!?]+$/, '');
|
|
86
|
+
if (!t || readEmail(t) || !/\b(?:hotmail|hot mail|yahoo|outlook|icloud|aol)\s*$/i.test(t)) {
|
|
87
|
+
return '';
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const whole = readEmail(t.replace(/hot mail\s*$/i, 'hotmail') + ' dot com');
|
|
91
|
+
const m = whole.match(/^(.+@(?:hotmail|yahoo|outlook|icloud|aol))\.com$/);
|
|
92
|
+
return m ? m[1] : '';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The ending a caller gives on its own after being asked what comes after the provider ("Punto com.", "dot net",
|
|
97
|
+
* ".com", "com", "punto com punto mx"): ".com", ".net", ".es", ".com.mx" … or '' for any other reply. Whole reply only.
|
|
98
|
+
*/
|
|
99
|
+
export function emailEnding(text) {
|
|
100
|
+
const t = String(text ?? '').trim().toLowerCase().replace(/[!?,;]+$/, '').replace(/\.$/, '').trim();
|
|
101
|
+
const dot = '(?:dot|punto|punt|ponto|\\.)';
|
|
102
|
+
const m = t.match(new RegExp('^(?:' + dot + '\\s*)?(com|con|net|org|edu|es|mx|co)(?:\\s*' + dot + '?\\s*(mx|uk|ar|co|es))?$'));
|
|
103
|
+
if (!m) {
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return '.' + (m[1] === 'con' ? 'com' : m[1]) + (m[2] ? '.' + m[2] : '');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** An address as it is read back: on a call letter by letter, with at / dot (arroba / punto) said as words. */
|
|
111
|
+
export function emailSaid(address, voice, es = false) {
|
|
112
|
+
const said = String(address || '');
|
|
113
|
+
return voice ? said.split('').join(' ').replace(/ @ /, es ? ' arroba ' : ' at ').replace(/ \. /g, es ? ' punto ' : ' dot ').replace(/ _ /g, es ? ' guion bajo ' : ' underscore ').replace(/ - /g, es ? ' guion ' : ' dash ') : said;
|
|
114
|
+
}
|
|
79
115
|
const PROVIDER_WITH_ENDING = /\s+((?:gmail|hotmail|yahoo|outlook|icloud|aol)\.(?:com|net|es|com\.mx|co\.uk)\b)/i;
|
|
80
116
|
/**
|
|
81
117
|
* A provider's domain as callers say it: "gmail" alone is gmail.com (the one consumer Gmail address), and a misheard
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-conversation.d.ts","sourceRoot":"","sources":["../../src/helpers/form-conversation.js"],"names":[],"mappings":"AAMA,0EAGC;AACD;;;;;GAKG;AACH,0FAKC;AACD;;;;;;GAMG;AACH,2EAOC;AACD,uJAAuJ;AACvJ,2EAUC;AACD;6GAC6G;AAC7G,2EAGC;AAYD,kHAAkH;AAClH,oDAGC;AACD,oEAGC;AACD;;qGAEqG;AACrG,2EAWC;AAKD;;0GAE0G;AAC1G,gFAIC;AACD;;;;;GAKG;AACH;;;SAQC;AACD;+CAC+C;AAC/C,sEAGC;AACD;;;GAGG;AACH,+
|
|
1
|
+
{"version":3,"file":"form-conversation.d.ts","sourceRoot":"","sources":["../../src/helpers/form-conversation.js"],"names":[],"mappings":"AAMA,0EAGC;AACD;;;;;GAKG;AACH,0FAKC;AACD;;;;;;GAMG;AACH,2EAOC;AACD,uJAAuJ;AACvJ,2EAUC;AACD;6GAC6G;AAC7G,2EAGC;AAYD,kHAAkH;AAClH,oDAGC;AACD,oEAGC;AACD;;qGAEqG;AACrG,2EAWC;AAKD;;0GAE0G;AAC1G,gFAIC;AACD;;;;;GAKG;AACH;;;SAQC;AACD;+CAC+C;AAC/C,sEAGC;AACD;;;GAGG;AACH,+GAcC;AAMD,oEAOC;AACD,8EAKC;AAED,yGAAyG;AACzG;;;;;;;;;;;;;;;;;;;;EAUC;AAED,sGAAsG;AACtG;;;;;;;;;;;;;;;;;;;;EAeC;AAED;2HAC2H;AAC3H,8EAOC"}
|
|
@@ -174,6 +174,10 @@ export function formInputPrompt(cargo, id, input, spec, data = {}, language = 'e
|
|
|
174
174
|
const retry = written('retry') || (es ? spec.retry_es : spec.retry);
|
|
175
175
|
if (feedback === 'partial')
|
|
176
176
|
return es ? 'Continúe.' : 'Go on.';
|
|
177
|
+
if (feedback === 'email_ending') {
|
|
178
|
+
const provider = String(cargo.forms?.[id]?.data?.['__email_' + input] || '').split('@')[1] || '';
|
|
179
|
+
return es ? `¿Qué sigue después de ${provider}? Por ejemplo, punto com.` : `What comes after ${provider}? For example, dot com.`;
|
|
180
|
+
}
|
|
177
181
|
// What a validator said about the last answer this turn (keepFormLine) leads the question.
|
|
178
182
|
const lead = lineForms(cargo, id).flatMap(state => state.lines || []).map(x => es ? x.message_es || x.message : x.message).filter(Boolean).join('\n\n');
|
|
179
183
|
const body = feedback === 'first' ? formFirstLine(cargo, id, input, es) + (retry || question)
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -54,6 +54,9 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
54
54
|
export { pickChoice };
|
|
55
55
|
export { withoutPromptEcho };
|
|
56
56
|
export { readEmail };
|
|
57
|
+
export { emailWithoutEnding };
|
|
58
|
+
export { emailEnding };
|
|
59
|
+
export { emailSaid };
|
|
57
60
|
export { readPhone };
|
|
58
61
|
export { readInternationalPhone };
|
|
59
62
|
export { readIdentifier };
|
|
@@ -200,6 +203,9 @@ import { amountInAnswer } from './answer.js';
|
|
|
200
203
|
import { pickChoice } from './answer.js';
|
|
201
204
|
import { withoutPromptEcho } from './answer.js';
|
|
202
205
|
import { readEmail } from './contact.js';
|
|
206
|
+
import { emailWithoutEnding } from './contact.js';
|
|
207
|
+
import { emailEnding } from './contact.js';
|
|
208
|
+
import { emailSaid } from './contact.js';
|
|
203
209
|
import { readPhone } from './contact.js';
|
|
204
210
|
import { readInternationalPhone } from './contact.js';
|
|
205
211
|
import { readIdentifier } from './contact.js';
|
|
@@ -294,5 +300,5 @@ import { sendables } from './sendables.js';
|
|
|
294
300
|
import { chatTranscript } from './sendables.js';
|
|
295
301
|
import { conversationCopy } from './sendables.js';
|
|
296
302
|
import { CONVERSATION_KEY } from './sendables.js';
|
|
297
|
-
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, 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 };
|
|
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 };
|
|
298
304
|
//# 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;iCAAnB,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;4BAE7B,iBAAiB;oCAAjB,iBAAiB;iCADI,oBAAoB;iCAApB,oBAAoB;kCAApB,oBAAoB;iCA9BM,gBAAgB;0BAAhB,gBAAgB;+BAAhB,gBAAgB;iCAAhB,gBAAgB;iCAAhB,gBAAgB"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProvide
|
|
|
25
25
|
import { matchesChoice } from './matches-choice.js';
|
|
26
26
|
import { readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions } from './money.js';
|
|
27
27
|
import { ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho } from './answer.js';
|
|
28
|
-
import { readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational } from './contact.js';
|
|
28
|
+
import { readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational } from './contact.js';
|
|
29
29
|
import { normalizeAndFindCapture } from './capture.js';
|
|
30
30
|
import { anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb } from './phrases.js';
|
|
31
31
|
import { dateToWords } from './date-words.js';
|
|
@@ -37,14 +37,14 @@ import { checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS } from
|
|
|
37
37
|
import { validateDigits, validatePhone, validateEmail } from './validators.js';
|
|
38
38
|
import { joinSpokenDigits, spokenDigitsText, wholeSpokenNumber } from './spoken-digits.js';
|
|
39
39
|
import { 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, 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, 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,
|
|
44
44
|
formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor,
|
|
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
|
-
readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
|
|
47
|
+
readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
|
|
48
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,
|
|
49
49
|
validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, wholeSpokenNumber,
|
|
50
50
|
registerSendable, sendables, chatTranscript, conversationCopy,
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:a28ee61017132b8f9a1593a8625a68251462eaeafbe403cbf460c0d09b02d5cb";
|
|
@@ -200,7 +200,7 @@ Profiles:
|
|
|
200
200
|
| `digits` | `min`, `max`: one unambiguous digit run of that length. |
|
|
201
201
|
| `identifier` | `pattern`: permitted account identifier shape. |
|
|
202
202
|
| `pattern` | `regex`, optional `flags`, `group`; optional `accept_other` for the current field only, `whole_phrases`, `template_words`; `spoken_digits` (`true`, or `'house_number'` when a numbered street can follow) reads a number said in pieces as one number ("5 0 9 Lazy Lane", "apt 2 0 4"), required on any pattern that reads digits. |
|
|
203
|
-
| `phone`, `email` | Typed readers; email `literal:true` preserves an explicit visible address token in surrounding prose. |
|
|
203
|
+
| `phone`, `email` | Typed readers; email `literal:true` preserves an explicit visible address token in surrounding prose. An email at hotmail, yahoo, outlook, icloud or aol said without its ending is held and only the ending is asked ("What comes after yahoo? For example, dot com."); the ending alone completes it, any other reply drops it. gmail is completed as gmail.com; an unknown domain is never guessed. |
|
|
204
204
|
| `amount` | `min`, `max`, optional `marked:true` or `marked:"out_of_order"`; optional `money:{currency:"USD",cardinals:true,intent:"payment"}`. |
|
|
205
205
|
| `text` | Current-field text fallback; `narrative:true` retains a substantive answer alongside independent structured fields. |
|
|
206
206
|
|
|
@@ -285,6 +285,8 @@ An unreadable answer with any words goes to the reply ranker, offered the questi
|
|
|
285
285
|
|
|
286
286
|
`confirm.named_fields: true` lets a caller correct a read-back in their own words: each input of this form that declares `names` and holds a value is offered to the reply ranker, and a pick extracts the new value of every such input, so one reply can change several. `confirm.reply_context` tells the ranker and the extraction what a reply may contain (never spoken); an input's `argument_description` says what its value looks like ("apartment or unit number alone, such as 4 or 12B"). A reply the word readers only partly account for goes to the ranker, so none of it is lost.
|
|
287
287
|
|
|
288
|
+
`confirm_edit: true` on a `text` input of the form that holds a value: the read-back also offers the ranker ADD (the reply is appended to that text) and REPLACE (the reply takes its place, a leading "no," dropped); the form is then confirmed again.
|
|
289
|
+
|
|
288
290
|
`whole_phrases: true` on a `choice`, or on a `pattern` that reads words: a word reading picks only when the whole reply is accounted for by its phrase, another input's argument (digits, an amount, a card), courtesy, connecting words and the input's `template_words` ("pay $50 with my Visa card"). Anything else goes to the reply ranker, offered the choices as above. Keypad keys and digit readings are arguments and read as before. Off by default.
|
|
289
291
|
|
|
290
292
|
A choice marked `current_only` is read only at its own question: neither the word reader nor the reply ranker offers it while another question is asked (a route's `done` or `switch` is never picked for a NO or a sub account said at the amount question). Written cents (`72.45`, `$72.45`, `287,15`) are an amount by shape: out of order they fill an open amount, and beside another field's reading (`51:72.45` at a sub account question) they are that amount, never digits of a security code or ZIP code.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.78.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",
|