jsfe 1.7.4 → 1.7.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA0FA;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DC;AACD;;;GAGG;AACH;;;;;;EAGC;AA8VD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAjgBM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkrB9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
1
+ {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA0FA;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDC;AACD;;;GAGG;AACH;;;;;;EAGC;AAkWD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAhgBM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAorB9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
@@ -117,7 +117,7 @@ export function formFlow({ id, name, version, description, inputs, after = [], e
117
117
  steps: [
118
118
  ...proposalRuntimeSteps(id, [], hasInputProposals(inputs) ? [INPUT_PROPOSALS_REQUIREMENT] : []),
119
119
  SET(`${id}_resume_kind`, 'form_internal_resume', '!!form_instance'),
120
- SET(`${id}_open`, 'form_instance', `openFormInstance(cargo, ${JSON.stringify(id)}, inputs, { parent: parent_form || null, input: result_input || '', context:!!parent_form && !result_input, resume: form_instance || (!parent_form ? (cargo.formTasks || {})[${JSON.stringify(id)}] || '' : ''), providers: provides, questions: questions, incomplete_outcome: ${incompleteExpression}, on_exhausted: form_on_exhausted })`),
120
+ SET(`${id}_open`, 'form_instance', `openFormInstance(cargo, ${JSON.stringify(id)}, inputs, { parent: parent_form || null, input: result_input || '', context:!!parent_form && !result_input, resume_on_parent_change: ${resume_on_parent_change === true}, resume: form_instance || (!parent_form ? (cargo.formTasks || {})[${JSON.stringify(id)}] || '' : ''), providers: provides, questions: questions, incomplete_outcome: ${incompleteExpression}, on_exhausted: form_on_exhausted })`),
121
121
  SIDE(`${id}_task`, `(!parent_form ? (cargo.formTasks = cargo.formTasks || {}, cargo.formTasks[${JSON.stringify(id)}] = form_instance) : true, true)`),
122
122
  SIDE(`${id}_provider_reset`, '(delete cargo.forms[form_instance].providerRequests, delete cargo.forms[form_instance].activeGates, delete cargo.forms[form_instance].providerGateActive, true)'),
123
123
  SIDE(`${id}_pass_reset`, '(cargo.forms[form_instance].replays = 0, form_internal_resume ? true : (cargo.forms[form_instance].attempts = {},cargo.forms[form_instance].misses={},cargo.forms[form_instance].feedback={}), true)'),
@@ -127,11 +127,6 @@ export function formFlow({ id, name, version, description, inputs, after = [], e
127
127
  SET(`${id}_initial`, 'initial_readings', 'form_internal_resume ? [] : formInitialReadings(cargo.forms[form_instance], currentContext, cargo)'),
128
128
  WHEN(`${id}_accept_initial`, 'initial_readings.length > 0', FLOW(`${id}_initial_accept`, 'collect-input-accept', 'call', { hits: '{{initial_readings}}' })),
129
129
  FLOW(`${id}_run`, 'run-form', 'call', { rf_form: '{{form_instance}}', ...(resume_on_parent_change ? { rf_resume_parent: true } : {}), ...(stop ? { rf_stop: stop } : {}) }),
130
- ...(resume_on_parent_change ? [
131
- WHEN(`${id}_parent_capture`, "rf_status === 'parent_changed'", SET(`${id}_parent_id`, 'form_resume_owner', 'cargo.forms[form_instance].parent')),
132
- WHEN(`${id}_parent_close`, "rf_status === 'parent_changed'", SIDE(`${id}_parent_release`, '(closeFormInstance(cargo, form_instance, false), true)')),
133
- WHEN(`${id}_parent_resume`, "rf_status === 'parent_changed'", FLOW(`${id}_parent_reenter`, 'resume-form', 'reboot', { form: '{{form_resume_owner}}' })),
134
- ] : []),
135
130
  ...(close_on_stop ? [WHEN(`${id}_close_stopped`, "rf_status === 'stopped'", SIDE(`${id}_stop_close`, '(closeFormInstance(cargo, form_instance, false), true)'))] : []),
136
131
  WHEN(`${id}_left`, "rf_status !== 'complete' || !cargo.forms[form_instance]", END(`${id}_left_end`)),
137
132
  ...(validator ? [
@@ -168,13 +163,15 @@ const runForm = {
168
163
  id: 'run-form', name: 'RunForm', version: '1.0.0',
169
164
  description: "Worker (shared scope, called by a form flow): the FORM loop. Merges the form's activation parameters into cargo.forms[rf_form] once, then each pass finds the first missing input whose `when` holds, collects it (collect-input) or runs its sub-form, and replaces itself until nothing is missing. Sets rf_status: 'complete' | 'stopped' (a path in rf_stop was set) | 'unwound'. Reads the form's `inputs`, `parent_form`, `result_input`, `questions`, `provides`, `exit_context(_es)`.",
170
165
  parameters: [{ name: 'rf_resume_parent', type: 'boolean', description: 'Yield a context collector when its owning form accepts a change' }, { name: 'rf_form', type: 'string', description: 'The form id (the calling form flow id)' }, { name: 'rf_resume', type: 'string', description: "'true' on the loop's own replays" }, { name: 'rf_stop', type: 'string', description: 'A cargo path (or list) that ends the form when set' }],
171
- variables: vars({ rf_stop: '', rf_resume: '', rf_resume_parent: false, rf_status: '', rf_next: '', rf_next_form: '', rf_questions: [], rf_provides: null, rf_max: 0, rf_pending: [], rf_deferred: [], rf_proposal: null, rf_proposal_readings: [] }),
166
+ variables: vars({ rf_stop: '', rf_resume: '', rf_resume_parent: false, rf_parent_resume: null, rf_status: '', rf_next: '', rf_next_form: '', rf_questions: [], rf_provides: null, rf_max: 0, rf_pending: [], rf_deferred: [], rf_proposal: null, rf_proposal_readings: [] }),
172
167
  steps: [
168
+ SIDE('rf_resume_policy', '(rf_resume_parent === true && cargo.forms[rf_form] && cargo.forms[rf_form].context_only ? (cargo.forms[rf_form].resume_on_parent_change=true) : true, true)'),
169
+ SET('rf_ancestor_resume', 'rf_parent_resume', 'formParentResume(cargo,rf_form,rf_resume_parent)'),
170
+ WHEN('rf_ancestor_close', 'rf_parent_resume', SIDE('rf_ancestor_release', '(closeFormInstance(cargo,rf_parent_resume.child,false),true)')),
171
+ WHEN('rf_ancestor_reboot', 'rf_parent_resume', FLOW('rf_ancestor_owner', 'resume-form', 'reboot', { form: '{{rf_parent_resume.owner}}' })),
173
172
  SIDE('rf_pass_count', '(cargo.forms[rf_form] ? (cargo.forms[rf_form].replays = Number(cargo.forms[rf_form].replays || 0) + 1) : true, true)'),
174
173
  SET('rf_pass', 'rf_status', "formInstanceApplies(cargo, rf_form) ? '' : (closeFormInstance(cargo, rf_form, false), 'unwound')"),
175
174
  WHEN('rf_unwound', "rf_status === 'unwound'", END('rf_unwound_end')),
176
- WHEN('rf_parent_changed', "rf_resume_parent === true && cargo.forms[rf_form].context_only && cargo.forms[cargo.forms[rf_form].parent].revision !== cargo.forms[rf_form].parent_revision", SET('rf_parent_status', 'rf_status', "'parent_changed'")),
177
- WHEN('rf_parent_end', "rf_status === 'parent_changed'", END('rf_parent_changed_end')),
178
175
  SET('rf_cap', 'rf_max', 'formWorkLimit(cargo, rf_form)'),
179
176
  WHEN('rf_runaway', 'cargo.forms[rf_form].replays > rf_max', incompleteDispatch('rf_runaway_out', 'rf_form', "rf_form+'_incomplete'")),
180
177
  WHEN('rf_stopped_early', '[].concat(rf_stop || []).some(function(p) { return !!formPath({cargo:cargo}, p); })', SET('rf_stopped_status', 'rf_status', "'stopped'")),
@@ -238,7 +235,9 @@ const collectInput = {
238
235
  SET('ci_own_choices', 'ci_choices', "ci_spec.choices_from && Array.isArray(ci_d[ci_spec.choices_from]) ? ci_d[ci_spec.choices_from] : (ci_spec.profile.kind === 'choice' && Array.isArray(ci_spec.profile.choices) ? ci_spec.profile.choices : [])"),
239
236
  SET('ci_keypad', 'ci_digits', 'ci_spec.digits || null'),
240
237
  SET('ci_is_amount', 'ci_amount', "ci_spec.amount === 'marked' ? 'marked' : (ci_spec.amount === true || ci_spec.profile.kind === 'amount')"),
241
- SET('ci_as_spoken', 'ci_as_spoken', 'ci_spec.as_spoken === true'),
238
+ // FORM profile readers own normalization and compound matching. Never discard other
239
+ // fields through question-specific voice cleanup before they see the original answer.
240
+ SET('ci_as_spoken', 'ci_as_spoken', 'ci_spec.as_spoken !== false'),
242
241
  SET('ci_is_pii', 'ci_pii', 'ci_spec.pii === true'),
243
242
  SET('ci_precheck', 'ci_pre', "ci_spec.answer_precheck || ''"),
244
243
  SET('ci_validator', 'ci_val', "ci_spec.answer_validator || ''"),
@@ -619,7 +618,10 @@ const providerMenu = {
619
618
  SET('pm_question_es', 'pm_q_es', `(function () { ${RENDER_JS} var m = provides.menu; var t = cargo.voice && (m.question_voice_es || m.question_voice) ? (m.question_voice_es || m.question_voice) : (m.question_es || m.question); return (retry === '1' ? 'Disculpe, no le entendí. ' : '') + fill(t, {}, null, 'es', { name: pm_who, verb: cargo.verb_es || (cargo.voice ? 'diga' : 'escriba') }); })()`),
620
619
  SET('pm_build', 'pm_choices', "provides.facts.concat(provides.sets || []).filter(function (f) { return Array.isArray(f.words) && f.words.length; }).map(function (f) { return { key: 'fact:' + f.key, words: f.words }; }).concat((provides.menu.choices || []).map(function (c) { return { key: 'act:' + c.key, words: c.words, exact: c.exact === true }; })).concat(provides.menu.done ? [{ key: 'done', words: provides.menu.done.words, exact: true }] : [])"),
621
620
  FLOW('pm_ask', 'ask-choice', 'call', { question: '{{pm_q}}', question_es: '{{pm_q_es}}', choices: '{{pm_choices}}', accept_other: true, digits: { min: 1, max: 1 }, exit_context: '{{provides.subject}}', exit_context_es: '{{provides.subject_es}}' }),
622
- SET('pm_take', 'pm_key', "String(cargo.choice || '').indexOf('fact:') === 0 ? pickProviderQuestion(cargo.choiceText, pm_choices.filter(function (c) { return c.key.indexOf('fact:') === 0; })) : String(cargo.choice || '')"),
621
+ // A declared terminal phrase (for example "no thanks") may also fit a shorter action
622
+ // after courtesy stripping ("no"). Resolve only that overlap; fact ownership and the
623
+ // existing reserved done fallback retain their normal behavior.
624
+ SET('pm_take', 'pm_key', "(function(){var key=String(cargo.choice || '');if(key.indexOf('fact:')===0)return pickProviderQuestion(cargo.choiceText,pm_choices.filter(function(c){return c.key.indexOf('fact:')===0;}));if(key.indexOf('act:')===0 && provides.menu.done && pickChoice(cargo.choiceText,[{key:'terminal:done',words:provides.menu.done.words,exact:true}],true)==='terminal:done')return 'done';return key;})()"),
623
625
  SET('pm_fact_keys', 'pm_keys', "pm_key.indexOf('fact:') === 0 ? (function (k) { var s = (provides.sets || []).filter(function (x) { return x.key === k; })[0]; return s ? s.facts.slice() : [k]; })(pm_key.slice(5)) : []"),
624
626
  SET('pm_closing', 'pm_close', "pm_keys.length > 0 && pm_keys.every(function (key) { var fact = provides.facts.find(function (f) { return f.key === key; }); return !!fact && fact.close === true; })"),
625
627
  SET('pm_action_flow', 'pm_flow', "pm_key.indexOf('act:') === 0 ? (function (c) { if (c && c.set) { Object.keys(c.set).forEach(function (k) { cargo[k] = c.set[k]; }); } else { /* nothing to set */ } return c ? c.flow : ''; })((provides.menu.choices || []).filter(function (x) { return 'act:' + x.key === pm_key; })[0]) : ''"),
@@ -1 +1 @@
1
- {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AA2BA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AAMD,4EAKC;AA8ED,4DAKC;AAwED,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAQD,0BAAmI"}
1
+ {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AA2BA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AAMD,4EAKC;AAgFD,4DAKC;AAwED,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAQD,0BAAmI"}
@@ -111,7 +111,7 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
111
111
  when('identity_contact_split_overshoot', "contact_partial && contact_digits.length > (contact_options.account_shape || []).reduce(function(max,s){return Math.max(max,Math.max.apply(null,s.lengths || [0]));},0)", call('identity_contact_restart_split', 'contact-split-failed', { contact_options: '{{contact_options}}' }, 'replace')),
112
112
  set('identity_contact_identifier', 'contact_id', "contact_options.account_pattern ? readIdentifier(contact_text,contact_options.account_pattern) : null"),
113
113
  set('identity_contact_phone', 'contact_phone', "readPhone(contact_text) || (validatePhone(contact_digits) ? contact_digits : '')"), set('identity_contact_email', 'contact_mail', 'readEmail(contact_text)'),
114
- set('identity_contact_classify', 'contact_kind', "contact_id && contact_id.kind === 'account' ? 'account' : contact_phone ? 'phone' : contact_mail ? 'email' : readInternationalPhone(contact_text) ? 'international' : isAgentRequest(contact_text) ? 'agent' : isAnswer(contact_text,'exit') && contact_text.trim().split(/\\s+/).length <= 2 ? 'exit' : contact_allowed && /^(?:no|nope|nah)\\b/i.test(contact_text.trim()) && !/[0-9@]/.test(contact_text) ? 'decline' : contact_allowed ? 'caller' : contact_digits ? 'invalid_phone' : contact_text.trim().split(/\\s+/).length>=3 && !/[0-9@]/.test(contact_text) ? 'off_topic' : 'invalid'"),
114
+ set('identity_contact_classify', 'contact_kind', "contact_id && contact_id.kind === 'account' ? 'account' : contact_phone ? 'phone' : contact_mail ? 'email' : readInternationalPhone(contact_text) ? 'international' : isAgentRequest(contact_text) ? 'agent' : isAnswer(contact_text,'exit') && contact_text.trim().split(/\\s+/).length <= 2 ? 'exit' : contact_allowed && /^(?:no|nope|nah)\\b/i.test(contact_text.trim()) && !/[0-9@]/.test(contact_text) ? 'decline' : contact_allowed ? 'caller' : contact_digits ? 'invalid_phone' : contact_text.trim().split(/\\s+/).length>=3 && !/[0-9@]/.test(contact_text) ? 'unmapped' : 'invalid'"),
115
115
  set('identity_contact_error', 'contact_error', expression(contactError, 'contact_kind', 'contact_options')), set('identity_contact_error_es', 'contact_error_es', expression(contactError, 'contact_kind', 'contact_options', 'true')),
116
116
  cases('identity_contact_route', {
117
117
  "condition: contact_kind === 'agent'": call('identity_contact_agent', 'live-agent-requested', undefined, 'reboot'),
@@ -119,9 +119,11 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
119
119
  "condition: contact_kind === 'decline'": call('identity_contact_declined', 'contact-caller-declined', { contact_options: '{{contact_options}}' }, 'replace'),
120
120
  "condition: contact_kind === 'international'": contactMenu('identity_contact_international'),
121
121
  "condition: contact_kind === 'invalid_phone'": contactMenu('identity_contact_invalid_phone'),
122
- "condition: contact_kind === 'off_topic'": { id: 'identity_contact_off_topic', type: 'DISPATCH', outcome: 'unresolved', reason: 'auth_prompt_off_topic' },
122
+ "condition: contact_kind === 'unmapped'": { id: 'identity_contact_off_topic', type: 'DISPATCH', onResponse: 'continue', responseContext: 'account identifier: phone number, email address or account number (teléfono, correo o número de cuenta)', outcome: 'unresolved', reason: 'auth_prompt_off_topic' },
123
123
  "condition: contact_kind === 'invalid'": contactMenu('identity_contact_missing'), default: effect('identity_contact_typed', 'true')
124
124
  }),
125
+ // A classified response is not authority to abandon identification: run the existing bounded recovery menu.
126
+ when('identity_contact_unmapped_retry', "contact_kind === 'unmapped'", contactMenu('identity_contact_unmapped')),
125
127
  set('identity_contact_number', 'acct_number', "contact_kind === 'account' ? String(contact_id.value) : ''"),
126
128
  set('identity_contact_cell', 'cell_number', "contact_kind === 'caller' ? String(cargo.callerId) : contact_kind === 'phone' ? contact_phone : ''"), set('identity_contact_mail', 'email', "contact_kind === 'email' ? contact_mail : ''"),
127
129
  effect('identity_contact_record', "(cargo.contactKind=acct_number?'account':email?'email':String(cell_number).replace(/\\D/g,'').slice(-10)===String(cargo.callerId || '').replace(/\\D/g,'').slice(-10)?'caller':'phone',cargo.contactValue=String(acct_number || email || cell_number),cargo.contactAlternatives=cargo.serviceAnswer.values,true)"),
@@ -1 +1 @@
1
- {"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AA8IA;;;GAGG;AACH,wEAkBC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AAiBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EA6BC;AAUD;;;;;;;;;GASG;AACH,6EAyGC;;;;;;;;AA3WD,qCAKiD"}
1
+ {"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AAuLA;;;GAGG;AACH,wEAkBC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AAiBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EA6BC;AAUD;;;;;;;;;GASG;AACH,6EAyGC;;;;;;;;AApZD,qCAKiD"}
@@ -50,11 +50,6 @@ export const CONFIRM_WORDS = ['yes', 'yeah', 'yep', 'yup', 'sure', 'of course',
50
50
  // AGENT words that also mean something else inside a sentence ("quiero pagar mi servicio", "someone else will pay"): they
51
51
  // ask for a person only as the whole answer (AGENT_ONLY), never from inside one.
52
52
  const AGENT_AMBIGUOUS = new Set(['servicio', 'support', 'someone', 'somebody', 'alguien', 'persona', 'a person', 'gente', 'al cliente']);
53
- // TEXT words that name the message itself inside a sentence ("dónde me llegó en este mensaje", "the text you sent me"): they
54
- // ask to switch to text only as the whole answer (TEXT_ONLY), never from inside one. Prod 2026-10-20: two callers looking for
55
- // the code we had texted were switched to SMS and the call ended.
56
- const TEXT_AMBIGUOUS = new Set(['text', 'texto', 'sms', 'message', 'mensaje', 'mensaje de texto', 'por texto', 'by text', 'whatsapp']);
57
- const TEXT_ONLY = /^(?:(?:by|via|por|en|a|to)\s+)?(?:text|texto|sms|message|text message|mensaje|mensaje de texto|whatsapp)(?:\s+(?:please|por favor))?[.!?]*$/;
58
53
  // A word that negates what follows it in its clause ("not sure", "no quiero un agente").
59
54
  const NEGATIONS = ['no', 'not', 'nope', 'nah', 'never', 'dont', 'doesnt', 'didnt', 'cant', 'cannot', 'wont', 'nunca', 'ni',
60
55
  'tampoco', 'jamas', 'jamás'];
@@ -85,6 +80,8 @@ const CONFIRM_FILLER = CONFIRM_WORDS.map(normalize).map((w) => w.split(' '));
85
80
  const ARTICLES = ['the', 'my', 'el', 'la', 'mi'].map((w) => [w]);
86
81
  const YES_SET = new Set(ANSWER_WORDS.yes.map(normalize));
87
82
  const collapse = (w) => w.replace(/([aeiouáéíóúü])\1+/g, '$1').replace(/(\p{L})\1{2,}/gu, '$1');
83
+ const phraseAt = (tokens, i, phrase) => phrase.every((w, j) => tokens[i + j] === w
84
+ || (!/(\p{L})\1/u.test(w) && collapse(tokens[i + j] || '') === w));
88
85
  /**
89
86
  * Whether the answer, with courtesy around it removed (please / thanks / gracias, um, uh, ma'am, señora…), holds NOTHING but
90
87
  * words from `words` — at least one of them. A YES that acts must be the whole answer (owner rule, 2026-10-14): "Yeah, sure,
@@ -99,7 +96,7 @@ function onlyAffirmative(b, words, needOne = true, filler = []) {
99
96
  }
100
97
  const tk = String(b).replace(/\./g, ' ').split(' ').filter(Boolean);
101
98
  const own = words.map(normalize).filter(Boolean).map((w) => w.split(' '));
102
- const at = (i, phrase) => phrase.every((w, j) => tk[i + j] === w || (!/(\p{L})\1/u.test(w) && collapse(tk[i + j] || '') === w));
99
+ const at = (i, phrase) => phraseAt(tk, i, phrase);
103
100
  let i = 0;
104
101
  let saw = false;
105
102
  while (i < tk.length) {
@@ -118,6 +115,62 @@ function onlyAffirmative(b, words, needOne = true, filler = []) {
118
115
  }
119
116
  return saw || !needOne;
120
117
  }
118
+ // Channel nouns select a channel only inside a complete request. The remainder must describe
119
+ // switching/continuing the conversation, not the contents of an OTP or a quoted earlier message.
120
+ const TEXT_CHANNELS = ['text', 'text message', 'texto', 'sms', 'message', 'mensaje', 'mensaje de texto', 'whatsapp'];
121
+ const TEXT_REQUEST_PREFIXES = ['i want to', 'i need to', 'i would like to', 'id like to', 'i would rather', 'id rather',
122
+ 'i want', 'i need', 'i prefer', 'i would like', 'id like', 'can i', 'could i', 'can we', 'could we', 'can you', 'could you', 'would you', 'lets',
123
+ 'quiero', 'quisiera', 'me gustaria', 'prefiero', 'necesito', 'podemos', 'podriamos', 'puedes', 'podrias', 'puede', 'podria', 'mejor']
124
+ .map(w => w.split(' ')).sort((a, b) => b.length - a.length);
125
+ const TEXT_WRAPPERS = [...COURTESY, ...ACKNOWLEDGEMENTS, ...CONFIRM_FILLER].sort((a, b) => b.length - a.length);
126
+ function trimAnswerWrappers(tokens) {
127
+ while (tokens.length) {
128
+ const first = TEXT_WRAPPERS.find(phrase => phraseAt(tokens, 0, phrase));
129
+ const last = first ? null : TEXT_WRAPPERS.find(phrase => phrase.length <= tokens.length && phraseAt(tokens, tokens.length - phrase.length, phrase));
130
+ if (first)
131
+ tokens = tokens.slice(first.length);
132
+ else if (last)
133
+ tokens = tokens.slice(0, -last.length);
134
+ else
135
+ break;
136
+ }
137
+ return tokens;
138
+ }
139
+ function textRequest(input, words, extra) {
140
+ const raw = String(input ?? '').replace(/\\(['"\\])/g, '$1');
141
+ // Quotation, code, blockquotes and strikethrough mark non-command text before normalization
142
+ // removes their delimiters. Ordinary emphasis and apostrophes remain valid command text.
143
+ const quoted = /["“”«»]|(?:^|\s)'[^']+'(?=$|\s|[.,!?;:])|(?:^|\s)‘[^’]+’(?=$|\s|[.,!?;:])/u.test(raw);
144
+ const markdown = /`|~~|(?:^|\n)[ \t]*>/u.test(raw);
145
+ if (quoted || markdown)
146
+ return false;
147
+ const command = raw.replace(/(\*{1,2}|_{1,2})(?=\S)([\s\S]*?\S)\1/g, '$2');
148
+ let tokens = trimAnswerWrappers(normalize(command.replace(/[,;!?¿¡]/g, ' ')).replace(/\./g, ' ').split(' ').filter(Boolean));
149
+ if (['instead', 'mejor'].includes(tokens.at(-1)))
150
+ tokens.pop();
151
+ const prefix = TEXT_REQUEST_PREFIXES.find(phrase => phraseAt(tokens, 0, phrase));
152
+ if (prefix)
153
+ tokens = trimAnswerWrappers(tokens.slice(prefix.length));
154
+ const body = tokens.join(' ');
155
+ if (!body)
156
+ return false;
157
+ if (onlyAffirmative(body, words))
158
+ return true;
159
+ const channel = value => onlyAffirmative(value, [...TEXT_CHANNELS, ...extra]);
160
+ if (channel(body) || /^(?:text|message) me$|^escrib(?:eme|ame)$/.test(body))
161
+ return true;
162
+ const delivery = /^(?:by|via|over|por|en|a|to) (.+)$/.exec(body);
163
+ if (delivery && channel(delivery[1]))
164
+ return true;
165
+ const continuation = /^(?:continue|communicate|chat|talk|carry on|go on|continuar|continua|continuemos|seguir|sigue|sigamos)(?: with me)? (?:by|via|over|por|en) (.+)$/.exec(body);
166
+ if (continuation && channel(continuation[1]))
167
+ return true;
168
+ const switching = /^(?:switch(?: me)? (?:over )?to|cambiar(?:me)? a|cambia(?:me)? a|pasame a) (.+)$/.exec(body);
169
+ if (switching && channel(switching[1]))
170
+ return true;
171
+ const sending = /^(?:send me (?:a )?|mandame (?:un )?|enviame (?:un )?)(.+)$/.exec(body);
172
+ return !!sending && channel(sending[1]);
173
+ }
121
174
  /**
122
175
  * Whether the answer is the keypad key `key` with nothing around it but courtesy ("1 please", "um 2", "2 gracias") and,
123
176
  * when `yesOk`, a YES word ("yes 1", "sí, 1"). Owner decision 2026-10-15: "Yes 1" at "tell me the product number" was
@@ -157,7 +210,7 @@ export function isAnswer(input, kind, extra = []) {
157
210
  return onlyAffirmative(b, words);
158
211
  }
159
212
  else if (kind === 'text') {
160
- return TEXT_ONLY.test(b) || matchesChoice(b, words.filter((w) => !TEXT_AMBIGUOUS.has(w)));
213
+ return textRequest(input, words, Array.isArray(extra) ? extra : []);
161
214
  }
162
215
  else {
163
216
  return matchesChoice(b, words);
@@ -4,8 +4,12 @@
4
4
  * back to the first lead-in word ("my email is", "mi correo es") is kept and joined. On a call the address is read
5
5
  * back for a YES / NO, so a misheard piece can be corrected; a dropped one could not. Accents are dropped from the
6
6
  * name (an address cannot carry them), and only the last @ counts.
7
+ * With `{literal:true}`, a complete visible address wins over surrounding prose; absent one,
8
+ * the same spoken/spelled parsing applies. Distinct visible addresses are ambiguous and return empty.
7
9
  */
8
- export function readEmail(text: any): string;
10
+ export function readEmail(text: any, { literal }?: {
11
+ literal?: boolean | undefined;
12
+ }): string;
9
13
  /** The 10-digit North American number in the answer (a leading 1 dropped), or ''. */
10
14
  export function readPhone(text: any): string;
11
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../src/helpers/contact.js"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,6CAwBC;AAED,qFAAqF;AACrF,6CASC;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;;WA8BC;AAED,qFAAqF;AACrF,6CASC;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"}
@@ -19,8 +19,17 @@ const EMAIL_LEAD_IN = new Set(['my', 'mi', 'su', 'your', 'email', 'e-mail', 'mai
19
19
  * back to the first lead-in word ("my email is", "mi correo es") is kept and joined. On a call the address is read
20
20
  * back for a YES / NO, so a misheard piece can be corrected; a dropped one could not. Accents are dropped from the
21
21
  * name (an address cannot carry them), and only the last @ counts.
22
+ * With `{literal:true}`, a complete visible address wins over surrounding prose; absent one,
23
+ * the same spoken/spelled parsing applies. Distinct visible addresses are ambiguous and return empty.
22
24
  */
23
- export function readEmail(text) {
25
+ export function readEmail(text, { literal = false } = {}) {
26
+ // Contextual prose must not become part of an already complete, visible address. This
27
+ // explicit mode preserves the default spoken/spelled-name grammar for existing callers.
28
+ if (literal) {
29
+ const addresses = [...String(text ?? '').matchAll(/(?<![a-z0-9._%+@-])([a-z0-9][a-z0-9._%+-]*@[a-z0-9.-]+\.[a-z]{2,})(?![a-z0-9_@-])/gi)].map(match => match[1].toLowerCase());
30
+ if (addresses.length)
31
+ return new Set(addresses).size === 1 ? addresses[0] : '';
32
+ }
24
33
  const spoken = String(text ?? '')
25
34
  .replace(/\s+(?:at|arroba)\s+/gi, ' @ ')
26
35
  .replace(/\s+(?:dot|punto)\s+/gi, '.')
@@ -18,7 +18,7 @@ export function settleFormActivations(batch?: {}, cargo?: null): {
18
18
  pending: any[];
19
19
  };
20
20
  /** Explicit ownership: unrelated tasks and sibling inputs never share an instance by definition id. */
21
- export function openFormInstance(cargo: any, definition: any, specs: any, { parent, input, resume, task, providers, questions, context, incomplete_outcome, on_exhausted }?: {
21
+ export function openFormInstance(cargo: any, definition: any, specs: any, { parent, input, resume, task, providers, questions, context, resume_on_parent_change, incomplete_outcome, on_exhausted }?: {
22
22
  parent?: null | undefined;
23
23
  input?: string | undefined;
24
24
  resume?: string | undefined;
@@ -26,6 +26,7 @@ export function openFormInstance(cargo: any, definition: any, specs: any, { pare
26
26
  providers?: null | undefined;
27
27
  questions?: null | undefined;
28
28
  context?: boolean | undefined;
29
+ resume_on_parent_change?: undefined;
29
30
  incomplete_outcome?: undefined;
30
31
  on_exhausted?: undefined;
31
32
  }): any;
@@ -89,7 +90,14 @@ export function invalidateFormInputs(cargo: any, id: any, changed: any, preserve
89
90
  export function resetFormInputs(cargo: any, id: any, names?: any[]): boolean;
90
91
  /** Commit only validated readings. Callers batch dependency-related candidates before invoking this transition. */
91
92
  export function acceptFormReadings(cargo: any, hits: any, additionalCandidates?: any[]): boolean;
92
- export function formInstanceApplies(cargo: any, id: any): any;
93
+ /** Resolve the outermost stale opted-in context through actual active ownership, without mutation.
94
+ * An unflagged wrapper must not hide an ancestor whose owner accepted a different field value.
95
+ */
96
+ export function formParentResume(cargo: any, id: any, explicit?: boolean): {
97
+ owner: any;
98
+ child: any;
99
+ } | null;
100
+ export function formInstanceApplies(cargo: any, id: any, seen?: Set<any>): any;
93
101
  export function closeFormInstance(cargo: any, id: any, handOn?: boolean): any;
94
102
  export function hasFormValue(v: any): boolean;
95
103
  //# sourceMappingURL=form-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-state.d.ts","sourceRoot":"","sources":["../../src/helpers/form-state.js"],"names":[],"mappings":"AAOA,qDAKC;AAED,oDAEC;AAED,qFAAqF;AACrF,oEA2BC;AAuCD,2FAEC;AACD,8FAcC;AACD,2DAOC;AACD,uEAuCC;AAED,kGAAkG;AAClG,2GAOC;AACD,0HAA0H;AAC1H,uEAwBC;AACD,8HAA8H;AAC9H;;;;;EAWC;AACD,uGAAuG;AACvG;;;;;;;;;;QA8BC;AAED,0FAA0F;AAC1F;;;SAIC;AACD,gGAAgG;AAChG;;;;;;;;;;;EAQC;AAED,sGAAsG;AACtG,2DAIC;AACD;;;GAGG;AACH;;;;;;;SAkBC;AAED,2FAA2F;AAC3F,oGAIC;AACD,gFA4BC;AAED,2GAA2G;AAC3G;;;EASC;AACD,mEAoBC;AACD,mEAGC;AACD,sEAUC;AACD,+EAEC;AACD,qFASC;AACD,oGAoCC;AACD;;;SAKC;AACD,qEAGC;AACD,gEAgBC;AACD,2DAQC;AACD,oGAUC;AAED,uEAAuE;AACvE,wHA+BC;AAED,uHAAuH;AACvH,6EAaC;AACD,mHAAmH;AACnH,iGA4CC;AACD,8DAQC;AACD,8EAeC;AAvjBM,8CAAmE"}
1
+ {"version":3,"file":"form-state.d.ts","sourceRoot":"","sources":["../../src/helpers/form-state.js"],"names":[],"mappings":"AAOA,qDAKC;AAED,oDAEC;AAED,qFAAqF;AACrF,oEA2BC;AAuCD,2FAEC;AACD,8FAcC;AACD,2DAOC;AACD,uEAuCC;AAED,kGAAkG;AAClG,2GAOC;AACD,0HAA0H;AAC1H,uEAwBC;AACD,8HAA8H;AAC9H;;;;;EAWC;AACD,uGAAuG;AACvG;;;;;;;;;;;QAgCC;AAED,0FAA0F;AAC1F;;;SAIC;AACD,gGAAgG;AAChG;;;;;;;;;;;EAQC;AAED,sGAAsG;AACtG,2DAIC;AACD;;;GAGG;AACH;;;;;;;SAkBC;AAED,2FAA2F;AAC3F,oGAIC;AACD,gFA4BC;AAED,2GAA2G;AAC3G;;;EASC;AACD,mEAoBC;AACD,mEAGC;AACD,sEAUC;AACD,+EAEC;AACD,qFASC;AACD,oGAoCC;AACD;;;SAKC;AACD,qEAGC;AACD,gEAgBC;AACD,2DAQC;AACD,oGAUC;AAED,uEAAuE;AACvE,wHA+BC;AAED,uHAAuH;AACvH,6EAaC;AACD,mHAAmH;AACnH,iGA4CC;AACD;;GAEG;AACH;;;SAcC;AACD,+EASC;AACD,8EAeC;AA5kBM,8CAAmE"}
@@ -274,7 +274,7 @@ export function settleFormActivations(batch = {}, cargo = null) {
274
274
  rejected: rejected.map(h => h.activation_inferred ? { ...h, ...h.activation_entry, activation_inferred: false } : h), pending: pending.concat(accepted.filter(h => held.has(h.activation_group))).filter(h => !discarded.has(h.activation_group)).map(h => held.has(h.activation_group) ? { ...h, ok: undefined, outcome: 'pending', silent: true } : h) };
275
275
  }
276
276
  /** Explicit ownership: unrelated tasks and sibling inputs never share an instance by definition id. */
277
- export function openFormInstance(cargo, definition, specs, { parent = null, input = '', resume = '', task = '', providers = null, questions = null, context = false, incomplete_outcome = undefined, on_exhausted = undefined } = {}) {
277
+ export function openFormInstance(cargo, definition, specs, { parent = null, input = '', resume = '', task = '', providers = null, questions = null, context = false, resume_on_parent_change = undefined, incomplete_outcome = undefined, on_exhausted = undefined } = {}) {
278
278
  const incomplete = validateFormIncompleteOutcome(incomplete_outcome);
279
279
  validateFormExhaustion(on_exhausted);
280
280
  cargo.forms ||= {};
@@ -284,6 +284,8 @@ export function openFormInstance(cargo, definition, specs, { parent = null, inpu
284
284
  if (existing) {
285
285
  if (existing.definition !== definition || existing.parent !== parent || existing.result_input !== input || !!existing.context_only !== !!context || (task && existing.task !== task))
286
286
  throw new Error('FORM resume ownership mismatch');
287
+ if (resume_on_parent_change !== undefined)
288
+ existing.resume_on_parent_change = resume_on_parent_change === true;
287
289
  if (incomplete_outcome !== undefined)
288
290
  existing.incomplete_outcome = incomplete;
289
291
  if (on_exhausted !== undefined)
@@ -298,6 +300,8 @@ export function openFormInstance(cargo, definition, specs, { parent = null, inpu
298
300
  if (child && cargo.forms[child]) {
299
301
  if (cargo.forms[child].definition !== definition)
300
302
  throw new Error('FORM child definition changed without invalidation');
303
+ if (resume_on_parent_change !== undefined)
304
+ cargo.forms[child].resume_on_parent_change = resume_on_parent_change === true;
301
305
  if (incomplete_outcome !== undefined)
302
306
  cargo.forms[child].incomplete_outcome = incomplete;
303
307
  if (on_exhausted !== undefined)
@@ -308,7 +312,7 @@ export function openFormInstance(cargo, definition, specs, { parent = null, inpu
308
312
  cargo.formSequence = Number(cargo.formSequence || 0) + 1;
309
313
  const id = `${definition}:${cargo.formSequence}`;
310
314
  cargo.forms[id] = { id, definition, task: owner?.task || task || id, parent, result_input: input,
311
- on_exhausted: on_exhausted || '', incomplete_outcome: incomplete, context_only: !!context, parent_revision: owner?.revision ?? null, specs, values: {}, accepted: {}, errors: {}, pending: {}, seeds: {}, attempts: {}, misses: {}, feedback: {}, prepared: {}, data: {}, arguments: {}, contexts: {}, children: {}, childResults: {}, revision: 0,
315
+ on_exhausted: on_exhausted || '', incomplete_outcome: incomplete, context_only: !!context, resume_on_parent_change: resume_on_parent_change === true, parent_revision: owner?.revision ?? null, specs, values: {}, accepted: {}, errors: {}, pending: {}, seeds: {}, attempts: {}, misses: {}, feedback: {}, prepared: {}, data: {}, arguments: {}, contexts: {}, children: {}, childResults: {}, revision: 0,
312
316
  providers: providers || owner?.providers || null, questions: questions?.length ? questions : owner?.questions || [], status: 'collecting' };
313
317
  if (owner) {
314
318
  if (context) {
@@ -838,15 +842,39 @@ export function acceptFormReadings(cargo, hits, additionalCandidates = []) {
838
842
  }
839
843
  return true;
840
844
  }
841
- export function formInstanceApplies(cargo, id) {
842
- const state = cargo.forms?.[id];
845
+ /** Resolve the outermost stale opted-in context through actual active ownership, without mutation.
846
+ * An unflagged wrapper must not hide an ancestor whose owner accepted a different field value.
847
+ */
848
+ export function formParentResume(cargo, id, explicit = false) {
849
+ const forms = cargo?.forms || {}, seen = new Set();
850
+ let state = forms[id], selected = null;
843
851
  if (!state)
852
+ return null;
853
+ while (state) {
854
+ if (seen.has(state.id) || forms[state.id] !== state || state.status !== 'collecting')
855
+ return null;
856
+ seen.add(state.id);
857
+ if (!state.parent)
858
+ break;
859
+ const parent = forms[state.parent];
860
+ if (!parent || parent.task !== state.task || (state.context_only ? parent.contexts?.[state.definition] !== state.id : parent.children?.[state.result_input] !== state.id))
861
+ return null;
862
+ if (state.context_only && (state.resume_on_parent_change === true || state.id === id && explicit === true) && parent.revision !== state.parent_revision)
863
+ selected = { owner: parent.id, child: state.id };
864
+ state = parent;
865
+ }
866
+ return selected && formInstanceApplies(cargo, selected.owner) ? selected : null;
867
+ }
868
+ export function formInstanceApplies(cargo, id, seen = new Set()) {
869
+ const state = cargo.forms?.[id];
870
+ if (!state || seen.has(id))
844
871
  return false;
872
+ seen.add(id);
845
873
  if (!state.parent)
846
874
  return true;
847
875
  const parent = cargo.forms[state.parent];
848
876
  if (state.context_only)
849
- return !!parent && formInstanceApplies(cargo, parent.id);
877
+ return !!parent && formInstanceApplies(cargo, parent.id, seen);
850
878
  const input = parent?.specs.find(i => i.name === state.result_input);
851
879
  return !!input && formInputApplies(input, parent.values, cargo, parent) && !formInputFilled(input, parent, cargo);
852
880
  }
@@ -97,6 +97,7 @@ export namespace STANDARD_FUNCTIONS {
97
97
  export { invalidateFormInputs };
98
98
  export { acceptFormReadings };
99
99
  export { formInstanceApplies };
100
+ export { formParentResume };
100
101
  export { closeFormInstance };
101
102
  export { validateOTP };
102
103
  export { validateDigits };
@@ -205,6 +206,7 @@ import { rejectFormReadings } from './form-state.js';
205
206
  import { invalidateFormInputs } from './form-state.js';
206
207
  import { acceptFormReadings } from './form-state.js';
207
208
  import { formInstanceApplies } from './form-state.js';
209
+ import { formParentResume } from './form-state.js';
208
210
  import { closeFormInstance } from './form-state.js';
209
211
  import { checkOtp } from './otp-check.js';
210
212
  import { maskDestination } from './otp-check.js';
@@ -215,5 +217,5 @@ import { validatePhone } from './validators.js';
215
217
  import { validateEmail } from './validators.js';
216
218
  import { urlToSpeech } from './url-speech.js';
217
219
  import { textWithUrlToSpeech } from './url-speech.js';
218
- export { formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, validateMoneyOptions, takeChoiceOffer, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readInputProfile, 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, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, closeFormInstance, checkOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech };
220
+ export { formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, validateMoneyOptions, takeChoiceOffer, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readInputProfile, 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, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech };
219
221
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings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BAAiB;yBAC3pB,gBAAgB;gCAAhB,gBAAgB;4BAAhB,gBAAgB;8BAAhB,gBAAgB;+BACzB,iBAAiB;8BAAjB,iBAAiB;8BAAjB,iBAAiB;4BAC7B,iBAAiB;oCAAjB,iBAAiB"}
@@ -28,17 +28,17 @@ import { dateToWords } from './date-words.js';
28
28
  import { amountToSpeech } from './amount-to-speech.js';
29
29
  import { validateCardNumber, validateExpiration } from './card-checks.js';
30
30
  import { matchInputs, readFormAnswer, readInputProfile } from './match-inputs.js';
31
- 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, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, closeFormInstance } from './form-state.js';
31
+ 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, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance } from './form-state.js';
32
32
  import { checkOtp, maskDestination, validateOTP, OTP_EXPIRY_MS } from './otp-check.js';
33
33
  import { validateDigits, validatePhone, validateEmail } from './validators.js';
34
34
  import { urlToSpeech, textWithUrlToSpeech } from './url-speech.js';
35
- export { formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, validateMoneyOptions, takeChoiceOffer, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readInputProfile, 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, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, closeFormInstance, checkOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, };
35
+ export { formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, validateMoneyOptions, takeChoiceOffer, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readInputProfile, 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, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, };
36
36
  /** The functions flows call by name, ready to spread into a host's approved functions. */
37
37
  export const STANDARD_FUNCTIONS = {
38
38
  formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor,
39
39
  clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome,
40
40
  readMoneyAmount, isMoneyAmount, moneyIntentAllows, validateMoneyOptions, takeChoiceOffer, matchesChoice, isAnswer, isAgentRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice,
41
41
  readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
42
- normalizeAndFindCapture, anythingElse, goodbye, sayName, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readInputProfile, 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, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, closeFormInstance,
42
+ normalizeAndFindCapture, anythingElse, goodbye, sayName, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readInputProfile, 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, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance,
43
43
  validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech,
44
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AA2EA;;;GAGG;AACH,sFAmGC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;mHACmH;AACnH;;;;;EAeC;AACD;;;;;;EA6EC"}
1
+ {"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAiGA;;;GAGG;AACH,sFAmGC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;mHACmH;AACnH;;;;;EAeC;AACD;;;;;;EAyHC"}
@@ -77,6 +77,26 @@ function emailSpans(raw, value) {
77
77
  }
78
78
  return [[0, raw.length]];
79
79
  }
80
+ /** Explicitly revise a declared choice, rather than mentioning it inside a requested narrative.
81
+ * The remaining correction clause must itself be a whole declared choice; a cue alone is not authority.
82
+ */
83
+ function choiceCorrection(raw, choices, value) {
84
+ const prefix = /^\s*(?:(?:please|por favor)\s+)?(?:actually|instead|rather|i (?:mean|meant)|make it|switch to|change (?:it |the service |my service )?to|en realidad|mejor|quise decir|quiero decir|cambi(?:a|e|é|ar) (?:el servicio )?a)\s*[,;:]?\s+/iu;
85
+ const suffix = /\s+(?:instead|en su lugar)\s*[.!]?\s*$/iu;
86
+ const clauses = [raw, ...raw.split(/[,;\n]/)];
87
+ return clauses.some(clause => {
88
+ const replaced = clause.replace(prefix, '').replace(suffix, '');
89
+ return replaced !== clause && pickChoice(replaced.split(/[,;\n]/)[0], choices, false) === value;
90
+ });
91
+ }
92
+ /** Remove independently spent evidence while leaving the original narrative value intact. */
93
+ function unclaimedSpans(raw, readings) {
94
+ let spans = [[0, raw.length]];
95
+ for (const [start, end] of readings.flatMap(reading => reading.spans || [])) {
96
+ spans = spans.flatMap(([a, b]) => end <= a || start >= b ? [[a, b]] : [[a, Math.max(a, start)], [Math.min(b, end), b]].filter(([a, b]) => b > a));
97
+ }
98
+ return spans;
99
+ }
80
100
  /**
81
101
  * One input's reading of the answer: { value, evidence } or null. `evidence` is what the answer spent on it (digits
82
102
  * or words), so two inputs that claim the same part of the answer are told apart from a compound answer.
@@ -116,7 +136,7 @@ export function readInputProfile(profile, answer, isCurrent = true) {
116
136
  const { option_label, option_label_es, ...one } = readings[0];
117
137
  return one;
118
138
  }
119
- return isCurrent && profile.accept_other === true && raw.trim() ? { value: raw.trim(), spans: [[0, raw.length]] } : null;
139
+ return isCurrent && profile.accept_other === true && raw.trim() ? { value: raw.trim(), ...(profile.narrative === true ? { fallback: true } : {}), spans: [[0, raw.length]] } : null;
120
140
  }
121
141
  else if (kind === 'amount') {
122
142
  const money = profile.money;
@@ -138,7 +158,7 @@ export function readInputProfile(profile, answer, isCurrent = true) {
138
158
  }
139
159
  }
140
160
  else if (kind === 'email') {
141
- const e = readEmail(raw);
161
+ const e = readEmail(raw, { literal: profile.literal === true });
142
162
  if (e) {
143
163
  return { value: e, spans: emailSpans(raw, e), evidence: [`e:${e}`] };
144
164
  }
@@ -252,6 +272,7 @@ export function matchInputs(answer, candidates, current, choiceKey) {
252
272
  const list = Array.isArray(candidates) ? candidates.filter((c) => c && c.name && c.profile) : [];
253
273
  const cur = current && typeof current === 'object' ? current : {};
254
274
  const isCur = (c) => (Array.isArray(cur.names) ? cur.names.indexOf(c.name) > -1 : c.name === cur.name) && (cur.form === undefined || c.form === cur.form);
275
+ const narrativeCurrent = list.some(field => isCur(field) && ['text', 'choice'].includes(field.profile.kind) && field.profile.narrative === true);
255
276
  const own = Array.isArray(cur.names) ? undefined : list.filter(isCur)[0]; // a group has no single own choice list
256
277
  // A form's scope level: 0 for the current input's form, then each further form in the order the chain lists them.
257
278
  const forms = [];
@@ -265,27 +286,74 @@ export function matchInputs(answer, candidates, current, choiceKey) {
265
286
  forms.push(c.scope || c.form);
266
287
  }
267
288
  else { /* already ranked */ } });
268
- const readings = [];
289
+ let readings = [];
269
290
  for (const c of list) {
270
- let r = readInputProfile(c.profile, raw, isCur(c));
291
+ const profile = narrativeCurrent && c.profile.kind === 'email' ? { ...c.profile, literal: true } : c.profile;
292
+ let r = readInputProfile(profile, raw, isCur(c));
293
+ // An opted-in narrative can still receive an explicit correction whose declared word
294
+ // is otherwise a strict acknowledgement (for example Spanish `seguro`). Preserve the
295
+ // noncurrent keypad/current-only rules when recognizing that correction clause.
296
+ if (!r && !isCur(c) && c.profile.kind === 'choice' && narrativeCurrent) {
297
+ const corrected = (c.profile.choices || []).filter(choice => choice.current_only !== true).map(choice => ({ ...choice, exact: true, words: (choice.words || []).filter(word => c.profile.numeric_values === true || !/^[\d*#]$/.test(String(word).trim())) })).filter(choice => choiceCorrection(raw, [choice], choice.key)).map(choice => ({ value: choice.key, spans: choiceSpans(raw, choice.words) }));
298
+ if (corrected.length)
299
+ r = corrected.length === 1 ? corrected[0] : { alternatives: corrected };
300
+ }
271
301
  // A semantic choice supplied by ask-choice (e.g. spoken keypad keys) is a reading, not an early return.
272
302
  if (!r && c === own && choiceKey && c.profile.kind === 'choice' && (c.profile.choices || []).some(x => x.key === choiceKey)) {
273
303
  r = { ...(r || {}), value: choiceKey, spans: r?.spans?.length ? r.spans : [[0, raw.length]] };
274
304
  }
275
305
  if (r) {
276
306
  for (const option of r.alternatives || [r]) {
277
- readings.push({ form: c.form, name: c.name, value: option.value, ...(option.refused === true ? { refused: true } : {}), known: c.value !== undefined && c.value !== null && String(c.value) === String(option.value), spans: option.spans, keypad: option.keypad === true, fallback: option.fallback === true,
307
+ const known = c.value !== undefined && c.value !== null && String(c.value) === String(option.value);
308
+ // A repeated choice may be the whole answer or only context in the requested field's answer.
309
+ // Use the same whole-answer vocabulary as explicit choices, including courtesy and articles.
310
+ const repeatedChoice = known && !isCur(c) && c.profile.kind === 'choice';
311
+ const isChoice = !isCur(c) && c.profile.kind === 'choice';
312
+ const wholeOptions = isChoice ? (c.profile.choices || []).filter(choice => choice.key === option.value).map(choice => ({ ...choice, exact: true })) : [];
313
+ const wholeChoice = isChoice && [raw, raw.replace(/\d(?:[\s.-]?\d)*/g, run => run.replace(/\D/g, ''))].some(text => pickChoice(text, wholeOptions, false) === option.value);
314
+ readings.push({ form: c.form, name: c.name, value: option.value, ...(option.refused === true ? { refused: true } : {}), known, repeatedChoice, wholeChoice, choice: isChoice, correctiveChoice: isChoice && choiceCorrection(raw, wholeOptions, option.value), narrative: isCur(c) && ['text', 'choice'].includes(c.profile.kind) && c.profile.narrative === true, resetOn: Array.isArray(c.reset_on) ? c.reset_on : [], spans: option.spans, keypad: option.keypad === true, fallback: option.fallback === true,
278
315
  ...(r.alternatives ? { option_label: option.option_label, option_label_es: option.option_label_es } : {}), group: c.group, exclusive: c.exclusive === true, level: forms.indexOf(c.scope || c.form), current: isCur(c), confirm: Array.isArray(c.confirm_against) ? c.confirm_against : [] });
279
316
  }
280
317
  }
281
318
  }
282
- // Readings that spent the same evidence form a group (connected components).
283
- const conflicts = (a, b) => a.form === b.form && (a.name === b.name && a.value !== b.value || a.exclusive && b.exclusive && a.group && a.group === b.group && a.name !== b.name) || (a.spans || []).some(([s, e]) => (b.spans || []).some(([t, u]) => s < u && t < e));
284
- const parent = readings.map((_, i) => i);
319
+ const paired = (a, b) => a.confirm.indexOf(b.name) > -1 || b.confirm.indexOf(a.name) > -1;
320
+ // Narrative ownership protects ancestor choices and same-form choices that reset
321
+ // the requested field. Other sibling choices remain independent compound data. A current choice can carry narrative context too (e.g. a channel plus a
322
+ // complaint). Preserve declared corrections and confirmation pairs, and leave all
323
+ // independently shaped non-choice fields available for compound collection.
324
+ const owners = readings.filter(reading => reading.current && reading.narrative);
325
+ readings = readings.filter(reading => !reading.choice || !owners.some(owner => (reading.level > owner.level || reading.form === owner.form && owner.resetOn.includes(reading.name)) && !reading.wholeChoice && !reading.correctiveChoice && !paired(owner, reading)));
326
+ const fieldConflict = (a, b) => a.form === b.form && (a.name === b.name && a.value !== b.value || a.exclusive && b.exclusive && a.group && a.group === b.group && a.name !== b.name);
327
+ const overlap = (a, b) => (a.spans || []).some(([s, e]) => (b.spans || []).some(([t, u]) => s < u && t < e));
328
+ const competes = (a, b) => fieldConflict(a, b) || overlap(a, b);
329
+ // Resolve fallback ownership before grouping: a losing whole-answer text span cannot join
330
+ // independent structured evidence into an ambiguity. Known contextual choice mentions do
331
+ // not displace current text; whole-answer repetitions and explicit pairs still compete.
332
+ const fallbacks = readings.filter(reading => reading.fallback);
333
+ // An opted-in narrative may provide both rationale and separately shaped fields. Only
334
+ // unclaimed prose is its evidence: a bare number/address still fills the structured slot alone.
335
+ for (const fallback of fallbacks.filter(reading => reading.narrative)) {
336
+ const structured = readings.filter(reading => !reading.fallback);
337
+ const prose = unclaimedSpans(raw, structured);
338
+ if (prose.some(([a, b]) => /\p{L}/u.test(raw.slice(a, b)))) {
339
+ const independent = structured.filter(reading => (!reading.choice || reading.level === fallback.level && !reading.wholeChoice && !reading.correctiveChoice && !fallback.resetOn.includes(reading.name)) && !fieldConflict(fallback, reading) && !paired(fallback, reading));
340
+ if (independent.length)
341
+ fallback.spans = unclaimedSpans(raw, independent);
342
+ }
343
+ }
344
+ const contextualChoice = (fallback, reading) => !paired(fallback, reading) && !reading.wholeChoice && (reading.repeatedChoice && !(fallback.narrative && reading.correctiveChoice) || fallback.narrative && reading.choice && (reading.level > fallback.level || reading.form === fallback.form && fallback.resetOn.includes(reading.name)) && !reading.correctiveChoice);
345
+ const stronger = new Map(fallbacks.map(fallback => [fallback, readings.filter(reading => !reading.fallback && competes(fallback, reading) && !contextualChoice(fallback, reading))]));
346
+ const keptFallbacks = fallbacks.filter(fallback => !stronger.get(fallback).length || stronger.get(fallback).some(reading => paired(fallback, reading)));
347
+ const pairedFallbacks = new Set(keptFallbacks.filter(fallback => stronger.get(fallback).length));
348
+ const effective = readings.filter(reading => reading.fallback ? keptFallbacks.includes(reading) : !keptFallbacks.some(fallback => competes(fallback, reading) && contextualChoice(fallback, reading)));
349
+ // A fallback retained for a declared pair must not bridge unrelated source spans either.
350
+ const conflicts = (a, b) => fieldConflict(a, b) || overlap(a, b) && !(pairedFallbacks.has(a) && !b.fallback && !paired(a, b) || pairedFallbacks.has(b) && !a.fallback && !paired(a, b));
351
+ // Readings that spent the same effective evidence form a group (connected components).
352
+ const parent = effective.map((_, i) => i);
285
353
  const find = (i) => (parent[i] === i ? i : (parent[i] = find(parent[i])));
286
- for (let i = 0; i < readings.length; i++) {
287
- for (let j = i + 1; j < readings.length; j++) {
288
- if (conflicts(readings[i], readings[j])) {
354
+ for (let i = 0; i < effective.length; i++) {
355
+ for (let j = i + 1; j < effective.length; j++) {
356
+ if (conflicts(effective[i], effective[j])) {
289
357
  parent[find(i)] = find(j);
290
358
  }
291
359
  else {
@@ -294,16 +362,13 @@ export function matchInputs(answer, candidates, current, choiceKey) {
294
362
  }
295
363
  }
296
364
  const groups = {};
297
- readings.forEach((r, i) => { (groups[find(i)] = groups[find(i)] || []).push(r); });
298
- const strip = ({ evidence, spans, keypad, fallback, level, group, exclusive, current: c, confirm, ...r }) => r;
299
- const paired = (a, b) => a.confirm.indexOf(b.name) > -1 || b.confirm.indexOf(a.name) > -1;
365
+ effective.forEach((r, i) => { (groups[find(i)] = groups[find(i)] || []).push(r); });
366
+ const strip = ({ evidence, spans, keypad, fallback, repeatedChoice, wholeChoice, choice, correctiveChoice, narrative, resetOn, level, group, exclusive, current: c, confirm, ...r }) => r;
300
367
  const hits = [];
301
368
  let ambiguous = [];
302
369
  const remaining = [];
303
370
  for (const group of Object.values(groups)) {
304
- // Free text is a fallback; a specific claim to the same source evidence is stronger.
305
- const specific = group.filter(m => !m.fallback);
306
- const members = specific.length ? specific.concat(group.filter(m => m.fallback && specific.some(s => paired(m, s)))) : group;
371
+ const members = group;
307
372
  let winners;
308
373
  if (members.length === 1) {
309
374
  winners = members;
package/dist/index.d.ts CHANGED
@@ -569,7 +569,7 @@ export interface PathTraversableObject {
569
569
  [key: string]: unknown;
570
570
  }
571
571
  export declare function getFlowForInput(input: string, engine: Engine): Promise<FlowDefinition | null>;
572
- export declare function detectFlowWithParameters(input: string, engine: Engine): Promise<{
572
+ export declare function detectFlowWithParameters(input: string, engine: Engine, continuation?: FlowDefinition): Promise<{
573
573
  flow: FlowDefinition;
574
574
  parameters?: Record<string, any>;
575
575
  } | null>;
@@ -668,6 +668,8 @@ export declare class WorkflowEngine implements Engine {
668
668
  * within the same call and routes the turn's input to intent detection. Never persisted.
669
669
  */
670
670
  pendingDispatchFrom: string | null;
671
+ /** Internal per-turn routing callback; never serialized or retained across updateActivity calls. */
672
+ dispatchIfMatched: ((frame: FlowFrame, step: any) => Promise<boolean>) | null;
671
673
  private enabledCommands;
672
674
  private commandsEnabled;
673
675
  private sessionContext;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAyB1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAyBlE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,EAAE,CASxD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,EAAE,CASxD;AAGD;;;;;;;;;;;;GAYG;AAIH,qBAAa,kBAAmB,SAAQ,KAAK;aACE,KAAK,CAAC,EAAE,KAAK;gBAA9C,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,KAAK,YAAA;CAI3D;AAED,MAAM,W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,CAAC,sBAAsB;IAe9B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmChC;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,GAAE,GAAQ,GAAG,GAAG;IAkHxC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAwE5B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA2BhC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAiC9B;;OAEG;IACH,OAAO,CAAC,2BAA2B;IA2CnC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA6BhC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAwB7B,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,2BAA2B;CAKpC"}
package/dist/index.js CHANGED
@@ -1830,9 +1830,52 @@ function reportToolFailure(engine, tool, result) {
1830
1830
  logger.warn(`Tool ${tool.id}: failure report failed (${e.message}); result delivered unchanged`);
1831
1831
  }
1832
1832
  }
1833
- function validateToolArgs(tool, args) {
1833
+ // Flat parameter maps and object schemas describe named argument bags. Explicitly non-object
1834
+ // schemas retain their existing typed values, including a declared nullable root.
1835
+ function usesToolArgumentBag(schema) {
1836
+ const type = schema?.type;
1837
+ if (typeof type === 'string')
1838
+ return type === 'object';
1839
+ if (Array.isArray(type))
1840
+ return type.every((name) => name === 'object');
1841
+ if (schema === undefined || schema === null)
1842
+ return true;
1843
+ if (typeof schema !== 'object')
1844
+ return false;
1845
+ // A typeless JSON Schema can admit primitive/array/null roots. Only a clear flat field
1846
+ // map has the named-bag contract; do not infer it from a schema's missing `type`.
1847
+ const objectKeywords = ['properties', 'patternProperties', 'additionalProperties', 'propertyNames',
1848
+ 'items', 'additionalItems', 'contains', 'unevaluatedProperties', 'unevaluatedItems',
1849
+ 'allOf', 'anyOf', 'oneOf', 'not', 'if', 'then', 'else', 'enum', 'const', 'contentSchema'];
1850
+ if (Object.keys(schema).some((key) => key.startsWith('$') || objectKeywords.includes(key)))
1851
+ return false;
1852
+ return Object.values(schema).every((field) => field !== null && typeof field === 'object' && !Array.isArray(field));
1853
+ }
1854
+ function validateToolArgs(tool, supplied) {
1855
+ const declared = tool.parameters || tool.schema;
1856
+ let args = supplied;
1857
+ const objectBranch = Array.isArray(declared?.type) && declared.type.includes('object') &&
1858
+ supplied !== null && typeof supplied === 'object' && !Array.isArray(supplied);
1859
+ if (usesToolArgumentBag(declared) || objectBranch) {
1860
+ // A null/absent previous tool result supplies no named arguments. Never pass that value to
1861
+ // a positional adapter, or mutate a previous result while filling this tool's defaults.
1862
+ if (supplied !== null && supplied !== undefined && (typeof supplied !== 'object' || Array.isArray(supplied))) {
1863
+ throw new Error('Tool arguments must be an object');
1864
+ }
1865
+ if (supplied === null || supplied === undefined) {
1866
+ args = {};
1867
+ const properties = declared?.properties || (declared && !declared.type ? declared : {});
1868
+ for (const [key, property] of Object.entries(properties)) {
1869
+ if (property && typeof property === 'object' && property.default !== undefined) {
1870
+ // Only a newly normalized absent bag receives defaults. Preserve supplied objects
1871
+ // and their existing adapter/payload semantics; each new default owns its JSON copy.
1872
+ args[key] = JSON.parse(JSON.stringify(property.default));
1873
+ }
1874
+ }
1875
+ }
1876
+ }
1834
1877
  if (!tool.parameters)
1835
- return args; // No validation schema
1878
+ return args; // Preserve the existing schema validation policy.
1836
1879
  if (!ajv)
1837
1880
  return args; // ajv not available — skip validation
1838
1881
  const validate = ajv.compile(tool.parameters);
@@ -2121,8 +2164,8 @@ async function detectLanguage(input, engine) {
2121
2164
  }
2122
2165
  }
2123
2166
  // === FLOW EXECUTION ENGINE WITH ENHANCED ERROR HANDLING ===
2124
- async function isFlowActivated(input, engine, userId = 'anonymous') {
2125
- const result = await detectFlowWithParameters(input, engine);
2167
+ async function isFlowActivated(input, engine, userId = 'anonymous', detected) {
2168
+ const result = detected === undefined ? await detectFlowWithParameters(input, engine) : detected;
2126
2169
  if (result && result.flow) {
2127
2170
  const flow = result.flow;
2128
2171
  const parameters = result.parameters;
@@ -2173,6 +2216,16 @@ async function isFlowActivated(input, engine, userId = 'anonymous') {
2173
2216
  }
2174
2217
  return null;
2175
2218
  }
2219
+ function stampStepRecovery(step, currentFlowFrame, engine) {
2220
+ if (step.recovery !== undefined) {
2221
+ const resolved = Object.fromEntries(Object.entries(step.recovery).map(([key, value]) => [key, typeof value === 'string' && value.includes('{{') ? interpolateMessage(value, currentFlowFrame.contextStack, currentFlowFrame.variables, engine).trim() : value]));
2222
+ if (resolved.form === '' && resolved.flow === '') {
2223
+ delete resolved.form;
2224
+ delete resolved.flow;
2225
+ }
2226
+ engine.stampFlowRecovery(validateFlowRecovery(resolved));
2227
+ }
2228
+ }
2176
2229
  async function playFlowFrame(engine) {
2177
2230
  // Enhanced recursion protection using natural stack depth
2178
2231
  const stackDepth = getCurrentStackLength(engine);
@@ -2323,15 +2376,9 @@ async function playFlowFrame(engine) {
2323
2376
  const step = currentFlowFrame.flowStepsStack[currentFlowFrame.flowStepsStack.length - 1];
2324
2377
  const startTime = Date.now();
2325
2378
  try {
2326
- if (step.recovery !== undefined) {
2327
- const declaration = step.recovery;
2328
- const resolved = Object.fromEntries(Object.entries(declaration).map(([key, value]) => [key, typeof value === 'string' && value.includes('{{') ? interpolateMessage(value, currentFlowFrame.contextStack, currentFlowFrame.variables, engine).trim() : value]));
2329
- if (resolved.form === '' && resolved.flow === '') {
2330
- delete resolved.form;
2331
- delete resolved.flow;
2332
- }
2333
- engine.stampFlowRecovery(validateFlowRecovery(resolved));
2334
- }
2379
+ // A conditional handoff declares recovery only after a target has been selected.
2380
+ if (!(step.type === 'DISPATCH' && step.onResponse === 'continue'))
2381
+ stampStepRecovery(step, currentFlowFrame, engine);
2335
2382
  const result = await playStep(currentFlowFrame, engine);
2336
2383
  const duration = Date.now() - startTime;
2337
2384
  TransactionManager.addStep(currentFlowFrame.transaction, step, result, duration, 'success');
@@ -2359,6 +2406,12 @@ async function playFlowFrame(engine) {
2359
2406
  return result;
2360
2407
  }
2361
2408
  // DISPATCH ended every flow; processActivity routes this turn's input (see handleDispatchStep)
2409
+ if (step.type === 'DISPATCH' && step.onResponse === 'continue') {
2410
+ // ContinueCurrent retains the stack; a workflow replaces it; None hands off to the host.
2411
+ if (engine.pendingDispatchFrom !== null)
2412
+ return result;
2413
+ continue;
2414
+ }
2362
2415
  if (step.type === 'DISPATCH') {
2363
2416
  logger.info(`DISPATCH step executed, all flows ended; handing this turn's input back to intent detection`);
2364
2417
  return result;
@@ -2445,7 +2498,7 @@ async function playStep(currentFlowFrame, engine) {
2445
2498
  case 'END':
2446
2499
  return handleEndStep(currentFlowFrame);
2447
2500
  case 'DISPATCH':
2448
- return handleDispatchStep(currentFlowFrame, engine);
2501
+ return await handleDispatchStep(currentFlowFrame, engine);
2449
2502
  default:
2450
2503
  throw new Error(`Unknown step type: ${step.type}`);
2451
2504
  }
@@ -2821,7 +2874,7 @@ export async function getFlowForInput(input, engine) {
2821
2874
  const result = await detectFlowWithParameters(input, engine);
2822
2875
  return result ? result.flow : null;
2823
2876
  }
2824
- export async function detectFlowWithParameters(input, engine) {
2877
+ export async function detectFlowWithParameters(input, engine, continuation) {
2825
2878
  // CRITICAL: This function requires AI access via engine.aiCallback
2826
2879
  // Without AI, the engine cannot detect user intent and activate flows
2827
2880
  // Sessions would never be activated as no workflows could be triggered
@@ -2839,7 +2892,7 @@ export async function detectFlowWithParameters(input, engine) {
2839
2892
  }
2840
2893
  // Filter to only primary flows for AI intent detection
2841
2894
  const primaryFlows = flowsMenu.filter(flow => flow.primary === true);
2842
- const flowsForIntentDetection = primaryFlows.length > 0 ? primaryFlows : flowsMenu;
2895
+ const flowsForIntentDetection = (primaryFlows.length > 0 ? primaryFlows : flowsMenu).concat(continuation ? [continuation] : []);
2843
2896
  logger.debug(`Using ${flowsForIntentDetection.length} flows for intent detection (${primaryFlows.length} primary flows available)`);
2844
2897
  // A host start (ContextEntry.start) answers detection for this turn: that flow, with its arguments.
2845
2898
  if (engine.hostStart) {
@@ -2904,7 +2957,7 @@ export async function detectFlowWithParameters(input, engine) {
2904
2957
  const request = buildDetectFlowRequest(input, engine.lastChatTurn, flowsForIntentDetection);
2905
2958
  const aiResponse = await fetchAiTask(task, rules, context, input, flowsForIntentDetection, jsonSchema, engine.aiCallback, engine.aiTimeOut, request);
2906
2959
  if (aiResponse && aiResponse.flowName && aiResponse.flowName !== 'None' && aiResponse.flowName !== 'null') {
2907
- const flow = flowsMenu.find(flow => flow.name.toLowerCase() === aiResponse.flowName.toLowerCase() || flow.id === aiResponse.flowName);
2960
+ const flow = flowsMenu.concat(continuation ? [continuation] : []).find(flow => flow.name.toLowerCase() === aiResponse.flowName.toLowerCase() || flow.id === aiResponse.flowName);
2908
2961
  if (flow) {
2909
2962
  // Defensive: strip empty-string keys from AI-generated parameters.
2910
2963
  // AI occasionally emits { "": value } which would cascade into flow
@@ -3962,7 +4015,19 @@ function handleReturnStep(currentFlowFrame, engine) {
3962
4015
  // Return the evaluated value as string
3963
4016
  return String(returnValue);
3964
4017
  }
3965
- function handleDispatchStep(currentFlowFrame, engine) {
4018
+ async function handleDispatchStep(currentFlowFrame, engine) {
4019
+ const pending = currentFlowFrame.flowStepsStack[currentFlowFrame.flowStepsStack.length - 1];
4020
+ if (pending.onResponse === 'continue') {
4021
+ // Detection precedes any pop, declaration, transaction finalization or state reset.
4022
+ // A model error leaves this live continuation available to the caller's error policy.
4023
+ const matched = engine.dispatchIfMatched ? await engine.dispatchIfMatched(currentFlowFrame, pending) : false;
4024
+ if (!matched)
4025
+ currentFlowFrame.flowStepsStack.pop();
4026
+ return '';
4027
+ }
4028
+ return terminateForDispatch(currentFlowFrame, engine);
4029
+ }
4030
+ function terminateForDispatch(currentFlowFrame, engine) {
3966
4031
  // DISPATCH = forget every flow and treat THIS turn's input as if no flow had been active:
3967
4032
  // processActivity runs intent detection on the input the turn started with (never a flow
3968
4033
  // variable a step may have rewritten). It resets ALL engine flow state — every stack, the
@@ -4278,6 +4343,8 @@ async function generateToolArgs(schema, input, contextStack = [], flowFrame, eng
4278
4343
  return {};
4279
4344
  }
4280
4345
  logger.info(`Generating tool arguments for schema: ${schema.name || schema.title || 'unknown'}`);
4346
+ // Preserve raw null until validation can distinguish an absent bag from a supplied {}.
4347
+ // Undefined retains the existing flow-variable and AI inference path below.
4281
4348
  if (typeof input === 'object') {
4282
4349
  // the caller passed the arguments already built: used as given (keys only, never the values: they can be personal data)
4283
4350
  logger.info(`Using input object directly for args: ${Object.keys(input || {}).join(', ')}`);
@@ -5768,6 +5835,43 @@ async function processActivity(input, userId, engine) {
5768
5835
  logger.debug(`Current stack length: ${getCurrentStackLength(engine)}`);
5769
5836
  // A DISPATCH is consumed within the call that raised it; never carry one into another turn.
5770
5837
  engine.pendingDispatchFrom = null;
5838
+ // One routing decision for the original turn, shared by guarded and ordinary dispatch.
5839
+ let detected;
5840
+ let activatedThisTurn = false;
5841
+ let guardedRoutingFailed = false;
5842
+ const route = async (continuation) => {
5843
+ if (detected === undefined)
5844
+ detected = await detectFlowWithParameters(String(sanitizedInput), engine, continuation);
5845
+ return detected;
5846
+ };
5847
+ engine.dispatchIfMatched = async (frame, step) => {
5848
+ if (activatedThisTurn)
5849
+ return false;
5850
+ if (engine.flowsMenu.some(flow => flow.name.toLowerCase() === 'continuecurrent' || flow.id.toLowerCase() === '__jsfe_continue_current__'))
5851
+ throw new Error('ContinueCurrent is reserved for contextual dispatch');
5852
+ const context = interpolateMessage(step.responseContext, frame.contextStack, frame.variables, engine).trim();
5853
+ const continuation = { id: '__jsfe_continue_current__', name: 'ContinueCurrent', version: '1.0.0', primary: true, steps: [], description: `The caller is responding to the requested ${context} or reports that the requested information is invalid, unknown or unavailable; datos incorrectos o inválidos, no lo sé, no lo tengo, no puedo dar el dato. Includes asking how to provide the requested information. Not a different service request or unrelated question; choose its workflow when offered, otherwise None for the host.` };
5854
+ let selected;
5855
+ try {
5856
+ selected = await route(continuation);
5857
+ }
5858
+ catch (error) {
5859
+ guardedRoutingFailed = true;
5860
+ throw error;
5861
+ }
5862
+ if (selected?.flow.id === continuation.id)
5863
+ return false;
5864
+ stampStepRecovery(step, frame, engine);
5865
+ terminateForDispatch(frame, engine);
5866
+ if (!selected)
5867
+ return true; // Real host handoff: ordinary dispatch consumes the cached None below.
5868
+ engine.pendingDispatchFrom = null;
5869
+ engine.recordDispatch({ fromFlow: frame.flowName, matchedFlow: selected.flow.name });
5870
+ engine.clearFlowOutcome();
5871
+ activatedThisTurn = true;
5872
+ await isFlowActivated(String(sanitizedInput), engine, userId, selected);
5873
+ return true;
5874
+ };
5771
5875
  // Check if we're already in a flow (using new stack-of-stacks)
5772
5876
  if (getCurrentStackLength(engine) > 0) {
5773
5877
  logger.info(`\n=== [${new Date().toISOString()}] Flow Handling query: ${input} ===`);
@@ -5828,7 +5932,7 @@ async function processActivity(input, userId, engine) {
5828
5932
  logger.error(`Flow execution error: ${error.message}`);
5829
5933
  logger.info(`Stack trace: ${error.stack}`);
5830
5934
  // Clean up failed flow
5831
- if (getCurrentStackLength(engine) > 0) {
5935
+ if (!guardedRoutingFailed && getCurrentStackLength(engine) > 0) {
5832
5936
  const failedFrame = popFromCurrentStack(engine);
5833
5937
  TransactionManager.fail(failedFrame.transaction, error.message);
5834
5938
  }
@@ -5841,7 +5945,10 @@ async function processActivity(input, userId, engine) {
5841
5945
  const dispatchedFrom = engine.pendingDispatchFrom;
5842
5946
  engine.pendingDispatchFrom = null;
5843
5947
  try {
5844
- const activatedFlow = await isFlowActivated(String(sanitizedInput), engine, userId);
5948
+ const routed = await route();
5949
+ const activatedFlow = activatedThisTurn || routed?.flow.id === '__jsfe_continue_current__' ? null : await isFlowActivated(String(sanitizedInput), engine, userId, routed);
5950
+ if (activatedFlow)
5951
+ activatedThisTurn = true;
5845
5952
  if (dispatchedFrom !== null) {
5846
5953
  engine.recordDispatch({ fromFlow: dispatchedFrom, matchedFlow: activatedFlow ? activatedFlow.name : null });
5847
5954
  if (activatedFlow) {
@@ -5901,6 +6008,9 @@ async function processActivity(input, userId, engine) {
5901
6008
  // Re-throw as-is — let the host distinguish JSFEExecutionError from intent detection errors
5902
6009
  throw error;
5903
6010
  }
6011
+ finally {
6012
+ engine.dispatchIfMatched = null;
6013
+ }
5904
6014
  }
5905
6015
  // === WORKFLOW ENGINE CLASS ===
5906
6016
  // Words an expression may use that are not flow variables: JavaScript keywords, literals and the built-ins the
@@ -6069,6 +6179,8 @@ export class WorkflowEngine {
6069
6179
  * within the same call and routes the turn's input to intent detection. Never persisted.
6070
6180
  */
6071
6181
  pendingDispatchFrom = null;
6182
+ /** Internal per-turn routing callback; never serialized or retained across updateActivity calls. */
6183
+ dispatchIfMatched = null;
6072
6184
  // Command management for different application types (chat vs voice vs automation)
6073
6185
  enabledCommands;
6074
6186
  commandsEnabled;
@@ -7116,12 +7228,18 @@ export class WorkflowEngine {
7116
7228
  case 'DISPATCH': {
7117
7229
  // DISPATCH always routes the turn's own input — no value. It may declare the ending of the
7118
7230
  // flows it ends (`outcome` / `reason`, kept only when no flow matches).
7119
- const extra = Object.keys(step).filter(k => !['id', 'type', 'outcome', 'reason', 'recovery'].includes(k));
7231
+ const extra = Object.keys(step).filter(k => !['id', 'type', 'outcome', 'reason', 'recovery', 'onResponse', 'responseContext'].includes(k));
7120
7232
  if (extra.length > 0) {
7121
- state.errors.push(`DISPATCH step "${step.id}" in flow "${flowDef.name}" has invalid attribute(s) ${extra.map(k => `"${k}"`).join(', ')} - DISPATCH takes only "id", "outcome", "reason" and "recovery"`);
7233
+ state.errors.push(`DISPATCH step "${step.id}" in flow "${flowDef.name}" has invalid attribute(s) ${extra.map(k => `"${k}"`).join(', ')} - DISPATCH takes only "id", "outcome", "reason", "recovery", "onResponse" and "responseContext"`);
7122
7234
  }
7123
- else {
7124
- // well-formed
7235
+ else if (step.onResponse !== undefined && step.onResponse !== 'continue') {
7236
+ state.errors.push(`DISPATCH step "${step.id}" in flow "${flowDef.name}" onResponse must be "continue" when provided`);
7237
+ }
7238
+ else if (step.onResponse === 'continue' && (typeof step.responseContext !== 'string' || !step.responseContext.trim())) {
7239
+ state.errors.push(`DISPATCH step "${step.id}" in flow "${flowDef.name}" requires a non-empty responseContext for contextual dispatch`);
7240
+ }
7241
+ else if (step.responseContext !== undefined && step.onResponse !== 'continue') {
7242
+ state.errors.push(`DISPATCH step "${step.id}" in flow "${flowDef.name}" responseContext requires onResponse:"continue"`);
7125
7243
  }
7126
7244
  break;
7127
7245
  }
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:665b33c4b0ecad0f66b71c07956e793bee8983f92b047dfb4a0f2db13f3fc1a8";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:e1f92f33ed78b9489b674bdfe64d7aa56c2ea039cee48410767bbf6e0f22bfbc";
@@ -49,6 +49,8 @@ END — Returns from the current flow only, resuming its caller at the step afte
49
49
 
50
50
  DISPATCH — Ends every flow (all stacks, and any SAY output not yet delivered) and routes the user's input for THIS turn through intent detection, exactly as if no flow had been active: a matching flow starts in the same turn, otherwise the host AI/RAG answers. Takes an id and optionally outcome/reason (no value): the ended flows' outcome reaches the host only when no flow matches. Use it right after a SAY-GET whose answer may really be a new request — e.g. the "default" branch of a menu's CASE, or the answer to "Anything else?" — so the user can move from flow to flow.
51
51
 
52
+ Conditional handoff — `DISPATCH` may declare `onResponse: "continue"` and a non-empty `responseContext` describing the current requested information. This scoped routing offers a reserved `ContinueCurrent` disposition alongside the primary workflows and `None`: a response (including invalid data or clarification) keeps the live continuation and executes the following authored recovery steps; a named workflow replaces the stacks; an unrelated request with no workflow (`None`) hands off to the host as usual. The decision precedes termination, recovery and outcome stamping, is reused once, and never restores a snapshot. Detection errors propagate with the continuation intact. Ordinary DISPATCH behavior is unchanged when the option is absent.
53
+
52
54
  Declared outcome — the step that ends a flow (RETURN, END, DISPATCH or a final SAY) may carry outcome and reason (both accept {{}}): "unresolved" (the user's need was not met; the flow's transaction is marked failed), "deflected" (a decoy flow absorbed a false-positive intent by design), "resolved" (informational). An outcome that interpolates to empty declares nothing. The host reads it to recover from an unresolved ending.
53
55
 
54
56
  ## Cargo — Session-Persistent State
@@ -35,3 +35,21 @@ Acceptance must include real engine-produced states through the actual host outc
35
35
  The shared proposal contract is opt-in through input declarations or validator descriptors. It retains candidates before canonical acceptance, uses an owned exact-confirmation context and revalidates proof before commit. No host or website changes are part of this implementation. The contract is included in JSFE 1.7.3. Publishing and pinning the package do not activate regenerated flow definitions or deploy a host.
36
36
 
37
37
  `contract.requires:['jsfe:input-proposals:v1']` describes intrinsic runtime support, not host configuration. Current JSFE admits that version directly; unknown `jsfe:*` contracts fail closed. Static and linked child declarations derive the requirement and strict entry guard; dynamic proposal workers declare it explicitly. Older runtimes must reject the matched definitions before tenant behavior. Release/pin the accepted runtime before activating regenerated shared and tenant sets. Both consumers must pin the same exact published runtime before the matched shared and tenant flow definitions are activated.
38
+
39
+ ## 1.7.5 input ownership and intent corrections
40
+
41
+ The local candidate corrects input ownership for incidental known-parent choices, keeps independent structured spans independent, and recognizes text-switch intent only as a complete command. English/Spanish courtesy and explicit continuation commands work; OTP delivery questions, quoted/code/struck-through commands, negation and extra-content sentences do not switch channels. Exact action consent, subject gates, money parsing, durable journal behavior and storage formats are unchanged. Provider terminal phrases retain priority when courtesy also makes them fit a shorter neutral action.
42
+
43
+ Tenant integration resolves a valid canonical case before compatibility routing, builds CRM verification text from the same contact snapshot as payload flags, and handles account-menu bare NO through the existing provider action contract. Intent probes fail execution errors independently of expected intent, reject malformed/empty runs, and retain a bilingual synthetic corpus. The new corpus is not a reconstruction of the historical uncommitted production replay.
44
+
45
+ Accept the same immutable tarball in isolated matched host/tenant installs. Run every engine suite and `npm run test:accept`, including the original journeys on both flow sets; `npm test` alone runs the curacao suites in legacy mode. Add host preprocessing end-reason checks to distinguish a closing question from a farewell, and exercise actual tool-call counts, payloads, reentry and fresh consent. Live model probes are separate from hermetic acceptance and retain execution failures as failures. Release authorization was granted after the local review. Publish the accepted runtime as 1.7.5, pin both consumers, deploy the dev host, then activate the matched shared and tenant definitions in the three dev configs. Production deployment remains a separate action.
46
+
47
+ ## 1.7.6 reviewed input recovery and data ownership
48
+
49
+ The release preserves complete FORM voice answers before profile normalization, adds opt-in narrative evidence ownership and dependency-aware choice handling, and resumes a changed opted-in ancestor through its live owner. Contextual literal email reading remains opt-in. Absent/null named tool argument bags normalize without changing supplied object payloads or nullable roots.
50
+
51
+ Contextual DISPATCH is opt-in through `onResponse:"continue"` and `responseContext`. A scoped ContinueCurrent decision runs authored bounded recovery without terminating the owner; a registered workflow replaces it once; None hands an unrelated request to the host. Detection precedes termination and outcome/recovery stamping. Model errors do not authorize a switch, reserved disposition names cannot collide with registry names, and ordinary DISPATCH is unchanged. Both the native and canonical legacy contact collectors opt in. Confirmation, action persistence and storage encoding contracts are unchanged.
52
+
53
+ Reviewed acceptance: all 81 engine test files, 121 legacy and 121 native tenant suites; all 622 deterministic and 622 production-model primary journeys spanning 17 primaries and 166 applicable paths. Full-day replay retains 2,325 conversations and 8,543 original turns with no engine exceptions. Nine extraction deadlines and one empty Shopify cleanup response remain visible in model-health evidence; the extraction cases rechecked cleanly with production model redundancy. Shared Shopify's safe original-input fallback remains separately scoped. Unknown backend fixtures are diagnostic, never customer-success evidence.
54
+
55
+ Owner authorized publication, exact consumer pins, dev host deployment and matched shared/native flow activation on all three dev configs with session-only action persistence. Production deployment/activation is not part of this release authorization. Publish/install the accepted package before activating its matched definitions.
package/docs/forms.md CHANGED
@@ -39,9 +39,15 @@ A batch retains independent valid fields if another field fails. Dependent early
39
39
 
40
40
  ## Resolution and reentry
41
41
 
42
- Resolve overlapping evidence in this order: current field, one matching field at the nearest owning scope, then ancestors. Multiple competing claims at the same applicable scope are clarified. Independent spans fill independent fields. Typed evidence beats an unconstrained text fallback. `confirm_against` deliberately overrides ordinary priority.
42
+ Resolve overlapping evidence in this order: current field, one matching field at the nearest owning scope, then ancestors. Multiple competing claims at the same applicable scope are clarified. Independent spans fill independent fields. Typed evidence beats an unconstrained text fallback. A noncurrent, already-filled choice mentioned incidentally in the current text answer does not displace that answer; a whole-answer repetition (including courtesy) remains a claim to that choice. Explicit new choices and structured data remain eligible out of order. Resolve losing fallback evidence before computing overlapping groups, so one whole-answer text span cannot make independent email/phone clauses ambiguous. `confirm_against` deliberately retains paired interpretations and overrides ordinary priority.
43
43
 
44
- The common loop asks the first ready missing required input, skips accepted data, unwinds inapplicable children and blocks unresolved prerequisites. A context service may use `stop` and `close_on_stop:true` to close itself without handing a value to its parent. With `resume_on_parent_change:true`, an accepted owner correction closes the stale context service and resumes the same owned form with its retained progress, requiring a fresh confirmation. `RETURN` ends the entire engine transaction; ordinary worker completion uses `END`.
44
+ FORM collectors preserve the original answer by default (`as_spoken:true`), including on voice channels. Their declared profile readers normalize typed evidence and match out-of-order fields before validation; question-specific voice cleanup must not discard other fields first. Explicit `as_spoken:false` remains available for a field that deliberately needs that cleanup. Direct `SAY-GET` and ordinary `ask-choice` defaults remain unchanged.
45
+
46
+ For an open rationale or description, opt into `profile:{kind:'text',narrative:true}`. The current narrative retains the full answer while independently shaped phone/email fields spend only their own spans. A structured-only number or address does not fill the rationale. Incidental ancestor choices and same-form choices listed in the requested field’s `reset_on` dependencies are context; a whole-answer declared choice or a bounded explicit correction such as “actually insurance” or “en realidad seguro” can still revise the ancestor. Other sibling choices remain independently collectable, including in compound answers. Whole-answer choices, explicit corrections, independently typed fields and explicit `confirm_against` ambiguity retain their normal behavior. A choice field may also opt into `narrative:true` when its answer commonly includes surrounding explanation; a valid current selection then owns that explanation without changing another discriminator from an incidental word. This does not infer an unmatched choice or bypass its validator. Ordinary text profiles keep their existing structured-input precedence.
47
+
48
+ Narrative collection reads email fields in explicit literal mode: a complete visible `owner@example.com` token stays that exact recipient, even inside prose. The standalone API `readEmail(text,{literal:true})` and `profile:{kind:'email',literal:true}` offer the same behavior. Different visible addresses fail closed; with no visible email token, spoken/spelled parsing remains available. Default `readEmail(text)` is unchanged, including joining intentional local-name fragments such as “Maria jose@gmail.com”. Use the explicit contextual mode when surrounding prose must not become part of the recipient.
49
+
50
+ The common loop asks the first ready missing required input, skips accepted data, unwinds inapplicable children and blocks unresolved prerequisites. A context service may use `stop` and `close_on_stop:true` to close itself without handing a value to its parent. With `resume_on_parent_change:true`, an accepted owner correction closes the stale context branch and resumes the highest changed opted-in ancestor with its retained progress, requiring a fresh confirmation. Nested contexts cannot return through obsolete callback tails or restore an old draft or action token; unrelated tasks remain intact. `RETURN` ends the entire engine transaction; ordinary worker completion uses `END`.
45
51
 
46
52
  Optional follow-ups may declare `incomplete_outcome:{outcome:'resolved',reason:'payment_made'}` to preserve an already completed task’s outcome when collection cannot finish or the user leaves. Accepted outcome values are `resolved`, `unresolved` and `deflected`, with a nonempty reason. A reusable form may instead use `incomplete_outcome:{from:'completed_outcome'}` with a declared object parameter; its runtime value must pass the same validation. The nearest actual owned ancestor supplies a fallback to a child. Another task’s outcome never does. The policy covers missing input specifications, blocked dependencies, exhausted validation/retries and unmatched collection/confirmation dispatch; it does not complete missing inputs or authorize effects. Omit it for ordinary required forms: contextual yields are pending, while actual validation or service failures remain unresolved.
47
53
 
@@ -169,3 +175,11 @@ Generation failures, stale artifacts, empty suite selections, crashed suites and
169
175
  ### Host capability admission
170
176
 
171
177
  `definePerformer` declares `guardedActions` in its contract requirements. A host must call `assertFlowHostCapabilities(flows, capabilities)` from `jsfe/host` before activation. Durable remains the default: supply `durableActions: true` and attach the journal. An explicit `actionPersistence: 'session-only'` is the alternative; a bare `guardedActions: true` cannot enable it. An additional `contract.requires: ['durableActions']` insists on durable storage even when the host selects session-only. Existing serialized 1.7.0 declarations with that durable-only requirement remain strict; rebuild a flow set with 1.7.1 to use the host-selectable policy. The check does not enable a journal or choose a conversation encoding. Missing requirements reject activation before customer input or effects. Other flow builders may declare additional boolean host requirements through `contract.requires`.
178
+
179
+ ## Provider menu terminal intent
180
+
181
+ Provider menus keep terminal phrases distinct from neutral menu answers. If an answer selects an action only because courtesy normalization also matches a shorter phrase, an explicitly declared whole-answer `menu.done.words` phrase takes its terminal meaning. For example, a neutral action keyed by “no” can ask what else the caller needs while “no thanks” remains terminal. Fact requests retain their existing priority and the existing done/deferral fallback is preserved. Reuse provider-menu actions and shared phrase renderers instead of adding tenant-specific parsing to the engine.
182
+
183
+ ### Identification handoff on an unmapped answer
184
+
185
+ The shared contact/account collector uses contextual `DISPATCH` (`onResponse: "continue"`, `responseContext`) before abandoning an unmapped conversational answer. The current input request is offered as a scoped `ContinueCurrent` disposition alongside the primary flows. A classified response retains the live continuation and enters the existing retry/options menu, where a complete identifier can still be supplied. A supported new intent replaces the workflow; an unrelated request without a workflow hands off to the host. This is a decision before state mutation, not a session snapshot restore. Ordinary FORM yields and exhausted retries retain their existing behavior; confirmations and action guards are unchanged.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
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",