jsfe 1.7.5 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forms/contracts.d.ts.map +1 -1
- package/dist/forms/contracts.js +12 -2
- package/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +9 -10
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +4 -2
- package/dist/helpers/contact.d.ts +5 -1
- package/dist/helpers/contact.d.ts.map +1 -1
- package/dist/helpers/contact.js +10 -1
- package/dist/helpers/contextual-response.d.ts +10 -0
- package/dist/helpers/contextual-response.d.ts.map +1 -0
- package/dist/helpers/contextual-response.js +48 -0
- package/dist/helpers/form-state.d.ts +10 -2
- package/dist/helpers/form-state.d.ts.map +1 -1
- package/dist/helpers/form-state.js +33 -5
- package/dist/helpers/index.d.ts +5 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +5 -3
- package/dist/helpers/match-inputs.d.ts.map +1 -1
- package/dist/helpers/match-inputs.js +59 -10
- package/dist/host/capabilities.d.ts.map +1 -1
- package/dist/host/capabilities.js +2 -1
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +1 -0
- package/dist/host/registry-composition.d.ts +16 -0
- package/dist/host/registry-composition.d.ts.map +1 -0
- package/dist/host/registry-composition.js +109 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +179 -29
- package/dist/runtime-identity.js +1 -1
- package/docs/copilot-reference.md +7 -0
- package/docs/development-release.md +20 -0
- package/docs/forms.md +53 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/forms/contracts.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/forms/contracts.js"],"names":[],"mappings":"AAeA;;;IAGC;AACD;;;;;EAGC;AACD,qGAAqG;AACrG;;QAqCC;AAqBD;;;QAEC;AACD;;;;;;;QAMC;AACD;;;QAGC;AACD;;;;;;;QA8BC;AAED,mHAAmH;AACnH,kDAgBC;AAED,+GAA+G;AAC/G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEC"}
|
package/dist/forms/contracts.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CONTEXTUAL_RESPONSES_REQUIREMENT, validateContextualResponseStep, contextualResponseRuntimeSteps } from '../helpers/contextual-response.js';
|
|
1
2
|
/** Build-time contracts for conversational flows. Transport operations remain registered tools. */
|
|
2
3
|
import { INPUT_PROPOSALS_REQUIREMENT, hasInputProposals, proposalRuntimeSteps } from './proposal-runtime.js';
|
|
3
4
|
import { ACTION_TOOLS } from './action-tools.js';
|
|
@@ -82,13 +83,20 @@ function declared(flow, contract) {
|
|
|
82
83
|
...(step.type === 'FLOW' && step.callType === 'replace' ? { initializeDefaults: step.initializeDefaults ?? true } : {}),
|
|
83
84
|
...(step.branches ? { branches: Object.fromEntries(Object.entries(step.branches).map(([key, branch]) => [key, replacementDefaults(branch)])) } : {}),
|
|
84
85
|
...(step.onFail ? { onFail: replacementDefaults(step.onFail) } : {}) });
|
|
85
|
-
const
|
|
86
|
+
const contextual = stepList(flow.steps).filter(step => step.type === 'DISPATCH').map(step => validateContextualResponseStep(step, flow)).some(Boolean);
|
|
87
|
+
const requirements = [...normalizeHostRequirements(contract.requires, flow.id), ...(hasInputProposals(flow.variables?.inputs?.value) ? [INPUT_PROPOSALS_REQUIREMENT] : []), ...(contextual ? [CONTEXTUAL_RESPONSES_REQUIREMENT] : [])];
|
|
86
88
|
const metadata = { version: 1, ...contract, parametersFrom: 'parameters' };
|
|
87
89
|
if (requirements.length || contract.requires !== undefined)
|
|
88
90
|
Object.defineProperty(metadata, 'requires', {
|
|
89
91
|
value: normalizeHostRequirements(requirements, flow.id), enumerable: true, writable: false, configurable: false,
|
|
90
92
|
});
|
|
91
|
-
|
|
93
|
+
const guardedSteps = flow.steps.map(replacementDefaults);
|
|
94
|
+
// Linking a form may declare it again. Rebuild an existing protocol-only prefix once.
|
|
95
|
+
const rebuiltGuards = [...(requirements.includes(CONTEXTUAL_RESPONSES_REQUIREMENT) ? ['contextualResponseProtocol() === 1'] : []), ...(requirements.includes(INPUT_PROPOSALS_REQUIREMENT) ? ['formProposalProtocol() === 1'] : [])];
|
|
96
|
+
if (requirements.includes(CONTEXTUAL_RESPONSES_REQUIREMENT))
|
|
97
|
+
while (guardedSteps[0]?.type === 'SET' && guardedSteps[0]?.requireTrue === true && rebuiltGuards.includes(guardedSteps[0]?.value))
|
|
98
|
+
guardedSteps.shift();
|
|
99
|
+
return { ...flow, steps: contextualResponseRuntimeSteps(flow.id, proposalRuntimeSteps(flow.id, guardedSteps, requirements), requirements), variables: { ...flow.variables, contract: value(metadata) } };
|
|
92
100
|
}
|
|
93
101
|
export function defineWorker({ contract, ...flow }) {
|
|
94
102
|
return declared({ scope: 'isolated', version: '1.0.0', ...flow }, contract);
|
|
@@ -262,6 +270,8 @@ export function validateFlowContracts(flows, tools = [], { externalFlows = [], r
|
|
|
262
270
|
if (!toolIds.has(tool))
|
|
263
271
|
fail(flow.id, `unknown tool ${tool}`);
|
|
264
272
|
for (const step of stepList(flow.steps)) {
|
|
273
|
+
if (step.type === 'DISPATCH')
|
|
274
|
+
validateContextualResponseStep(step, flow);
|
|
265
275
|
if (step.type === 'FLOW' || step.type === 'CALL-TOOL') {
|
|
266
276
|
const inspect = value => {
|
|
267
277
|
if (typeof value === 'string')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA0FA;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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"}
|
package/dist/forms/flows.js
CHANGED
|
@@ -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
|
-
|
|
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 || ''"),
|
|
@@ -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;
|
|
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) ? '
|
|
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 === '
|
|
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)"),
|
|
@@ -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
|
|
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
|
|
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"}
|
package/dist/helpers/contact.js
CHANGED
|
@@ -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, '.')
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Return an isolated declaration copy; unknown response fields cannot silently become legacy dispatch. */
|
|
2
|
+
export function validateContextualResponseStep(step: any, flow: any): {
|
|
3
|
+
parameters: any;
|
|
4
|
+
variable: any;
|
|
5
|
+
} | null | undefined;
|
|
6
|
+
export function contextualResponseRuntimeSteps(id: any, steps: any, requirements?: any[]): any;
|
|
7
|
+
/** Explicit typed contextual responses. No engine state, transport, or host permissions. */
|
|
8
|
+
export const CONTEXTUAL_RESPONSES_REQUIREMENT: "jsfe:contextual-responses:v1";
|
|
9
|
+
export function contextualResponseProtocol(): number;
|
|
10
|
+
//# sourceMappingURL=contextual-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextual-response.d.ts","sourceRoot":"","sources":["../../src/helpers/contextual-response.js"],"names":[],"mappings":"AAMA,2GAA2G;AAC3G;;;qBAiBC;AACD,+FAIC;AA7BD,4FAA4F;AAC5F,+CAAgD,8BAA8B,CAAC;AACxE,qDAA0C"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Explicit typed contextual responses. No engine state, transport, or host permissions. */
|
|
2
|
+
export const CONTEXTUAL_RESPONSES_REQUIREMENT = 'jsfe:contextual-responses:v1';
|
|
3
|
+
export const contextualResponseProtocol = () => 1;
|
|
4
|
+
const own = (o, k) => Object.prototype.hasOwnProperty.call(o || {}, k);
|
|
5
|
+
const safeName = value => typeof value === 'string' && /^[A-Za-z_$][\w$]*$/.test(value) && !['__proto__', 'prototype', 'constructor'].includes(value);
|
|
6
|
+
const fail = message => { throw new Error('Contextual response: ' + message); };
|
|
7
|
+
/** Return an isolated declaration copy; unknown response fields cannot silently become legacy dispatch. */
|
|
8
|
+
export function validateContextualResponseStep(step, flow) {
|
|
9
|
+
const typed = own(step, 'responseParameters') || own(step, 'responseVariable');
|
|
10
|
+
if (!typed)
|
|
11
|
+
return null;
|
|
12
|
+
if (step.type !== 'DISPATCH' || step.onResponse !== 'continue' || typeof step.responseContext !== 'string' || !step.responseContext.trim())
|
|
13
|
+
fail('typed responses require DISPATCH onResponse:continue and nonempty responseContext');
|
|
14
|
+
if (!safeName(step.responseVariable) || ['cargo', 'currentContext', 'userInput', 'language', 'globalVariables'].includes(step.responseVariable) || !own(flow?.variables, step.responseVariable) || flow.variables[step.responseVariable]?.type !== 'object')
|
|
15
|
+
fail('responseVariable must name a declared object variable in this flow');
|
|
16
|
+
if (!Array.isArray(step.responseParameters) || !step.responseParameters.length)
|
|
17
|
+
fail('responseParameters must be a nonempty canonical parameter array');
|
|
18
|
+
const names = new Set();
|
|
19
|
+
for (const p of step.responseParameters) {
|
|
20
|
+
if (!p || typeof p !== 'object' || Array.isArray(p) || !safeName(p.name) || names.has(p.name))
|
|
21
|
+
fail('response parameter names must be unique safe identifiers');
|
|
22
|
+
names.add(p.name);
|
|
23
|
+
if (typeof p.description !== 'string' || !p.description.trim())
|
|
24
|
+
fail('response parameters need a description');
|
|
25
|
+
if (p.type !== undefined && !['string', 'boolean', 'number', 'integer'].includes(p.type))
|
|
26
|
+
fail('unsupported response parameter type');
|
|
27
|
+
if (p.enum !== undefined && (!Array.isArray(p.enum) || !p.enum.length || p.enum.some(v => typeof v !== 'string') || p.type !== undefined && p.type !== 'string'))
|
|
28
|
+
fail('response parameter enum must contain strings for a string parameter');
|
|
29
|
+
if (p.internal !== undefined && p.internal !== false)
|
|
30
|
+
fail('response parameters must be public extraction parameters');
|
|
31
|
+
if (own(p, 'jsonSchema'))
|
|
32
|
+
fail('response parameters support primitive types only; jsonSchema is not supported');
|
|
33
|
+
if (Object.keys(p).some(k => !['name', 'description', 'type', 'enum', 'internal'].includes(k)))
|
|
34
|
+
fail('responseParameters accepts only canonical parameter descriptors');
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return structuredClone({ parameters: step.responseParameters, variable: step.responseVariable });
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
fail('response parameters must be cloneable declaration data');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function contextualResponseRuntimeSteps(id, steps, requirements = []) {
|
|
44
|
+
if (!requirements.includes(CONTEXTUAL_RESPONSES_REQUIREMENT))
|
|
45
|
+
return steps;
|
|
46
|
+
const guard = { id: id + '_contextual_response_protocol', type: 'SET', variable: 'noop', value: 'contextualResponseProtocol() === 1', requireTrue: true };
|
|
47
|
+
return steps[0]?.type === 'SET' && steps[0]?.value === guard.value && steps[0]?.requireTrue === true ? steps : [guard, ...steps];
|
|
48
|
+
}
|
|
@@ -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
|
-
|
|
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
|
|
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
|
-
|
|
842
|
-
|
|
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
|
}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export namespace STANDARD_FUNCTIONS {
|
|
2
|
+
export { contextualResponseProtocol };
|
|
2
3
|
export { formProposalPolicy };
|
|
3
4
|
export { stageFormProposal };
|
|
4
5
|
export { nextFormProposal };
|
|
@@ -97,6 +98,7 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
97
98
|
export { invalidateFormInputs };
|
|
98
99
|
export { acceptFormReadings };
|
|
99
100
|
export { formInstanceApplies };
|
|
101
|
+
export { formParentResume };
|
|
100
102
|
export { closeFormInstance };
|
|
101
103
|
export { validateOTP };
|
|
102
104
|
export { validateDigits };
|
|
@@ -105,6 +107,7 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
105
107
|
export { urlToSpeech };
|
|
106
108
|
export { textWithUrlToSpeech };
|
|
107
109
|
}
|
|
110
|
+
import { contextualResponseProtocol } from './contextual-response.js';
|
|
108
111
|
import { formProposalPolicy } from './form-proposals.js';
|
|
109
112
|
import { stageFormProposal } from './form-proposals.js';
|
|
110
113
|
import { nextFormProposal } from './form-proposals.js';
|
|
@@ -205,6 +208,7 @@ import { rejectFormReadings } from './form-state.js';
|
|
|
205
208
|
import { invalidateFormInputs } from './form-state.js';
|
|
206
209
|
import { acceptFormReadings } from './form-state.js';
|
|
207
210
|
import { formInstanceApplies } from './form-state.js';
|
|
211
|
+
import { formParentResume } from './form-state.js';
|
|
208
212
|
import { closeFormInstance } from './form-state.js';
|
|
209
213
|
import { checkOtp } from './otp-check.js';
|
|
210
214
|
import { maskDestination } from './otp-check.js';
|
|
@@ -215,5 +219,5 @@ import { validatePhone } from './validators.js';
|
|
|
215
219
|
import { validateEmail } from './validators.js';
|
|
216
220
|
import { urlToSpeech } from './url-speech.js';
|
|
217
221
|
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 };
|
|
222
|
+
export { contextualResponseProtocol, 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
223
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAAyC,0BAA0B;mCAC2G,qBAAqB;kCAArB,qBAAqB;iCAArB,qBAAqB;qCAArB,qBAAqB;iCAArB,qBAAqB;mCAArB,qBAAqB;oCAArB,qBAAqB;6CAArB,qBAAqB;qCAC/E,wBAAwB;2CAAxB,wBAAwB;+CAAxB,wBAAwB;uCAAxB,wBAAwB;gCACpC,wBAAwB;8BAAxB,wBAAwB;gCAAxB,wBAAwB;oCAAxB,wBAAwB;wCAAxB,wBAAwB;gCAmB7C,YAAY;8BAAZ,YAAY;kCAAZ,YAAY;qCAAZ,YAAY;gCAlB/D,mBAAmB;8BAiBrB,qBAAqB;6BAEkG,aAAa;8BAAb,aAAa;yBAAb,aAAa;+BAAb,aAAa;+BAAb,aAAa;kCAAb,aAAa;+BAAb,aAAa;+BAAb,aAAa;2BAAb,aAAa;0BACT,cAAc;0BAAd,cAAc;uCAAd,cAAc;+BAAd,cAAc;sBAAd,cAAc;0BAAd,cAAc;iCAAd,cAAc;gCAAd,cAAc;sCAAd,cAAc;wCAC/H,cAAc;6BACP,cAAc;wBAAd,cAAc;wBAAd,cAAc;4BACjC,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;4BAUtD,mBAAmB;+BAAnB,mBAAmB;iCAAnB,mBAAmB;kCAC+nB,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;mCAAjB,iBAAiB;qCAAjB,iBAAiB;mCAAjB,iBAAiB;oCAAjB,iBAAiB;iCAAjB,iBAAiB;kCAAjB,iBAAiB;yBAC3pB,gBAAgB;gCAAhB,gBAAgB;4BAAhB,gBAAgB;8BAAhB,gBAAgB;+BACzB,iBAAiB;8BAAjB,iBAAiB;8BAAjB,iBAAiB;4BAC7B,iBAAiB;oCAAjB,iBAAiB"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { contextualResponseProtocol } from './contextual-response.js';
|
|
1
2
|
import { formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation } from './form-proposals.js';
|
|
2
3
|
import { formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor } from './proposal-contract.js';
|
|
3
4
|
import { clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome } from './form-conversation.js';
|
|
@@ -28,17 +29,18 @@ import { dateToWords } from './date-words.js';
|
|
|
28
29
|
import { amountToSpeech } from './amount-to-speech.js';
|
|
29
30
|
import { validateCardNumber, validateExpiration } from './card-checks.js';
|
|
30
31
|
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';
|
|
32
|
+
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
33
|
import { checkOtp, maskDestination, validateOTP, OTP_EXPIRY_MS } from './otp-check.js';
|
|
33
34
|
import { validateDigits, validatePhone, validateEmail } from './validators.js';
|
|
34
35
|
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, };
|
|
36
|
+
export { contextualResponseProtocol, 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
37
|
/** The functions flows call by name, ready to spread into a host's approved functions. */
|
|
37
38
|
export const STANDARD_FUNCTIONS = {
|
|
39
|
+
contextualResponseProtocol,
|
|
38
40
|
formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor,
|
|
39
41
|
clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome,
|
|
40
42
|
readMoneyAmount, isMoneyAmount, moneyIntentAllows, validateMoneyOptions, takeChoiceOffer, matchesChoice, isAnswer, isAgentRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice,
|
|
41
43
|
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,
|
|
44
|
+
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
45
|
validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech,
|
|
44
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"
|
|
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"}
|