domain0 0.3.2 → 0.4.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.
Files changed (40) hide show
  1. package/README.md +17 -6
  2. package/dist/contracts.cjs +1 -1811
  3. package/dist/contracts.cjs.map +1 -1
  4. package/dist/contracts.d.cts +2 -2
  5. package/dist/contracts.d.mts +2 -2
  6. package/dist/contracts.mjs +1 -1665
  7. package/dist/contracts.mjs.map +1 -1
  8. package/dist/error-1Gob8Pup.cjs +2 -0
  9. package/dist/{error-BB4-lyc4.cjs.map → error-1Gob8Pup.cjs.map} +1 -1
  10. package/dist/error-szz6-UFL.mjs +2 -0
  11. package/dist/{error-Cyd6a9ay.mjs.map → error-szz6-UFL.mjs.map} +1 -1
  12. package/dist/{index-sSrRFTnm.d.cts → index-DzGqFq0D.d.cts} +1678 -128
  13. package/dist/{index-sSrRFTnm.d.mts → index-DzGqFq0D.d.mts} +1678 -128
  14. package/dist/index.cjs +1 -245
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +3 -3
  17. package/dist/index.d.mts +3 -3
  18. package/dist/index.mjs +1 -90
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/sdk-BbUuEwzs.mjs +148 -0
  21. package/dist/sdk-BbUuEwzs.mjs.map +1 -0
  22. package/dist/{sdk-B10fN-QP.d.mts → sdk-CkEDIlsq.d.cts} +8 -9
  23. package/dist/{sdk-DYR5Itru.d.cts → sdk-D2QNoMIg.d.mts} +8 -9
  24. package/dist/sdk-Dv22iteS.cjs +148 -0
  25. package/dist/sdk-Dv22iteS.cjs.map +1 -0
  26. package/dist/server.cjs +1 -102
  27. package/dist/server.cjs.map +1 -1
  28. package/dist/server.mjs +1 -101
  29. package/dist/server.mjs.map +1 -1
  30. package/dist/ui.cjs +1 -12
  31. package/dist/ui.d.cts +22 -3
  32. package/dist/ui.d.mts +22 -3
  33. package/dist/ui.mjs +1 -2
  34. package/package.json +7 -1
  35. package/dist/error-BB4-lyc4.cjs +0 -48
  36. package/dist/error-Cyd6a9ay.mjs +0 -31
  37. package/dist/sdk-DILJWt1m.cjs +0 -4264
  38. package/dist/sdk-DILJWt1m.cjs.map +0 -1
  39. package/dist/sdk-IuBNH4cL.mjs +0 -4187
  40. package/dist/sdk-IuBNH4cL.mjs.map +0 -1
package/README.md CHANGED
@@ -286,12 +286,14 @@ it to resolve records in the browser. Conditional intent is resolved by the
286
286
  backend when the provider is selected, preventing a caller from claiming a
287
287
  capability the provider has not proved.
288
288
 
289
- The framework-neutral UI exposes fully typed `onStepChange`, `onSuccess`, and
290
- `onClose` lifecycle callbacks. Step events are deduplicated, success is emitted
291
- once per open modal session, and close events distinguish the close button,
292
- Escape, programmatic close, and destruction. The lower-level
293
- `onConnectionChange` observer is revision-aware and does not repeat an
294
- unchanged connection.
289
+ The framework-neutral UI exposes fully typed `onStepChange`, `onSuccess`,
290
+ `onFailure`, `onError`, and `onClose` lifecycle callbacks. Step events are
291
+ deduplicated, success is emitted once per open modal session, and each failed
292
+ connection revision emits once. SDK errors are classified into sanitized
293
+ configuration, API, transport, protocol, and unexpected variants. Close events
294
+ separate their interaction `trigger` from the final success, failure,
295
+ cancellation, or incomplete `outcome`. The lower-level `onConnectionChange`
296
+ observer is revision-aware and does not repeat an unchanged connection.
295
297
 
296
298
  For an Entri-style high-level lifecycle, use the singleton `domain0` export or
297
299
  create an isolated instance with `createDomain0()`. `connectDomain()` mounts
@@ -401,6 +403,8 @@ await domain0.connectDomain({
401
403
  onEvent: (event) => {
402
404
  switch (event.type) {
403
405
  case 'success':
406
+ case 'failure':
407
+ case 'error':
404
408
  case 'close':
405
409
  case 'step_change':
406
410
  case 'manual_setup_documentation_click':
@@ -419,6 +423,13 @@ await domain0.connectDomain({
419
423
  })
420
424
  ```
421
425
 
426
+ `failure` means the persisted connection workflow entered
427
+ `failed_retryable` or `failed_terminal`. `error` means the SDK itself could not
428
+ complete an operation. The distinction lets hosts offer connection recovery
429
+ without treating network or integration faults as domain-state transitions.
430
+ Error events contain stable safe codes, retryability, and an API request ID
431
+ when available; raw causes and provider responses are never emitted.
432
+
422
433
  Providing `onRequestClose` intercepts only the in-widget Close button. The
423
434
  modal remains open until the host closes it, and `onClose` fires only after the
424
435
  real close. Manual-guide events fire only from the manual instructions screen.