@lunora/react 1.0.0-alpha.20 → 1.0.0-alpha.200

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 (70) hide show
  1. package/README.md +25 -18
  2. package/dist/index.d.mts +1218 -358
  3. package/dist/index.d.ts +1218 -358
  4. package/dist/index.mjs +1 -19
  5. package/dist/packem_shared/AuthLoading-BhGVKJRL.mjs +2 -0
  6. package/dist/packem_shared/LunoraProvider-kWE2G_u5.mjs +1 -0
  7. package/dist/packem_shared/hydratePreloaded-uVXBlzvZ.mjs +2 -0
  8. package/dist/packem_shared/lunora-provider-DWiCv5g_.mjs +2 -0
  9. package/dist/packem_shared/lunoraQueryOptions-CKwybG2A.mjs +1 -0
  10. package/dist/packem_shared/query-key-Dr-B-Np0.mjs +1 -0
  11. package/dist/packem_shared/query-options.d-CdgGQ9s4.d.mts +38 -0
  12. package/dist/packem_shared/query-options.d-CdgGQ9s4.d.ts +38 -0
  13. package/dist/packem_shared/stream-state-abygFxmy.mjs +1 -0
  14. package/dist/packem_shared/use-paginated-core-NjPHKrxP.mjs +2 -0
  15. package/dist/packem_shared/useAction-X1QCIdmd.mjs +2 -0
  16. package/dist/packem_shared/useAgent-YZjRdG1c.mjs +2 -0
  17. package/dist/packem_shared/useAgentChat-CQyEpDz1.mjs +2 -0
  18. package/dist/packem_shared/useAgentState-Qq182JCp.mjs +2 -0
  19. package/dist/packem_shared/useAgentToolEvents-B6i1XMJb.mjs +2 -0
  20. package/dist/packem_shared/useAuth-BIFJEEU6.mjs +2 -0
  21. package/dist/packem_shared/useAuthSessions-C0Cyj6dJ.mjs +2 -0
  22. package/dist/packem_shared/useAuthState-BexUi5WP.mjs +2 -0
  23. package/dist/packem_shared/useClientQuery-D0CLe8aa.mjs +2 -0
  24. package/dist/packem_shared/useConnectionStatus-CYv-tHDB.mjs +2 -0
  25. package/dist/packem_shared/useFlag-D9PnK13Y.mjs +2 -0
  26. package/dist/packem_shared/useHttpStream-BCmlU245.mjs +2 -0
  27. package/dist/packem_shared/useInfiniteQuery-QpKQGvZA.mjs +2 -0
  28. package/dist/packem_shared/useMutation-CUcrtmDP.mjs +2 -0
  29. package/dist/packem_shared/useMutator-BtUd-xEA.mjs +2 -0
  30. package/dist/packem_shared/usePaginatedQuery-BKWiSq9X.mjs +2 -0
  31. package/dist/packem_shared/usePresence-CoxoZmPW.mjs +2 -0
  32. package/dist/packem_shared/useQuery-BnzYnRqP.mjs +2 -0
  33. package/dist/packem_shared/useRateLimit-Cckxi8m9.mjs +2 -0
  34. package/dist/packem_shared/useStream-D5Cq9TSk.mjs +2 -0
  35. package/dist/packem_shared/useSubscription-BNW9-iP5.mjs +2 -0
  36. package/dist/packem_shared/useVoiceAgent-v854u1m3.mjs +2 -0
  37. package/dist/payment.d.mts +105 -0
  38. package/dist/payment.d.ts +105 -0
  39. package/dist/payment.mjs +2 -0
  40. package/dist/server.d.mts +47 -29
  41. package/dist/server.d.ts +47 -29
  42. package/dist/server.mjs +1 -31
  43. package/dist/upload.d.mts +24 -0
  44. package/dist/upload.d.ts +24 -0
  45. package/dist/upload.mjs +2 -0
  46. package/package.json +14 -5
  47. package/dist/packem_shared/AuthLoading-DezUWNB2.mjs +0 -33
  48. package/dist/packem_shared/CheckoutButton-DUite8jJ.mjs +0 -189
  49. package/dist/packem_shared/LunoraProvider-BsuiW4Lk.mjs +0 -81
  50. package/dist/packem_shared/cache-BFlsXmup.mjs +0 -75
  51. package/dist/packem_shared/hydratePreloaded-Dsf9YuII.mjs +0 -54
  52. package/dist/packem_shared/lunoraQueryOptions-C3uwOTMW.mjs +0 -16
  53. package/dist/packem_shared/query-key-BmCbgidV.mjs +0 -13
  54. package/dist/packem_shared/query-options.d-D4okOpO8.d.mts +0 -38
  55. package/dist/packem_shared/query-options.d-D4okOpO8.d.ts +0 -38
  56. package/dist/packem_shared/stable-key-CGp4e2Ux.mjs +0 -38
  57. package/dist/packem_shared/use-paginated-core-CWSzk1J1.mjs +0 -180
  58. package/dist/packem_shared/useAuth-BSutjJaa.mjs +0 -129
  59. package/dist/packem_shared/useAuthState-CyF35qZR.mjs +0 -36
  60. package/dist/packem_shared/useConnectionStatus-PJ7vyCHy.mjs +0 -30
  61. package/dist/packem_shared/useFlag-hhoN_xYA.mjs +0 -224
  62. package/dist/packem_shared/useInfiniteQuery-Dy42_srs.mjs +0 -97
  63. package/dist/packem_shared/useMutation-BeqeIjTr.mjs +0 -67
  64. package/dist/packem_shared/useMutator-IIrLtDiM.mjs +0 -47
  65. package/dist/packem_shared/usePaginatedQuery-Tx-B3mAP.mjs +0 -46
  66. package/dist/packem_shared/usePresence-DC8VIyLB.mjs +0 -108
  67. package/dist/packem_shared/useQuery-_fTR6DCQ.mjs +0 -54
  68. package/dist/packem_shared/useRateLimit-DTEffQEi.mjs +0 -64
  69. package/dist/packem_shared/useStream-DFuryaIC.mjs +0 -125
  70. package/dist/packem_shared/useSubscription-D38Jdyr8.mjs +0 -139
package/README.md CHANGED
@@ -94,24 +94,31 @@ function MessageList({ room }: { room: string }) {
94
94
 
95
95
  ## Hooks
96
96
 
97
- | Hook | Returns | Notes |
98
- | ---------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------ |
99
- | `useQuery(fn, args, options?)` | `T \| undefined` | Live query; shares one WS subscription across consumers of the same key. |
100
- | `useMutation(fn)` | `{ mutate, pending, data, error, reset, withOptimisticUpdate }` | Per-call `optimistic` / `optimisticUpdate` options pass through to the client. |
101
- | `useSubscription(fn, args, options?)` | `{ data, error }` | No initial fetch — only server-pushed values. |
102
- | `usePaginatedQuery(fn, args, { initialNumItems })` | `{ results, status, isLoading, loadMore }` | Cursor-paginated feed that stays consistent under live edits. |
103
- | `useInfiniteQuery(fn, args, { initialNumItems })` | `{ pages, status, hasNextPage, fetchNextPage, … }` | Page-array variant of the same paginator. |
104
- | `usePreloadedQuery(preloaded)` | `T` | Reads a server `Preloaded` token, then goes live. |
105
- | `usePresence({ heartbeat, listPresent, roomId, … })` | present members | Drives the `definePresence` heartbeat + list functions. |
106
- | `useFlag(key, default, context?)` | flag value (live) | Live OpenFeature flag over the WS; reads `default` until the server answers. |
107
- | `useFlags(defaults, context?)` | `{ [key]: value }` | Batch variant — one live value per key in the `defaults` map. |
108
- | `useStream(fn, args, options?)` | `{ chunks, status, error, cancel }` | Consumes a streamed action response chunk by chunk. |
109
- | `useRateLimit(config, options?)` | `{ ok, disabled, retryAfter, check, consume, reset }` | Client-side mirror of a `@lunora/ratelimit` budget for instant UX. |
110
- | `useConnectionStatus()` | `ConnectionStatus` | `idle` / `connecting` / `connected` / `offline`. |
111
- | `useAuth()` | `{ user, token, setToken }` | Call `setToken(jwt)` after sign-in; RPC then carries the token. |
112
- | `useAuthState()` | `{ isAuthenticated, isLoading }` | Hydration-safe three-state gate. |
113
-
114
- `Authenticated`, `Unauthenticated`, and `AuthLoading` are gate components built on `useAuthState`. `CheckoutButton`, `CustomerPortalButton`, and `useCheckout` wrap `@lunora/payment` flows.
97
+ | Hook | Returns | Notes |
98
+ | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
99
+ | `useQuery(fn, args, options?)` | `T \| undefined` | Live query; shares one WS subscription across consumers of the same key. |
100
+ | `useMutation(fn)` | `{ mutate, pending, data, error, reset, withOptimisticUpdate }` | Per-call `optimistic` / `optimisticUpdate` options pass through to the client. |
101
+ | `useSubscription(fn, args, options?)` | `{ data, error }` | No initial fetch — only server-pushed values. |
102
+ | `usePaginatedQuery(fn, args, { initialNumItems, onError? })` | `{ results, status, isLoading, loadMore, error }` | Cursor-paginated feed that stays consistent under live edits. A failed tail page is dropped so `loadMore` can retry it. |
103
+ | `useInfiniteQuery(fn, args, { initialNumItems, onError? })` | `{ pages, status, hasNextPage, fetchNextPage, error, … }` | Page-array variant of the same paginator. |
104
+ | `usePreloadedQuery(preloaded, options?)` | `T \| undefined` | Reads a server `Preloaded` token, then goes live. Pass `onError` to see a session expiry instead of rendering the stale SSR snapshot. |
105
+ | `usePresence(roomId, { heartbeat, listPresent, … })` | `{ present, sessionId, setData, error }` | Drives the `definePresence` heartbeat + list functions. `roomId` is a positional first argument, not an option. |
106
+ | `useFlag(key, default)` | flag value (live) | Live OpenFeature flag over the WS; reads `default` until the server answers. Evaluated under the socket's server-verified identity. |
107
+ | `useFlags(defaults)` | `{ [key]: value }` | Batch variant — one live value per key in the `defaults` map. |
108
+ | `useStream(fn, args, options?)` | `{ chunks, status, error, cancel }` | Consumes a streamed action response chunk by chunk. |
109
+ | `useRateLimit(config, options?)` | `{ ok, disabled, retryAfter, check, consume, reset }` | Client-side mirror of a `@lunora/ratelimit` budget for instant UX. |
110
+ | `useConnectionStatus()` | `ConnectionStatus` | `idle` / `connecting` / `connected` / `offline`. |
111
+ | `useAuth()` | `{ user, token, status, setToken }` | Call `setToken(jwt)` after sign-in; RPC then carries the token. |
112
+ | `useAuthState()` | `{ isAuthenticated, isLoading }` | Hydration-safe three-state gate. |
113
+ | `useAgentToolEvents({ api, threadKey, … })` | `{ events }` | One agent thread's tool lifecycle: call / result / awaiting-approval / progress. |
114
+ | `useVoiceAgent({ voice, threadKey, … })` | `{ status, transcript, startCall, endCall, … }` | Full-duplex voice call: mic capture, playback, live transcripts, barge-in. |
115
+ | `useAuthUsers` / `useAuthSessions` / `useOrganizations` / `useImpersonate` | `{ data, error, loading, hasMore, total, loadMore, refetch }` (`useImpersonate`: `{ data, error, pending, impersonate, reset }`) | Admin-plane auth reads for a console UI; each needs an admin-capable token. HTTP-only, so `refetch()` rather than a live subscription. |
116
+
117
+ `Authenticated`, `Unauthenticated`, and `AuthLoading` are gate components built on `useAuthState`.
118
+
119
+ The payment kit — `CheckoutButton`, `CustomerPortalButton`, and `useCheckout`, which wrap `@lunora/payment` flows — ships from the `@lunora/react/payment` subpath, not the package root: it renders a DOM `<button>` and navigates via `globalThis.location`, so it is the one part of this package that is browser-only (the root barrel stays renderer-agnostic, which is what lets `@lunora/react-native` re-export it wholesale).
120
+
121
+ `useVoiceAgent` opens nothing until you call `startCall()` — that is what requests the microphone, so it has to run from a user gesture; `endCall()` releases the socket, the mic tracks and the Web Audio graph, and also runs on unmount. See the [voice-agent docs](https://lunora.sh/docs/packages/react#voice-agents--usevoiceagentoptions) for the silence/barge-in thresholds.
115
122
 
116
123
  ## Server Components
117
124