jsfe 1.91.0 → 1.92.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.
@@ -61,6 +61,13 @@ export function isReaderFiller(text: any, templateWords?: any[]): any;
61
61
  * whole answer is an agent request and EXIT only on exit/quit/salir/abort (cancel is an answer there).
62
62
  */
63
63
  export function pickChoice(answer: any, choices: any, acceptOther: any): any;
64
+ /**
65
+ * pickChoice for a flow's own word reader, tight (owner 2026-11-24: a word inside a sentence never decides; the reply ranker
66
+ * does). A choice's phrase picks only when the rest of the answer is courtesy, connecting words, numbers or `templateWords`
67
+ * (isReaderFiller, the rule of profile.whole_phrases); otherwise ''. Keys, YES words and agent/exit picks are pickChoice's
68
+ * (already whole-answer). "where is my order, please" picks; "it says delivered but I never got it" does not.
69
+ */
70
+ export function pickWholeChoice(answer: any, choices: any, templateWords?: any[]): any;
64
71
  export namespace ANSWER_WORDS {
65
72
  let yes: string[];
66
73
  let no: string[];
@@ -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;AAuBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAqCC;AAqBD,oEAqBC;AASD,gJAAgJ;AAChJ,sEAGC;AAED;;;;;;;;;GASG;AACH,6EA4GC;;;;;;;;AA/gBD,qCAKwE"}
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;AAuBD;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAqCC;AAqBD,oEAqBC;AASD,gJAAgJ;AAChJ,sEAGC;AAED;;;;;;;;;GASG;AACH,6EA4GC;AAED;;;;;GAKG;AACH,uFAeC;;;;;;;;AAtiBD,qCAKwE"}
@@ -599,3 +599,27 @@ export function pickChoice(answer, choices, acceptOther) {
599
599
  return '';
600
600
  }
601
601
  }
602
+ /**
603
+ * pickChoice for a flow's own word reader, tight (owner 2026-11-24: a word inside a sentence never decides; the reply ranker
604
+ * does). A choice's phrase picks only when the rest of the answer is courtesy, connecting words, numbers or `templateWords`
605
+ * (isReaderFiller, the rule of profile.whole_phrases); otherwise ''. Keys, YES words and agent/exit picks are pickChoice's
606
+ * (already whole-answer). "where is my order, please" picks; "it says delivered but I never got it" does not.
607
+ */
608
+ export function pickWholeChoice(answer, choices, templateWords = []) {
609
+ const key = pickChoice(answer, choices, false);
610
+ const choice = (Array.isArray(choices) ? choices : []).find((c) => c && c.key === key);
611
+ if (!key || !choice) {
612
+ return key;
613
+ }
614
+ else {
615
+ const plain = (x) => ' ' + normalize(String(x ?? '').replace(/[^\p{L}\p{N}'\s]/gu, ' ')).replace(/\s+/g, ' ').trim() + ' ';
616
+ const said = plain(answer);
617
+ const hit = (choice.phrases ?? choice.words ?? []).map(plain).filter((p) => p.trim() && said.includes(p)).sort((a, b) => b.length - a.length)[0];
618
+ if (!hit) {
619
+ return key; // a key, a YES word or a spoken key: pickChoice reads those only as the whole answer
620
+ }
621
+ else {
622
+ return isReaderFiller(said.replace(hit, ' '), templateWords) ? key : '';
623
+ }
624
+ }
625
+ }
@@ -3,7 +3,7 @@ export function sharedSandbox(): any;
3
3
  export const EXPRESSION_LIMITS: Readonly<{
4
4
  memoryBytes: number;
5
5
  stackBytes: number;
6
- timeoutMs: 500;
6
+ steps: 1000;
7
7
  }>;
8
8
  export class ExpressionSandbox {
9
9
  constructor(limits?: {});
@@ -14,8 +14,8 @@ export class ExpressionSandbox {
14
14
  compiled: Map<any, any>;
15
15
  released: boolean;
16
16
  };
17
- timeoutMs: 500;
18
- deadline: number;
17
+ stepLimit: 1000;
18
+ steps: number;
19
19
  depth: number;
20
20
  generation: number;
21
21
  owned: any[];
@@ -44,7 +44,7 @@ export class ExpressionSandbox {
44
44
  callback(index: any): (...args: any[]) => any;
45
45
  /** Calls a sandbox function with host arguments, inside the current evaluation. */
46
46
  call(f: any, args: any): any;
47
- /** One evaluation: a deadline, a fresh object table, every handle released at the end. */
47
+ /** One evaluation: a step budget, a fresh object table, every handle released at the end. */
48
48
  scope(run: any, approved: any): any;
49
49
  compile(source: any): any;
50
50
  hostGet(idH: any, kH: any): any;
@@ -1 +1 @@
1
- {"version":3,"file":"expression-sandbox.d.ts","sourceRoot":"","sources":["../../src/helpers/expression-sandbox.js"],"names":[],"mappings":"AA6dA,4FAA4F;AAC5F,qCAA8E;AArc9E;;;;GAA0H;AA4K1H;IACG,yBAuCC;IAjCE;;;;;;MAAc;IACd,eAA0B;IAC1B,iBAAiB;IACjB,cAAc;IACd,mBAAmB;IACnB,aAAe;IACf,cAAoB;IACpB,gBAAkB;IAAE,yBAA0B;IAC9C,YAAc;IAAE,qBAAsB;IACtC,iCAA+B;IAC/B,8BAA+B;IAK/B,SAAc;IAcd,SAAoB;IAMvB,kFAAkF;IAClF,gBAA4D;IAE5D,sCAOC;IAED,iBAAwC;IAExC,kFAAkF;IAClF,6BAGC;IAGD,iBAsBC;IAED,kEAAkE;IAClE,qBAIC;IAGD,iBAmBC;IAED,8BASC;IAED,qBAGC;IAED,iFAAiF;IACjF,uBAEW,GAAG,WAAI,SAKjB;IAED,mFAAmF;IACnF,6BAQC;IAED,0FAA0F;IAC1F,oCAuBC;IAED,0BAYC;IAGD,gCAGC;IACD,yCAKC;IACD,gCAAkI;IAClI,gCAAiI;IACjI,wBAA+G;IAC/G,gCAKC;IACD,oDAYC;IAGD,wHAAwH;IACxH,gFAYC;IAED;wHACoH;IACpH;;;;;YA+BC;CACH"}
1
+ {"version":3,"file":"expression-sandbox.d.ts","sourceRoot":"","sources":["../../src/helpers/expression-sandbox.js"],"names":[],"mappings":"AAkeA,4FAA4F;AAC5F,qCAA8E;AArc9E;;;;GAAuH;AA4KvH;IACG,yBAuCC;IAjCE;;;;;;MAAc;IACd,gBAAsB;IACtB,cAAe;IACf,cAAc;IACd,mBAAmB;IACnB,aAAe;IACf,cAAoB;IACpB,gBAAkB;IAAE,yBAA0B;IAC9C,YAAc;IAAE,qBAAsB;IACtC,iCAA+B;IAC/B,8BAA+B;IAK/B,SAAc;IAcd,SAAoB;IAMvB,kFAAkF;IAClF,gBAA4D;IAE5D,sCAOC;IAED,iBAAwC;IAExC,kFAAkF;IAClF,6BAGC;IAGD,iBAsBC;IAED,kEAAkE;IAClE,qBAIC;IAGD,iBAmBC;IAED,8BASC;IAED,qBAGC;IAED,iFAAiF;IACjF,uBAEW,GAAG,WAAI,SAKjB;IAED,mFAAmF;IACnF,6BAQC;IAED,6FAA6F;IAC7F,oCAuBC;IAED,0BAYC;IAGD,gCAGC;IACD,yCAKC;IACD,gCAAkI;IAClI,gCAAiI;IACjI,wBAA+G;IAC/G,gCAKC;IACD,oDAYC;IAGD,wHAAwH;IACxH,gFAYC;IAED;wHACoH;IACpH;;;;;YA+BC;CACH"}
@@ -21,7 +21,12 @@ const UNDEF = MARK + 'u', ABSENT = MARK + 'a';
21
21
  const BUILTINS = new Set(['Object', 'Date', 'Math', 'String', 'Number', 'Boolean', 'Array', 'JSON']);
22
22
  const identifier = /^[A-Za-z_$][\w$]*$/;
23
23
  const COMPILED_CACHE = 1000;
24
- export const EXPRESSION_LIMITS = Object.freeze({ memoryBytes: 256 * 1024 * 1024, stackBytes: 1024 * 1024, timeoutMs: 500 });
24
+ // steps: the interrupt handler's calls in one evaluation, which QuickJS makes at a fixed count of executed bytecode, so the
25
+ // limit is the expression's own work: the same verdict on any machine, under any load, and a trusted helper the expression
26
+ // calls (readFormAnswer, matchInputs) is not counted. Measured 2026-11-24 over 7.29 M evaluations (all AIDevelopment flow
27
+ // suites and jsfe's): at most 6 steps, 99.99% at 3 or fewer; a runaway loop makes 1.7-30 steps per ms, so 1,000 stops one
28
+ // within ~30-600 ms.
29
+ export const EXPRESSION_LIMITS = Object.freeze({ memoryBytes: 256 * 1024 * 1024, stackBytes: 1024 * 1024, steps: 1000 });
25
30
  // Guest runtime. The host functions it is given are captured and removed from the global object before anything else
26
31
  // runs; its API is the script's completion value, never a global.
27
32
  const GUEST = String.raw `(function () {
@@ -196,14 +201,14 @@ const guestError = (ctx, handle) => {
196
201
  };
197
202
  export class ExpressionSandbox {
198
203
  constructor(limits = {}) {
199
- const { memoryBytes, stackBytes, timeoutMs } = { ...EXPRESSION_LIMITS, ...limits };
204
+ const { memoryBytes, stackBytes, steps } = { ...EXPRESSION_LIMITS, ...limits };
200
205
  const rt = QuickJS.newRuntime();
201
206
  rt.setMemoryLimit(memoryBytes);
202
207
  rt.setMaxStackSize(stackBytes);
203
208
  const res = { rt, ctx: null, handles: [], compiled: new Map(), released: false };
204
209
  this.res = res;
205
- this.timeoutMs = timeoutMs;
206
- this.deadline = 0;
210
+ this.stepLimit = steps;
211
+ this.steps = -1; // -1 outside an evaluation: nothing is counted or interrupted
207
212
  this.depth = 0;
208
213
  this.generation = 0;
209
214
  this.owned = [];
@@ -215,7 +220,16 @@ export class ExpressionSandbox {
215
220
  this.namespaces = new WeakMap(); // a named-function namespace -> its guest object
216
221
  this.namespaceCache = new Map(); // compiled once per source (see defineNamespace)
217
222
  const self = new WeakRef(this);
218
- rt.setInterruptHandler(() => { const s = self.deref(); return !s || (s.deadline !== 0 && Date.now() > s.deadline); });
223
+ rt.setInterruptHandler(() => { const s = self.deref(); if (!s) {
224
+ return true;
225
+ }
226
+ else if (s.steps < 0) {
227
+ return false;
228
+ }
229
+ else {
230
+ s.steps++;
231
+ return s.steps > s.stepLimit;
232
+ } });
219
233
  const ctx = rt.newContext();
220
234
  res.ctx = ctx;
221
235
  this.ctx = ctx;
@@ -390,7 +404,7 @@ export class ExpressionSandbox {
390
404
  const encoded = this.own(this.guest('enc', r.value));
391
405
  return this.inn(JSON.parse(this.ctx.getString(encoded)));
392
406
  }
393
- /** One evaluation: a deadline, a fresh object table, every handle released at the end. */
407
+ /** One evaluation: a step budget, a fresh object table, every handle released at the end. */
394
408
  scope(run, approved) {
395
409
  const outer = this.depth === 0;
396
410
  const previousApproved = this.approved;
@@ -400,7 +414,7 @@ export class ExpressionSandbox {
400
414
  if (this.res.released)
401
415
  throw new Error('expression sandbox released');
402
416
  this.generation++;
403
- this.deadline = Date.now() + this.timeoutMs;
417
+ this.steps = 0;
404
418
  }
405
419
  this.depth++;
406
420
  try {
@@ -410,7 +424,7 @@ export class ExpressionSandbox {
410
424
  this.depth--;
411
425
  this.approved = previousApproved;
412
426
  if (outer) {
413
- this.deadline = 0;
427
+ this.steps = -1;
414
428
  for (const h of this.owned)
415
429
  if (h.alive)
416
430
  h.dispose();
@@ -52,6 +52,7 @@ export namespace STANDARD_FUNCTIONS {
52
52
  export { isAmountAnswer };
53
53
  export { amountInAnswer };
54
54
  export { pickChoice };
55
+ export { pickWholeChoice };
55
56
  export { withoutPromptEcho };
56
57
  export { readEmail };
57
58
  export { emailWithoutEnding };
@@ -206,6 +207,7 @@ import { isSpelledFragment } from './answer.js';
206
207
  import { isAmountAnswer } from './answer.js';
207
208
  import { amountInAnswer } from './answer.js';
208
209
  import { pickChoice } from './answer.js';
210
+ import { pickWholeChoice } from './answer.js';
209
211
  import { withoutPromptEcho } from './answer.js';
210
212
  import { readEmail } from './contact.js';
211
213
  import { emailWithoutEnding } from './contact.js';
@@ -310,5 +312,5 @@ import { sendables } from './sendables.js';
310
312
  import { chatTranscript } from './sendables.js';
311
313
  import { conversationCopy } from './sendables.js';
312
314
  import { CONVERSATION_KEY } from './sendables.js';
313
- export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY };
315
+ export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY };
314
316
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CACyC,iCAAiC;+BAIoO,wBAAwB;2CAHxP,0BAA0B;qCAA1B,0BAA0B;gCAA1B,0BAA0B;mCAC8F,qBAAqB;kCAArB,qBAAqB;iCAArB,qBAAqB;qCAArB,qBAAqB;iCAArB,qBAAqB;wC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iB;8BAAjB,iBAAiB;8BAAjB,iBAAiB;4BAI7B,iBAAiB;oCAAjB,iBAAiB;iCAHiB,oBAAoB;iCAApB,oBAAoB;kCAApB,oBAAoB;4BAApB,oBAAoB;iCA9BP,gBAAgB;0BAAhB,gBAAgB;+BAAhB,gBAAgB;iCAAhB,gBAAgB;iCAAhB,gBAAgB"}
@@ -24,7 +24,7 @@ import { consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFo
24
24
  import { sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion } from './form-sources.js';
25
25
  import { matchesChoice } from './matches-choice.js';
26
26
  import { readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions } from './money.js';
27
- import { ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho } from './answer.js';
27
+ import { ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho } from './answer.js';
28
28
  import { readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational } from './contact.js';
29
29
  import { normalizeAndFindCapture } from './capture.js';
30
30
  import { anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb } from './phrases.js';
@@ -39,13 +39,13 @@ import { joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone } fr
39
39
  import { findNumbers, assignNumbers, joinSpokenNumbers } from './numbers.js';
40
40
  import { addressDraft } from './address.js';
41
41
  import { urlToSpeech, textWithUrlToSpeech } from './url-speech.js';
42
- export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY, };
42
+ export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY, };
43
43
  /** The functions flows call by name, ready to spread into a host's approved functions. */
44
44
  export const STANDARD_FUNCTIONS = {
45
45
  continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse,
46
46
  formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor,
47
47
  clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome,
48
- readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, withoutPromptEcho,
48
+ readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho,
49
49
  readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
50
50
  normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance,
51
51
  validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, wholeSpokenNumber, numberAlone,
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:12b7415283ddd8f6d0f359c9a16e568cdb7d0c22f756fb1d76963213d6eaa3c7";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:0476062be5f39ae4a8e4509c87fa8381d08105852a61d92c5f72889a76bb18b6";
@@ -288,7 +288,7 @@ An unreadable answer with any words goes to the reply ranker, offered the questi
288
288
 
289
289
  `confirm_edit: true` on a `text` input of the form that holds a value: the read-back also offers the ranker ADD (the reply is appended to that text) and REPLACE (the reply takes its place, a leading "no," dropped); the form is then confirmed again.
290
290
 
291
- `whole_phrases: true` on a `choice`, or on a `pattern` that reads words: a word reading picks only when the whole reply is accounted for by its phrase, another input's argument (digits, an amount, a card), courtesy, connecting words and the input's `template_words` ("pay $50 with my Visa card"). Anything else goes to the reply ranker, offered the choices as above. Keypad keys and digit readings are arguments and read as before. Off by default.
291
+ `whole_phrases: true` on a `choice`, or on a `pattern` that reads words: a word reading picks only when the whole reply is accounted for by its phrase, another input's argument (digits, an amount, a card), courtesy, connecting words and the input's `template_words` ("pay $50 with my Visa card"). Anything else goes to the reply ranker, offered the choices as above. Keypad keys and digit readings are arguments and read as before. Off by default. A flow's own word reader gets the same rule from `pickWholeChoice(answer, choices, templateWords)`: `pickChoice`'s pick, kept only when the rest of the answer is courtesy, connecting words, numbers or `templateWords`, else `''` (the reply ranker reads it).
292
292
 
293
293
  A choice marked `current_only` is read only at its own question: neither the word reader nor the reply ranker offers it while another question is asked (a route's `done` or `switch` is never picked for a NO or a sub account said at the amount question). Written cents (`72.45`, `$72.45`, `287,15`) are an amount by shape: out of order they fill an open amount, and beside another field's reading (`51:72.45` at a sub account question) they are that amount, never digits of a security code or ZIP code.
294
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.91.0",
3
+ "version": "1.92.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",