@ferricstore/ferricstore 0.13.0 → 0.13.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.
Files changed (74) hide show
  1. package/README.md +43 -1
  2. package/dist/index.cjs +230 -82
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +30 -6
  5. package/dist/index.d.ts +30 -6
  6. package/dist/index.js +229 -82
  7. package/dist/index.js.map +1 -1
  8. package/dist/langgraph.cjs.map +1 -1
  9. package/dist/langgraph.js.map +1 -1
  10. package/dist/openai-agents.cjs.map +1 -1
  11. package/dist/openai-agents.js.map +1 -1
  12. package/docs/api/assets/hierarchy.js +1 -1
  13. package/docs/api/assets/highlight.css +9 -2
  14. package/docs/api/assets/navigation.js +1 -1
  15. package/docs/api/assets/search.js +1 -1
  16. package/docs/api/classes/ConnectionClosedError.html +4 -4
  17. package/docs/api/classes/FerricStoreClient.html +13 -13
  18. package/docs/api/classes/FerricStoreError.html +1 -0
  19. package/docs/api/classes/FlowAlreadyExistsError.html +3 -3
  20. package/docs/api/classes/FlowNotFoundError.html +3 -3
  21. package/docs/api/classes/FlowWrongStateError.html +3 -3
  22. package/docs/api/classes/HTTPTransportError.html +13 -7
  23. package/docs/api/classes/InvalidCommandError.html +3 -3
  24. package/docs/api/classes/LeaseRenewalError.html +1 -1
  25. package/docs/api/classes/LockHeldError.html +3 -3
  26. package/docs/api/classes/LockNotOwnedError.html +3 -3
  27. package/docs/api/classes/NativeAdapter.html +3 -3
  28. package/docs/api/classes/OverloadedError.html +5 -5
  29. package/docs/api/classes/QueueCompletionError.html +1 -1
  30. package/docs/api/classes/RequestNotSentError.html +225 -0
  31. package/docs/api/classes/RequestTimeoutError.html +6 -6
  32. package/docs/api/classes/RerouteError.html +3 -3
  33. package/docs/api/classes/StaleLeaseError.html +3 -3
  34. package/docs/api/classes/StalePolicyGenerationError.html +3 -3
  35. package/docs/api/classes/WorkflowContext.html +7 -9
  36. package/docs/api/functions/classifyServerError.html +1 -1
  37. package/docs/api/functions/mapException.html +1 -1
  38. package/docs/api/hierarchy.html +21 -20
  39. package/docs/api/index.html +30 -2
  40. package/docs/api/interfaces/AdvanceOptions.html +9 -5
  41. package/docs/api/interfaces/AlreadyAppliedOutcome.html +1 -1
  42. package/docs/api/interfaces/AppliedStepOutcome.html +1 -1
  43. package/docs/api/interfaces/CancelOptions.html +12 -8
  44. package/docs/api/interfaces/CompleteOptions.html +12 -8
  45. package/docs/api/interfaces/CompleteOutcome.html +1 -1
  46. package/docs/api/interfaces/ExtendLeaseOptions.html +10 -8
  47. package/docs/api/interfaces/FailOptions.html +12 -8
  48. package/docs/api/interfaces/FailOutcome.html +1 -1
  49. package/docs/api/interfaces/HistoryOptions.html +16 -16
  50. package/docs/api/interfaces/LeaseMutationOptions.html +10 -6
  51. package/docs/api/interfaces/MutateOptions.html +7 -3
  52. package/docs/api/interfaces/NamedValueMutation.html +1 -1
  53. package/docs/api/interfaces/ReadOptions.html +11 -11
  54. package/docs/api/interfaces/RetryOptions.html +12 -8
  55. package/docs/api/interfaces/RetryOutcome.html +1 -1
  56. package/docs/api/interfaces/RunStepsItem.html +3 -3
  57. package/docs/api/interfaces/RunStepsManyOptions.html +11 -11
  58. package/docs/api/interfaces/SearchOptions.html +12 -12
  59. package/docs/api/interfaces/StepContinueOptions.html +15 -11
  60. package/docs/api/interfaces/StepOptions.html +15 -8
  61. package/docs/api/interfaces/StepResult.html +3 -3
  62. package/docs/api/interfaces/TDigestCreateOptions.html +1 -1
  63. package/docs/api/interfaces/TDigestMergeOptions.html +1 -1
  64. package/docs/api/interfaces/TransitionOptions.html +14 -10
  65. package/docs/api/interfaces/TransitionOutcome.html +1 -1
  66. package/docs/api/media/design.md +12 -1
  67. package/docs/api/modules.html +2 -2
  68. package/docs/api/types/ConnectionRequestDisposition.html +1 -1
  69. package/docs/api/types/ManagementPairs.html +1 -1
  70. package/docs/api/types/RequestDisposition.html +1 -1
  71. package/docs/api/types/SearchStateMeta.html +1 -1
  72. package/docs/api/variables/FERRICSTORE_SDK_VERSION.html +1 -1
  73. package/docs/design.md +12 -1
  74. package/package.json +1 -1
package/README.md CHANGED
@@ -34,7 +34,7 @@ covers every public adapter class and option.
34
34
 
35
35
  ## Compatibility
36
36
 
37
- TypeScript SDK `0.12.0` requires FerricStore server `0.11.4` or newer. With
37
+ TypeScript SDK `0.13.1` requires FerricStore server `0.11.4` or newer. With
38
38
  FerricStore 0.11.11 it negotiates compact Stream mode 34 for homogeneous auto-ID
39
39
  `XADD` pipelines and compact Pub/Sub mode 35 for homogeneous `PUBLISH`
40
40
  pipelines. Native wire protocol v1 and the generic fallback are unchanged.
@@ -232,6 +232,11 @@ unclassified failures are treated conservatively as possibly sent.
232
232
  timeouts while waiting for a local flow-control or write-queue slot are
233
233
  `"unsent"`, while a request whose frame entered the socket is
234
234
  `"possibly_sent"`. Do not automatically retry a possibly-sent mutation.
235
+ HTTP `408` responses, truncated responses, stream resets, and other failures
236
+ after dispatch are also treated as uncertain even if an intermediary labels
237
+ them retry-safe. Local HTTP validation, encoding, size-limit, closed-client,
238
+ and unsupported-command failures are marked `"unsent"` and perform no network
239
+ exchange.
235
240
  `autoReconnect` accepts `maxRetries`, `baseDelayMs`, `maxDelayMs`, and
236
241
  `jitterPct`; backoff is applied only after a reconnect attempt itself fails.
237
242
 
@@ -380,6 +385,43 @@ Handlers return explicit durable outcomes:
380
385
 
381
386
  FerricFlow does not replay TypeScript handler code. Workers claim a durable state, run normal code, then write the next state through the FerricFlow API.
382
387
 
388
+ For chainable state changes, pass the current claim directly to `advance()`.
389
+ It reads the workflow identity, logical state, lease token, and fencing token
390
+ from the claim and returns the renewed claim:
391
+
392
+ ```ts
393
+ job = await flow.advance(job, { toState: "schedule_warning" });
394
+ ```
395
+
396
+ Use `step()` when a closure result must be journaled with the transition:
397
+
398
+ ```ts
399
+ const stepped = await flow.step(job, {
400
+ name: "charge-customer:v1",
401
+ run: async () => await stripe.charges.create(
402
+ { amount: 150, currency: "usd", customer: customerId },
403
+ { idempotencyKey: `${job.id}:charge-customer:v1` }
404
+ ),
405
+ toState: "schedule_warning"
406
+ });
407
+ job = stepped.job;
408
+ ```
409
+
410
+ The step name must remain stable across retries. A committed result is returned
411
+ without running the closure again. A worker can still stop after an external
412
+ effect succeeds but before FerricStore commits the result, so external systems
413
+ still need the same stable provider idempotency key. The closure runs in the
414
+ calling worker's JavaScript execution context; the SDK does not move it to a
415
+ global thread pool.
416
+
417
+ `nowMs` is an explicit client timestamp sent with a command. When omitted, the
418
+ SDK samples the client wall clock separately for each request. It is intended
419
+ mainly for deterministic tests and is not a server-response timestamp or a
420
+ transport timeout. `timeoutMs`, by contrast, is the client-side request
421
+ deadline. For a command that intentionally blocks on the server, its declared
422
+ server wait is added to that client deadline; an unbounded server wait has no
423
+ response timer.
424
+
383
425
  Per-job `run()` workers cap every claim to currently available concurrency. They continuously refill slots by default, so if five of ten jobs finish and their terminal writes are acknowledged, one client-side `claim(limit: 5)` can start five replacements while the other five continue. Queue completions produced in the same event-loop turn remain batched. A slot stays occupied through its `complete`, `retry`, or `fail` acknowledgement; the worker never exceeds its local concurrency limit.
384
426
 
385
427
  Full-record claims across multiple states are returned by the claim command itself, including requested payloads and named values. `FLOW.GET` hydration is retained only for compatibility with a server that unexpectedly returns legacy compact tuples. That fallback preserves result order and is bounded to 16 concurrent reads by default; set `legacyClaimHydrationConcurrency` on the client to tune it. If a fallback read fails, `ClaimHydrationError.claimed` contains every already-leased job, while `hydratedItems` contains the indexed records that finished successfully; `failedIndex` and `cause` identify the first observed failure. Set `jobOnly: true` when compact claim metadata is sufficient; compact state metadata is decoded directly from the claim response without per-job `FLOW.GET` calls.