jsfe 1.41.0 → 1.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/forms/address-flows.d.ts.map +1 -1
- package/dist/forms/address-flows.js +11 -8
- package/dist/forms/declarations.js +1 -1
- package/dist/forms/flows.d.ts +3 -1
- package/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +17 -8
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +7 -1
- package/dist/helpers/answer.d.ts +6 -0
- package/dist/helpers/answer.d.ts.map +1 -1
- package/dist/helpers/answer.js +10 -0
- package/dist/helpers/contextual-response.d.ts +2 -0
- package/dist/helpers/contextual-response.d.ts.map +1 -1
- package/dist/helpers/contextual-response.js +7 -1
- package/dist/helpers/form-conversation.d.ts +13 -0
- package/dist/helpers/form-conversation.d.ts.map +1 -1
- package/dist/helpers/form-conversation.js +27 -0
- package/dist/helpers/form-state.d.ts +3 -1
- package/dist/helpers/form-state.d.ts.map +1 -1
- package/dist/helpers/form-state.js +10 -2
- package/dist/helpers/index.d.ts +7 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +5 -5
- package/dist/host/reply-rank.d.ts +9 -2
- package/dist/host/reply-rank.d.ts.map +1 -1
- package/dist/host/reply-rank.js +25 -7
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +144 -6
- package/dist/runtime-identity.js +1 -1
- package/docs/architecture-guide.md +26 -1
- package/docs/copilot-reference.md +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -373,11 +373,27 @@ when it declares them. A confident `answers` (no `fallback`) is never lost: when
|
|
|
373
373
|
the field is the reply as said. Unmarked fields (a product, a city) always need a real extraction. After a
|
|
374
374
|
`fallback` answer extraction is the judge, and ReadFormResponse asks the question again when it finds nothing; `abort` is a RETURN: every flow ends and the reply is system message `cmd_request_aborted`
|
|
375
375
|
("The process has been cancelled at your request - how can I help you?"),
|
|
376
|
-
outcome `user_aborted`, no recovery stamp;
|
|
376
|
+
outcome `user_aborted`, no recovery stamp (never the global exit flow below);
|
|
377
|
+
`concern` (jsfe 1.42.0, owner 2026-11-11; offered only when the step declares `responseConcern` (a string) or `responseConcernForm` (a form instance; form readers pass their own): the nearest form
|
|
378
|
+
in the chain declaring `user_description` / `user_description_es`, written with the engine's own `{{...}}` expressions, every input of the declaring form in scope ('' until answered) with its data; never at
|
|
379
|
+
a reason question; cut 0.6, and the top score wins over a cleared choice): the caller expresses doubt that the current process is what they need.
|
|
380
|
+
The reader says the description, how to cancel ("To cancel, press the asterisk key or say EXIT." / "To cancel, type EXIT."; Spanish
|
|
381
|
+
SALIR) and the question again; no attempt is counted;
|
|
377
382
|
`irrelevant` (a stray word, an unfinished sentence, speech to someone else; cut 0.7, and 0.8 to outrank a cleared choice) extracts nothing and asks again: no flow moves. `new_request` ends the flows and routes the input through intent detection. Only a new request is routed: after
|
|
378
383
|
`answers` a later ordinary DISPATCH in the same turn hands the host the turn without detection. A host that does not know the task answers the `llm`
|
|
379
384
|
instructions with its text model.
|
|
380
385
|
|
|
386
|
+
**The global exit (jsfe 1.42.0, owner 2026-11-11):** a whole answer of `*`, EXIT, QUIT or SALIR (repeated, or with please / por
|
|
387
|
+
favor / now / ahora; CANCEL is not one) ends every flow at any question, before any reader, command or the reply ranker
|
|
388
|
+
(`isGlobalExit`), outcome `user_aborted`, reason `exit_requested`, unless the question declares a choice of its own for that
|
|
389
|
+
word (its key or a phrase is `*`, EXIT, QUIT or SALIR): that choice takes the answer. The engine then starts
|
|
390
|
+
the worker `global-exit` (default: a reboot to the set's `contact-support` with `exit_outcome`, the outcome in force before the
|
|
391
|
+
flows ended), or the tenant flow that `wraps: "global-exit"`. A set with neither a wrapper nor `contact-support` keeps the generic reply.
|
|
392
|
+
|
|
393
|
+
**Keypad 9 (jsfe 1.42.0, owner 2026-10-31):** on a call, a whole answer of `9` at any question ends every flow and starts
|
|
394
|
+
`switch-to-text`, when the caller's number can take texts (`callerTextNumber`) and the set has that flow. A question that declares a
|
|
395
|
+
choice for 9, or asks for an amount (ask-choice `amount`), keeps the answer. Keypad 8 (language) is the host's.
|
|
396
|
+
|
|
381
397
|
An input with `profile.whole_phrases` (default off; `choice`, or a `pattern` that reads words) keeps its word reader only for a reply wholly made of its phrase, arguments, courtesy, connecting words and its `template_words`; any other reply goes to this ranker.
|
|
382
398
|
|
|
383
399
|
**A number that must name itself.** `input.confirm_out_of_order: {word, word_es, message, message_es}` (default off): out of order a number fills this input only beside its word, in either language ("account 5373850"). Alone it may be something else, a code said with an extra digit, so nothing is filled: the caller hears `message` (`{value}` the number, digit by digit on a call; `{word}` the word) and the current question again, which counts as an attempt at that question. It works at `collect-input` and `confirm-form` questions. At its own question the number needs no word. `authenticate-user`'s `code_confirm` takes the same declaration for a `code_validator`, whose flow reads it with the helpers `saysConfirmWord(answer, spec)` and `confirmOutOfOrderLine(spec, value, language, voice)`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-flows.d.ts","sourceRoot":"","sources":["../../src/forms/address-flows.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"address-flows.d.ts","sourceRoot":"","sources":["../../src/forms/address-flows.js"],"names":[],"mappings":"AAgDA,0BAAmF"}
|
|
@@ -9,15 +9,18 @@ const E = (fn, ...args) => `(${fn.toString()})(${args.join(',')})`;
|
|
|
9
9
|
const P = (name, type = 'string') => ({ name, type, description: name });
|
|
10
10
|
const C = (id, summary, steps, extra = {}) => defineWorker({ id, name: id.split('-').map(w => w[0].toUpperCase() + w.slice(1)).join(''), description: summary, ...extra, contract: { role: 'worker', summary, ...extra.contract }, steps });
|
|
11
11
|
const streetPattern = '\\b\\d{1,6}\\s+(?:[A-Za-z0-9.\\xC0-\\xFF-]+\\s+){1,8}(?:st(?:reet)?|ave(?:nue)?|blvd|boulevard|rd|road|ln|lane|dr(?:ive)?|way|ct|court|pl(?:ace)?|pkwy|parkway|cir(?:cle)?|ter(?:race)?)\\b';
|
|
12
|
-
const address = defineForm({ id: 'collect-geocoded-address', name: 'CollectGeocodedAddress', version: '1.0.0', description: 'Collect a mailing address in any order, project geocoder evidence, and read the complete address back for confirmation.', contract: { summary: 'Collect and confirm a geocoded mailing address', result: { path: 'form result.resolved', type: 'object' } }, parameters: [P('given')], extraVars: { given: '', zip: '', street: '', unit: '', draft: null, address_result: null, exit_context: 'your address', exit_context_es: 'su dirección' },
|
|
13
|
-
before: [S('address_given', 'given', "given || (cargo.forms[cargo.forms[form_instance].parent] || {}).context && (cargo.forms[cargo.forms[form_instance].parent].context.given || '') || ''"), S('address_draft', 'draft', E(addressDraft, "given || (cargo.forms[form_instance].seeds && cargo.forms[form_instance].seeds.given) || ''")), S('address_seed_zip', 'zip', "zip || draft.zip"), S('address_seed_street', 'street', "street || draft.street"), S('address_seed_unit', 'unit', "unit || draft.unit"), S('address_data', 'noop', "(cargo.forms[form_instance].data=Object.assign({need_city:false},cargo.forms[form_instance].data || {}), draft.street ? (cargo.addressDraft={said:draft.street}) : null, true)")
|
|
12
|
+
const address = defineForm({ id: 'collect-geocoded-address', name: 'CollectGeocodedAddress', version: '1.0.0', description: 'Collect a mailing address in any order, project geocoder evidence, and read the complete address back for confirmation.', contract: { summary: 'Collect and confirm a geocoded mailing address', result: { path: 'form result.resolved', type: 'object' } }, parameters: [P('given')], extraVars: { given: '', zip: '', street: '', unit: '', draft: null, address_result: null, address_spec: null, address_label: 'new address', address_label_es: 'nueva dirección', exit_context: 'your address', exit_context_es: 'su dirección' },
|
|
13
|
+
before: [S('address_given', 'given', "given || (cargo.forms[cargo.forms[form_instance].parent] || {}).context && (cargo.forms[cargo.forms[form_instance].parent].context.given || '') || ''"), S('address_draft', 'draft', E(addressDraft, "given || (cargo.forms[form_instance].seeds && cargo.forms[form_instance].seeds.given) || ''")), S('address_seed_zip', 'zip', "zip || draft.zip"), S('address_seed_street', 'street', "street || draft.street"), S('address_seed_unit', 'unit', "unit || draft.unit"), S('address_data', 'noop', "(cargo.forms[form_instance].data=Object.assign({need_city:false},cargo.forms[form_instance].data || {}), draft.street ? (cargo.addressDraft={said:draft.street}) : null, true)"),
|
|
14
|
+
// The calling form's own label for this input names what is being changed ("new delivery address") in every question and the read-back;
|
|
15
|
+
// without one, today's wording.
|
|
16
|
+
S('address_spec', 'address_spec', "(function(f){var p=f&&f.parent?cargo.forms[f.parent]:null,s=p&&p.specs,n=f&&f.result_input,x=null;if(n&&Array.isArray(s)){for(var i=0;i<s.length;i++){if(s[i]&&s[i].name===n){x=s[i];break;}}}else if(n&&s&&typeof s==='object'){x=s[n]||null;}return x||{};})(cargo.forms[form_instance])"), S('address_label', 'address_label', "typeof address_spec.label==='string'&&address_spec.label.trim()?address_spec.label.trim():'new address'"), S('address_label_es', 'address_label_es', "typeof address_spec.label_es==='string'&&address_spec.label_es.trim()?address_spec.label_es.trim():'nueva dirección'"), S('address_label_data', 'noop', "(function(d,labelled){d.label=address_label;d.label_es=address_label_es;d.labelled=labelled;d.city_state_question=labelled?'What city and state is your '+address_label+' in?':'What city and state is that in?';d.city_state_question_es=labelled?'¿En qué ciudad y estado está su '+address_label_es+'?':'¿En qué ciudad y estado está?';d.unit_question=labelled?'Is there an apartment or unit number in your '+address_label+'? Type the number, or NONE.':'Is there an apartment or unit number? Type the number, or NONE.';d.unit_question_es=labelled?'¿Hay un número de apartamento o unidad en su '+address_label_es+'? Escriba el número, o NINGUNO.':'¿Hay un número de apartamento o unidad? Escriba el número, o NINGUNO.';return true;})(cargo.forms[form_instance].data,typeof address_spec.label==='string'&&!!address_spec.label.trim())")],
|
|
14
17
|
inputs: [{ name: 'zip', field: 'zip', argument_description: '5-digit ZIP code', names: ['zip', 'zip code', 'postal code', 'código postal', 'codigo postal'], validator: 'address-zip-validate', prepare: 'address-zip-prompt', question_from: 'zip_question', question: 'What is the 5-digit zip code of your new address?', question_es: '¿Cuál es el código postal de 5 dígitos de su nueva dirección?' },
|
|
15
18
|
{ name: 'city', argument_description: 'city name alone', label: 'city', label_es: 'ciudad', names: ['city', 'ciudad'], profile: { kind: 'choice', choices: [], accept_other: true, other_needs_letter: true }, choices_from: 'city_choices', when: { 'form.data.city_known': true }, depends_on: ['zip'], reset_on: ['zip'], prepare: 'address-city-prompt', question_from: 'city_question', question: 'Which city is it?', question_es: '¿Qué ciudad es?' },
|
|
16
|
-
{ name: 'city_state', argument_description: 'city and state', label: 'city and state', label_es: 'ciudad y estado', names: ['city', 'ciudad'], profile: { kind: 'text' }, when: { 'form.data.need_city': true }, depends_on: ['zip'], question: 'What city and state is that in?', question_es: '¿En qué ciudad y estado está?' },
|
|
19
|
+
{ name: 'city_state', argument_description: 'city and state', label: 'city and state', label_es: 'ciudad y estado', names: ['city', 'ciudad'], profile: { kind: 'text' }, when: { 'form.data.need_city': true }, depends_on: ['zip'], question_from: 'city_state_question', question: 'What city and state is that in?', question_es: '¿En qué ciudad y estado está?' },
|
|
17
20
|
{ name: 'street', argument_description: 'street number and street name, without the apartment', label: 'street address', label_es: 'dirección', names: ['street', 'calle'], profile: { kind: 'pattern', regex: streetPattern, spoken_digits: 'house_number', accept_other: true }, depends_on: ['zip'], validator: 'address-street-validate', prepare: 'address-street-prompt', question_from: 'street_question', question: 'What is the street address?', question_es: '¿Cuál es la dirección?' },
|
|
18
|
-
{ name: 'unit', argument_description: 'apartment or unit number alone, such as 4 or 12B', reset_on: ['street'], label: 'apartment or unit', label_es: 'apartamento o unidad', names: ['apartment', 'apt', 'unit', 'apartamento', 'unidad', 'departamento'], profile: { kind: 'pattern', regex: '(?:\\bapartment|\\bapartamento|\\bdepartamento|\\bapt\\.?|\\bunit|\\bunidad|#)\\s*([\\w-]+)', group: 1, spoken_digits: true, accept_other: true }, question: 'Is there an apartment or unit number? Type the number, or NONE.', question_es: '¿Hay un número de apartamento o unidad? Escriba el número, o NINGUNO.' }],
|
|
21
|
+
{ name: 'unit', argument_description: 'apartment or unit number alone, such as 4 or 12B', reset_on: ['street'], label: 'apartment or unit', label_es: 'apartamento o unidad', names: ['apartment', 'apt', 'unit', 'apartamento', 'unidad', 'departamento'], profile: { kind: 'pattern', regex: '(?:\\bapartment|\\bapartamento|\\bdepartamento|\\bapt\\.?|\\bunit|\\bunidad|#)\\s*([\\w-]+)', group: 1, spoken_digits: true, accept_other: true }, question_from: 'unit_question', question: 'Is there an apartment or unit number? Type the number, or NONE.', question_es: '¿Hay un número de apartamento o unidad? Escriba el número, o NINGUNO.' }],
|
|
19
22
|
before_confirm: [S('address_resolved', 'address_result', E(resolvedAddress, 'cargo.forms[form_instance].values', 'cargo.forms[form_instance].data'))],
|
|
20
|
-
confirm: { named_fields: true, reply_context: 'This is a mailing address read back for confirmation. A reply may correct one part or several at once: the street number, street name or street type, the apartment or unit, the city, or the ZIP code.', no_keys: ['2', 'not right', 'not correct', 'incorrect', 'wrong', 'no es correcto', 'no es correcta', 'incorrecta'], question: 'Your
|
|
23
|
+
confirm: { named_fields: true, reply_context: 'This is a mailing address read back for confirmation. A reply may correct one part or several at once: the street number, street name or street type, the apartment or unit, the city, or the ZIP code.', no_keys: ['2', 'not right', 'not correct', 'incorrect', 'wrong', 'no es correcto', 'no es correcta', 'incorrecta'], question: 'Your {{address_label}} is {{address_result.line}}. Is that correct?', question_es: 'Su {{address_label_es}} es {{address_result.line}}. ¿Es correcta?' },
|
|
21
24
|
after: [S('address_result_store', 'noop', '(cargo.forms[form_instance].values.resolved = address_result, cargo.address = address_result, cargo.addressDraft = null, true)')], declined: [S('address_retry_noop', 'noop', 'true')] });
|
|
22
25
|
const zip = C('address-zip-validate', 'Read city and state from geocoder evidence for the proposed ZIP; missing geocoder data requires an explicit city.', [
|
|
23
26
|
S('address_zip_components', 'components', "'postal_code:'+value+'|country:US'"), { id: 'address_zip_tool', type: 'CALL-TOOL', tool: 'geocode-zip', variable: 'result', args: { components: '{{components}}', address: '' }, onFail: S('address_zip_failed', 'result', 'null') },
|
|
@@ -31,9 +34,9 @@ const street = C('address-street-validate', 'Validate a proposed street against
|
|
|
31
34
|
S('address_street_projection', 'location', E(streetLocation, 'result', 'value', 'values.zip')),
|
|
32
35
|
S('address_street_result', 'noop', "(cargo.forms[form].data.street=location, location.city&&cargo.forms[form].accepted&&cargo.forms[form].accepted.city&&cargo.forms[form].accepted.city.origin==='derived'&&cargo.forms[form].values.city!==location.city?(cargo.forms[form].values.city=location.city):null, cargo.inputCheck={ok:true,value:String(value)}, true)")
|
|
33
36
|
], { parameters: [P('form'), P('value'), P('values', 'object')], variables: V({ components: '', result: null, location: null }), contract: { tools: ['geocode-street'], result: { path: 'cargo.inputCheck', type: 'object' } } });
|
|
34
|
-
const zipPrompt = C('address-zip-prompt', 'Render the ZIP
|
|
35
|
-
const streetPrompt = C('address-street-prompt', 'Include the ZIP-derived location when asking for the street.', [S('address_street_prompt', 'noop', "(cargo.forms[form].data.street_question=(cargo.forms[form].data.location?'Got it, '+(cargo.forms[form].values.city?cargo.forms[form].values.city+', '+cargo.forms[form].data.location.state:cargo.forms[form].data.location.line)+'. ':'')+'What is the street address?',cargo.forms[form].data.street_question_es=(cargo.forms[form].data.location?'Entendido, '+(cargo.forms[form].values.city?cargo.forms[form].values.city+', '+cargo.forms[form].data.location.state:cargo.forms[form].data.location.line)+'. ':'')+'¿Cuál es la dirección?',true)")], { parameters: [P('form')], contract: { result: { path: 'cargo.forms[form].data', type: 'object' } } });
|
|
36
|
-
const cityPrompt = C('address-city-prompt', 'Ask which of the ZIP code\'s place names the address carries.', [S('address_city_prompt', 'noop', "(function(data,voice){var names=(data.location&&data.location.cities)||[],n=names.length,list=function(and){return names.slice(0,-1).join(', ')+' '+and+' '+names[n-1];};if(n<2){data.city_question='What city is it?';data.city_question_es='¿Qué ciudad es?';return true;}data.city_question='Which city is it: '+list('or')+'? '+(voice?names.map(function(c,i){return (i?'':'Press ')+(i+1)+' for '+c;}).join(', ')+'.':'Type the city or its number, 1 to '+n+'.');data.city_question_es='¿Qué ciudad es: '+list('o')+'? '+(voice?names.map(function(c,i){return (i?'':'Presione ')+(i+1)+' para '+c;}).join(', ')+'.':'Escriba la ciudad o su número, del 1 al '+n+'.');return true;})(cargo.forms[form].data,cargo.voice===true)")], { parameters: [P('form')], contract: { result: { path: 'cargo.forms[form].data', type: 'object' } } });
|
|
37
|
+
const zipPrompt = C('address-zip-prompt', 'Render the ZIP question from the owned address instance, naming the calling form\'s label.', [S('address_zip_prompt', 'noop', "(cargo.forms[form].data.zip_question=(cargo.forms[form].data.retry ? \"Let's try again. \" : '')+'What is the 5-digit zip code of your '+(cargo.forms[form].data.label||'new address')+'?',cargo.forms[form].data.zip_question_es=(cargo.forms[form].data.retry?'Intentémoslo otra vez. ':'')+'¿Cuál es el código postal de 5 dígitos de su '+(cargo.forms[form].data.label_es||'nueva dirección')+'?',true)")], { parameters: [P('form')], contract: { result: { path: 'cargo.forms[form].data', type: 'object' } } });
|
|
38
|
+
const streetPrompt = C('address-street-prompt', 'Include the ZIP-derived location when asking for the street.', [S('address_street_prompt', 'noop', "(cargo.forms[form].data.street_question=(cargo.forms[form].data.location?'Got it, '+(cargo.forms[form].values.city?cargo.forms[form].values.city+', '+cargo.forms[form].data.location.state:cargo.forms[form].data.location.line)+'. ':'')+(cargo.forms[form].data.labelled?'What is the street of your '+cargo.forms[form].data.label+'?':'What is the street address?'),cargo.forms[form].data.street_question_es=(cargo.forms[form].data.location?'Entendido, '+(cargo.forms[form].values.city?cargo.forms[form].values.city+', '+cargo.forms[form].data.location.state:cargo.forms[form].data.location.line)+'. ':'')+(cargo.forms[form].data.labelled?'¿Cuál es la calle de su '+cargo.forms[form].data.label_es+'?':'¿Cuál es la dirección?'),true)")], { parameters: [P('form')], contract: { result: { path: 'cargo.forms[form].data', type: 'object' } } });
|
|
39
|
+
const cityPrompt = C('address-city-prompt', 'Ask which of the ZIP code\'s place names the address carries.', [S('address_city_prompt', 'noop', "(function(data,voice){var names=(data.location&&data.location.cities)||[],n=names.length,list=function(and){return names.slice(0,-1).join(', ')+' '+and+' '+names[n-1];};if(n<2){data.city_question=data.labelled?'What city is your '+data.label+' in?':'What city is it?';data.city_question_es=data.labelled?'¿En qué ciudad está su '+data.label_es+'?':'¿Qué ciudad es?';return true;}data.city_question=(data.labelled?'Which city is your '+data.label+' in: ':'Which city is it: ')+list('or')+'? '+(voice?names.map(function(c,i){return (i?'':'Press ')+(i+1)+' for '+c;}).join(', ')+'.':'Type the city or its number, 1 to '+n+'.');data.city_question_es=(data.labelled?'¿En qué ciudad está su '+data.label_es+': ':'¿Qué ciudad es: ')+list('o')+'? '+(voice?names.map(function(c,i){return (i?'':'Presione ')+(i+1)+' para '+c;}).join(', ')+'.':'Escriba la ciudad o su número, del 1 al '+n+'.');return true;})(cargo.forms[form].data,cargo.voice===true)")], { parameters: [P('form')], contract: { result: { path: 'cargo.forms[form].data', type: 'object' } } });
|
|
37
40
|
// NO at the read-back asks which part is wrong and re-asks only that part; ALL starts over.
|
|
38
41
|
const PARTS = [{ key: 'zip', phrases: ['1', 'zip', 'zip code', 'postal code', 'código postal', 'codigo postal'] }, { key: 'city', phrases: ['2', 'city', 'ciudad'] }, { key: 'street', phrases: ['3', 'street', 'calle'] }, { key: 'unit', phrases: ['4', 'apartment', 'apt', 'unit', 'apartamento', 'unidad', 'departamento'] }, { key: 'all', phrases: ['5', 'all', 'everything', 'all of it', 'todo', 'toda'] }];
|
|
39
42
|
const declined = C('collect-geocoded-address-declined', 'Ask which part of the declined address is wrong, re-ask only that part, or start a fresh pass.', [
|
|
@@ -4,7 +4,7 @@ import { linkFormSchemas, validateFlowContracts } from './contracts.js';
|
|
|
4
4
|
import { compileFormPrompts } from './prompt-compiler.js';
|
|
5
5
|
import { withSafetyRevision } from './continuation-safety.js';
|
|
6
6
|
import { capturedAuthorSpec, copyAuthorSpec, authoredExpressions } from './declaration-capture.js';
|
|
7
|
-
const formKeys = new Set(['inputs', 'before', 'after', 'confirm', 'before_confirm', 'declined', 'stop', 'close_on_stop', 'resume_on_parent_change', 'done', 'validator', 'confirmation_condition', 'prompt', 'prompt_es', 'incomplete_outcome', 'on_exhausted', 'on_no', 'must_complete', 'first_task', 'first_task_es', 'acknowledge']);
|
|
7
|
+
const formKeys = new Set(['inputs', 'before', 'after', 'confirm', 'before_confirm', 'declined', 'stop', 'close_on_stop', 'resume_on_parent_change', 'done', 'validator', 'confirmation_condition', 'prompt', 'prompt_es', 'incomplete_outcome', 'on_exhausted', 'on_no', 'must_complete', 'first_task', 'first_task_es', 'user_description', 'user_description_es', 'acknowledge']);
|
|
8
8
|
const sharedKeys = ['id', 'name', 'description', 'version', 'scope', 'primary', 'parameters', 'contract', 'parameterInstructions'];
|
|
9
9
|
const safe = /^[A-Za-z_$][\w$]*$/;
|
|
10
10
|
const fail = message => { throw new Error('Flow declaration: ' + message); };
|
package/dist/forms/flows.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export function validateRankParameters(id: any, name: any, what: any, list: any)
|
|
|
17
17
|
* confirmation is soft, a plain form's (no action) included (owner 2026-11-09). confirm.exact is separate: it binds the
|
|
18
18
|
* action to the confirmed values, whatever the confirmation's firmness. */
|
|
19
19
|
export function confirmationFirmness(performs: any): "firm" | "soft";
|
|
20
|
-
export function formFlow({ id, name, version, description, inputs, after, extraVars, parameters, confirm, confirm_soft, before_confirm, declined, stop, close_on_stop, on_no, resume_on_parent_change, before, done, primary, scope, validator, confirmation_condition, prompt, prompt_es, incomplete_outcome, on_exhausted, must_complete, first_task, first_task_es, acknowledge }: {
|
|
20
|
+
export function formFlow({ id, name, version, description, inputs, after, extraVars, parameters, confirm, confirm_soft, before_confirm, declined, stop, close_on_stop, on_no, resume_on_parent_change, before, done, primary, scope, validator, confirmation_condition, prompt, prompt_es, incomplete_outcome, on_exhausted, must_complete, first_task, first_task_es, user_description, user_description_es, acknowledge }: {
|
|
21
21
|
id: any;
|
|
22
22
|
name: any;
|
|
23
23
|
version: any;
|
|
@@ -47,6 +47,8 @@ export function formFlow({ id, name, version, description, inputs, after, extraV
|
|
|
47
47
|
must_complete?: boolean | undefined;
|
|
48
48
|
first_task?: string | undefined;
|
|
49
49
|
first_task_es?: string | undefined;
|
|
50
|
+
user_description?: string | undefined;
|
|
51
|
+
user_description_es?: string | undefined;
|
|
50
52
|
acknowledge?: string | undefined;
|
|
51
53
|
}): {
|
|
52
54
|
variables: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA6GA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAiBD;;2EAE2E;AAC3E,qEAEC;AACD
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA6GA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAiBD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEC;AACD;;;GAGG;AACH;;;;;;EAGC;AA+lBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AA7zBM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuhC9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
|
package/dist/forms/flows.js
CHANGED
|
@@ -151,7 +151,7 @@ function validateAcceptanceDeclarations(id, inputs) {
|
|
|
151
151
|
export function confirmationFirmness(performs) {
|
|
152
152
|
return Array.isArray(performs) && performs.some((action) => action?.effect === 'charge') ? 'firm' : 'soft';
|
|
153
153
|
}
|
|
154
|
-
export function formFlow({ id, name, version, description, inputs, after = [], extraVars = {}, parameters = [], confirm = null, confirm_soft = confirmationFirmness([]) === 'soft', before_confirm = [], declined = [], stop = '', close_on_stop = false, on_no = '', resume_on_parent_change = false, before = [], done = true, primary = false, scope = 'isolated', validator = '', confirmation_condition = 'true', prompt = undefined, prompt_es = undefined, incomplete_outcome = null, on_exhausted = null, must_complete = false, first_task = '', first_task_es = '', acknowledge = 'all' }) {
|
|
154
|
+
export function formFlow({ id, name, version, description, inputs, after = [], extraVars = {}, parameters = [], confirm = null, confirm_soft = confirmationFirmness([]) === 'soft', before_confirm = [], declined = [], stop = '', close_on_stop = false, on_no = '', resume_on_parent_change = false, before = [], done = true, primary = false, scope = 'isolated', validator = '', confirmation_condition = 'true', prompt = undefined, prompt_es = undefined, incomplete_outcome = null, on_exhausted = null, must_complete = false, first_task = '', first_task_es = '', user_description = '', user_description_es = '', acknowledge = 'all' }) {
|
|
155
155
|
validateFormExhaustion(on_exhausted);
|
|
156
156
|
if (acknowledge !== 'all' && acknowledge !== 'data')
|
|
157
157
|
throw new Error(`FORM ${id}: acknowledge must be 'all' or 'data'`);
|
|
@@ -192,13 +192,13 @@ export function formFlow({ id, name, version, description, inputs, after = [], e
|
|
|
192
192
|
] : [];
|
|
193
193
|
return {
|
|
194
194
|
id, name, version, description, scope, metadata: { formProtocol: 2 }, parameters: [...parameters, { name: 'form_instance', type: 'string', internal: true, description: 'Internal instance to resume' }], ...(primary ? { primary: true } : {}), ...(prompt ? { prompt, prompt_es } : {}),
|
|
195
|
-
variables: vars({ form_on_exhausted: on_exhausted, form_on_no: on_no, form_must_complete: must_complete, form_incomplete_outcome: incompleteFrom ? null : incomplete_outcome, form_instance: '', form_internal_resume: false, form_resume_owner: '', form_arguments: {}, form_exhaustion: null, form_values: {}, form_validation: '', initial_readings: [], inputs: resolveFormInputs(inputs, FIELD_PRESETS), parent_form: '', result_input: '', questions: [], provides: null, exit_context: '', exit_context_es: '', form_confirm_q: '', form_confirm_q_es: '', form_confirm_firmness: '', form_confirmation: confirm || {}, form_should_confirm: false, ...extraVars }),
|
|
195
|
+
variables: vars({ form_on_exhausted: on_exhausted, form_on_no: on_no, form_must_complete: must_complete, form_incomplete_outcome: incompleteFrom ? null : incomplete_outcome, form_instance: '', form_internal_resume: false, form_resume_owner: '', form_arguments: {}, form_exhaustion: null, form_values: {}, form_validation: '', initial_readings: [], inputs: resolveFormInputs(inputs, FIELD_PRESETS), parent_form: '', result_input: '', questions: [], provides: null, exit_context: '', exit_context_es: '', form_confirm_q: '', form_confirm_q_es: '', form_confirm_firmness: '', form_confirmation: confirm || {}, form_should_confirm: false, ...(user_description ? { form_user_description: user_description } : {}), ...(user_description_es ? { form_user_description_es: user_description_es } : {}), ...extraVars }),
|
|
196
196
|
steps: [
|
|
197
197
|
...contextualResponseRuntimeSteps(id, [], hasFormResponse(inputs) ? [CONTEXTUAL_RESPONSES_REQUIREMENT] : []),
|
|
198
198
|
...(hasFormResponse(inputs) ? [{ ...SET(`${id}_response_reader_required`, 'noop', "typeof validateFormResponse === 'function'"), requireTrue: true }] : []),
|
|
199
199
|
...proposalRuntimeSteps(id, [], hasInputProposals(inputs) ? [INPUT_PROPOSALS_REQUIREMENT] : []),
|
|
200
200
|
SET(`${id}_resume_kind`, 'form_internal_resume', '!!form_instance'),
|
|
201
|
-
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, on_no: form_on_no, must_complete: form_must_complete${first_task ? `, first_task: ${JSON.stringify(first_task)}` : ''}${first_task_es ? `, first_task_es: ${JSON.stringify(first_task_es)}` : ''}${acknowledge === 'data' ? ", acknowledge: 'data'" : ''} })`),
|
|
201
|
+
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, on_no: form_on_no, must_complete: form_must_complete${first_task ? `, first_task: ${JSON.stringify(first_task)}` : ''}${first_task_es ? `, first_task_es: ${JSON.stringify(first_task_es)}` : ''}${user_description ? ', user_description: form_user_description' : ''}${user_description_es ? ', user_description_es: form_user_description_es' : ''}${acknowledge === 'data' ? ", acknowledge: 'data'" : ''} })`),
|
|
202
202
|
SIDE(`${id}_task`, `(!parent_form ? (cargo.formTasks = cargo.formTasks || {}, cargo.formTasks[${JSON.stringify(id)}] = form_instance) : true, true)`),
|
|
203
203
|
SIDE(`${id}_provider_reset`, '(delete cargo.forms[form_instance].providerRequests, delete cargo.forms[form_instance].activeGates, delete cargo.forms[form_instance].afterRunning, delete cargo.forms[form_instance].providerGateActive, true)'),
|
|
204
204
|
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)'),
|
|
@@ -468,7 +468,11 @@ const RANK_LABEL_JS = "function(c){var said=(Array.isArray(c.phrases) ? c.phrase
|
|
|
468
468
|
// already offered is not offered twice. Each carries its input, so a pick is read as that input's answer.
|
|
469
469
|
const otherChoicesJS = (asked, taken, scope = `i.form===form && i.name!==${asked}`) => `(function(){var seen=(${taken}).map(function(c){return String(c.key);}).concat(['yes','no']);return (chain || []).filter(function(i){return ${scope} && !i.confirmation && i.profile && i.profile.kind==='choice' && Array.isArray(i.profile.choices);}).reduce(function(all,i){return all.concat(i.profile.choices.filter(function(c){var k=String(c.key);if(c.current_only===true||seen.indexOf(k)>=0)return false;seen.push(k);return true;}).map(function(c){return Object.assign({key:String(c.key),label:(${RANK_LABEL_JS})(c),owner:{form:i.form,name:i.name}},Array.isArray(c.parameters) && c.parameters.length ? {parameters:c.parameters} : {});}));},[]);})()`;
|
|
470
470
|
const escapeRoutes = (id) => [WHEN(`${id}_agent`, "reply && reply.key === '__agent'", FLOW(`${id}_agent_flow`, 'live-agent-requested', 'reboot'))];
|
|
471
|
-
const rankedDispatch = (id, reason, stay = false, parameters = '') => ({ ...yieldDispatch(id, 'form', `'${reason}'`), onResponse: 'continue', responseContext: 'Current question: {{asked}}', responseChoices: 'ranked', responseVariable: 'reply', ...(parameters ? { responseParameters: parameters } : {}), ...(stay ? { responseStay: 'stay' } : {}) });
|
|
471
|
+
const rankedDispatch = (id, reason, stay = false, parameters = '') => ({ ...yieldDispatch(id, 'form', `'${reason}'`), onResponse: 'continue', responseContext: 'Current question: {{asked}}', responseChoices: 'ranked', responseVariable: 'reply', responseConcernForm: '{{form}}', ...(parameters ? { responseParameters: parameters } : {}), ...(stay ? { responseStay: 'stay' } : {}) });
|
|
472
|
+
// CONCERN (owner 2026-11-11): the nearest form in the chain that declares user_description says what its process does
|
|
473
|
+
// (DISPATCH responseConcernForm: the engine renders it). The ranker is offered `concern` only then; a concern says the rendered
|
|
474
|
+
// description, how to cancel, and the question again, with no attempt.
|
|
475
|
+
const concernRoute = (id, input) => [WHEN(id, 'reply && reply.concern === true', SIDE(`${id}_line`, `(cargo.forms[form].concernText=String(reply.concern_text || ''),cargo.forms[form].feedback=cargo.forms[form].feedback || {},cargo.forms[form].feedback[${input}]='concern',true)`)), WHEN(`${id}_end`, 'reply && reply.concern === true', END(`${id}_done`))];
|
|
472
476
|
const readFormReply = {
|
|
473
477
|
id: 'read-form-reply', name: 'ReadFormReply', version: '1.1.0', scope: 'isolated', description: 'Rank an unreadable answer against its question: a request for a person or for text is taken; an answer is asked again; a withdrawal or a new request leaves with saved form progress.',
|
|
474
478
|
parameters: [{ name: 'form', type: 'string' }, { name: 'input', type: 'string' }, { name: 'question', type: 'string' }, { name: 'question_es', type: 'string' }],
|
|
@@ -477,6 +481,7 @@ const readFormReply = {
|
|
|
477
481
|
rankedChoices('reply_ranked', '[]'),
|
|
478
482
|
rankedDispatch('reply_dispatch', 'input_not_matched'),
|
|
479
483
|
...escapeRoutes('reply_escape'),
|
|
484
|
+
...concernRoute('reply_concern', 'input'),
|
|
480
485
|
rankedMiss('reply_miss')]
|
|
481
486
|
};
|
|
482
487
|
// A provider menu's fact named inside a longer sentence (provides.menu.whole_phrases): the phrase does not decide, the ranker
|
|
@@ -528,6 +533,7 @@ const readFormChoice = {
|
|
|
528
533
|
rankedChoices('choice_ranked', `(choices || []).filter(function(c,i,all){return !(firm==='firm' && String(c.key)==='yes') && all.findIndex(function(o){return String(o.key)===String(c.key);})===i;}).map(function(c){return Object.assign({key:String(c.key),label:(${RANK_LABEL_JS})(c)},Array.isArray(c.parameters) && c.parameters.length ? {parameters:c.parameters.map(function(p){return {name:p.name,type:p.type || 'string',description:p.description};})} : {});}).concat(others.map(function(c){return Object.assign({key:c.key,label:c.label},c.parameters ? {parameters:c.parameters.map(function(p){return {name:p.name,type:p.type || 'string',description:p.description};})} : {});}))`),
|
|
529
534
|
rankedDispatch('choice_dispatch', 'input_not_matched', true, 'rank_params'),
|
|
530
535
|
...escapeRoutes('choice_escape'),
|
|
536
|
+
...concernRoute('choice_concern', 'input'),
|
|
531
537
|
SET('choice_picked', 'picked', "(function(){var k=String(reply && reply.key || '');var c=(choices || []).filter(function(c){return String(c.key)===k;})[0] || others.filter(function(c){return c.key===k;})[0];return c ? String(c.key) : '';})()"),
|
|
532
538
|
// A question over any_of asks one name and its choices belong to a member ('selection' asks, 'option' holds PAST DUE): the pick is read as the member's answer.
|
|
533
539
|
SET('choice_owner', 'owner', "(others.filter(function(c){return c.key===picked && !(choices || []).some(function(own){return String(own.key)===picked;});})[0] || {}).owner || (function(){var asked=(chain || []).filter(function(i){return i.form===form && i.name===input;})[0];if(asked || !picked)return null;var spec=((cargo.forms[form] || {}).specs || []).filter(function(i){return i.name===input;})[0];var names=((spec || {}).any_of || []).map(function(i){return i.name;});var member=(chain || []).filter(function(i){return i.form===form && names.indexOf(i.name)>=0 && i.profile && (i.profile.choices || []).some(function(c){return String(c.key)===picked;});})[0];return member ? {form:member.form,name:member.name} : null;})()"),
|
|
@@ -552,7 +558,7 @@ const readFormChoice = {
|
|
|
552
558
|
// A confirmation's unread answer goes to the reply ranker with the confirmation question (owner 2026-10-27), never
|
|
553
559
|
// straight to the host. A firm confirmation authorizes the form's action, so the ranker is offered NO, the form's other
|
|
554
560
|
// choices (a correction) and a person, never YES; a soft one (no exact action) is offered YES too (owner 2026-11-08:
|
|
555
|
-
// prod 11:07 "Sí, para enviar." at a ticket's confirmation). Result: cargo.confirmRanked = 'yes' | 'no' | 'changed' | 'none'
|
|
561
|
+
// prod 11:07 "Sí, para enviar." at a ticket's confirmation). Result: cargo.confirmRanked = 'yes' | 'no' | 'changed' | 'none' | 'concern'
|
|
556
562
|
// (ConfirmForm reads it); `abort` ends every flow; `new_request` goes to intent detection.
|
|
557
563
|
const readConfirmReply = {
|
|
558
564
|
id: 'read-confirm-reply', name: 'ReadConfirmReply', version: '1.4.0', scope: 'isolated', description: 'Rank an unreadable answer to a confirmation: it declines (NO), picks another of the form\'s choices (a correction, read as that input\'s answer), says a named field read back is wrong (confirm.named_fields: that input is asked again), asks for a person, or is asked again; a withdrawal or a new request leaves with saved form progress. Never confirms.',
|
|
@@ -576,6 +582,8 @@ const readConfirmReply = {
|
|
|
576
582
|
SET('confirm_rank_params', 'rank_params', "(Array.isArray(rank_parameters) ? rank_parameters : []).map(function(p){return {name:p.name,type:p.type || 'string',description:p.description};})"),
|
|
577
583
|
rankedDispatch('confirm_dispatch', 'confirmation_not_matched', true, 'rank_params'),
|
|
578
584
|
...escapeRoutes('confirm_escape'),
|
|
585
|
+
WHEN('confirm_concern', 'reply && reply.concern === true', SIDE('confirm_concern_line', "(cargo.forms[form].concernText=String(reply.concern_text || ''),cargo.forms[form].feedback=cargo.forms[form].feedback || {},cargo.forms[form].feedback['__confirm']='concern',cargo.confirmRanked='concern',true)")),
|
|
586
|
+
WHEN('confirm_concern_end', 'reply && reply.concern === true', END('confirm_concern_done')),
|
|
579
587
|
// a correction picked by the ranker is read as its input's answer: the form changes and is confirmed again, never confirmed
|
|
580
588
|
SET('confirm_picked', 'picked', "others.filter(function(c){return reply && c.key===reply.key;})[0] || null"),
|
|
581
589
|
SET('confirm_read', 'reading', "picked ? enrichFormMatches(readFormAnswer(picked.key, chain, picked.owner, picked.key, []), chain, form, [picked.owner.name], picked.owner.name) : null"),
|
|
@@ -737,10 +745,11 @@ const confirmForm = {
|
|
|
737
745
|
default: SET('cf_unclear', 'cf_result', "'unclear'")
|
|
738
746
|
} },
|
|
739
747
|
// the ranker's reading of an unread answer: a decline is the NO; an answer that declines nothing is asked again
|
|
740
|
-
SET('cf_ranked', 'cf_result', "cf_result ? cf_result : cargo.confirmRanked === 'yes' ? 'yes' : cargo.confirmRanked === 'no' ? 'no' : cargo.confirmRanked === 'none' ? 'unclear' : ''"),
|
|
748
|
+
SET('cf_ranked', 'cf_result', "cf_result ? cf_result : cargo.confirmRanked === 'yes' ? 'yes' : cargo.confirmRanked === 'no' ? 'no' : cargo.confirmRanked === 'none' ? 'unclear' : cargo.confirmRanked === 'concern' ? 'concern' : ''"),
|
|
741
749
|
SET('cf_changed', 'cf_result', "cf_result ? cf_result : 'changed'"),
|
|
742
750
|
// an unclear answer is asked again (the form runs again and reaches this question), at most twice
|
|
743
|
-
|
|
751
|
+
// a concern is answered and asked again: no attempt, and the misses so far stand
|
|
752
|
+
SET('cf_tries_count', 'cf_tries', "cf_result === 'unclear' ? missFormInput(cargo,form,'__confirm') : cf_result === 'concern' ? 0 : (clearFormMisses(cargo,form,'__confirm'),0)"),
|
|
744
753
|
WHEN('cf_first', 'cf_must && cf_result === \'unclear\' && cf_words > 0', SIDE('cf_first_line', "(cargo.forms[form].feedback['__confirm']='first',true)")),
|
|
745
754
|
// out of attempts: the give-up worker (a person), never a silent DISPATCH that ends the request unanswered
|
|
746
755
|
optionalIncomplete('cf_optional_exhausted', 'cf_tries >= 2 && !cf_must', 'form', "'confirmation_misses_exhausted'"),
|
|
@@ -748,7 +757,7 @@ const confirmForm = {
|
|
|
748
757
|
WHEN('cf_misses_exhausted', 'cf_tries >= 2 && !cf_must', FLOW('cf_give_up', 'give-up', 'reboot', { context: '{{exit_context}}', context_es: '{{exit_context_es}}' })),
|
|
749
758
|
WHEN('cf_clarified_no_sorry', 'cf_clarify', SIDE('cf_clarified_feedback', "consumeFormFeedback(cargo,form,'__confirm')")),
|
|
750
759
|
WHEN('cf_bind_revision', "cf_result === 'yes'", SIDE('cf_bind', 'confirmFormRevision(cargo, form)')),
|
|
751
|
-
SIDE('cf_store', "(cargo.formConfirm[form] = cf_result === 'unclear' || cf_result === 'clarification' ? 'changed' : cf_result, true)"),
|
|
760
|
+
SIDE('cf_store', "(cargo.formConfirm[form] = cf_result === 'unclear' || cf_result === 'clarification' || cf_result === 'concern' ? 'changed' : cf_result, true)"),
|
|
752
761
|
],
|
|
753
762
|
};
|
|
754
763
|
// ── proposed input: owned confirmation before canonical acceptance or callbacks ────────────────────────────
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AA8CA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AAMD,4EAKC;AA6FD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAqJD,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AAhQD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AA8CA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AAMD,4EAKC;AA6FD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAqJD,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AAhQD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAiRzC,0BAA8J"}
|
|
@@ -456,4 +456,10 @@ const failed = worker('verification-failed', 'VerificationFailed', 'End a verifi
|
|
|
456
456
|
{ id: 'vf_offer_agent', type: 'CASE', branches: { 'condition: !!vf_agent': { id: 'vf_agent_say', type: 'SAY', value: '{{vf_agent}}', value_es: '{{vf_agent_es}}' }, default: set('vf_agent_skip', 'noop', 'true') } },
|
|
457
457
|
end('vf_end')]
|
|
458
458
|
});
|
|
459
|
-
|
|
459
|
+
// The global exit (owner 2026-11-11): the engine starts this flow when the whole answer is *, EXIT, QUIT or SALIR (and the
|
|
460
|
+
// question declares no choice of its own for it), after every flow has ended. Default: the tenant's support closing with the outcome in force. A tenant
|
|
461
|
+
// gives the global exit its own path with a flow that `wraps` this one; the engine then starts that wrapper.
|
|
462
|
+
const globalExit = worker('global-exit', 'GlobalExit', 'Worker (started by the engine): the caller exited; give the support closing with the outcome in force.', { scope: 'isolated', parameters: [param('exit_outcome', 'The declared outcome in force when the caller exited (resolved: thanks)')], steps: [
|
|
463
|
+
call('global_exit_support', 'contact-support', { exit_outcome: '{{exit_outcome}}' }, 'reboot')
|
|
464
|
+
] });
|
|
465
|
+
export const FLOWS = [taskGate, resume, service, rawTransport, contact, declined, splitFailed, rejected, auth, code, validateCode, emailToo, retry, email, failed, globalExit];
|
package/dist/helpers/answer.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ export function isWholeNo(input: any): boolean;
|
|
|
11
11
|
* The word may be repeated ("Salir salir."), echo the prompt ("Salir para cancelar") or end in "now" (prod 2026-10-28).
|
|
12
12
|
*/
|
|
13
13
|
export function isExitRequest(input: any): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the WHOLE answer is the global exit (owner 2026-11-11): "*", EXIT, QUIT or SALIR, maybe repeated or with please /
|
|
16
|
+
* por favor / now. The engine ends every flow on it, at any question, before any reader or the reply ranker. "Cancel" and
|
|
17
|
+
* "cancelar" are not in it: they can be an answer (a menu's CANCEL choice), so they stay with the question.
|
|
18
|
+
*/
|
|
19
|
+
export function isGlobalExit(input: any): boolean;
|
|
14
20
|
/** Whether the WHOLE answer asks for a person ("agent", "I want to talk to a representative", "0") — for free-text prompts. */
|
|
15
21
|
export function isAgentRequest(input: any): boolean;
|
|
16
22
|
/** Whether the answer is (part of) a spelled address — letters said one at a time, or a spelled symbol. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AAsNA;;;GAGG;AACH,wEAkBC;AAED,qHAAqH;AACrH,+CAGC;AAED;;;;GAIG;AACH,mDAIC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AAuBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAqCC;AAqBD,oEAqBC;AASD,gJAAgJ;AAChJ,sEAGC;AAED;;;;;;;;;GASG;AACH,6EA4GC;;;;;;;;
|
|
1
|
+
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AAsNA;;;GAGG;AACH,wEAkBC;AAED,qHAAqH;AACrH,+CAGC;AAED;;;;GAIG;AACH,mDAIC;AAED;;;;GAIG;AACH,kDAIC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AAuBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAqCC;AAqBD,oEAqBC;AASD,gJAAgJ;AAChJ,sEAGC;AAED;;;;;;;;;GASG;AACH,6EA4GC;;;;;;;;AA3gBD,qCAKwE"}
|
package/dist/helpers/answer.js
CHANGED
|
@@ -265,6 +265,16 @@ export function isExitRequest(input) {
|
|
|
265
265
|
const word = '(?:exit|quit|salir|abort|cancel|cancelar)';
|
|
266
266
|
return b === '*' || new RegExp(`^${word}(?:[ .]+${word})*(?: para cancelar| to cancel)?(?: please| por favor| ahora| now)?$`).test(b);
|
|
267
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Whether the WHOLE answer is the global exit (owner 2026-11-11): "*", EXIT, QUIT or SALIR, maybe repeated or with please /
|
|
270
|
+
* por favor / now. The engine ends every flow on it, at any question, before any reader or the reply ranker. "Cancel" and
|
|
271
|
+
* "cancelar" are not in it: they can be an answer (a menu's CANCEL choice), so they stay with the question.
|
|
272
|
+
*/
|
|
273
|
+
export function isGlobalExit(input) {
|
|
274
|
+
const b = normalize(input).replace(/^[.\s!]+|[.\s!]+$/g, '');
|
|
275
|
+
const word = '(?:exit|quit|salir)';
|
|
276
|
+
return /^\*(?:\s*\*)*$/.test(b) || new RegExp(`^${word}(?:[ .!]+${word})*(?: please| por favor| ahora| now)?$`).test(b);
|
|
277
|
+
}
|
|
268
278
|
/** Whether the WHOLE answer asks for a person ("agent", "I want to talk to a representative", "0") — for free-text prompts. */
|
|
269
279
|
export function isAgentRequest(input) {
|
|
270
280
|
// the period normalize() keeps for emails is not part of the answer at its ends ("Operator." on a call, 2026-10-17)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Return an isolated declaration copy; unknown response fields cannot silently become legacy dispatch. */
|
|
2
2
|
export function validateContextualResponseStep(step: any, flow: any): {
|
|
3
|
+
concernForm?: any;
|
|
4
|
+
concern?: any;
|
|
3
5
|
reasonFor?: any;
|
|
4
6
|
choices?: any;
|
|
5
7
|
variable: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextual-response.d.ts","sourceRoot":"","sources":["../../src/helpers/contextual-response.js"],"names":[],"mappings":"AAMA,2GAA2G;AAC3G
|
|
1
|
+
{"version":3,"file":"contextual-response.d.ts","sourceRoot":"","sources":["../../src/helpers/contextual-response.js"],"names":[],"mappings":"AAMA,2GAA2G;AAC3G;;;;;;;;qBAwBC;AACD,oHAAoH;AACpH,2DAcC;AACD,+FAIC;AAED;;;GAGG;AACH,yDAMC;AAhED,4FAA4F;AAC5F,+CAAgD,8BAA8B,CAAC;AACxE,qDAA0C;AA+D1C,kDAA8J"}
|
|
@@ -33,8 +33,14 @@ export function validateContextualResponseStep(step, flow) {
|
|
|
33
33
|
// responseReasonFor: what the caller does not want; the reply is ranked as the reason for not wanting it (owner 2026-10-31).
|
|
34
34
|
if (own(step, 'responseReasonFor') && (typeof step.responseReasonFor !== 'string' || choices))
|
|
35
35
|
fail('responseReasonFor is a string, on a question without responseChoices');
|
|
36
|
+
// responseConcern: what the process does (a form's user_description); the ranker may read the reply as a concern about it.
|
|
37
|
+
if (own(step, 'responseConcern') && typeof step.responseConcern !== 'string')
|
|
38
|
+
fail('responseConcern is a string');
|
|
39
|
+
// responseConcernForm: a form instance; the nearest form in its chain declaring user_description, rendered by the engine.
|
|
40
|
+
if (own(step, 'responseConcernForm') && typeof step.responseConcernForm !== 'string')
|
|
41
|
+
fail('responseConcernForm is a string');
|
|
36
42
|
try {
|
|
37
|
-
return structuredClone({ parameters: dynamic ? [] : step.responseParameters || [], ...(dynamic ? { parametersFrom: step.responseParameters } : {}), variable: step.responseVariable, ...(choices ? { choices: step.responseChoices } : {}), ...(own(step, 'responseReasonFor') ? { reasonFor: step.responseReasonFor } : {}) });
|
|
43
|
+
return structuredClone({ parameters: dynamic ? [] : step.responseParameters || [], ...(dynamic ? { parametersFrom: step.responseParameters } : {}), variable: step.responseVariable, ...(choices ? { choices: step.responseChoices } : {}), ...(own(step, 'responseReasonFor') ? { reasonFor: step.responseReasonFor } : {}), ...(own(step, 'responseConcern') ? { concern: step.responseConcern } : {}), ...(own(step, 'responseConcernForm') ? { concernForm: step.responseConcernForm } : {}) });
|
|
38
44
|
}
|
|
39
45
|
catch {
|
|
40
46
|
fail('response parameters must be cloneable declaration data');
|
|
@@ -7,6 +7,19 @@ export function formMustComplete(cargo: any, id: any, input: any): boolean;
|
|
|
7
7
|
/** A must_complete question's reply that picks nothing the ranker was offered is acknowledged, then the question again (owner
|
|
8
8
|
* 2026-11-02): "I understand, first let's record your new card." The task is the nearest enclosing form's first_task. */
|
|
9
9
|
export function formFirstLine(cargo: any, id: any, input: any, es: any): string;
|
|
10
|
+
/**
|
|
11
|
+
* A form's user_description (owner 2026-11-11): what the process does, for a caller who doubts the current process is what they
|
|
12
|
+
* need. The nearest form in the chain that declares one, from the asking form outward, so a shared sub-form (an address) speaks
|
|
13
|
+
* for the task that opened it. Returns {form, text} with the TEMPLATE as declared (the engine renders it with the engine's own
|
|
14
|
+
* {{...}} expressions, that form's data and values in scope), or null when none declares one.
|
|
15
|
+
*/
|
|
16
|
+
export function formUserDescriptionSource(cargo: any, id: any, es: any): {
|
|
17
|
+
form: any;
|
|
18
|
+
text: string;
|
|
19
|
+
} | null;
|
|
20
|
+
/** CONCERN: the description as the engine rendered it for this verdict (state.concernText), how to cancel (the global exit:
|
|
21
|
+
* *, EXIT, SALIR), then the question again. */
|
|
22
|
+
export function formConcernLine(cargo: any, id: any, es: any): string;
|
|
10
23
|
/**
|
|
11
24
|
* Explicit retry wins. Otherwise acknowledge only an actual unrecognized answer, once per re-ask.
|
|
12
25
|
* question_text / retry_text (and _es): the written-channel wording, used only when the conversation is not a call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-conversation.d.ts","sourceRoot":"","sources":["../../src/helpers/form-conversation.js"],"names":[],"mappings":"AAMA,0EAGC;AACD,oEAGC;AACD;;qGAEqG;AACrG,2EAWC;AACD;yHACyH;AACzH,gFAIC;AACD;;;GAGG;AACH,+
|
|
1
|
+
{"version":3,"file":"form-conversation.d.ts","sourceRoot":"","sources":["../../src/helpers/form-conversation.js"],"names":[],"mappings":"AAMA,0EAGC;AACD,oEAGC;AACD;;qGAEqG;AACrG,2EAWC;AACD;yHACyH;AACzH,gFAIC;AACD;;;;;GAKG;AACH;;;SAQC;AACD;+CAC+C;AAC/C,sEAIC;AACD;;;GAGG;AACH,+GAUC;AAMD,oEAOC;AACD,8EAAwI;AAExI,yGAAyG;AACzG;;;;;;;;;;;;;;;;;;;;EAUC;AAED,sGAAsG;AACtG;;;;;;;;;;;;;;;;;;;;EAeC;AAED;2HAC2H;AAC3H,8EAOC"}
|
|
@@ -57,6 +57,31 @@ export function formFirstLine(cargo, id, input, es) {
|
|
|
57
57
|
}
|
|
58
58
|
return es ? `Entiendo, primero vamos a ${task || 'terminar esto'}. ` : `I understand, first let's ${task || 'finish this'}. `;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* A form's user_description (owner 2026-11-11): what the process does, for a caller who doubts the current process is what they
|
|
62
|
+
* need. The nearest form in the chain that declares one, from the asking form outward, so a shared sub-form (an address) speaks
|
|
63
|
+
* for the task that opened it. Returns {form, text} with the TEMPLATE as declared (the engine renders it with the engine's own
|
|
64
|
+
* {{...}} expressions, that form's data and values in scope), or null when none declares one.
|
|
65
|
+
*/
|
|
66
|
+
export function formUserDescriptionSource(cargo, id, es) {
|
|
67
|
+
const seen = new Set();
|
|
68
|
+
while (id && cargo?.forms?.[id] && !seen.has(id)) {
|
|
69
|
+
seen.add(id);
|
|
70
|
+
const state = cargo.forms[id];
|
|
71
|
+
const text = es ? state.user_description_es || state.user_description : state.user_description;
|
|
72
|
+
if (typeof text === 'string' && text.trim())
|
|
73
|
+
return { form: id, text };
|
|
74
|
+
id = state.parent;
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
/** CONCERN: the description as the engine rendered it for this verdict (state.concernText), how to cancel (the global exit:
|
|
79
|
+
* *, EXIT, SALIR), then the question again. */
|
|
80
|
+
export function formConcernLine(cargo, id, es) {
|
|
81
|
+
const said = String(cargo?.forms?.[id]?.concernText || '').replace(/\s+/g, ' ').trim(), end = !said || /[.!?]$/.test(said) ? '' : '.';
|
|
82
|
+
const cancel = es ? (cargo?.voice ? 'Para cancelar, presione la tecla de asterisco o diga SALIR.' : 'Para cancelar, escriba SALIR.') : (cargo?.voice ? 'To cancel, press the asterisk key or say EXIT.' : 'To cancel, type EXIT.');
|
|
83
|
+
return (said ? said + end + ' ' : '') + cancel + ' ';
|
|
84
|
+
}
|
|
60
85
|
/**
|
|
61
86
|
* Explicit retry wins. Otherwise acknowledge only an actual unrecognized answer, once per re-ask.
|
|
62
87
|
* question_text / retry_text (and _es): the written-channel wording, used only when the conversation is not a call.
|
|
@@ -70,6 +95,8 @@ export function formInputPrompt(cargo, id, input, spec, data = {}, language = 'e
|
|
|
70
95
|
return es ? 'Continúe.' : 'Go on.';
|
|
71
96
|
if (feedback === 'first')
|
|
72
97
|
return formFirstLine(cargo, id, input, es) + (retry || question);
|
|
98
|
+
if (feedback === 'concern')
|
|
99
|
+
return formConcernLine(cargo, id, es) + question;
|
|
73
100
|
if (feedback && retry)
|
|
74
101
|
return retry;
|
|
75
102
|
return (feedback === 'miss' ? sorryNotCaught(es ? 'es' : 'en', cargo) : '') + question;
|
|
@@ -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, resume_on_parent_change, incomplete_outcome, on_exhausted, on_no, acknowledge, must_complete, first_task, first_task_es }?: {
|
|
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, on_no, acknowledge, must_complete, first_task, first_task_es, user_description, user_description_es }?: {
|
|
22
22
|
parent?: null | undefined;
|
|
23
23
|
input?: string | undefined;
|
|
24
24
|
resume?: string | undefined;
|
|
@@ -34,6 +34,8 @@ export function openFormInstance(cargo: any, definition: any, specs: any, { pare
|
|
|
34
34
|
must_complete?: undefined;
|
|
35
35
|
first_task?: undefined;
|
|
36
36
|
first_task_es?: undefined;
|
|
37
|
+
user_description?: undefined;
|
|
38
|
+
user_description_es?: undefined;
|
|
37
39
|
}): any;
|
|
38
40
|
/** An incomplete optional follow-up may preserve an explicitly completed task outcome. */
|
|
39
41
|
export function validateFormIncompleteOutcome(value: any): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-state.d.ts","sourceRoot":"","sources":["../../src/helpers/form-state.js"],"names":[],"mappings":"AAQA,qDAKC;AAED,oDAEC;AAED,qFAAqF;AACrF,oEA+BC;AA0CD,2FAEC;AACD,8FAcC;AACD,2DAOC;AACD,uEA8CC;AAED,kGAAkG;AAClG,2GAOC;AACD,0HAA0H;AAC1H,uEAwBC;AACD,8HAA8H;AAC9H;;;;;EAeC;AACD,uGAAuG;AACvG
|
|
1
|
+
{"version":3,"file":"form-state.d.ts","sourceRoot":"","sources":["../../src/helpers/form-state.js"],"names":[],"mappings":"AAQA,qDAKC;AAED,oDAEC;AAED,qFAAqF;AACrF,oEA+BC;AA0CD,2FAEC;AACD,8FAcC;AACD,2DAOC;AACD,uEA8CC;AAED,kGAAkG;AAClG,2GAOC;AACD,0HAA0H;AAC1H,uEAwBC;AACD,8HAA8H;AAC9H;;;;;EAeC;AACD,uGAAuG;AACvG;;;;;;;;;;;;;;;;;;QA+CC;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;AAoCD,qFAYC;AACD,oGAqCC;AACD;;;SAKC;AACD,qEAGC;AACD,gEAgBC;AACD;;uGAEuG;AACvG,sEAGC;AACD,2DAQC;AACD,oGAUC;AAED,uEAAuE;AACvE,wHA+BC;AAED,uHAAuH;AACvH,6EAaC;AACD,mHAAmH;AACnH,iGAsDC;AACD;;;GAGG;AACH;;;SAcC;AACD,+EASC;AACD,8EAeC;AAtqBM,8CAAmE"}
|
|
@@ -301,7 +301,7 @@ export function settleFormActivations(batch = {}, cargo = null) {
|
|
|
301
301
|
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) };
|
|
302
302
|
}
|
|
303
303
|
/** Explicit ownership: unrelated tasks and sibling inputs never share an instance by definition id. */
|
|
304
|
-
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, on_no = undefined, acknowledge = undefined, must_complete = undefined, first_task = undefined, first_task_es = undefined } = {}) {
|
|
304
|
+
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, on_no = undefined, acknowledge = undefined, must_complete = undefined, first_task = undefined, first_task_es = undefined, user_description = undefined, user_description_es = undefined } = {}) {
|
|
305
305
|
const incomplete = validateFormIncompleteOutcome(incomplete_outcome);
|
|
306
306
|
validateFormExhaustion(on_exhausted);
|
|
307
307
|
if (acknowledge !== undefined && acknowledge !== 'all' && acknowledge !== 'data')
|
|
@@ -327,6 +327,10 @@ export function openFormInstance(cargo, definition, specs, { parent = null, inpu
|
|
|
327
327
|
existing.first_task = first_task;
|
|
328
328
|
if (first_task_es !== undefined)
|
|
329
329
|
existing.first_task_es = first_task_es;
|
|
330
|
+
if (user_description !== undefined)
|
|
331
|
+
existing.user_description = user_description;
|
|
332
|
+
if (user_description_es !== undefined)
|
|
333
|
+
existing.user_description_es = user_description_es;
|
|
330
334
|
if (acknowledge !== undefined)
|
|
331
335
|
existing.acknowledge = acknowledge;
|
|
332
336
|
return resume;
|
|
@@ -353,6 +357,10 @@ export function openFormInstance(cargo, definition, specs, { parent = null, inpu
|
|
|
353
357
|
cargo.forms[child].first_task = first_task;
|
|
354
358
|
if (first_task_es !== undefined)
|
|
355
359
|
cargo.forms[child].first_task_es = first_task_es;
|
|
360
|
+
if (user_description !== undefined)
|
|
361
|
+
cargo.forms[child].user_description = user_description;
|
|
362
|
+
if (user_description_es !== undefined)
|
|
363
|
+
cargo.forms[child].user_description_es = user_description_es;
|
|
356
364
|
if (acknowledge !== undefined)
|
|
357
365
|
cargo.forms[child].acknowledge = acknowledge;
|
|
358
366
|
return child;
|
|
@@ -361,7 +369,7 @@ export function openFormInstance(cargo, definition, specs, { parent = null, inpu
|
|
|
361
369
|
cargo.formSequence = Number(cargo.formSequence || 0) + 1;
|
|
362
370
|
const id = `${definition}:${cargo.formSequence}`;
|
|
363
371
|
cargo.forms[id] = { id, definition, task: owner?.task || task || id, parent, result_input: input,
|
|
364
|
-
on_exhausted: on_exhausted || '', on_no: on_no || '', must_complete: must_complete === true, ...(first_task !== undefined ? { first_task } : {}), ...(first_task_es !== undefined ? { first_task_es } : {}), ...(acknowledge !== undefined ? { acknowledge } : {}), 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,
|
|
372
|
+
on_exhausted: on_exhausted || '', on_no: on_no || '', must_complete: must_complete === true, ...(first_task !== undefined ? { first_task } : {}), ...(first_task_es !== undefined ? { first_task_es } : {}), ...(user_description !== undefined ? { user_description } : {}), ...(user_description_es !== undefined ? { user_description_es } : {}), ...(acknowledge !== undefined ? { acknowledge } : {}), 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,
|
|
365
373
|
providers: providers || owner?.providers || null, questions: questions?.length ? questions : owner?.questions || [], status: 'collecting' };
|
|
366
374
|
if (owner) {
|
|
367
375
|
if (context) {
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
22
22
|
export { missFormInput };
|
|
23
23
|
export { formMustComplete };
|
|
24
24
|
export { formInputPrompt };
|
|
25
|
+
export { formUserDescriptionSource };
|
|
26
|
+
export { formConcernLine };
|
|
25
27
|
export { formAcknowledges };
|
|
26
28
|
export { consumeFormFeedback };
|
|
27
29
|
export { formConversationOutcome };
|
|
@@ -38,6 +40,7 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
38
40
|
export { isAnswer };
|
|
39
41
|
export { isAgentRequest };
|
|
40
42
|
export { isExitRequest };
|
|
43
|
+
export { isGlobalExit };
|
|
41
44
|
export { isOtherRequest };
|
|
42
45
|
export { isSpelledFragment };
|
|
43
46
|
export { isAmountAnswer };
|
|
@@ -148,6 +151,8 @@ import { formNoOwner } from './form-conversation.js';
|
|
|
148
151
|
import { missFormInput } from './form-conversation.js';
|
|
149
152
|
import { formMustComplete } from './form-conversation.js';
|
|
150
153
|
import { formInputPrompt } from './form-conversation.js';
|
|
154
|
+
import { formUserDescriptionSource } from './form-conversation.js';
|
|
155
|
+
import { formConcernLine } from './form-conversation.js';
|
|
151
156
|
import { formAcknowledges } from './form-conversation.js';
|
|
152
157
|
import { consumeFormFeedback } from './form-conversation.js';
|
|
153
158
|
import { formConversationOutcome } from './form-conversation.js';
|
|
@@ -166,6 +171,7 @@ import { CONFIRM_WORDS } from './answer.js';
|
|
|
166
171
|
import { isAnswer } from './answer.js';
|
|
167
172
|
import { isAgentRequest } from './answer.js';
|
|
168
173
|
import { isExitRequest } from './answer.js';
|
|
174
|
+
import { isGlobalExit } from './answer.js';
|
|
169
175
|
import { isOtherRequest } from './answer.js';
|
|
170
176
|
import { isSpelledFragment } from './answer.js';
|
|
171
177
|
import { isAmountAnswer } from './answer.js';
|
|
@@ -258,5 +264,5 @@ import { textWithUrlToSpeech } from './url-speech.js';
|
|
|
258
264
|
import { joinSpokenDigits } from './spoken-digits.js';
|
|
259
265
|
import { spokenDigitsText } from './spoken-digits.js';
|
|
260
266
|
import { wholeSpokenNumber } from './spoken-digits.js';
|
|
261
|
-
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formAcknowledges, consumeFormFeedback, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho, readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber };
|
|
267
|
+
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho, readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber };
|
|
262
268
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CACyC,iCAAiC;+BAIqI,wBAAwB;2CAHzJ,0BAA0B;qCAA1B,0BAA0B;gCAA1B,0BAA0B;mCACsE,qBAAqB;kCAArB,qBAAqB;iCAArB,qBAAqB;qCAArB,qBAAqB;iCAArB,qBAAqB;mCAArB,qBAAqB;oCAArB,qBAAqB;6CAArB,qBAAqB;qCAC/E,wBAAwB;2CAAxB,wBAAwB;+CAAxB,wBAAwB;uCAAxB,wBAAwB;gCACmE,wBAAwB;4BAAxB,wBAAwB;8BAAxB,wBAAwB;iCAAxB,wBAAwB;gCAAxB,wBAAwB;0CAAxB,wBAAwB;gCAAxB,wBAAwB;iCAAxB,wBAAwB;oCAAxB,wBAAwB;wCAAxB,wBAAwB;gCAmBxG,YAAY;8BAAZ,YAAY;kCAAZ,YAAY;uCAAZ,YAAY;qCAAZ,YAAY;qCAAZ,YAAY;gCAlB3G,mBAAmB;gCA0BwE,mBAAmB;sCAAnB,mBAAmB;8BAThH,qBAAqB;6BAEkJ,aAAa;8BAAb,aAAa;yBAAb,aAAa;+BAAb,aAAa;8BAAb,aAAa;6BAAb,aAAa;+BAAb,aAAa;kCAAb,aAAa;+BAAb,aAAa;+BAAb,aAAa;2BAAb,aAAa;kCAAb,aAAa;0BACzD,cAAc;0BAAd,cAAc;uCAAd,cAAc;+BAAd,cAAc;sBAAd,cAAc;0BAAd,cAAc;iCAAd,cAAc;gCAAd,cAAc;sCAAd,cAAc;wCAC/H,cAAc;6BACS,cAAc;wBAAd,cAAc;wBAAd,cAAc;+BAAd,cAAc;4BACjD,iBAAiB;+BACd,uBAAuB;mCACC,kBAAkB;mCAAlB,kBAAkB;qCAxB+I,mBAAmB;yCAAnB,mBAAmB;8BAAnB,mBAAmB;iCAAnB,mBAAmB;oCAAnB,mBAAmB;kCAAnB,mBAAmB;wCAAnB,mBAAmB;gCAAnB,mBAAmB;iCAAnB,mBAAmB;mCAAnB,mBAAmB;gCAe1I,mBAAmB;mCAAnB,mBAAmB;sCAAnB,mBAAmB;qCAAnB,mBAAmB;4BAUO,mBAAmB;+BAAnB,mBAAmB;iCAAnB,mBAAmB;oCAAnB,mBAAmB;kCAC0lB,iBAAiB;iCAAjB,iBAAiB;gCAAjB,iBAAiB;8BAAjB,iBAAiB;+BAAjB,iBAAiB;iCAAjB,iBAAiB;8CAAjB,iBAAiB;sCAAjB,iBAAiB;uCAAjB,iBAAiB;iCAAjB,iBAAiB;oCAAjB,iBAAiB;kCAAjB,iBAAiB;mCAAjB,iBAAiB;oCAAjB,iBAAiB;wCAAjB,iBAAiB;sCAAjB,iBAAiB;kCAAjB,iBAAiB;sCAAjB,iBAAiB;sCAAjB,iBAAiB;sCAAjB,iBAAiB;gCAAjB,iBAAiB;6BAAjB,iBAAiB;yBAAjB,iBAAiB;gCAAjB,iBAAiB;iCAAjB,iBAAiB;oCAAjB,iBAAiB;gCAAjB,iBAAiB;kCAAjB,iBAAiB;oCAAjB,iBAAiB;8BAAjB,iBAAiB;wCAAjB,iBAAiB;mCAAjB,iBAAiB;qCAAjB,iBAAiB;mCAAjB,iBAAiB;oCAAjB,iBAAiB;iCAAjB,iBAAiB;kCAAjB,iBAAiB;yBACzqB,gBAAgB;yBAAhB,gBAAgB;gCAAhB,gBAAgB;4BAAhB,gBAAgB;8BAAhB,gBAAgB;+BACnC,iBAAiB;8BAAjB,iBAAiB;8BAAjB,iBAAiB;4BAE7B,iBAAiB;oCAAjB,iBAAiB;iCADI,oBAAoB;iCAApB,oBAAoB;kCAApB,oBAAoB"}
|