@lunora/solid 1.0.0-alpha.69 → 1.0.0-alpha.70

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
@@ -112,6 +112,10 @@ render(
112
112
  | `createRateLimit` | `useRateLimit` | Client-side rate-limit mirror — `ok`, `disabled`, `retryAfter` as signals. |
113
113
  | `createConnectionStatus` | `useConnectionStatus` | Reactive connection state signal. |
114
114
  | `hydratePreloaded` | `usePreloadedQuery` | Seed a query synchronously from an SSR `Preloaded` token, then go live. |
115
+ | `createAgentToolEvents` | `useAgentToolEvents` | One agent thread's tool lifecycle as an `Accessor` of discriminated events. |
116
+ | `createVoiceAgent` | `useVoiceAgent` | Full-duplex voice call — accessors for status/transcript/level + call controls. |
117
+
118
+ `createVoiceAgent` opens nothing until `startCall()` — that call is what requests the microphone, so it must run from a user gesture. `endCall()` releases the socket, the mic tracks and the Web Audio graph, and `onCleanup` runs it for you when the owning root is disposed.
115
119
 
116
120
  ## Related
117
121
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, User, ConnectionStatus, MutationCallOptions, MutatorHandle, Preloaded } from '@lunora/client';
2
- export type { ArgsOf, FunctionReference, MutatorHandle, MutatorTransaction, OptimisticUpdate, Preloaded, ReturnOf, Unsubscribe } from '@lunora/client';
1
+ import { LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, User, ConnectionStatus, MutationCallOptions, MutatorHandle, SubscriptionErrorCallback, Preloaded } from '@lunora/client';
2
+ export type { ArgsOf, FunctionReference, MutatorHandle, MutatorTransaction, OptimisticUpdate, Preloaded, ReturnOf, SubscriptionError, SubscriptionErrorCallback, Unsubscribe } from '@lunora/client';
3
3
  import { Context, Accessor } from 'solid-js';
4
4
  import { PaginationStatus } from '@lunora/client/pagination';
5
5
  import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
@@ -768,6 +768,12 @@ interface CreatePresenceResult<L extends ListPresentReference> {
768
768
  }
769
769
  declare const createPresence: <H extends HeartbeatReference, L extends ListPresentReference>(roomId: string, options: CreatePresenceOptions<H, L>) => CreatePresenceResult<L>;
770
770
  interface CreateQueryOptions {
771
+ /**
772
+ * Called when the server pushes a subscription-scoped error (an RLS denial, a
773
+ * query that starts failing server-side). Without a handler such an error has
774
+ * nowhere to go and the accessor simply freezes at its last good value.
775
+ */
776
+ onError?: SubscriptionErrorCallback;
771
777
  /** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
772
778
  shardKey?: string;
773
779
  }
@@ -788,6 +794,10 @@ interface CreateQueryOptions {
788
794
  * const messages = createQuery(api.messages.list, () => ({ channelId: channelId() }));
789
795
  * return <For each={messages()?.messages}>{(m) => <li>{m.text}</li>}</For>;
790
796
  * ```
797
+ *
798
+ * Pass `onError` to surface a subscription-scoped error the server pushes (an RLS
799
+ * denial, a query that starts failing server-side). Without it such an error is
800
+ * dropped and the accessor just freezes at its last good value.
791
801
  */
792
802
  declare const createQuery: <F extends FunctionReference>(function_: F, args: (ArgsOf<F> | "skip") | Accessor<ArgsOf<F> | "skip">, options?: CreateQueryOptions) => Accessor<ReturnOf<F> | undefined>;
793
803
  interface CreateRateLimitOptions {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, User, ConnectionStatus, MutationCallOptions, MutatorHandle, Preloaded } from '@lunora/client';
2
- export type { ArgsOf, FunctionReference, MutatorHandle, MutatorTransaction, OptimisticUpdate, Preloaded, ReturnOf, Unsubscribe } from '@lunora/client';
1
+ import { LunoraClient, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, User, ConnectionStatus, MutationCallOptions, MutatorHandle, SubscriptionErrorCallback, Preloaded } from '@lunora/client';
2
+ export type { ArgsOf, FunctionReference, MutatorHandle, MutatorTransaction, OptimisticUpdate, Preloaded, ReturnOf, SubscriptionError, SubscriptionErrorCallback, Unsubscribe } from '@lunora/client';
3
3
  import { Context, Accessor } from 'solid-js';
4
4
  import { PaginationStatus } from '@lunora/client/pagination';
5
5
  import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
@@ -768,6 +768,12 @@ interface CreatePresenceResult<L extends ListPresentReference> {
768
768
  }
769
769
  declare const createPresence: <H extends HeartbeatReference, L extends ListPresentReference>(roomId: string, options: CreatePresenceOptions<H, L>) => CreatePresenceResult<L>;
770
770
  interface CreateQueryOptions {
771
+ /**
772
+ * Called when the server pushes a subscription-scoped error (an RLS denial, a
773
+ * query that starts failing server-side). Without a handler such an error has
774
+ * nowhere to go and the accessor simply freezes at its last good value.
775
+ */
776
+ onError?: SubscriptionErrorCallback;
771
777
  /** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
772
778
  shardKey?: string;
773
779
  }
@@ -788,6 +794,10 @@ interface CreateQueryOptions {
788
794
  * const messages = createQuery(api.messages.list, () => ({ channelId: channelId() }));
789
795
  * return <For each={messages()?.messages}>{(m) => <li>{m.text}</li>}</For>;
790
796
  * ```
797
+ *
798
+ * Pass `onError` to surface a subscription-scoped error the server pushes (an RLS
799
+ * denial, a query that starts failing server-side). Without it such an error is
800
+ * dropped and the accessor just freezes at its last good value.
791
801
  */
792
802
  declare const createQuery: <F extends FunctionReference>(function_: F, args: (ArgsOf<F> | "skip") | Accessor<ArgsOf<F> | "skip">, options?: CreateQueryOptions) => Accessor<ReturnOf<F> | undefined>;
793
803
  interface CreateRateLimitOptions {
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{LunoraContext as r,useLunora as o}from"./packem_shared/LunoraContext-dPcjtn6R.mjs";import{createAction as c,createActionForClient as n}from"./packem_shared/createAction-M4s8XBXV.mjs";import{createAgent as m}from"./packem_shared/createAgent-DTUKko5X.mjs";import{createAgentChat as x}from"./packem_shared/createAgentChat-BjVMwDVY.mjs";import{createAgentState as u}from"./packem_shared/createAgentState-DIknFZyn.mjs";import{createAgentToolEvents as A}from"./packem_shared/createAgentToolEvents-BZDqkzK6.mjs";import{AuthLoading as l,Authenticated as s,Unauthenticated as h,createAuth as C}from"./packem_shared/AuthLoading-6vueEnV0.mjs";import{default as y}from"./packem_shared/createConnectionStatus-BnlXYWeE.mjs";import{createFlag as P,createFlags as S}from"./packem_shared/createFlag-CmR5zt3p.mjs";import{createMutation as Q,createMutationForClient as v}from"./packem_shared/createMutation-DcSsIbGF.mjs";import{createMutator as E}from"./packem_shared/createMutator-q9cMjGKv.mjs";import{createInfiniteQuery as R,createPaginatedQuery as T}from"./packem_shared/createInfiniteQuery-Chl4xGx9.mjs";import{createPresence as V}from"./packem_shared/createPresence-Da_DdL7L.mjs";import{createQuery as k}from"./packem_shared/createQuery-DnfKuyeU.mjs";import{createRateLimit as w}from"./packem_shared/createRateLimit-CIVWrD5H.mjs";import{createStream as B}from"./packem_shared/createStream-B10b3ijV.mjs";import{createSubscription as G}from"./packem_shared/createSubscription-D9e8lT1C.mjs";import{createVoiceAgent as J}from"./packem_shared/createVoiceAgent-BjL6DH05.mjs";import{default as N}from"./packem_shared/hydratePreloaded-CnJNitir.mjs";import{LunoraProvider as W}from"./packem_shared/LunoraProvider-BKWckcDR.mjs";export{l as AuthLoading,s as Authenticated,r as LunoraContext,W as LunoraProvider,h as Unauthenticated,c as createAction,n as createActionForClient,m as createAgent,x as createAgentChat,u as createAgentState,A as createAgentToolEvents,C as createAuth,y as createConnectionStatus,P as createFlag,S as createFlags,R as createInfiniteQuery,Q as createMutation,v as createMutationForClient,E as createMutator,T as createPaginatedQuery,V as createPresence,k as createQuery,w as createRateLimit,B as createStream,G as createSubscription,J as createVoiceAgent,N as hydratePreloaded,o as useLunora};
1
+ import{LunoraContext as r,useLunora as o}from"./packem_shared/LunoraContext-dPcjtn6R.mjs";import{createAction as c,createActionForClient as n}from"./packem_shared/createAction-M4s8XBXV.mjs";import{createAgent as m}from"./packem_shared/createAgent-DTUKko5X.mjs";import{createAgentChat as x}from"./packem_shared/createAgentChat-Bo021xHU.mjs";import{createAgentState as u}from"./packem_shared/createAgentState-DIknFZyn.mjs";import{createAgentToolEvents as A}from"./packem_shared/createAgentToolEvents-BZDqkzK6.mjs";import{AuthLoading as l,Authenticated as s,Unauthenticated as h,createAuth as C}from"./packem_shared/AuthLoading-6vueEnV0.mjs";import{default as y}from"./packem_shared/createConnectionStatus-BnlXYWeE.mjs";import{createFlag as P,createFlags as S}from"./packem_shared/createFlag-DB3YHQrF.mjs";import{createMutation as Q,createMutationForClient as v}from"./packem_shared/createMutation-DcSsIbGF.mjs";import{createMutator as E}from"./packem_shared/createMutator-q9cMjGKv.mjs";import{createInfiniteQuery as R,createPaginatedQuery as T}from"./packem_shared/createInfiniteQuery-Chl4xGx9.mjs";import{createPresence as V}from"./packem_shared/createPresence-Da_DdL7L.mjs";import{createQuery as k}from"./packem_shared/createQuery-DMcnUyOD.mjs";import{createRateLimit as w}from"./packem_shared/createRateLimit-CIVWrD5H.mjs";import{createStream as B}from"./packem_shared/createStream-B10b3ijV.mjs";import{createSubscription as G}from"./packem_shared/createSubscription-D9e8lT1C.mjs";import{createVoiceAgent as J}from"./packem_shared/createVoiceAgent-BjL6DH05.mjs";import{default as N}from"./packem_shared/hydratePreloaded-CnJNitir.mjs";import{LunoraProvider as W}from"./packem_shared/LunoraProvider-BKWckcDR.mjs";export{l as AuthLoading,s as Authenticated,r as LunoraContext,W as LunoraProvider,h as Unauthenticated,c as createAction,n as createActionForClient,m as createAgent,x as createAgentChat,u as createAgentState,A as createAgentToolEvents,C as createAuth,y as createConnectionStatus,P as createFlag,S as createFlags,R as createInfiniteQuery,Q as createMutation,v as createMutationForClient,E as createMutator,T as createPaginatedQuery,V as createPresence,k as createQuery,w as createRateLimit,B as createStream,G as createSubscription,J as createVoiceAgent,N as hydratePreloaded,o as useLunora};
@@ -0,0 +1 @@
1
+ import{reconcileOptimistic as A,maxSeq as M}from"@lunora/client";import{createSignal as F,createMemo as c}from"solid-js";import{resolveMaybe as a,NO_MUTATION_REF as U}from"./createAgent-DTUKko5X.mjs";import{createMutation as p}from"./createMutation-DcSsIbGF.mjs";import{createStream as $}from"./createStream-B10b3ijV.mjs";import{createSubscription as k}from"./createSubscription-D9e8lT1C.mjs";import{t as z}from"./solid-compat-ByG5HD_F.mjs";const B={__lunoraRef:""},Z=R=>{const{api:m,cancel:u,limit:f,send:S,sendArgs:w,stream:h,threadKey:r}=R,{data:x}=k(m.agents.agentMessages,()=>{const t=a(r);return f===void 0?{key:t}:{key:t,limit:f}}),{data:I}=k(m.agents.agentThread,()=>({key:a(r)})),b=h===void 0?"skip":()=>({key:a(r)}),{chunks:_}=$(h??B,b),E=p(S),K=p(u??U),O=p(m.agents.agentResolveApproval),[g,d]=F([]);let y=0;z(()=>a(r),()=>{g().length>0&&d([])});const l=c(()=>I()),T=c(()=>l()?.status),i=c(()=>x()??[]),j=c(()=>{const t=i(),n=A(g(),t);if(n.length===0)return t;const e=M(t);return[...t,...n.map((s,o)=>({content:s.content,optimistic:!0,role:"user",seq:e+1+o}))]}),q=c(()=>{const t=a(r),n=i().filter(e=>e.role==="assistant").length;return _().filter(e=>e.kind!=="progress"&&e.threadKey===t&&e.turn>=n).map(e=>e.text).join("")}),C=async(t,n)=>{const e=y;y+=1;const s=M(i());d(o=>[...A(o,i()),{content:t,id:e,maxDurableSeqAtSend:s}]);try{await E.mutate({input:t,threadKey:a(r),...w,...n})}catch(o){throw d(D=>D.filter(N=>N.id!==e)),o}},v=async(t,n,e)=>{const s=l()?.instanceId;if(s===void 0)throw new Error(`createAgentChat: cannot ${t} — no in-flight run (thread has no instanceId)`);await O.mutate({decision:t,instanceId:s,threadKey:a(r),toolCallId:n,...e===void 0?{}:{note:e}})};return{approve:async(t,n)=>v("approve",t,n),cancel:async()=>{const t=l()?.instanceId;u===void 0||t===void 0||await K.mutate({instanceId:t,threadKey:a(r)})},messages:j,reject:async(t,n)=>v("reject",t,n),send:C,status:T,streamingText:q}};export{Z as createAgentChat};
@@ -0,0 +1 @@
1
+ import{createSignal as f}from"solid-js";import{s as l}from"./stable-key-B_BlboiY.mjs";import{useLunora as b}from"./LunoraContext-dPcjtn6R.mjs";import{resolveMaybe as o}from"./createAgent-DTUKko5X.mjs";import{t as m}from"./solid-compat-ByG5HD_F.mjs";const v="__lunora_flags__:eval",x=e=>{const t=typeof e;return t==="boolean"||t==="number"||t==="string"?t:"object"},F={__lunoraRef:v},p=(e,t,r)=>{try{return e.subscribe(F,{context:t.context,default:t.default,key:t.key,type:x(t.default)},c=>{r(c)},{onError:()=>{r(t.default)}})}catch{return()=>{}}},d=e=>e===void 0?"":l(e),S=(e,t,r)=>{const c=b(),[s,u]=f(t);return m(()=>`${o(e)} ${d(o(r))}`,()=>{const i=o(e),a=o(r);return u(()=>t),p(c,{context:a,default:t,key:i},n=>{u(()=>n)})}),s},g=(e,t)=>{const r=b(),[c,s]=f(e),u=l(e);return m(()=>`${u} ${d(o(t))}`,()=>{const i=o(t);s(()=>e);const a=[];for(const[n,y]of Object.entries(e))a.push(p(r,{context:i,default:y,key:n},_=>{s(k=>({...k,[n]:_}))}));return()=>{for(const n of a)n()}}),c};export{S as createFlag,g as createFlags};
@@ -0,0 +1 @@
1
+ import{createQuerySubscription as f}from"@lunora/client/query";import{createSignal as m}from"solid-js";import{useLunora as p}from"./LunoraContext-dPcjtn6R.mjs";import{t as l}from"./solid-compat-ByG5HD_F.mjs";const Q=(o,r,t={})=>{const n=p(),{onError:s,shardKey:c}=t,[u,e]=m(void 0);return l(()=>typeof r=="function"?r():r,i=>f(n,o,i,{onData:a=>{e(()=>a)},onError:s,onReset:()=>{e(()=>{})}},{shardKey:c})),u};export{Q as createQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/solid",
3
- "version": "1.0.0-alpha.69",
3
+ "version": "1.0.0-alpha.70",
4
4
  "description": "SolidJS adapter for Lunora — live queries, optimistic mutations, and reactive loaders",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -54,9 +54,9 @@
54
54
  "access": "public"
55
55
  },
56
56
  "dependencies": {
57
- "@lunora/client": "1.0.0-alpha.66",
57
+ "@lunora/client": "1.0.0-alpha.67",
58
58
  "@lunora/errors": "1.0.0-alpha.26",
59
- "@lunora/ratelimit": "1.0.0-alpha.30",
59
+ "@lunora/ratelimit": "1.0.0-alpha.31",
60
60
  "@visulima/storage-client": "1.0.2"
61
61
  },
62
62
  "peerDependencies": {
@@ -1 +0,0 @@
1
- import{reconcileOptimistic as v,maxSeq as A}from"@lunora/client";import{createSignal as F,createMemo as c}from"solid-js";import{resolveMaybe as a,NO_MUTATION_REF as U}from"./createAgent-DTUKko5X.mjs";import{createMutation as u}from"./createMutation-DcSsIbGF.mjs";import{createStream as $}from"./createStream-B10b3ijV.mjs";import{createSubscription as M}from"./createSubscription-D9e8lT1C.mjs";const z={__lunoraRef:""},X=R=>{const{api:m,cancel:l,limit:p,send:S,sendArgs:k,stream:h,threadKey:r}=R,{data:w}=M(m.agents.agentMessages,()=>{const t=a(r);return p===void 0?{key:t}:{key:t,limit:p}}),{data:x}=M(m.agents.agentThread,()=>({key:a(r)})),I=h===void 0?"skip":()=>({key:a(r)}),{chunks:b}=$(h??z,I),_=u(S),K=u(l??U),O=u(m.agents.agentResolveApproval),[T,g]=F([]);let f=0;const d=c(()=>x()),j=c(()=>d()?.status),i=c(()=>w()??[]),q=c(()=>{const t=i(),n=v(T(),t);if(n.length===0)return t;const e=A(t);return[...t,...n.map((s,o)=>({content:s.content,optimistic:!0,role:"user",seq:e+1+o}))]}),E=c(()=>{const t=a(r),n=i().filter(e=>e.role==="assistant").length;return b().filter(e=>e.kind!=="progress"&&e.threadKey===t&&e.turn>=n).map(e=>e.text).join("")}),C=async(t,n)=>{const e=f;f+=1;const s=A(i());g(o=>[...v(o,i()),{content:t,id:e,maxDurableSeqAtSend:s}]);try{await _.mutate({input:t,threadKey:a(r),...k,...n})}catch(o){throw g(D=>D.filter(N=>N.id!==e)),o}},y=async(t,n,e)=>{const s=d()?.instanceId;if(s===void 0)throw new Error(`createAgentChat: cannot ${t} — no in-flight run (thread has no instanceId)`);await O.mutate({decision:t,instanceId:s,threadKey:a(r),toolCallId:n,...e===void 0?{}:{note:e}})};return{approve:async(t,n)=>y("approve",t,n),cancel:async()=>{const t=d()?.instanceId;l===void 0||t===void 0||await K.mutate({instanceId:t,threadKey:a(r)})},messages:q,reject:async(t,n)=>y("reject",t,n),send:C,status:j,streamingText:E}};export{X as createAgentChat};
@@ -1 +0,0 @@
1
- import{createSignal as l}from"solid-js";import{s as m}from"./stable-key-B_BlboiY.mjs";import{useLunora as p}from"./LunoraContext-dPcjtn6R.mjs";import{resolveMaybe as n}from"./createAgent-DTUKko5X.mjs";import{t as y}from"./solid-compat-ByG5HD_F.mjs";const $="__lunora_flags__:eval",_=t=>{const e=typeof t;return e==="boolean"||e==="number"||e==="string"?e:"object"},v={__lunoraRef:$},d=t=>t===void 0?"":m(t),F=(t,e,s)=>{const a=p(),c=_(e),[b,u]=l(e);return y(()=>`${n(t)} ${d(n(s))}`,()=>{const i=n(t),r=n(s);u(()=>e);let o;try{o=a.subscribe(v,{context:r,default:e,key:i,type:c},f=>{u(()=>f)})}catch{return}return o}),b},L=(t,e)=>{const s=p(),[a,c]=l(t),b=m(t);return y(()=>`${b} ${d(n(e))}`,()=>{const u=n(e);c(()=>t);const i=[];for(const[r,o]of Object.entries(t))try{i.push(s.subscribe(v,{context:u,default:o,key:r,type:_(o)},f=>{c(g=>({...g,[r]:f}))}))}catch{}return()=>{for(const r of i)r()}}),a};export{F as createFlag,L as createFlags};
@@ -1 +0,0 @@
1
- import{createQuerySubscription as a}from"@lunora/client/query";import{createSignal as f}from"solid-js";import{useLunora as m}from"./LunoraContext-dPcjtn6R.mjs";import{t as p}from"./solid-compat-ByG5HD_F.mjs";const Q=(t,e,o={})=>{const n=m(),{shardKey:s}=o,[c,r]=f(void 0);return p(()=>typeof e=="function"?e():e,u=>a(n,t,u,{onData:i=>{r(()=>i)},onReset:()=>{r(()=>{})}},{shardKey:s})),c};export{Q as createQuery};