jsfe 1.101.5 → 1.102.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/forms/declarations.js +1 -1
- package/dist/forms/flows.d.ts +3 -1
- package/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +9 -1
- package/dist/forms/form-client.d.ts +14 -0
- package/dist/forms/form-client.d.ts.map +1 -1
- package/dist/forms/form-client.js +12 -3
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +2 -1
- package/dist/forms/send-copy-flow.d.ts.map +1 -1
- package/dist/forms/send-copy-flow.js +39 -26
- package/dist/helpers/answer.d.ts +1 -0
- package/dist/helpers/answer.d.ts.map +1 -1
- package/dist/helpers/answer.js +6 -1
- package/dist/helpers/money.js +2 -2
- package/dist/runtime-identity.js +1 -1
- package/docs/architecture-guide.md +5 -0
- package/docs/copilot-reference.md +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm i jsfe
|
|
|
14
14
|
- **[README.md](README.md)** - Technical API reference (this document)
|
|
15
15
|
- **[Flows architecture guide](docs/architecture-guide.md)** - start here: the concepts, the building blocks, what the caller experiences, and how conversational AI and exact transactional flows work together (the reply ranker and DISPATCH)
|
|
16
16
|
- **[Flow author reference](docs/copilot-reference.md)** - the authoritative engine and JSON authoring specification for flow authors and AI flow generators (shipped in the package; the Flow Designer's CoPilot reads it from the published version, so change it with the engine)
|
|
17
|
-
- **[Form client adapter](docs/form-client.md)** - optional: a host renders the pending FORM question as a form for a capable client and reads its strict named submission through the same FORM workers; an input may name its control (`form_client`: date, date range, number since jsfe 1.44.0; place (city or address suggestions from the host) since 1.46.0)
|
|
17
|
+
- **[Form client adapter](docs/form-client.md)** - optional: a host renders the pending FORM question as a form for a capable client and reads its strict named submission through the same FORM workers; an input may name its control (`form_client`: date, date range, number since jsfe 1.44.0; place (city or address suggestions from the host) since 1.46.0); a form's `introduction` heads the card since 1.102.0
|
|
18
18
|
- **[Sendables](docs/sendables.md)** - what a flow can send the caller (registered sendables and their media) and how a host delivers it
|
|
19
19
|
- **[Engine internals](docs/engine-internals.md)** - how the engine runs a turn: stacks, the form loop, attempts, queued lines and every exit
|
|
20
20
|
- **[Template interpolation design notes](docs/template-interpolation-design-notes.md)** - how `{{...}}` templates are resolved
|
|
@@ -464,6 +464,11 @@ question asked again ("Sorry, I didn't catch that. " / "Disculpe, no le entendí
|
|
|
464
464
|
and the provider menu. A flow set that sets `cargo.sorryByName = true` (for example once the caller is verified) gets it with
|
|
465
465
|
`cargo.displayName` ("Disculpe, Ana, no le entendí. "); without it the wording is unchanged.
|
|
466
466
|
|
|
467
|
+
**A form's introduction (jsfe 1.102.0, owner 2026-12-03):** `introduction` / `introduction_es` on a form is plain text (a `{{...}}`
|
|
468
|
+
fails at definition time; without the Spanish the text is said as written) said once for the form instance, before `before` and
|
|
469
|
+
the first question. `projectForm` carries it as `introduction`, with `question` when the reply asks the input's declared question
|
|
470
|
+
in exactly its words, so a client draws both on its card and leaves them out of the message (docs/form-client.md).
|
|
471
|
+
|
|
467
472
|
**Acknowledging only data, opt-in (jsfe 1.20.0):** a form declaring `acknowledge: 'data'` (or the nearest enclosing form
|
|
468
473
|
that declares it) says "Got it, your …" / "Okay, I noted your …" only for a value the caller supplied, an input whose profile
|
|
469
474
|
kind is digits, email, phone, amount, identifier, account or text. A pick among offered words (`choice`, `pattern`), such as
|
|
@@ -4,7 +4,7 @@ import { linkFormSchemas, validateFlowContracts } from './contracts.js';
|
|
|
4
4
|
import { compileFormPrompts } from './prompt-compiler.js';
|
|
5
5
|
import { withSafetyRevision } from './continuation-safety.js';
|
|
6
6
|
import { capturedAuthorSpec, copyAuthorSpec, authoredExpressions } from './declaration-capture.js';
|
|
7
|
-
const formKeys = new Set(['inputs', 'before', 'after', 'confirm', 'before_confirm', 'declined', 'stop', 'close_on_stop', 'resume_on_parent_change', 'done', 'validator', 'confirmation_condition', 'prompt', 'prompt_es', 'incomplete_outcome', 'on_exhausted', 'on_no', 'must_complete', 'first_task', 'first_task_es', 'user_description', 'user_description_es', 'acknowledge']);
|
|
7
|
+
const formKeys = new Set(['inputs', 'before', 'after', 'confirm', 'before_confirm', 'declined', 'stop', 'close_on_stop', 'resume_on_parent_change', 'done', 'validator', 'confirmation_condition', 'prompt', 'prompt_es', 'incomplete_outcome', 'on_exhausted', 'on_no', 'must_complete', 'first_task', 'first_task_es', 'user_description', 'user_description_es', 'introduction', 'introduction_es', 'acknowledge']);
|
|
8
8
|
const sharedKeys = ['id', 'name', 'description', 'version', 'scope', 'primary', 'parameters', 'contract', 'parameterInstructions'];
|
|
9
9
|
const safe = /^[A-Za-z_$][\w$]*$/;
|
|
10
10
|
const fail = message => { throw new Error('Flow declaration: ' + message); };
|
package/dist/forms/flows.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export function validateRankParameters(id: any, name: any, what: any, list: any)
|
|
|
17
17
|
* confirmation is soft, a plain form's (no action) included (owner 2026-11-09). confirm.exact is separate: it binds the
|
|
18
18
|
* action to the confirmed values, whatever the confirmation's firmness. */
|
|
19
19
|
export function confirmationFirmness(performs: any): "firm" | "soft";
|
|
20
|
-
export function formFlow({ id, name, version, description, inputs, after, extraVars, parameters, confirm, confirm_soft, before_confirm, declined, stop, close_on_stop, on_no, resume_on_parent_change, before, done, primary, scope, validator, confirmation_condition, prompt, prompt_es, incomplete_outcome, on_exhausted, must_complete, first_task, first_task_es, user_description, user_description_es, acknowledge }: {
|
|
20
|
+
export function formFlow({ id, name, version, description, inputs, after, extraVars, parameters, confirm, confirm_soft, before_confirm, declined, stop, close_on_stop, on_no, resume_on_parent_change, before, done, primary, scope, validator, confirmation_condition, prompt, prompt_es, incomplete_outcome, on_exhausted, must_complete, first_task, first_task_es, user_description, user_description_es, introduction, introduction_es, acknowledge }: {
|
|
21
21
|
id: any;
|
|
22
22
|
name: any;
|
|
23
23
|
version: any;
|
|
@@ -49,6 +49,8 @@ export function formFlow({ id, name, version, description, inputs, after, extraV
|
|
|
49
49
|
first_task_es?: string | undefined;
|
|
50
50
|
user_description?: string | undefined;
|
|
51
51
|
user_description_es?: string | undefined;
|
|
52
|
+
introduction?: string | undefined;
|
|
53
|
+
introduction_es?: string | undefined;
|
|
52
54
|
acknowledge?: string | undefined;
|
|
53
55
|
}): {
|
|
54
56
|
variables: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AAqIA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAsGD;;2EAE2E;AAC3E,qEAEC;AACD
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AAqIA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAsGD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgFC;AACD;;;GAGG;AACH;;;;;;EAGC;AAsoBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AA59BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2J9G,4CAEqI;AA4hCrI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
|
package/dist/forms/flows.js
CHANGED
|
@@ -291,8 +291,13 @@ function validateFormClientControls(id, inputs) {
|
|
|
291
291
|
export function confirmationFirmness(performs) {
|
|
292
292
|
return Array.isArray(performs) && performs.some((action) => action?.effect === 'charge') ? 'firm' : 'soft';
|
|
293
293
|
}
|
|
294
|
-
export function formFlow({ id, name, version, description, inputs, after = [], extraVars = {}, parameters = [], confirm = null, confirm_soft = confirmationFirmness([]) === 'soft', before_confirm = [], declined = [], stop = '', close_on_stop = false, on_no = '', resume_on_parent_change = false, before = [], done = true, primary = false, scope = 'isolated', validator = '', confirmation_condition = 'true', prompt = undefined, prompt_es = undefined, incomplete_outcome = null, on_exhausted = null, must_complete = false, first_task = '', first_task_es = '', user_description = '', user_description_es = '', acknowledge = 'all' }) {
|
|
294
|
+
export function formFlow({ id, name, version, description, inputs, after = [], extraVars = {}, parameters = [], confirm = null, confirm_soft = confirmationFirmness([]) === 'soft', before_confirm = [], declined = [], stop = '', close_on_stop = false, on_no = '', resume_on_parent_change = false, before = [], done = true, primary = false, scope = 'isolated', validator = '', confirmation_condition = 'true', prompt = undefined, prompt_es = undefined, incomplete_outcome = null, on_exhausted = null, must_complete = false, first_task = '', first_task_es = '', user_description = '', user_description_es = '', introduction = '', introduction_es = '', acknowledge = 'all' }) {
|
|
295
295
|
validateFormExhaustion(on_exhausted);
|
|
296
|
+
for (const [key, text] of Object.entries({ introduction, introduction_es }))
|
|
297
|
+
if (typeof text !== 'string' || text.includes('{{'))
|
|
298
|
+
throw new Error(`FORM ${id}: ${key} must be plain text`);
|
|
299
|
+
if (introduction_es && !introduction)
|
|
300
|
+
throw new Error(`FORM ${id}: introduction_es needs introduction`);
|
|
296
301
|
if (acknowledge !== 'all' && acknowledge !== 'data')
|
|
297
302
|
throw new Error(`FORM ${id}: acknowledge must be 'all' or 'data'`);
|
|
298
303
|
if (on_no !== '' && (typeof on_no !== 'string' || !/^[\w-]+$/.test(on_no)))
|
|
@@ -347,6 +352,9 @@ export function formFlow({ id, name, version, description, inputs, after = [], e
|
|
|
347
352
|
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)'),
|
|
348
353
|
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)`),
|
|
349
354
|
...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)}]`)),
|
|
355
|
+
// The introduction is said once for an instance, before anything the form does; a card shows it itself (projectForm).
|
|
356
|
+
...(introduction ? [WHEN(`${id}_introduce`, '!cargo.forms[form_instance].introduction', SAY(`${id}_introduction`, introduction, introduction_es || introduction)),
|
|
357
|
+
SIDE(`${id}_introduced`, `(cargo.forms[form_instance].introduction = ${JSON.stringify({ en: introduction, es: introduction_es || introduction })}, true)`)] : []),
|
|
350
358
|
...before,
|
|
351
359
|
SET(`${id}_initial`, 'initial_readings', 'form_internal_resume ? [] : formInitialReadings(cargo.forms[form_instance], currentContext, cargo)'),
|
|
352
360
|
WHEN(`${id}_accept_initial`, 'initial_readings.length > 0', FLOW(`${id}_initial_accept`, 'collect-input-accept', 'call', { hits: '{{initial_readings}}' })),
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
/** A public rendering projection, never a serialized flow, executable expression, or session. */
|
|
2
2
|
export function projectForm(session: any, flows: any): {
|
|
3
|
+
fields: any;
|
|
4
|
+
question: string;
|
|
5
|
+
introduction: any;
|
|
6
|
+
version: number;
|
|
7
|
+
form: any;
|
|
8
|
+
language: any;
|
|
9
|
+
} | {
|
|
10
|
+
fields: any;
|
|
11
|
+
question?: undefined;
|
|
12
|
+
introduction: any;
|
|
3
13
|
version: number;
|
|
4
14
|
form: any;
|
|
5
15
|
language: any;
|
|
16
|
+
} | {
|
|
6
17
|
fields: any;
|
|
18
|
+
version: number;
|
|
19
|
+
form: any;
|
|
20
|
+
language: any;
|
|
7
21
|
} | null;
|
|
8
22
|
/**
|
|
9
23
|
* The options of the question asked now, when it has a closed, labelled set, for a client that draws them as buttons or a list:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-client.d.ts","sourceRoot":"","sources":["../../src/forms/form-client.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-client.d.ts","sourceRoot":"","sources":["../../src/forms/form-client.js"],"names":[],"mappings":"AA0CA,iGAAiG;AACjG;;;;;;;;;;;;;;;;;;;SA6HC;AAMD;;;;;;;;GAQG;AACH;;;;;;;;SAoBC;AAED;;;;yGAIyG;AACzG,oDAyBC;AACD,+GAA+G;AAC/G;wHACwH;AACxH,qEAWC;AAED;;;;SA4CC;AAED;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDC;AA5VD,qCAAsC,eAAe,CAAC"}
|
|
@@ -25,8 +25,16 @@ const pendingForm = session => {
|
|
|
25
25
|
return null;
|
|
26
26
|
state = parent;
|
|
27
27
|
}
|
|
28
|
-
return { state, context };
|
|
28
|
+
return { state, context, frame };
|
|
29
29
|
};
|
|
30
|
+
/** The question asked now, when it is exactly the one its input declares. With anything else in it (a refusal, an
|
|
31
|
+
* acknowledgment, a computed wording) the card does not stand for it and it is left out. */
|
|
32
|
+
function askedPlainly(frame, root, context, language) {
|
|
33
|
+
const input = root.id === context.form && (root.specs || []).find(spec => spec.name === context.current);
|
|
34
|
+
const words = source => source ? (language === 'es' ? source.question_es || source.question : source.question) : undefined;
|
|
35
|
+
const asked = words(frame.variables);
|
|
36
|
+
return typeof asked === 'string' && asked && asked === words(input) ? { question: asked } : {};
|
|
37
|
+
}
|
|
30
38
|
/** Today in an IANA time zone, moved by whole days, as YYYY-MM-DD (UTC arithmetic: no DST shift). */
|
|
31
39
|
function daysFromToday(days, timeZone) {
|
|
32
40
|
const [year, month, day] = new Intl.DateTimeFormat('en-CA', { timeZone, year: 'numeric', month: '2-digit', day: '2-digit' }).format(new Date()).split('-').map(Number);
|
|
@@ -42,7 +50,7 @@ export function projectForm(session, flows) {
|
|
|
42
50
|
const pending = pendingForm(session);
|
|
43
51
|
if (!pending)
|
|
44
52
|
return null;
|
|
45
|
-
const { state: root, context } = pending, cargo = session.cargo, language = session.language || 'en';
|
|
53
|
+
const { state: root, context, frame } = pending, cargo = session.cargo, language = session.language || 'en';
|
|
46
54
|
// Both the code field and its free-text fallback can contain the one-time code.
|
|
47
55
|
const collectingOtp = session.flowStacks.flat().some(frame => frame.flowId === 'get-and-validate-otp-code');
|
|
48
56
|
let askedShown = false;
|
|
@@ -190,7 +198,8 @@ export function projectForm(session, flows) {
|
|
|
190
198
|
const plain = field => field.kind !== 'choice' && !field.control && !field.sensitive;
|
|
191
199
|
if (leaves.length === 1 && plain(leaves[0]))
|
|
192
200
|
return null;
|
|
193
|
-
|
|
201
|
+
const introduction = root.introduction && String(language === 'es' ? root.introduction.es : root.introduction.en);
|
|
202
|
+
return { version: 1, form: root.id, language, ...(introduction ? { introduction, ...askedPlainly(frame, root, context, language) } : {}), fields: projected };
|
|
194
203
|
}
|
|
195
204
|
const STANDARD_LABELS = { yes: { en: 'Yes', es: 'Sí' }, no: { en: 'No', es: 'No' } };
|
|
196
205
|
const MAX_CHOICE_OPTIONS = 12;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAkDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,0CAYC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAYC;AAED;;kGAEkG;AAClG,0FASC;AAED;kIACkI;AAClI;;;;SAUC;AAiID,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;
|
|
1
|
+
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAkDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,0CAYC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAYC;AAED;;kGAEkG;AAClG,0FASC;AAED;kIACkI;AAClI;;;;SAUC;AAiID,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAmKD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAYD,oGAOC;AAnRD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAsSzC,0BAAsK"}
|
|
@@ -443,7 +443,8 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
|
|
|
443
443
|
default: effect('otp_reply_route_none', 'true')
|
|
444
444
|
}),
|
|
445
445
|
effect('otp_word_count', '(cargo.otpWordMisses=Number(cargo.otpWordMisses || 0)+(no_code_given?1:0),true)'),
|
|
446
|
-
|
|
446
|
+
// Words alone end it at the sixth reply (owner 2026-12-04): at the third, callers still getting or saying the code lost it.
|
|
447
|
+
when('otp_word_cap', 'no_code_given && cargo.otpWordMisses >= 6', verificationEnd('otp_word_end')),
|
|
447
448
|
// a reason for the call authentication serves is acknowledged: verification comes first
|
|
448
449
|
when('otp_usecase_ack', "no_code_given && otp_reply && String(otp_reply.key || '').indexOf('usecase:') === 0", say('otp_usecase_explain', 'Understood. First we need to finish verifying your identity. I sent you a message with a six-digit code in it. Read those six digits back to me. You can also {{cargo.verb}} EXIT to cancel.', "Entendido. Primero necesitamos completar la verificación de su identidad. Le envié un mensaje con un código de seis dígitos. Dígame esos seis dígitos. También puede {{cargo.voice ? 'decir' : 'escribir'}} SALIR para cancelar.")),
|
|
449
450
|
when('otp_explanation', "no_code_given && !(no_code_given && otp_reply && String(otp_reply.key || '').indexOf('usecase:') === 0)", say('otp_explain', 'Let me explain. I sent you a message with a six-digit code in it. Read those six digits back to me. You can also {{cargo.verb}} EXIT to cancel.', "Le explico. Le envié un mensaje con un código de seis dígitos. Dígame esos seis dígitos. También puede {{cargo.voice ? 'decir' : 'escribir'}} SALIR para cancelar.")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"AAqPA,0BAAmD"}
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
* - The web chat link (WEB_LINK_KEY, owner 2026-11-26: "can I continue this on my computer?") is made at send time by the
|
|
16
16
|
* host's get-web-chat-link tool. With no medium or destination named it is texted to the caller's number, else emailed to
|
|
17
17
|
* the email on file, else the medium is asked; any number or email the caller names is used, as for any item.
|
|
18
|
-
* -
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* - The email on file is a verified customer's only: cargo.accountEmail, which the tenant sets from the verified account, else
|
|
19
|
+
* the address the code went to. It is offered in full when no address was given (owner 2026-12-03).
|
|
20
|
+
* - Any item to a target that is not the caller's own (their phone, the verified cell, the email on file) is read back once and
|
|
21
|
+
* sent only on YES: ask-email's read-back is that question for an address it collected, and a second one is asked only when
|
|
22
|
+
* the item has a warning (owner 2026-12-03): the web link, the whole conversation, or a registered document that declares
|
|
23
|
+
* a disclaimer (owner 2026-11-26: anything in the chat may be sensitive). A sender item's own flow gates its destination.
|
|
21
24
|
* No authentication gate here (owner rule: an authenticated caller's chat and documents are theirs to send anywhere;
|
|
22
25
|
* before authentication no reply holds account data). A sender flow gates its own document.
|
|
23
26
|
*/
|
|
@@ -43,7 +46,7 @@ const sendCopy = defineWorker({
|
|
|
43
46
|
contract: { role: 'router', summary: 'Sends a reply, registered document, the whole conversation or a link to continue it on the web, as the caller picks, by text or email, through the system send workers or the document\'s sender flow' },
|
|
44
47
|
id: 'send-copy',
|
|
45
48
|
name: 'SendCopy',
|
|
46
|
-
version: '1.
|
|
49
|
+
version: '1.4.0',
|
|
47
50
|
primary: true,
|
|
48
51
|
prompt: 'Send a copy',
|
|
49
52
|
prompt_es: 'Enviar una copia',
|
|
@@ -57,7 +60,7 @@ const sendCopy = defineWorker({
|
|
|
57
60
|
],
|
|
58
61
|
variables: vars({
|
|
59
62
|
noop: false, sc_items: [], sc_key: '', sc_item: null, sc_last: null, sc_last_head: '', sc_offer_q: '', sc_offer_q_es: '', sc_doc_list: '', sc_email: '', sc_phone: '',
|
|
60
|
-
sc_medium: '', sc_medium_q: '', sc_medium_q_es: '', sc_given: '', sc_other: false, sc_too_long: false, sc_media: [], sc_forced: '', sc_to: '', sc_subject: '', sc_content: '', sc_sent: false, sc_link: '',
|
|
63
|
+
sc_medium: '', sc_medium_q: '', sc_medium_q_es: '', sc_given: '', sc_other: false, sc_too_long: false, sc_media: [], sc_forced: '', sc_to: '', sc_subject: '', sc_content: '', sc_sent: false, sc_link: '', sc_on_file: '', sc_account_email: false, sc_email_q: '', sc_email_q_es: '', sc_read_back: false, sc_ask: false, sc_warning: '', sc_warning_es: '', sc_target: '', sc_confirm_q: '', sc_confirm_q_es: '',
|
|
61
64
|
}),
|
|
62
65
|
steps: [
|
|
63
66
|
set('sc_items', 'sc_items', 'sendables(cargo)'),
|
|
@@ -89,9 +92,12 @@ const sendCopy = defineWorker({
|
|
|
89
92
|
set('sc_email', 'sc_email', `${EMAIL_IN_JS}(typeof destination === 'string' ? destination : '')`),
|
|
90
93
|
set('sc_phone', 'sc_phone', "readPhone(typeof destination === 'string' ? destination : '')"),
|
|
91
94
|
set('sc_medium', 'sc_medium', "typeof medium === 'string' && (medium === 'text' || medium === 'email') ? medium : sc_email ? 'email' : sc_phone ? 'text' : ''"),
|
|
95
|
+
// the email on file: the verified account's, else the address the verification code went to
|
|
96
|
+
set('sc_on_file', 'sc_on_file', "cargo.otpVerified === true ? [cargo.accountEmail, cargo.otp_email].map(function (e) { return String(e || '').trim(); }).find(function (e) { return validateEmail(e); }) || '' : ''"),
|
|
97
|
+
set('sc_account_email', 'sc_account_email', "!!sc_on_file && sc_on_file === String(cargo.accountEmail || '').trim()"),
|
|
92
98
|
// the web chat link: texted to the caller's number when nothing was named, else emailed to the email on file
|
|
93
99
|
when('sc_link_text', "sc_item.kind === 'web_link' && !sc_medium && !!cargo.twilioNumber && !!textDestination(cargo)", set('sc_link_text_set', 'sc_medium', "'text'")),
|
|
94
|
-
when('sc_link_email', "sc_item.kind === 'web_link' && !sc_medium &&
|
|
100
|
+
when('sc_link_email', "sc_item.kind === 'web_link' && !sc_medium && !!sc_on_file", set('sc_link_email_set', 'sc_email', 'sc_on_file')),
|
|
95
101
|
when('sc_link_email_medium', "sc_item.kind === 'web_link' && !sc_medium && !!sc_email", set('sc_link_email_medium_set', 'sc_medium', "'email'")),
|
|
96
102
|
when('sc_link', "sc_item.kind === 'web_link'", { id: 'sc_link_call', type: 'CALL-TOOL', tool: 'get-web-chat-link', variable: 'sc_link', args: {}, onFail: set('sc_link_failed', 'sc_link', "''") }),
|
|
97
103
|
when('sc_link_none', "sc_item.kind === 'web_link' && !sc_link", say('sc_link_none_say', "Sorry, I couldn't make a link to continue on the web." + ANYTHING_ELSE, 'Lo siento, no pude crear un enlace para continuar en la web.' + ANYTHING_ELSE_ES)),
|
|
@@ -138,7 +144,9 @@ const sendCopy = defineWorker({
|
|
|
138
144
|
question: 'What email address should I send it to?', question_es: '¿A qué correo electrónico se lo envío?', on_file: '',
|
|
139
145
|
})),
|
|
140
146
|
when('sc_other_email_read', "sc_other && sc_medium === 'email'", set('sc_other_email_set', 'sc_email', "cargo.email && validateEmail(String(cargo.email)) ? String(cargo.email) : ''")),
|
|
141
|
-
when('
|
|
147
|
+
when('sc_other_email_heard', "sc_other && sc_medium === 'email'", set('sc_other_email_read_back', 'sc_read_back', 'true')),
|
|
148
|
+
when('sc_other_email_bad', "sc_other && sc_medium === 'email' && !sc_email", say('sc_other_email_bad_say', "Sorry, I couldn't read that email address, so I didn't send it." + ANYTHING_ELSE, 'Lo siento, no pude entender ese correo electrónico, así que no lo envié.' + ANYTHING_ELSE_ES)),
|
|
149
|
+
when('sc_other_email_end', "sc_other && sc_medium === 'email' && !sc_email", end('sc_other_email_done', { outcome: 'unresolved', reason: 'no_email' })),
|
|
142
150
|
// a sender item: its flow collects what it needs (destination, identity) and tells the caller every outcome
|
|
143
151
|
set('sc_given', 'sc_given', "sc_medium === 'email' ? sc_email : sc_phone"),
|
|
144
152
|
when('sc_sender_reset', '!!sc_item.sender', effect('sc_sender_reset_set', 'cargo.copyHandled = false')),
|
|
@@ -160,25 +168,30 @@ const sendCopy = defineWorker({
|
|
|
160
168
|
when('sc_number_bad', "sc_medium === 'text' && !cargo.textTo", say('sc_number_bad_say', "Sorry, I couldn't read that phone number." + ANYTHING_ELSE, 'Lo siento, no pude entender ese número de teléfono.' + ANYTHING_ELSE_ES)),
|
|
161
169
|
when('sc_number_bad_end', "sc_medium === 'text' && !cargo.textTo", end('sc_number_bad_done', { outcome: 'unresolved', reason: 'no_phone_number' })),
|
|
162
170
|
when('sc_text_four', "sc_medium === 'text'", effect('sc_text_four_set', 'cargo.textTo4 = last4(cargo.textTo, cargo.voice)')),
|
|
163
|
-
// email: the address given, else asked
|
|
171
|
+
// email: the address given, else asked, offering the email on file
|
|
164
172
|
set('sc_to', 'sc_to', "sc_medium === 'email' && sc_email && validateEmail(sc_email) ? sc_email : ''"),
|
|
165
173
|
when('sc_email_clear', "sc_medium === 'email' && !sc_to", effect('sc_email_clear_set', "cargo.email = ''")),
|
|
174
|
+
set('sc_email_q', 'sc_email_q', "!sc_on_file ? 'What email address should I send it to?' : \"I'll email it to \" + emailSaid(sc_on_file, cargo.voice) + (sc_account_email ? ', the email on your account' : '') + (cargo.voice ? '. Press 1 or say OK to send it, or say a different email address.' : '. Type OK to send it, or type a different email address.')"),
|
|
175
|
+
set('sc_email_q_es', 'sc_email_q_es', "!sc_on_file ? '¿A qué correo electrónico se lo envío?' : 'Se lo enviaré a ' + emailSaid(sc_on_file, cargo.voice, true) + (sc_account_email ? ', el correo de su cuenta' : '') + (cargo.voice ? '. Presione 1 o diga OK para enviarlo, o diga otro correo electrónico.' : '. Escriba OK para enviarlo, o escriba otro correo electrónico.')"),
|
|
166
176
|
when('sc_ask_email', "sc_medium === 'email' && !sc_to", call('sc_ask_email_call', 'ask-email', {
|
|
167
|
-
question: '
|
|
168
|
-
question_es: '
|
|
169
|
-
on_file: '{{
|
|
177
|
+
question: '{{sc_email_q}}',
|
|
178
|
+
question_es: '{{sc_email_q_es}}',
|
|
179
|
+
on_file: '{{sc_on_file}}',
|
|
170
180
|
})),
|
|
181
|
+
when('sc_email_heard', "sc_medium === 'email' && !sc_to", set('sc_email_read_back', 'sc_read_back', 'true')),
|
|
171
182
|
when('sc_email_read', "sc_medium === 'email' && !sc_to", set('sc_email_pick', 'sc_to', "cargo.email && validateEmail(String(cargo.email)) ? String(cargo.email) : ''")),
|
|
172
|
-
when('
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
when('
|
|
181
|
-
when('
|
|
183
|
+
when('sc_email_none', "sc_medium === 'email' && !sc_to", say('sc_email_none_say', "Sorry, I couldn't read that email address, so I didn't send it." + ANYTHING_ELSE, 'Lo siento, no pude entender ese correo electrónico, así que no lo envié.' + ANYTHING_ELSE_ES)),
|
|
184
|
+
when('sc_email_none_end', "sc_medium === 'email' && !sc_to", end('sc_email_none_done', { outcome: 'unresolved', reason: 'no_email' })),
|
|
185
|
+
// a target that is not the caller's own (their phone, the verified cell, the email on file): sent only on YES. An address
|
|
186
|
+
// ask-email just read back has had its YES: only an item with a warning (the web link, the whole conversation, a registered
|
|
187
|
+
// document's disclaimer) is asked about again, saying why
|
|
188
|
+
set('sc_warning', 'sc_warning', "sc_item.kind === 'web_link' ? 'This link opens our conversation, including any account details, for whoever has it. ' : sc_item.kind === 'conversation' ? 'This is our whole conversation, including any account details. ' : sc_item.disclaimer ? String(sc_item.disclaimer) + ' ' : ''"),
|
|
189
|
+
set('sc_warning_es', 'sc_warning_es', "sc_item.kind === 'web_link' ? 'Este enlace abre nuestra conversación, incluidos los datos de su cuenta, para quien lo tenga. ' : sc_item.kind === 'conversation' ? 'Es toda nuestra conversación, incluidos los datos de su cuenta. ' : sc_item.disclaimer ? String(sc_item.disclaimer_es || sc_item.disclaimer) + ' ' : ''"),
|
|
190
|
+
set('sc_ask', 'sc_ask', "!(sc_medium === 'email' ? !!sc_on_file && [sc_on_file, cargo.otp_email].some(function (e) { return String(e || '').trim().toLowerCase() === sc_to.toLowerCase(); }) : [cargo.callerId, cargo.otp_cell_number].map(function (n) { return String(n || '').replace(/\\D/g, '').slice(-10); }).filter(function (n) { return n.length === 10; }).indexOf(String(cargo.textTo || '').replace(/\\D/g, '').slice(-10)) >= 0) && (!sc_read_back || !!sc_warning)"),
|
|
191
|
+
when('sc_target', 'sc_ask', set('sc_target_set', 'sc_target', "sc_medium === 'email' ? sc_to : String(cargo.textTo || '').replace(/\\D/g, '').slice(-10).replace(/^(\\d{3})(\\d{3})(\\d{4})$/, '($1) $2-$3')")),
|
|
192
|
+
when('sc_confirm_q', 'sc_ask', set('sc_confirm_q_set', 'sc_confirm_q', "sc_warning + (sc_read_back ? (sc_account_email ? 'The address you gave is not the email on your account. ' : '') + 'Are you sure you want it sent there? ' : 'Should I send it to ' + sc_target + '? ') + yesNoKeys('en', cargo)")),
|
|
193
|
+
when('sc_confirm_q_es', 'sc_ask', set('sc_confirm_q_es_set', 'sc_confirm_q_es', "sc_warning_es + (sc_read_back ? (sc_account_email ? 'La dirección que me dio no es el correo de su cuenta. ' : '') + '¿Seguro que quiere que se lo envíe ahí? ' : '¿Se lo envío a ' + sc_target + '? ') + yesNoKeys('es', cargo)")),
|
|
194
|
+
when('sc_confirm', 'sc_ask', call('sc_confirm_ask', 'ask-choice', {
|
|
182
195
|
question: '{{sc_confirm_q}}',
|
|
183
196
|
question_es: '{{sc_confirm_q_es}}',
|
|
184
197
|
choices: [{ key: 'yes', phrases: ['1'] }, { key: 'no', phrases: ['2'] }],
|
|
@@ -188,11 +201,11 @@ const sendCopy = defineWorker({
|
|
|
188
201
|
answer_precheck: 'send-copy-destination-answer',
|
|
189
202
|
})),
|
|
190
203
|
// another email address or phone number: SendCopy again with it, so it is read back in its turn
|
|
191
|
-
when('sc_corrected', "
|
|
192
|
-
when('sc_corrected_medium', "
|
|
193
|
-
when('sc_corrected_again', "
|
|
194
|
-
when('sc_confirm_no', "
|
|
195
|
-
when('sc_confirm_no_end', "
|
|
204
|
+
when('sc_corrected', "sc_ask && (cargo.choice === 'email' || cargo.choice === 'text')", set('sc_corrected_set', 'sc_given', `cargo.choice === 'email' ? ${EMAIL_IN_JS}(cargo.choiceText) : readPhone(String(cargo.choiceText || ''))`)),
|
|
205
|
+
when('sc_corrected_medium', "sc_ask && (cargo.choice === 'email' || cargo.choice === 'text')", set('sc_corrected_medium_set', 'sc_medium', 'cargo.choice')),
|
|
206
|
+
when('sc_corrected_again', "sc_ask && !!sc_given && (sc_medium === 'email' || sc_medium === 'text') && (cargo.choice === 'email' || cargo.choice === 'text')", { id: 'sc_corrected_again_flow', type: 'FLOW', value: 'send-copy', callType: 'replace', parameters: { item: '{{sc_item.key}}', medium: '{{sc_medium}}', destination: '{{sc_given}}', no_closing: '{{no_closing}}' } }),
|
|
207
|
+
when('sc_confirm_no', "sc_ask && cargo.choice !== 'yes'", say('sc_confirm_no_say', "Okay, I didn't send it." + ANYTHING_ELSE, 'De acuerdo, no lo envié.' + ANYTHING_ELSE_ES)),
|
|
208
|
+
when('sc_confirm_no_end', "sc_ask && cargo.choice !== 'yes'", end('sc_confirm_no_done', { outcome: 'unresolved', reason: 'declined' })),
|
|
196
209
|
// send: a sender item runs its flow (it tells the caller); content goes as is
|
|
197
210
|
set('sc_subject', 'sc_subject', "sc_item.kind === 'web_link' ? (language === 'es' ? 'Continúe nuestra conversación en la web' : 'Continue our conversation on the web') : language === 'es' ? 'Su copia de nuestra conversación' : sc_item.kind === 'conversation' ? 'Your copy of our conversation' : 'Your copy from our conversation'"),
|
|
198
211
|
when('sc_send_text', "sc_medium === 'text'", call('sc_send_text_call', 'send-text', { message: '{{sc_content}}' })),
|
package/dist/helpers/answer.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export function isOtherRequest(input: any, kind: any): boolean;
|
|
|
34
34
|
* the caller was offered $235.90 (2026-10-14).
|
|
35
35
|
*/
|
|
36
36
|
export function isAmountAnswer(input: any): boolean;
|
|
37
|
+
export function joinDollarPieces(input: any): string;
|
|
37
38
|
/**
|
|
38
39
|
* The amount an answer names, or NaN when it names none or is ambiguous. Prod replay 2026-10-14: the first number in the
|
|
39
40
|
* answer was taken, so "pagar cuenta 50, ciento treinta y cuatro…" paid $50, "$10 con 18 centavos" paid $10.00 and an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AA0NA;;;GAGG;AACH,wEAkBC;AAED,qHAAqH;AACrH,+CAGC;AAED;;;;GAIG;AACH,mDAIC;AAED;;;;GAIG;AACH,kDAIC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;
|
|
1
|
+
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AA0NA;;;GAGG;AACH,wEAkBC;AAED,qHAAqH;AACrH,+CAGC;AAED;;;;GAIG;AACH,mDAIC;AAED;;;;GAIG;AACH,kDAIC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AA2BD,qDAA0I;AAE1I;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAqCC;AAqBD,oEAqBC;AASD,gJAAgJ;AAChJ,sEAGC;AAED;;;;;;;;;GASG;AACH,6EA4GC;AAED;;;;;GAKG;AACH,uFAeC;;;;;;;;AA5iBD,qCAKwE"}
|
package/dist/helpers/answer.js
CHANGED
|
@@ -355,6 +355,11 @@ const DOLLARS_JOINED_CENTS = /(\$\s*)?(\d+)(\s*(?:dollars?|d[oó]lar(?:es)?|buck
|
|
|
355
355
|
// cinco": "157 95", "$157 95", "1 50" (owner 2026-10-29; prod 10-28 callers re-asked). Never after a decimal or before more
|
|
356
356
|
// digits, and never two-digit dollars: "95 52" is four digits, a card's last four read in pairs.
|
|
357
357
|
const DOLLARS_SPACE_CENTS = /(?<![\d.,])(\$\s*)?(\d|\d{3,})\s+(\d{2})(?![\d.,]|\s*(?:dollars?|d[oó]lar(?:es)?|bucks?|cents?|centavos?)\b)/gi;
|
|
358
|
+
// Dollars said in pieces, as speech-to-text writes "one sixty three" ("1 63") or "one six three" ("1 6 3"), are one number when
|
|
359
|
+
// a dollar word or "and NN cents" follows (prod 2026-12-04 CAb2b7f: "1 63 and 52 cents" was asked again twice). A first digit and
|
|
360
|
+
// then single digits or one pair: "50 100 dollars" stays two numbers (a sub account and an amount).
|
|
361
|
+
const DOLLARS_IN_PIECES = /(?<![\d$.,-]\s*)\d(?:(?:\s+\d)+|\s+\d{2})(?=\s*(?:(?:dollars?|d[oó]lar(?:es)?|bucks?)\b|(?:and|con|y)\s*(?:un\s+)?\d{1,2}\s*(?:cents?|centavos?)\b))/gi;
|
|
362
|
+
export function joinDollarPieces(input) { return String(input ?? '').replace(DOLLARS_IN_PIECES, (digits) => digits.replace(/\s+/g, '')); }
|
|
358
363
|
/**
|
|
359
364
|
* The amount an answer names, or NaN when it names none or is ambiguous. Prod replay 2026-10-14: the first number in the
|
|
360
365
|
* answer was taken, so "pagar cuenta 50, ciento treinta y cuatro…" paid $50, "$10 con 18 centavos" paid $10.00 and an
|
|
@@ -365,7 +370,7 @@ const DOLLARS_SPACE_CENTS = /(?<![\d.,])(\$\s*)?(\d|\d{3,})\s+(\d{2})(?![\d.,]|\
|
|
|
365
370
|
export function amountInAnswer(input) { return numericAmountReading(input).value; }
|
|
366
371
|
/** Internal numeric evidence shared by the opt-in money reader; legacy results stay unchanged. */
|
|
367
372
|
export function numericAmountReading(input) {
|
|
368
|
-
const raw =
|
|
373
|
+
const raw = joinDollarPieces(input);
|
|
369
374
|
// A connector plus cents is a fragment of another amount, not a new standalone payment.
|
|
370
375
|
// A caller can instead explicitly request "51 cents" or provide the complete dollars and cents.
|
|
371
376
|
if (/^\s*(?:and|con|y)\s*(?:un\s+)?\d{1,2}\s*(?:cents?|centavos?)\b/i.test(raw))
|
package/dist/helpers/money.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Opt-in currency grammar. Existing amountInAnswer/isAmountAnswer retain their published 1.6 semantics. */
|
|
2
|
-
import { numericAmountReading } from './answer.js';
|
|
2
|
+
import { joinDollarPieces, numericAmountReading } from './answer.js';
|
|
3
3
|
import { scanSpokenMoney } from './spoken-money.js';
|
|
4
4
|
/** A profile must declare its currency; currently only USD grammar is supported. No exchange-rate inference. */
|
|
5
5
|
export function validateMoneyOptions(options) {
|
|
@@ -26,7 +26,7 @@ function completeMoneyAnswer(input) {
|
|
|
26
26
|
let raw = String(input ?? '').trim().replace(/^[¡!]+|[.!]+$/g, '').trim();
|
|
27
27
|
raw = raw.replace(/^(?:please|por favor)[, ]+/i, '').replace(/[, ]+(?:please|por favor)$/i, '').trim();
|
|
28
28
|
raw = raw.replace(PAYMENT_PREFIX, '').replace(AMOUNT_LABEL_PREFIX, '').replace(AMOUNT_LABEL_SUFFIX, '').replace(ACCOUNT_PREFIX, '').replace(CARD_SUFFIX, '').replace(ACCOUNT_SUFFIX, '').trim();
|
|
29
|
-
if (NUMERIC_MONEY.test(raw))
|
|
29
|
+
if (NUMERIC_MONEY.test(joinDollarPieces(raw)))
|
|
30
30
|
return true;
|
|
31
31
|
const { readings, invalid } = scanSpokenMoney(raw);
|
|
32
32
|
return !invalid.length && readings.length === 1 && readings[0].start === 0 && readings[0].end === raw.length;
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:d4c6ab7e924bce0da918301dfa047d58a3bdc738cddff44a8f766d3f70489754";
|
|
@@ -300,6 +300,11 @@ does this reply do with the question the flow asked? The model picks from a clos
|
|
|
300
300
|
expressions, its inputs in scope, '' until answered); the nearest form in the chain that declares one is used. It is never offered at a reason question. A
|
|
301
301
|
top-scoring `concern` (cut 0.6) wins over a cleared choice.
|
|
302
302
|
|
|
303
|
+
**Introducing a form.** A form declares `introduction` / `introduction_es` (plain text, jsfe 1.102.0): what the caller is told
|
|
304
|
+
before its first question, such as why the information is asked. It is said once for that form, never again when the form
|
|
305
|
+
resumes, runs again after a change or asks a field again. On the web a card that draws the form shows it at its top, in place of
|
|
306
|
+
a message above the card; every other channel says it. A SAY in `before` is only ever a message: a card cannot show it.
|
|
307
|
+
|
|
303
308
|
**Options with arguments.** A declared choice may carry `parameters` (`{name,type,description}`): a pick then extracts them from the reply with the same stage as a flow's parameters, and the flow reads `{ key, arguments }`. The pick stands when extraction finds nothing or fails. The ranker is generic, so the flow supplies the context: a form's `confirm.reply_context` says what a reply may contain. The address read-back uses this: "It's Long Beach, apartment 4" changes the city and the apartment and reads the address back, with no further question.
|
|
304
309
|
|
|
305
310
|
### Arguments in free-form answers
|
|
@@ -128,6 +128,7 @@ A form declaration has top-level common fields and `form:{inputs:[...]}`. Do not
|
|
|
128
128
|
| Option | Meaning |
|
|
129
129
|
| --- | --- |
|
|
130
130
|
| `inputs` | Ordered field/group/sub-form declarations. Order controls which ready missing field is asked next, not which fields may be accepted. |
|
|
131
|
+
| `introduction`, `introduction_es` | Plain text said once before the first question; a web card shows it at its top. |
|
|
131
132
|
| `before`, `after` | Ordinary step arrays before collection and after completed collection/confirmation. |
|
|
132
133
|
| `validator` | Whole-form validation worker, called with `{form,values}`. |
|
|
133
134
|
| `confirm`, `before_confirm`, `declined` | Confirmation descriptor, preceding steps and declined step array. |
|
|
@@ -282,6 +283,8 @@ An unreadable answer with any words goes to the reply ranker, offered the questi
|
|
|
282
283
|
|
|
283
284
|
**Yes/no keys.** Every yes/no question names 1 for YES and 2 for NO on a call; word it with `yesNoKeys(lang, cargo, yes?, no?)` rather than by hand: voice "Press 1 or say YES to submit it, or press 2 or say NO.", text "Type YES to submit it, or type NO." (Spanish SÍ, "Presione 1 o diga", "escriba"). `channelVerb(lang, cargo, capital?)` gives the verb alone: the host's `cargo.verb` / `cargo.verb_es`, else "say" on a call and "type" elsewhere. On a form confirmation, key 1 confirms and key 2 declines on every channel.
|
|
284
285
|
|
|
286
|
+
`introduction` / `introduction_es` on a form (jsfe 1.102.0): plain text said once, before its first question. A web card shows it at its top in place of the message. Write it here, not as a SAY in `before`, which a card cannot draw.
|
|
287
|
+
|
|
285
288
|
`must_complete:true` on a form (inherited by every field of it and of the forms nested in it) or on one field (`false` on a field opts out): an unreadable answer is never yielded to DISPATCH, however long, and neither is a confirmation miss or an unresolved ambiguity — the question is asked again, acknowledged. A worded reply always reaches the reply ranker, offered every choice the chain's reader accepts: a pick is taken, a clear withdrawal ends the flows, and any other verdict (a new request included) stays and says `first_task` / `first_task_es` from the nearest form declaring it, "I understand, first let's enter your new card details." / "Entiendo, primero vamos a ingresar los datos de su tarjeta nueva.", then the field's `retry` or its question. It uses no attempt. Use it where leaving would strand an effect in progress (a payment's card, its billing-ZIP correction). Other exits stay explicit: the form's stop words, `max_attempts` with `on_exhausted`, and whatever the host intercepts before the engine. The form runaway guard counts passes without a caller answer only.
|
|
286
289
|
|
|
287
290
|
`confirm.named_fields: true` lets a caller correct a read-back in their own words: each input of this form that declares `names` and holds a value is offered to the reply ranker, and a pick extracts the new value of every such input, so one reply can change several. `confirm.reply_context` tells the ranker and the extraction what a reply may contain (never spoken); an input's `argument_description` says what its value looks like ("apartment or unit number alone, such as 4 or 12B"). A reply the word readers only partly account for goes to the ranker, so none of it is lost.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.102.1",
|
|
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",
|