@lunora/react 1.0.0-alpha.243 → 1.0.0-alpha.245
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/dist/index.mjs +1 -1
- package/dist/packem_shared/{useAgent-C2jMXz2-.mjs → useAgent-HdZlRJPr.mjs} +1 -1
- package/dist/packem_shared/{useAgentChat-DiBCl0Rr.mjs → useAgentChat-mUYiftK-.mjs} +1 -1
- package/dist/packem_shared/{useAgentState-CDAO3aLL.mjs → useAgentState-CwsVpvmD.mjs} +1 -1
- package/dist/packem_shared/{useAgentToolEvents-Bb94yV7R.mjs → useAgentToolEvents-Dpc8Oce8.mjs} +1 -1
- package/dist/packem_shared/useSubscription-D9QkGhO3.mjs +2 -0
- package/package.json +3 -3
- package/dist/packem_shared/useSubscription-CwZgOrE4.mjs +0 -2
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-024-XH0I.mjs";import{useAuthState as a}from"./packem_shared/useAuthState-CqN1F2FM.mjs";import{L as f,u as n}from"./packem_shared/lunora-provider-_WqSuvf9.mjs";import{lunoraQueryOptions as m}from"./packem_shared/lunoraQueryOptions-IJB_aFzi.mjs";import{useAction as x}from"./packem_shared/useAction-jJl4KPEw.mjs";import{useAuthSessions as g,useAuthUsers as A,useImpersonate as c,useOrganizations as h,useSignUpInvitations as U}from"./packem_shared/useAuthSessions-jJWdw8Zw.mjs";import{useAgent as S}from"./packem_shared/useAgent-
|
|
2
|
+
import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-024-XH0I.mjs";import{useAuthState as a}from"./packem_shared/useAuthState-CqN1F2FM.mjs";import{L as f,u as n}from"./packem_shared/lunora-provider-_WqSuvf9.mjs";import{lunoraQueryOptions as m}from"./packem_shared/lunoraQueryOptions-IJB_aFzi.mjs";import{useAction as x}from"./packem_shared/useAction-jJl4KPEw.mjs";import{useAuthSessions as g,useAuthUsers as A,useImpersonate as c,useOrganizations as h,useSignUpInvitations as U}from"./packem_shared/useAuthSessions-jJWdw8Zw.mjs";import{useAgent as S}from"./packem_shared/useAgent-HdZlRJPr.mjs";import{useAgentChat as E}from"./packem_shared/useAgentChat-mUYiftK-.mjs";import{useAgentState as L}from"./packem_shared/useAgentState-CwsVpvmD.mjs";import{useAgentToolEvents as R}from"./packem_shared/useAgentToolEvents-Dpc8Oce8.mjs";import{default as F}from"./packem_shared/useAuth-CpGKVRsv.mjs";import{default as M}from"./packem_shared/useClientQuery-DUEUAqPh.mjs";import{default as b}from"./packem_shared/useConnectionStatus-Dtx_OWez.mjs";import{useFlag as O,useFlags as k}from"./packem_shared/useFlag-A7XPHExt.mjs";import{useHttpStream as V}from"./packem_shared/useHttpStream-CzryjxVH.mjs";import{default as q}from"./packem_shared/useInfiniteQuery-D_AG59dX.mjs";import{useLiveTopic as B}from"./packem_shared/useLiveTopic-UYAE2s4R.mjs";import{useMutation as G}from"./packem_shared/useMutation-Bz9uwvGf.mjs";import{useMutator as K}from"./packem_shared/useMutator-BtUd-xEA.mjs";import{usePaginatedQuery as W}from"./packem_shared/usePaginatedQuery-DhQAsxgX.mjs";import{hydratePreloaded as Y,default as Z}from"./packem_shared/hydratePreloaded-qs8nspKB.mjs";import{usePresence as $}from"./packem_shared/usePresence-X5Ax04Cf.mjs";import{default as re}from"./packem_shared/useQuery-Cek_oF7t.mjs";import{useRateLimit as te}from"./packem_shared/useRateLimit-Cckxi8m9.mjs";import{useStream as se}from"./packem_shared/useStream-D8GB__4j.mjs";import{default as pe}from"./packem_shared/useSubscription-D9QkGhO3.mjs";import{default as ne}from"./packem_shared/useSuspenseQuery-CZTk7Kch.mjs";import{useVoiceAgent as me}from"./packem_shared/useVoiceAgent-DAh27XxD.mjs";import{createClientQuery as xe,getErrorCode as le,getRetryAfterMs as ge,isConflictError as Ae,isForbiddenError as ce,isRateLimitedError as he,isUnauthorizedError as Ue}from"@lunora/client";import{RestrictionError as Se,UploadControl as Ce,UploadError as Ee}from"@visulima/storage-client";import{useChunkedRestUpload as Le,useFileInput as Pe,useMultipartUpload as Re,usePasteUpload as ve,useTusUpload as Fe,useUpload as Ie}from"@visulima/storage-client/react";export{o as AuthLoading,t as Authenticated,f as LunoraProvider,Se as RestrictionError,u as Unauthenticated,Ce as UploadControl,Ee as UploadError,xe as createClientQuery,le as getErrorCode,ge as getRetryAfterMs,Y as hydratePreloaded,Ae as isConflictError,ce as isForbiddenError,he as isRateLimitedError,Ue as isUnauthorizedError,m as lunoraQueryOptions,x as useAction,S as useAgent,E as useAgentChat,L as useAgentState,R as useAgentToolEvents,F as useAuth,g as useAuthSessions,a as useAuthState,A as useAuthUsers,Le as useChunkedRestUpload,M as useClientQuery,b as useConnectionStatus,Pe as useFileInput,O as useFlag,k as useFlags,V as useHttpStream,c as useImpersonate,q as useInfiniteQuery,B as useLiveTopic,n as useLunora,Re as useMultipartUpload,G as useMutation,K as useMutator,h as useOrganizations,W as usePaginatedQuery,ve as usePasteUpload,Z as usePreloadedQuery,$ as usePresence,re as useQuery,te as useRateLimit,U as useSignUpInvitations,se as useStream,pe as useSubscription,ne as useSuspenseQuery,Fe as useTusUpload,Ie as useUpload,me as useVoiceAgent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{c as N}from"react/compiler-runtime";import{useMutation as R}from"./useMutation-Bz9uwvGf.mjs";import O from"./useSubscription-
|
|
2
|
+
import{c as N}from"react/compiler-runtime";import{useMutation as R}from"./useMutation-Bz9uwvGf.mjs";import O from"./useSubscription-D9QkGhO3.mjs";const b={__lunoraRef:""},F=_=>{const t=N(20),{api:A,cancel:a,onError:d,run:I,runArgs:f,threadKey:e}=_,s=R(I),T=R(a??b);let c;t[0]!==e?(c={key:e},t[0]=e,t[1]=c):c=t[1];let r;t[2]!==d?(r={onError:d},t[2]=d,t[3]=r):r=t[3];const{data:v,error:p}=O(A.agents.agentThread,c,r),n=v,g=n?.status,o=n?.instanceId,{mutate:m}=s,{mutate:M}=T;let i;t[4]!==f||t[5]!==m||t[6]!==e?(i=async(w,E)=>{await m({input:w,threadKey:e,...f,...E})},t[4]=f,t[5]=m,t[6]=e,t[7]=i):i=t[7];const h=i;let u;t[8]!==M||t[9]!==a||t[10]!==o||t[11]!==e?(u=async()=>{a===void 0||o===void 0||await M({instanceId:o,threadKey:e})},t[8]=M,t[9]=a,t[10]=o,t[11]=e,t[12]=u):u=t[12];const y=u;let l;return t[13]!==y||t[14]!==p||t[15]!==h||t[16]!==s.pending||t[17]!==g||t[18]!==n?(l={cancel:y,error:p,pending:s.pending,run:h,status:g,thread:n},t[13]=y,t[14]=p,t[15]=h,t[16]=s.pending,t[17]=g,t[18]=n,t[19]=l):l=t[19],l};export{F as useAgent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{reconcileOptimistic as M,maxSeq as R}from"@lunora/client";import{useState as Q,useRef as S}from"react";import{useMutation as u}from"./useMutation-Bz9uwvGf.mjs";import{useStream as V}from"./useStream-D8GB__4j.mjs";import A from"./useSubscription-
|
|
2
|
+
import{reconcileOptimistic as M,maxSeq as R}from"@lunora/client";import{useState as Q,useRef as S}from"react";import{useMutation as u}from"./useMutation-Bz9uwvGf.mjs";import{useStream as V}from"./useStream-D8GB__4j.mjs";import A from"./useSubscription-D9QkGhO3.mjs";const W={__lunoraRef:""},X={__lunoraRef:""},Z=[],it=E=>{const{api:a,cancel:m,limit:d,onError:l,send:_,sendArgs:k,stream:p,threadKey:e}=E,x=d===void 0?{key:e}:{key:e,limit:d},{data:w,error:O}=A(a.agents.agentMessages,x,{onError:l}),{data:T,error:b}=A(a.agents.agentThread,{key:e},{onError:l}),I=p===void 0?"skip":{key:e},{chunks:j}=V(p??X,I),q=u(_),C=u(m??W),D=u(a.agents.agentResolveApproval),[K,c]=Q([]),f=S(0),h=S(e);h.current!==e&&(h.current=e,c([]));const g=T,N=g?.status,o=g?.instanceId,s=w??Z,v=M(K,s),F=R(s),G=v.length===0?s:[...s,...v.map((t,n)=>({content:t.content,optimistic:!0,role:"user",seq:F+1+n}))],P=s.filter(t=>t.role==="assistant").length,U=j.filter(t=>t.kind!=="progress"&&t.threadKey===e&&t.turn>=P).map(t=>t.text).join(""),{mutate:Y}=q,{mutate:$}=C,{mutate:z}=D,B=async(t,n)=>{const r=f.current;f.current+=1;const H=R(s);c(i=>[...M(i,s),{content:t,id:r,maxDurableSeqAtSend:H}]);try{await Y({input:t,threadKey:e,...k,...n})}catch(i){throw c(J=>J.filter(L=>L.id!==r)),i}},y=async(t,n,r)=>{if(o===void 0)throw new Error(`useAgentChat: cannot ${t} — no in-flight run (thread has no instanceId)`);await z({decision:t,instanceId:o,threadKey:e,toolCallId:n,...r===void 0?{}:{note:r}})};return{approve:(t,n)=>y("approve",t,n),cancel:async()=>{m===void 0||o===void 0||await $({instanceId:o,threadKey:e})},error:O??b,messages:G,reject:(t,n)=>y("reject",t,n),send:B,status:N,streamingText:U}};export{it as useAgentChat};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{c as o}from"react/compiler-runtime";import d from"./useSubscription-
|
|
2
|
+
import{c as o}from"react/compiler-runtime";import d from"./useSubscription-D9QkGhO3.mjs";const l=t=>{const e=o(5);let r;e[0]!==t.threadKey?(r={key:t.threadKey},e[0]=t.threadKey,e[1]=r):r=e[1];const{data:n,error:s}=d(t.api.agents.agentState,r),c=n;let a;return e[2]!==s||e[3]!==c?(a={error:s,state:c},e[2]=s,e[3]=c,e[4]=a):a=e[4],a};export{l as useAgentState};
|
package/dist/packem_shared/{useAgentToolEvents-Bb94yV7R.mjs → useAgentToolEvents-Dpc8Oce8.mjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{c as y}from"react/compiler-runtime";import{useStream as I}from"./useStream-D8GB__4j.mjs";import N from"./useSubscription-
|
|
2
|
+
import{c as y}from"react/compiler-runtime";import{useStream as I}from"./useStream-D8GB__4j.mjs";import N from"./useSubscription-D9QkGhO3.mjs";const E={__lunoraRef:""},_=[],k=o=>{if(o.role==="assistant"&&o.toolCalls)return o.toolCalls.map(t=>({input:t.input,seq:o.seq,toolCallId:t.id,toolName:t.name,type:"call"}));if(o.role==="tool")return o.status==="awaiting_approval"?[{seq:o.seq,type:"awaiting-approval",...o.toolCallId===void 0?{}:{toolCallId:o.toolCallId},...o.toolName===void 0?{}:{toolName:o.toolName}}]:[{output:o.content,seq:o.seq,type:"result",...o.status==="approved"||o.status==="rejected"?{status:o.status}:{},...o.toolCallId===void 0?{}:{toolCallId:o.toolCallId},...o.toolName===void 0?{}:{toolName:o.toolName}}]},A=o=>{const t=y(12),{api:c,limit:r,stream:n,threadKey:l}=o;let a;t[0]!==r||t[1]!==l?(a=r===void 0?{key:l}:{key:l,limit:r},t[0]=r,t[1]=l,t[2]=a):a=t[2];const f=a,{data:v}=N(c.agents.agentMessages,f);let i;t[3]!==n||t[4]!==l?(i=n===void 0?"skip":{key:l},t[3]=n,t[4]=l,t[5]=i):i=t[5];const C=i,{chunks:p}=I(n??E,C),s=v??_;let e;if(t[6]!==p||t[7]!==s||t[8]!==l){e=s.flatMap(q);for(const d of p)d.kind==="progress"&&d.threadKey===l&&e.push({data:d.data,toolCallId:d.toolCallId,type:"progress"});t[6]=p,t[7]=s,t[8]=l,t[9]=e}else e=t[9];let u;return t[10]!==e?(u={events:e},t[10]=e,t[11]=u):u=t[11],u};function q(o){return k(o)??[]}export{A as useAgentToolEvents};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{c as O}from"react/compiler-runtime";import{createQuerySubscription as j}from"@lunora/client/query";import{LunoraError as L}from"@lunora/errors";import{useState as M,useRef as R,useEffect as E}from"react";import{u as q}from"./lunora-provider-_WqSuvf9.mjs";import{stableWireKey as x}from"@lunora/wire";const A=Object.freeze({data:void 0,error:void 0}),W=(t,n,b)=>{const e=O(20),r=b===void 0?{}:b,o=q(),a=n==="skip",c=a?"skip":x(n),i=JSON.stringify([t.__lunoraRef,c,r.shardKey??""]),[y,p]=M(void 0),v=R(r.onError);let u;e[0]!==r.onError?(u=()=>{v.current=r.onError},e[0]=r.onError,e[1]=u):u=e[1],E(u);let d;e[2]!==n||e[3]!==t?(d={args:n,fn:t},e[2]=n,e[3]=t,e[4]=d):d=e[4];const K=R(d);let l;e[5]!==n||e[6]!==t?(l=()=>{K.current={args:n,fn:t}},e[5]=n,e[6]=t,e[7]=l):l=e[7],E(l);let f;e[8]!==o||e[9]!==i||e[10]!==r.shardKey||e[11]!==a?(f=()=>{if(a)return D;let h=!1;const{args:k,fn:w}=K.current,S=j(o,w,k,{onData:s=>{h||p({client:o,key:i,result:{data:s,error:void 0}})},onError:s=>{const z=Object.assign(s.code===void 0?new Error(s.message):new L(s.code,s.message),s.why===void 0?{}:{why:s.why});v.current?.(s),queueMicrotask(()=>{h||p({client:o,key:i,result:{data:void 0,error:z}})})}},{shardKey:r.shardKey});return()=>{h=!0,S(),p(void 0)}},e[8]=o,e[9]=i,e[10]=r.shardKey,e[11]=a,e[12]=f):f=e[12];let m;return e[13]!==o||e[14]!==t.__lunoraRef||e[15]!==i||e[16]!==r.shardKey||e[17]!==c||e[18]!==a?(m=[o,t.__lunoraRef,i,c,r.shardKey,a],e[13]=o,e[14]=t.__lunoraRef,e[15]=i,e[16]=r.shardKey,e[17]=c,e[18]=a,e[19]=m):m=e[19],E(f,m),y?.client===o&&y.key===i?y.result:A};function D(){}export{W as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/react",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.245",
|
|
4
4
|
"description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@lunora/client": "1.0.0-alpha.
|
|
60
|
+
"@lunora/client": "1.0.0-alpha.232",
|
|
61
61
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
62
|
-
"@lunora/ratelimit": "1.0.0-alpha.
|
|
62
|
+
"@lunora/ratelimit": "1.0.0-alpha.154",
|
|
63
63
|
"@lunora/wire": "1.0.0-alpha.1",
|
|
64
64
|
"@visulima/storage-client": "1.0.9"
|
|
65
65
|
},
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import{c as L}from"react/compiler-runtime";import{createQuerySubscription as M}from"@lunora/client/query";import{LunoraError as O}from"@lunora/errors";import{useState as j,useRef as R,useEffect as K}from"react";import{u as q}from"./lunora-provider-_WqSuvf9.mjs";import{stableWireKey as x}from"@lunora/wire";const A=Object.freeze({data:void 0,error:void 0}),W=(t,s,b)=>{const e=L(20),r=b===void 0?{}:b,o=q(),i=s==="skip",c=i?"skip":x(s),n=JSON.stringify([t.__lunoraRef,c,r.shardKey??""]),[p,y]=j(void 0),h=R(r.onError);let u;e[0]!==r.onError?(u=()=>{h.current=r.onError},e[0]=r.onError,e[1]=u):u=e[1],K(u);let l;e[2]!==s||e[3]!==t?(l={args:s,fn:t},e[2]=s,e[3]=t,e[4]=l):l=e[4];const v=R(l);let d;e[5]!==s||e[6]!==t?(d=()=>{v.current={args:s,fn:t}},e[5]=s,e[6]=t,e[7]=d):d=e[7],K(d);let f;e[8]!==o||e[9]!==n||e[10]!==r.shardKey||e[11]!==i?(f=()=>{if(i)return D;let E=!1;const{args:k,fn:S}=v.current,z=M(o,S,k,{onData:a=>{E||y({client:o,key:n,result:{data:a,error:void 0}})},onError:a=>{const w=a.code===void 0?new Error(a.message):new O(a.code,a.message);h.current?.(a),queueMicrotask(()=>{E||y({client:o,key:n,result:{data:void 0,error:w}})})}},{shardKey:r.shardKey});return()=>{E=!0,z(),y(void 0)}},e[8]=o,e[9]=n,e[10]=r.shardKey,e[11]=i,e[12]=f):f=e[12];let m;return e[13]!==o||e[14]!==t.__lunoraRef||e[15]!==n||e[16]!==r.shardKey||e[17]!==c||e[18]!==i?(m=[o,t.__lunoraRef,n,c,r.shardKey,i],e[13]=o,e[14]=t.__lunoraRef,e[15]=n,e[16]=r.shardKey,e[17]=c,e[18]=i,e[19]=m):m=e[19],K(f,m),p?.client===o&&p.key===n?p.result:A};function D(){}export{W as default};
|