jsfe 1.7.8 → 1.7.10
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 +2 -3
- package/dist/forms/authoring.d.ts +10 -0
- package/dist/forms/authoring.d.ts.map +1 -0
- package/dist/forms/authoring.js +110 -0
- package/dist/forms/choice-flow.d.ts +0 -4
- package/dist/forms/choice-flow.d.ts.map +1 -1
- package/dist/forms/choice-flow.js +10 -14
- package/dist/forms/continuation-safety.d.ts.map +1 -1
- package/dist/forms/continuation-safety.js +2 -1
- package/dist/forms/contracts.d.ts +8 -4
- package/dist/forms/contracts.d.ts.map +1 -1
- package/dist/forms/contracts.js +46 -23
- package/dist/forms/declaration-capture.d.ts +7 -0
- package/dist/forms/declaration-capture.d.ts.map +1 -0
- package/dist/forms/declaration-capture.js +15 -0
- package/dist/forms/declarations.d.ts +20 -0
- package/dist/forms/declarations.d.ts.map +1 -0
- package/dist/forms/declarations.js +272 -0
- package/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +47 -50
- package/dist/forms/identity-flows.js +8 -8
- package/dist/forms/index.d.ts +4 -0
- package/dist/forms/index.js +5 -1
- package/dist/forms/inspection.d.ts +12 -0
- package/dist/forms/inspection.d.ts.map +1 -0
- package/dist/forms/inspection.js +120 -0
- package/dist/forms/prompt-compiler.d.ts.map +1 -1
- package/dist/forms/prompt-compiler.js +5 -1
- package/dist/helpers/answer.d.ts +1 -1
- package/dist/helpers/answer.js +2 -2
- package/dist/helpers/contextual-response.d.ts +3 -0
- package/dist/helpers/contextual-response.d.ts.map +1 -1
- package/dist/helpers/contextual-response.js +7 -0
- package/dist/helpers/form-sources.js +1 -1
- package/dist/helpers/form-state.d.ts +1 -1
- package/dist/helpers/form-state.d.ts.map +1 -1
- package/dist/helpers/form-state.js +7 -5
- package/dist/helpers/index.d.ts +6 -5
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +4 -4
- package/dist/helpers/match-inputs.d.ts.map +1 -1
- package/dist/helpers/match-inputs.js +12 -40
- package/dist/helpers/money.d.ts +5 -3
- package/dist/helpers/money.d.ts.map +1 -1
- package/dist/helpers/money.js +25 -10
- package/dist/helpers/named-functions.d.ts +5 -0
- package/dist/helpers/named-functions.d.ts.map +1 -0
- package/dist/helpers/named-functions.js +54 -0
- package/dist/helpers/proposal-contract.js +4 -4
- package/dist/host/capabilities.d.ts.map +1 -1
- package/dist/host/capabilities.js +11 -3
- package/dist/host/registry-composition.d.ts.map +1 -1
- package/dist/host/registry-composition.js +9 -3
- package/dist/index.d.ts +15 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -51
- package/dist/runtime-identity.js +1 -1
- package/docs/copilot-reference.md +336 -66
- package/docs/development-release.md +16 -1
- package/package.json +1 -2
- package/dist/helpers/semantic-input-prompt.d.ts +0 -2
- package/dist/helpers/semantic-input-prompt.d.ts.map +0 -1
- package/dist/helpers/semantic-input-prompt.js +0 -153
- package/dist/helpers/semantic-input.d.ts +0 -28
- package/dist/helpers/semantic-input.d.ts.map +0 -1
- package/dist/helpers/semantic-input.js +0 -47
- package/docs/forms.md +0 -271
|
@@ -96,7 +96,7 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
|
|
|
96
96
|
set('identity_contact_allowed', 'contact_allowed', "!!cargo.callerId && !callerIsInternational(cargo) && !cargo.callerDeclined && contact_options.caller_on_file !== 'no'"),
|
|
97
97
|
set('identity_contact_prefill', 'contact_prefill', "String(acct_number || cell_number || email || (!contact_partial && contact_allowed && contact_options.caller_on_file === 'yes' ? cargo.callerId : ''))"),
|
|
98
98
|
effect('identity_contact_preselected', "(acct_number || cell_number || email ? true : (cargo.callerPreselected=!!(contact_prefill && contact_options.caller_on_file === 'yes')),true)"),
|
|
99
|
-
set('identity_contact_profiles', 'contact_profiles', "contact_profiles_base.map(function (field) {return field.name === 'account' ? Object.assign({},field,{profile:{kind:'identifier',pattern:contact_options.account_pattern || '(?!)'}}) : field;}).concat(contact_allowed ? [{name:'caller_decision',label:'caller ID choice',label_es:'opción del identificador de llamadas',profile:{kind:'choice',choices:[{key:'yes',
|
|
99
|
+
set('identity_contact_profiles', 'contact_profiles', "contact_profiles_base.map(function (field) {return field.name === 'account' ? Object.assign({},field,{profile:{kind:'identifier',pattern:contact_options.account_pattern || '(?!)'}}) : field;}).concat(contact_allowed ? [{name:'caller_decision',label:'caller ID choice',label_es:'opción del identificador de llamadas',profile:{kind:'choice',choices:[{key:'yes',phrases:['1','yes','si','sí'],exact:true},{key:'no',phrases:['no','nope','nah'],exact:true}]}}] : [])"),
|
|
100
100
|
set('identity_contact_keypad', 'contact_keypad', "(function () {var shapes=[{first:'23456789',lengths:[10]},{first:'1',lengths:[11]}].concat(contact_options.account_shape || []);if(contact_partial){var left=[];(contact_options.account_shape || []).forEach(function(s){(s.lengths || []).forEach(function(n){var rest=n-String(cargo.gcePartial).length;if(rest>0 && left.indexOf(rest)<0)left.push(rest);});});return {min:1,max:12,autoSubmitMs:3000,complete:[{first:'0123456789',lengths:left.sort(function(a,b){return a-b;})}]};}return {min:7,max:12,autoSubmitMs:3000,autoSubmitChars:contact_allowed?['1']:[],complete:shapes};})()"),
|
|
101
101
|
set('identity_contact_question', 'contact_question', expression(contactPrompt, 'cargo', 'contact_options', 'contact_allowed', 'contact_partial')),
|
|
102
102
|
set('identity_contact_question_es', 'contact_question_es', expression(contactPrompt, 'cargo', 'contact_options', 'contact_allowed', 'contact_partial', 'true')),
|
|
@@ -196,7 +196,7 @@ function otpPhoneUnavailable(value) {
|
|
|
196
196
|
return /\b(?:no longer|cannot|can't|dont|don't|do not)\s+(?:have(?:\s+access\s+to)?|access|use)\b[^.!?]{0,70}\b(?:phone|number|mobile|cellphone)\b/.test(text)
|
|
197
197
|
|| /\b(?:ya\s+no|no)\s+(?:tengo|puedo\s+(?:usar|acceder))\b[^.!?]{0,70}\b(?:telefono|numero|celular|movil)\b/.test(text);
|
|
198
198
|
}
|
|
199
|
-
const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a challenge response with explicit bounded retries, alternate-contact handling and tenant callbacks.', { variables: vars({
|
|
199
|
+
const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a challenge response with explicit bounded retries, alternate-contact handling and tenant callbacks.', { variables: vars({ otp_phrases: OTP_WORDS, no_code_given: false, wants_other_account: false, other_account_given: false, otp_validation_result: false, whatsapp_invite_sent: false, invite_text: '', otp_cancel: 'contact-support', answer_key: '', answer_value: '' }), contract: { role: 'gate', summary: 'Validate the active one-time challenge', tools: ['validate-otp', 'send-whatsapp-invite'], result: { path: 'cargo.otpVerified', type: 'boolean' } }, steps: [
|
|
200
200
|
set('otp_cancel', 'otp_cancel', "cargo.authCancelFlow || 'contact-support'"),
|
|
201
201
|
set('otp_reset_no_code', 'no_code_given', 'false'), set('otp_reset_invite', 'whatsapp_invite_sent', 'false'), set('otp_reset_callback', 'answer_key', "''"),
|
|
202
202
|
when('otp_tenant_code', 'cargo.authOptions && cargo.authOptions.code_validator && normalized_otp_code.length !== 6 && /[0-9]/.test(user_choice)', call('otp_tenant_code_call', '{{cargo.authOptions.code_validator}}', { answer: '{{user_choice}}' })),
|
|
@@ -264,15 +264,15 @@ export function emailReadback(address, voice, es = false) {
|
|
|
264
264
|
said = said.split('').join(' ').replace(/ @ /, es ? ' arroba ' : ' at ').replace(/ \. /g, es ? ' punto ' : ' dot ').replace(/ _ /g, es ? ' guion bajo ' : ' underscore ').replace(/ - /g, es ? ' guion ' : ' dash ');
|
|
265
265
|
return (es ? 'Tengo ' : 'I have ') + said + (es ? '. ¿Es correcto? ' : '. Is that right? ') + (es ? voice ? 'Presione 1 o diga' : 'Escriba' : voice ? 'Press 1 or say' : 'Type') + (es ? ' SÍ, o ' : ' YES, or ') + (es ? voice ? 'presione 2 o diga' : 'escriba' : voice ? 'press 2 or say' : 'type') + (es ? ' NO.' : ' NO.');
|
|
266
266
|
}
|
|
267
|
-
const email = worker('ask-email', 'AskEmail', 'Collect an email through shared FORM matching, retaining field-specific spelling and readback behavior.', { scope: 'isolated', parameters: [param('question', 'English email question'), param('question_es', 'Spanish email question'), param('on_file', 'Known email offered by OK'), param('attempt', 'Retry attempt'), param('why', 'invalid, retry or more'), param('confirm', 'Read back a caller-supplied known address'), param('parent_form', 'Owning task FORM instance'), param('email_state', 'Internal field protocol state', 'object')], variables: vars({ question: '', question_es: '', on_file: '', attempt: '', why: '', confirm: '', parent_form: '', email_state: null, email_question: '', email_question_es: '', email_raw: '', email_found: '', email_spelling: false, email_new: false, email_choice: '', email_readback: '', email_readback_es: '', email_choices: EMAIL_CHOICES, email_profiles_base: [{ name: 'email_address', label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' } }, raw], email_profiles: [], email_confirm_profiles: [{ name: 'decision', label: 'email confirmation', label_es: 'confirmación de correo', profile: { kind: 'choice', choices: [{ key: 'no',
|
|
267
|
+
const email = worker('ask-email', 'AskEmail', 'Collect an email through shared FORM matching, retaining field-specific spelling and readback behavior.', { scope: 'isolated', parameters: [param('question', 'English email question'), param('question_es', 'Spanish email question'), param('on_file', 'Known email offered by OK'), param('attempt', 'Retry attempt'), param('why', 'invalid, retry or more'), param('confirm', 'Read back a caller-supplied known address'), param('parent_form', 'Owning task FORM instance'), param('email_state', 'Internal field protocol state', 'object')], variables: vars({ question: '', question_es: '', on_file: '', attempt: '', why: '', confirm: '', parent_form: '', email_state: null, email_question: '', email_question_es: '', email_raw: '', email_found: '', email_spelling: false, email_new: false, email_choice: '', email_readback: '', email_readback_es: '', email_choices: EMAIL_CHOICES, email_profiles_base: [{ name: 'email_address', label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' } }, raw], email_profiles: [], email_confirm_profiles: [{ name: 'decision', label: 'email confirmation', label_es: 'confirmación de correo', profile: { kind: 'choice', choices: [{ key: 'no', phrases: ['2', 'no', 'wrong', 'incorrect', 'incorrecto'] }, { key: 'yes', phrases: ['1', 'yes', 'sí', 'si', 'correct', 'correcto'] }] } }, raw] }), contract: { role: 'collector', summary: 'Email field spelling and readback service', result: { path: 'cargo.email', type: 'string' } }, steps: [
|
|
268
268
|
set('email_protocol', 'email_state', "email_state || {question:question,question_es:question_es || question,on_file:on_file,confirm:confirm === true || confirm === 'true',attempt:Number(attempt || 0),why:why,draft:why === 'more'?String(cargo.emailDraft || ''):'',parent_form:parent_form}"),
|
|
269
|
-
set('email_profiles', 'email_profiles', "email_profiles_base.concat(email_state.on_file ? [{name:'known_email_choice',label:'email destination choice',label_es:'opción de destino del correo',profile:{kind:'choice',choices:[{key:'ok',
|
|
269
|
+
set('email_profiles', 'email_profiles', "email_profiles_base.concat(email_state.on_file ? [{name:'known_email_choice',label:'email destination choice',label_es:'opción de destino del correo',profile:{kind:'choice',choices:[{key:'ok',phrases:email_choices.ok},{key:'another',phrases:email_choices.another}]}}] : [])"),
|
|
270
270
|
set('email_question', 'email_question', "email_state.why === 'more' ? 'Got it. Go on.' : (email_state.attempt>0 ? email_state.why === 'retry' ? \"Okay, let's try again. \" : \"That doesn't look like an email address. \" : '')+email_state.question"),
|
|
271
271
|
set('email_question_es', 'email_question_es', "email_state.why === 'more' ? 'Entendido. Continúe.' : (email_state.attempt>0 ? email_state.why === 'retry' ? 'De acuerdo, intentemos de nuevo. ' : 'Eso no parece un correo electrónico. ' : '')+email_state.question_es"),
|
|
272
272
|
call('email_collect', 'collect-service-answer', { profiles: '{{email_profiles}}', question: '{{email_question}}', question_es: '{{email_question_es}}', keypad: { min: 1, max: 1 }, parent_form: '{{email_state.parent_form}}', context: 'email', context_es: 'correo' }),
|
|
273
273
|
set('email_raw', 'email_raw', 'String(cargo.serviceAnswer.raw || "")'),
|
|
274
274
|
cases('email_command', { "condition: isAgentRequest(email_raw)": call('email_agent', 'live-agent-requested', undefined, 'reboot'), "condition: isAnswer(email_raw,'exit')": call('email_exit', 'contact-support', { support_context: 'email', support_context_es: 'correo' }, 'reboot'), default: effect('email_is_answer', 'true') }),
|
|
275
|
-
set('email_choice', 'email_choice', "pickChoice(email_raw,[{key:'ok',
|
|
275
|
+
set('email_choice', 'email_choice', "pickChoice(email_raw,[{key:'ok',phrases:email_choices.ok},{key:'another',phrases:email_choices.another}],false)"),
|
|
276
276
|
when('email_other_request_clear', "!email_choice && !readEmail(email_raw) && isOtherRequest(email_raw,'email')", effect('email_other_request_draft', "(email_state.draft='',cargo.emailDraft='',cargo.email='',true)")),
|
|
277
277
|
when('email_other_request', "!email_choice && !readEmail(email_raw) && isOtherRequest(email_raw,'email')", { id: 'email_dispatch_request', type: 'DISPATCH' }),
|
|
278
278
|
set('email_parse', 'email_found', "(email_state.draft ? readEmail(email_state.draft+' '+email_raw) : '') || readEmail(email_raw) || (email_choice === 'ok' && email_state.on_file ? String(email_state.on_file).toLowerCase() : '')"),
|
|
@@ -282,9 +282,9 @@ const email = worker('ask-email', 'AskEmail', 'Collect an email through shared F
|
|
|
282
282
|
set('email_new', 'email_new', '!!email_found && (email_state.confirm || String(email_state.on_file || "").toLowerCase() !== email_found)'),
|
|
283
283
|
set('email_readback', 'email_readback', expression(emailReadback, 'email_found', 'cargo.voice')), set('email_readback_es', 'email_readback_es', expression(emailReadback, 'email_found', 'cargo.voice', 'true')),
|
|
284
284
|
when('email_verify_new', 'email_new', call('email_readback_collect', 'collect-service-answer', { profiles: '{{email_confirm_profiles}}', question: '{{email_readback}}', question_es: '{{email_readback_es}}', keypad: { min: 1, max: 1 }, parent_form: '{{email_state.parent_form}}', context: 'email', context_es: 'correo' })),
|
|
285
|
-
when('email_readback_other_clear', "email_new && isOtherRequest(cargo.serviceAnswer.raw,'email') && !pickChoice(cargo.serviceAnswer.raw,[{key:'yes',
|
|
286
|
-
when('email_readback_other', "email_new && isOtherRequest(cargo.serviceAnswer.raw,'email') && !pickChoice(cargo.serviceAnswer.raw,[{key:'yes',
|
|
287
|
-
when('email_readback_wrong', "email_new && pickChoice(cargo.serviceAnswer.raw,[{key:'no',
|
|
285
|
+
when('email_readback_other_clear', "email_new && isOtherRequest(cargo.serviceAnswer.raw,'email') && !pickChoice(cargo.serviceAnswer.raw,[{key:'yes',phrases:['1','yes','sí','si','correct','correcto']},{key:'no',phrases:['2','no','wrong','incorrect','incorrecto']}],false)", effect('email_readback_other_draft', "(email_state.draft='',cargo.emailDraft='',cargo.email='',true)")),
|
|
286
|
+
when('email_readback_other', "email_new && isOtherRequest(cargo.serviceAnswer.raw,'email') && !pickChoice(cargo.serviceAnswer.raw,[{key:'yes',phrases:['1','yes','sí','si','correct','correcto']},{key:'no',phrases:['2','no','wrong','incorrect','incorrecto']}],false)", { id: 'email_readback_dispatch', type: 'DISPATCH' }),
|
|
287
|
+
when('email_readback_wrong', "email_new && pickChoice(cargo.serviceAnswer.raw,[{key:'no',phrases:['2','no','wrong','incorrect','incorrecto']},{key:'yes',phrases:['1','yes','sí','si','correct','correcto']}],false) !== 'yes'", set('email_rejected', 'email_found', "''")),
|
|
288
288
|
when('email_got_address', '!!email_found', effect('email_store', "(cargo.email=email_found,cargo.emailDraft='',true)")), when('email_return_address', '!!email_found', end('email_complete')),
|
|
289
289
|
when('email_other_address', "email_choice === 'another' && !!email_state.on_file", effect('email_change_offer', "(email_state.question='What email address should I send it to?',email_state.question_es='¿A qué correo electrónico se lo envío?',email_state.on_file='',email_state.confirm=false,email_state.attempt=-1,true)")),
|
|
290
290
|
effect('email_retry_state', "(email_state.attempt+=1,email_state.why=email_new?'retry':'invalid',email_state.draft='',cargo.emailDraft='',true)"),
|
package/dist/forms/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export const FLOWS: any[];
|
|
2
2
|
export { FLOWS as IDENTITY_FLOWS } from "./identity-flows.js";
|
|
3
3
|
export { compileFormPrompts } from "./prompt-compiler.js";
|
|
4
|
+
export { explainSession } from "./inspection.js";
|
|
5
|
+
export { inheritFlowDeclaration } from "./declaration-capture.js";
|
|
4
6
|
export { withSafetyRevision, CONTINUATION_SAFETY_REQUIREMENT } from "./continuation-safety.js";
|
|
5
7
|
export { FIELD_PRESETS, formFlow, declinedFlow, textValue } from "./flows.js";
|
|
6
8
|
export { linkFormSchemas, defineWorker, defineProvider, defineForm, definePerformer, validateFlowContracts, operationWorkers, providerQuestions, providerParameter } from "./contracts.js";
|
|
7
9
|
export { addressDraft, zipLocation, streetLocation, resolvedAddress } from "../helpers/address.js";
|
|
10
|
+
export { Form, Provider, Performer, Worker, compileExpression } from "./authoring.js";
|
|
11
|
+
export { compileFlowDeclarations, serializeFlowDeclaration, captureOriginalDeclaration } from "./declarations.js";
|
|
8
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/forms/index.js
CHANGED
|
@@ -4,9 +4,13 @@ import { FLOWS as ADDRESS_FLOWS } from './address-flows.js';
|
|
|
4
4
|
import { FLOWS as FORM_FLOWS } from './flows.js';
|
|
5
5
|
import { FLOWS as CHOICE_FLOWS } from './choice-flow.js';
|
|
6
6
|
import { FLOWS as IDENTITY } from './identity-flows.js';
|
|
7
|
-
export const FLOWS = [...FORM_FLOWS, ...ADDRESS_FLOWS, ...CHOICE_FLOWS, ...IDENTITY].map(flow => withSafetyRevision(flow, '
|
|
7
|
+
export const FLOWS = [...FORM_FLOWS, ...ADDRESS_FLOWS, ...CHOICE_FLOWS, ...IDENTITY].map(flow => withSafetyRevision(flow, 'dispatch-intake-2026-10-22'));
|
|
8
8
|
export { FIELD_PRESETS, formFlow, declinedFlow, textValue } from './flows.js';
|
|
9
9
|
export { FLOWS as IDENTITY_FLOWS } from './identity-flows.js';
|
|
10
10
|
export { linkFormSchemas, defineWorker, defineProvider, defineForm, definePerformer, validateFlowContracts, operationWorkers, providerQuestions, providerParameter } from './contracts.js';
|
|
11
11
|
export { compileFormPrompts } from './prompt-compiler.js';
|
|
12
12
|
export { addressDraft, zipLocation, streetLocation, resolvedAddress } from '../helpers/address.js';
|
|
13
|
+
export { explainSession } from './inspection.js';
|
|
14
|
+
export { Form, Provider, Performer, Worker, compileExpression } from './authoring.js';
|
|
15
|
+
export { compileFlowDeclarations, serializeFlowDeclaration, captureOriginalDeclaration } from './declarations.js';
|
|
16
|
+
export { inheritFlowDeclaration } from './declaration-capture.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Explain existing state; this neither authorizes an action nor records an event history.
|
|
2
|
+
* Values, request bodies, caller words and rendered questions are intentionally omitted.
|
|
3
|
+
* `previous` adds only observable field changes and invalidated confirmations; it cannot
|
|
4
|
+
* reconstruct intermediate events between the two snapshots.
|
|
5
|
+
*/
|
|
6
|
+
export function explainSession(session: any, { flows, previous }?: {
|
|
7
|
+
flows?: never[] | undefined;
|
|
8
|
+
}): {
|
|
9
|
+
status: string;
|
|
10
|
+
entries: any[];
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=inspection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../../src/forms/inspection.js"],"names":[],"mappings":"AAOA;;;;GAIG;AACH;;;;;EAkFC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { nextFormInput, formValuesEqual } from '../helpers/form-state.js';
|
|
2
|
+
import { actionConfirmationValid } from '../helpers/form-actions.js';
|
|
3
|
+
const components = { collector: 'Form', provider: 'Provider', performer: 'Performer', worker: 'Worker', gate: 'Worker', router: 'Worker' };
|
|
4
|
+
const object = value => value && typeof value === 'object' && !Array.isArray(value);
|
|
5
|
+
const framesOf = session => (Array.isArray(session?.flowStacks) ? session.flowStacks : []).flat().filter(object);
|
|
6
|
+
/** Explain existing state; this neither authorizes an action nor records an event history.
|
|
7
|
+
* Values, request bodies, caller words and rendered questions are intentionally omitted.
|
|
8
|
+
* `previous` adds only observable field changes and invalidated confirmations; it cannot
|
|
9
|
+
* reconstruct intermediate events between the two snapshots.
|
|
10
|
+
*/
|
|
11
|
+
export function explainSession(session, { flows = [], previous } = {}) {
|
|
12
|
+
if (!object(session))
|
|
13
|
+
throw new TypeError('explainSession requires a session snapshot');
|
|
14
|
+
if (!Array.isArray(flows))
|
|
15
|
+
throw new TypeError('explainSession flows must be an array');
|
|
16
|
+
const registry = new Map(flows.filter(object).map(flow => [flow.id, flow]));
|
|
17
|
+
const cargo = object(session.cargo) ? session.cargo : {};
|
|
18
|
+
const forms = object(cargo.forms) ? cargo.forms : {};
|
|
19
|
+
const frames = framesOf(session), entries = [];
|
|
20
|
+
const activeIds = new Set(frames.flatMap(frame => [frame.variables?.form_instance, frame.variables?.form, frame.variables?.rf_form]).filter(id => typeof id === 'string'));
|
|
21
|
+
let held = !!session.continuationSafetyHold, uncertain = false, collecting = false, confirming = false;
|
|
22
|
+
const entry = (kind, message, source = {}) => entries.push({ kind, message, component: components[registry.get(source.flowId)?.variables?.contract?.value?.role] || 'Unknown', ...source });
|
|
23
|
+
const actions = new Map();
|
|
24
|
+
const action = (record, source) => {
|
|
25
|
+
if (!object(record))
|
|
26
|
+
return;
|
|
27
|
+
const identity = record.key || record;
|
|
28
|
+
const priority = ['attempted', 'unknown'].includes(record.status) || record.result?.status === 'unknown' ? 3 : record.status === 'completed' ? 2 : record.status === 'prepared' ? 1 : 0;
|
|
29
|
+
if (priority === 3)
|
|
30
|
+
held = true;
|
|
31
|
+
const previous = actions.get(identity);
|
|
32
|
+
// A duplicate key is not proof that both sources agree. Keep its most conservative
|
|
33
|
+
// evidence independently of traversal order, including journal/form contradictions.
|
|
34
|
+
if (priority && (!previous || priority > previous.priority))
|
|
35
|
+
actions.set(identity, { priority, source: source.flowId ? source : previous?.source || source });
|
|
36
|
+
};
|
|
37
|
+
if (session.continuationSafetyHold)
|
|
38
|
+
entry('continuation_held', 'An earlier action or incompatible continuation requires review before continuing.');
|
|
39
|
+
for (const [id, state] of Object.entries(forms)) {
|
|
40
|
+
if (!object(state)) {
|
|
41
|
+
uncertain = true;
|
|
42
|
+
entry('unavailable', 'This form state cannot be inspected.', { form: id });
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const source = { flowId: state.definition, form: id }, active = activeIds.has(id), before = previous?.cargo?.forms?.[id];
|
|
46
|
+
if (object(before)) {
|
|
47
|
+
const names = new Set([...Object.keys(before.values || {}), ...Object.keys(state.values || {})]);
|
|
48
|
+
for (const input of names)
|
|
49
|
+
if (!formValuesEqual(before.values?.[input], state.values?.[input]))
|
|
50
|
+
entry('input_changed', 'The field changed; its current value is withheld from the explanation.', { ...source, input });
|
|
51
|
+
if (before.confirmation && !formValuesEqual(before.confirmation, state.confirmation))
|
|
52
|
+
entry(state.confirmation ? 'confirmation_changed' : 'confirmation_invalidated', state.confirmation ? 'A different confirmation is now recorded; it must match the current proposal.' : 'The earlier confirmation no longer applies. A fresh confirmation is required for the revised proposal.', source);
|
|
53
|
+
}
|
|
54
|
+
let next;
|
|
55
|
+
try {
|
|
56
|
+
if (!Array.isArray(state.specs) || !object(state.values))
|
|
57
|
+
throw new TypeError('Incomplete snapshot');
|
|
58
|
+
next = nextFormInput(state, cargo);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
uncertain = true;
|
|
62
|
+
entry('unavailable', 'Required input state cannot be determined from this snapshot.', source);
|
|
63
|
+
}
|
|
64
|
+
if (next) {
|
|
65
|
+
const blocked = next === '__blocked__';
|
|
66
|
+
entry(blocked ? 'input_blocked' : 'input_missing', blocked ? 'Required inputs are waiting on their prerequisites.' : active ? 'Collecting this required input.' : 'This saved form still needs this input.', { ...source, ...(!blocked ? { input: next } : {}), active });
|
|
67
|
+
if (active)
|
|
68
|
+
collecting = true;
|
|
69
|
+
}
|
|
70
|
+
const proposal = state.proposal;
|
|
71
|
+
if (proposal?.status === 'prepared' && next === '') {
|
|
72
|
+
const valid = actionConfirmationValid(cargo, id, proposal);
|
|
73
|
+
entry(valid ? 'confirmation_recorded' : 'confirmation_needed', valid ? 'Confirmation matches the current proposal; other execution guards still apply.' : 'Waiting for confirmation of the current proposal.', { ...source, active });
|
|
74
|
+
if (active && !valid)
|
|
75
|
+
confirming = true;
|
|
76
|
+
}
|
|
77
|
+
else if (state.confirmation && next) {
|
|
78
|
+
entry('confirmation_stale', 'A recorded confirmation cannot authorize an incomplete form.', source);
|
|
79
|
+
}
|
|
80
|
+
action(state.proposal, source);
|
|
81
|
+
for (const record of Object.values(state.actions || {}))
|
|
82
|
+
action(record, source);
|
|
83
|
+
for (const [input, proposal] of Object.entries(state.inputProposals || {}))
|
|
84
|
+
if (proposal && !proposal.committed && proposal.status === 'pending') {
|
|
85
|
+
entry('input_confirmation_needed', 'A proposed field value is waiting for confirmation.', { ...source, input, active });
|
|
86
|
+
if (active)
|
|
87
|
+
confirming = true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
for (const record of Object.values(cargo.actionJournal || {}))
|
|
91
|
+
action(record, {});
|
|
92
|
+
for (const { priority, source } of actions.values()) {
|
|
93
|
+
if (priority === 3)
|
|
94
|
+
entry('action_held', 'An action has been attempted and its result is not confirmed. Automatic repetition is blocked.', source);
|
|
95
|
+
else if (priority === 2)
|
|
96
|
+
entry('action_completed', 'An action attempt has a recorded result. This does not authorize another attempt.', source);
|
|
97
|
+
else
|
|
98
|
+
entry('action_prepared', 'An action proposal is prepared; execution still requires its guards.', source);
|
|
99
|
+
}
|
|
100
|
+
// Completed forms may already be cleared. The generic last result remains evidence of
|
|
101
|
+
// its recorded outcome, but carries no authority or reliable component identity by itself.
|
|
102
|
+
const lastResult = cargo.actionResult;
|
|
103
|
+
const resultMessages = { ok: 'The most recent action result is recorded as successful.', failed: 'The most recent action result is recorded as failed.', unknown: 'The most recent action result is unconfirmed; consult the current action hold.', not_applicable: 'The most recent performer recorded that no action was applicable.' };
|
|
104
|
+
if (object(lastResult) && Object.hasOwn(resultMessages, lastResult.status))
|
|
105
|
+
entry('action_result', resultMessages[lastResult.status]);
|
|
106
|
+
const handoff = session.lastTurnDispatch;
|
|
107
|
+
const handedOff = handoff?.matchedFlow === null && frames.length === 0;
|
|
108
|
+
if (handedOff)
|
|
109
|
+
entry('handoff', 'DISPATCH yielded this turn to the host for contextual interpretation.', { flowId: registry.has(handoff.fromFlow) ? handoff.fromFlow : [...registry.values()].find(flow => flow.name === handoff.fromFlow)?.id });
|
|
110
|
+
const current = frames.at(-1);
|
|
111
|
+
if (current) {
|
|
112
|
+
const step = current.flowStepsStack?.at(-1);
|
|
113
|
+
const reversed = [...frames].reverse();
|
|
114
|
+
const author = reversed.find(frame => ['Form', 'Provider', 'Performer'].includes(registry.get(frame.flowId)?.metadata?.authoring?.component))
|
|
115
|
+
|| reversed.find(frame => registry.get(frame.flowId)?.metadata?.authoring?.component)
|
|
116
|
+
|| reversed.find(frame => { const definition = registry.get(frame.flowId); const role = definition?.variables?.contract?.value?.role; return ['provider', 'performer'].includes(role) || role === 'collector' && (definition?.primary || definition?.metadata?.formProtocol === 2); }) || current;
|
|
117
|
+
entry('current_step', 'Current execution location.', { flowId: author.flowId, ...(current.flowId !== author.flowId ? { workerFlowId: current.flowId } : {}), ...(step?.id ? { step: step.id } : {}) });
|
|
118
|
+
}
|
|
119
|
+
return { status: held ? 'held' : uncertain ? 'unknown' : handedOff ? 'handed_off' : confirming ? 'confirmation' : collecting ? 'collecting' : frames.length ? 'active' : 'idle', entries };
|
|
120
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-compiler.d.ts","sourceRoot":"","sources":["../../src/forms/prompt-compiler.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt-compiler.d.ts","sourceRoot":"","sources":["../../src/forms/prompt-compiler.js"],"names":[],"mappings":"AACA,yFAAyF;AACzF,sDAyBC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { inheritFlowDeclaration } from './declaration-capture.js';
|
|
1
2
|
/** Compile contextual field prompts into workers; source declarations stay immutable. */
|
|
2
3
|
export function compileFormPrompts(forms) {
|
|
3
4
|
const workers = [];
|
|
4
5
|
const flows = forms.map(source => {
|
|
5
|
-
const flow = structuredClone(source);
|
|
6
|
+
const flow = inheritFlowDeclaration(source, structuredClone(source));
|
|
6
7
|
const visit = input => {
|
|
7
8
|
if (input.any_of) {
|
|
8
9
|
input.any_of.forEach(visit);
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
12
|
+
if (input.question_from)
|
|
13
|
+
return;
|
|
11
14
|
if (!String(input.question || '').includes('{{') && !String(input.question_es || '').includes('{{'))
|
|
12
15
|
return;
|
|
13
16
|
const id = flow.id + '-' + input.name + '-question';
|
|
@@ -18,6 +21,7 @@ export function compileFormPrompts(forms) {
|
|
|
18
21
|
set('en', 'en', literal(input.question || '')), set('es', 'es', literal(input.question_es || input.question || '')),
|
|
19
22
|
set('store', 'noop', `(cargo.forms[form].data=Object.assign({},cargo.forms[form].data,{${JSON.stringify(input.name + '_question')}:en,${JSON.stringify(input.name + '_question_es')}:es}),true)`)];
|
|
20
23
|
workers.push({ id, name: flow.name + input.name + 'Question', version: '1.0.0', scope: 'isolated', description: 'Render the declared field question in its owning form context.',
|
|
24
|
+
...(flow.metadata?.declaration ? { metadata: { declaration: { ...flow.metadata.declaration } } } : {}),
|
|
21
25
|
parameters: [{ name: 'form', type: 'string' }, { name: 'input', type: 'string' }],
|
|
22
26
|
variables: { data: { type: 'object', value: null }, en: { type: 'string', value: '' }, es: { type: 'string', value: '' }, contract: { type: 'object', value: { version: 1, role: 'worker', summary: 'Render a contextual form prompt', parametersFrom: 'parameters', result: { path: 'cargo.forms[form].data', type: 'object' } } } }, steps });
|
|
23
27
|
input.prepare = id;
|
package/dist/helpers/answer.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export function numericAmountReading(input: any): {
|
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* ask-choice's matcher: the key of the choice the answer picks, '__agent', '__exit', or '' (no choice).
|
|
38
|
-
* choices: [{ key,
|
|
38
|
+
* choices: [{ key, phrases, negative?, neutral?, exact? }]. A key (digit, * or #) and a YES word pick a choice only as the whole
|
|
39
39
|
* answer, courtesy aside (onlyAffirmative); an `exact` choice (one that charges or cancels) treats ALL its words that way. A choice keyed 'yes' also takes ANSWER_WORDS.yes (CONFIRM_WORDS when `exact`) and, when not `exact`, a bare thanks (THANKS), and the NO-type
|
|
40
40
|
* choice (key no / decline / done / cancel, or negative: true) also takes ANSWER_WORDS.no, so callers list only their
|
|
41
41
|
* extras. A word after a negation in its clause is negated: it picks the NO-type choice; a `neutral` choice still
|
package/dist/helpers/answer.js
CHANGED
|
@@ -346,7 +346,7 @@ function spokenKeys(b) {
|
|
|
346
346
|
}
|
|
347
347
|
/**
|
|
348
348
|
* ask-choice's matcher: the key of the choice the answer picks, '__agent', '__exit', or '' (no choice).
|
|
349
|
-
* choices: [{ key,
|
|
349
|
+
* choices: [{ key, phrases, negative?, neutral?, exact? }]. A key (digit, * or #) and a YES word pick a choice only as the whole
|
|
350
350
|
* answer, courtesy aside (onlyAffirmative); an `exact` choice (one that charges or cancels) treats ALL its words that way. A choice keyed 'yes' also takes ANSWER_WORDS.yes (CONFIRM_WORDS when `exact`) and, when not `exact`, a bare thanks (THANKS), and the NO-type
|
|
351
351
|
* choice (key no / decline / done / cancel, or negative: true) also takes ANSWER_WORDS.no, so callers list only their
|
|
352
352
|
* extras. A word after a negation in its clause is negated: it picks the NO-type choice; a `neutral` choice still
|
|
@@ -397,7 +397,7 @@ export function pickChoice(answer, choices, acceptOther) {
|
|
|
397
397
|
let blocked = false;
|
|
398
398
|
let found = '';
|
|
399
399
|
for (const c of cs) {
|
|
400
|
-
const own = Array.isArray(c.words) ? c.words : [];
|
|
400
|
+
const own = Array.isArray(c.phrases) ? c.phrases : Array.isArray(c.words) ? c.words : [];
|
|
401
401
|
const all = c.key === 'yes' ? [...own, ...(c.exact === true ? CONFIRM_WORDS : ANSWER_WORDS.yes)] : (c.key === noChoice ? [...own, ...ANSWER_WORDS.no] : own);
|
|
402
402
|
// Strict words pick this choice only when they are the whole answer (onlyAffirmative): a key, a YES word, or — on an
|
|
403
403
|
// `exact` choice (one that charges or cancels) — every word. The rest (named actions: LINK, RECEIPT…) match inside it.
|
|
@@ -4,7 +4,10 @@ export function validateContextualResponseStep(step: any, flow: any): {
|
|
|
4
4
|
variable: any;
|
|
5
5
|
} | null | undefined;
|
|
6
6
|
export function contextualResponseRuntimeSteps(id: any, steps: any, requirements?: any[]): any;
|
|
7
|
+
/** A normal extraction description for an open-ended FORM answer, using contextual DISPATCH. */
|
|
8
|
+
export function validateFormResponse(response: any): any;
|
|
7
9
|
/** Explicit typed contextual responses. No engine state, transport, or host permissions. */
|
|
8
10
|
export const CONTEXTUAL_RESPONSES_REQUIREMENT: "jsfe:contextual-responses:v1";
|
|
9
11
|
export function contextualResponseProtocol(): number;
|
|
12
|
+
export function hasFormResponse(inputs: any): any;
|
|
10
13
|
//# sourceMappingURL=contextual-response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextual-response.d.ts","sourceRoot":"","sources":["../../src/helpers/contextual-response.js"],"names":[],"mappings":"AAMA,2GAA2G;AAC3G;;;qBAiBC;AACD,+FAIC;
|
|
1
|
+
{"version":3,"file":"contextual-response.d.ts","sourceRoot":"","sources":["../../src/helpers/contextual-response.js"],"names":[],"mappings":"AAMA,2GAA2G;AAC3G;;;qBAiBC;AACD,+FAIC;AAED,gGAAgG;AAChG,yDAGC;AAnCD,4FAA4F;AAC5F,+CAAgD,8BAA8B,CAAC;AACxE,qDAA0C;AAkC1C,kDAA8J"}
|
|
@@ -46,3 +46,10 @@ export function contextualResponseRuntimeSteps(id, steps, requirements = []) {
|
|
|
46
46
|
const guard = { id: id + '_contextual_response_protocol', type: 'SET', variable: 'noop', value: 'contextualResponseProtocol() === 1', requireTrue: true };
|
|
47
47
|
return steps[0]?.type === 'SET' && steps[0]?.value === guard.value && steps[0]?.requireTrue === true ? steps : [guard, ...steps];
|
|
48
48
|
}
|
|
49
|
+
/** A normal extraction description for an open-ended FORM answer, using contextual DISPATCH. */
|
|
50
|
+
export function validateFormResponse(response) {
|
|
51
|
+
if (!response || typeof response !== 'object' || Array.isArray(response) || Object.keys(response).some(k => k !== 'description') || typeof response.description !== 'string' || !response.description.trim())
|
|
52
|
+
fail('FORM response requires a nonempty description only');
|
|
53
|
+
return structuredClone(response);
|
|
54
|
+
}
|
|
55
|
+
export const hasFormResponse = inputs => (inputs || []).some(input => input.response !== undefined || hasFormResponse(input.any_of) || hasFormResponse(input.schema?.inputs));
|
|
@@ -40,7 +40,7 @@ export function completeSourceRefresh(cargo, source, now = Date.now()) {
|
|
|
40
40
|
/** Prefer the most specific positively matched catalog phrase over a contained broad fact alias.
|
|
41
41
|
* Ordinary menu actions retain their own exact-choice rules. No match returns no fact. */
|
|
42
42
|
export function pickProviderQuestion(answer, questions = []) {
|
|
43
|
-
const matches = questions.flatMap((question, index) => (question.words
|
|
43
|
+
const matches = questions.flatMap((question, index) => (question.phrases ?? question.words ?? []).flatMap(word => pickChoice(answer, [{ ...question, phrases: [word] }], false) === question.key
|
|
44
44
|
? [{ key: question.key, length: String(word).normalize('NFD').replace(/[\u0300-\u036f]/g, '').trim().length, index }] : []));
|
|
45
45
|
matches.sort((a, b) => b.length - a.length || a.index - b.index);
|
|
46
46
|
return matches[0]?.key || '';
|
|
@@ -83,7 +83,7 @@ export function formPreparation(cargo: any, id: any, input: any): {
|
|
|
83
83
|
export function queueFormReadings(cargo: any, hits?: any[]): boolean;
|
|
84
84
|
export function pendingFormReadings(cargo: any, id: any): any[];
|
|
85
85
|
export function formWorkLimit(cargo: any, id: any): number;
|
|
86
|
-
export function applyFormValidation(cargo: any, id: any, result: any): "
|
|
86
|
+
export function applyFormValidation(cargo: any, id: any, result: any): "failed" | "valid" | "retry";
|
|
87
87
|
/** Invalidation is transitive and independent of declaration order. */
|
|
88
88
|
export function invalidateFormInputs(cargo: any, id: any, changed: any, preserve?: any[], preserveNodes?: any[]): any[];
|
|
89
89
|
/** An intentional retry resets the named inputs as well as all of their dependent state. Unknown actions stay held. */
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"form-state.d.ts","sourceRoot":"","sources":["../../src/helpers/form-state.js"],"names":[],"mappings":"AAQA,qDAKC;AAED,oDAEC;AAED,qFAAqF;AACrF,oEA6BC;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;AAoCD,qFAYC;AACD,oGAqCC;AACD;;;SAKC;AACD,qEAGC;AACD,gEAgBC;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;AAhoBM,8CAAmE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validateFormResponse } from './contextual-response.js';
|
|
2
2
|
import { validateFormProposalPolicy } from './proposal-contract.js';
|
|
3
3
|
/** Shared FORM semantics. Pure readers plus explicit mutations of the supplied session container; no host I/O. */
|
|
4
4
|
import { readInputProfile } from './match-inputs.js';
|
|
@@ -37,10 +37,12 @@ export function resolveFormInputs(inputs, presets = {}) {
|
|
|
37
37
|
validateMoneyOptions(input.profile.money);
|
|
38
38
|
}
|
|
39
39
|
validateFormExhaustion(input.on_exhausted);
|
|
40
|
-
if (input.meaning !== undefined)
|
|
40
|
+
if (input.meaning !== undefined)
|
|
41
|
+
throw new Error('FORM meaning is retired; use a contextual response description');
|
|
42
|
+
if (input.response !== undefined) {
|
|
41
43
|
if (!input.profile || input.form || input.any_of || input.bind)
|
|
42
|
-
throw new Error('FORM
|
|
43
|
-
|
|
44
|
+
throw new Error('FORM response requires a readable leaf input');
|
|
45
|
+
validateFormResponse(input.response);
|
|
44
46
|
}
|
|
45
47
|
if (input.proposal !== undefined) {
|
|
46
48
|
if (!input.profile || input.form || input.any_of || input.bind)
|
|
@@ -204,7 +206,7 @@ export function enrichFormMatches(matches, chain, form, names = [], asked = '')
|
|
|
204
206
|
const enrich = h => {
|
|
205
207
|
const spec = chain.find(c => c.form === h.form && c.name === h.name) || {};
|
|
206
208
|
return { ...h, label: h.option_label || spec.label || h.name, label_es: h.option_label_es || spec.label_es || spec.label || h.name,
|
|
207
|
-
validator: spec.validator || '', ...(spec.
|
|
209
|
+
validator: spec.validator || '', ...(spec.response ? { response: spec.response } : {}), after: spec.after || '', validate_always: spec.validate_always === true, ...(spec.activation ? { activation: spec.activation } : {}), pii: spec.pii === true, current: h.form === form && names.includes(h.name), asked };
|
|
208
210
|
};
|
|
209
211
|
return { ...matches, hits: matches.hits.map(enrich), ambiguous: matches.ambiguous.map(enrich), remaining: (matches.remaining || []).map(group => group.map(enrich)) };
|
|
210
212
|
}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
export { compileNamedFunctions } from "./named-functions.js";
|
|
1
2
|
export namespace STANDARD_FUNCTIONS {
|
|
2
3
|
export { continuationSafetyProtocol };
|
|
3
|
-
export { semanticInputValidationProtocol };
|
|
4
|
-
export { validateInputMeaning };
|
|
5
4
|
export { cancelFormTask };
|
|
6
5
|
export { contextualResponseProtocol };
|
|
6
|
+
export { validateFormResponse };
|
|
7
|
+
export { hasFormResponse };
|
|
7
8
|
export { formProposalPolicy };
|
|
8
9
|
export { stageFormProposal };
|
|
9
10
|
export { nextFormProposal };
|
|
@@ -114,10 +115,10 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
114
115
|
export { textWithUrlToSpeech };
|
|
115
116
|
}
|
|
116
117
|
import { continuationSafetyProtocol } from '../forms/continuation-safety.js';
|
|
117
|
-
import { semanticInputValidationProtocol } from './semantic-input.js';
|
|
118
|
-
import { validateInputMeaning } from './semantic-input.js';
|
|
119
118
|
import { cancelFormTask } from './form-conversation.js';
|
|
120
119
|
import { contextualResponseProtocol } from './contextual-response.js';
|
|
120
|
+
import { validateFormResponse } from './contextual-response.js';
|
|
121
|
+
import { hasFormResponse } from './contextual-response.js';
|
|
121
122
|
import { formProposalPolicy } from './form-proposals.js';
|
|
122
123
|
import { stageFormProposal } from './form-proposals.js';
|
|
123
124
|
import { nextFormProposal } from './form-proposals.js';
|
|
@@ -231,5 +232,5 @@ import { validatePhone } from './validators.js';
|
|
|
231
232
|
import { validateEmail } from './validators.js';
|
|
232
233
|
import { urlToSpeech } from './url-speech.js';
|
|
233
234
|
import { textWithUrlToSpeech } from './url-speech.js';
|
|
234
|
-
export { continuationSafetyProtocol,
|
|
235
|
+
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, 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 };
|
|
235
236
|
//# 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;+BAI6C,wBAAwB;2CAHjE,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;gCACrB,wBAAwB;8BAAxB,wBAAwB;gCAAxB,wBAAwB;oCAAxB,wBAAwB;wCAAxB,wBAAwB;gCAmBhB,YAAY;8BAAZ,YAAY;kCAAZ,YAAY;uCAAZ,YAAY;qCAAZ,YAAY;qCAAZ,YAAY;gCAlB3G,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,6 +1,6 @@
|
|
|
1
|
+
export { compileNamedFunctions } from './named-functions.js';
|
|
1
2
|
import { continuationSafetyProtocol } from '../forms/continuation-safety.js';
|
|
2
|
-
import {
|
|
3
|
-
import { contextualResponseProtocol } from './contextual-response.js';
|
|
3
|
+
import { contextualResponseProtocol, validateFormResponse, hasFormResponse } from './contextual-response.js';
|
|
4
4
|
import { formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation } from './form-proposals.js';
|
|
5
5
|
import { formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor } from './proposal-contract.js';
|
|
6
6
|
import { cancelFormTask, clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome } from './form-conversation.js';
|
|
@@ -35,10 +35,10 @@ import { resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, fo
|
|
|
35
35
|
import { checkOtp, maskDestination, validateOTP, OTP_EXPIRY_MS } from './otp-check.js';
|
|
36
36
|
import { validateDigits, validatePhone, validateEmail } from './validators.js';
|
|
37
37
|
import { urlToSpeech, textWithUrlToSpeech } from './url-speech.js';
|
|
38
|
-
export { continuationSafetyProtocol,
|
|
38
|
+
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, 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, };
|
|
39
39
|
/** The functions flows call by name, ready to spread into a host's approved functions. */
|
|
40
40
|
export const STANDARD_FUNCTIONS = {
|
|
41
|
-
continuationSafetyProtocol,
|
|
41
|
+
continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse,
|
|
42
42
|
formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor,
|
|
43
43
|
clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome,
|
|
44
44
|
readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, matchesChoice, isAnswer, isAgentRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice,
|
|
@@ -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":"AAoFA;;;GAGG;AACH,sFAgGC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;mHACmH;AACnH;;;;;EAeC;AACD;;;;;;EAkHC"}
|