@lunora/vue 1.0.0-alpha.78 → 1.0.0-alpha.79

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 (46) hide show
  1. package/dist/index.d.mts +77 -1
  2. package/dist/index.d.ts +77 -1
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/AuthLoading-nfI43dvD.mjs +1 -0
  5. package/dist/packem_shared/LUNORA_INJECTION_KEY-Bct9tKCj.mjs +1 -0
  6. package/dist/packem_shared/hydratePreloaded-kyzbcRHO.mjs +1 -0
  7. package/dist/packem_shared/scope-dispose-Mq3k4nvP.mjs +1 -0
  8. package/dist/packem_shared/stable-key-BrNca3-v.mjs +1 -0
  9. package/dist/packem_shared/subscribeToQuery-DPfbYx11.mjs +1 -0
  10. package/dist/packem_shared/useAgent-BngqmpN9.mjs +1 -0
  11. package/dist/packem_shared/useAgentChat-Cx2Q0zEw.mjs +1 -0
  12. package/dist/packem_shared/useAgentState-B_LPf5ZX.mjs +1 -0
  13. package/dist/packem_shared/useAgentToolEvents-DYYeyrXW.mjs +1 -0
  14. package/dist/packem_shared/useAuth-DJ9902_4.mjs +1 -0
  15. package/dist/packem_shared/useConnectionStatus-BSFJBnmi.mjs +1 -0
  16. package/dist/packem_shared/useFlag-D9nbORR8.mjs +1 -0
  17. package/dist/packem_shared/useInfiniteQuery-qPTnyRUN.mjs +1 -0
  18. package/dist/packem_shared/useMutation-DBAUj440.mjs +1 -0
  19. package/dist/packem_shared/useMutator-CO7nXlRf.mjs +1 -0
  20. package/dist/packem_shared/usePresence-BBMik0HU.mjs +1 -0
  21. package/dist/packem_shared/useRateLimit-zoPsflSG.mjs +1 -0
  22. package/dist/packem_shared/useStream-pSLl_8ix.mjs +1 -0
  23. package/dist/packem_shared/useSubscription-uZqOa1Pu.mjs +1 -0
  24. package/dist/packem_shared/useVoiceAgent-CR6Tyf_3.mjs +1 -0
  25. package/package.json +3 -3
  26. package/dist/packem_shared/AuthLoading-CST_mkXL.mjs +0 -1
  27. package/dist/packem_shared/LUNORA_INJECTION_KEY-CswQb5zb.mjs +0 -1
  28. package/dist/packem_shared/hydratePreloaded-C-yIiam2.mjs +0 -1
  29. package/dist/packem_shared/scope-dispose-Dn0gQ2SS.mjs +0 -1
  30. package/dist/packem_shared/stable-key-BSG0zK_E.mjs +0 -1
  31. package/dist/packem_shared/subscribeToQuery-Sz46o9Xt.mjs +0 -1
  32. package/dist/packem_shared/useAgent-CeAYhGZA.mjs +0 -1
  33. package/dist/packem_shared/useAgentChat-B5mq0x66.mjs +0 -1
  34. package/dist/packem_shared/useAgentState-Cs1VcKQj.mjs +0 -1
  35. package/dist/packem_shared/useAgentToolEvents-BhjZrNSJ.mjs +0 -1
  36. package/dist/packem_shared/useAuth-DwDFjvto.mjs +0 -1
  37. package/dist/packem_shared/useConnectionStatus-1brbiHgc.mjs +0 -1
  38. package/dist/packem_shared/useFlag-Bxoq8mH9.mjs +0 -1
  39. package/dist/packem_shared/useInfiniteQuery-CD_dnvES.mjs +0 -1
  40. package/dist/packem_shared/useMutation-MdgW9pRE.mjs +0 -1
  41. package/dist/packem_shared/useMutator-DRVDOhcj.mjs +0 -1
  42. package/dist/packem_shared/usePresence-D2d4BqBJ.mjs +0 -1
  43. package/dist/packem_shared/useRateLimit-z8EUFuYJ.mjs +0 -1
  44. package/dist/packem_shared/useStream-CYkKEcDf.mjs +0 -1
  45. package/dist/packem_shared/useSubscription-3X8pNJ6P.mjs +0 -1
  46. package/dist/packem_shared/useVoiceAgent-1gtd9RU3.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -982,4 +982,80 @@ interface UseVoiceAgentResult {
982
982
  * `createSocket`) so the composable is drivable outside a browser.
983
983
  */
984
984
  declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
985
- export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type FlagContext, type FlagValue, type HeartbeatReference, LUNORA_INJECTION_KEY, type ListPresentReference, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, createLunora, hydratePreloaded, provideLunora, subscribeToQuery, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useConnectionStatus, useFlag, useFlags, useInfiniteQuery, useLunora, useMutation, useMutator, usePaginatedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
985
+ export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type FlagContext, type FlagValue, type HeartbeatReference,
986
+ /**
987
+ * `@lunora/vue` — the Vue adapter for Lunora.
988
+ *
989
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client` (which owns
990
+ * the WebSocket transport, subscription registry, offline queue, and
991
+ * delta-merge — zero React, zero Vue). This package re-expresses that contract
992
+ * as Vue composables:
993
+ *
994
+ * - `createLunora` / `provideLunora` / `useLunora` — provide/inject the client.
995
+ * - `useQuery` — a live `ref` that opens a WS subscription and updates on deltas (reactive args re-subscribe).
996
+ * - `useMutation` — an optimistic mutation handle (refs + awaitable `mutate`).
997
+ * - `hydratePreloaded` — seed a `ref` synchronously from an SSR `Preloaded` token (no loading flash), then attach the live subscription.
998
+ *
999
+ * Server-side preload helpers live in the socket-free `@lunora/vue/server`
1000
+ * entry (`createServerClient`, `preloadQuery`). Nuxt's single-worker
1001
+ * composition (Lunora mounted inside Nitro) is `@lunora/nuxt`, not this
1002
+ * package — see [Bring your framework](/docs/frameworks/bring-your-framework).
1003
+ */
1004
+ LUNORA_INJECTION_KEY, type ListPresentReference, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus,
1005
+ /**
1006
+ * `@lunora/vue` — the Vue adapter for Lunora.
1007
+ *
1008
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client` (which owns
1009
+ * the WebSocket transport, subscription registry, offline queue, and
1010
+ * delta-merge — zero React, zero Vue). This package re-expresses that contract
1011
+ * as Vue composables:
1012
+ *
1013
+ * - `createLunora` / `provideLunora` / `useLunora` — provide/inject the client.
1014
+ * - `useQuery` — a live `ref` that opens a WS subscription and updates on deltas (reactive args re-subscribe).
1015
+ * - `useMutation` — an optimistic mutation handle (refs + awaitable `mutate`).
1016
+ * - `hydratePreloaded` — seed a `ref` synchronously from an SSR `Preloaded` token (no loading flash), then attach the live subscription.
1017
+ *
1018
+ * Server-side preload helpers live in the socket-free `@lunora/vue/server`
1019
+ * entry (`createServerClient`, `preloadQuery`). Nuxt's single-worker
1020
+ * composition (Lunora mounted inside Nitro) is `@lunora/nuxt`, not this
1021
+ * package — see [Bring your framework](/docs/frameworks/bring-your-framework).
1022
+ */
1023
+ createLunora, hydratePreloaded,
1024
+ /**
1025
+ * `@lunora/vue` — the Vue adapter for Lunora.
1026
+ *
1027
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client` (which owns
1028
+ * the WebSocket transport, subscription registry, offline queue, and
1029
+ * delta-merge — zero React, zero Vue). This package re-expresses that contract
1030
+ * as Vue composables:
1031
+ *
1032
+ * - `createLunora` / `provideLunora` / `useLunora` — provide/inject the client.
1033
+ * - `useQuery` — a live `ref` that opens a WS subscription and updates on deltas (reactive args re-subscribe).
1034
+ * - `useMutation` — an optimistic mutation handle (refs + awaitable `mutate`).
1035
+ * - `hydratePreloaded` — seed a `ref` synchronously from an SSR `Preloaded` token (no loading flash), then attach the live subscription.
1036
+ *
1037
+ * Server-side preload helpers live in the socket-free `@lunora/vue/server`
1038
+ * entry (`createServerClient`, `preloadQuery`). Nuxt's single-worker
1039
+ * composition (Lunora mounted inside Nitro) is `@lunora/nuxt`, not this
1040
+ * package — see [Bring your framework](/docs/frameworks/bring-your-framework).
1041
+ */
1042
+ provideLunora, subscribeToQuery, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useConnectionStatus, useFlag, useFlags, useInfiniteQuery,
1043
+ /**
1044
+ * `@lunora/vue` — the Vue adapter for Lunora.
1045
+ *
1046
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client` (which owns
1047
+ * the WebSocket transport, subscription registry, offline queue, and
1048
+ * delta-merge — zero React, zero Vue). This package re-expresses that contract
1049
+ * as Vue composables:
1050
+ *
1051
+ * - `createLunora` / `provideLunora` / `useLunora` — provide/inject the client.
1052
+ * - `useQuery` — a live `ref` that opens a WS subscription and updates on deltas (reactive args re-subscribe).
1053
+ * - `useMutation` — an optimistic mutation handle (refs + awaitable `mutate`).
1054
+ * - `hydratePreloaded` — seed a `ref` synchronously from an SSR `Preloaded` token (no loading flash), then attach the live subscription.
1055
+ *
1056
+ * Server-side preload helpers live in the socket-free `@lunora/vue/server`
1057
+ * entry (`createServerClient`, `preloadQuery`). Nuxt's single-worker
1058
+ * composition (Lunora mounted inside Nitro) is `@lunora/nuxt`, not this
1059
+ * package — see [Bring your framework](/docs/frameworks/bring-your-framework).
1060
+ */
1061
+ useLunora, useMutation, useMutator, usePaginatedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
package/dist/index.d.ts CHANGED
@@ -982,4 +982,80 @@ interface UseVoiceAgentResult {
982
982
  * `createSocket`) so the composable is drivable outside a browser.
983
983
  */
984
984
  declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
985
- export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type FlagContext, type FlagValue, type HeartbeatReference, LUNORA_INJECTION_KEY, type ListPresentReference, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, createLunora, hydratePreloaded, provideLunora, subscribeToQuery, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useConnectionStatus, useFlag, useFlags, useInfiniteQuery, useLunora, useMutation, useMutator, usePaginatedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
985
+ export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type FlagContext, type FlagValue, type HeartbeatReference,
986
+ /**
987
+ * `@lunora/vue` — the Vue adapter for Lunora.
988
+ *
989
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client` (which owns
990
+ * the WebSocket transport, subscription registry, offline queue, and
991
+ * delta-merge — zero React, zero Vue). This package re-expresses that contract
992
+ * as Vue composables:
993
+ *
994
+ * - `createLunora` / `provideLunora` / `useLunora` — provide/inject the client.
995
+ * - `useQuery` — a live `ref` that opens a WS subscription and updates on deltas (reactive args re-subscribe).
996
+ * - `useMutation` — an optimistic mutation handle (refs + awaitable `mutate`).
997
+ * - `hydratePreloaded` — seed a `ref` synchronously from an SSR `Preloaded` token (no loading flash), then attach the live subscription.
998
+ *
999
+ * Server-side preload helpers live in the socket-free `@lunora/vue/server`
1000
+ * entry (`createServerClient`, `preloadQuery`). Nuxt's single-worker
1001
+ * composition (Lunora mounted inside Nitro) is `@lunora/nuxt`, not this
1002
+ * package — see [Bring your framework](/docs/frameworks/bring-your-framework).
1003
+ */
1004
+ LUNORA_INJECTION_KEY, type ListPresentReference, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus,
1005
+ /**
1006
+ * `@lunora/vue` — the Vue adapter for Lunora.
1007
+ *
1008
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client` (which owns
1009
+ * the WebSocket transport, subscription registry, offline queue, and
1010
+ * delta-merge — zero React, zero Vue). This package re-expresses that contract
1011
+ * as Vue composables:
1012
+ *
1013
+ * - `createLunora` / `provideLunora` / `useLunora` — provide/inject the client.
1014
+ * - `useQuery` — a live `ref` that opens a WS subscription and updates on deltas (reactive args re-subscribe).
1015
+ * - `useMutation` — an optimistic mutation handle (refs + awaitable `mutate`).
1016
+ * - `hydratePreloaded` — seed a `ref` synchronously from an SSR `Preloaded` token (no loading flash), then attach the live subscription.
1017
+ *
1018
+ * Server-side preload helpers live in the socket-free `@lunora/vue/server`
1019
+ * entry (`createServerClient`, `preloadQuery`). Nuxt's single-worker
1020
+ * composition (Lunora mounted inside Nitro) is `@lunora/nuxt`, not this
1021
+ * package — see [Bring your framework](/docs/frameworks/bring-your-framework).
1022
+ */
1023
+ createLunora, hydratePreloaded,
1024
+ /**
1025
+ * `@lunora/vue` — the Vue adapter for Lunora.
1026
+ *
1027
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client` (which owns
1028
+ * the WebSocket transport, subscription registry, offline queue, and
1029
+ * delta-merge — zero React, zero Vue). This package re-expresses that contract
1030
+ * as Vue composables:
1031
+ *
1032
+ * - `createLunora` / `provideLunora` / `useLunora` — provide/inject the client.
1033
+ * - `useQuery` — a live `ref` that opens a WS subscription and updates on deltas (reactive args re-subscribe).
1034
+ * - `useMutation` — an optimistic mutation handle (refs + awaitable `mutate`).
1035
+ * - `hydratePreloaded` — seed a `ref` synchronously from an SSR `Preloaded` token (no loading flash), then attach the live subscription.
1036
+ *
1037
+ * Server-side preload helpers live in the socket-free `@lunora/vue/server`
1038
+ * entry (`createServerClient`, `preloadQuery`). Nuxt's single-worker
1039
+ * composition (Lunora mounted inside Nitro) is `@lunora/nuxt`, not this
1040
+ * package — see [Bring your framework](/docs/frameworks/bring-your-framework).
1041
+ */
1042
+ provideLunora, subscribeToQuery, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useConnectionStatus, useFlag, useFlags, useInfiniteQuery,
1043
+ /**
1044
+ * `@lunora/vue` — the Vue adapter for Lunora.
1045
+ *
1046
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client` (which owns
1047
+ * the WebSocket transport, subscription registry, offline queue, and
1048
+ * delta-merge — zero React, zero Vue). This package re-expresses that contract
1049
+ * as Vue composables:
1050
+ *
1051
+ * - `createLunora` / `provideLunora` / `useLunora` — provide/inject the client.
1052
+ * - `useQuery` — a live `ref` that opens a WS subscription and updates on deltas (reactive args re-subscribe).
1053
+ * - `useMutation` — an optimistic mutation handle (refs + awaitable `mutate`).
1054
+ * - `hydratePreloaded` — seed a `ref` synchronously from an SSR `Preloaded` token (no loading flash), then attach the live subscription.
1055
+ *
1056
+ * Server-side preload helpers live in the socket-free `@lunora/vue/server`
1057
+ * entry (`createServerClient`, `preloadQuery`). Nuxt's single-worker
1058
+ * composition (Lunora mounted inside Nitro) is `@lunora/nuxt`, not this
1059
+ * package — see [Bring your framework](/docs/frameworks/bring-your-framework).
1060
+ */
1061
+ useLunora, useMutation, useMutator, usePaginatedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-CST_mkXL.mjs";import{hydratePreloaded as a}from"./packem_shared/hydratePreloaded-C-yIiam2.mjs";import{LUNORA_INJECTION_KEY as f,createLunora as m,provideLunora as p,useLunora as x}from"./packem_shared/LUNORA_INJECTION_KEY-CswQb5zb.mjs";import{useAgent as d}from"./packem_shared/useAgent-CeAYhGZA.mjs";import{useAgentChat as A}from"./packem_shared/useAgentChat-B5mq0x66.mjs";import{useAgentState as h}from"./packem_shared/useAgentState-Cs1VcKQj.mjs";import{useAgentToolEvents as l}from"./packem_shared/useAgentToolEvents-BhjZrNSJ.mjs";import{useAuth as Q}from"./packem_shared/useAuth-DwDFjvto.mjs";import{default as b}from"./packem_shared/useConnectionStatus-1brbiHgc.mjs";import{useFlag as E,useFlags as I}from"./packem_shared/useFlag-Bxoq8mH9.mjs";import{useMutation as P}from"./packem_shared/useMutation-MdgW9pRE.mjs";import{useMutator as v}from"./packem_shared/useMutator-DRVDOhcj.mjs";import{useInfiniteQuery as M,usePaginatedQuery as O}from"./packem_shared/useInfiniteQuery-CD_dnvES.mjs";import{usePresence as U}from"./packem_shared/usePresence-D2d4BqBJ.mjs";import{subscribeToQuery as J,useQuery as K}from"./packem_shared/subscribeToQuery-Sz46o9Xt.mjs";import{useRateLimit as Y}from"./packem_shared/useRateLimit-z8EUFuYJ.mjs";import{useStream as k}from"./packem_shared/useStream-CYkKEcDf.mjs";import{useSubscription as w}from"./packem_shared/useSubscription-3X8pNJ6P.mjs";import{useVoiceAgent as B}from"./packem_shared/useVoiceAgent-1gtd9RU3.mjs";export{o as AuthLoading,t as Authenticated,f as LUNORA_INJECTION_KEY,u as Unauthenticated,m as createLunora,a as hydratePreloaded,p as provideLunora,J as subscribeToQuery,d as useAgent,A as useAgentChat,h as useAgentState,l as useAgentToolEvents,Q as useAuth,b as useConnectionStatus,E as useFlag,I as useFlags,M as useInfiniteQuery,x as useLunora,P as useMutation,v as useMutator,O as usePaginatedQuery,U as usePresence,K as useQuery,Y as useRateLimit,k as useStream,w as useSubscription,B as useVoiceAgent};
1
+ import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-nfI43dvD.mjs";import{hydratePreloaded as a}from"./packem_shared/hydratePreloaded-kyzbcRHO.mjs";import{LUNORA_INJECTION_KEY as f,createLunora as m,provideLunora as p,useLunora as x}from"./packem_shared/LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{useAgent as d}from"./packem_shared/useAgent-BngqmpN9.mjs";import{useAgentChat as A}from"./packem_shared/useAgentChat-Cx2Q0zEw.mjs";import{useAgentState as h}from"./packem_shared/useAgentState-B_LPf5ZX.mjs";import{useAgentToolEvents as l}from"./packem_shared/useAgentToolEvents-DYYeyrXW.mjs";import{useAuth as Q}from"./packem_shared/useAuth-DJ9902_4.mjs";import{default as b}from"./packem_shared/useConnectionStatus-BSFJBnmi.mjs";import{useFlag as E,useFlags as I}from"./packem_shared/useFlag-D9nbORR8.mjs";import{useMutation as P}from"./packem_shared/useMutation-DBAUj440.mjs";import{useMutator as v}from"./packem_shared/useMutator-CO7nXlRf.mjs";import{useInfiniteQuery as M,usePaginatedQuery as O}from"./packem_shared/useInfiniteQuery-qPTnyRUN.mjs";import{usePresence as U}from"./packem_shared/usePresence-BBMik0HU.mjs";import{subscribeToQuery as J,useQuery as K}from"./packem_shared/subscribeToQuery-DPfbYx11.mjs";import{useRateLimit as Y}from"./packem_shared/useRateLimit-zoPsflSG.mjs";import{useStream as k}from"./packem_shared/useStream-pSLl_8ix.mjs";import{useSubscription as w}from"./packem_shared/useSubscription-uZqOa1Pu.mjs";import{useVoiceAgent as B}from"./packem_shared/useVoiceAgent-CR6Tyf_3.mjs";export{o as AuthLoading,t as Authenticated,f as LUNORA_INJECTION_KEY,u as Unauthenticated,m as createLunora,a as hydratePreloaded,p as provideLunora,J as subscribeToQuery,d as useAgent,A as useAgentChat,h as useAgentState,l as useAgentToolEvents,Q as useAuth,b as useConnectionStatus,E as useFlag,I as useFlags,M as useInfiniteQuery,x as useLunora,P as useMutation,v as useMutator,O as usePaginatedQuery,U as usePresence,K as useQuery,Y as useRateLimit,k as useStream,w as useSubscription,B as useVoiceAgent};
@@ -0,0 +1 @@
1
+ import{defineComponent as o,computed as a}from"vue";import{useAuth as l}from"./useAuth-DJ9902_4.mjs";const r=o({name:"Authenticated",setup(s,{slots:t}){const{token:e,user:n}=l(),u=a(()=>e.value!==null&&n.value!==null);return()=>u.value?t.default?.():void 0}}),c=o({name:"Unauthenticated",setup(s,{slots:t}){const{token:e,user:n}=l(),u=a(()=>e.value!==null&&n.value===null);return()=>!u.value&&e.value===null?t.default?.():void 0}}),p=o({name:"AuthLoading",setup(s,{slots:t}){const{token:e,user:n}=l(),u=a(()=>e.value!==null&&n.value===null);return()=>u.value?t.default?.():void 0}});export{p as AuthLoading,r as Authenticated,c as Unauthenticated};
@@ -0,0 +1 @@
1
+ import{LunoraError as e}from"@lunora/errors";import{inject as t,provide as i}from"vue";const o=Symbol("lunora.client"),c=r=>({install(n){n.provide(o,r)}}),p=r=>{i(o,r)},l=()=>{const r=t(o,void 0);if(!r)throw new e("INTERNAL","useLunora(): no LunoraClient provided — call app.use(createLunora(client)) or provideLunora(client) in a parent setup().");return r};export{o as LUNORA_INJECTION_KEY,c as createLunora,p as provideLunora,l as useLunora};
@@ -0,0 +1 @@
1
+ import{useLunora as s}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{subscribeToQuery as u}from"./subscribeToQuery-DPfbYx11.mjs";const d=e=>{const r=s(),{args:n,functionPath:o,shardKey:t,value:c}=e;return u(r,{__lunoraRef:o},n,{seed:c,shardKey:t})};export{d as hydratePreloaded};
@@ -0,0 +1 @@
1
+ import{getCurrentScope as e,onScopeDispose as r}from"vue";const s=(o,n)=>{e()&&r(o)};export{s as o};
@@ -0,0 +1 @@
1
+ const c=(t,e)=>t<e?-1:t>e?1:0,s=t=>{if(t===void 0)return"null";if(typeof t=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(r=>s(r)).join(",")}]`;const e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype){const r=t.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${r} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const n=t,a=Object.keys(n).toSorted(c),o=[];for(const r of a){const i=n[r];i!==void 0&&o.push(`${JSON.stringify(r)}:${s(i)}`)}return`{${o.join(",")}}`};export{s};
@@ -0,0 +1 @@
1
+ import{createQuerySubscription as b}from"@lunora/client/query";import{shallowRef as i,watch as p,toValue as f}from"vue";import{i as n}from"./is-browser-BEdfLJHK.mjs";import{useLunora as l}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{o as y}from"./scope-dispose-Mq3k4nvP.mjs";const D=(o,s,t,e={})=>{const r=i(e.seed);if(n()){const a=o.subscribe(s,t,u=>{r.value=u},{shardKey:e.shardKey});y(a)}return r},R=(o,s,t={})=>{const e=l(),r=i(void 0);return p(()=>f(s),(a,u,c)=>{if(!n())return;const m=b(e,o,a,{onData:d=>{r.value=d},onReset:()=>{r.value=void 0}},{shardKey:t.shardKey});c(m)},{immediate:!0}),r};export{D as subscribeToQuery,R as useQuery};
@@ -0,0 +1 @@
1
+ import{computed as o,toValue as a}from"vue";import{useMutation as s}from"./useMutation-DBAUj440.mjs";import{useSubscription as y}from"./useSubscription-uZqOa1Pu.mjs";const v={__lunoraRef:""},I=u=>{const{api:i,cancel:c,run:d,runArgs:l,threadKey:e}=u,r=s(d),m=s(c??v),{data:p}=y(i.agents.agentThread,()=>({key:a(e)})),n=o(()=>p.value),f=o(()=>n.value?.status),g=async(t,h)=>{await r.mutate({input:t,threadKey:a(e),...l,...h})};return{cancel:async()=>{const t=n.value?.instanceId;c===void 0||t===void 0||await m.mutate({instanceId:t,threadKey:a(e)})},pending:r.pending,run:g,status:f,thread:n}};export{v as NO_MUTATION_REF,I as useAgent};
@@ -0,0 +1 @@
1
+ import{reconcileOptimistic as y,maxSeq as A}from"@lunora/client";import{ref as D,computed as c,toValue as s}from"vue";import{NO_MUTATION_REF as N}from"./useAgent-BngqmpN9.mjs";import{useMutation as m}from"./useMutation-DBAUj440.mjs";import{useStream as F}from"./useStream-pSLl_8ix.mjs";import{useSubscription as R}from"./useSubscription-uZqOa1Pu.mjs";const U={__lunoraRef:""},Q=k=>{const{api:u,cancel:p,limit:v,send:w,sendArgs:x,stream:h,threadKey:a}=k,{data:I}=R(u.agents.agentMessages,()=>{const t=s(a);return v===void 0?{key:t}:{key:t,limit:v}}),{data:M}=R(u.agents.agentThread,()=>({key:s(a)})),S=h===void 0?"skip":()=>({key:s(a)}),{chunks:_}=F(h??U,S),b=m(w),K=m(p??N),T=m(u.agents.agentResolveApproval),o=D([]);let f=0;const l=c(()=>M.value),j=c(()=>l.value?.status),i=c(()=>I.value??[]),q=c(()=>{const t=i.value,n=y(o.value,t);if(n.length===0)return t;const e=A(t);return[...t,...n.map((r,d)=>({content:r.content,optimistic:!0,role:"user",seq:e+1+d}))]}),E=c(()=>{const t=s(a),n=i.value.filter(e=>e.role==="assistant").length;return _.value.filter(e=>e.kind!=="progress"&&e.threadKey===t&&e.turn>=n).map(e=>e.text).join("")}),O=async(t,n)=>{const e=f;f+=1;const r=A(i.value);o.value=[...y(o.value,i.value),{content:t,id:e,maxDurableSeqAtSend:r}];try{await b.mutate({input:t,threadKey:s(a),...x,...n})}catch(d){throw o.value=o.value.filter(C=>C.id!==e),d}},g=async(t,n,e)=>{const r=l.value?.instanceId;if(r===void 0)throw new Error(`useAgentChat: cannot ${t} — no in-flight run (thread has no instanceId)`);await T.mutate({decision:t,instanceId:r,threadKey:s(a),toolCallId:n,...e===void 0?{}:{note:e}})};return{approve:async(t,n)=>g("approve",t,n),cancel:async()=>{const t=l.value?.instanceId;p===void 0||t===void 0||await K.mutate({instanceId:t,threadKey:s(a)})},messages:q,reject:async(t,n)=>g("reject",t,n),send:O,status:j,streamingText:E}};export{Q as useAgentChat};
@@ -0,0 +1 @@
1
+ import{computed as o,toValue as n}from"vue";import{useSubscription as u}from"./useSubscription-uZqOa1Pu.mjs";const m=t=>{const{data:e,error:r}=u(t.api.agents.agentState,()=>({key:n(t.threadKey)})),a=o(()=>e.value);return{error:r,state:a}};export{m as useAgentState};
@@ -0,0 +1 @@
1
+ import{computed as v,toValue as e}from"vue";import{useStream as f}from"./useStream-pSLl_8ix.mjs";import{useSubscription as C}from"./useSubscription-uZqOa1Pu.mjs";const y={__lunoraRef:""},I=[],N=t=>{if(t.role==="assistant"&&t.toolCalls)return t.toolCalls.map(l=>({input:l.input,seq:t.seq,toolCallId:l.id,toolName:l.name,type:"call"}));if(t.role==="tool")return t.status==="awaiting_approval"?[{seq:t.seq,type:"awaiting-approval",...t.toolCallId===void 0?{}:{toolCallId:t.toolCallId},...t.toolName===void 0?{}:{toolName:t.toolName}}]:[{output:t.content,seq:t.seq,type:"result",...t.status==="approved"||t.status==="rejected"?{status:t.status}:{},...t.toolCallId===void 0?{}:{toolCallId:t.toolCallId},...t.toolName===void 0?{}:{toolName:t.toolName}}]},h=t=>{const{api:l,limit:a,stream:u,threadKey:n}=t,d=()=>{const r=e(n);return a===void 0?{key:r}:{key:r,limit:a}},{data:p}=C(l.agents.agentMessages,d),s=u===void 0?"skip":()=>({key:e(n)}),{chunks:c}=f(u??y,s);return{events:v(()=>{const r=e(n),i=(p.value??I).flatMap(o=>N(o)??[]);for(const o of c.value)o.kind==="progress"&&o.threadKey===r&&i.push({data:o.data,toolCallId:o.toolCallId,type:"progress"});return i})}};export{h as useAgentToolEvents};
@@ -0,0 +1 @@
1
+ import{getIdentityStore as T}from"@lunora/client/auth";import{ref as s,onScopeDispose as a,readonly as r}from"vue";import{useLunora as i}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const b=()=>{const e=i(),o=T(e),t=s(e.getAuthToken()),n=s(o.getUser()),u=()=>{t.value=e.getAuthToken()},c=()=>{n.value=o.getUser()},k=e.onAuthTokenChange(u),g=o.subscribe(c);return a(()=>{k(),g()}),{setToken:h=>{e.setAuthToken(h)},token:r(t),user:r(n)}};export{b as useAuth};
@@ -0,0 +1 @@
1
+ import{shallowRef as e}from"vue";import{useLunora as r}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{o as u}from"./scope-dispose-Mq3k4nvP.mjs";const m=()=>{const o=r(),t=e(o.connectionStatus()),n=o.onConnectionStatus(s=>{t.value=s});return u(n),t};export{m as default};
@@ -0,0 +1 @@
1
+ import{shallowRef as _,watch as m,toValue as n}from"vue";import{s as p}from"./stable-key-BrNca3-v.mjs";import{useLunora as v}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const $="__lunora_flags__:eval",y=e=>{const t=typeof e;return t==="boolean"||t==="number"||t==="string"?t:"object"},d={__lunoraRef:$},h=e=>e===void 0?"":p(e),C=(e,t,c)=>{const r=v(),a=y(t),u=_(t);return m(()=>`${n(e)}\0${h(n(c))}`,(g,f,l)=>{const i=n(e),s=n(c);u.value=t;let o;try{o=r.subscribe(d,{context:s,default:t,key:i,type:a},b=>{u.value=b})}catch{return}l(o)},{immediate:!0}),u},F=(e,t)=>{const c=v(),r=_(e),a=p(e);return m(()=>`${a}\0${h(n(t))}`,(u,g,f)=>{const l=n(t);r.value=e;const i=[];for(const[s,o]of Object.entries(e))try{i.push(c.subscribe(d,{context:l,default:o,key:s,type:y(o)},b=>{r.value={...r.value,[s]:b}}))}catch{}f(()=>{for(const s of i)s()})},{immediate:!0}),r};export{C as useFlag,F as useFlags};
@@ -0,0 +1 @@
1
+ import{shallowRef as x,watch as O,toValue as A,onScopeDispose as V,computed as S}from"vue";import{initialPages as F,derivePaginationStatus as U,rebalance as W,applyLoadMore as z}from"@lunora/client/pagination";import{i as G}from"./is-browser-BEdfLJHK.mjs";import{s as H}from"./stable-key-BrNca3-v.mjs";import{useLunora as X}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const j=e=>{let n="";for(let f=0;f<e.length;f+=32768)n+=String.fromCharCode(...e.subarray(f,f+32768));return btoa(n)},u="$lunora.wire$",$=64,Y="__proto__",q=e=>{if(e===null||typeof e!="object")return!1;const n=Object.getPrototypeOf(e);return n===null||n===Object.prototype},K=(e,n=0)=>{if(n>$)throw new RangeError(`wire-codec: value nesting exceeds the ${$}-level limit`);if(e===void 0)return[u,"undefined"];if(e===null)return null;const y=typeof e;if(y==="bigint")return[u,"bigint",e.toString()];if(y==="number"){const t=e;return Number.isNaN(t)?[u,"nan"]:t===1/0?[u,"inf"]:t===-1/0?[u,"-inf"]:t}if(y!=="object")return e;if(e instanceof Date)return[u,"date",K(e.getTime(),n+1)];if(e instanceof Error){const t=e,r={};for(const g of Object.keys(t))t[g]!==void 0&&(r[g]=K(t[g],n+1));const s=[u,"error",t.name,t.message,r];return t.cause!==void 0&&s.push(K(t.cause,n+1)),s}if(e instanceof URL)return[u,"url",e.href];if(e instanceof Map)return[u,"map",[...e.entries()].map(([t,r])=>[K(t,n+1),K(r,n+1)])];if(e instanceof Set)return[u,"set",[...e].map(t=>K(t,n+1))];if(e instanceof ArrayBuffer)return[u,"bytes",j(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const t=e,r=t.constructor.name,s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return r==="Uint8Array"?[u,"bytes",j(s)]:[u,"bytes",j(s),r]}if(Array.isArray(e)){const t=e.map(r=>K(r,n+1));return t.length>0&&t[0]===u?[u,"arr",t]:t}if(!q(e)){const t=e.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${t} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}const f=e,b={};for(const t of Object.keys(f)){const r=f[t];if(r===void 0)continue;const s=K(r,n+1);t===Y?Object.defineProperty(b,t,{configurable:!0,enumerable:!0,value:s,writable:!0}):b[t]=s}return b},T=e=>H(K(e)),R=(e,n)=>`${e}::${T(n)}`,k=(e,n)=>({...n,paginationOpts:{cursor:e.lower,endCursor:e.upper,numItems:e.numItems}}),D=(e,n,y)=>{const f=X(),{initialNumItems:b,shardKey:t}=y,r=x(F(b)),s=x([]);let g;const p=new Map,d=new Map,M=new Set,L=(o,i)=>{s.value=o.map(w=>{const P=R(e.__lunoraRef,k(w,i));return d.get(P)})},Q=(o,i,w)=>{const P=a=>R(e.__lunoraRef,k(a,w));for(const a of i){const l=P(a);if(d.has(l))continue;const m=o.find(c=>c.lower===a.lower);if(m){const c=d.get(P(m));c&&d.set(l,c)}}},B=(o,i)=>{const w=new Set;for(const a of o)w.add(R(e.__lunoraRef,k(a,i)));for(const[a,l]of p)w.has(l.currentKey)||(l.unsub(),p.delete(a),d.delete(l.currentKey),M.delete(l.currentKey));const P=new Set([...p.values()].map(a=>a.currentKey));for(const a of o){const l=k(a,i),m=R(e.__lunoraRef,l);if(P.has(m))continue;const c={currentKey:m,unsub:void 0};M.add(m);const h=f.subscribe(e,l,v=>{d.set(c.currentKey,v),M.delete(c.currentKey);const _=A(n);if(L(r.value,_),M.size===0){const I=r.value,N=W(I,s.value);N&&(Q(I,N,_),r.value=N)}},{shardKey:t});c.unsub=h,p.set(m,c),P.add(m)}},C=()=>{for(const o of p.values())o.unsub();p.clear(),d.clear(),M.clear()};O(()=>T(A(n)),()=>{if(!G())return;const o=A(n);C(),r.value=F(b),s.value=[],g=void 0,o!=="skip"&&(B(r.value,o),L(r.value,o))},{immediate:!0}),O(()=>r.value,o=>{const i=A(n);i!=="skip"&&(B(o,i),L(o,i))}),V(C);const E=x("LoadingFirstPage");return O([()=>A(n),s],([o,i])=>{E.value=U(o==="skip",i).status},{immediate:!0}),{loadMore:o=>{const i=A(n);if(i==="skip")return;const{nextCursor:w,status:P}=U(!1,s.value);if(P!=="CanLoadMore"||w===g)return;const a=z(r.value,w,o);if(!a)return;g=w;const l=r.value.at(-1),m=a.at(-2);if(l&&m){const c=R(e.__lunoraRef,k(l,i)),h=R(e.__lunoraRef,k(m,i)),v=p.get(c);if(v&&c!==h){v.currentKey=h,p.set(h,v),p.delete(c);const _=d.get(c);_&&(d.set(h,_),d.delete(c))}}r.value=a},pageResults:s,status:E}},oe=(e,n,y)=>{const{loadMore:f,pageResults:b,status:t}=D(e,n,y),r=S(()=>b.value.flatMap(g=>g?.page??[]));return{isLoading:S(()=>t.value==="LoadingFirstPage"||t.value==="LoadingMore"),loadMore:f,results:r,status:t}},se=(e,n,y)=>{const{initialNumItems:f}=y,{loadMore:b,pageResults:t,status:r}=D(e,n,y),s=S(()=>t.value.flatMap(L=>L?[L.page]:[])),g=S(()=>r.value==="LoadingFirstPage"),p=S(()=>r.value==="CanLoadMore"),d=S(()=>r.value==="LoadingMore");return{fetchNextPage:L=>{b(L??f)},hasNextPage:p,isFetchingNextPage:d,isLoading:g,pages:s,status:r}};export{se as useInfiniteQuery,oe as usePaginatedQuery};
@@ -0,0 +1 @@
1
+ import{createMutationRunner as l}from"@lunora/client";import{shallowRef as n,ref as v}from"vue";import{useLunora as c}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const p=s=>{const a=c(),o=n(void 0),t=n(void 0),r=v(!1),u=()=>{o.value=void 0,t.value=void 0},i=l(a,s,{setError:e=>{t.value=e},setPending:e=>{r.value=e},setResult:e=>{o.value=e,t.value=void 0}});return{data:o,error:t,mutate:i,pending:r,reset:u}};export{p as useMutation};
@@ -0,0 +1 @@
1
+ import{createMutatorRunner as c}from"@lunora/client";import{shallowRef as o,computed as i}from"vue";const d=n=>{const r=o(void 0),t=o(!1),s=i(()=>r.value!==void 0),{mutate:u,reset:a}=c(n,{setError:e=>{r.value=e},setPending:e=>{t.value=e}});return{error:r,isError:s,mutate:u,pending:t,reset:a}};export{d as useMutator};
@@ -0,0 +1 @@
1
+ import{shallowRef as b}from"vue";import{i as g}from"./is-browser-BEdfLJHK.mjs";import{useLunora as D}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{o as S}from"./scope-dispose-Mq3k4nvP.mjs";const h=(t="sess")=>{if(typeof crypto<"u"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"){const e=crypto.getRandomValues(new Uint8Array(16));return`${t}-${Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}`}}return`${t}-${Date.now().toString(36)}`},w=1e4,E=(t,e)=>{const n=D(),{heartbeat:u,intervalMs:f=w,listPresent:l,shardKey:r}=e,i=e.sessionId??h(),c=b(void 0);let a=e.data;const s=()=>{const o={roomId:t,sessionId:i,...a===void 0?{}:{data:a}};n.mutation(u,o,{shardKey:r}).catch(()=>{})},m=o=>{a=o,s()};if(g()){s();const o=setInterval(s,f),d=()=>{typeof document<"u"&&document.visibilityState==="visible"&&s()};typeof document<"u"&&document.addEventListener("visibilitychange",d);const y=n.acquireConnectionContext({roomId:t,sessionId:i},{shardKey:r}),p=n.subscribe(l,{roomId:t},v=>{c.value=v},{shardKey:r});S(()=>{clearInterval(o),typeof document<"u"&&document.removeEventListener("visibilitychange",d),y(),p()})}return{present:c,sessionId:i,setData:m}};export{E as usePresence};
@@ -0,0 +1 @@
1
+ import{evaluate as r}from"@lunora/ratelimit";import{shallowRef as k,toValue as l,watchEffect as b,onScopeDispose as A,computed as f}from"vue";const M=(o,i={})=>{const a=i.now??Date.now,p=i.tickMs??1e3;let e;const m=k(0),u=()=>{m.value+=1},t=k(r(l(o),e,{consume:!1,count:1,now:a(),reserve:!1}).status),w=b(()=>{m.value,t.value=r(l(o),e,{consume:!1,count:1,now:a(),reserve:!1}).status},{flush:"sync"});let s;const n=()=>{s!==void 0&&(clearInterval(s),s=void 0)},d=()=>{t.value.ok||s!==void 0||(s=setInterval(()=>{u(),t.value.ok&&n()},p))};A(()=>{n(),w()}),d();const h=(c=1)=>{const v=r(l(o),e,{consume:!0,count:c,now:a(),reserve:!1});return v.value!==void 0&&(e=v.value),u(),d(),v.status},I=(c=1)=>r(l(o),e,{consume:!1,count:c,now:a(),reserve:!1}).status.ok,y=()=>{e=void 0,n(),u()};return{check:I,consume:h,disabled:f(()=>!t.value.ok),ok:f(()=>t.value.ok),reset:y,retryAfter:f(()=>t.value.retryAfter)}};export{M as useRateLimit};
@@ -0,0 +1 @@
1
+ import{ref as u,watch as p,toValue as y,onScopeDispose as k}from"vue";import{useLunora as w}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const b=(v,m,s={})=>{const d=w(),t=u([]),c=u(void 0),e=u("idle");let a;const i=()=>{a?.()};return p(()=>y(m),(l,x,h)=>{if(t.value=[],c.value=void 0,l==="skip"){e.value="idle";return}e.value="streaming";let o=!0;const f=d.stream(v,l,{maxBuffer:s.maxBuffer,shardKey:s.shardKey}),n=()=>{f.cancel()};a=n,(async()=>{try{for await(const r of f){if(!o)return;t.value=[...t.value,r]}o&&(e.value="complete")}catch(r){if(!o)return;c.value=r instanceof Error?r:new Error(String(r)),e.value="error"}})().catch(()=>{}),h(()=>{o=!1,n(),a===n&&(a=void 0)})},{immediate:!0}),k(()=>{i()}),{cancel:i,chunks:t,error:c,status:e}};export{b as useStream};
@@ -0,0 +1 @@
1
+ import{createQuerySubscription as m}from"@lunora/client/query";import{LunoraError as l}from"@lunora/errors";import{ref as i,watch as c,toValue as p,onScopeDispose as f}from"vue";import{i as w}from"./is-browser-BEdfLJHK.mjs";import{useLunora as h}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const g=(t,u,v={})=>{const s=h(),e=i(void 0),r=i(void 0);return c(()=>p(u),(a,y,d)=>{if(a==="skip"){e.value=void 0,r.value=void 0;return}if(!w())return;const n=m(s,t,a,{onData:o=>{e.value=o,r.value=void 0},onError:o=>{r.value=o.code===void 0?new Error(o.message):new l(o.code,o.message),e.value=void 0},onReset:()=>{e.value=void 0}},{shardKey:v.shardKey});d(n)},{immediate:!0}),f(()=>{e.value=void 0,r.value=void 0}),{data:e,error:r}};export{g as useSubscription};
@@ -0,0 +1 @@
1
+ import{ref as A,onScopeDispose as I,toValue as P}from"vue";import{useLunora as V}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const W=16e3,H=e=>{if(e.length===0)return 0;let r=0;for(const o of e)r+=o*o;return Math.sqrt(r/e.length)},O=(e,r)=>{const o=r/W,a=o>1?Math.floor(e.length/o):e.length,p=new ArrayBuffer(a*2),i=new DataView(p);for(let l=0;l<a;l+=1){const v=e[Math.floor(l*o)]??0,k=Math.max(-1,Math.min(1,v));i.setInt16(l*2,k<0?k*32768:k*32767,!0)}return new Uint8Array(p)},q=async e=>{const r=globalThis,o=r.navigator?.mediaDevices?.getUserMedia.bind(r.navigator.mediaDevices),a=r.AudioContext??r.webkitAudioContext;if(!o||!a)throw new Error("useVoiceAgent: microphone capture requires getUserMedia + AudioContext (no browser audio available)");const p=await o({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}),i=new a,l=i.createMediaStreamSource(p),v=i.createScriptProcessor(4096,1,1);let k=!1,m=!1,h=0,s=0;return v.onaudioprocess=c=>{const d=c.inputBuffer.getChannelData(0),f=k?0:H(d);if(e.onLevel(f),k)return;if(e.onAudio(O(d,i.sampleRate)),e.isSpeaking()){s=f>=e.interruptThreshold?s+1:0,s>=e.interruptChunks&&(s=0,e.onInterrupt());return}s=0;const w=d.length/i.sampleRate*1e3;if(f>=e.silenceThreshold){m=!0,h=0;return}m&&(h+=w,h>=e.silenceDurationMs&&(m=!1,h=0,e.onSilence()))},l.connect(v),v.connect(i.destination),{setMuted:c=>{k=c},stop:()=>{v.disconnect(),l.disconnect();for(const c of p.getTracks())c.stop();i.close()}}},B=()=>{const e=globalThis,r=e.AudioContext??e.webkitAudioContext;if(!r)throw new Error("useVoiceAgent: audio playback requires AudioContext (no browser audio available)");const o=new r,a=new Set;let p=0,i=Promise.resolve(),l=0;const v=async(h,s)=>{if(s!==l)return;let c;try{c=await o.decodeAudioData(h.buffer)}catch{return}if(s!==l)return;const d=o.createBufferSource();d.buffer=c,d.connect(o.destination);const f=Math.max(o.currentTime,p);d.start(f),p=f+c.duration,a.add(d),d.onended=()=>{a.delete(d)}},k=h=>{const s=Uint8Array.from(h),c=l;i=i.then(()=>v(s,c))},m=()=>{l+=1;for(const h of a)try{h.stop()}catch{}a.clear(),p=o.currentTime};return{enqueue:k,interrupt:m,stop:()=>{m(),o.close()}}},_=1,$=.01,J=1200,K=.15,G=3,j=e=>e.startsWith("https://")?`wss://${e.slice(8)}`:e.startsWith("http://")?`ws://${e.slice(7)}`:e,z=e=>{const r=e.__lunoraRef,o=r.startsWith("agents:")?r.slice(7):r;return o.endsWith("Voice")?o.slice(0,-5):o},Q=(e,r,o)=>{const a=j(e),p=a.endsWith("/")?a.slice(0,-1):a,i=new URLSearchParams({threadKey:o});return`${p}/_lunora/voice/${encodeURIComponent(r)}?${i.toString()}`},Z=e=>{const{createMicrophone:r=q,createSpeaker:o=B,createSocket:a,interruptChunks:p=G,interruptThreshold:i=K,silenceDurationMs:l=J,silenceThreshold:v=$,threadKey:k,voice:m}=e,h=V(),s=A("idle"),c=A(!1),d=A(""),f=A(""),w=A(0),b=A(!1),y=A(void 0);let u,T=!1;const M=t=>{const n=u?.socket;return n?.readyState===_?(n.send(JSON.stringify(t)),!0):!1},C=()=>{const t=u;if(u=void 0,t){t.microphone?.stop(),t.speaker?.stop();try{t.socket.close()}catch{}}T=!1,c.value=!1,s.value="idle",w.value=0},U=C,R=t=>{const n=u;switch(t.type){case"assistant_delta":{n&&(n.speaking=!0),s.value="speaking",f.value+=t.text;break}case"assistant_done":{n&&(n.speaking=!1),f.value=t.text,s.value="listening";break}case"error":{n&&(n.speaking=!1),y.value=new Error(t.message),s.value="listening";break}case"interrupted":{n&&(n.speaking=!1,n.suppressAudio=!1),n?.speaker?.interrupt(),s.value="listening";break}case"ready":{n&&(n.audioFormat=t.audioFormat,n.suppressAudio=!1),c.value=!0,s.value="listening";break}case"user_transcript":{n&&(n.suppressAudio=!1),d.value=t.text,f.value="",s.value="thinking";break}}},D=t=>{const n=u;!n||n.suppressAudio||(n.speaker??=o({audioFormat:n.audioFormat}),n.speaking=!0,s.value="speaking",n.speaker.enqueue(t))},L=async()=>{if(!(u||T)){T=!0,y.value=void 0,d.value="",f.value="";try{const t=Q(h.url,z(m),P(k)),S=(a??(g=>new globalThis.WebSocket(g)))(t);S.binaryType="arraybuffer";const E={audioFormat:"mp3",microphone:void 0,socket:S,speaker:void 0,speaking:!1,suppressAudio:!1};u=E,S.onmessage=g=>{if(typeof g.data=="string"){try{R(JSON.parse(g.data))}catch{}return}D(new Uint8Array(g.data))},S.onerror=()=>{y.value=new Error("useVoiceAgent: voice socket error")},S.onclose=()=>{u===E&&C()};const x=await r({interruptChunks:p,interruptThreshold:i,isSpeaking:()=>u?.speaking??!1,onAudio:g=>{S.readyState===_&&S.send(g)},onInterrupt:()=>{M({type:"interrupt"}),u?.speaker?.interrupt(),u&&(u.speaking=!1,u.suppressAudio=!0),s.value="listening"},onLevel:g=>{w.value=g},onSilence:()=>{M({type:"commit"}),s.value="thinking"},silenceDurationMs:l,silenceThreshold:v});u===E?(E.microphone=x,b.value=!1,s.value="listening"):x.stop()}catch(t){y.value=t instanceof Error?t:new Error(String(t)),C()}finally{T=!1}}},F=()=>{const t=!b.value;return u?.microphone?.setMuted(t),b.value=t,t},N=t=>{M({text:t,type:"text"})&&(s.value="thinking")};return I(C),{audioLevel:w,connected:c,endCall:U,error:y,interimTranscript:f,isMuted:b,sendText:N,startCall:L,status:s,toggleMute:F,transcript:d}};export{Z as useVoiceAgent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/vue",
3
- "version": "1.0.0-alpha.78",
3
+ "version": "1.0.0-alpha.79",
4
4
  "description": "Vue adapter for Lunora — live composables, optimistic mutations, and reactive loaders",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -54,11 +54,11 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@lunora/client": "1.0.0-alpha.49",
57
+ "@lunora/client": "1.0.0-alpha.50",
58
58
  "@lunora/errors": "1.0.0-alpha.21",
59
59
  "@lunora/ratelimit": "1.0.0-alpha.22",
60
60
  "@lunora/runtime": "1.0.0-alpha.62",
61
- "@visulima/storage-client": "1.0.0"
61
+ "@visulima/storage-client": "1.0.2"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "vue": "^3.5.0"
@@ -1 +0,0 @@
1
- import{defineComponent as l,computed as a}from"vue";import{useAuth as s}from"./useAuth-DwDFjvto.mjs";const i=l({name:"Authenticated",setup(o,{slots:t}){const{token:e,user:u}=s(),n=a(()=>e.value!==null&&u.value!==null);return()=>n.value?t.default?.():void 0}}),v=l({name:"Unauthenticated",setup(o,{slots:t}){const{token:e,user:u}=s(),n=a(()=>e.value!==null&&u.value===null);return()=>!n.value&&e.value===null?t.default?.():void 0}}),c=l({name:"AuthLoading",setup(o,{slots:t}){const{token:e,user:u}=s(),n=a(()=>e.value!==null&&u.value===null);return()=>n.value?t.default?.():void 0}});export{c as AuthLoading,i as Authenticated,v as Unauthenticated};
@@ -1 +0,0 @@
1
- import{LunoraError as n}from"@lunora/errors";import{inject as t,provide as a}from"vue";const o=Symbol("lunora.client"),p=r=>({install(e){e.provide(o,r)}}),l=r=>{a(o,r)},L=()=>{const r=t(o,void 0);if(!r)throw new n("INTERNAL","useLunora(): no LunoraClient provided — call app.use(createLunora(client)) or provideLunora(client) in a parent setup().");return r};export{o as LUNORA_INJECTION_KEY,p as createLunora,l as provideLunora,L as useLunora};
@@ -1 +0,0 @@
1
- import{useLunora as n}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";import{subscribeToQuery as u}from"./subscribeToQuery-Sz46o9Xt.mjs";const f=r=>{const e=n(),{args:o,functionPath:t,shardKey:a,value:s}=r;return u(e,{__lunoraRef:t},o,{seed:s,shardKey:a})};export{f as hydratePreloaded};
@@ -1 +0,0 @@
1
- import{getCurrentScope as e,onScopeDispose as p}from"vue";const c=(o,r)=>{e()&&p(o)};export{c as e};
@@ -1 +0,0 @@
1
- const y=(e,t)=>e<t?-1:e>t?1:0,s=e=>{if(e===void 0)return"null";if(typeof e=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>s(r)).join(",")}]`;const t=Object.getPrototypeOf(e);if(t!==null&&t!==Object.prototype){const r=e.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${r} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const n=e,a=Object.keys(n).toSorted(y),i=[];for(const r of a){const o=n[r];o!==void 0&&i.push(`${JSON.stringify(r)}:${s(o)}`)}return`{${i.join(",")}}`};export{s as e};
@@ -1 +0,0 @@
1
- import{createQuerySubscription as f}from"@lunora/client/query";import{shallowRef as a,watch as p,toValue as y}from"vue";import{i as m}from"./is-browser-BEdfLJHK.mjs";import{useLunora as h}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";import{e as l}from"./scope-dispose-Dn0gQ2SS.mjs";const R=(o,s,t,r={})=>{const e=a(r.seed);if(m()){const u=o.subscribe(s,t,i=>{e.value=i},{shardKey:r.shardKey});l(u)}return e},x=(o,s,t={})=>{const r=h(),e=a(void 0);return p(()=>y(s),(u,i,n)=>{if(!m())return;const c=f(r,o,u,{onData:d=>{e.value=d},onReset:()=>{e.value=void 0}},{shardKey:t.shardKey});n(c)},{immediate:!0}),e};export{R as subscribeToQuery,x as useQuery};
@@ -1 +0,0 @@
1
- import{computed as s,toValue as n}from"vue";import{useMutation as i}from"./useMutation-MdgW9pRE.mjs";import{useSubscription as h}from"./useSubscription-3X8pNJ6P.mjs";const v={__lunoraRef:""},K=o=>{const{api:d,cancel:u,run:c,runArgs:p,threadKey:a}=o,r=i(c),m=i(u??v),{data:g}=h(d.agents.agentThread,()=>({key:n(a)})),e=s(()=>g.value),l=s(()=>e.value?.status),y=async(t,f)=>{await r.mutate({input:t,threadKey:n(a),...p,...f})};return{cancel:async()=>{const t=e.value?.instanceId;u===void 0||t===void 0||await m.mutate({instanceId:t,threadKey:n(a)})},pending:r.pending,run:y,status:l,thread:e}};export{v as NO_MUTATION_REF,K as useAgent};
@@ -1 +0,0 @@
1
- import{reconcileOptimistic as y,maxSeq as I}from"@lunora/client";import{ref as N,computed as i,toValue as s}from"vue";import{NO_MUTATION_REF as R}from"./useAgent-CeAYhGZA.mjs";import{useMutation as m}from"./useMutation-MdgW9pRE.mjs";import{useStream as U}from"./useStream-CYkKEcDf.mjs";import{useSubscription as k}from"./useSubscription-3X8pNJ6P.mjs";const F={__lunoraRef:""},H=w=>{const{api:c,cancel:v,limit:p,send:A,sendArgs:x,stream:g,threadKey:n}=w,{data:S}=k(c.agents.agentMessages,()=>{const e=s(n);return p===void 0?{key:e}:{key:e,limit:p}}),{data:K}=k(c.agents.agentThread,()=>({key:s(n)})),O=g===void 0?"skip":()=>({key:s(n)}),{chunks:T}=U(g??F,O),_=m(A),C=m(v??R),M=m(c.agents.agentResolveApproval),o=N([]);let h=0;const l=i(()=>K.value),$=i(()=>l.value?.status),u=i(()=>S.value??[]),b=i(()=>{const e=u.value,a=y(o.value,e);if(a.length===0)return e;const t=I(e);return[...e,...a.map((r,d)=>({content:r.content,optimistic:!0,role:"user",seq:t+1+d}))]}),j=i(()=>{const e=s(n),a=u.value.filter(t=>t.role==="assistant").length;return T.value.filter(t=>t.kind!=="progress"&&t.threadKey===e&&t.turn>=a).map(t=>t.text).join("")}),q=async(e,a)=>{const t=h;h+=1;const r=I(u.value);o.value=[...y(o.value,u.value),{content:e,id:t,maxDurableSeqAtSend:r}];try{await _.mutate({input:e,threadKey:s(n),...x,...a})}catch(d){throw o.value=o.value.filter(E=>E.id!==t),d}},f=async(e,a,t)=>{const r=l.value?.instanceId;if(r===void 0)throw new Error(`useAgentChat: cannot ${e} — no in-flight run (thread has no instanceId)`);await M.mutate({decision:e,instanceId:r,threadKey:s(n),toolCallId:a,...t===void 0?{}:{note:t}})};return{approve:async(e,a)=>f("approve",e,a),cancel:async()=>{const e=l.value?.instanceId;v===void 0||e===void 0||await C.mutate({instanceId:e,threadKey:s(n)})},messages:b,reject:async(e,a)=>f("reject",e,a),send:q,status:$,streamingText:j}};export{H as useAgentChat};
@@ -1 +0,0 @@
1
- import{computed as o,toValue as s}from"vue";import{useSubscription as n}from"./useSubscription-3X8pNJ6P.mjs";const p=t=>{const{data:e,error:r}=n(t.api.agents.agentState,()=>({key:s(t.threadKey)})),a=o(()=>e.value);return{error:r,state:a}};export{p as useAgentState};
@@ -1 +0,0 @@
1
- import{computed as v,toValue as e}from"vue";import{useStream as c}from"./useStream-CYkKEcDf.mjs";import{useSubscription as C}from"./useSubscription-3X8pNJ6P.mjs";const f={__lunoraRef:""},g=[],y=t=>{if(t.role==="assistant"&&t.toolCalls)return t.toolCalls.map(a=>({input:a.input,seq:t.seq,toolCallId:a.id,toolName:a.name,type:"call"}));if(t.role==="tool")return t.status==="awaiting_approval"?[{seq:t.seq,type:"awaiting-approval",...t.toolCallId===void 0?{}:{toolCallId:t.toolCallId},...t.toolName===void 0?{}:{toolName:t.toolName}}]:[{output:t.content,seq:t.seq,type:"result",...t.status==="approved"||t.status==="rejected"?{status:t.status}:{},...t.toolCallId===void 0?{}:{toolCallId:t.toolCallId},...t.toolName===void 0?{}:{toolName:t.toolName}}]},q=t=>{const{api:a,limit:r,stream:i,threadKey:s}=t,u=()=>{const l=e(s);return r===void 0?{key:l}:{key:l,limit:r}},{data:d}=C(a.agents.agentMessages,u),n=i===void 0?"skip":()=>({key:e(s)}),{chunks:m}=c(i??f,n);return{events:v(()=>{const l=e(s),p=(d.value??g).flatMap(o=>y(o)??[]);for(const o of m.value)o.kind==="progress"&&o.threadKey===l&&p.push({data:o.data,toolCallId:o.toolCallId,type:"progress"});return p})}};export{q as useAgentToolEvents};
@@ -1 +0,0 @@
1
- import{getIdentityStore as k}from"@lunora/client/auth";import{ref as n,onScopeDispose as m,readonly as s}from"vue";import{useLunora as p}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";const f=()=>{const e=p(),t=k(e),o=n(e.getAuthToken()),r=n(t.getUser()),u=()=>{o.value=e.getAuthToken()},g=()=>{r.value=t.getUser()},i=e.onAuthTokenChange(u),a=t.subscribe(g);return m(()=>{i(),a()}),{setToken:h=>{e.setAuthToken(h)},token:s(o),user:s(r)}};export{f as useAuth};
@@ -1 +0,0 @@
1
- import{shallowRef as r}from"vue";import{useLunora as a}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";import{e as s}from"./scope-dispose-Dn0gQ2SS.mjs";const f=()=>{const o=a(),t=r(o.connectionStatus()),n=o.onConnectionStatus(e=>{t.value=e});return s(n),t};export{f as default};
@@ -1 +0,0 @@
1
- import{shallowRef as b,watch as p,toValue as a}from"vue";import{e as v}from"./stable-key-BSG0zK_E.mjs";import{useLunora as _}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";const g="__lunora_flags__:eval",y=t=>{const e=typeof t;return e==="boolean"||e==="number"||e==="string"?e:"object"},d={__lunoraRef:g},h=t=>t===void 0?"":v(t),k=(t,e,u)=>{const o=_(),n=y(e),c=b(e);return p(()=>`${a(t)}\0${h(a(u))}`,(x,m,f)=>{const l=a(t),r=a(u);c.value=e;let s;try{s=o.subscribe(d,{context:r,default:e,key:l,type:n},i=>{c.value=i})}catch{return}f(s)},{immediate:!0}),c},w=(t,e)=>{const u=_(),o=b(t),n=v(t);return p(()=>`${n}\0${h(a(e))}`,(c,x,m)=>{const f=a(e);o.value=t;const l=[];for(const[r,s]of Object.entries(t))try{l.push(u.subscribe(d,{context:f,default:s,key:r,type:y(s)},i=>{o.value={...o.value,[r]:i}}))}catch{}m(()=>{for(const r of l)r()})},{immediate:!0}),o};export{k as useFlag,w as useFlags};
@@ -1 +0,0 @@
1
- import{shallowRef as N,watch as $,toValue as L,onScopeDispose as z,computed as K}from"vue";import{initialPages as U,derivePaginationStatus as E,applyLoadMore as Q,rebalance as q}from"@lunora/client/pagination";import{i as G}from"./is-browser-BEdfLJHK.mjs";import{e as H}from"./stable-key-BSG0zK_E.mjs";import{useLunora as J}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";const k=e=>{let r="";for(let i=0;i<e.length;i+=32768)r+=String.fromCharCode(...e.subarray(i,i+32768));return btoa(r)},f="$lunora.wire$",F=64,W="__proto__",X=e=>{if(e===null||typeof e!="object")return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype},h=(e,r=0)=>{if(r>F)throw new RangeError(`wire-codec: value nesting exceeds the ${F}-level limit`);if(e===void 0)return[f,"undefined"];if(e===null)return null;const i=typeof e;if(i==="bigint")return[f,"bigint",e.toString()];if(i==="number"){const t=e;return Number.isNaN(t)?[f,"nan"]:t===1/0?[f,"inf"]:t===-1/0?[f,"-inf"]:t}if(i!=="object")return e;if(e instanceof Date)return[f,"date",h(e.getTime(),r+1)];if(e instanceof Error){const t=e,o={};for(const b of Object.keys(t))t[b]!==void 0&&(o[b]=h(t[b],r+1));const a=[f,"error",t.name,t.message,o];return t.cause!==void 0&&a.push(h(t.cause,r+1)),a}if(e instanceof URL)return[f,"url",e.href];if(e instanceof Map)return[f,"map",[...e.entries()].map(([t,o])=>[h(t,r+1),h(o,r+1)])];if(e instanceof Set)return[f,"set",[...e].map(t=>h(t,r+1))];if(e instanceof ArrayBuffer)return[f,"bytes",k(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const t=e,o=t.constructor.name,a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return o==="Uint8Array"?[f,"bytes",k(a)]:[f,"bytes",k(a),o]}if(Array.isArray(e)){const t=e.map(o=>h(o,r+1));return t.length>0&&t[0]===f?[f,"arr",t]:t}if(!X(e)){const t=e.constructor?.name??"value";throw new TypeError(`wire-codec: cannot encode a ${t} over the Lunora wire — only plain objects, arrays, and the supported built-ins (Date, Error, URL, Map, Set, ArrayBuffer/typed arrays, bigint) round-trip`)}const _=e,y={};for(const t of Object.keys(_)){const o=_[t];if(o===void 0)continue;const a=h(o,r+1);t===W?Object.defineProperty(y,t,{configurable:!0,enumerable:!0,value:a,writable:!0}):y[t]=a}return y},D=e=>H(h(e)),R=(e,r)=>`${e}::${D(r)}`,P=(e,r)=>({...r,paginationOpts:{cursor:e.lower,endCursor:e.upper,numItems:e.numItems}}),T=(e,r,i)=>{const _=J(),{initialNumItems:y,shardKey:t}=i,o=N(U(y)),a=N([]);let b;const p=new Map,d=new Map,m=new Set,S=(n,s)=>{a.value=n.map(v=>{const w=R(e.__lunoraRef,P(v,s));return d.get(w)})},V=(n,s,v)=>{const w=u=>R(e.__lunoraRef,P(u,v));for(const u of s){const l=w(u);if(d.has(l))continue;const g=n.find(c=>c.lower===u.lower);if(g){const c=d.get(w(g));c&&d.set(l,c)}}},x=(n,s)=>{const v=new Set;for(const u of n)v.add(R(e.__lunoraRef,P(u,s)));for(const[u,l]of p)v.has(l.currentKey)||(l.unsub(),p.delete(u),d.delete(l.currentKey),m.delete(l.currentKey));const w=new Set([...p.values()].map(u=>u.currentKey));for(const u of n){const l=P(u,s),g=R(e.__lunoraRef,l);if(w.has(g))continue;const c={currentKey:g,unsub:void 0};m.add(g);const M=_.subscribe(e,l,A=>{d.set(c.currentKey,A),m.delete(c.currentKey);const O=L(r);if(S(o.value,O),m.size===0){const I=o.value,j=q(I,a.value);j&&(V(I,j,O),o.value=j)}},{shardKey:t});c.unsub=M,p.set(g,c),w.add(g)}},C=()=>{for(const n of p.values())n.unsub();p.clear(),d.clear(),m.clear()};$(()=>D(L(r)),()=>{if(!G())return;const n=L(r);C(),o.value=U(y),a.value=[],b=void 0,n!=="skip"&&(x(o.value,n),S(o.value,n))},{immediate:!0}),$(()=>o.value,n=>{const s=L(r);s!=="skip"&&(x(n,s),S(n,s))}),z(C);const B=N("LoadingFirstPage");return $([()=>L(r),a],([n,s])=>{B.value=E(n==="skip",s).status},{immediate:!0}),{loadMore:n=>{const s=L(r);if(s==="skip")return;const{nextCursor:v,status:w}=E(!1,a.value);if(w!=="CanLoadMore"||v===b)return;const u=Q(o.value,v,n);if(!u)return;b=v;const l=o.value.at(-1),g=u.at(-2);if(l&&g){const c=R(e.__lunoraRef,P(l,s)),M=R(e.__lunoraRef,P(g,s)),A=p.get(c);if(A&&c!==M){A.currentKey=M,p.set(M,A),p.delete(c);const O=d.get(c);O&&(d.set(M,O),d.delete(c))}}o.value=u},pageResults:a,status:B}},oe=(e,r,i)=>{const{loadMore:_,pageResults:y,status:t}=T(e,r,i),o=K(()=>y.value.flatMap(a=>a?.page??[]));return{isLoading:K(()=>t.value==="LoadingFirstPage"||t.value==="LoadingMore"),loadMore:_,results:o,status:t}},ae=(e,r,i)=>{const{initialNumItems:_}=i,{loadMore:y,pageResults:t,status:o}=T(e,r,i),a=K(()=>t.value.flatMap(m=>m?[m.page]:[])),b=K(()=>o.value==="LoadingFirstPage"),p=K(()=>o.value==="CanLoadMore"),d=K(()=>o.value==="LoadingMore");return{fetchNextPage:m=>{y(m??_)},hasNextPage:p,isFetchingNextPage:d,isLoading:b,pages:a,status:o}};export{ae as useInfiniteQuery,oe as usePaginatedQuery};
@@ -1 +0,0 @@
1
- import{createMutationRunner as v}from"@lunora/client";import{shallowRef as a,ref as l}from"vue";import{useLunora as d}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";const c=u=>{const i=d(),t=a(void 0),r=a(void 0),o=l(!1),n=()=>{t.value=void 0,r.value=void 0},s=v(i,u,{setError:e=>{r.value=e},setPending:e=>{o.value=e},setResult:e=>{t.value=e,r.value=void 0}});return{data:t,error:r,mutate:s,pending:o,reset:n}};export{c as useMutation};
@@ -1 +0,0 @@
1
- import{createMutatorRunner as i}from"@lunora/client";import{shallowRef as o,computed as m}from"vue";const p=u=>{const e=o(void 0),t=o(!1),a=m(()=>e.value!==void 0),{mutate:s,reset:n}=i(u,{setError:r=>{e.value=r},setPending:r=>{t.value=r}});return{error:e,isError:a,mutate:s,pending:t,reset:n}};export{p as useMutator};
@@ -1 +0,0 @@
1
- import{shallowRef as I}from"vue";import{i as h}from"./is-browser-BEdfLJHK.mjs";import{useLunora as b}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";import{e as g}from"./scope-dispose-Dn0gQ2SS.mjs";const $=(e="sess")=>{if(typeof crypto<"u"){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto.getRandomValues=="function"){const t=crypto.getRandomValues(new Uint8Array(16));return`${e}-${Array.from(t,o=>o.toString(16).padStart(2,"0")).join("")}`}}return`${e}-${Date.now().toString(36)}`},w=1e4,S=(e,t)=>{const o=b(),{heartbeat:u,intervalMs:m=w,listPresent:y,shardKey:s}=t,i=t.sessionId??$(),c=I(void 0);let a=t.data;const n=()=>{const r={roomId:e,sessionId:i,...a===void 0?{}:{data:a}};o.mutation(u,r,{shardKey:s}).catch(()=>{})},f=r=>{a=r,n()};if(h()){n();const r=setInterval(n,m),d=()=>{typeof document<"u"&&document.visibilityState==="visible"&&n()};typeof document<"u"&&document.addEventListener("visibilitychange",d);const p=o.acquireConnectionContext({roomId:e,sessionId:i},{shardKey:s}),l=o.subscribe(y,{roomId:e},v=>{c.value=v},{shardKey:s});g(()=>{clearInterval(r),typeof document<"u"&&document.removeEventListener("visibilitychange",d),p(),l()})}return{present:c,sessionId:i,setData:f}};export{S as usePresence};
@@ -1 +0,0 @@
1
- import{evaluate as u}from"@lunora/ratelimit";import{shallowRef as d,toValue as r,watchEffect as b,onScopeDispose as A,computed as f}from"vue";const L=(s,i={})=>{const a=i.now??Date.now,k=i.tickMs??1e3;let e;const w=d(0),l=()=>{w.value+=1},o=d(u(r(s),e,{consume:!1,count:1,now:a(),reserve:!1}).status),p=b(()=>{o.value=u(r(s),e,{consume:!1,count:1,now:a(),reserve:!1}).status},{flush:"sync"});let t;const n=()=>{t!==void 0&&(clearInterval(t),t=void 0)},m=()=>{o.value.ok||t!==void 0||(t=setInterval(()=>{l(),o.value.ok&&n()},k))};A(()=>{n(),p()}),m();const h=(c=1)=>{const v=u(r(s),e,{consume:!0,count:c,now:a(),reserve:!1});return v.value!==void 0&&(e=v.value),l(),m(),v.status},y=(c=1)=>u(r(s),e,{consume:!1,count:c,now:a(),reserve:!1}).status.ok,R=()=>{e=void 0,n(),l()};return{check:y,consume:h,disabled:f(()=>!o.value.ok),ok:f(()=>o.value.ok),reset:R,retryAfter:f(()=>o.value.retryAfter)}};export{L as useRateLimit};
@@ -1 +0,0 @@
1
- import{ref as n,watch as h,toValue as y,onScopeDispose as w}from"vue";import{useLunora as x}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";const B=(m,v,l={})=>{const d=x(),a=n([]),u=n(void 0),e=n("idle");let t;const c=()=>{t?.()};return h(()=>y(v),(i,S,p)=>{if(a.value=[],u.value=void 0,i==="skip"){e.value="idle";return}e.value="streaming";let o=!0;const f=d.stream(m,i,{maxBuffer:l.maxBuffer,shardKey:l.shardKey}),s=()=>{f.cancel()};t=s,(async()=>{try{for await(const r of f){if(!o)return;a.value=[...a.value,r]}o&&(e.value="complete")}catch(r){if(!o)return;u.value=r instanceof Error?r:new Error(String(r)),e.value="error"}})().catch(()=>{}),p(()=>{o=!1,s(),t===s&&(t=void 0)})},{immediate:!0}),w(()=>{c()}),{cancel:c,chunks:a,error:u,status:e}};export{B as useStream};
@@ -1 +0,0 @@
1
- import{createQuerySubscription as n}from"@lunora/client/query";import{LunoraError as p}from"@lunora/errors";import{ref as a,watch as c,toValue as l,onScopeDispose as f}from"vue";import{i as w}from"./is-browser-BEdfLJHK.mjs";import{useLunora as h}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";const K=(s,t,u={})=>{const v=h(),o=a(void 0),e=a(void 0);return c(()=>l(t),(i,y,d)=>{if(i==="skip"){o.value=void 0,e.value=void 0;return}if(!w())return;const m=n(v,s,i,{onData:r=>{o.value=r,e.value=void 0},onError:r=>{e.value=r.code===void 0?new Error(r.message):new p(r.code,r.message),o.value=void 0},onReset:()=>{o.value=void 0}},{shardKey:u.shardKey});d(m)},{immediate:!0}),f(()=>{o.value=void 0,e.value=void 0}),{data:o,error:e}};export{K as useSubscription};
@@ -1 +0,0 @@
1
- import{ref as y,onScopeDispose as F,toValue as L}from"vue";import{useLunora as R}from"./LUNORA_INJECTION_KEY-CswQb5zb.mjs";const W=t=>{if(t.length===0)return 0;let s=0;for(const n of t)s+=n*n;return Math.sqrt(s/t.length)},B=(t,s)=>{const n=s/16e3,o=n>1?Math.floor(t.length/n):t.length,d=new ArrayBuffer(o*2),i=new DataView(d);for(let c=0;c<o;c+=1){const v=t[Math.floor(c*n)]??0,g=Math.max(-1,Math.min(1,v));i.setInt16(c*2,g<0?g*32768:g*32767,!0)}return new Uint8Array(d)},I=async t=>{const s=globalThis,n=s.navigator?.mediaDevices?.getUserMedia.bind(s.navigator.mediaDevices),o=s.AudioContext??s.webkitAudioContext;if(!n||!o)throw new Error("useVoiceAgent: microphone capture requires getUserMedia + AudioContext (no browser audio available)");const d=await n({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}),i=new o,c=i.createMediaStreamSource(d),v=i.createScriptProcessor(4096,1,1);let g=!1,m=!1,f=0,a=0;return v.onaudioprocess=u=>{const p=u.inputBuffer.getChannelData(0),h=g?0:W(p);if(t.onLevel(h),g)return;if(t.onAudio(B(p,i.sampleRate)),t.isSpeaking()){a=h>=t.interruptThreshold?a+1:0,a>=t.interruptChunks&&(a=0,t.onInterrupt());return}a=0;const w=p.length/i.sampleRate*1e3;if(h>=t.silenceThreshold){m=!0,f=0;return}m&&(f+=w,f>=t.silenceDurationMs&&(m=!1,f=0,t.onSilence()))},c.connect(v),v.connect(i.destination),{setMuted:u=>{g=u},stop:()=>{v.disconnect(),c.disconnect();for(const u of d.getTracks())u.stop();i.close()}}},J=()=>{const t=globalThis,s=t.AudioContext??t.webkitAudioContext;if(!s)throw new Error("useVoiceAgent: audio playback requires AudioContext (no browser audio available)");const n=new s,o=new Set;let d=0,i=Promise.resolve(),c=0;const v=async(f,a)=>{if(a!==c)return;let u;try{u=await n.decodeAudioData(f.buffer)}catch{return}if(a!==c)return;const p=n.createBufferSource();p.buffer=u,p.connect(n.destination);const h=Math.max(n.currentTime,d);p.start(h),d=h+u.duration,o.add(p),p.onended=()=>{o.delete(p)}},g=f=>{const a=Uint8Array.from(f),u=c;i=i.then(()=>v(a,u))},m=()=>{c+=1;for(const f of o)try{f.stop()}catch{}o.clear(),d=n.currentTime};return{enqueue:g,interrupt:m,stop:()=>{m(),n.close()}}},D=1,K=.01,N=1200,P=.15,O=3,j=t=>t.startsWith("https://")?`wss://${t.slice(8)}`:t.startsWith("http://")?`ws://${t.slice(7)}`:t,G=t=>{const s=t.__lunoraRef,n=s.startsWith("agents:")?s.slice(7):s;return n.endsWith("Voice")?n.slice(0,-5):n},H=(t,s,n)=>{const o=j(t),d=o.endsWith("/")?o.slice(0,-1):o,i=new URLSearchParams({threadKey:n});return`${d}/_lunora/voice/${encodeURIComponent(s)}?${i.toString()}`},X=t=>{const{createMicrophone:s=I,createSpeaker:n=J,createSocket:o,interruptChunks:d=O,interruptThreshold:i=P,silenceDurationMs:c=N,silenceThreshold:v=K,threadKey:g,voice:m}=t,f=R(),a=y("idle"),u=y(!1),p=y(""),h=y(""),w=y(0),b=y(!1),A=y(void 0);let l,S=!1;const C=r=>{const e=l?.socket;return e?.readyState===D?(e.send(JSON.stringify(r)),!0):!1},M=()=>{const r=l;if(l=void 0,r){r.microphone?.stop(),r.speaker?.stop();try{r.socket.close()}catch{}}S=!1,u.value=!1,a.value="idle",w.value=0},U=M,V=r=>{const e=l;switch(r.type){case"assistant_delta":{e&&(e.speaking=!0),a.value="speaking",h.value+=r.text;break}case"assistant_done":{e&&(e.speaking=!1),h.value=r.text,a.value="listening";break}case"error":{e&&(e.speaking=!1),A.value=new Error(r.message),a.value="listening";break}case"interrupted":{e&&(e.speaking=!1,e.suppressAudio=!1),e?.speaker?.interrupt(),a.value="listening";break}case"ready":{e&&(e.audioFormat=r.audioFormat,e.suppressAudio=!1),u.value=!0,a.value="listening";break}case"user_transcript":{e&&(e.suppressAudio=!1),p.value=r.text,h.value="",a.value="thinking";break}}},$=r=>{const e=l;!e||e.suppressAudio||(e.speaker??=n({audioFormat:e.audioFormat}),e.speaking=!0,a.value="speaking",e.speaker.enqueue(r))},E=async()=>{if(!(l||S)){S=!0,A.value=void 0,p.value="",h.value="";try{const r=H(f.url,G(m),L(g)),e=(o??(k=>new globalThis.WebSocket(k)))(r);e.binaryType="arraybuffer";const x={audioFormat:"mp3",microphone:void 0,socket:e,speaker:void 0,speaking:!1,suppressAudio:!1};l=x,e.onmessage=k=>{if(typeof k.data=="string"){try{V(JSON.parse(k.data))}catch{}return}$(new Uint8Array(k.data))},e.onerror=()=>{A.value=new Error("useVoiceAgent: voice socket error")},e.onclose=()=>{l===x&&M()};const T=await s({interruptChunks:d,interruptThreshold:i,isSpeaking:()=>l?.speaking??!1,onAudio:k=>{e.readyState===D&&e.send(k)},onInterrupt:()=>{C({type:"interrupt"}),l?.speaker?.interrupt(),l&&(l.speaking=!1,l.suppressAudio=!0),a.value="listening"},onLevel:k=>{w.value=k},onSilence:()=>{C({type:"commit"}),a.value="thinking"},silenceDurationMs:c,silenceThreshold:v});l===x?(x.microphone=T,b.value=!1,a.value="listening"):T.stop()}catch(r){A.value=r instanceof Error?r:new Error(String(r)),M()}finally{S=!1}}},_=()=>{const r=!b.value;return l?.microphone?.setMuted(r),b.value=r,r},q=r=>{C({text:r,type:"text"})&&(a.value="thinking")};return F(M),{audioLevel:w,connected:u,endCall:U,error:A,interimTranscript:h,isMuted:b,sendText:q,startCall:E,status:a,toggleMute:_,transcript:p}};export{X as useVoiceAgent};