jsfe 1.94.0 → 1.95.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.
@@ -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,4EAYC;AAED;kIACkI;AAClI;;;;SAUC;AAwHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAgKD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AA/QD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAkSzC,0BAAsK"}
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,4EAYC;AAED;kIACkI;AAClI;;;;SAUC;AAwHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAkKD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AAjRD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAoSzC,0BAAsK"}
@@ -361,7 +361,9 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
361
361
  'condition: wants_other_account': toParent(call('otp_change_account', 'authenticate-user', { cell_number: '', email: '', retrying: true, declined_caller: true }, 'replace')),
362
362
  // Email asked for at a code sent by text: authentication is an input step, so the contact question is asked again
363
363
  // (without the caller-ID offer) and the caller gives the email; a code sent by email keeps "no me llegó el correo" a resend.
364
- ['condition: email_too && normalized_otp_code.length !== 6 && (' + 'matchesChoice(user_choice,otp_phrases.resend) || matchesChoice(user_choice,otp_phrases.cannot_find) || matchesChoice(user_choice,otp_phrases.another_way) || matchesChoice(user_choice,otp_phrases.email)' + ')']: call('otp_email_too', 'send-otp-email-too'),
364
+ // "I don't have that phone" (owner 2026-11-26) is the strongest case for the second code: the code went to the account's
365
+ // cell on file (an account number was given) and the caller no longer has it.
366
+ ['condition: email_too && normalized_otp_code.length !== 6 && (' + 'matchesChoice(user_choice,otp_phrases.resend) || matchesChoice(user_choice,otp_phrases.cannot_find) || matchesChoice(user_choice,otp_phrases.another_way) || matchesChoice(user_choice,otp_phrases.email) || matchesChoice(user_choice,otp_phrases.noPhone) || ' + expression(otpPhoneUnavailable, 'user_choice') + ')']: call('otp_email_too', 'send-otp-email-too'),
365
367
  'condition: !!cargo.otp_cell_number && normalized_otp_code.length !== 6 && matchesChoice(user_choice,otp_phrases.email)': toParent(call('otp_use_email', 'authenticate-user', { cell_number: '', email: '', retrying: true, declined_caller: true }, 'replace')),
366
368
  "condition: isExitRequest(user_choice)": call('otp_exit', '{{otp_cancel}}', undefined, 'reboot'),
367
369
  "condition: isAgentRequest(user_choice)": call('otp_agent', 'live-agent-requested', undefined, 'reboot'),
@@ -374,7 +376,7 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
374
376
  "condition: answer_key === 'code_notice'": effect('otp_tenant_notice_said', 'true'),
375
377
  'condition: normalized_otp_code.length > 0 && Number(cargo.otpFormatMisses || 0)<2': say('otp_bad_format', "I was expecting a 6-digit code. Let's try again.", "Esperaba un código de 6 dígitos. Intentemos de nuevo."),
376
378
  'condition: normalized_otp_code.length > 0': effect('otp_format_cap_next', 'true'),
377
- ['condition: matchesChoice(user_choice,otp_phrases.noPhone) || ' + expression(otpPhoneUnavailable, 'user_choice')]: otpMenu('otp_no_phone', "No problem. Then the code can't reach you there. You can use the email on your account instead, or {{cargo.verb}} AGENT to reach a person.", 'No hay problema. Entonces el código no le puede llegar ahí. Puede usar el correo electrónico de su cuenta, o {{cargo.verb_es}} AGENTE para hablar con una persona.', false),
379
+ ['condition: matchesChoice(user_choice,otp_phrases.noPhone) || ' + expression(otpPhoneUnavailable, 'user_choice')]: otpMenu('otp_no_phone', "No problem. Then the code can't reach you there. To reach a person, {{cargo.verb}} AGENT.", 'No hay problema. Entonces el código no le puede llegar ahí. Para hablar con una persona, {{cargo.verb_es}} AGENTE.', false),
378
380
  default: set('otp_words_missing', 'no_code_given', 'true')
379
381
  }),
380
382
  // An answer none of the above reads goes to the reply ranker (owner 2026-10-29: prod 10-28, 128 of 238 such replies were
@@ -396,14 +398,14 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
396
398
  // is answering, so it is no miss. Its own bound: from the fourth, it counts as a word miss again.
397
399
  set('otp_hold_cap', 'no_code_given', "no_code_given || !!(otp_reply && otp_reply.key === 'has_code' && (cargo.otpCodeHolds=Number(cargo.otpCodeHolds || 0)+1) > 3)"),
398
400
  cases('otp_reply_route', {
399
- "condition: !no_code_given && email_too && otp_reply && ['email','resend','cannot_find','another_way'].includes(otp_reply.key)": call('otp_ranked_email_too', 'send-otp-email-too'),
401
+ "condition: !no_code_given && email_too && otp_reply && ['email','resend','cannot_find','another_way','no_phone'].includes(otp_reply.key)": call('otp_ranked_email_too', 'send-otp-email-too'),
400
402
  "condition: !no_code_given && otp_reply && otp_reply.key === 'email'": toParent(call('otp_ranked_email', 'authenticate-user', { cell_number: '', email: '', retrying: true, declined_caller: true }, 'replace')),
401
403
  "condition: !no_code_given && otp_reply && otp_reply.key === 'another_account'": toParent(call('otp_ranked_account', 'authenticate-user', { cell_number: '', email: '', retrying: true, declined_caller: true }, 'replace')),
402
404
  "condition: !no_code_given && otp_reply && (otp_reply.key === 'where' || otp_reply.key === 'cannot_find')": say('otp_ranked_where', '{{otp_where}}', '{{otp_where_es}}'),
403
405
  "condition: !no_code_given && otp_reply && otp_reply.key === 'another_way'": say('otp_ranked_no_other_way', '{{otp_where}} To reach a person, {{cargo.verb}} AGENT.', '{{otp_where_es}} Para hablar con una persona, {{cargo.verb_es}} AGENTE.'),
404
406
  "condition: !no_code_given && otp_reply && otp_reply.key === 'has_code'": say('otp_ranked_has_code', 'Go ahead. Read me the six digits when you have them.', 'Adelante. Dígame los seis dígitos cuando los tenga.'),
405
407
  "condition: !no_code_given && otp_reply && otp_reply.key === 'resend'": call('otp_ranked_resend', 'resend-otp-code', { resend_reason: 'requested' }),
406
- "condition: !no_code_given && otp_reply && otp_reply.key === 'no_phone'": otpMenu('otp_ranked_no_phone', "No problem. Then the code can't reach you there. You can use the email on your account instead, or {{cargo.verb}} AGENT to reach a person.", 'No hay problema. Entonces el código no le puede llegar ahí. Puede usar el correo electrónico de su cuenta, o {{cargo.verb_es}} AGENTE para hablar con una persona.', false),
408
+ "condition: !no_code_given && otp_reply && otp_reply.key === 'no_phone'": otpMenu('otp_ranked_no_phone', "No problem. Then the code can't reach you there. To reach a person, {{cargo.verb}} AGENT.", 'No hay problema. Entonces el código no le puede llegar ahí. Para hablar con una persona, {{cargo.verb_es}} AGENTE.', false),
407
409
  "condition: !no_code_given && otp_reply && otp_reply.key === 'no_other_account'": say('otp_ranked_no_other_account', 'I understand. We still need to secure access to your account.', 'Entiendo. Aún necesitamos asegurar el acceso a su cuenta.'),
408
410
  "condition: !no_code_given && otp_reply && otp_reply.key === '__agent'": call('otp_ranked_agent', 'live-agent-requested', undefined, 'reboot'),
409
411
  default: effect('otp_reply_route_none', 'true')
@@ -1 +1 @@
1
- {"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"AAoLA,0BAAgC"}
1
+ {"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"AAwMA,0BAAgC"}
@@ -15,6 +15,9 @@
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
+ * - Any item to a target that is not the caller's own (their phone, the verified cell, the email on file) is read back and
19
+ * sent only on YES, with a warning for the web link, the whole conversation, or a registered document that declares a
20
+ * disclaimer (owner 2026-11-26: anything in the chat may be sensitive). A sender item's own flow gates its destination.
18
21
  * No authentication gate here (owner rule: an authenticated caller's chat and documents are theirs to send anywhere;
19
22
  * before authentication no reply holds account data). A sender flow gates its own document.
20
23
  */
@@ -50,7 +53,7 @@ const sendCopy = defineWorker({
50
53
  ],
51
54
  variables: vars({
52
55
  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: '',
53
- 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: '',
56
+ 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_trusted: true, sc_warning: '', sc_warning_es: '', sc_target: '', sc_confirm_q: '', sc_confirm_q_es: '',
54
57
  }),
55
58
  steps: [
56
59
  set('sc_items', 'sc_items', 'sendables(cargo)'),
@@ -156,6 +159,22 @@ const sendCopy = defineWorker({
156
159
  })),
157
160
  when('sc_email_read', "sc_medium === 'email' && !sc_to", set('sc_email_pick', 'sc_to', "cargo.email && validateEmail(String(cargo.email)) ? String(cargo.email) : ''")),
158
161
  when('sc_email_none_end', "sc_medium === 'email' && !sc_to", end('sc_email_none_done')),
162
+ // a target that is not the caller's own (their phone, the verified cell, the email on file): read back, with the item's
163
+ // warning when it has one (the web link, the whole conversation, a registered document's disclaimer), sent only on YES
164
+ set('sc_trusted', 'sc_trusted', "(sc_medium === 'email' ? sc_to.toLowerCase() === String(cargo.otp_email || '').trim().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)"),
165
+ when('sc_warning', '!sc_trusted', set('sc_warning_set', '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) + ' ' : ''")),
166
+ when('sc_warning_es', '!sc_trusted', set('sc_warning_es_set', '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) + ' ' : ''")),
167
+ when('sc_target', '!sc_trusted', 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')")),
168
+ when('sc_confirm_q', '!sc_trusted', set('sc_confirm_q_set', 'sc_confirm_q', "sc_warning + 'Should I send it to ' + sc_target + '? ' + yesNoKeys('en', cargo)")),
169
+ when('sc_confirm_q_es', '!sc_trusted', set('sc_confirm_q_es_set', 'sc_confirm_q_es', "sc_warning_es + '¿Se lo envío a ' + sc_target + '? ' + yesNoKeys('es', cargo)")),
170
+ when('sc_confirm', '!sc_trusted', call('sc_confirm_ask', 'ask-choice', {
171
+ question: '{{sc_confirm_q}}',
172
+ question_es: '{{sc_confirm_q_es}}',
173
+ choices: [{ key: 'yes', phrases: ['1'] }, { key: 'no', phrases: ['2'] }],
174
+ digits: { min: 1, max: 1 },
175
+ })),
176
+ when('sc_confirm_no', "!sc_trusted && cargo.choice !== 'yes'", say('sc_confirm_no_say', "Okay, I didn't send it." + ANYTHING_ELSE, 'De acuerdo, no lo envié.' + ANYTHING_ELSE_ES)),
177
+ when('sc_confirm_no_end', "!sc_trusted && cargo.choice !== 'yes'", end('sc_confirm_no_done', { outcome: 'unresolved', reason: 'declined' })),
159
178
  // send: a sender item runs its flow (it tells the caller); content goes as is
160
179
  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'"),
161
180
  when('sc_send_text', "sc_medium === 'text'", call('sc_send_text_call', 'send-text', { message: '{{sc_content}}' })),
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Register (or replace, by key) a document the caller may ask to be sent. Throws on a malformed entry: a flow that
3
3
  * registers something unsendable is a flow bug and must fail where it is written, not when a caller asks for it.
4
+ * disclaimer / disclaimer_es (a content entry only): said before the document is sent to a number or email that is not the
5
+ * caller's own, with the read-back SendCopy asks then (owner 2026-11-26).
4
6
  * → true, so it can stand in a SET expression.
5
7
  */
6
8
  export function registerSendable(cargo: any, entry: any): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"sendables.d.ts","sourceRoot":"","sources":["../../src/helpers/sendables.js"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,kEAqCC;AAED;;;;;;;;GAQG;AACH,6CAeC;AAED;;;GAGG;AACH,wEAOC;AAGD;;;;;;GAMG;AACH,mEAwBC;AAED;;;GAGG;AACH,gEAeC;AAED;;;;GAIG;AACH,oEAsBC;AArLD,8GAA8G;AAC9G,+BAAgC,cAAc,CAAC;AAC/C,mFAAmF;AACnF,2BAA4B,UAAU,CAAC"}
1
+ {"version":3,"file":"sendables.d.ts","sourceRoot":"","sources":["../../src/helpers/sendables.js"],"names":[],"mappings":"AAiCA;;;;;;GAMG;AACH,kEAgDC;AAED;;;;;;;;GAQG;AACH,6CAeC;AAED;;;GAGG;AACH,wEAOC;AAGD;;;;;;GAMG;AACH,mEAwBC;AAED;;;GAGG;AACH,gEAeC;AAED;;;;GAIG;AACH,oEAsBC;AAlMD,8GAA8G;AAC9G,+BAAgC,cAAc,CAAC;AAC/C,mFAAmF;AACnF,2BAA4B,UAAU,CAAC"}
@@ -31,6 +31,8 @@ const mediaError = (media) => (media === undefined || (Array.isArray(media) && m
31
31
  /**
32
32
  * Register (or replace, by key) a document the caller may ask to be sent. Throws on a malformed entry: a flow that
33
33
  * registers something unsendable is a flow bug and must fail where it is written, not when a caller asks for it.
34
+ * disclaimer / disclaimer_es (a content entry only): said before the document is sent to a number or email that is not the
35
+ * caller's own, with the read-back SendCopy asks then (owner 2026-11-26).
34
36
  * → true, so it can stand in a SET expression.
35
37
  */
36
38
  export function registerSendable(cargo, entry) {
@@ -58,6 +60,12 @@ export function registerSendable(cargo, entry) {
58
60
  else if (entry.args !== undefined && !isText(entry.sender)) {
59
61
  throw new Error(`registerSendable(${entry.key}): args belong to a sender entry`);
60
62
  }
63
+ else if ((entry.disclaimer !== undefined && !isText(entry.disclaimer)) || (entry.disclaimer_es !== undefined && !isText(entry.disclaimer_es))) {
64
+ throw new Error(`registerSendable(${entry.key}): disclaimer and disclaimer_es, when given, must be nonempty strings`);
65
+ }
66
+ else if (entry.disclaimer !== undefined && isText(entry.sender)) {
67
+ throw new Error(`registerSendable(${entry.key}): a disclaimer belongs to a content entry (a sender flow gates its own destination)`);
68
+ }
61
69
  else if (mediaError(entry.media)) {
62
70
  throw new Error(`registerSendable(${entry.key}): ${mediaError(entry.media)}`);
63
71
  }
@@ -69,6 +77,14 @@ export function registerSendable(cargo, entry) {
69
77
  else {
70
78
  // English label only: the ranker reads the label in either language.
71
79
  }
80
+ for (const field of ['disclaimer', 'disclaimer_es']) {
81
+ if (isText(entry[field])) {
82
+ stored[field] = entry[field];
83
+ }
84
+ else {
85
+ // not declared: no warning before a send to someone else
86
+ }
87
+ }
72
88
  if (isText(entry.content)) {
73
89
  stored.content = entry.content;
74
90
  }
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:e79e2190dd5898c56afed262ef1d0db775ad798fe91843a5736b8d7c5f555007";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:493220aa2e49f0f7dc6280917ff389665487e77baab92182b724bc9cea648ab1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.94.0",
3
+ "version": "1.95.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",