jsfe 1.41.0 → 1.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/forms/address-flows.d.ts.map +1 -1
- package/dist/forms/address-flows.js +11 -8
- package/dist/forms/declarations.js +1 -1
- package/dist/forms/flows.d.ts +3 -1
- package/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +17 -8
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +7 -1
- package/dist/helpers/answer.d.ts +6 -0
- package/dist/helpers/answer.d.ts.map +1 -1
- package/dist/helpers/answer.js +10 -0
- package/dist/helpers/contextual-response.d.ts +2 -0
- package/dist/helpers/contextual-response.d.ts.map +1 -1
- package/dist/helpers/contextual-response.js +7 -1
- package/dist/helpers/form-conversation.d.ts +13 -0
- package/dist/helpers/form-conversation.d.ts.map +1 -1
- package/dist/helpers/form-conversation.js +27 -0
- package/dist/helpers/form-state.d.ts +3 -1
- package/dist/helpers/form-state.d.ts.map +1 -1
- package/dist/helpers/form-state.js +10 -2
- package/dist/helpers/index.d.ts +7 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +5 -5
- package/dist/host/reply-rank.d.ts +9 -2
- package/dist/host/reply-rank.d.ts.map +1 -1
- package/dist/host/reply-rank.js +25 -7
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +144 -6
- package/dist/runtime-identity.js +1 -1
- package/docs/architecture-guide.md +26 -1
- package/docs/copilot-reference.md +5 -1
- package/package.json +1 -1
|
@@ -267,6 +267,10 @@ The loop skips accepted data and asks the first ready missing required field. Co
|
|
|
267
267
|
|
|
268
268
|
An unreadable answer with any words goes to the reply ranker, offered the question's choices (`exact` ones too, since `exact` is how words match a choice; never the YES of a firm confirmation; a NO always) and a person (`__agent`), never text (the words and keypad key for text are read before it): a picked choice is the answer, a person is taken, a reply that picks none is asked again (counted against `max_attempts`); only `abort` or `new_request` leaves the form. `max_misses` (default two) bounds unreadable answers without words (symbols, an unexpected keypad entry): clarify the first with explicit retry text or a localized “Sorry, I didn't catch that.” prefix; yield the second utterance to DISPATCH while preserving the draft. A form confirmation's unread answers are ranked the same way (offered NO, never YES); after two, the `give-up` worker takes over. Validator failures use a separate `max_attempts` budget. An out-of-order accepted answer is not a miss. On exhaustion the nearest declared `on_exhausted` receives `{form,input,failed_form,failed_input,reason:"attempts_exhausted"}` and must deliberately recover that branch; it does not receive consent.
|
|
269
269
|
|
|
270
|
+
`user_description` / `user_description_es` on a form (jsfe 1.42.0): one sentence saying what the process does, written with the engine's own `{{...}}` expressions, every input of the form in scope ('' until answered) and its data ("This process allows you to change the delivery address or delivery date for your order.{{change === 'address' ? ' You chose to change the delivery address.' : change === 'date' ? ' You chose to change the delivery date.' : ''}}"). The nearest form in the chain declaring one is used. The form's readers then offer the reply ranker `concern`; a caller who expresses doubt that the process is what they need hears the sentence, "To cancel, press the asterisk key or say EXIT." (text: "To cancel, type EXIT."; Spanish SALIR) and the question again, with no attempt counted. Declare it where a caller may mistake what the flow is doing; it applies to every question of the form and its sub-forms, so word it for all of them.
|
|
271
|
+
|
|
272
|
+
**Global keys (jsfe 1.42.0).** A whole answer `*`, EXIT, QUIT or SALIR ends every flow at any question and starts `global-exit` (default: `contact-support`; a tenant overrides it with a flow that `wraps: "global-exit"`). On a call a whole answer `9` starts `switch-to-text` when the caller can be texted. Never write a local handler for these; to give a question its own meaning for one, declare it as a choice (key or phrase): a declared choice takes the answer. CANCEL is not an exit word.
|
|
273
|
+
|
|
270
274
|
`must_complete:true` on a form (inherited by every field of it and of the forms nested in it) or on one field (`false` on a field opts out): an unreadable answer is never yielded to DISPATCH, however long, and neither is a confirmation miss or an unresolved ambiguity — the question is asked again, acknowledged. A worded reply always reaches the reply ranker, offered every choice the chain's reader accepts: a pick is taken, a clear withdrawal ends the flows, and any other verdict (a new request included) stays and says `first_task` / `first_task_es` from the nearest form declaring it, "I understand, first let's record your new card." / "Entiendo, primero vamos a registrar su tarjeta nueva.", then the field's `retry` or its question. It uses no attempt. Use it where leaving would strand an effect in progress (a payment's card, its billing-ZIP correction). Other exits stay explicit: the form's stop words, `max_attempts` with `on_exhausted`, and whatever the host intercepts before the engine. The form runaway guard counts passes without a caller answer only.
|
|
271
275
|
|
|
272
276
|
`confirm.named_fields: true` lets a caller correct a read-back in their own words: each input of this form that declares `names` and holds a value is offered to the reply ranker, and a pick extracts the new value of every such input, so one reply can change several. `confirm.reply_context` tells the ranker and the extraction what a reply may contain (never spoken); an input's `argument_description` says what its value looks like ("apartment or unit number alone, such as 4 or 12B"). A reply the word readers only partly account for goes to the ranker, so none of it is lost.
|
|
@@ -288,7 +292,7 @@ Ordinary DISPATCH is the default uncertainty escape. An explicit contextual DISP
|
|
|
288
292
|
}
|
|
289
293
|
```
|
|
290
294
|
|
|
291
|
-
Declare `response` as a local object variable. A single open string parameter whose words are the value (a reason, a description) may add `"verbatim":true`: a confident `answers` then keeps the reply as said when extraction finds nothing. Never mark a field that names something to look up (a product, a city). The reply ranker answers `answers`, `abort`, `new_request` or `
|
|
295
|
+
Declare `response` as a local object variable. A single open string parameter whose words are the value (a reason, a description) may add `"verbatim":true`: a confident `answers` then keeps the reply as said when extraction finds nothing. Never mark a field that names something to look up (a product, a city). The reply ranker answers `answers`, `abort`, `new_request`, `irrelevant`, or `concern` when the step declares `responseConcern` (a string, interpolated: what the process does) or `responseConcernForm` (a form instance: its chain's `user_description`, rendered by the engine); the flow reads `{concern:true, concern_text}` and explains (a cleared `new_request` outranks it; nothing clear is `answers`; `irrelevant` extracts nothing and the question is asked again). `responseChoices` names a flow variable holding `[{key,label,route?,parameters?}]`: the ranker is also offered `choice:<key>`. A pick sets the response variable to `{key}`, plus `also` (other declared choices the reply clears at 0.6, by score) when there are any, plus `arguments` when the choice declares `parameters:[{name,type,description}]`. `route:"new_request"` makes a pick leave like a new request. `onNoIntent:"stay"`: a `new_request` that intent detection routes to no flow is an answer to this question, and the flow continues. `answers` retains the live continuation and runs the following recovery steps; an optional typed response writes a cloned normalized object before continuing. `new_request` routes the input through intent detection; `abort` ends every flow as a RETURN with the reply `cmd_request_aborted` and outcome `user_aborted` (no recovery stamp). Neither writes that response object. Typed contextual v1 permits primitive string/boolean/number/integer fields, not object/array/jsonSchema. Missing fields remain missing. Errors preserve the pending step and prior object. Context is supplied to that decision without overwriting saved conversation history. This is existing configured intent/extraction, not authorization and not a snapshot restore.
|
|
292
296
|
|
|
293
297
|
**A form question's values in a free-form sentence** (jsfe 1.36): declare `rank_parameters` on the input (extracted when the ranker says the reply answers), `parameters` on a choice (extracted when it is picked) or `confirm.rank_parameters` (at the form's confirmation), each `[{ name, description, type?, reads? }]`. Each value is read by the form's readers as if said alone: `reads` names the input it answers, else it answers the asked question. Never a DISPATCH of your own for this. Details and rules: architecture-guide.md, "Arguments in free-form answers".
|
|
294
298
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.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",
|