jsfe 1.81.2 → 1.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/forms/contracts.d.ts +20 -0
- package/dist/forms/contracts.d.ts.map +1 -1
- package/dist/forms/flows.d.ts +24 -0
- package/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +5 -0
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +3 -1
- package/dist/helpers/match-inputs.d.ts.map +1 -1
- package/dist/helpers/match-inputs.js +25 -1
- package/dist/helpers/numbers.d.ts.map +1 -1
- package/dist/helpers/numbers.js +17 -0
- package/dist/runtime-identity.js +1 -1
- package/docs/architecture-guide.md +2 -0
- package/docs/copilot-reference.md +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -421,6 +421,8 @@ and, in the same reply, asked "Is 1500 your amount or your payment option?".
|
|
|
421
421
|
|
|
422
422
|
**An amount-shaped number is no ZIP (jsfe 1.43.0, owner 2026-11-11).** `profile.refuse_amount_shape: true` on a `digits` profile (default off): out of order, three digits then two ("119 19") read as dollars and cents as readily as one number, so they are not this field's digits; at its own question the field was asked for, and it reads. The `zip` and `card_zip` presets declare it, and `card_zip` also declares `confirm_out_of_order` (word ZIP / CÓDIGO POSTAL): out of order a bare five-digit number fills the billing ZIP only beside the word (prod 2026-11-11: "119 19." at the save-card question replaced an answered billing ZIP and the charge failed AVS).
|
|
423
423
|
|
|
424
|
+
**A number asked is the whole answer (jsfe 1.82.0, owner 2026-11-20).** At its own question a `digits` field takes its number only when the number is the whole answer (courtesy, connecting words and the field's own words aside; several fields read from one answer are a compound answer). Any other sentence goes to the reply ranker, which extracts the value through the input's `rank_parameters` (declared by the `zip` and `card_zip` presets). `profile.in_sentence: true` reads the number wherever it is said; the one-time code profiles declare it.
|
|
425
|
+
|
|
424
426
|
**Declared choices (`responseChoices`, jsfe 1.14):** a step may name a flow variable of type array holding
|
|
425
427
|
`[{ key, label, parameters? }]` (`parameters`: extracted on a pick, read as `{ key, arguments }`); the ranker is then also offered `choice:<key>` for each (before the fixed options), and `answers`
|
|
426
428
|
means a reply that picks none of them. A picked choice sets `responseVariable` to `{ key }`, plus `arguments` when it declares `parameters` (the pick stands if extraction finds nothing or fails);
|
|
@@ -92,6 +92,10 @@ export function validateFlowContracts(flows: any, tools?: any[], { externalFlows
|
|
|
92
92
|
min: number;
|
|
93
93
|
max: number;
|
|
94
94
|
};
|
|
95
|
+
rank_parameters: {
|
|
96
|
+
name: string;
|
|
97
|
+
description: string;
|
|
98
|
+
}[];
|
|
95
99
|
length_message: string;
|
|
96
100
|
length_message_es: string;
|
|
97
101
|
question: string;
|
|
@@ -124,6 +128,10 @@ export function validateFlowContracts(flows: any, tools?: any[], { externalFlows
|
|
|
124
128
|
ssn_last4: {
|
|
125
129
|
label: string;
|
|
126
130
|
label_es: string;
|
|
131
|
+
rank_parameters: {
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
}[];
|
|
127
135
|
profile: {
|
|
128
136
|
kind: string;
|
|
129
137
|
min: number;
|
|
@@ -196,6 +204,10 @@ export function validateFlowContracts(flows: any, tools?: any[], { externalFlows
|
|
|
196
204
|
lengths: number[];
|
|
197
205
|
}[];
|
|
198
206
|
};
|
|
207
|
+
rank_parameters: {
|
|
208
|
+
name: string;
|
|
209
|
+
description: string;
|
|
210
|
+
}[];
|
|
199
211
|
pii: boolean;
|
|
200
212
|
validator: string;
|
|
201
213
|
length_message: string;
|
|
@@ -248,6 +260,10 @@ export function validateFlowContracts(flows: any, tools?: any[], { externalFlows
|
|
|
248
260
|
max: number;
|
|
249
261
|
};
|
|
250
262
|
pii: boolean;
|
|
263
|
+
rank_parameters: {
|
|
264
|
+
name: string;
|
|
265
|
+
description: string;
|
|
266
|
+
}[];
|
|
251
267
|
length_message: string;
|
|
252
268
|
length_message_es: string;
|
|
253
269
|
validator: string;
|
|
@@ -273,6 +289,10 @@ export function validateFlowContracts(flows: any, tools?: any[], { externalFlows
|
|
|
273
289
|
min: number;
|
|
274
290
|
max: number;
|
|
275
291
|
};
|
|
292
|
+
rank_parameters: {
|
|
293
|
+
name: string;
|
|
294
|
+
description: string;
|
|
295
|
+
}[];
|
|
276
296
|
length_message: string;
|
|
277
297
|
length_message_es: string;
|
|
278
298
|
confirm_out_of_order: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/forms/contracts.js"],"names":[],"mappings":"AAgBA;;;IAGC;AACD;;;;;EAGC;AACD,qGAAqG;AACrG;;QAwCC;AAqBD;;;QAEC;AAgBD;;;;;;;;;QASC;AACD;;;;QAGC;AACD;;;;;;;;QA8BC;AAED,mHAAmH;AACnH,kDAgBC;AAED,+GAA+G;AAC/G
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/forms/contracts.js"],"names":[],"mappings":"AAgBA;;;IAGC;AACD;;;;;EAGC;AACD,qGAAqG;AACrG;;QAwCC;AAqBD;;;QAEC;AAgBD;;;;;;;;;QASC;AACD;;;;QAGC;AACD;;;;;;;;QA8BC;AAED,mHAAmH;AACnH,kDAgBC;AAED,+GAA+G;AAC/G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4EC"}
|
package/dist/forms/flows.d.ts
CHANGED
|
@@ -160,6 +160,10 @@ export namespace FIELD_PRESETS {
|
|
|
160
160
|
export { max_2 as max };
|
|
161
161
|
}
|
|
162
162
|
export { digits_1 as digits };
|
|
163
|
+
export let rank_parameters: {
|
|
164
|
+
name: string;
|
|
165
|
+
description: string;
|
|
166
|
+
}[];
|
|
163
167
|
let length_message_1: string;
|
|
164
168
|
export { length_message_1 as length_message };
|
|
165
169
|
let length_message_es_1: string;
|
|
@@ -217,6 +221,11 @@ export namespace FIELD_PRESETS {
|
|
|
217
221
|
export { label_4 as label };
|
|
218
222
|
let label_es_4: string;
|
|
219
223
|
export { label_es_4 as label_es };
|
|
224
|
+
let rank_parameters_1: {
|
|
225
|
+
name: string;
|
|
226
|
+
description: string;
|
|
227
|
+
}[];
|
|
228
|
+
export { rank_parameters_1 as rank_parameters };
|
|
220
229
|
export namespace profile_4 {
|
|
221
230
|
let kind_4: string;
|
|
222
231
|
export { kind_4 as kind };
|
|
@@ -335,6 +344,11 @@ export namespace FIELD_PRESETS {
|
|
|
335
344
|
}[];
|
|
336
345
|
}
|
|
337
346
|
export { digits_4 as digits };
|
|
347
|
+
let rank_parameters_2: {
|
|
348
|
+
name: string;
|
|
349
|
+
description: string;
|
|
350
|
+
}[];
|
|
351
|
+
export { rank_parameters_2 as rank_parameters };
|
|
338
352
|
let pii_1: boolean;
|
|
339
353
|
export { pii_1 as pii };
|
|
340
354
|
export let validator: string;
|
|
@@ -421,6 +435,11 @@ export namespace FIELD_PRESETS {
|
|
|
421
435
|
export { digits_6 as digits };
|
|
422
436
|
let pii_2: boolean;
|
|
423
437
|
export { pii_2 as pii };
|
|
438
|
+
let rank_parameters_3: {
|
|
439
|
+
name: string;
|
|
440
|
+
description: string;
|
|
441
|
+
}[];
|
|
442
|
+
export { rank_parameters_3 as rank_parameters };
|
|
424
443
|
let length_message_5: string;
|
|
425
444
|
export { length_message_5 as length_message };
|
|
426
445
|
let length_message_es_5: string;
|
|
@@ -466,6 +485,11 @@ export namespace FIELD_PRESETS {
|
|
|
466
485
|
export { max_12 as max };
|
|
467
486
|
}
|
|
468
487
|
export { digits_7 as digits };
|
|
488
|
+
let rank_parameters_4: {
|
|
489
|
+
name: string;
|
|
490
|
+
description: string;
|
|
491
|
+
}[];
|
|
492
|
+
export { rank_parameters_4 as rank_parameters };
|
|
469
493
|
let length_message_6: string;
|
|
470
494
|
export { length_message_6 as length_message };
|
|
471
495
|
let length_message_es_6: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AAkIA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAsGD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EC;AACD;;;GAGG;AACH;;;;;;EAGC;AAunBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAr8BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwJ9G,4CAEqI;AAwgCrI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
|
package/dist/forms/flows.js
CHANGED
|
@@ -60,6 +60,7 @@ export const FIELD_PRESETS = {
|
|
|
60
60
|
retry: 'Please say your email address, for example juan at gmail dot com.', retry_es: 'Por favor diga su correo electrónico, por ejemplo juan arroba gmail punto com.',
|
|
61
61
|
retry_text: 'Please type your email address, for example juan@gmail.com.', retry_text_es: 'Por favor escriba su correo electrónico, por ejemplo juan@gmail.com.' },
|
|
62
62
|
zip: { label: 'ZIP code', label_es: 'código postal', profile: { kind: 'digits', min: 5, max: 5, refuse_amount_shape: true }, digits: { min: 5, max: 5 },
|
|
63
|
+
rank_parameters: [{ name: 'zip', description: 'The 5-digit ZIP code, as the caller said it.' }],
|
|
63
64
|
length_message: 'I heard {heard} digits; a ZIP code has 5.', length_message_es: 'Escuché {heard} dígitos; el código postal tiene 5.',
|
|
64
65
|
question: 'What is your ZIP code?', question_es: '¿Cuál es su código postal?',
|
|
65
66
|
retry: 'Please say or enter your 5-digit ZIP code.', retry_es: 'Por favor diga o ingrese su código postal de 5 dígitos.',
|
|
@@ -70,6 +71,7 @@ export const FIELD_PRESETS = {
|
|
|
70
71
|
retry: 'Please say or enter your account number.', retry_es: 'Por favor diga o ingrese su número de cuenta.',
|
|
71
72
|
retry_text: 'Please type your account number.', retry_text_es: 'Por favor escriba su número de cuenta.' },
|
|
72
73
|
ssn_last4: { label: 'last four digits of your Social Security number', label_es: 'últimos cuatro dígitos de su Seguro Social',
|
|
74
|
+
rank_parameters: [{ name: 'ssn_last4', description: 'The last four digits of the Social Security number, as the caller said them.' }],
|
|
73
75
|
profile: { kind: 'digits', min: 4, max: 4 }, digits: { min: 4, max: 4 }, pii: true,
|
|
74
76
|
length_message: 'I heard {heard} digits; I need only the last 4.', length_message_es: 'Escuché {heard} dígitos; solo necesito los últimos 4.',
|
|
75
77
|
question: 'What are the last four digits of your Social Security number?', question_es: '¿Cuáles son los últimos cuatro dígitos de su Seguro Social?' },
|
|
@@ -81,6 +83,7 @@ export const FIELD_PRESETS = {
|
|
|
81
83
|
state: { label: 'state', label_es: 'estado', profile: { kind: 'pattern', regex: '^\\s*(?:Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming|District of Columbia|Puerto Rico|AL|AK|AZ|AR|CA|CO|CT|DE|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY|DC|PR)\\s*$' },
|
|
82
84
|
question: 'What state?', question_es: '¿En qué estado?' },
|
|
83
85
|
card_number: { label: 'card number', label_es: 'número de tarjeta', accumulate: true, accumulate_first: '^[2-6]', profile: { kind: 'digits', min: 13, max: 19 }, digits: { min: 13, max: 19, complete: [{ first: '4', lengths: [16, 19] }, { first: '25', lengths: [16] }, { first: '3', lengths: [15] }, { first: '6', lengths: [16, 19] }] },
|
|
86
|
+
rank_parameters: [{ name: 'card_number', description: 'The card number, every digit as the caller said it.' }],
|
|
84
87
|
pii: true, validator: 'validate-card-number',
|
|
85
88
|
length_message: 'I heard {heard} digits; a card number has 16, or 15 for American Express.', length_message_es: 'Escuché {heard} dígitos; el número de la tarjeta tiene 16, o 15 si es American Express.',
|
|
86
89
|
question: 'Please say or enter your card number.', question_es: 'Por favor diga o ingrese el número de su tarjeta.',
|
|
@@ -103,6 +106,7 @@ export const FIELD_PRESETS = {
|
|
|
103
106
|
retry: 'Please say or enter the expiration as four digits, month then year, like 0 9 2 8.', retry_es: 'Por favor diga o ingrese el vencimiento en cuatro dígitos, mes y año, por ejemplo 0 9 2 8.',
|
|
104
107
|
retry_text: 'Please type the expiration as four digits, month then year, like 0928.', retry_text_es: 'Por favor escriba el vencimiento en cuatro dígitos, mes y año, por ejemplo 0928.' },
|
|
105
108
|
card_cvv: { label: 'security code', label_es: 'código de seguridad', profile: { kind: 'digits', min: 3, max: 4 }, digits: { min: 3, max: 4 }, pii: true,
|
|
109
|
+
rank_parameters: [{ name: 'security_code', description: "The card's 3- or 4-digit security code, as the caller said it." }],
|
|
106
110
|
length_message: 'I heard {heard} digits; the security code has 3, or 4 on the front of an American Express card.', length_message_es: 'Escuché {heard} dígitos; el código de seguridad tiene 3, o 4 al frente de una American Express.',
|
|
107
111
|
validator: 'validate-card-cvv',
|
|
108
112
|
// A bare 3-4 digit number out of order may be a group of the card number (prod 2026-11-16: a lone 4-digit group at the card number
|
|
@@ -112,6 +116,7 @@ export const FIELD_PRESETS = {
|
|
|
112
116
|
// A bare five-digit number out of order may be anything (prod 2026-11-11: it replaced an answered ZIP), so it fills the
|
|
113
117
|
// billing ZIP only beside the word (owner 2026-11-11).
|
|
114
118
|
card_zip: { label: 'billing ZIP code', label_es: 'código postal de facturación', profile: { kind: 'digits', min: 5, max: 5, refuse_amount_shape: true }, digits: { min: 5, max: 5 },
|
|
119
|
+
rank_parameters: [{ name: 'zip', description: "The card's 5-digit billing ZIP code, as the caller said it." }],
|
|
115
120
|
length_message: 'I heard {heard} digits; the billing ZIP code has 5.', length_message_es: 'Escuché {heard} dígitos; el código postal de facturación tiene 5.',
|
|
116
121
|
confirm_out_of_order: { word: 'ZIP', word_es: 'CÓDIGO POSTAL', message: 'If {value} is the billing ZIP code of the card, add the word {word}.', message_es: 'Si {value} es el código postal de facturación de la tarjeta, agregue las palabras {word}.' },
|
|
117
122
|
question: 'What is the billing ZIP code for the card?', question_es: '¿Cuál es el código postal de facturación de la tarjeta?' },
|
|
@@ -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,0CAWC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAMC;AAkHD,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,0CAWC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAMC;AAkHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AA4JD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AA3QD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AA8RzC,0BAAsK"}
|
|
@@ -279,7 +279,9 @@ const emailToo = worker('send-otp-email-too', 'SendOtpEmailToo', "Email a second
|
|
|
279
279
|
set('otp_email_too_where', 'otp_where', expression(otpWhere, 'cargo')), set('otp_email_too_where_es', 'otp_where_es', expression(otpWhere, 'cargo', 'true')),
|
|
280
280
|
cases('otp_email_too_say', { 'condition: cargo.otpAltSent === true': say('otp_email_too_sent', '{{also_sent}}', '{{also_sent_es}}'), default: say('otp_email_too_refused', '{{otp_where}}', '{{otp_where_es}}') })
|
|
281
281
|
] });
|
|
282
|
-
|
|
282
|
+
// in_sentence: the code is read wherever it is said (owner 2026-11-20), the named exception to a number being the whole answer: a
|
|
283
|
+
// wrong number only fails the check, which counts it.
|
|
284
|
+
const OTP_PROFILES = [{ name: 'code', label: 'verification code', label_es: 'código de verificación', profile: { kind: 'digits', min: 6, max: 6, in_sentence: true } }, { ...raw, form_client: false }];
|
|
283
285
|
const code = worker('get-and-validate-otp-code', 'GetAndValidateOtpCode', 'Collect a one-time-code answer through the owning FORM ancestry, preserving protocol commands for validation.', { variables: vars({ otp_code: '', user_choice: '', normalized_otp_code: '', otp_question: '', otp_question_es: '', otp_profiles: OTP_PROFILES }), contract: { role: 'collector', summary: 'One-time-code answer collector using shared FORM matching' }, steps: [
|
|
284
286
|
when('otp_already_verified', 'cargo.otpVerified === true', end('otp_existing_verification')),
|
|
285
287
|
set('otp_question', 'otp_question', expression(otpPrompt, 'cargo')), set('otp_question_es', 'otp_question_es', expression(otpPrompt, 'cargo', 'true')),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,sEAQC;
|
|
1
|
+
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,sEAQC;AAoGD;;;GAGG;AACH,sFAiIC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;mHACmH;AAEnH,iEAEC;AAGD,gGAOC;AAYD,kDAGC;AAED;;;;;;;GAOG;AACH;;;;SAcC;AACD;;;;;GAKG;AACH;;;;;;;;;;;;;;;;;;;;;;EAaC;AACD;;;;;;;;;;;;;;;;;;;;;;EAeC;AACD;;;;;;;;;;;;;;;;;;;;;;;EAkYC"}
|
|
@@ -127,6 +127,11 @@ function unclaimedSpans(raw, readings) {
|
|
|
127
127
|
}
|
|
128
128
|
return spans;
|
|
129
129
|
}
|
|
130
|
+
/** A field's own words, which an answer may say around its value: its name, names, labels, template words and confirm word. */
|
|
131
|
+
function inputWords(field) {
|
|
132
|
+
const said = [String(field.name || '').replace(/_/g, ' '), ...(field.names || []), field.label, field.label_es, ...(field.profile?.template_words || []), field.confirm_out_of_order?.word, field.confirm_out_of_order?.word_es].filter(Boolean);
|
|
133
|
+
return said.flatMap((s) => String(s).split(/\s+/));
|
|
134
|
+
}
|
|
130
135
|
/**
|
|
131
136
|
* One input's reading of the answer: { value, evidence } or null. `evidence` is what the answer spent on it (digits
|
|
132
137
|
* or words), so two inputs that claim the same part of the answer are told apart from a compound answer.
|
|
@@ -620,12 +625,31 @@ export function matchInputs(answer, candidates, current, choiceKey) {
|
|
|
620
625
|
return false;
|
|
621
626
|
}
|
|
622
627
|
});
|
|
628
|
+
// The number asked is taken only when the answer is accounted for (owner 2026-11-20: a tight reader, else the reply ranker): the
|
|
629
|
+
// number, courtesy and connecting words and the field's own words ("mi código es 129", "zip code 91306, gracias"). Several
|
|
630
|
+
// parts read are a compound answer (a whole address at the ZIP question), as in rule 1. Any other word means the reader does not decide: the
|
|
631
|
+
// ranker does, and extracts the field (the input's rank_parameters). Prod 11-18: a street address said at the
|
|
632
|
+
// billing ZIP took the house number; payment amounts at the security code filled the CVV. profile.in_sentence: the number is
|
|
633
|
+
// read wherever it is said (the one-time code, where a wrong number only fails the check).
|
|
634
|
+
readings = readings.filter((reading) => {
|
|
635
|
+
const field = fieldOf(reading);
|
|
636
|
+
const compound = located.some((other) => other.form !== reading.form || other.name !== reading.name);
|
|
637
|
+
if (!reading.current || field.profile.kind !== 'digits' || field.profile.in_sentence === true || reading.keypad || compound || isReaderFiller(leftover, inputWords(field))) {
|
|
638
|
+
return true;
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
// the ranker reads the whole sentence: no "add the word" line for another number in it
|
|
642
|
+
clarify.splice(0);
|
|
643
|
+
refused.push({ form: reading.form, name: reading.name, value: reading.value, rule: 'unaccounted_words', spans: reading.spans });
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
});
|
|
623
647
|
// Rule 1, a full match (owner 2026-11-02): one part of the answer read out of order, with nothing read for the question asked,
|
|
624
648
|
// accounts for the whole answer: the reading, courtesy or connecting words, and the words of the field itself (its names, label,
|
|
625
649
|
// template words, its confirmation word). Any other word means the matcher does not decide: the reply ranker does ("Si son 129"
|
|
626
650
|
// at the card number). An input asked keeps its reading ("mi código es 129"), several parts read are a compound answer, a
|
|
627
651
|
// confirmation asks no input (its fields are corrections, current.whole_reply declares when they must be whole), and an amount has rule 4.
|
|
628
|
-
const fieldWords = (reading) =>
|
|
652
|
+
const fieldWords = (reading) => inputWords(fieldOf(reading));
|
|
629
653
|
const unaccounted = unclaimedSpans(raw, readings.filter((reading) => !reading.fallback && reading.unlocated !== true)).map(([a, b]) => raw.slice(a, b)).join(' ');
|
|
630
654
|
const spansMeet = (a, b) => (a.spans || []).some(([s, e]) => (b.spans || []).some(([t, u]) => s < u && t < e));
|
|
631
655
|
const onePartAlone = !!cur.name && !readings.some(inOrder) && readings.every((reading) => spansMeet(reading, readings[0]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/helpers/numbers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/helpers/numbers.js"],"names":[],"mappings":"AAmGA;;;;;GAKG;AACH;;;;;;IAqBC;AAED;;;;;;;GAOG;AACH;;;;EA0BC;AAED;mFACmF;AACnF,qEASC;AApKD;;;4EAG4E;AAC5E,+BAAqF"}
|
package/dist/helpers/numbers.js
CHANGED
|
@@ -26,6 +26,23 @@ function wordNumbers(raw) {
|
|
|
26
26
|
const found = [];
|
|
27
27
|
for (let i = 0; i < tokens.length; i++) {
|
|
28
28
|
const first = tokens[i].word;
|
|
29
|
+
// Spanish says "y" inside a number, and speech-to-text keeps it between the digits (owner 2026-11-19; prod 11-19 17:10
|
|
30
|
+
// "9 y 5, 55, 31" was the code 955531): tens and a digit add up ("40 y 3" → 43, "cuarenta y tres"); two single digits
|
|
31
|
+
// join ("9 y 5" → 95) unless the first ends a number already being said digit by digit ("1 2 3 4 y 0 5 1 2 1 9 8 0" is two
|
|
32
|
+
// numbers). "y" between longer groups still separates two numbers ("1382 y 5603").
|
|
33
|
+
const and = tokens[i + 1], unit = tokens[i + 2];
|
|
34
|
+
if (/^\d{1,2}$/.test(first) && and?.word === 'y' && unit && /^\d$/.test(unit.word) && gapOk(tokens[i], and) && gapOk(and, unit)
|
|
35
|
+
&& !/\d/.test(raw[unit.end] || '')) {
|
|
36
|
+
const tensAndUnit = /^[2-9]0$/.test(first) && unit.word !== '0';
|
|
37
|
+
const digitPair = /^\d$/.test(first) && !/\d[\s.,-]*$/.test(raw.slice(0, tokens[i].start));
|
|
38
|
+
if (tensAndUnit || digitPair) {
|
|
39
|
+
found.push({ start: tokens[i].start, end: unit.end, digits: tensAndUnit ? String(Number(first) + Number(unit.word)) : first + unit.word });
|
|
40
|
+
i += 2;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
else { /* "15 y 3": two numbers */ }
|
|
44
|
+
}
|
|
45
|
+
else { /* no "y" inside a number here */ }
|
|
29
46
|
if (!isNumberWord(first) || CONNECTORS.has(first)) {
|
|
30
47
|
continue;
|
|
31
48
|
}
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:176875db0ad95fcdb6ece79ad4b79a16f923f8eb7cdc2db41977d6887c9536c0";
|
|
@@ -376,6 +376,8 @@ and, in the same reply, asked "Is 1500 your amount or your payment option?".
|
|
|
376
376
|
|
|
377
377
|
**An amount-shaped number is no ZIP.** `profile.refuse_amount_shape: true` (digits profile, default off): "119 19" (three digits then two) is not the field's digits out of order; at its own question it reads. Declared by the `zip` and `card_zip` presets; `card_zip` also takes a bare number out of order only beside ZIP / CÓDIGO POSTAL (`confirm_out_of_order`).
|
|
378
378
|
|
|
379
|
+
**A number asked is the whole answer** (owner 2026-11-20). At its own question a `digits` field takes its number only when the answer is accounted for: the number, courtesy and connecting words, the field's own words (name, label, template words), or a compound answer other fields read. Any other sentence is the reply ranker's: on `answers` the input's `rank_parameters` are extracted and read by the field as if said alone. A keypad entry is a whole answer. `profile.in_sentence: true` keeps reading the number anywhere in the sentence: the one-time code, where a wrong number only fails the check.
|
|
380
|
+
|
|
379
381
|
**A number of the wrong length says so.** A numeric field (`digits`, `phone` or `identifier` kind) that declares `digits` takes, at its own question, the one 3+ digit number of the wrong length that no other field read or refused; validation rejects it with the count heard and the count it takes (`length_message`), said with the question that re-asks. Routing is unchanged.
|
|
380
382
|
|
|
381
383
|
**A provider's menu.** `provides.menu.whole_phrases: true` (default off) applies the same rule to a menu: a fact's phrase answers only as the whole reply, and a phrase inside a longer sentence goes to the reply ranker, offered every fact with phrases, every action, `done` and a person. A fact pick is answered with every other fact that cleared `REPLY_ALSO_CUT` (0.6), so one sentence that asks two things hears both; an action pick runs alone. `answers` and `irrelevant` fall to the menu's plain DISPATCH, which hands the turn to the host without intent detection (a Guru answers from the user context the flow set); `new_request` runs intent detection. A reply with no phrase is unchanged. `menu.unanswered` handles a question the provider cannot answer: when a reply from its own menu comes back to it through intent detection with no fact to say, the caller hears the declared apology and offer (`provider-unanswered`) instead of the same facts again.
|
|
@@ -226,6 +226,7 @@ Declarations:
|
|
|
226
226
|
| `authenticate-user` `other_whole_answer:true` | At the code question "another account" switches only as the whole answer; inside a sentence the reply ranker decides, offered `another_account` and `no_other_account` ("I understand. We still need to secure access to your account.", then the question). Default off. |
|
|
227
227
|
| input `confirm_out_of_order:{word,word_es,message,message_es}` | Out of order a number fills this input only beside its `word`, in either language. Alone, the caller hears `message` (`{value}` is the number, `{word}` the word) and the current question again, which counts as an attempt. `authenticate-user`'s `code_confirm` is the same declaration for a `code_validator`, whose flow reads it with `saysConfirmWord` and `confirmOutOfOrderLine`: an account number at the verification-code question, where it may be a code said with an extra digit. A pattern field's `asked_regex` also reads out of order beside the word; the field asked now wins over a refused number. Card presets: expiration, security code and billing ZIP. |
|
|
228
228
|
| profile `refuse_amount_shape:true` (digits) | Out of order, three digits then two ("119 19") fill nothing: they read as dollars and cents. At its own question they read as the field. The `zip` and `card_zip` presets declare it. |
|
|
229
|
+
| profile `in_sentence:true` (digits) | At its own question a `digits` field takes its number only when the number is the whole answer (courtesy, connecting words and the field's own words aside, or a compound answer other fields read); any other sentence goes to the reply ranker, which extracts the field through the input's `rank_parameters`. `in_sentence` reads the number wherever it is said: the one-time code (the OTP profiles declare it). The `zip`, `card_zip` presets declare `rank_parameters`. |
|
|
229
230
|
| `digits: {min,max}` with `length_message` / `length_message_es` | At its own question (a `digits`, `phone` or `identifier` field; a pattern field reads only what it matches), one number of 3+ digits whose length is outside `digits`, read by no other field: a reading of the field, rejected with "{heard} digits; it has {lengths}", said with the re-ask. The declaration is the opt-in; the length presets declare messages. |
|
|
230
231
|
| input `choices_from` | The choice's values come from prepared data (the caller's saved cards), so its signature is those values. |
|
|
231
232
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.82.0",
|
|
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",
|