@lunora/vue 1.0.0-alpha.137 → 1.0.0-alpha.138

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.
package/README.md CHANGED
@@ -83,7 +83,7 @@ const { mutate, pending } = useMutation(api.messages.send);
83
83
  | `useSubscription` | `useSubscription` | Raw subscription `ShallowRef` — unbounded live stream. |
84
84
  | `usePaginatedQuery` | `usePaginatedQuery` | Cursor-paginated query with `loadMore`, `status`, `results`, and `error`. |
85
85
  | `useInfiniteQuery` | `useInfiniteQuery` | Infinite-scroll variant of `usePaginatedQuery`. |
86
- | `useAuth` | `useAuth` | Reactive auth: readonly `token`/`user` refs plus `setToken`. |
86
+ | `useAuth` | `useAuth` | Reactive auth: readonly `token`/`user`/`status` refs plus `setToken`. |
87
87
  | `usePresence` | `usePresence` | Collaborative-awareness — heartbeat + live present-members `ShallowRef`. |
88
88
  | `useFlag` | `useFlag` | Live OpenFeature flag as a readonly `Ref` — holds `default` until resolved. |
89
89
  | `useFlags` | `useFlags` | Batch variant — a readonly `Ref` of one value per key in the defaults map. |
package/dist/index.d.mts CHANGED
@@ -1,22 +1,29 @@
1
1
  import { Component, Ref, InjectionKey, App, MaybeRefOrGetter, ComputedRef, DeepReadonly, ShallowRef } from 'vue';
2
2
  import { Preloaded, SubscriptionErrorCallback, LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, User, ConnectionStatus, MutationCallOptions, MutatorHandle, SubscriptionError } from '@lunora/client';
3
3
  export type { ArgsOf, FunctionReference, LunoraClient, MutationCallOptions, MutatorHandle, MutatorTransaction, OptimisticLocalStore, OptimisticUpdate, Preloaded, ReturnOf, SubscriptionError, SubscriptionErrorCallback, Unsubscribe, User } from '@lunora/client';
4
+ import { AuthStatus } from '@lunora/client/auth';
4
5
  import { PaginationStatus } from '@lunora/client/pagination';
5
6
  export type { PaginationResult, PaginationStatus } from '@lunora/client/pagination';
6
7
  import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
7
8
  /**
8
- * Render the default slot only after auth has settled and a token + user are
9
- * both present. Hides the slot on first render and when signed out.
9
+ * Render the default slot once authentication has settled in the caller's
10
+ * favour a credential is held and nothing has contradicted it.
11
+ *
12
+ * Gated on {@link isAuthenticatedStatus}, the shared contract in
13
+ * `@lunora/client/auth`, not on `user !== null`: an unreachable identity
14
+ * endpoint leaves `user` at `null` while the credential is still perfectly
15
+ * valid, and requiring a user record there hid the whole app behind
16
+ * `AuthLoading` for the length of an offline session.
10
17
  */
11
18
  declare const Authenticated: Component;
12
19
  /**
13
- * Render the default slot only when auth has settled and no token is present
14
- * (the signed-out state). Hidden while the user is still loading.
20
+ * Render the default slot only when authentication has settled and there is no
21
+ * session no credential, or the server answered that the credential has none.
15
22
  */
16
23
  declare const Unauthenticated: Component;
17
24
  /**
18
- * Render the default slot while authentication is still in progress — token is
19
- * set but `getCurrentUser()` has not yet resolved.
25
+ * Render the default slot while authentication is still in progress — a
26
+ * credential is held and the first identity resolve has not come back yet.
20
27
  */
21
28
  declare const AuthLoading: Component;
22
29
  /**
@@ -552,6 +559,12 @@ interface UseAgentToolEventsResult {
552
559
  declare const useAgentToolEvents: (options: UseAgentToolEventsOptions) => UseAgentToolEventsResult;
553
560
  interface UseAuthResult {
554
561
  setToken: (token: string | null) => void;
562
+ /**
563
+ * The resolved auth state. Branch on this, not on `user === null` — see the
564
+ * contract in `@lunora/client/auth`; `user` is `null` both when signed out
565
+ * and when a held credential's identity could not be resolved.
566
+ */
567
+ status: DeepReadonly<Ref<AuthStatus>>;
555
568
  token: DeepReadonly<Ref<string | null>>;
556
569
  user: DeepReadonly<Ref<User | null>>;
557
570
  }
package/dist/index.d.ts CHANGED
@@ -1,22 +1,29 @@
1
1
  import { Component, Ref, InjectionKey, App, MaybeRefOrGetter, ComputedRef, DeepReadonly, ShallowRef } from 'vue';
2
2
  import { Preloaded, SubscriptionErrorCallback, LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, User, ConnectionStatus, MutationCallOptions, MutatorHandle, SubscriptionError } from '@lunora/client';
3
3
  export type { ArgsOf, FunctionReference, LunoraClient, MutationCallOptions, MutatorHandle, MutatorTransaction, OptimisticLocalStore, OptimisticUpdate, Preloaded, ReturnOf, SubscriptionError, SubscriptionErrorCallback, Unsubscribe, User } from '@lunora/client';
4
+ import { AuthStatus } from '@lunora/client/auth';
4
5
  import { PaginationStatus } from '@lunora/client/pagination';
5
6
  export type { PaginationResult, PaginationStatus } from '@lunora/client/pagination';
6
7
  import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
7
8
  /**
8
- * Render the default slot only after auth has settled and a token + user are
9
- * both present. Hides the slot on first render and when signed out.
9
+ * Render the default slot once authentication has settled in the caller's
10
+ * favour a credential is held and nothing has contradicted it.
11
+ *
12
+ * Gated on {@link isAuthenticatedStatus}, the shared contract in
13
+ * `@lunora/client/auth`, not on `user !== null`: an unreachable identity
14
+ * endpoint leaves `user` at `null` while the credential is still perfectly
15
+ * valid, and requiring a user record there hid the whole app behind
16
+ * `AuthLoading` for the length of an offline session.
10
17
  */
11
18
  declare const Authenticated: Component;
12
19
  /**
13
- * Render the default slot only when auth has settled and no token is present
14
- * (the signed-out state). Hidden while the user is still loading.
20
+ * Render the default slot only when authentication has settled and there is no
21
+ * session no credential, or the server answered that the credential has none.
15
22
  */
16
23
  declare const Unauthenticated: Component;
17
24
  /**
18
- * Render the default slot while authentication is still in progress — token is
19
- * set but `getCurrentUser()` has not yet resolved.
25
+ * Render the default slot while authentication is still in progress — a
26
+ * credential is held and the first identity resolve has not come back yet.
20
27
  */
21
28
  declare const AuthLoading: Component;
22
29
  /**
@@ -552,6 +559,12 @@ interface UseAgentToolEventsResult {
552
559
  declare const useAgentToolEvents: (options: UseAgentToolEventsOptions) => UseAgentToolEventsResult;
553
560
  interface UseAuthResult {
554
561
  setToken: (token: string | null) => void;
562
+ /**
563
+ * The resolved auth state. Branch on this, not on `user === null` — see the
564
+ * contract in `@lunora/client/auth`; `user` is `null` both when signed out
565
+ * and when a held credential's identity could not be resolved.
566
+ */
567
+ status: DeepReadonly<Ref<AuthStatus>>;
555
568
  token: DeepReadonly<Ref<string | null>>;
556
569
  user: DeepReadonly<Ref<User | null>>;
557
570
  }
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{AuthLoading as r,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-Dp-20UXt.mjs";import{hydratePreloaded as a}from"./packem_shared/hydratePreloaded-BpzZkPH4.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{useAction as A}from"./packem_shared/useAction-C4VLsh4M.mjs";import{useAgent as d}from"./packem_shared/useAgent-BLhUb7TW.mjs";import{useAgentChat as h}from"./packem_shared/useAgentChat-D9dYI4Pq.mjs";import{useAgentState as l}from"./packem_shared/useAgentState-eXsZU41P.mjs";import{useAgentToolEvents as Q}from"./packem_shared/useAgentToolEvents-CXb7Vtcn.mjs";import{useAuth as b}from"./packem_shared/useAuth-axmO2A7B.mjs";import{default as E}from"./packem_shared/useConnectionStatus-CCUbKnj2.mjs";import{useFlag as N,useFlags as P}from"./packem_shared/useFlag-xVfWC_c6.mjs";import{useMutation as v}from"./packem_shared/useMutation-D6PkaNaE.mjs";import{useMutator as M}from"./packem_shared/useMutator-CO7nXlRf.mjs";import{useInfiniteQuery as R,usePaginatedQuery as U}from"./packem_shared/useInfiniteQuery-T4qCkGfy.mjs";import{usePresence as J}from"./packem_shared/usePresence-CQ8zOCOI.mjs";import{subscribeToQuery as V,useQuery as Y}from"./packem_shared/subscribeToQuery-G5w094pU.mjs";import{useRateLimit as k}from"./packem_shared/useRateLimit-zoPsflSG.mjs";import{useStream as w}from"./packem_shared/useStream-COVzNdKq.mjs";import{useSubscription as B}from"./packem_shared/useSubscription-ImlDfQGg.mjs";import{useVoiceAgent as G}from"./packem_shared/useVoiceAgent-BEGHhbmX.mjs";export{r as AuthLoading,t as Authenticated,f as LUNORA_INJECTION_KEY,u as Unauthenticated,m as createLunora,a as hydratePreloaded,p as provideLunora,V as subscribeToQuery,A as useAction,d as useAgent,h as useAgentChat,l as useAgentState,Q as useAgentToolEvents,b as useAuth,E as useConnectionStatus,N as useFlag,P as useFlags,R as useInfiniteQuery,x as useLunora,v as useMutation,M as useMutator,U as usePaginatedQuery,J as usePresence,Y as useQuery,k as useRateLimit,w as useStream,B as useSubscription,G as useVoiceAgent};
1
+ import{AuthLoading as r,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-ZXVgXos1.mjs";import{hydratePreloaded as a}from"./packem_shared/hydratePreloaded-CZz988qC.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{useAction as A}from"./packem_shared/useAction-C4VLsh4M.mjs";import{useAgent as d}from"./packem_shared/useAgent-BGmeFHNJ.mjs";import{useAgentChat as h}from"./packem_shared/useAgentChat-DbQR4_7F.mjs";import{useAgentState as l}from"./packem_shared/useAgentState-BJ6wJKcJ.mjs";import{useAgentToolEvents as Q}from"./packem_shared/useAgentToolEvents-Co1SkNFx.mjs";import{useAuth as b}from"./packem_shared/useAuth-QDllAwZL.mjs";import{default as E}from"./packem_shared/useConnectionStatus-CCUbKnj2.mjs";import{useFlag as N,useFlags as P}from"./packem_shared/useFlag-xVfWC_c6.mjs";import{useMutation as v}from"./packem_shared/useMutation-D6PkaNaE.mjs";import{useMutator as M}from"./packem_shared/useMutator-CO7nXlRf.mjs";import{useInfiniteQuery as R,usePaginatedQuery as U}from"./packem_shared/useInfiniteQuery-buEj7Q2V.mjs";import{usePresence as J}from"./packem_shared/usePresence-CQ8zOCOI.mjs";import{subscribeToQuery as V,useQuery as Y}from"./packem_shared/subscribeToQuery-CFDi1S_4.mjs";import{useRateLimit as k}from"./packem_shared/useRateLimit-zoPsflSG.mjs";import{useStream as w}from"./packem_shared/useStream-COVzNdKq.mjs";import{useSubscription as B}from"./packem_shared/useSubscription-BCcPS1Ye.mjs";import{useVoiceAgent as G}from"./packem_shared/useVoiceAgent-BEGHhbmX.mjs";export{r as AuthLoading,t as Authenticated,f as LUNORA_INJECTION_KEY,u as Unauthenticated,m as createLunora,a as hydratePreloaded,p as provideLunora,V as subscribeToQuery,A as useAction,d as useAgent,h as useAgentChat,l as useAgentState,Q as useAgentToolEvents,b as useAuth,E as useConnectionStatus,N as useFlag,P as useFlags,R as useInfiniteQuery,x as useLunora,v as useMutation,M as useMutator,U as usePaginatedQuery,J as usePresence,Y as useQuery,k as useRateLimit,w as useStream,B as useSubscription,G as useVoiceAgent};
@@ -0,0 +1 @@
1
+ import{isAuthenticatedStatus as i,isLoadingStatus as d}from"@lunora/client/auth";import{defineComponent as n,computed as a}from"vue";import{useAuth as o}from"./useAuth-QDllAwZL.mjs";const m=n({name:"Authenticated",setup(s,{slots:t}){const{status:e}=o(),u=a(()=>i(e.value));return()=>u.value?t.default?.():void 0}}),h=n({name:"Unauthenticated",setup(s,{slots:t}){const{status:e}=o(),u=a(()=>e.value==="unauthenticated");return()=>u.value?t.default?.():void 0}}),l=n({name:"AuthLoading",setup(s,{slots:t}){const{status:e}=o(),u=a(()=>d(e.value));return()=>u.value?t.default?.():void 0}});export{l as AuthLoading,m as Authenticated,h as Unauthenticated};
@@ -1 +1 @@
1
- import{useLunora as u}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{subscribeToQuery as a}from"./subscribeToQuery-G5w094pU.mjs";const l=(r,e={})=>{const o=u(),{args:n,functionPath:t,shardKey:c,value:s}=r;return a(o,{__lunoraRef:t},n,{onError:e.onError,seed:s,shardKey:c})};export{l as hydratePreloaded};
1
+ import{useLunora as u}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{subscribeToQuery as a}from"./subscribeToQuery-CFDi1S_4.mjs";const l=(r,e={})=>{const o=u(),{args:n,functionPath:t,shardKey:c,value:s}=r;return a(o,{__lunoraRef:t},n,{onError:e.onError,seed:s,shardKey:c})};export{l as hydratePreloaded};
@@ -0,0 +1 @@
1
+ import{createQuerySubscription as y}from"@lunora/client/query";import{shallowRef as n,watch as f,toValue as i}from"vue";import{i as c}from"./is-browser-BEdfLJHK.mjs";import{s as l}from"./wire-key-DfMHAtqH.mjs";import{useLunora as p}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{o as v}from"./scope-dispose-Mq3k4nvP.mjs";const R=(t,o,s,e={})=>{const r=n(e.seed);if(c()){const a=t.subscribe(o,s,u=>{r.value=u},{onError:e.onError,shardKey:e.shardKey});v(a)}return r},S=(t,o,s={})=>{const e=p(),r=n(void 0);return f(()=>l(i(o)),(a,u,m)=>{if(!c())return;r.value=void 0;const d=y(e,t,i(o),{onData:b=>{r.value=b},onError:s.onError,onReset:()=>{r.value=void 0}},{shardKey:s.shardKey});m(d)},{immediate:!0}),r};export{R as subscribeToQuery,S as useQuery};
@@ -1 +1 @@
1
- import{computed as c,toValue as a}from"vue";import{useMutation as s}from"./useMutation-D6PkaNaE.mjs";import{useSubscription as M}from"./useSubscription-ImlDfQGg.mjs";const R={__lunoraRef:""},T=u=>{const{api:i,cancel:r,onError:d,run:l,runArgs:m,threadKey:e}=u,o=s(l),p=s(r??R),{data:f,error:g}=M(i.agents.agentThread,()=>({key:a(e)}),{onError:d}),n=c(()=>f.value),h=c(()=>n.value?.status),y=async(t,v)=>{await o.mutate({input:t,threadKey:a(e),...m,...v})};return{cancel:async()=>{const t=n.value?.instanceId;r===void 0||t===void 0||await p.mutate({instanceId:t,threadKey:a(e)})},error:g,pending:o.pending,run:y,status:h,thread:n}};export{R as NO_MUTATION_REF,T as useAgent};
1
+ import{computed as c,toValue as a}from"vue";import{useMutation as s}from"./useMutation-D6PkaNaE.mjs";import{useSubscription as M}from"./useSubscription-BCcPS1Ye.mjs";const R={__lunoraRef:""},T=u=>{const{api:i,cancel:r,onError:d,run:l,runArgs:m,threadKey:e}=u,o=s(l),p=s(r??R),{data:f,error:g}=M(i.agents.agentThread,()=>({key:a(e)}),{onError:d}),n=c(()=>f.value),h=c(()=>n.value?.status),y=async(t,v)=>{await o.mutate({input:t,threadKey:a(e),...m,...v})};return{cancel:async()=>{const t=n.value?.instanceId;r===void 0||t===void 0||await p.mutate({instanceId:t,threadKey:a(e)})},error:g,pending:o.pending,run:y,status:h,thread:n}};export{R as NO_MUTATION_REF,T as useAgent};
@@ -1 +1 @@
1
- import{reconcileOptimistic as A,maxSeq as w}from"@lunora/client";import{computed as c,ref as V,watch as $,toValue as a}from"vue";import{NO_MUTATION_REF as z}from"./useAgent-BLhUb7TW.mjs";import{useMutation as m}from"./useMutation-D6PkaNaE.mjs";import{useStream as B}from"./useStream-COVzNdKq.mjs";import{useSubscription as E}from"./useSubscription-ImlDfQGg.mjs";const G={__lunoraRef:""},tt=R=>{const{api:u,cancel:v,limit:p,onError:h,send:k,sendArgs:x,stream:f,threadKey:n}=R,{data:I,error:M}=E(u.agents.agentMessages,()=>{const t=a(n);return p===void 0?{key:t}:{key:t,limit:p}},{onError:h}),{data:S,error:b}=E(u.agents.agentThread,()=>({key:a(n)}),{onError:h}),_=c(()=>M.value??b.value),K=f===void 0?"skip":()=>({key:a(n)}),{chunks:T}=B(f??G,K),j=m(k),q=m(v??z),O=m(u.agents.agentResolveApproval),o=V([]);let g=0;$(()=>a(n),()=>{o.value=[]});const l=c(()=>S.value),C=c(()=>l.value?.status),i=c(()=>I.value??[]),D=c(()=>{const t=i.value,r=A(o.value,t);if(r.length===0)return t;const e=w(t);return[...t,...r.map((s,d)=>({content:s.content,optimistic:!0,role:"user",seq:e+1+d}))]}),N=c(()=>{const t=a(n),r=i.value.filter(e=>e.role==="assistant").length;return T.value.filter(e=>e.kind!=="progress"&&e.threadKey===t&&e.turn>=r).map(e=>e.text).join("")}),F=async(t,r)=>{const e=g;g+=1;const s=w(i.value);o.value=[...A(o.value,i.value),{content:t,id:e,maxDurableSeqAtSend:s}];try{await j.mutate({input:t,threadKey:a(n),...x,...r})}catch(d){throw o.value=o.value.filter(U=>U.id!==e),d}},y=async(t,r,e)=>{const s=l.value?.instanceId;if(s===void 0)throw new Error(`useAgentChat: cannot ${t} — no in-flight run (thread has no instanceId)`);await O.mutate({decision:t,instanceId:s,threadKey:a(n),toolCallId:r,...e===void 0?{}:{note:e}})};return{approve:async(t,r)=>y("approve",t,r),cancel:async()=>{const t=l.value?.instanceId;v===void 0||t===void 0||await q.mutate({instanceId:t,threadKey:a(n)})},error:_,messages:D,reject:async(t,r)=>y("reject",t,r),send:F,status:C,streamingText:N}};export{tt as useAgentChat};
1
+ import{reconcileOptimistic as A,maxSeq as w}from"@lunora/client";import{computed as c,ref as V,watch as $,toValue as a}from"vue";import{NO_MUTATION_REF as z}from"./useAgent-BGmeFHNJ.mjs";import{useMutation as m}from"./useMutation-D6PkaNaE.mjs";import{useStream as B}from"./useStream-COVzNdKq.mjs";import{useSubscription as E}from"./useSubscription-BCcPS1Ye.mjs";const G={__lunoraRef:""},tt=R=>{const{api:u,cancel:v,limit:p,onError:h,send:k,sendArgs:x,stream:f,threadKey:n}=R,{data:I,error:M}=E(u.agents.agentMessages,()=>{const t=a(n);return p===void 0?{key:t}:{key:t,limit:p}},{onError:h}),{data:S,error:b}=E(u.agents.agentThread,()=>({key:a(n)}),{onError:h}),_=c(()=>M.value??b.value),K=f===void 0?"skip":()=>({key:a(n)}),{chunks:T}=B(f??G,K),j=m(k),q=m(v??z),O=m(u.agents.agentResolveApproval),o=V([]);let g=0;$(()=>a(n),()=>{o.value=[]});const l=c(()=>S.value),C=c(()=>l.value?.status),i=c(()=>I.value??[]),D=c(()=>{const t=i.value,r=A(o.value,t);if(r.length===0)return t;const e=w(t);return[...t,...r.map((s,d)=>({content:s.content,optimistic:!0,role:"user",seq:e+1+d}))]}),N=c(()=>{const t=a(n),r=i.value.filter(e=>e.role==="assistant").length;return T.value.filter(e=>e.kind!=="progress"&&e.threadKey===t&&e.turn>=r).map(e=>e.text).join("")}),F=async(t,r)=>{const e=g;g+=1;const s=w(i.value);o.value=[...A(o.value,i.value),{content:t,id:e,maxDurableSeqAtSend:s}];try{await j.mutate({input:t,threadKey:a(n),...x,...r})}catch(d){throw o.value=o.value.filter(U=>U.id!==e),d}},y=async(t,r,e)=>{const s=l.value?.instanceId;if(s===void 0)throw new Error(`useAgentChat: cannot ${t} — no in-flight run (thread has no instanceId)`);await O.mutate({decision:t,instanceId:s,threadKey:a(n),toolCallId:r,...e===void 0?{}:{note:e}})};return{approve:async(t,r)=>y("approve",t,r),cancel:async()=>{const t=l.value?.instanceId;v===void 0||t===void 0||await q.mutate({instanceId:t,threadKey:a(n)})},error:_,messages:D,reject:async(t,r)=>y("reject",t,r),send:F,status:C,streamingText:N}};export{tt as useAgentChat};
@@ -1 +1 @@
1
- import{computed as o,toValue as n}from"vue";import{useSubscription as u}from"./useSubscription-ImlDfQGg.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};
1
+ import{computed as o,toValue as n}from"vue";import{useSubscription as u}from"./useSubscription-BCcPS1Ye.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};
@@ -1 +1 @@
1
- import{computed as v,toValue as e}from"vue";import{useStream as f}from"./useStream-COVzNdKq.mjs";import{useSubscription as C}from"./useSubscription-ImlDfQGg.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};
1
+ import{computed as v,toValue as e}from"vue";import{useStream as f}from"./useStream-COVzNdKq.mjs";import{useSubscription as C}from"./useSubscription-BCcPS1Ye.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 h}from"@lunora/client/auth";import{ref as u,readonly as e,onScopeDispose as m}from"vue";import{i as p}from"./is-browser-BEdfLJHK.mjs";import{useLunora as T}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const U=()=>{const t=T(),o=h(t),s=u(t.getAuthToken()),n=u(o.getUser()),r=u(o.getStatus()),c=()=>{s.value=t.getAuthToken()},i=()=>{n.value=o.getUser(),r.value=o.getStatus()},a=f=>{t.setAuthToken(f)};if(!p())return{setToken:a,status:e(r),token:e(s),user:e(n)};const g=t.onAuthTokenChange(c),k=o.subscribe(i);return m(()=>{g(),k()}),{setToken:a,status:e(r),token:e(s),user:e(n)}};export{U as useAuth};
@@ -0,0 +1 @@
1
+ import{shallowRef as _,watch as N,toValue as m,onScopeDispose as D,computed as K}from"vue";import{initialPages as B,derivePaginationStatus as O,rebalance as E,applyLoadMore as T}from"@lunora/client/pagination";import{i as V}from"./is-browser-BEdfLJHK.mjs";import{s as Q}from"./wire-key-DfMHAtqH.mjs";import{useLunora as W}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const M=(o,s)=>`${o}::${Q(s)}`,R=(o,s)=>({...s,paginationOpts:{cursor:o.lower,endCursor:o.upper,numItems:o.numItems}}),$=(o,s,h)=>{const x=W(),{initialNumItems:L,onError:S,shardKey:P}=h,e=_(B(L)),d=_([]),p=_(void 0);let b;const f=new Map,i=new Map,c=new Set,C=(t,a)=>{d.value=t.map(v=>{const r=M(o.__lunoraRef,R(v,a));return i.get(r)})},z=(t,a,v)=>{const r=l=>M(o.__lunoraRef,R(l,v));for(const l of a){const u=r(l);if(i.has(u))continue;const w=t.find(n=>n.lower===l.lower);if(w){const n=i.get(r(w));n&&i.set(u,n)}}},F=(t,a)=>{const v=new Set;for(const r of t)v.add(M(o.__lunoraRef,R(r,a)));for(const[r,l]of f)v.has(r)||(l(),f.delete(r),i.delete(r),c.delete(r));for(const r of t){const l=R(r,a),u=M(o.__lunoraRef,l);if(f.has(u))continue;c.add(u);const w=x.subscribe(o,l,n=>{i.set(u,n),c.delete(u),p.value=void 0;const g=m(s);if(C(e.value,g),c.size===0){const y=e.value,k=E(y,d.value);k&&(z(y,k,g),e.value=k)}},{onError:n=>{c.delete(u),p.value=n;const g=e.value,y=g.at(-1);g.length>1&&y&&!i.has(u)&&M(o.__lunoraRef,R(y,a))===u&&(e.value=g.slice(0,-1)),S?.(n)},shardKey:P});f.set(u,w)}},I=()=>{for(const t of f.values())t();f.clear(),i.clear(),c.clear()};N(()=>Q(m(s)),()=>{if(!V())return;const t=m(s);I(),e.value=B(L),d.value=[],p.value=void 0,b=void 0,t!=="skip"&&(F(e.value,t),C(e.value,t))},{immediate:!0}),N(()=>e.value,t=>{const a=m(s);b=void 0,a!=="skip"&&(F(t,a),C(t,a))}),D(I);const A=_("LoadingFirstPage");return N([()=>m(s),d],([t,a])=>{A.value=O(t==="skip",a).status},{immediate:!0}),{error:p,loadMore:t=>{const a=m(s);if(a==="skip")return;const{nextCursor:v,status:r}=O(!1,d.value);if(r!=="CanLoadMore"||v===b)return;const l=T(e.value,v,t);if(!l)return;b=v,p.value=void 0;const u=e.value.at(-1),w=l.at(-2);if(u&&w){const n=M(o.__lunoraRef,R(u,a)),g=M(o.__lunoraRef,R(w,a)),y=f.get(n);if(y&&n!==g){const k=i.get(n);k&&i.set(g,k),y(),f.delete(n),i.delete(n),c.delete(n)}}e.value=l},pageResults:d,status:A}},X=(o,s,h)=>{const{error:x,loadMore:L,pageResults:S,status:P}=$(o,s,h),e=K(()=>S.value.flatMap(p=>p?.page??[])),d=K(()=>m(s)!=="skip"&&(P.value==="LoadingFirstPage"||P.value==="LoadingMore"));return{error:x,isLoading:d,loadMore:L,results:e,status:P}},Y=(o,s,h)=>{const{initialNumItems:x}=h,{error:L,loadMore:S,pageResults:P,status:e}=$(o,s,h),d=K(()=>P.value.flatMap(c=>c?[c.page]:[])),p=K(()=>m(s)!=="skip"&&e.value==="LoadingFirstPage"),b=K(()=>e.value==="CanLoadMore"),f=K(()=>m(s)!=="skip"&&e.value==="LoadingMore");return{error:L,fetchNextPage:c=>{S(c??x)},hasNextPage:b,isFetchingNextPage:f,isLoading:p,pages:d,status:e}};export{Y as useInfiniteQuery,X as usePaginatedQuery};
@@ -0,0 +1 @@
1
+ import{createQuerySubscription as c}from"@lunora/client/query";import{LunoraError as l}from"@lunora/errors";import{ref as u,watch as f,toValue as s,onScopeDispose as p}from"vue";import{i as y}from"./is-browser-BEdfLJHK.mjs";import{s as w}from"./wire-key-DfMHAtqH.mjs";import{useLunora as K}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const x=(v,a,t={})=>{const n=K(),o=u(void 0),r=u(void 0);return f(()=>w(s(a)),(h,S,d)=>{const i=s(a);if(o.value=void 0,r.value=void 0,i==="skip"||!y())return;const m=c(n,v,i,{onData:e=>{o.value=e,r.value=void 0},onError:e=>{r.value=e.code===void 0?new Error(e.message):new l(e.code,e.message),o.value=void 0,t.onError?.(e)},onReset:()=>{o.value=void 0}},{shardKey:t.shardKey});d(m)},{immediate:!0}),p(()=>{o.value=void 0,r.value=void 0}),{data:o,error:r}};export{x as useSubscription};
@@ -0,0 +1 @@
1
+ const m=/["\\\u0000-\u001F\uD800-\uDFFF]/,d=r=>m.test(r)?JSON.stringify(r):`"${r}"`,b=r=>{if(r===void 0)return"null";if(typeof r=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key — pass it as a string, or use stableWireKey");if(typeof r=="number"){if(Number.isNaN(r))return"nan";if(r===1/0)return"inf";if(r===-1/0)return"-inf";if(Object.is(r,-0))return"-0"}if(typeof r=="string")return d(r);if(r===null||typeof r!="object")return JSON.stringify(r);if(Array.isArray(r)){let e="[";for(let i=0;i<r.length;i++)i>0&&(e+=","),e+=b(r[i]);return e+"]"}const n=Object.getPrototypeOf(r);if(n!==null&&n!==Object.prototype){const e=r.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${e} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const y=r,s=Object.keys(y).sort();let f="{",t=!0;for(const e of s){const i=y[e];i!==void 0&&(t?t=!1:f+=",",f+=d(e),f+=":",f+=b(i))}return f+"}"},u=r=>{let n="";for(let s=0;s<r.length;s+=32768)n+=String.fromCharCode(...r.subarray(s,s+32768));return btoa(n)},o="$lunora.wire$";const g="__proto__",w=r=>{if(r===null||typeof r!="object")return!1;const n=Object.getPrototypeOf(r);return n===null||n===Object.prototype},c=(r,n=0)=>{if(n>64)throw new RangeError("wire-codec: value nesting exceeds the 64-level limit");if(r===void 0)return[o,"undefined"];if(r===null)return null;const y=typeof r;if(y==="bigint")return[o,"bigint",r.toString()];if(y==="number"){const t=r;return Number.isNaN(t)?[o,"nan"]:t===1/0?[o,"inf"]:t===-1/0?[o,"-inf"]:t}if(y!=="object")return r;if(r instanceof Date)return[o,"date",c(r.getTime(),n+1)];if(r instanceof Error){const t=r,e={};for(const a of Object.keys(t)){if(t[a]===void 0)continue;const p=c(t[a],n+1);a===g?Object.defineProperty(e,a,{configurable:!0,enumerable:!0,value:p,writable:!0}):e[a]=p}const i=[o,"error",String(t.name),String(t.message),e];return t.cause!==void 0&&i.push(c(t.cause,n+1)),i}if(r instanceof URL)return[o,"url",r.href];if(r instanceof Map)return[o,"map",[...r.entries()].map(([t,e])=>[c(t,n+1),c(e,n+1)])];if(r instanceof Set)return[o,"set",[...r].map(t=>c(t,n+1))];if(r instanceof ArrayBuffer)return[o,"bytes",u(new Uint8Array(r)),"ArrayBuffer"];if(ArrayBuffer.isView(r)){const t=r,e=t.constructor.name,i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return e==="Uint8Array"?[o,"bytes",u(i)]:[o,"bytes",u(i),e]}if(Array.isArray(r)){const t=r.map(e=>c(e,n+1));return t.length>0&&t[0]===o?[o,"arr",t]:t}if(!w(r)){const t=r.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 s=r,f={};for(const t of Object.keys(s)){const e=s[t];if(e===void 0)continue;const i=c(e,n+1);t===g?Object.defineProperty(f,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):f[t]=i}return f},O=r=>b(c(r));export{O as s};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/vue",
3
- "version": "1.0.0-alpha.137",
3
+ "version": "1.0.0-alpha.138",
4
4
  "description": "Vue adapter for Lunora — live composables, optimistic mutations, and reactive loaders",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -54,7 +54,7 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@lunora/client": "1.0.0-alpha.101",
57
+ "@lunora/client": "1.0.0-alpha.102",
58
58
  "@lunora/errors": "1.0.0-alpha.36",
59
59
  "@lunora/ratelimit": "1.0.0-alpha.57",
60
60
  "@visulima/storage-client": "1.0.3"
@@ -1 +0,0 @@
1
- import{defineComponent as o,computed as a}from"vue";import{useAuth as l}from"./useAuth-axmO2A7B.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};
@@ -1 +0,0 @@
1
- import{createQuerySubscription as b}from"@lunora/client/query";import{shallowRef as i,watch as f,toValue as l}from"vue";import{i as n}from"./is-browser-BEdfLJHK.mjs";import{useLunora as v}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";import{o as p}from"./scope-dispose-Mq3k4nvP.mjs";const Q=(s,t,o,e={})=>{const r=i(e.seed);if(n()){const a=s.subscribe(t,o,u=>{r.value=u},{onError:e.onError,shardKey:e.shardKey});p(a)}return r},D=(s,t,o={})=>{const e=v(),r=i(void 0);return f(()=>l(t),(a,u,c)=>{if(!n())return;r.value=void 0;const m=b(e,s,a,{onData:d=>{r.value=d},onError:o.onError,onReset:()=>{r.value=void 0}},{shardKey:o.shardKey});c(m)},{immediate:!0}),r};export{Q as subscribeToQuery,D as useQuery};
@@ -1 +0,0 @@
1
- import{getIdentityStore as g}from"@lunora/client/auth";import{ref as u,readonly as o,onScopeDispose as h}from"vue";import{i as m}from"./is-browser-BEdfLJHK.mjs";import{useLunora as p}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const U=()=>{const e=p(),t=g(e),n=u(e.getAuthToken()),s=u(t.getUser()),c=()=>{n.value=e.getAuthToken()},i=()=>{s.value=t.getUser()},r=f=>{e.setAuthToken(f)};if(!m())return{setToken:r,token:o(n),user:o(s)};const k=e.onAuthTokenChange(c),a=t.subscribe(i);return h(()=>{k(),a()}),{setToken:r,token:o(n),user:o(s)}};export{U as useAuth};
@@ -1 +0,0 @@
1
- import{shallowRef as _,watch as v,toValue as O,onScopeDispose as q,computed as E}from"vue";import{initialPages as $,derivePaginationStatus as D,rebalance as z,applyLoadMore as G}from"@lunora/client/pagination";import{i as H}from"./is-browser-BEdfLJHK.mjs";import{useLunora as X}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const Y=/["\\\u0000-\u001F\uD800-\uDFFF]/,T=e=>Y.test(e)?JSON.stringify(e):`"${e}"`,x=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(typeof e=="number"){if(Number.isNaN(e))return"nan";if(e===1/0)return"inf";if(e===-1/0)return"-inf";if(Object.is(e,-0))return"-0"}if(typeof e=="string")return T(e);if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e)){let o="[";for(let n=0;n<e.length;n++)n>0&&(o+=","),o+=x(e[n]);return o+"]"}const r=Object.getPrototypeOf(e);if(r!==null&&r!==Object.prototype){const o=e.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${o} in a stable JSON cache key — only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}const y=e,f=Object.keys(y).sort();let a="{",t=!0;for(const o of f){const n=y[o];n!==void 0&&(t?t=!1:a+=",",a+=T(o),a+=":",a+=x(n))}return a+"}"},F=e=>{let r="";for(let f=0;f<e.length;f+=32768)r+=String.fromCharCode(...e.subarray(f,f+32768));return btoa(r)},d="$lunora.wire$",U=64,J="__proto__",Z=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>U)throw new RangeError(`wire-codec: value nesting exceeds the ${U}-level limit`);if(e===void 0)return[d,"undefined"];if(e===null)return null;const y=typeof e;if(y==="bigint")return[d,"bigint",e.toString()];if(y==="number"){const t=e;return Number.isNaN(t)?[d,"nan"]:t===1/0?[d,"inf"]:t===-1/0?[d,"-inf"]:t}if(y!=="object")return e;if(e instanceof Date)return[d,"date",h(e.getTime(),r+1)];if(e instanceof Error){const t=e,o={};for(const c of Object.keys(t)){if(t[c]===void 0)continue;const b=h(t[c],r+1);c===J?Object.defineProperty(o,c,{configurable:!0,enumerable:!0,value:b,writable:!0}):o[c]=b}const n=[d,"error",String(t.name),String(t.message),o];return t.cause!==void 0&&n.push(h(t.cause,r+1)),n}if(e instanceof URL)return[d,"url",e.href];if(e instanceof Map)return[d,"map",[...e.entries()].map(([t,o])=>[h(t,r+1),h(o,r+1)])];if(e instanceof Set)return[d,"set",[...e].map(t=>h(t,r+1))];if(e instanceof ArrayBuffer)return[d,"bytes",F(new Uint8Array(e)),"ArrayBuffer"];if(ArrayBuffer.isView(e)){const t=e,o=t.constructor.name,n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);return o==="Uint8Array"?[d,"bytes",F(n)]:[d,"bytes",F(n),o]}if(Array.isArray(e)){const t=e.map(o=>h(o,r+1));return t.length>0&&t[0]===d?[d,"arr",t]:t}if(!Z(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,a={};for(const t of Object.keys(f)){const o=f[t];if(o===void 0)continue;const n=h(o,r+1);t===J?Object.defineProperty(a,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):a[t]=n}return a},W=e=>x(h(e)),M=(e,r)=>`${e}::${W(r)}`,R=(e,r)=>({...r,paginationOpts:{cursor:e.lower,endCursor:e.upper,numItems:e.numItems}}),Q=(e,r,y)=>{const f=X(),{initialNumItems:a,onError:t,shardKey:o}=y,n=_($(a)),c=_([]),b=_(void 0);let j;const k=new Map,m=new Map,w=new Set,K=(s,i)=>{c.value=s.map(P=>{const l=M(e.__lunoraRef,R(P,i));return m.get(l)})},V=(s,i,P)=>{const l=g=>M(e.__lunoraRef,R(g,P));for(const g of i){const p=l(g);if(m.has(p))continue;const A=s.find(u=>u.lower===g.lower);if(A){const u=m.get(l(A));u&&m.set(p,u)}}},C=(s,i)=>{const P=new Set;for(const l of s)P.add(M(e.__lunoraRef,R(l,i)));for(const[l,g]of k)P.has(l)||(g(),k.delete(l),m.delete(l),w.delete(l));for(const l of s){const g=R(l,i),p=M(e.__lunoraRef,g);if(k.has(p))continue;w.add(p);const A=f.subscribe(e,g,u=>{m.set(p,u),w.delete(p),b.value=void 0;const S=O(r);if(K(n.value,S),w.size===0){const N=n.value,L=z(N,c.value);L&&(V(N,L,S),n.value=L)}},{onError:u=>{w.delete(p),b.value=u;const S=n.value,N=S.at(-1);S.length>1&&N&&!m.has(p)&&M(e.__lunoraRef,R(N,i))===p&&(n.value=S.slice(0,-1)),t?.(u)},shardKey:o});k.set(p,A)}},I=()=>{for(const s of k.values())s();k.clear(),m.clear(),w.clear()};v(()=>W(O(r)),()=>{if(!H())return;const s=O(r);I(),n.value=$(a),c.value=[],b.value=void 0,j=void 0,s!=="skip"&&(C(n.value,s),K(n.value,s))},{immediate:!0}),v(()=>n.value,s=>{const i=O(r);j=void 0,i!=="skip"&&(C(s,i),K(s,i))}),q(I);const B=_("LoadingFirstPage");return v([()=>O(r),c],([s,i])=>{B.value=D(s==="skip",i).status},{immediate:!0}),{error:b,loadMore:s=>{const i=O(r);if(i==="skip")return;const{nextCursor:P,status:l}=D(!1,c.value);if(l!=="CanLoadMore"||P===j)return;const g=G(n.value,P,s);if(!g)return;j=P,b.value=void 0;const p=n.value.at(-1),A=g.at(-2);if(p&&A){const u=M(e.__lunoraRef,R(p,i)),S=M(e.__lunoraRef,R(A,i)),N=k.get(u);if(N&&u!==S){const L=m.get(u);L&&m.set(S,L),N(),k.delete(u),m.delete(u),w.delete(u)}}n.value=g},pageResults:c,status:B}},se=(e,r,y)=>{const{error:f,loadMore:a,pageResults:t,status:o}=Q(e,r,y),n=E(()=>t.value.flatMap(b=>b?.page??[])),c=E(()=>O(r)!=="skip"&&(o.value==="LoadingFirstPage"||o.value==="LoadingMore"));return{error:f,isLoading:c,loadMore:a,results:n,status:o}},ie=(e,r,y)=>{const{initialNumItems:f}=y,{error:a,loadMore:t,pageResults:o,status:n}=Q(e,r,y),c=E(()=>o.value.flatMap(w=>w?[w.page]:[])),b=E(()=>O(r)!=="skip"&&n.value==="LoadingFirstPage"),j=E(()=>n.value==="CanLoadMore"),k=E(()=>O(r)!=="skip"&&n.value==="LoadingMore");return{error:a,fetchNextPage:w=>{t(w??f)},hasNextPage:j,isFetchingNextPage:k,isLoading:b,pages:c,status:n}};export{ie as useInfiniteQuery,se as usePaginatedQuery};
@@ -1 +0,0 @@
1
- import{createQuerySubscription as m}from"@lunora/client/query";import{LunoraError as l}from"@lunora/errors";import{ref as v,watch as c,toValue as f,onScopeDispose as p}from"vue";import{i as w}from"./is-browser-BEdfLJHK.mjs";import{useLunora as h}from"./LUNORA_INJECTION_KEY-Bct9tKCj.mjs";const k=(t,u,a={})=>{const d=h(),o=v(void 0),r=v(void 0);return c(()=>f(u),(i,y,n)=>{if(o.value=void 0,r.value=void 0,i==="skip"||!w())return;const s=m(d,t,i,{onData:e=>{o.value=e,r.value=void 0},onError:e=>{r.value=e.code===void 0?new Error(e.message):new l(e.code,e.message),o.value=void 0,a.onError?.(e)},onReset:()=>{o.value=void 0}},{shardKey:a.shardKey});n(s)},{immediate:!0}),p(()=>{o.value=void 0,r.value=void 0}),{data:o,error:r}};export{k as useSubscription};