jsfe 1.42.2 → 1.44.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 +3 -1
- package/dist/forms/contracts.d.ts +8 -0
- package/dist/forms/contracts.d.ts.map +1 -1
- package/dist/forms/flows.d.ts +9 -0
- package/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +63 -2
- package/dist/forms/form-client.d.ts.map +1 -1
- package/dist/forms/form-client.js +16 -0
- package/dist/helpers/match-inputs.d.ts.map +1 -1
- package/dist/helpers/match-inputs.js +12 -3
- 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
|
@@ -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
|
|
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; jsfe 1.44.0)
|
|
18
18
|
- **[Development candidate acceptance](docs/development-release.md)** - reproducible package and cross-repository verification
|
|
19
19
|
- **[System Flows](docs/flows/system/README.md)** and **[Shopify Flows](docs/flows/shopify/README.md)** - the bundled flow and tool libraries in `flows/`: a page and a chart per flow, generated from the JSON (`node scripts/flow-docs.mjs`), plus the conventions the system flows share
|
|
20
20
|
|
|
@@ -400,6 +400,8 @@ An input with `profile.whole_phrases` (default off; `choice`, or a `pattern` tha
|
|
|
400
400
|
|
|
401
401
|
**A number that must name itself.** `input.confirm_out_of_order: {word, word_es, message, message_es}` (default off): out of order a number fills this input only beside its word, in either language ("account 5373850"). Alone it may be something else, a code said with an extra digit, so nothing is filled: the caller hears `message` (`{value}` the number, digit by digit on a call; `{word}` the word) and the current question again, which counts as an attempt at that question. It works at `collect-input` and `confirm-form` questions. At its own question the number needs no word. `authenticate-user`'s `code_confirm` takes the same declaration for a `code_validator`, whose flow reads it with the helpers `saysConfirmWord(answer, spec)` and `confirmOutOfOrderLine(spec, value, language, voice)`.
|
|
402
402
|
|
|
403
|
+
**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).
|
|
404
|
+
|
|
403
405
|
**Declared choices (`responseChoices`, jsfe 1.14):** a step may name a flow variable of type array holding
|
|
404
406
|
`[{ 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`
|
|
405
407
|
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);
|
|
@@ -82,6 +82,7 @@ export function validateFlowContracts(flows: any, tools?: any[], { externalFlows
|
|
|
82
82
|
kind: string;
|
|
83
83
|
min: number;
|
|
84
84
|
max: number;
|
|
85
|
+
refuse_amount_shape: boolean;
|
|
85
86
|
};
|
|
86
87
|
digits: {
|
|
87
88
|
min: number;
|
|
@@ -239,11 +240,18 @@ export function validateFlowContracts(flows: any, tools?: any[], { externalFlows
|
|
|
239
240
|
kind: string;
|
|
240
241
|
min: number;
|
|
241
242
|
max: number;
|
|
243
|
+
refuse_amount_shape: boolean;
|
|
242
244
|
};
|
|
243
245
|
digits: {
|
|
244
246
|
min: number;
|
|
245
247
|
max: number;
|
|
246
248
|
};
|
|
249
|
+
confirm_out_of_order: {
|
|
250
|
+
word: string;
|
|
251
|
+
word_es: string;
|
|
252
|
+
message: string;
|
|
253
|
+
message_es: string;
|
|
254
|
+
};
|
|
247
255
|
question: string;
|
|
248
256
|
question_es: string;
|
|
249
257
|
};
|
|
@@ -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
|
@@ -144,6 +144,7 @@ export namespace FIELD_PRESETS {
|
|
|
144
144
|
export { min_1 as min };
|
|
145
145
|
let max_1: number;
|
|
146
146
|
export { max_1 as max };
|
|
147
|
+
export let refuse_amount_shape: boolean;
|
|
147
148
|
}
|
|
148
149
|
export { profile_2 as profile };
|
|
149
150
|
export namespace digits_1 {
|
|
@@ -410,6 +411,8 @@ export namespace FIELD_PRESETS {
|
|
|
410
411
|
export { min_12 as min };
|
|
411
412
|
let max_11: number;
|
|
412
413
|
export { max_11 as max };
|
|
414
|
+
let refuse_amount_shape_1: boolean;
|
|
415
|
+
export { refuse_amount_shape_1 as refuse_amount_shape };
|
|
413
416
|
}
|
|
414
417
|
export { profile_12 as profile };
|
|
415
418
|
export namespace digits_7 {
|
|
@@ -419,6 +422,12 @@ export namespace FIELD_PRESETS {
|
|
|
419
422
|
export { max_12 as max };
|
|
420
423
|
}
|
|
421
424
|
export { digits_7 as digits };
|
|
425
|
+
export namespace confirm_out_of_order {
|
|
426
|
+
let word: string;
|
|
427
|
+
let word_es: string;
|
|
428
|
+
let message: string;
|
|
429
|
+
let message_es: string;
|
|
430
|
+
}
|
|
422
431
|
let question_12: string;
|
|
423
432
|
export { question_12 as question };
|
|
424
433
|
let question_es_12: 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":"AAgHA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAuDD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsEC;AACD;;;GAGG;AACH;;;;;;EAGC;AA+lBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAv2BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAikC9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
|
package/dist/forms/flows.js
CHANGED
|
@@ -57,7 +57,7 @@ export const FIELD_PRESETS = {
|
|
|
57
57
|
email: { label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' },
|
|
58
58
|
question: 'What is your email address?', question_es: '¿Cuál es su correo electrónico?',
|
|
59
59
|
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.' },
|
|
60
|
-
zip: { label: 'ZIP code', label_es: 'código postal', profile: { kind: 'digits', min: 5, max: 5 }, digits: { min: 5, max: 5 },
|
|
60
|
+
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 },
|
|
61
61
|
question: 'What is your ZIP code?', question_es: '¿Cuál es su código postal?',
|
|
62
62
|
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.',
|
|
63
63
|
retry_text: 'Please type your 5-digit ZIP code.', retry_text_es: 'Por favor escriba su código postal de 5 dígitos.' },
|
|
@@ -93,7 +93,10 @@ export const FIELD_PRESETS = {
|
|
|
93
93
|
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,
|
|
94
94
|
validator: 'validate-card-cvv',
|
|
95
95
|
question: 'What is the security code on the back of the card?', question_es: '¿Cuál es el código de seguridad al reverso de la tarjeta?' },
|
|
96
|
-
|
|
96
|
+
// A bare five-digit number out of order may be anything (prod 2026-11-11: it replaced an answered ZIP), so it fills the
|
|
97
|
+
// billing ZIP only beside the word (owner 2026-11-11).
|
|
98
|
+
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 },
|
|
99
|
+
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}.' },
|
|
97
100
|
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?' },
|
|
98
101
|
};
|
|
99
102
|
// Field collectors: one-input forms over a preset, callable directly (result in cargo.formResults[<id>]).
|
|
@@ -145,6 +148,63 @@ function validateAcceptanceDeclarations(id, inputs) {
|
|
|
145
148
|
else { /* no invites, or a list of names */ }
|
|
146
149
|
}
|
|
147
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* input.form_client: false (never on a form card) or the control a form card draws for it (docs/form-client.md):
|
|
153
|
+
* {control: 'date', range_from?, min?, max?, timezone?} or {control: 'number', min?, max?}. A date's min and max are whole
|
|
154
|
+
* days from today in `timezone` (required with either); range_from names the start of a range, a date input of this
|
|
155
|
+
* form that is not itself an end. A number's min and max bound its value. Checked at definition time; malformed fails.
|
|
156
|
+
*/
|
|
157
|
+
const FORM_CLIENT_KEYS = { date: ['control', 'range_from', 'min', 'max', 'timezone'], number: ['control', 'min', 'max'] };
|
|
158
|
+
const FORM_CLIENT_KINDS = ['pattern', 'text', 'digits', 'amount', 'identifier'];
|
|
159
|
+
function validateFormClientControls(id, inputs) {
|
|
160
|
+
const all = (inputs || []).flatMap((input) => input.any_of || [input]);
|
|
161
|
+
const fail = (input, message) => { throw new Error(`FORM ${id}: ${input.name} form_client ${message}`); };
|
|
162
|
+
for (const input of all) {
|
|
163
|
+
const declared = input.form_client;
|
|
164
|
+
if (declared === undefined || declared === false)
|
|
165
|
+
continue;
|
|
166
|
+
else if (!declared || typeof declared !== 'object' || Array.isArray(declared))
|
|
167
|
+
fail(input, 'must be false or {control, ...}');
|
|
168
|
+
else if (!Object.hasOwn(FORM_CLIENT_KEYS, declared.control))
|
|
169
|
+
fail(input, 'control must be "date" or "number"');
|
|
170
|
+
else { /* a control object, checked below */ }
|
|
171
|
+
const extra = Object.keys(declared).filter((key) => !FORM_CLIENT_KEYS[declared.control].includes(key));
|
|
172
|
+
if (extra.length)
|
|
173
|
+
fail(input, `${declared.control} cannot declare ${extra.join(', ')}`);
|
|
174
|
+
if (!FORM_CLIENT_KINDS.includes(input.profile?.kind))
|
|
175
|
+
fail(input, `control needs a profile of kind ${FORM_CLIENT_KINDS.join(', ')}`);
|
|
176
|
+
if (input.pii === true)
|
|
177
|
+
fail(input, 'control cannot draw a sensitive input');
|
|
178
|
+
for (const key of ['min', 'max'])
|
|
179
|
+
if (declared[key] !== undefined && !Number.isInteger(declared[key]))
|
|
180
|
+
fail(input, `${key} must be a whole number`);
|
|
181
|
+
if (Number.isInteger(declared.min) && Number.isInteger(declared.max) && declared.min > declared.max)
|
|
182
|
+
fail(input, 'min is above max');
|
|
183
|
+
if (declared.control === 'date') {
|
|
184
|
+
if ((declared.min !== undefined || declared.max !== undefined) && declared.timezone === undefined)
|
|
185
|
+
fail(input, 'min and max are days from today: declare the timezone they count in');
|
|
186
|
+
if (declared.timezone !== undefined) {
|
|
187
|
+
try {
|
|
188
|
+
new Intl.DateTimeFormat('en-CA', { timeZone: declared.timezone });
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
fail(input, `timezone ${JSON.stringify(declared.timezone)} is not an IANA time zone`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else { /* no bounds, no time zone */ }
|
|
195
|
+
if (declared.range_from !== undefined) {
|
|
196
|
+
const start = all.find((other) => other.name === declared.range_from);
|
|
197
|
+
if (!start || start === input)
|
|
198
|
+
fail(input, 'range_from must name another input of this form');
|
|
199
|
+
else if (start.form_client?.control !== 'date' || start.form_client.range_from !== undefined)
|
|
200
|
+
fail(input, `range_from ${start.name} must be a date control that is not itself a range end`);
|
|
201
|
+
else { /* a valid range start */ }
|
|
202
|
+
}
|
|
203
|
+
else { /* a single date or a range start */ }
|
|
204
|
+
}
|
|
205
|
+
else { /* a number */ }
|
|
206
|
+
}
|
|
207
|
+
}
|
|
148
208
|
/** How firm a form's confirmation is: firm ONLY when an action it authorizes is a payment (effect 'charge'); every other
|
|
149
209
|
* confirmation is soft, a plain form's (no action) included (owner 2026-11-09). confirm.exact is separate: it binds the
|
|
150
210
|
* action to the confirmed values, whatever the confirmation's firmness. */
|
|
@@ -160,6 +220,7 @@ export function formFlow({ id, name, version, description, inputs, after = [], e
|
|
|
160
220
|
if (typeof must_complete !== 'boolean')
|
|
161
221
|
throw new Error(`FORM ${id}: must_complete must be true or false`);
|
|
162
222
|
validateAcceptanceDeclarations(id, inputs);
|
|
223
|
+
validateFormClientControls(id, inputs);
|
|
163
224
|
if (confirm && typeof confirm === 'object')
|
|
164
225
|
validateRankParameters(id, 'confirm', 'rank_parameters', confirm.rank_parameters);
|
|
165
226
|
else { /* no confirmation */ }
|
|
@@ -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":"AAiCA,iGAAiG;AACjG;;;;;SAsFC;AAED,+GAA+G;AAC/G;;;;SAgCC;AAED;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BC;AAvLD,qCAAsC,eAAe,CAAC"}
|
|
@@ -27,6 +27,11 @@ const pendingForm = session => {
|
|
|
27
27
|
}
|
|
28
28
|
return { state, context };
|
|
29
29
|
};
|
|
30
|
+
/** Today in an IANA time zone, moved by whole days, as YYYY-MM-DD (UTC arithmetic: no DST shift). */
|
|
31
|
+
function daysFromToday(days, timeZone) {
|
|
32
|
+
const [year, month, day] = new Intl.DateTimeFormat('en-CA', { timeZone, year: 'numeric', month: '2-digit', day: '2-digit' }).format(new Date()).split('-').map(Number);
|
|
33
|
+
return new Date(Date.UTC(year, month - 1, day + days)).toISOString().slice(0, 10);
|
|
34
|
+
}
|
|
30
35
|
/** A public rendering projection, never a serialized flow, executable expression, or session. */
|
|
31
36
|
export function projectForm(session, flows) {
|
|
32
37
|
if (flows && Object.values(session?.cargo?.forms || {}).some(state => state?.derived)) {
|
|
@@ -104,6 +109,17 @@ export function projectForm(session, flows) {
|
|
|
104
109
|
continue;
|
|
105
110
|
}
|
|
106
111
|
field.constraints = Object.fromEntries(['min', 'max'].filter(key => typeof profile[key] === 'number').map(key => [key, profile[key]]));
|
|
112
|
+
// The control the input declares (validated at definition time). Its bounds replace the profile's, which for
|
|
113
|
+
// some kinds are lengths: a number's are values, a date's are days from today turned into YYYY-MM-DD dates.
|
|
114
|
+
const control = input.form_client?.control;
|
|
115
|
+
if (control === 'number' || control === 'date') {
|
|
116
|
+
field.control = control;
|
|
117
|
+
field.constraints = Object.fromEntries(['min', 'max'].filter(key => Number.isInteger(input.form_client[key]))
|
|
118
|
+
.map(key => [key, control === 'date' ? daysFromToday(input.form_client[key], input.form_client.timezone) : input.form_client[key]]));
|
|
119
|
+
if (control === 'date' && input.form_client.range_from)
|
|
120
|
+
field.range_from = prefix + input.form_client.range_from;
|
|
121
|
+
}
|
|
122
|
+
else { /* the profile's own box */ }
|
|
107
123
|
if (!field.sensitive && ['string', 'number', 'boolean'].includes(typeof state.values?.[input.name]))
|
|
108
124
|
field.value = state.values[input.name];
|
|
109
125
|
// A worded refusal is shown with its field; the bare 'invalid' flag (a refusal with no message, or a whole-form
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,sEAQC;
|
|
1
|
+
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,sEAQC;AAyFD;;;GAGG;AACH,sFA8HC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;mHACmH;AAEnH,iEAEC;AAGD,gGAKC;AAED;;;;;;;;;;;;;;;;;;;;;;EAeC;AACD;;;;;;;;;;;;;;;;;;;;;;;EA+SC"}
|
|
@@ -45,6 +45,7 @@ function digitRuns(raw) {
|
|
|
45
45
|
// A choice reads its keys without the comma join: "1, 2" names two keys, not 12.
|
|
46
46
|
const CHOICE_RUN = /\d(?:[\s.-]?\d)*/g;
|
|
47
47
|
const DECIMAL_AMOUNT = /(?:[$€£]\s?)?\d+[.,]\d{2}(?!\d)/g; // a written decimal amount, with its currency mark
|
|
48
|
+
const AMOUNT_SHAPED = /(?<!\d[\s.,-]?)\d{3}\s+\d{2}(?![\s.,-]?\d)/g; // "119 19": dollars and cents as said (profile.refuse_amount_shape)
|
|
48
49
|
/** Where the answer says amount n: a written decimal by itself ("51 72.45" is not one spoken run), else its number spans. */
|
|
49
50
|
function amountSpans(raw, n) {
|
|
50
51
|
const decimals = [...raw.matchAll(DECIMAL_AMOUNT)].filter((m) => Number(m[0].replace(/[^\d.,]/g, '').replace(',', '.')) === n).map((m) => [m.index, m.index + m[0].length]);
|
|
@@ -225,11 +226,19 @@ export function readInputProfile(profile, answer, isCurrent = true) {
|
|
|
225
226
|
const min = Number(profile.min || 1);
|
|
226
227
|
const max = Number(profile.max || min);
|
|
227
228
|
// Out of order a decimal amount ("72.45", "287,15") is never this field's digits.
|
|
228
|
-
let
|
|
229
|
+
let source = isCurrent ? raw : raw.replace(DECIMAL_AMOUNT, (m) => ' '.repeat(m.length));
|
|
230
|
+
// profile.refuse_amount_shape: out of order, three digits then two ("119 19") read as dollars and cents as readily as
|
|
231
|
+
// one number, so they are not this field's digits (owner 2026-11-11: prod "119 19." at a save-card question replaced the
|
|
232
|
+
// billing ZIP with 11919 and the charge failed AVS). At its own question the field was asked for: it reads.
|
|
233
|
+
if (profile.refuse_amount_shape === true && !isCurrent) {
|
|
234
|
+
source = source.replace(AMOUNT_SHAPED, (m) => ' '.repeat(m.length));
|
|
235
|
+
}
|
|
236
|
+
else { /* every run reads */ }
|
|
237
|
+
let fits = [...new Set(digitRuns(source).filter((d) => d.length >= min && d.length <= max))];
|
|
229
238
|
// At its own question, an answer of digits and separators alone is one number when its length fits ("4111, 1111,
|
|
230
239
|
// 1111, 1111": a card read in groups of four).
|
|
231
|
-
const whole =
|
|
232
|
-
if (!fits.length && isCurrent && /^[\d\s.,-]+$/.test(
|
|
240
|
+
const whole = source.replace(/\D/g, '');
|
|
241
|
+
if (!fits.length && isCurrent && /^[\d\s.,-]+$/.test(source.trim()) && whole.length >= min && whole.length <= max) {
|
|
233
242
|
fits = [whole];
|
|
234
243
|
}
|
|
235
244
|
else { /* read by runs */ }
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:eb871898cda6efbbfc0eb7229f79d74168ed50f1a3a3e102cc29f345b72acb36";
|
|
@@ -360,6 +360,8 @@ it.
|
|
|
360
360
|
|
|
361
361
|
**A number that must name itself.** `input.confirm_out_of_order: {word, word_es, message, message_es}` (default off): out of order a number fills this input only beside its word, in either language ("account 5373850"). Alone it may be something else, a code said with an extra digit, so nothing is filled: the caller hears `message` (`{value}` the number, digit by digit on a call; `{word}` the word) and the current question again, which counts as an attempt at that question. It works at `collect-input` and `confirm-form` questions. At its own question the number needs no word. `authenticate-user`'s `code_confirm` takes the same declaration for a `code_validator`, whose flow reads it with the helpers `saysConfirmWord(answer, spec)` and `confirmOutOfOrderLine(spec, value, language, voice)`.
|
|
362
362
|
|
|
363
|
+
**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`).
|
|
364
|
+
|
|
363
365
|
**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.
|
|
364
366
|
|
|
365
367
|
Some options are **never offered**, so the ranker cannot pick them: the YES of a firm confirmation (an input's, or a form's
|
|
@@ -219,6 +219,7 @@ Declarations:
|
|
|
219
219
|
| profile `out_of_order:{…}` | A narrower signature for out-of-order reading: the payment card takes a bare last four when asked, but out of order only a card word or "ending in 4242". |
|
|
220
220
|
| `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. |
|
|
221
221
|
| 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. |
|
|
222
|
+
| 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. |
|
|
222
223
|
| input `choices_from` | The choice's values come from prepared data (the caller's saved cards), so its signature is those values. |
|
|
223
224
|
|
|
224
225
|
Rules, in order:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.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",
|