jsfe 1.7.1 → 1.7.2

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 CHANGED
@@ -769,6 +769,11 @@ return aiResponse;
769
769
  is already repaired: the next turn starts with fresh intent detection. Log or record the error;
770
770
  no rollback is needed. A deliberate `RETURN ''` (which ends every flow) is not flagged.
771
771
 
772
+ Native FORM collection in 1.7.2 acknowledges an unreadable answer once, then yields the current
773
+ utterance while retaining its draft. Explicit recovery metadata distinguishes resumption, required
774
+ restart, unknown-action hold and no promised recovery; business completion remains independent.
775
+ See the [retry/yield/recovery contract](docs/forms.md#retry-yield-and-recovery-contract-172).
776
+
772
777
  ### Host Responsibilities: Tool Calls, Cancellation and Concurrency
773
778
 
774
779
  A flow can take actions in the outside world through `CALL-TOOL` — charge a card, send an SMS,
@@ -114,7 +114,7 @@ export function definePerformer({ performs, contract, prepare, present, project
114
114
  call('prepare', prepare, { form: '{{form_instance}}' }),
115
115
  set('request', 'pf_request', 'cargo.actionRequest'),
116
116
  set('select', 'pf_action', 'selectFormAction(cargo, form_instance, performs)'),
117
- when('bad_request', "!(pf_action === null || pf_action && typeof pf_action === 'object' && pf_action.action) || pf_action !== null && (!pf_request || typeof pf_request !== 'object')", { id: `${spec.id}_prepare_failed`, type: 'FLOW', value: 'give-up', callType: 'reboot', parameters: { context: '{{exit_context}}', context_es: '{{exit_context_es}}' } }),
117
+ when('bad_request', "!(pf_action === null || pf_action && typeof pf_action === 'object' && pf_action.action) || pf_action !== null && (!pf_request || typeof pf_request !== 'object')", { id: `${spec.id}_prepare_failed`, type: 'FLOW', value: 'give-up', callType: 'reboot', recovery: { version: 1, mode: 'none', reason: 'performer_request_invalid' }, parameters: { context: '{{exit_context}}', context_es: '{{exit_context_es}}' } }),
118
118
  set('proposal', 'pf_record', "pf_action ? prepareFormAction(cargo, form_instance, pf_action, pf_request) : null"),
119
119
  ];
120
120
  const flow = formFlow({ ...spec, confirm, confirmation_condition: "pf_action !== null && pf_action && typeof pf_action === 'object'",
@@ -1 +1 @@
1
- {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AAsFA;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DC;AACD;;;GAGG;AACH;;;;;;EAGC;AAiSD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAlcM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAknB9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
1
+ {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AAyFA;;;;;;GAMG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4DC;AACD;;;GAGG;AACH;;;;;;EAGC;AAoTD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAtdM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsoB9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
@@ -28,7 +28,10 @@ const FLOW = (id, value, callType = 'call', parameters) => ({ id, type: 'FLOW',
28
28
  const WHEN = (id, condition, step) => ({ id, type: 'CASE', branches: { [`condition: ${condition}`]: step, default: NOOP(`${id}_skip`) } });
29
29
  const vars = (o) => Object.fromEntries(Object.entries(o).map(([k, v]) => [k, { type: Array.isArray(v) ? 'array' : v === null || typeof v === 'object' ? 'object' : typeof v, value: v }]));
30
30
  const incompleteAttrs = (form, reason) => ({ outcome: `{{formIncompleteOutcome(cargo,${form},{outcome:'unresolved',reason:${reason}}).outcome}}`, reason: `{{formIncompleteOutcome(cargo,${form},{outcome:'unresolved',reason:${reason}}).reason}}` });
31
- const incompleteDispatch = (id, form, reason) => ({ id, type: 'DISPATCH', ...incompleteAttrs(form, reason) });
31
+ const recoveryAttrs = (form, reason, failure = false, mode = 'resume') => { const call = `formConversationOutcome(cargo,${form},${reason},${failure},${JSON.stringify(mode)})`; return { outcome: `{{${call}.outcome}}`, reason: `{{${call}.reason}}`, recovery: { version: 1, mode: `{{${call}.recovery.mode}}`, reason: `{{${call}.recovery.reason}}`, form: `{{${call}.recovery.form || ''}}`, flow: `{{${call}.recovery.flow || ''}}` } }; };
32
+ const incompleteDispatch = (id, form, reason) => ({ id, type: 'DISPATCH', ...recoveryAttrs(form, reason, true, 'none') });
33
+ const yieldDispatch = (id, form, reason) => ({ id, type: 'DISPATCH', ...recoveryAttrs(form, reason) });
34
+ const recoveryStamp = (id, form, reason, mode = 'resume') => ({ ...SET(id, 'noop', 'true'), recovery: recoveryAttrs(form, reason, true, mode).recovery });
32
35
  const optionalIncomplete = (id, condition, form, reason) => WHEN(id, `(${condition}) && !!formIncompleteOutcome(cargo,${form},{outcome:'unresolved',reason:${reason}}).owner`, incompleteDispatch(id + '_dispatch', form, reason));
33
36
  /** A SET value that yields this text: with {{ }} it is a template (as is); without, a JS string literal. */
34
37
  export const textValue = (text) => (String(text).includes('{{') ? String(text) : JSON.stringify(String(text)));
@@ -115,7 +118,7 @@ export function formFlow({ id, name, version, description, inputs, after = [], e
115
118
  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 })`),
116
119
  SIDE(`${id}_task`, `(!parent_form ? (cargo.formTasks = cargo.formTasks || {}, cargo.formTasks[${JSON.stringify(id)}] = form_instance) : true, true)`),
117
120
  SIDE(`${id}_provider_reset`, '(delete cargo.forms[form_instance].providerRequests, delete cargo.forms[form_instance].activeGates, delete cargo.forms[form_instance].providerGateActive, true)'),
118
- SIDE(`${id}_pass_reset`, '(cargo.forms[form_instance].replays = 0, form_internal_resume ? true : (cargo.forms[form_instance].attempts = {}), true)'),
121
+ 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)'),
119
122
  SET(`${id}_arguments`, 'form_arguments', `rememberFormArguments(cargo.forms[form_instance], currentContext, ${JSON.stringify(parameters.filter(p => !p.internal && !/^internal\b/i.test(p.description || '')).map(p => p.name))}, form_internal_resume)`),
120
123
  ...parameters.filter(p => !p.internal && !/^internal\b/i.test(p.description || '')).map(p => SET(`${id}_restore_${p.name}`, p.name, `form_internal_resume ? form_arguments[${JSON.stringify(p.name)}] : currentContext[${JSON.stringify(p.name)}]`)),
121
124
  ...before,
@@ -137,6 +140,7 @@ export function formFlow({ id, name, version, description, inputs, after = [], e
137
140
  WHEN(`${id}_resolve_validation_exhausted`, "form_validation === 'failed'", SET(`${id}_validation_exhaustion`, 'form_exhaustion', "exhaustFormInput(cargo,form_instance,((cargo.formCheck || {}).invalid || [])[0] ? cargo.formCheck.invalid[0].name : '')")),
138
141
  WHEN(`${id}_recover_validation_exhausted`, 'form_exhaustion', FLOW(`${id}_validation_recovery`, '{{form_exhaustion.flow}}', 'reboot', { form: '{{form_exhaustion.form}}', failed_form: '{{form_exhaustion.failed_form}}', input: '{{form_exhaustion.input}}', failed_input: '{{form_exhaustion.failed_input}}', reason: '{{form_exhaustion.reason}}' })),
139
142
  optionalIncomplete(`${id}_optional_validation_failed`, "form_validation === 'failed'", 'form_instance', "form_instance+'_incomplete'"),
143
+ WHEN(`${id}_validation_failed_recovery`, "form_validation === 'failed'", recoveryStamp(`${id}_validation_stamp`, 'form_instance', "'validation_exhausted'", 'none')),
140
144
  WHEN(`${id}_validation_failed`, "form_validation === 'failed'", FLOW(`${id}_validation_give_up`, 'give-up', 'reboot', { context: '{{exit_context}}', context_es: '{{exit_context_es}}' })),
141
145
  WHEN(`${id}_validation_message`, "form_validation === 'retry' && cargo.formCheck.message", SAY(`${id}_validation_say`, '{{cargo.formCheck.message}}', '{{cargo.formCheck.message_es}}')),
142
146
  WHEN(`${id}_validation_retry`, "form_validation === 'retry'", FLOW(`${id}_validate_again`, id, 'replace', { parent_form: '{{parent_form}}', result_input: '{{result_input}}', form_instance: '{{form_instance}}' })),
@@ -198,26 +202,31 @@ const collectInput = {
198
202
  id: 'collect-input', name: 'CollectInput', version: '1.0.0', scope: 'isolated',
199
203
  description: "Worker: ask the form's current input once and file the answer wherever it belongs in the form chain (matchInputs, decided by scope; a declared confirm_against pair is asked). One reading → collect-input-accept; ambiguous → disambiguate-input; a question about the form's data → provide-data; a short miss → counted, the loop re-asks; 3+ words that fit nothing → DISPATCH. Params: form, current, questions, provides, exit_context(_es).",
200
204
  parameters: ['form', 'current', 'questions', 'provides', 'exit_context', 'exit_context_es'].map((n) => ({ name: n, type: ['questions'].includes(n) ? 'array' : n === 'provides' ? 'object' : 'string', description: n })),
201
- variables: vars({ ci_exhaustion: null, ci_d: {}, ci_pre: '', ci_val: '', ci_routed: '', ci_names: [], ci_chain: [], ci_spec: null, ci_choices: [], ci_q: '', ci_q_es: '', ci_missed: 0, ci_max: 3, ci_m: null, ci_qkey: '', ci_skip_gate: '', ci_words: 0, ci_digits: null, ci_amount: false, ci_as_spoken: false, ci_reader: {}, ci_pii: false, ci_ctx: '', ci_ctx_es: '' }),
205
+ variables: vars({ ci_exhaustion: null, ci_d: {}, ci_pre: '', ci_val: '', ci_routed: '', ci_names: [], ci_chain: [], ci_spec: null, ci_choices: [], ci_q: '', ci_q_es: '', ci_missed: 0, ci_max: 3, ci_misses: 0, ci_miss_limit: 2, ci_m: null, ci_qkey: '', ci_skip_gate: '', ci_words: 0, ci_digits: null, ci_amount: false, ci_as_spoken: false, ci_reader: {}, ci_pii: false, ci_ctx: '', ci_ctx_es: '' }),
202
206
  steps: [
203
207
  SET('ci_find_spec', 'ci_spec', "(function () { var s = ((cargo.forms[form] || {}).specs || []).filter(function (s) { return s.name === current; })[0]; return s ? (Array.isArray(s.any_of) ? Object.assign({}, s, { profile: { kind: 'group' } }) : s) : null; })()"),
204
208
  SET('ci_current_names', 'ci_names', "Array.isArray(ci_spec && ci_spec.any_of) ? ci_spec.any_of.map(function (m) { return m.name; }) : [current]"),
205
- WHEN('ci_no_spec', '!ci_spec', END('ci_no_spec_end', incompleteAttrs('form', "'collect_input_spec'"))),
209
+ WHEN('ci_no_spec', '!ci_spec', END('ci_no_spec_end', recoveryAttrs('form', "'collect_input_spec'", true, 'none'))),
206
210
  SET('ci_count_missed', 'ci_missed', "Number(((cargo.forms[form] || {}).attempts || {})[current] || 0)"),
207
211
  SET('ci_max_attempts', 'ci_max', 'Number(ci_spec.max_attempts || 3)'),
212
+ SET('ci_context_misses', 'ci_misses', 'Number(((cargo.forms[form] || {}).misses || {})[current] || 0)'),
213
+ SET('ci_context_limit', 'ci_miss_limit', 'Number(ci_spec.max_misses || 2)'),
214
+ WHEN('ci_context_yield', 'ci_misses >= ci_miss_limit', yieldDispatch('ci_misses_dispatch', 'form', "'input_misses_exhausted'")),
208
215
  SET('ci_context', 'ci_ctx', "typeof exit_context !== 'undefined' && exit_context ? exit_context : 'your request'"),
209
216
  SET('ci_context_es', 'ci_ctx_es', "typeof exit_context_es !== 'undefined' && exit_context_es ? exit_context_es : 'su solicitud'"),
210
217
  WHEN('ci_resolve_exhausted', 'ci_missed >= ci_max', SET('ci_exhausted_policy', 'ci_exhaustion', 'exhaustFormInput(cargo,form,current)')),
211
218
  WHEN('ci_declared_exhausted', 'ci_exhaustion', FLOW('ci_exhausted_recovery', '{{ci_exhaustion.flow}}', 'reboot', { form: '{{ci_exhaustion.form}}', failed_form: '{{ci_exhaustion.failed_form}}', input: '{{ci_exhaustion.input}}', failed_input: '{{ci_exhaustion.failed_input}}', reason: '{{ci_exhaustion.reason}}' })),
212
219
  optionalIncomplete('ci_optional_exhausted', 'ci_missed >= ci_max', 'form', "form+'_incomplete'"),
220
+ WHEN('ci_failure_recovery', 'ci_missed >= ci_max', recoveryStamp('ci_failure_stamp', 'form', "'validation_exhausted'")),
213
221
  WHEN('ci_give_up', 'ci_missed >= ci_max', FLOW('ci_give_up_flow', 'give-up', 'reboot', { context: '{{ci_ctx}}', context_es: '{{ci_ctx_es}}' })),
214
222
  FLOW('ci_prepare', 'prepare-input', 'call', { form: '{{form}}', input: '{{current}}' }),
215
223
  // `refresh`: a flow run before EVERY ask, which computes what the question shows into cargo.forms[form].data
216
224
  WHEN('ci_refresh', 'ci_spec.refresh', FLOW('ci_refresh_flow', '{{ci_spec.refresh}}', 'call', { form: '{{form}}', input: '{{current}}' })),
217
225
  SET('ci_refetch_spec', 'ci_spec', "(function(){var spec=cargo.forms[form].specs.filter(function(s){return s.name===current;})[0];return spec&&spec.any_of?Object.assign({},spec,{profile:{kind:'group'}}):spec;})()"),
218
226
  SET('ci_data', 'ci_d', '(cargo.forms[form] || {}).data || {}'),
219
- SET('ci_question', 'ci_q', "ci_spec.question_from && ci_d[ci_spec.question_from] ? ci_d[ci_spec.question_from] : (ci_missed > 0 && ci_spec.retry ? ci_spec.retry : ci_spec.question)"),
220
- SET('ci_question_es', 'ci_q_es', "ci_spec.question_from && (ci_d[ci_spec.question_from + '_es'] || ci_d[ci_spec.question_from]) ? (ci_d[ci_spec.question_from + '_es'] || ci_d[ci_spec.question_from]) : (ci_missed > 0 && (ci_spec.retry_es || ci_spec.retry) ? (ci_spec.retry_es || ci_spec.retry) : (ci_spec.question_es || ci_spec.question))"),
227
+ SET('ci_question', 'ci_q', "formInputPrompt(cargo,form,current,ci_spec,ci_d,'en')"),
228
+ SET('ci_question_es', 'ci_q_es', "formInputPrompt(cargo,form,current,ci_spec,ci_d,'es')"),
229
+ SIDE('ci_feedback_consumed', 'consumeFormFeedback(cargo,form,current)'),
221
230
  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 : [])"),
222
231
  SET('ci_keypad', 'ci_digits', 'ci_spec.digits || null'),
223
232
  SET('ci_is_amount', 'ci_amount', "ci_spec.amount === 'marked' ? 'marked' : (ci_spec.amount === true || ci_spec.profile.kind === 'amount')"),
@@ -236,6 +245,7 @@ const collectInput = {
236
245
  // The labels and validators ride on each reading, so the presets stay in this one flow.
237
246
  SET('ci_enrich', 'ci_m', 'enrichFormMatches(ci_m, ci_chain, form, ci_names, current)'),
238
247
  SET('ci_question_key', 'ci_qkey', "ci_m.questions.length ? ci_m.questions[0] : !ci_m.hits.length && !ci_m.ambiguous.length && Array.isArray(questions) && questions.length && provides ? pickChoice(cargo.choiceText, questions, false) : ''"),
248
+ WHEN('ci_understood', 'ci_m.hits.length || ci_m.ambiguous.length || ci_m.questions.length || ci_qkey && ci_qkey.indexOf("__") !== 0', SIDE('ci_clear_misses', 'clearFormMisses(cargo,form,current)')),
239
249
  SET('ci_count_words', 'ci_words', "String(cargo.choiceText || '').split(/\\s+/).filter(function (w) { return /[a-záéíóúüñ]/i.test(w); }).length"),
240
250
  // Independent field clauses are committed before a provider can suspend on its gate.
241
251
  WHEN('ci_question_ambiguity', 'ci_m.questions.length > 0 && ci_m.ambiguous.length > 0', FLOW('ci_question_clarify', 'disambiguate-input', 'call', { readings: '{{ci_m.ambiguous}}', hits: '{{ci_m.hits}}', remaining: '{{ci_m.remaining}}' })),
@@ -248,8 +258,8 @@ const collectInput = {
248
258
  'condition: ci_m.hits.length > 0': FLOW('ci_accept', 'collect-input-accept', 'call', { hits: '{{ci_m.hits}}' }),
249
259
  "condition: ci_m.questions.length > 0": END('ci_question_handled'),
250
260
  "condition: ci_qkey && ci_qkey.indexOf('__') !== 0": FLOW('ci_question_asked', 'provide-data', 'call', { form: '{{form}}', provides: '{{provides}}', asked: '{{ci_qkey}}', no_menu: 'true', no_gate: '{{ci_skip_gate}}' }),
251
- 'condition: ci_words >= 3': incompleteDispatch('ci_elsewhere', 'form', "form+'_incomplete'"),
252
- default: SIDE('ci_miss', "(cargo.forms[form].attempts = cargo.forms[form].attempts || {}, cargo.forms[form].attempts[current] = ci_missed + 1, true)")
261
+ 'condition: ci_words >= 3': yieldDispatch('ci_elsewhere', 'form', "'input_not_matched'"),
262
+ default: SIDE('ci_miss', "(missFormInput(cargo,form,current),true)")
253
263
  } },
254
264
  ],
255
265
  };
@@ -317,7 +327,7 @@ const acceptedEffects = {
317
327
  SET('ie_first', 'ca_h', 'readings.length ? readings[0] : null'),
318
328
  WHEN('ie_none', '!ca_h', END('ie_end')),
319
329
  SET('ie_rest', 'ca_rest', 'readings.slice(1)'),
320
- WHEN('ie_reject', "ca_h.outcome === 'rejected'", SIDE('ie_attempt', "(cargo.forms[ca_h.form].attempts[ca_h.asked || ca_h.name] = Number(cargo.forms[ca_h.form].attempts[ca_h.asked || ca_h.name] || 0) + 1, true)")),
330
+ WHEN('ie_reject', "ca_h.outcome === 'rejected'", SIDE('ie_attempt', "(cargo.forms[ca_h.form].attempts[ca_h.asked || ca_h.name] = Number(cargo.forms[ca_h.form].attempts[ca_h.asked || ca_h.name] || 0) + 1, cargo.forms[ca_h.form].feedback=cargo.forms[ca_h.form].feedback || {}, cargo.forms[ca_h.form].feedback[ca_h.asked || ca_h.name]='invalid', true)")),
321
331
  SET('ie_say_en', 'ca_ack', "ca_h.outcome === 'rejected' ? (ca_h.message || ('That ' + (ca_h.label || ca_h.name) + \" doesn't look right.\")) : ca_h.silent === true || ca_h.fromPending ? '' : ca_h.outcome === 'known' && !ca_h.current ? ('Thank you, I already have your ' + ca_h.label + '.') : ca_h.outcome === 'changed' ? ('Okay, I updated your ' + ca_h.label + '.') : (ca_h.outcome === 'taken' || ca_h.outcome === 'pending') && ca_h.origin !== 'activation' ? ('Got it, your ' + ca_h.label + '.') : ''"),
322
332
  SET('ie_say_es', 'ca_ack_es', "ca_h.outcome === 'rejected' ? (ca_h.message_es || ca_h.message || ('Ese ' + (ca_h.label_es || ca_h.label || ca_h.name) + ' no parece correcto.')) : ca_h.silent === true || ca_h.fromPending ? '' : ca_h.outcome === 'known' && !ca_h.current ? ('Gracias, ya tengo su ' + ca_h.label_es + '.') : ca_h.outcome === 'changed' ? ('Listo, actualicé su ' + ca_h.label_es + '.') : (ca_h.outcome === 'taken' || ca_h.outcome === 'pending') && ca_h.origin !== 'activation' ? ('Entendido, su ' + ca_h.label_es + '.') : ''"),
323
333
  WHEN('ie_say', 'ca_ack', SAY('ie_ack', '{{ca_ack}}', '{{ca_ack_es}}')),
@@ -330,7 +340,7 @@ const disambiguate = {
330
340
  id: 'disambiguate-input', name: 'DisambiguateInput', version: '1.0.0', scope: 'isolated',
331
341
  description: "Worker: the answer fits two or more inputs at the same scope (or a declared confirm_against pair). Stores the unambiguous readings, asks which input the rest was for (keys 1..n, never 8), stores the pick. No pick: nothing stored, not a miss. Params: readings, hits.",
332
342
  parameters: [{ name: 'readings', type: 'array', description: 'The ambiguous readings' }, { name: 'hits', type: 'array', description: 'Readings to store as they are' }, { name: 'remaining', type: 'array' }],
333
- variables: vars({ di_keys: [], di_choices: [], di_q: '', di_q_es: '', di_pick: null, di_value: '', remaining: [], di_next: [], di_rest: [] }),
343
+ variables: vars({ di_form: '', di_input: '', di_prompt: '', di_prompt_es: '', di_words: 0, di_misses: 0, di_keys: [], di_choices: [], di_q: '', di_q_es: '', di_pick: null, di_value: '', remaining: [], di_next: [], di_rest: [] }),
334
344
  steps: [
335
345
  WHEN('di_store_clear', 'Array.isArray(hits) && hits.length > 0', FLOW('di_store_hits', 'collect-input-accept', 'call', { hits: '{{hits}}' })),
336
346
  SET('di_number', 'di_keys', `${KEYS_JS}(readings.length)`),
@@ -338,8 +348,19 @@ const disambiguate = {
338
348
  SET('di_said', 'di_value', "readings[0].pii ? '' : String(readings[0].value)"),
339
349
  SET('di_question', 'di_q', "(di_value ? 'Is ' + di_value + ' your ' : 'Is that your ') + readings.map(function (r) { return r.label; }).join(' or your ') + '? ' + readings.map(function (r, i) { return (cargo.voice ? 'Press ' + di_keys[i] + ' or say ' : 'Say ') + r.label.toUpperCase(); }).join(', ') + '.'"),
340
350
  SET('di_question_es', 'di_q_es', "(di_value ? '¿' + di_value + ' es su ' : '¿Eso es su ') + readings.map(function (r) { return r.label_es; }).join(' o su ') + '? ' + readings.map(function (r, i) { return (cargo.voice ? 'Presione ' + di_keys[i] + ' o diga ' : 'Diga ') + r.label_es.toUpperCase(); }).join(', ') + '.'"),
341
- FLOW('di_ask', 'ask-choice', 'call', { question: '{{di_q}}', question_es: '{{di_q_es}}', choices: '{{di_choices}}', accept_other: true, digits: { min: 1, max: 1 } }),
351
+ SET('di_owner', 'di_form', 'readings[0].form'),
352
+ SET('di_counter', 'di_input', "'__ambiguity:'+readings.map(function(r){return r.form+':'+r.name;}).sort().join('|')"),
353
+ SET('di_prompt', 'di_prompt', "formInputPrompt(cargo,di_form,di_input,{question:di_q,question_es:di_q_es},{},'en')"),
354
+ SET('di_prompt_es', 'di_prompt_es', "formInputPrompt(cargo,di_form,di_input,{question:di_q,question_es:di_q_es},{},'es')"),
355
+ SIDE('di_feedback_consumed', 'consumeFormFeedback(cargo,di_form,di_input)'),
356
+ FLOW('di_ask', 'ask-choice', 'call', { question: '{{di_prompt}}', question_es: '{{di_prompt_es}}', choices: '{{di_choices}}', accept_other: true, digits: { min: 1, max: 1 } }),
342
357
  SET('di_picked', 'di_pick', "/^r\\d+$/.test(String(cargo.choice || '')) ? [readings[Number(String(cargo.choice).slice(1))]] : null"),
358
+ WHEN('di_understood', 'di_pick', SIDE('di_clear_misses', 'clearFormMisses(cargo,di_form,di_input)')),
359
+ SET('di_word_count', 'di_words', "String(cargo.choiceText || '').split(/\\s+/).filter(function(w){return /[a-záéíóúüñ]/i.test(w);}).length"),
360
+ WHEN('di_context', '!di_pick && di_words >= 3', yieldDispatch('di_context_yield', 'di_form', "'ambiguity_not_resolved'")),
361
+ WHEN('di_miss', '!di_pick', SET('di_miss_count', 'di_misses', 'missFormInput(cargo,di_form,di_input)')),
362
+ WHEN('di_exhausted', '!di_pick && di_misses >= 2', yieldDispatch('di_misses_yield', 'di_form', "'ambiguity_misses_exhausted'")),
363
+ WHEN('di_retry', '!di_pick', FLOW('di_retry_question', 'disambiguate-input', 'replace', { readings: '{{readings}}', hits: [], remaining: '{{remaining}}' })),
343
364
  WHEN('di_store_pick', 'di_pick', FLOW('di_store_pick_flow', 'collect-input-accept', 'call', { hits: '{{di_pick}}' })),
344
365
  SET('di_remaining_first', 'di_next', 'Array.isArray(remaining) && remaining.length ? remaining[0] : []'),
345
366
  SET('di_remaining_rest', 'di_rest', 'Array.isArray(remaining) ? remaining.slice(1) : []'),
@@ -351,13 +372,16 @@ const confirmForm = {
351
372
  id: 'confirm-form', name: 'ConfirmForm', version: '1.0.0', scope: 'isolated',
352
373
  description: "Worker: ask a form's confirmation (exact YES / NO; keys 1 and 2). A correction instead ('no, make it $40') is read against the form chain and stored, and the result is 'changed' so the form runs again; an unclear short answer is asked again, a long unrelated one is DISPATCHed. Result: cargo.formConfirm[form] = 'yes' | 'no' | 'changed'. Params: form, question(_es), exit_context(_es).",
353
374
  parameters: ['form', 'question', 'question_es', 'exit_context', 'exit_context_es', 'words', 'interrupts', 'no_keys', 'clarifications'].map((n) => ({ name: n, type: ['words', 'interrupts', 'no_keys', 'clarifications'].includes(n) ? 'array' : 'string', description: n })),
354
- variables: vars({ cf_presets: FIELD_PRESETS, cf_chain: [], cf_m: null, cf_result: '', cf_words: 0, cf_tries: 0, words: [], clarifications: [], no_keys: ['2'], interrupts: [], cf_choices: [], cf_event: '', cf_amount: false, cf_questions: [], cf_provides: null, cf_skip_gate: '' }),
375
+ variables: vars({ cf_presets: FIELD_PRESETS, cf_chain: [], cf_m: null, cf_result: '', cf_prompt: '', cf_prompt_es: '', cf_words: 0, cf_tries: 0, words: [], clarifications: [], no_keys: ['2'], interrupts: [], cf_choices: [], cf_event: '', cf_amount: false, cf_questions: [], cf_provides: null, cf_skip_gate: '' }),
355
376
  steps: [
356
377
  SIDE('cf_reset', "(cargo.formConfirm = cargo.formConfirm || {}, cargo.formConfirm[form] = '', true)"),
357
378
  SET('cf_choices', 'cf_choices', "[{key:'yes',words:['1'].concat(Array.isArray(words)?words:[]),exact:true},{key:'no',words:Array.isArray(no_keys)?no_keys:['2']}].concat((Array.isArray(interrupts)?interrupts:[]).map(function(event){return {key:'event:'+event.key,words:event.words,exact:event.exact!==false};}))"),
358
379
  SET('cf_initial_chain', 'cf_chain', CHAIN_JS),
359
380
  SET('cf_amount_context', 'cf_amount', "cf_chain.some(function(input){return input.profile && input.profile.kind==='amount';})"),
360
- FLOW('cf_ask', 'ask-choice', 'call', { amount: '{{cf_amount}}', question: '{{question}}', question_es: '{{question_es}}', choices: '{{cf_choices}}', accept_other: true, reask_long: true, digits: { min: 1, max: 1 }, exit_context: '{{exit_context}}', exit_context_es: '{{exit_context_es}}' }),
381
+ SET('cf_prompt', 'cf_prompt', "formInputPrompt(cargo,form,'__confirm',{question:question,question_es:question_es},{},'en')"),
382
+ SET('cf_prompt_es', 'cf_prompt_es', "formInputPrompt(cargo,form,'__confirm',{question:question,question_es:question_es},{},'es')"),
383
+ SIDE('cf_feedback_consumed', "consumeFormFeedback(cargo,form,'__confirm')"),
384
+ FLOW('cf_ask', 'ask-choice', 'call', { amount: '{{cf_amount}}', question: '{{cf_prompt}}', question_es: '{{cf_prompt_es}}', choices: '{{cf_choices}}', accept_other: true, reask_long: true, digits: { min: 1, max: 1 }, exit_context: '{{exit_context}}', exit_context_es: '{{exit_context_es}}' }),
361
385
  SET('cf_event', 'cf_event', "(Array.isArray(interrupts)?interrupts:[]).filter(function(event){return cargo.choice==='event:'+event.key;}).map(function(event){return event.flow;})[0] || ''"),
362
386
  WHEN('cf_interrupt', 'cf_event', FLOW('cf_event_flow', '{{cf_event}}', 'reboot', { form: '{{form}}', event: '{{cargo.choice}}', text: '{{cargo.choiceText}}' })),
363
387
  SET('cf_build_chain', 'cf_chain', CHAIN_JS),
@@ -376,17 +400,16 @@ const confirmForm = {
376
400
  'condition: cf_m.ambiguous.length > 0': FLOW('cf_ambiguous', 'disambiguate-input', 'call', { readings: '{{cf_m.ambiguous}}', hits: '{{cf_m.hits}}', remaining: '{{cf_m.remaining}}' }),
377
401
  'condition: cf_m.hits.length > 0': FLOW('cf_accept', 'collect-input-accept', 'call', { hits: '{{cf_m.hits}}' }),
378
402
  "condition: cargo.choice === 'no'": SET('cf_declined', 'cf_result', "'no'"),
379
- "condition: Array.isArray(clarifications) && pickChoice(String(cargo.choiceText || '').replace(/[?¿]/g,''),[{key:'clarify',words:clarifications,exact:true}],false)==='clarify'": SET('cf_clarification', 'cf_result', "'unclear'"),
380
- 'condition: cf_words >= 3': incompleteDispatch('cf_elsewhere', 'form', "form+'_unconfirmed'"),
403
+ "condition: Array.isArray(clarifications) && pickChoice(String(cargo.choiceText || '').replace(/[?¿]/g,''),[{key:'clarify',words:clarifications,exact:true}],false)==='clarify'": SET('cf_clarification', 'cf_result', "'clarification'"),
404
+ 'condition: cf_words >= 3': yieldDispatch('cf_elsewhere', 'form', "'confirmation_not_matched'"),
381
405
  default: SET('cf_unclear', 'cf_result', "'unclear'")
382
406
  } },
383
407
  SET('cf_changed', 'cf_result', "cf_result ? cf_result : 'changed'"),
384
408
  // an unclear short answer is asked again (the form runs again and reaches this question), at most twice
385
- SET('cf_tries_count', 'cf_tries', "cf_result === 'unclear' ? (cargo.forms[form] ? ((cargo.forms[form].attempts = cargo.forms[form].attempts || {}).__confirm = Number(cargo.forms[form].attempts.__confirm || 0) + 1) : 9) : 0"),
386
- optionalIncomplete('cf_optional_exhausted', 'cf_tries > 2', 'form', "form+'_unconfirmed'"),
387
- WHEN('cf_give_up', 'cf_tries > 2', FLOW('cf_give_up_flow', 'give-up', 'reboot', { context: '{{exit_context}}', context_es: '{{exit_context_es}}' })),
409
+ SET('cf_tries_count', 'cf_tries', "cf_result === 'unclear' ? missFormInput(cargo,form,'__confirm') : (clearFormMisses(cargo,form,'__confirm'),0)"),
410
+ WHEN('cf_misses_exhausted', 'cf_tries >= 2', yieldDispatch('cf_misses_dispatch', 'form', "'confirmation_misses_exhausted'")),
388
411
  WHEN('cf_bind_revision', "cf_result === 'yes'", SIDE('cf_bind', 'confirmFormRevision(cargo, form)')),
389
- SIDE('cf_store', "(cargo.formConfirm[form] = cf_result === 'unclear' ? 'changed' : cf_result, true)"),
412
+ SIDE('cf_store', "(cargo.formConfirm[form] = cf_result === 'unclear' || cf_result === 'clarification' ? 'changed' : cf_result, true)"),
390
413
  ],
391
414
  };
392
415
  // ── form-done: the result goes to the parent (or cargo.formResults); the form is cleared ─────────────────────────────
@@ -497,7 +520,7 @@ const provideData = {
497
520
  parameters: [{ name: 'form', type: 'string', description: 'Originating FORM instance for task-owned deferred questions' }, { name: 'provides', type: 'object', description: 'The provider catalog' }, { name: 'asked', type: 'string', description: 'Fact or set key' }, { name: 'asked_keys', type: 'array', description: 'Independent requested facts or sets' }, { name: 'no_menu', type: 'string', description: "'true': answer only (a question asked inside a form)" }, { name: 'gate_params', type: 'object', description: 'Identifiers the caller already gave, passed to the gate flow as gate_params' }, { name: 'no_gate', type: 'string', description: "'true': the caller is inside a task on the verified account; the gate flow is not run (the verified paths are still checked)" }],
498
521
  variables: vars({ form: '', pd_request: null, pd_deferred: null, pd_ready: [], asked_keys: [], no_gate: '', pd_close: false, pd_who: '', no_menu: '', gate_params: null, pd_keys: [], pd_menu: [], pd_mkeys: [], pd_q: '', pd_q_es: '', pd_gated: false, pd_ok: false }),
499
522
  steps: [
500
- WHEN('pd_no_catalog', "!provides || typeof provides !== 'object' || !Array.isArray(provides.facts)", END('pd_no_catalog_end', { outcome: 'unresolved', reason: 'provide_data_catalog' })),
523
+ WHEN('pd_no_catalog', "!provides || typeof provides !== 'object' || !Array.isArray(provides.facts)", END('pd_no_catalog_end', { outcome: 'unresolved', reason: 'provide_data_catalog', recovery: { version: 1, mode: 'none', reason: 'provide_data_catalog' } })),
501
524
  SET('pd_resolve', 'pd_keys', "(function () { var requested=Array.isArray(asked_keys)&&asked_keys.length?asked_keys:[typeof asked!=='undefined'?String(asked||''):''];return requested.reduce(function(keys,a){var set=(provides.sets||[]).filter(function(x){return x.key===a;})[0];var facts=set?set.facts:provides.facts.some(function(f){return f.key===a;})?[a]:[];return keys.concat(facts.filter(function(key){return keys.indexOf(key)<0;}));},[]); })()"),
502
525
  // Nothing specific asked: offer the sets and facts as a menu (keys 1..n, never 8; at most 7 options shown).
503
526
  SET('pd_menu_items', 'pd_menu', "(provides.sets || []).concat(provides.facts).slice(0, 7)"),
@@ -515,7 +538,7 @@ const provideData = {
515
538
  SET('pd_deferred', 'pd_deferred', `(${finishProviderRequest.toString()})(cargo,pd_request.owner,provides,pd_keys)`),
516
539
  SET('pd_merged_keys', 'pd_keys', 'pd_deferred.keys'),
517
540
  SET('pd_gate_check', 'pd_ok', `!pd_gated || [].concat(provides.gate.verified).every(function (p) { return !!${PATH_JS}(p); })`),
518
- WHEN('pd_not_verified', '!pd_ok', END('pd_not_verified_end', { outcome: 'unresolved', reason: 'provide_data_not_verified' })),
541
+ WHEN('pd_not_verified', '!pd_ok', END('pd_not_verified_end', { outcome: 'unresolved', reason: 'provide_data_not_verified', recovery: { version: 1, mode: 'none', reason: 'provide_data_not_verified' } })),
519
542
  WHEN('pd_load', 'provides.source && provides.source.flow', FLOW('pd_load_flow', 'load-source', 'call', { source: '{{provides.source}}' })),
520
543
  FLOW('pd_answer', 'answer-facts', 'call', { provides: '{{provides}}', keys: '{{pd_keys}}' }),
521
544
  WHEN('pd_deferred_more', 'pd_deferred.remaining.length > 0', FLOW('pd_answer_deferred', 'provide-queued-data', 'call', { form: '{{form}}', requests: '{{pd_deferred.remaining}}' })),
@@ -584,7 +607,7 @@ const loadSource = {
584
607
  WHEN('ls_begin', 'ls_stale', SIDE('ls_clear_old', 'beginSourceRefresh(cargo, source)')),
585
608
  WHEN('ls_load', 'ls_stale', FLOW('ls_loader', '{{source.flow}}', 'call')),
586
609
  SET('ls_loaded', 'ls_have', 'ls_stale ? completeSourceRefresh(cargo, source) : true'),
587
- WHEN('ls_failed', '!ls_have', FLOW('ls_give_up', 'give-up', 'reboot', { context: 'your request', context_es: 'su solicitud' })),
610
+ WHEN('ls_failed', '!ls_have', { ...FLOW('ls_give_up', 'give-up', 'reboot', { context: 'your request', context_es: 'su solicitud' }), recovery: { version: 1, mode: 'none', reason: 'source_unavailable' } }),
588
611
  ],
589
612
  };
590
613
  const answerFacts = {
@@ -0,0 +1,28 @@
1
+ export function clearFormMisses(cargo: any, id: any, input: any): boolean;
2
+ export function missFormInput(cargo: any, id: any, input: any): any;
3
+ /** Explicit retry wins. Otherwise acknowledge only an actual unrecognized answer, once per re-ask. */
4
+ export function formInputPrompt(cargo: any, id: any, input: any, spec: any, data?: {}, language?: string): any;
5
+ export function consumeFormFeedback(cargo: any, id: any, input: any): boolean;
6
+ /** Recovery refers to the actual owning root, and never permits a fresh attempt at an unknown action. */
7
+ export function formConversationOutcome(cargo: any, id: any, reason: any, failure?: boolean, recoveryMode?: string): {
8
+ outcome: any;
9
+ reason: any;
10
+ recovery: {
11
+ version: number;
12
+ mode: string;
13
+ reason: any;
14
+ form?: undefined;
15
+ flow?: undefined;
16
+ };
17
+ } | {
18
+ outcome: any;
19
+ reason: any;
20
+ recovery: {
21
+ version: number;
22
+ mode: string;
23
+ reason: any;
24
+ form: any;
25
+ flow: any;
26
+ };
27
+ };
28
+ //# sourceMappingURL=form-conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-conversation.d.ts","sourceRoot":"","sources":["../../src/helpers/form-conversation.js"],"names":[],"mappings":"AAGA,0EAGC;AACD,oEAGC;AACD,sGAAsG;AACtG,+GAMC;AACD,8EAAwI;AAExI,yGAAyG;AACzG;;;;;;;;;;;;;;;;;;;;EAUC"}
@@ -0,0 +1,57 @@
1
+ /** Shared FORM retry, contextual yield and recovery policy; all state is conversation-owned. */
2
+ import { formIncompleteOutcome } from './form-state.js';
3
+ export function clearFormMisses(cargo, id, input) {
4
+ const state = cargo.forms?.[id];
5
+ if (!state)
6
+ return true;
7
+ state.misses ||= {};
8
+ state.feedback ||= {};
9
+ delete state.misses[input];
10
+ delete state.feedback[input];
11
+ return true;
12
+ }
13
+ export function missFormInput(cargo, id, input) {
14
+ const state = cargo.forms?.[id];
15
+ if (!state)
16
+ throw new Error('Cannot record a miss without its owned form');
17
+ state.misses ||= {};
18
+ state.feedback ||= {};
19
+ state.misses[input] = Number(state.misses[input] || 0) + 1;
20
+ state.feedback[input] = 'miss';
21
+ return state.misses[input];
22
+ }
23
+ /** Explicit retry wins. Otherwise acknowledge only an actual unrecognized answer, once per re-ask. */
24
+ export function formInputPrompt(cargo, id, input, spec, data = {}, language = 'en') {
25
+ const es = language === 'es', feedback = cargo.forms?.[id]?.feedback?.[input];
26
+ const question = spec.question_from && (es ? (data[spec.question_from + '_es'] || data[spec.question_from]) : data[spec.question_from]) || (es ? (spec.question_es || spec.question) : spec.question) || '';
27
+ const retry = es ? spec.retry_es : spec.retry;
28
+ if (feedback && retry)
29
+ return retry;
30
+ return (feedback === 'miss' ? (es ? 'Disculpe, no le entendí. ' : "Sorry, I didn't catch that. ") : '') + question;
31
+ }
32
+ export function consumeFormFeedback(cargo, id, input) { if (cargo.forms?.[id]?.feedback)
33
+ delete cargo.forms[id].feedback[input]; return true; }
34
+ /** Recovery refers to the actual owning root, and never permits a fresh attempt at an unknown action. */
35
+ export function formConversationOutcome(cargo, id, reason, failure = false, recoveryMode = 'resume') {
36
+ const completed = formIncompleteOutcome(cargo, id, { outcome: 'unresolved', reason });
37
+ if (completed.owner && ['resolved', 'deflected'].includes(completed.outcome))
38
+ return { outcome: completed.outcome, reason: completed.reason, recovery: { version: 1, mode: 'none', reason: completed.reason } };
39
+ const seen = new Set();
40
+ let state = cargo.forms?.[id], root = state;
41
+ while (state && !seen.has(state.id)) {
42
+ seen.add(state.id);
43
+ root = state;
44
+ state = cargo.forms?.[state.parent];
45
+ }
46
+ if (!root)
47
+ return { outcome: 'unresolved', reason, recovery: { version: 1, mode: 'none', reason } };
48
+ const belongs = form => { const visited = new Set(); while (form && !visited.has(form.id)) {
49
+ if (form.id === root.id)
50
+ return true;
51
+ visited.add(form.id);
52
+ form = cargo.forms?.[form.parent];
53
+ } return false; };
54
+ const unknown = Object.values(cargo.forms || {}).filter(belongs).some(form => Object.values(form.actions || {}).some(record => ['attempted', 'unknown'].includes(record.status)));
55
+ const mode = unknown ? 'hold' : recoveryMode, why = unknown ? 'action_result_unknown' : completed.owner ? completed.reason : reason;
56
+ return { outcome: unknown ? 'unresolved' : completed.owner ? completed.outcome : failure ? 'unresolved' : 'pending', reason: why, recovery: { version: 1, mode, reason: why, form: root.id, flow: root.definition } };
57
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"form-state.d.ts","sourceRoot":"","sources":["../../src/helpers/form-state.js"],"names":[],"mappings":"AAMA,qDAKC;AAED,oDAEC;AAED,qFAAqF;AACrF,oEAsBC;AAuCD,2FAEC;AACD,8FAcC;AACD,2DAOC;AACD,uEAuCC;AAED,kGAAkG;AAClG,2GAOC;AACD,0HAA0H;AAC1H,uEAwBC;AACD,8HAA8H;AAC9H;;;;EAWC;AACD,uGAAuG;AACvG;;;;;;;;;;QA8BC;AAED,0FAA0F;AAC1F;;;SAIC;AACD,gGAAgG;AAChG;;;;;;;;;;;EAQC;AAED,sGAAsG;AACtG,2DAIC;AACD;;;GAGG;AACH;;;;;;;SAkBC;AAED,2FAA2F;AAC3F,oGAIC;AACD,gFA4BC;AAED,2GAA2G;AAC3G;;;EASC;AACD,mEAoBC;AACD,mEAGC;AACD,sEAUC;AACD,+EAEC;AACD,qFASC;AACD,oGAoCC;AACD;;;SAKC;AACD,qEAGC;AACD,gEAgBC;AACD,2DAQC;AACD,oGAUC;AAED,uEAAuE;AACvE,wHA+BC;AAED,uHAAuH;AACvH,6EAaC;AACD,mHAAmH;AACnH,iGA4CC;AACD,8DAQC;AACD,8EAeC;AAljBM,8CAAmE"}
1
+ {"version":3,"file":"form-state.d.ts","sourceRoot":"","sources":["../../src/helpers/form-state.js"],"names":[],"mappings":"AAMA,qDAKC;AAED,oDAEC;AAED,qFAAqF;AACrF,oEAuBC;AAuCD,2FAEC;AACD,8FAcC;AACD,2DAOC;AACD,uEAuCC;AAED,kGAAkG;AAClG,2GAOC;AACD,0HAA0H;AAC1H,uEAwBC;AACD,8HAA8H;AAC9H;;;;EAWC;AACD,uGAAuG;AACvG;;;;;;;;;;QA8BC;AAED,0FAA0F;AAC1F;;;SAIC;AACD,gGAAgG;AAChG;;;;;;;;;;;EAQC;AAED,sGAAsG;AACtG,2DAIC;AACD;;;GAGG;AACH;;;;;;;SAkBC;AAED,2FAA2F;AAC3F,oGAIC;AACD,gFA4BC;AAED,2GAA2G;AAC3G;;;EASC;AACD,mEAoBC;AACD,mEAGC;AACD,sEAUC;AACD,+EAEC;AACD,qFASC;AACD,oGAoCC;AACD;;;SAKC;AACD,qEAGC;AACD,gEAgBC;AACD,2DAQC;AACD,oGAUC;AAED,uEAAuE;AACvE,wHA+BC;AAED,uHAAuH;AACvH,6EAaC;AACD,mHAAmH;AACnH,iGA4CC;AACD,8DAQC;AACD,8EAeC;AAnjBM,8CAAmE"}
@@ -35,6 +35,8 @@ export function resolveFormInputs(inputs, presets = {}) {
35
35
  validateMoneyOptions(input.profile.money);
36
36
  }
37
37
  validateFormExhaustion(input.on_exhausted);
38
+ if (input.max_misses !== undefined && (!Number.isInteger(input.max_misses) || input.max_misses < 1))
39
+ throw new Error('FORM max_misses must be a positive integer');
38
40
  if (input.max_attempts !== undefined && (!Number.isInteger(input.max_attempts) || input.max_attempts < 1))
39
41
  throw new Error('FORM max_attempts must be a positive integer');
40
42
  if (input.any_of)
@@ -300,7 +302,7 @@ export function openFormInstance(cargo, definition, specs, { parent = null, inpu
300
302
  cargo.formSequence = Number(cargo.formSequence || 0) + 1;
301
303
  const id = `${definition}:${cargo.formSequence}`;
302
304
  cargo.forms[id] = { id, definition, task: owner?.task || task || id, parent, result_input: input,
303
- on_exhausted: on_exhausted || '', incomplete_outcome: incomplete, context_only: !!context, parent_revision: owner?.revision ?? null, specs, values: {}, accepted: {}, errors: {}, pending: {}, seeds: {}, attempts: {}, prepared: {}, data: {}, arguments: {}, contexts: {}, children: {}, childResults: {}, revision: 0,
305
+ 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,
304
306
  providers: providers || owner?.providers || null, questions: questions?.length ? questions : owner?.questions || [], status: 'collecting' };
305
307
  if (owner) {
306
308
  if (context) {
@@ -1,4 +1,9 @@
1
1
  export namespace STANDARD_FUNCTIONS {
2
+ export { clearFormMisses };
3
+ export { missFormInput };
4
+ export { formInputPrompt };
5
+ export { consumeFormFeedback };
6
+ export { formConversationOutcome };
2
7
  export { readMoneyAmount };
3
8
  export { isMoneyAmount };
4
9
  export { moneyIntentAllows };
@@ -88,6 +93,11 @@ export namespace STANDARD_FUNCTIONS {
88
93
  export { urlToSpeech };
89
94
  export { textWithUrlToSpeech };
90
95
  }
96
+ import { clearFormMisses } from './form-conversation.js';
97
+ import { missFormInput } from './form-conversation.js';
98
+ import { formInputPrompt } from './form-conversation.js';
99
+ import { consumeFormFeedback } from './form-conversation.js';
100
+ import { formConversationOutcome } from './form-conversation.js';
91
101
  import { readMoneyAmount } from './money.js';
92
102
  import { isMoneyAmount } from './money.js';
93
103
  import { moneyIntentAllows } from './money.js';
@@ -181,5 +191,5 @@ import { validatePhone } from './validators.js';
181
191
  import { validateEmail } from './validators.js';
182
192
  import { urlToSpeech } from './url-speech.js';
183
193
  import { textWithUrlToSpeech } from './url-speech.js';
184
- export { 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 };
194
+ export { 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 };
185
195
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAkBmF,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;iCAAn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;8BAAjB,iBAAiB;mCAAjB,iBAAiB;qCAAjB,iBAAiB;mCAAjB,iBAAiB;oCAAjB,iBAAiB;kCAAjB,iBAAiB;yBACzoB,gBAAgB;gCAAhB,gBAAgB;4BAAhB,gBAAgB;8BAAhB,gBAAgB;+BACzB,iBAAiB;8BAAjB,iBAAiB;8BAAjB,iBAAiB;4BAC7B,iBAAiB;oCAAjB,iBAAiB"}
@@ -1,3 +1,4 @@
1
+ import { clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome } from './form-conversation.js';
1
2
  import { takeChoiceOffer } from './choice-offer.js';
2
3
  import { consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified } from './form-actions.js';
3
4
  /**
@@ -29,9 +30,10 @@ import { resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, fo
29
30
  import { checkOtp, maskDestination, validateOTP, OTP_EXPIRY_MS } from './otp-check.js';
30
31
  import { validateDigits, validatePhone, validateEmail } from './validators.js';
31
32
  import { urlToSpeech, textWithUrlToSpeech } from './url-speech.js';
32
- export { 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, };
33
+ export { 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, };
33
34
  /** The functions flows call by name, ready to spread into a host's approved functions. */
34
35
  export const STANDARD_FUNCTIONS = {
36
+ clearFormMisses, missFormInput, formInputPrompt, consumeFormFeedback, formConversationOutcome,
35
37
  readMoneyAmount, isMoneyAmount, moneyIntentAllows, validateMoneyOptions, takeChoiceOffer, matchesChoice, isAnswer, isAgentRequest, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice,
36
38
  readEmail, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
37
39
  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,
@@ -0,0 +1,19 @@
1
+ /** @returns {FlowRecovery} */
2
+ export function validateFlowRecovery(value: any): FlowRecovery;
3
+ /** Undefined means historical behavior; null explicitly clears a completed task's handoff. */
4
+ export function flowHandoffInfo(result: any): {
5
+ flow: any;
6
+ reason: string;
7
+ kind: string;
8
+ recovery: FlowRecovery;
9
+ } | null | undefined;
10
+ /** Instructions belong to JSFE; the host only composes this explicit, consume-once note. */
11
+ export function renderFlowRecovery(handoff: any): string | undefined;
12
+ export type FlowRecovery = {
13
+ version: 1;
14
+ mode: "resume" | "restart" | "hold" | "none";
15
+ reason: string;
16
+ form?: string;
17
+ flow?: string;
18
+ };
19
+ //# sourceMappingURL=flow-recovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-recovery.d.ts","sourceRoot":"","sources":["../../src/host/flow-recovery.js"],"names":[],"mappings":"AAIA,8BAA8B;AAC9B,kDADc,YAAY,CAMzB;AACD,8FAA8F;AAC9F;;;;;qBAKC;AACD,4FAA4F;AAC5F,qEAWC;2BA7Ba;IAAC,OAAO,EAAC,CAAC,CAAC;IAAA,IAAI,EAAC,QAAQ,GAAC,SAAS,GAAC,MAAM,GAAC,MAAM,CAAC;IAAA,MAAM,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,MAAM,CAAC;IAAA,IAAI,CAAC,EAAC,MAAM,CAAA;CAAC"}
@@ -0,0 +1,43 @@
1
+ /** Explicit conversational recovery. No engine, transport, credentials or host-state imports. */
2
+ /** @typedef {{version:1,mode:'resume'|'restart'|'hold'|'none',reason:string,form?:string,flow?:string}} FlowRecovery */
3
+ const modes = new Set(['resume', 'restart', 'hold', 'none']);
4
+ const text = value => typeof value === 'string' && !!value.trim() && value === value.trim();
5
+ /** @returns {FlowRecovery} */
6
+ export function validateFlowRecovery(value) {
7
+ if (!value || typeof value !== 'object' || Array.isArray(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value)) || !['version', 'mode', 'reason'].every(key => Object.hasOwn(value, key)) || Object.keys(value).some(key => !['version', 'mode', 'reason', 'form', 'flow'].includes(key)) || value.version !== 1 || !modes.has(value.mode) || !text(value.reason))
8
+ throw new Error('Invalid JSFE flow recovery descriptor');
9
+ if (value.form !== undefined || value.flow !== undefined) {
10
+ if (!text(value.form) || !text(value.flow))
11
+ throw new Error('Flow recovery requires both form and flow identities');
12
+ }
13
+ if (value.mode === 'resume' && !value.form)
14
+ throw new Error('Resume recovery requires an owned form');
15
+ return { ...value };
16
+ }
17
+ /** Undefined means historical behavior; null explicitly clears a completed task's handoff. */
18
+ export function flowHandoffInfo(result) {
19
+ if (result?.lastFlowRecovery === undefined)
20
+ return undefined;
21
+ const recovery = validateFlowRecovery(result.lastFlowRecovery), outcome = result.lastFlowOutcome;
22
+ if (['resolved', 'deflected'].includes(outcome?.outcome))
23
+ return null;
24
+ return { flow: recovery.flow || outcome?.flowName || result.lastTurnDispatch?.fromFlow || '', reason: recovery.reason, kind: outcome?.outcome === 'pending' ? 'yield' : 'failure', recovery };
25
+ }
26
+ /** Instructions belong to JSFE; the host only composes this explicit, consume-once note. */
27
+ export function renderFlowRecovery(handoff) {
28
+ if (handoff?.recovery === undefined)
29
+ return undefined;
30
+ const recovery = validateFlowRecovery(handoff.recovery);
31
+ let guidance;
32
+ if (recovery.mode === 'hold')
33
+ guidance = 'An earlier external action may have taken effect and its result is not confirmed. Do not claim success or failure. Do not offer to restart, repeat the action, or pay again. Explain that its result needs verification or reconciliation, and address the current question without executing an action.';
34
+ else if (recovery.mode === 'resume')
35
+ guidance = handoff.kind === 'yield'
36
+ ? 'The user has moved outside the current collection question. The original task is pending and its draft is retained. Answer the current request using available authorized information. Do not describe this as a failed task or say it must start over. Offer to return to the retained task only when helpful.'
37
+ : 'A collection step could not finish, but the task draft and accepted information are retained. Briefly acknowledge the difficulty and offer to resume the task if the user wants. Do not say the whole process must start over or ask for information already collected.';
38
+ else if (recovery.mode === 'restart')
39
+ guidance = 'The flow explicitly requires a fresh start to complete the task. Explain that briefly and offer to start the original task again if the user wants. Do not claim an external action failed unless its observed result establishes that.';
40
+ else
41
+ guidance = 'The flow cannot complete this task with its current data or service. Explain the limitation briefly and address the current request or another supported option. Do not invent a restart or retry instruction.';
42
+ return '\n<flow-handoff>\n' + guidance + '\nDo not collect individual scripted fields yourself. Only the relevant JSFE flow collects them, rechecks authorization, and obtains any required fresh confirmation. Do not read internal flow identifiers or machine reasons to the user.\n</flow-handoff>';
43
+ }
@@ -6,6 +6,8 @@
6
6
  * import { buildAiRequest, isDetectFlowRequest, toFlowRequest } from 'jsfe/host';
7
7
  */
8
8
  export * from './request.js';
9
+ export { validateFlowRecovery, flowHandoffInfo, renderFlowRecovery } from './flow-recovery.js';
10
+ export type { FlowRecovery } from './flow-recovery.js';
9
11
  export * from './systemone-intent.js';
10
12
  export * from './intent-stages.js';
11
13
  export { createActionJournal, createMemoryActionStorage, ActionJournalError } from './action-journal.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAC,mBAAmB,EAAC,yBAAyB,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAC,qBAAqB,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAC,mBAAmB,EAAC,wBAAwB,EAAC,MAAM,sBAAsB,CAAC;AAElF,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAC,4BAA4B,EAAC,4BAA4B,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAE/H,OAAO,EAAC,0BAA0B,EAAC,uBAAuB,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,oBAAoB,EAAC,eAAe,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAC3F,YAAY,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACrD,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAC,mBAAmB,EAAC,yBAAyB,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAC,qBAAqB,EAAC,uBAAuB,EAAC,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAC,mBAAmB,EAAC,wBAAwB,EAAC,MAAM,sBAAsB,CAAC;AAElF,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAC,4BAA4B,EAAC,4BAA4B,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAE/H,OAAO,EAAC,0BAA0B,EAAC,uBAAuB,EAAC,qBAAqB,EAAC,MAAM,mBAAmB,CAAC"}
@@ -6,6 +6,7 @@
6
6
  * import { buildAiRequest, isDetectFlowRequest, toFlowRequest } from 'jsfe/host';
7
7
  */
8
8
  export * from './request.js';
9
+ export { validateFlowRecovery, flowHandoffInfo, renderFlowRecovery } from './flow-recovery.js';
9
10
  export * from './systemone-intent.js';
10
11
  export * from './intent-stages.js';
11
12
  export { createActionJournal, createMemoryActionStorage, ActionJournalError } from './action-journal.js';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { FlowRecovery } from './host/flow-recovery.js';
2
+ export type { FlowRecovery } from './host/flow-recovery.js';
1
3
  import type { IntentStageRequest } from './host/intent-stages.js';
2
4
  /**
3
5
  * Pure JS parser for .tools file content (string or object)
@@ -202,6 +204,7 @@ export interface EngineSessionContext {
202
204
  cargo: Record<string, unknown> | undefined;
203
205
  language?: string;
204
206
  hasTentativeFlowInit?: boolean;
207
+ lastFlowRecovery?: FlowRecovery;
205
208
  lastFlowOutcome?: FlowOutcome;
206
209
  lastTurnToolCalls?: ToolCallRecord[];
207
210
  lastTurnDispatch?: DispatchRecord;
@@ -256,6 +259,13 @@ export interface FlowOutcome {
256
259
  export interface FlowStep {
257
260
  id?: string;
258
261
  type: StepType;
262
+ recovery?: {
263
+ version: 1;
264
+ mode: string;
265
+ reason: string;
266
+ form?: string;
267
+ flow?: string;
268
+ };
259
269
  tool?: string;
260
270
  args?: Record<string, unknown>;
261
271
  variable?: string;
@@ -307,7 +317,7 @@ export interface TransactionData {
307
317
  initiator: string;
308
318
  userId: string;
309
319
  steps: TransactionStep[];
310
- state: 'active' | 'completed' | 'failed' | 'rolled_back';
320
+ state: 'active' | 'completed' | 'failed' | 'rolled_back' | 'yielded';
311
321
  createdAt: Date;
312
322
  completedAt?: Date;
313
323
  failedAt?: Date;
@@ -322,6 +332,7 @@ export declare class TransactionManager {
322
332
  static sanitizeForLog(data: unknown): unknown;
323
333
  static rollback(transaction: TransactionData): void;
324
334
  static complete(transaction: TransactionData): void;
335
+ static yield(transaction: TransactionData): void;
325
336
  static fail(transaction: TransactionData, reason: string): void;
326
337
  }
327
338
  export interface FlowFrame {
@@ -788,6 +799,7 @@ export declare class WorkflowEngine implements Engine {
788
799
  getAndClearAccumulatedMessages(): string[];
789
800
  hasAccumulatedMessages(): boolean;
790
801
  setTentativeFlowInit(value: boolean): void;
802
+ stampFlowRecovery(recovery: FlowRecovery): void;
791
803
  stampFlowOutcome(outcome: FlowOutcome): void;
792
804
  getTentativeFlowInit(): boolean;
793
805
  initializeFlowStacks(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAyBlE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,EAAE,CASxD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,EAAE,CASxD;AAGD;;;;;;;;;;;;GAYG;AAIH,qBAAa,kBAAmB,SAAQ,KAAK;aACE,KAAK,CAAC,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C,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,2BAA2B;CAKpC"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { validateFlowRecovery } from './host/flow-recovery.js';
1
2
  import { ACTION_TOOLS } from './forms/action-tools.js';
2
3
  import { claimSessionAction, completeSessionAction } from './forms/session-actions.js';
3
4
  import { actionPersistenceMode } from './host/capabilities.js';
@@ -427,6 +428,7 @@ export class TransactionManager {
427
428
  transaction.state = 'completed';
428
429
  transaction.completedAt = new Date();
429
430
  }
431
+ static yield(transaction) { transaction.state = 'yielded'; }
430
432
  static fail(transaction, reason) {
431
433
  transaction.state = 'failed';
432
434
  transaction.failedAt = new Date();
@@ -444,6 +446,9 @@ function finalizeFlowTransaction(engine, frame, endedBy) {
444
446
  if (declared.outcome === 'unresolved') {
445
447
  TransactionManager.fail(frame.transaction, declared.reason || 'unresolved');
446
448
  }
449
+ else if (declared.outcome === 'pending') {
450
+ TransactionManager.yield(frame.transaction);
451
+ }
447
452
  else {
448
453
  TransactionManager.complete(frame.transaction);
449
454
  }
@@ -2318,6 +2323,15 @@ async function playFlowFrame(engine) {
2318
2323
  const step = currentFlowFrame.flowStepsStack[currentFlowFrame.flowStepsStack.length - 1];
2319
2324
  const startTime = Date.now();
2320
2325
  try {
2326
+ if (step.recovery !== undefined) {
2327
+ const declaration = step.recovery;
2328
+ const resolved = Object.fromEntries(Object.entries(declaration).map(([key, value]) => [key, typeof value === 'string' && value.includes('{{') ? interpolateMessage(value, currentFlowFrame.contextStack, currentFlowFrame.variables, engine).trim() : value]));
2329
+ if (resolved.form === '' && resolved.flow === '') {
2330
+ delete resolved.form;
2331
+ delete resolved.flow;
2332
+ }
2333
+ engine.stampFlowRecovery(validateFlowRecovery(resolved));
2334
+ }
2321
2335
  const result = await playStep(currentFlowFrame, engine);
2322
2336
  const duration = Date.now() - startTime;
2323
2337
  TransactionManager.addStep(currentFlowFrame.transaction, step, result, duration, 'success');
@@ -3974,6 +3988,9 @@ function handleDispatchStep(currentFlowFrame, engine) {
3974
3988
  if (flow.declaredOutcome) {
3975
3989
  finalizeFlowTransaction(engine, flow, 'dispatch');
3976
3990
  }
3991
+ else if (currentFlowFrame.declaredOutcome?.outcome === 'pending') {
3992
+ TransactionManager.yield(flow.transaction);
3993
+ }
3977
3994
  else {
3978
3995
  TransactionManager.fail(flow.transaction, `Dispatched: flow ended by DISPATCH in ${fromFlow}`);
3979
3996
  }
@@ -6229,6 +6246,7 @@ export class WorkflowEngine {
6229
6246
  // the flow terminated — drop any stale stamp from a prior turn before
6230
6247
  // processing (finalizeFlowTransaction re-stamps if a flow ends this turn).
6231
6248
  delete this.sessionContext.lastFlowOutcome;
6249
+ delete this.sessionContext.lastFlowRecovery;
6232
6250
  // Same one-shot semantics for tool calls: the record describes THIS call only, so a
6233
6251
  // host deciding whether this turn's session may be discarded is not misled by a tool
6234
6252
  // that ran on an earlier turn. See recordToolCall and "Host Responsibilities".
@@ -6301,6 +6319,7 @@ export class WorkflowEngine {
6301
6319
  if (!actionRecoveryIdentityMatches(recoveryIdentity, recovery.session.actionRecoveryIdentity)) {
6302
6320
  engineSessionContext.lastTurnToolCalls = [];
6303
6321
  delete engineSessionContext.lastFlowOutcome;
6322
+ delete engineSessionContext.lastFlowRecovery;
6304
6323
  delete engineSessionContext.lastTurnDispatch;
6305
6324
  this.hostStart = null;
6306
6325
  engineSessionContext.lastTurnRecovery = { key: record.key, sequence: record.sequence, status: record.status, hold: true, reason: 'incompatible_recovery_identity', deferredInput: contextEntry };
@@ -6323,6 +6342,7 @@ export class WorkflowEngine {
6323
6342
  this.reconstructVariableReferences();
6324
6343
  engineSessionContext.lastTurnToolCalls = [];
6325
6344
  delete engineSessionContext.lastFlowOutcome;
6345
+ delete engineSessionContext.lastFlowRecovery;
6326
6346
  delete engineSessionContext.lastTurnDispatch;
6327
6347
  this.hostStart = null;
6328
6348
  recoveredAction = true;
@@ -6658,6 +6678,14 @@ export class WorkflowEngine {
6658
6678
  }
6659
6679
  // Stamp the one-shot host-facing outcome for a flow that terminated this turn
6660
6680
  // (sessionContext is private; finalizeFlowTransaction goes through this).
6681
+ stampFlowRecovery(recovery) {
6682
+ const value = validateFlowRecovery(recovery);
6683
+ if (value.form && this.cargo?.forms?.[value.form]?.definition !== value.flow)
6684
+ throw new Error('Recovery form ownership mismatch');
6685
+ if (!this.sessionContext)
6686
+ throw new Error('Flow recovery requires an active session');
6687
+ this.sessionContext.lastFlowRecovery = value;
6688
+ }
6661
6689
  stampFlowOutcome(outcome) {
6662
6690
  if (this.sessionContext) {
6663
6691
  this.sessionContext.lastFlowOutcome = outcome;
@@ -6695,6 +6723,7 @@ export class WorkflowEngine {
6695
6723
  clearFlowOutcome() {
6696
6724
  if (this.sessionContext) {
6697
6725
  delete this.sessionContext.lastFlowOutcome;
6726
+ delete this.sessionContext.lastFlowRecovery;
6698
6727
  }
6699
6728
  else {
6700
6729
  logger.warn('No session context available for clearFlowOutcome');
@@ -7087,9 +7116,9 @@ export class WorkflowEngine {
7087
7116
  case 'DISPATCH': {
7088
7117
  // DISPATCH always routes the turn's own input — no value. It may declare the ending of the
7089
7118
  // flows it ends (`outcome` / `reason`, kept only when no flow matches).
7090
- const extra = Object.keys(step).filter(k => !['id', 'type', 'outcome', 'reason'].includes(k));
7119
+ const extra = Object.keys(step).filter(k => !['id', 'type', 'outcome', 'reason', 'recovery'].includes(k));
7091
7120
  if (extra.length > 0) {
7092
- state.errors.push(`DISPATCH step "${step.id}" in flow "${flowDef.name}" has invalid attribute(s) ${extra.map(k => `"${k}"`).join(', ')} - DISPATCH takes only "id", "outcome" and "reason"`);
7121
+ state.errors.push(`DISPATCH step "${step.id}" in flow "${flowDef.name}" has invalid attribute(s) ${extra.map(k => `"${k}"`).join(', ')} - DISPATCH takes only "id", "outcome", "reason" and "recovery"`);
7093
7122
  }
7094
7123
  else {
7095
7124
  // well-formed
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:e22c79845d34c8eaf8fa259acaddd4bc3c5a8999202e1c7eee690187f475a760";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:8bda7ef27c22853a43dfc6734c548115e2b5855e6bb56eeb48eddc5acdf6a820";
@@ -23,3 +23,9 @@ Native performer declarations from 1.7.1 include `contract.requires: ['guardedAc
23
23
  Session-only opt-out (1.7.1) requires `config.jsfe.actionPersistence:'session-only'`, no attached journal, and `durableActions` absent or false. The engine defaults to durable and missing storage still fails closed. Session-only retains confirmation, subject, revision, gate and session-owned attempted/completed/unknown guards, but cannot recover an effect after its updated conversation save is lost. It creates no durable receipts or journal traffic. Action-enabled conversations pin their mode before the first effect; changing the mode of an existing conversation or abandoning durable recovery metadata is rejected. Apply the new mode to fresh conversations and keep existing conversations on their original routing. See [session-only semantics](forms.md#explicit-session-only-action-persistence-171).
24
24
 
25
25
  Publishing the package, deploying the host or uploading tenant/system flow sets are separate release actions requiring the owner's authorization. A release should replace local tarball dependencies with the exact published package whose bytes were accepted, and deploy matched host/system/tenant contracts together. No deployment is implied by a passing local candidate.
26
+
27
+ ## 1.7.2 retry/yield/recovery acceptance
28
+
29
+ Native contextual misses default to one localized re-ask then DISPATCH of the second current utterance. Validation attempts and declared exhaustion callbacks are independent. Dynamic question refresh, explicit localized retries, nested/out-of-order input, provider detours and recognized clarification questions require behavioral assertions. A required draft yields pending; a failed service stays unresolved; a completed optional follow-up stays completed; unknown effects remain held. The host must consume explicit recovery rather than infer restartability from `unresolved`. Unannotated legacy JSON retains its historical path.
30
+
31
+ Acceptance must include real engine-produced states through the actual host outcome and consume-once guidance adapter, not only helper snapshots. Verify English/Spanish and voice/text, “imposible” never confirms, exact price-reference utterance handoff, same root/accepted values on resume, fresh consent after correction, validator-specific limits, completed receipts, unknown-action holds, matched dispatch suppression and next-turn clearing. Run full engine and tenant matrices and clean consumer installs; Shopify behavior is outside this release and its source/artifact bytes must remain unchanged.
package/docs/forms.md CHANGED
@@ -43,7 +43,7 @@ Resolve overlapping evidence in this order: current field, one matching field at
43
43
 
44
44
  The common loop asks the first ready missing required input, skips accepted data, unwinds inapplicable children and blocks unresolved prerequisites. A context service may use `stop` and `close_on_stop:true` to close itself without handing a value to its parent. With `resume_on_parent_change:true`, an accepted owner correction closes the stale context service and resumes the same owned form with its retained progress, requiring a fresh confirmation. `RETURN` ends the entire engine transaction; ordinary worker completion uses `END`.
45
45
 
46
- Optional follow-ups may declare `incomplete_outcome:{outcome:'resolved',reason:'payment_made'}` to preserve an already completed task’s outcome when collection cannot finish or the user leaves. Accepted outcome values are `resolved`, `unresolved` and `deflected`, with a nonempty reason. A reusable form may instead use `incomplete_outcome:{from:'completed_outcome'}` with a declared object parameter; its runtime value must pass the same validation. The nearest actual owned ancestor supplies a fallback to a child. Another task’s outcome never does. The policy covers missing input specifications, blocked dependencies, exhausted validation/retries and unmatched collection/confirmation dispatch; it does not complete missing inputs or authorize effects. Omit it for ordinary required forms, which retain their existing unresolved outcomes and reasons.
46
+ Optional follow-ups may declare `incomplete_outcome:{outcome:'resolved',reason:'payment_made'}` to preserve an already completed task’s outcome when collection cannot finish or the user leaves. Accepted outcome values are `resolved`, `unresolved` and `deflected`, with a nonempty reason. A reusable form may instead use `incomplete_outcome:{from:'completed_outcome'}` with a declared object parameter; its runtime value must pass the same validation. The nearest actual owned ancestor supplies a fallback to a child. Another task’s outcome never does. The policy covers missing input specifications, blocked dependencies, exhausted validation/retries and unmatched collection/confirmation dispatch; it does not complete missing inputs or authorize effects. Omit it for ordinary required forms: contextual yields are pending, while actual validation or service failures remain unresolved.
47
47
 
48
48
  For bounded collection recovery, declare `on_exhausted:'recovery-worker'` on an input or FORM. On attempt exhaustion, the resolver checks the failed input/member, its group, then its containing form before walking actual owned ancestors. The worker receives `{form,failed_form,input,failed_input,reason:'attempts_exhausted'}`: `form` and `input` identify the selected policy’s owner, while `failed_form` and `failed_input` identify the original failure. Shared recovery resets only the selected input branch, closes its child without handing off an incomplete value, withdraws confirmation and reboots to that worker. Independent draft fields remain. The callback must deliberately collect a new choice and obtain any required fresh confirmation before an effect; exhaustion is not consent. Worker names and references are validated. With no callback, the existing incomplete-outcome or give-up path applies.
49
49
 
@@ -103,6 +103,22 @@ Historical plaintext remains readable. Unsupported envelopes, corrupt data, inte
103
103
 
104
104
  Roll out decoder-capable readers before enabling any tenant’s binary writer. Old workers in a mixed fleet cannot read new envelopes. A pre-reader rollback requires lossless, revision-checked conversion and verification of every affected row; a flag toggle alone is insufficient. Existing native continuations and pending/unknown actions must remain on a compatible recovery service when native starts are disabled. Never hand them to legacy execution or reset them to manufacture rollback compatibility.
105
105
 
106
+ ## Retry, yield and recovery contract (1.7.2)
107
+
108
+ Unreadable answers and rejected candidate values are different events. Native collection records consecutive unrecognized answers in `forms[id].misses[input]`. `max_misses` defaults to 2: the first miss gets one clarification, and the second DISPATCHes that exact current utterance without giving up or erasing the draft. A positive integer override can declare another bounded policy. `max_attempts` continues to bound validator-rejected candidates independently; declared `on_exhausted` workers retain their precedence and branch recovery. Recognition of a field, ambiguity, or provider question resets the current contextual-miss budget. An accepted out-of-order answer never produces a miss apology.
109
+
110
+ The shared renderer builds the active question after preparation/refresh, including `question_from`. After a miss it uses the explicit retry for that language, if supplied; otherwise it prefixes the current localized question with “Sorry, I didn't catch that.” / “Disculpe, no le entendí.” Feedback is consumed once, so provider detours and ordinary reentry do not repeat an apology. Validator feedback does not acquire a generic unreadable-answer apology. Exact confirmation and ambiguity clarification use the same two-miss yield policy; declared clarification questions do not consume that budget. None of these paths authorizes an action, and a correction still invalidates consent.
111
+
112
+ Business outcome and recovery guidance are independent. Contextual DISPATCH declares `pending`; affected transactions are `yielded`, neither completed nor failed. An actual validation/service failure remains `unresolved`. An owned completed-task fallback remains `resolved`, including abandonment of an optional receipt after an approved payment. Existing declared incomplete-outcome overrides retain their business meaning.
113
+
114
+ An optional step attribute `recovery` declares `{version:1,mode,reason,form?,flow?}`. Modes are `resume`, `restart`, `hold` and `none`. `resume` requires the identity of a retained owned form and its definition. The runtime validates that identity before executing the annotated step. A SET or FLOW may annotate a subsequent failure handoff; terminal END/RETURN/DISPATCH can declare it directly. Attribute strings support normal step interpolation. The engine exposes the validated declaration as `session.lastFlowRecovery` for that turn only. A matched DISPATCH target consumes the earlier flow's outcome and recovery; a no-match handoff preserves them for the host. The next turn clears both one-shot records.
115
+
116
+ Shared native yields refer to the actual root form and retain accepted values and nested drafts. Structural/provider failures declare no automatic recovery when resumability is not established. An attempted/unknown action in the owned task instead requires `hold`: elapsed time, an unrelated question or a renewed YES cannot authorize another charge. No recovery descriptor executes an action or bypasses authentication, validation or fresh confirmation.
117
+
118
+ Hosts compose guidance using `flowHandoffInfo(result)` and `renderFlowRecovery(note)` from `jsfe/host`. A contextual yield answers the current request without claiming the task failed. A resumable failure can offer return to the retained task. Only explicit `restart` can require starting over; `hold` prohibits repeat/restart advice for an uncertain effect, and `none` makes no invented recovery promise. Explicit resolved/deflected outcomes clear an obsolete note. Without recovery metadata the helpers return undefined, preserving the host's historical compatibility path. Internal IDs and machine reasons are not user-facing wording.
119
+
120
+ These changes belong to the new shared native workers and declarations. Existing loaded legacy flow/step JSON without these attributes keeps its prior retry and outcome behavior. Regenerate the dev system and tenant native sets from the matched JSFE package; do not deploy a new shared set with an older engine or helper registry. Hosts retain responsibility for serializing turns and persisting the whole returned session; action persistence guarantees are unchanged.
121
+
106
122
  ## Explicit monetary grammar and compatibility
107
123
 
108
124
  `amountInAnswer(text)` and `isAmountAnswer(text)` preserve the published JSFE 1.6 behavior. Installing native FORM support does not make existing production flows accept cardinal words or treat pesos as dollar markers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "TypeScript workflow engine for conversational/automation apps: multi-flow orchestration, interrupt/resume, stack-based control, robust errors, and flexible tool/REST integration.",
5
5
  "license": "MIT",
6
6
  "author": "Ron Pinkas",