jsfe 1.7.7 → 1.7.9

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.
Files changed (49) hide show
  1. package/dist/forms/authoring.d.ts +10 -0
  2. package/dist/forms/authoring.d.ts.map +1 -0
  3. package/dist/forms/authoring.js +109 -0
  4. package/dist/forms/choice-flow.js +2 -2
  5. package/dist/forms/continuation-safety.d.ts +4 -0
  6. package/dist/forms/continuation-safety.d.ts.map +1 -0
  7. package/dist/forms/continuation-safety.js +14 -0
  8. package/dist/forms/contracts.d.ts +7 -3
  9. package/dist/forms/contracts.d.ts.map +1 -1
  10. package/dist/forms/contracts.js +37 -13
  11. package/dist/forms/flows.d.ts.map +1 -1
  12. package/dist/forms/flows.js +45 -10
  13. package/dist/forms/identity-flows.d.ts.map +1 -1
  14. package/dist/forms/identity-flows.js +10 -3
  15. package/dist/forms/index.d.ts +3 -0
  16. package/dist/forms/index.d.ts.map +1 -1
  17. package/dist/forms/index.js +5 -1
  18. package/dist/forms/inspection.d.ts +12 -0
  19. package/dist/forms/inspection.d.ts.map +1 -0
  20. package/dist/forms/inspection.js +120 -0
  21. package/dist/helpers/answer.d.ts.map +1 -1
  22. package/dist/helpers/answer.js +10 -2
  23. package/dist/helpers/contextual-response.d.ts +3 -0
  24. package/dist/helpers/contextual-response.d.ts.map +1 -1
  25. package/dist/helpers/contextual-response.js +7 -0
  26. package/dist/helpers/form-conversation.d.ts +22 -0
  27. package/dist/helpers/form-conversation.d.ts.map +1 -1
  28. package/dist/helpers/form-conversation.js +29 -1
  29. package/dist/helpers/form-state.d.ts +2 -1
  30. package/dist/helpers/form-state.d.ts.map +1 -1
  31. package/dist/helpers/form-state.js +95 -8
  32. package/dist/helpers/index.d.ts +13 -1
  33. package/dist/helpers/index.d.ts.map +1 -1
  34. package/dist/helpers/index.js +7 -6
  35. package/dist/helpers/match-inputs.d.ts.map +1 -1
  36. package/dist/helpers/match-inputs.js +9 -32
  37. package/dist/helpers/money.d.ts +8 -2
  38. package/dist/helpers/money.d.ts.map +1 -1
  39. package/dist/helpers/money.js +31 -7
  40. package/dist/host/capabilities.d.ts.map +1 -1
  41. package/dist/host/capabilities.js +4 -1
  42. package/dist/index.d.ts +10 -0
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +122 -0
  45. package/dist/runtime-identity.js +1 -1
  46. package/docs/copilot-reference.md +5 -0
  47. package/docs/development-release.md +20 -0
  48. package/docs/forms.md +82 -0
  49. package/package.json +1 -1
@@ -1,3 +1,11 @@
1
+ ## 1.7.9: simpler authoring and DISPATCH ownership of conversational interpretation
2
+
3
+ The separate input-assessment classifier, model override and ASSESS-INPUT step are removed. Open-ended fields use existing contextual DISPATCH extraction and concise descriptions; an uncertain answer yields to the host with saved progress. Narrative correction phrases and broad payment refusal/tense rules are removed. Strict money reading, exact confirmation, proposal dependencies and action recovery guards remain.
4
+
5
+ Requires matched shared and tenant definitions. Updated safety revisions retire incompatible saved continuations before consuming input and preserve unknown action holds. Old meaning/assessment declarations fail admission rather than silently bypassing validation. This is an intentional removal of the 1.7.8 assessment extension, not a drop-in runtime-only upgrade. Publish and activate the matched shared/tenant definitions together; the runtime alone is not sufficient.
6
+
7
+ The Form, Provider, Performer and Worker authoring facades derive conventional metadata, parameter defaults, extraction descriptions and provider questions. Plain synchronous calculations/projections compile into ordinary guarded JSFE steps; compileExpression centralizes existing compound expression serialization. explainSession reads existing session snapshots and diffs without exposing collected values or introducing state. Runtime execution continues to consume JSON flow/tool sets, with the established shared-set composition.
8
+
1
9
  # Reproducible native JSFE development candidate
2
10
 
3
11
  The native form/performer implementation spans the engine, host and tenant flow generator. Testing an unversioned sibling symlink does not establish that a clean consumer installation will use the same engine.
@@ -63,3 +71,15 @@ Typed contextual DISPATCH binds canonical primitive fields only after ContinueCu
63
71
  Reviewed Shopify acceptance covers 47 native definitions, three primary providers, 639 domain assertions, 88 production-model synthetic journeys (336 turns), both 127-suite tenant modes, and 83 SDK test files. Customer tools remain local stubs. The 12 retained nonprimary legacy definitions serve saved continuations only; native host admission rejects known fresh legacy references and incomplete native bundles.
64
72
 
65
73
  Owner authorized publication, exact consumer pins, dev host deployment, and matched shared/native Shopify activation for all three dev tenant configurations with explicit session-only action persistence. Production deployment/activation is outside this authorization. Match runtime, system, tenant and Shopify assets; do not enable native Shopify on the older production system registry.
74
+
75
+ ## 1.7.8 explicit intake meaning and continuation safety
76
+
77
+ Optional declared field meanings use ASSESS-INPUT with a strict accept/retry/cancel/redirect result. This validation never grants action consent. Technical failure leaves input unaccepted and asks for a technical retry; late answers do not commit withdrawn work. Existing unmarked inputs do not invoke an assessment. The matched host qualifies GPT-6 Sol for this task, requires its schema-capable transport, and does not fall back to an unqualified model.
78
+
79
+ Proposal dependency handling preserves a corrected candidate through its new explicit confirmation. Opted-in continuation safety revisions stop obsolete frames and yielded form continuations before consuming new input. An uncertain prior effect remains held for authoritative reconciliation; no automatic replay or expiry releases it. Session-only mode and its confirmation, subject and attempted/completed/unknown guards remain explicit. Storage encoding and durability defaults do not change.
80
+
81
+ Payment interpretation rejects partial cents and card references as replacement amounts, distinguishes historical payment reports from new instructions, and keeps balance distinct from amount due. Identity recovery has bounded resend, lost-phone and disambiguation paths. Saved-card profiles deduplicate by stable identity and omit declined profiles.
82
+
83
+ Reviewed acceptance: 89 SDK test files; 142 legacy and 142 native flow suites; 626 hermetic and 626 real-model primary executions across 17 primaries and 167 applicable paths. Targeted model probes: consent/intake 229/230, payments 16/16 per flow set, routing 132/132. The one consent deadline safely left input unaccepted with no case filed; its late verdict was retry, and bounded same-source rechecks passed in both flow sets. Original observations remain retained. Customer effects use local stubs; these results do not claim a literal replay of the October 21 production day.
84
+
85
+ Owner authorized publication, exact pins in both consumers, dev host deployment and matching shared/ai-ar-ql activation in all three dev configs with session-only actions. Production deployment and activation are excluded. Shopify Policy remains unchanged with its later review recorded as a tenant TODO. Match runtime, host and regenerated definitions before activation; existing uncertain work must retain its hold.
package/docs/forms.md CHANGED
@@ -225,3 +225,85 @@ const reply = defineWorker({
225
225
  Builders automatically declare the intrinsic requirement `jsfe:contextual-responses:v1` and add a fail-closed entry guard requiring `contextualResponseProtocol() === 1`. This is runtime support, not a host permission or a new configuration switch. Hosts still run capability admission; unsupported intrinsic versions cannot be enabled by supplying a boolean. An older helper registry fails before tenant steps execute.
226
226
 
227
227
  Missing or invalid extracted parameters may yield an empty object. The caller must check the required fields and use its normal bounded collection/retry policy; choosing `ContinueCurrent` is not evidence that every requested value exists and never authorizes an effect. A model exception during typed continuation detection or extraction preserves the pending step and prior response object. One decision is reused per turn: incompatible typed context/schema reuse fails closed, as does reaching a typed classification after another workflow has already been activated that turn. Ordinary and untyped dispatch retain their prior routing/cache semantics.
228
+
229
+ ### Open-ended answers through contextual DISPATCH
230
+
231
+ A readable leaf field can declare `response: { description }`. Describe the information to extract concisely, for example `{name:'issue_details',profile:{kind:'text',narrative:true},response:{description:'The specific issue or desired resolution in the caller words; omit a fragment or a generic complaint announcement.'},question:'What happened?'}`.
232
+
233
+ The common collector uses existing `DISPATCH` with `onResponse:'continue'` and an `answer` extraction parameter. Its context includes the actual prepared question and the field description. An extracted answer permits ordinary deterministic validation; the stored candidate retains the caller wording. A different workflow is routed normally. `None` or a continuation without a usable answer yields to the host with the form progress saved. The host can answer with its full conversation context. Detection/extraction errors preserve the pending step and never commit the candidate.
234
+
235
+ This uses the existing tenant-configured intent/extraction roles. There is no separate classifier, model assignment, verdict taxonomy or extra request-withdrawal inference. Public activation parameters use the same descriptions, and already extracted activation or deferred candidates are not classified again. Ordinary fields keep their existing deterministic readers. Exact consent and action guards still apply independently.
236
+
237
+ Legacy callers use `collect-contextual-answer` with `question`, `question_es`, `description`, optional `choices` and `digits`, and `context` / `context_es`. It returns `cargo.choice` and preserves `cargo.choiceText`. These definitions require the existing `jsfe:contextual-responses:v1` runtime. Retired `meaning` declarations and the removed classifier capability are rejected rather than silently accepted.
238
+
239
+ Payment-intent amount reading accepts a bounded whole monetary answer. Uncertain prose yields to DISPATCH rather than inferring refusal, deferral or an earlier payment. Currency, range, identifier and partial-amount checks remain deterministic. Narrative matching preserves strict whole choices and independent structured fields without parsing conversational correction phrases.
240
+
241
+ When a declared dependency (including an ancestor subform dependency) has a pending input proposal, dependent candidates wait for that proposal rather than using the previous committed context. Deferred candidates retain the exact proposal identity. Confirming the controller preserves those candidates through dependency invalidation and validates them under the new context; declining or superseding it discards them. Independent fields still collect normally. Declare `depends_on` for contextual prerequisites and `reset_on` for changes that invalidate previously collected data.
242
+
243
+ ### Safety revisions for saved continuations
244
+
245
+ `withSafetyRevision(flow, token)` opts a definition into the `jsfe:continuation-safety:v1` contract. The token is a nonempty string, independent of the informational flow version. Change it when old serialized steps or retained FORM schemas must no longer execute. The helper adds an executable protocol guard and augments an existing contract's requirements; it does not invent a FORM contract for legacy workers. Hosts register the current `STANDARD_FUNCTIONS`.
246
+
247
+ New frames save the token. Sessions also save the definition-token snapshot so yielded FORM tasks with no active frames are checked. Before new input is processed, and after durable checkpoint restoration, a missing or different token retires obsolete stacks and safely closes unexecuted FORM tasks. The engine does not rebase old steps, restart a request, forward the old answer, or repeat effects. It returns a localized explanation and `unresolved / obsolete_continuation`; a subsequent fresh request must collect new confirmation. Unopted definitions retain their previous behavior.
248
+
249
+ If retirement encounters any attempted/unknown FORM action, session journal record, or existing payment uncertainty hold, it preserves the effect evidence and quarantines the old task. Its confirmation/proposal approvals and task index are invalidated. The session receives `continuationSafetyHold`; later turns cannot execute flows or consume durable checkpoints. This conservative restriction applies only to obsolete continuations with uncertain effects, and directs the user to configured support outside that conversation. There is no automatic release, timeout or retry. External reconciliation must resolve the effect and retire the quarantined task before deliberately clearing the hold. Cargo, identity data, action ledgers and payment holds are preserved.
250
+
251
+ The runtime never treats the informational `version` as a hot-reload instruction. An older runtime without the intrinsic contract must not activate revised definitions: matched capability admission rejects unsupported intrinsic requirements, and the executable protocol guard fails closed in standalone engines.
252
+
253
+ Semantic dispositions describe the caller's intent, not permission to perform an action. An explicit replacement request yields with `redirect`; withdrawing the owning request or prohibiting its intended action yields `cancel`. Refusing one field while continuing the same request yields `retry`, unless the declaration permits that answer (such as an unknown date). Factual negative allegations remain eligible data. Candidate instructions are evidence for this classification; they cannot change the evaluator's rules or authorize backend cancellation.
254
+
255
+ A field meaning must explicitly identify both the field and its owning service/action in `purpose`, for example collecting a date before filing a caller-requested investigation. A vague instruction to collect information does not identify what a withdrawal applies to. Author this context in the declaration; never derive it from caller keywords or rewrite it at runtime.
256
+
257
+ ## Concise authoring pilot: four components
258
+
259
+ `Form`, `Provider`, `Performer` and `Worker` from `jsfe/forms` are the preferred concise declarations for the account-info/make-payment pilot. They compile through the existing `define*` builders and validators; they add no runtime protocol. Existing declarations remain supported.
260
+
261
+ Declare `id` once; the conventional name is derived unless overridden. Parameters can be an array or a map. A string map entry supplies a string parameter description; an object entry supplies a typed descriptor and optional `default`. JSFE derives its runtime variable and removes the authoring-only default from extraction metadata. Existing advanced variable definitions remain available.
262
+
263
+ ```js
264
+ const lookup = Provider({
265
+ id: 'account-info',
266
+ description: 'Answer questions about a verified account',
267
+ parameters: { acct_number: 'The caller account number' },
268
+ provides: {
269
+ default: 'balance',
270
+ gate: { flow: 'verify-account', verified: ['cargo.verified'] },
271
+ source: { flow: 'load-account', result: 'cargo.account', refresh: 'per_turn' },
272
+ facts: [{ key: 'balance', gloss: 'The account balance', path: 'balance' }]
273
+ },
274
+ gateParameters: { acct_number: '{{acct_number}}' }
275
+ });
276
+ ```
277
+
278
+ The provider compiles its default selection and gate argument plumbing. Gate arguments can use whole template expressions; JSFE lowers them into SET steps so FLOW argument validation remains path-only. The gate and subject freshness checks are still enforced by the shared provider workers. Actual account authentication policy stays in its declaration.
279
+
280
+ A primary `Form` or `Performer` can put a public extraction `description` directly on a readable field, including a group member. JSFE derives that parameter before generating collection/reentry steps. Explicit parameters remain useful for aliases or a more restricted extraction enum. A performer can declare `provides` once; its provider question list is generated.
281
+
282
+ ```js
283
+ const payment = Performer({
284
+ id: 'make-payment', primary: true,
285
+ description: 'Make a payment',
286
+ inputs: [{ name: 'amount', field: 'amount', description: 'The requested amount' }],
287
+ performs: [chargeAction],
288
+ prepare: 'prepare-payment', present: 'present-payment',
289
+ confirm: { question: 'Authorize this exact payment?' },
290
+ project: { apply: applyPaymentResult, helpers: { recordPayment } }
291
+ });
292
+ ```
293
+
294
+ An action still declares its real effect, authentication gate, outcomes and idempotency/reconciliation policy. JSFE owns proposal identity, fresh confirmation, guarded execution and receipt application. `project.apply(cargo, {form, formSnapshot, request, result, key})` is a synchronous domain result projection that returns true; it compiles into the same validated SET-only projection used for ordinary and recovered results. It cannot replace the action executor. Helpers must be explicit; captured module closures are not serialized.
295
+
296
+ A `Worker` can use ordinary `steps`, one `call: {flow, parameters}`, or one `calculate: {value, args, result, helpers}`. Calculations are plain synchronous functions with explicit argument paths and a safe cargo result path. Use registered tools/flows for external effects. A worker's calculation result metadata and parameter variables are generated. `before` retains ordinary sequencing where needed.
297
+
298
+ ### Explain a session without another state store
299
+
300
+ ```js
301
+ const explanation = explainSession(session, { flows, previous: previousSnapshot });
302
+ // {status: 'confirmation', entries: [{kind, message, component, flowId, input, ...}]}
303
+ ```
304
+
305
+ The inspector reads existing state only. It identifies missing inputs, current proposals, recorded outcomes, holds, handoffs and source component/worker/step references. Comparing two snapshots adds changed field names and invalidated confirmations without outputting collected values. Unknown/attempted evidence takes precedence over contradictory completed records. Component provenance is compiler-generated metadata, not author-maintained bookkeeping.
306
+
307
+ This is a snapshot explanation and optional difference, not a persistent event history, model role, authorization decision or new logging stream. An empty stack does not prove that an action succeeded or that no action was attempted. A generic last result without source identity is labelled only as the most recent recorded outcome. Callers can show the messages in a debugger or retain synthetic snapshots in tests.
308
+
309
+ For a calculation embedded in an existing SET or CASE, use `compileExpression(fn, ...args)` instead of a tenant `fn.toString()` wrapper. Each argument is **developer-authored JavaScript expression source**, not a caller value; bind caller data through existing variables and paths. Functions must be synchronous and use declared arguments or existing runtime helpers. `Worker.calculate` remains the simpler choice for a whole calculation and retains its path-only argument checks. Collectors may also declare `provides` once; JSFE derives their provider question list just as it does for performers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.7.7",
3
+ "version": "1.7.9",
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",