@lunora/solid 1.0.0-alpha.7 → 1.0.0-alpha.71

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 (44) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +8 -0
  3. package/dist/index.d.mts +931 -235
  4. package/dist/index.d.ts +931 -235
  5. package/dist/index.mjs +1 -13
  6. package/dist/packem_shared/AuthLoading-6vueEnV0.mjs +1 -0
  7. package/dist/packem_shared/LunoraContext-dPcjtn6R.mjs +1 -0
  8. package/dist/packem_shared/LunoraProvider-BKWckcDR.mjs +1 -0
  9. package/dist/packem_shared/createAction-M4s8XBXV.mjs +1 -0
  10. package/dist/packem_shared/createAgent-DTUKko5X.mjs +1 -0
  11. package/dist/packem_shared/createAgentChat-Bo021xHU.mjs +1 -0
  12. package/dist/packem_shared/createAgentState-DIknFZyn.mjs +1 -0
  13. package/dist/packem_shared/createAgentToolEvents-BZDqkzK6.mjs +1 -0
  14. package/dist/packem_shared/createConnectionStatus-BnlXYWeE.mjs +1 -0
  15. package/dist/packem_shared/createFlag-CkY9V_ou.mjs +1 -0
  16. package/dist/packem_shared/createInfiniteQuery-DLpKN_aQ.mjs +1 -0
  17. package/dist/packem_shared/createMutation-DcSsIbGF.mjs +1 -0
  18. package/dist/packem_shared/createMutator-q9cMjGKv.mjs +1 -0
  19. package/dist/packem_shared/createPresence-Da_DdL7L.mjs +1 -0
  20. package/dist/packem_shared/createQuery-DMcnUyOD.mjs +1 -0
  21. package/dist/packem_shared/createRateLimit-CIVWrD5H.mjs +1 -0
  22. package/dist/packem_shared/createStream-B10b3ijV.mjs +1 -0
  23. package/dist/packem_shared/createSubscription-D9e8lT1C.mjs +1 -0
  24. package/dist/packem_shared/createVoiceAgent-BjL6DH05.mjs +1 -0
  25. package/dist/packem_shared/hydratePreloaded-CnJNitir.mjs +1 -0
  26. package/dist/packem_shared/solid-compat-ByG5HD_F.mjs +1 -0
  27. package/dist/server.mjs +1 -1
  28. package/dist/upload.d.mts +2 -0
  29. package/dist/upload.d.ts +2 -0
  30. package/dist/upload.mjs +1 -0
  31. package/package.json +10 -4
  32. package/dist/packem_shared/AuthLoading-RMT5Q_eE.mjs +0 -73
  33. package/dist/packem_shared/LunoraContext-C9SpKj54.mjs +0 -12
  34. package/dist/packem_shared/LunoraProvider-B5BJFk3K.mjs +0 -17
  35. package/dist/packem_shared/createConnectionStatus-D8GPatZX.mjs +0 -14
  36. package/dist/packem_shared/createFlag-BDunYuaH.mjs +0 -106
  37. package/dist/packem_shared/createInfiniteQuery-DyMvQ2Qy.mjs +0 -196
  38. package/dist/packem_shared/createMutation-C7BxzO0y.mjs +0 -36
  39. package/dist/packem_shared/createMutator-foSnPJPt.mjs +0 -24
  40. package/dist/packem_shared/createPresence-DiAak1Jw.mjs +0 -78
  41. package/dist/packem_shared/createQuery-D8mdHfyQ.mjs +0 -28
  42. package/dist/packem_shared/createRateLimit-BA2f8XyF.mjs +0 -76
  43. package/dist/packem_shared/createSubscription-BM2fw8hw.mjs +0 -39
  44. package/dist/packem_shared/hydratePreloaded-CaT1kDBH.mjs +0 -25
package/dist/index.d.ts CHANGED
@@ -1,104 +1,587 @@
1
- import { LunoraClient, User, ConnectionStatus, FunctionReference, ArgsOf, MutationCallOptions, ReturnOf, MutatorHandle, Preloaded } from '@lunora/client';
2
- export type { ArgsOf, FunctionReference, MutatorHandle, MutatorTransaction, OptimisticUpdate, Preloaded, ReturnOf, Unsubscribe } from '@lunora/client';
3
- import { Context, JSX, Accessor } from 'solid-js';
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
+ import { Context, Accessor } from 'solid-js';
4
4
  import { PaginationStatus } from '@lunora/client/pagination';
5
5
  import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
6
6
  /**
7
- * Solid context carrying the framework-neutral {@link LunoraClient}. Every
8
- * reactive primitive in this adapter (`createQuery`, `createMutation`,
9
- * `hydratePreloaded`) reads the client from here, so a single
10
- * `<LunoraProvider client={…}>` at the root of the tree wires the whole app.
11
- *
12
- * Defaults to `undefined` so {@link useLunora} can throw a helpful error when a
13
- * primitive is used outside a provider rather than dereferencing it.
14
- */
7
+ * Solid context carrying the framework-neutral {@link LunoraClient}. Every
8
+ * reactive primitive in this adapter (`createQuery`, `createMutation`,
9
+ * `hydratePreloaded`) reads the client from here, so a single
10
+ * `<LunoraProvider client={…}>` at the root of the tree wires the whole app.
11
+ *
12
+ * Defaults to `undefined` so {@link useLunora} can throw a helpful error when a
13
+ * primitive is used outside a provider rather than dereferencing it. Solid 2
14
+ * refuses to hand back an `undefined` default at all — see {@link useLunora}.
15
+ */
15
16
  declare const LunoraContext: Context<LunoraClient | undefined>;
16
17
  /**
17
- * Read the {@link LunoraClient} from the nearest `&lt;LunoraProvider>`.
18
- *
19
- * Throws when called outside a provider — the client is required to open the
20
- * HTTP/WS transport, so there is no sensible fallback. The React adapter's
21
- * `useLunora` has the same contract.
22
- */
18
+ * Read the {@link LunoraClient} from the nearest `<LunoraProvider>`.
19
+ *
20
+ * Throws when called outside a provider — the client is required to open the
21
+ * HTTP/WS transport, so there is no sensible fallback. The React adapter's
22
+ * `useLunora` has the same contract.
23
+ */
23
24
  declare const useLunora: () => LunoraClient;
25
+ interface ActionHandle<F extends FunctionReference> {
26
+ /** Invoke the action. Resolves with the server result; rejects on failure. */
27
+ call: (args: ArgsOf<F>, options?: ActionCallOptions) => Promise<ReturnOf<F>>;
28
+ /** The latest invocation's resolved value, or `undefined` before the first success. */
29
+ data: Accessor<ReturnOf<F> | undefined>;
30
+ /** The latest invocation's error, or `undefined`. */
31
+ error: Accessor<Error | undefined>;
32
+ /** `true` while any invocation from this handle is in flight (ref-counted, so overlapping calls compose). */
33
+ pending: Accessor<boolean>;
34
+ /** Clear `data`/`error` back to idle. */
35
+ reset: () => void;
36
+ }
37
+ /**
38
+ * The transport surface {@link createAction} actually needs — just
39
+ * `client.action`. Narrowed so the primitive can be exercised against a stub in
40
+ * tests without constructing a full `LunoraClient`.
41
+ */
42
+ interface ActionClient<F extends FunctionReference> {
43
+ action: (function_: F, args: ArgsOf<F>, options?: ActionCallOptions) => Promise<ReturnOf<F>>;
44
+ }
45
+ /**
46
+ * Build an action handle bound to an explicit client. Internal seam used by the
47
+ * provider-bound {@link createAction}; exported for tests that inject a stub.
48
+ * The ref-counted pending + error-normalize orchestration is the shared
49
+ * `createCallRunner` from `@lunora/client`; only the reactive sinks (Solid
50
+ * signals) are adapter-specific.
51
+ *
52
+ * `data`/`error` follow the adapter-wide contract: both track the LATEST
53
+ * invocation (an earlier call settling later cannot clobber a newer one), a
54
+ * success clears `error`, and a failure leaves the previous `data` in place.
55
+ * `reset()` clears both; it does not cancel an in-flight call.
56
+ */
57
+ declare const createActionForClient: <F extends FunctionReference>(client: ActionClient<F>, function_: F) => ActionHandle<F>;
58
+ /**
59
+ * Returns a reactive handle `{ call, pending, data, error, reset }` for the
60
+ * given action reference, bound to the `LunoraClient` from the nearest
61
+ * `<LunoraProvider>`.
62
+ *
63
+ * **Narrower than `createMutation` on purpose:** no `optimistic` /
64
+ * `optimisticUpdate` call options. An optimistic update patches the subscription
65
+ * cache on the assumption a write will land; an action is not a write — it runs
66
+ * in the Worker, may call a third party, and has no declared effect on any
67
+ * query. Offering the option would imply a rollback guarantee nothing can
68
+ * honour.
69
+ */
70
+ declare const createAction: <F extends FunctionReference>(function_: F) => ActionHandle<F>;
71
+ /**
72
+ * The lifecycle status stored on an agent thread. Client-safe mirror of
73
+ * `@lunora/agent`'s `AgentThreadStatus` — re-declared here (rather than imported)
74
+ * so this Solid entry never pulls in the server-only `@lunora/agent` module graph
75
+ * (the adapter stays Solid + `@lunora/client` only). Keep in sync with
76
+ * `packages/agent/src/types.ts`.
77
+ */
78
+ type AgentThreadStatus = "awaiting_input" | "cancelled" | "error" | "idle" | "running";
79
+ /**
80
+ * The live thread record surfaced by the `agents:agentThread` query. A structural
81
+ * subset of the persisted thread row — every field beyond `status` is optional so
82
+ * the shape stays forgiving as the server schema grows. Keep in sync with the
83
+ * `agent_threads` table in `packages/agent/src/component.ts`.
84
+ */
85
+ interface AgentThreadRecord {
86
+ createdAt?: number;
87
+ /** The failure message when `status === "error"`. */
88
+ error?: string;
89
+ /** The workflow instance id of the in-flight run — the handle `cancel` targets. */
90
+ instanceId?: string;
91
+ messageCount?: number;
92
+ /** The verified thread owner, when the run was started with one. */
93
+ owner?: string;
94
+ status: AgentThreadStatus;
95
+ title?: string;
96
+ updatedAt?: number;
97
+ }
98
+ /** A plain value or a Solid accessor of it — matching `createQuery`'s reactive-args contract. */
99
+ type MaybeAccessor<T> = Accessor<T> | T;
100
+ /**
101
+ * The `agents.agentThread` reference the primitive subscribes to for live thread
102
+ * state (status + the in-flight `instanceId`). A structural subset of the
103
+ * generated `api.agents` surface, so the whole generated `api` object is
104
+ * assignable.
105
+ */
106
+ interface CreateAgentApi {
107
+ agents: {
108
+ agentThread: FunctionReference<"query", {
109
+ key: string;
110
+ }, Record<string, unknown> | undefined>;
111
+ };
112
+ }
113
+ interface CreateAgentOptions {
114
+ /** The generated `api` — its `agents.agentThread` query drives live thread state. */
115
+ api: CreateAgentApi;
116
+ /**
117
+ * Optional app mutation over the agent's cancel path
118
+ * (`ctx.agents.<name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
119
+ * When omitted (or no run is in flight) {@link CreateAgentResult.cancel} is a
120
+ * no-op.
121
+ */
122
+ cancel?: FunctionReference<"mutation">;
123
+ /**
124
+ * The app mutation that starts (or continues) a run — a thin wrapper over
125
+ * `ctx.agents.<name>.run(...)`. Called with `{ threadKey, input }` merged with
126
+ * {@link CreateAgentOptions.runArgs} and the per-call args.
127
+ */
128
+ run: FunctionReference<"mutation">;
129
+ /** Extra args merged into every `run` call (e.g. an `owner` or `title`). */
130
+ runArgs?: Record<string, unknown>;
131
+ /** The thread to observe and drive — a plain value or accessor (an accessor re-subscribes on change). */
132
+ threadKey: MaybeAccessor<string>;
133
+ }
134
+ interface CreateAgentResult {
135
+ /**
136
+ * Terminate the in-flight run and mark its thread `"cancelled"`. Resolves as a
137
+ * no-op when no `cancel` mutation was supplied or no run is in flight.
138
+ */
139
+ cancel: () => Promise<void>;
140
+ /** `true` while a `run` invocation is in flight. */
141
+ pending: Accessor<boolean>;
142
+ /** Start (or continue) a run with a user message; extra args merge over `runArgs`. */
143
+ run: (input: string, args?: Record<string, unknown>) => Promise<void>;
144
+ /** The live thread status, or `undefined` before the thread exists. */
145
+ status: Accessor<AgentThreadStatus | undefined>;
146
+ /** The live thread record (status, `instanceId`, …), or `undefined` before it exists. */
147
+ thread: Accessor<AgentThreadRecord | undefined>;
148
+ }
149
+ /**
150
+ * A thin agent handle: live thread `status` plus `run` / `cancel`, without the
151
+ * chat message surface. Composes `createSubscription(api.agents.agentThread)` for
152
+ * live state and `createMutation` for the run/cancel writes — the Solid
153
+ * counterpart to React's `useAgent`, re-expressed with signals. For the full
154
+ * conversation surface (durable history + streaming + approvals) use
155
+ * `createAgentChat`.
156
+ *
157
+ * `run` and `cancel` stay generic over the app-defined mutations that wrap
158
+ * `ctx.agents.<name>.run` / `.cancel`, so the primitive hard-codes no function
159
+ * names beyond the `agents:*` surface. `threadKey` may be an accessor — a changing
160
+ * key re-subscribes to the new thread.
161
+ */
162
+ declare const createAgent: (options: CreateAgentOptions) => CreateAgentResult;
163
+ /**
164
+ * One persisted (or optimistic) thread message, as `agents:agentMessages`
165
+ * surfaces it. Client-safe mirror of `@lunora/agent`'s `AgentMessageRow` —
166
+ * re-declared here (rather than imported) so this Solid entry never pulls in the
167
+ * server-only `@lunora/agent` module graph. Keep in sync with the
168
+ * `agent_messages` table in `packages/agent/src/component.ts`.
169
+ */
170
+ interface AgentChatMessage {
171
+ content: string;
172
+ createdAt?: number;
173
+ /**
174
+ * `true` for a client-side optimistic user message not yet acknowledged by
175
+ * the server. Cleared once the durable history carries the matching user turn.
176
+ */
177
+ optimistic?: boolean;
178
+ role: "assistant" | "system" | "tool" | "user";
179
+ seq: number;
180
+ /** Approval lifecycle marker on a human-in-the-loop tool message. */
181
+ status?: "approved" | "awaiting_approval" | "rejected";
182
+ toolCallId?: string;
183
+ toolCalls?: ReadonlyArray<{
184
+ id: string;
185
+ input: unknown;
186
+ name: string;
187
+ }>;
188
+ toolName?: string;
189
+ }
190
+ /**
191
+ * A live token delta streamed while a turn is generating. Client-safe mirror of
192
+ * `@lunora/agent`'s `AgentTokenDelta`. Ephemeral — deltas feed
193
+ * {@link CreateAgentChatResult.streamingText} live and are never replayed; the
194
+ * persisted assistant message stays the single source of truth.
195
+ */
196
+ interface AgentTokenDelta {
197
+ /** Discriminates the token arm of {@link AgentLiveEvent}; unset on the wire (token is the default). */
198
+ kind?: "token";
199
+ /** The incremental text chunk the model just produced. */
200
+ text: string;
201
+ /** The thread this delta belongs to. */
202
+ threadKey: string;
203
+ /** The zero-based index of the turn producing the delta. */
204
+ turn: number;
205
+ }
206
+ /**
207
+ * A live tool-progress event streamed via `ctx.reportProgress(...)`. Client-safe
208
+ * mirror of `@lunora/agent`'s `AgentProgressEvent`. Ephemeral and `toolCallId`-keyed;
209
+ * surfaced by `createAgentToolEvents`, ignored by {@link CreateAgentChatResult.streamingText}.
210
+ */
211
+ interface AgentProgressEvent {
212
+ /** The arbitrary, JSON-serializable payload the tool reported. */
213
+ data: unknown;
214
+ /** Discriminates the progress arm of {@link AgentLiveEvent}. */
215
+ kind: "progress";
216
+ /** The thread this event belongs to. */
217
+ threadKey: string;
218
+ /** The tool call this progress belongs to. */
219
+ toolCallId: string;
220
+ }
221
+ /**
222
+ * A single event on the agent's live-only channel — a streamed token delta or a
223
+ * tool progress event. Client-safe mirror of `@lunora/agent`'s `AgentLiveEvent`.
224
+ * Discriminate on `kind` (`"progress"` for the progress arm; token deltas leave
225
+ * it unset).
226
+ */
227
+ type AgentLiveEvent = AgentProgressEvent | AgentTokenDelta;
228
+ /** The `agents:agentMessages` reference — live durable thread history. */
229
+ type AgentMessagesReference$1 = FunctionReference<"query", {
230
+ key: string;
231
+ limit?: number;
232
+ }, ReadonlyArray<Record<string, unknown>>>;
233
+ /** The `agents:agentResolveApproval` reference — resolves a human-in-the-loop tool approval. */
234
+ type AgentApprovalReference = FunctionReference<"mutation", {
235
+ decision: "approve" | "reject";
236
+ instanceId: string;
237
+ note?: string;
238
+ threadKey: string;
239
+ toolCallId: string;
240
+ }, {
241
+ resolved: boolean;
242
+ }>;
243
+ /** The `agents:agentThread` reference — live thread status + in-flight `instanceId`. */
244
+ type AgentThreadReference = FunctionReference<"query", {
245
+ key: string;
246
+ }, Record<string, unknown> | undefined>;
247
+ /**
248
+ * An app stream reference that tees the agent's in-flight live events, keyed by
249
+ * thread. Carries token deltas and — since `ctx.reportProgress` rides the same
250
+ * sink — tool progress events; this primitive consumes only the token arm.
251
+ */
252
+ type AgentTokenStreamReference = FunctionReference<"stream", {
253
+ key: string;
254
+ }, AgentLiveEvent>;
255
+ /**
256
+ * The `agents.*` reference surface the chat primitive reads. A structural subset
257
+ * of the generated `api.agents`, so the whole generated `api` object is
258
+ * assignable.
259
+ */
260
+ interface CreateAgentChatApi {
261
+ agents: {
262
+ agentMessages: AgentMessagesReference$1;
263
+ agentResolveApproval: AgentApprovalReference;
264
+ agentThread: AgentThreadReference;
265
+ };
266
+ }
267
+ interface CreateAgentChatOptions {
268
+ /** The generated `api` — its `agents.*` surface provides history, thread state, and approval resolution. */
269
+ api: CreateAgentChatApi;
270
+ /**
271
+ * Optional app mutation over the agent's cancel path
272
+ * (`ctx.agents.<name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
273
+ * When omitted (or no run is in flight) {@link CreateAgentChatResult.cancel} is
274
+ * a no-op.
275
+ */
276
+ cancel?: FunctionReference<"mutation">;
277
+ /** History depth forwarded to `agents:agentMessages`. */
278
+ limit?: number;
279
+ /**
280
+ * The app mutation that starts (or continues) a run — a thin wrapper over
281
+ * `ctx.agents.<name>.run(...)`. Called with `{ threadKey, input }` merged with
282
+ * {@link CreateAgentChatOptions.sendArgs} and the per-call args.
283
+ */
284
+ send: FunctionReference<"mutation">;
285
+ /** Extra args merged into every `send` call (e.g. an `owner` or `title`). */
286
+ sendArgs?: Record<string, unknown>;
287
+ /**
288
+ * Optional live token-delta stream — an app stream function that tees the
289
+ * agent's in-flight deltas. When omitted {@link CreateAgentChatResult.streamingText}
290
+ * stays empty and the UI updates message-by-message from durable history.
291
+ */
292
+ stream?: AgentTokenStreamReference;
293
+ /** The thread to observe and continue — a plain value or accessor (an accessor re-subscribes on change). */
294
+ threadKey: MaybeAccessor<string>;
295
+ }
296
+ interface CreateAgentChatResult {
297
+ /** Approve a paused human-in-the-loop tool call (optionally with a note). */
298
+ approve: (toolCallId: string, note?: string) => Promise<void>;
299
+ /**
300
+ * Terminate the in-flight run and mark its thread `"cancelled"`. Resolves as a
301
+ * no-op when no `cancel` mutation was supplied or no run is in flight.
302
+ */
303
+ cancel: () => Promise<void>;
304
+ /** Durable thread history (oldest first) plus any un-acknowledged optimistic user turns. */
305
+ messages: Accessor<ReadonlyArray<AgentChatMessage>>;
306
+ /** Reject a paused human-in-the-loop tool call (optionally with a reason). */
307
+ reject: (toolCallId: string, note?: string) => Promise<void>;
308
+ /** Start (or continue) a run with a user message; extra args merge over `sendArgs`. Appends an optimistic user turn. */
309
+ send: (input: string, args?: Record<string, unknown>) => Promise<void>;
310
+ /** The live thread status, or `undefined` before the thread exists. */
311
+ status: Accessor<AgentThreadStatus | undefined>;
312
+ /** The in-flight turn's streamed text — live-only, empty once the turn persists to `messages`. */
313
+ streamingText: Accessor<string>;
314
+ }
315
+ /**
316
+ * A first-class agent chat surface: live durable history + in-flight token
317
+ * streaming + the send / approve / reject / cancel writes, keyed by `threadKey` —
318
+ * the Solid counterpart to React's `useAgentChat`, re-expressed with signals.
319
+ *
320
+ * It composes the existing primitives rather than adding transport:
321
+ * `createSubscription(api.agents.agentMessages)` for durable history,
322
+ * `createSubscription(api.agents.agentThread)` for live status + the in-flight
323
+ * `instanceId`, {@link createStream} over an app token stream for in-flight deltas,
324
+ * and `createMutation` for the writes (`api.agents.agentResolveApproval` for
325
+ * approvals; app-defined wrappers for `send`/`cancel`). Only the `agents:*`
326
+ * surface is hard-coded — `send`/`cancel`/`stream` stay generic references.
327
+ *
328
+ * A `send` optimistically appends the user turn so it renders immediately; the
329
+ * optimistic row clears once the durable history carries the acknowledged turn.
330
+ * `streamingText` is live-only: it holds the current turn's streamed text and
331
+ * empties as soon as that turn's assistant message lands in `messages` (the
332
+ * persisted message is the source of truth), consistent with the loop's
333
+ * replay-safe, live-only delta design.
334
+ */
335
+ declare const createAgentChat: (options: CreateAgentChatOptions) => CreateAgentChatResult;
336
+ /**
337
+ * The `agents.agentState` reference the primitive subscribes to for the thread's
338
+ * live synced state. A structural subset of the generated `api.agents` surface
339
+ * (like `CreateAgentApi` for `agentThread`), so the whole generated `api` object
340
+ * is assignable. Client-safe: no `@lunora/agent` import — the per-agent state type
341
+ * is mirrored by the primitive's generic `T`, since codegen pins the reference
342
+ * return as an optional record (it never evaluates agent config).
343
+ */
344
+ interface CreateAgentStateApi {
345
+ agents: {
346
+ agentState: FunctionReference<"query", {
347
+ key: string;
348
+ }, Record<string, unknown> | undefined>;
349
+ };
350
+ }
351
+ interface CreateAgentStateOptions {
352
+ /** The generated `api` — its `agents.agentState` query drives live thread state. */
353
+ api: CreateAgentStateApi;
354
+ /** The thread whose synced state to observe — a plain value or accessor (an accessor re-subscribes on change). */
355
+ threadKey: MaybeAccessor<string>;
356
+ }
357
+ interface CreateAgentStateResult<T> {
358
+ /** The subscription error, if the live channel reported one. */
359
+ error: Accessor<Error | undefined>;
360
+ /** The live synced state, or `undefined` before it is seeded/first pushed. */
361
+ state: Accessor<T | undefined>;
362
+ }
363
+ /**
364
+ * Subscribe to an agent thread's synced state — the `setState`-style value a tool
365
+ * writes with `ctx.setState(...)`, seeded by `defineAgent({ initialState })`. A
366
+ * thin wrapper over `createSubscription(api.agents.agentState, { key })`: the
367
+ * server pushes a fresh frame whenever the state changes (the dedicated query's
368
+ * per-socket JSON memo suppresses no-op pushes on unrelated thread writes), so
369
+ * `state` updates only on a real `setState`. The Solid counterpart to React's
370
+ * `useAgentState`, re-expressed with signals.
371
+ *
372
+ * Generic over the app's state shape (`createAgentState` with a `SupportState`
373
+ * type argument, itself a record) — the reference is typed as an optional record
374
+ * because codegen cannot see the per-agent state type; the generic casts to `T`.
375
+ * The `extends` bound (not a bare unbounded type parameter) is required so the
376
+ * reference's optional-record return casts cleanly to `T`.
377
+ */
378
+ declare const createAgentState: <T extends Record<string, unknown> = Record<string, unknown>>(options: CreateAgentStateOptions) => CreateAgentStateResult<T>;
379
+ /** The `agents:agentMessages` reference — live durable thread history. */
380
+ type AgentMessagesReference = FunctionReference<"query", {
381
+ key: string;
382
+ limit?: number;
383
+ }, ReadonlyArray<Record<string, unknown>>>;
384
+ /**
385
+ * An app stream reference that tees the agent's in-flight live events, keyed by
386
+ * thread. Carries token deltas and tool progress events; this primitive consumes
387
+ * only the progress arm (`kind === "progress"`).
388
+ */
389
+ type AgentLiveStreamReference = FunctionReference<"stream", {
390
+ key: string;
391
+ }, AgentLiveEvent>;
392
+ /**
393
+ * The `agents.*` reference surface the tool-events primitive reads. A structural
394
+ * subset of the generated `api.agents`, so the whole generated `api` object is
395
+ * assignable.
396
+ */
397
+ interface CreateAgentToolEventsApi {
398
+ agents: {
399
+ agentMessages: AgentMessagesReference;
400
+ };
401
+ }
402
+ interface CreateAgentToolEventsOptions {
403
+ /** The generated `api` — its `agents.agentMessages` query provides the durable tool lifecycle. */
404
+ api: CreateAgentToolEventsApi;
405
+ /** History depth forwarded to `agents:agentMessages`. */
406
+ limit?: number;
407
+ /**
408
+ * Optional live event stream — the same app stream function `createAgentChat`
409
+ * uses. When supplied, ephemeral `ctx.reportProgress(...)` events for the
410
+ * thread are surfaced as `{ type: "progress" }` entries; when omitted only the
411
+ * durable lifecycle (call / result / awaiting-approval) is returned.
412
+ */
413
+ stream?: AgentLiveStreamReference;
414
+ /** The thread whose tool activity to observe — a plain value or accessor (an accessor re-subscribes on change). */
415
+ threadKey: MaybeAccessor<string>;
416
+ }
417
+ /**
418
+ * A single tool-lifecycle event for a thread. The durable arms
419
+ * (`call`/`result`/`awaiting-approval`) are derived from `agents:agentMessages`
420
+ * and carry the persisted `seq`; the ephemeral `progress` arm comes live off the
421
+ * stream and has no `seq`. Discriminate on `type`.
422
+ */
423
+ type AgentToolEvent = {
424
+ data: unknown;
425
+ toolCallId: string;
426
+ type: "progress";
427
+ } | {
428
+ input: unknown;
429
+ seq: number;
430
+ toolCallId: string;
431
+ toolName: string;
432
+ type: "call";
433
+ } | {
434
+ output: string;
435
+ seq: number;
436
+ status?: "approved" | "rejected";
437
+ toolCallId?: string;
438
+ toolName?: string;
439
+ type: "result";
440
+ } | {
441
+ seq: number;
442
+ toolCallId?: string;
443
+ toolName?: string;
444
+ type: "awaiting-approval";
445
+ };
446
+ interface CreateAgentToolEventsResult {
447
+ /**
448
+ * The thread's tool events: the durable lifecycle (oldest first, by `seq`)
449
+ * followed by any in-flight ephemeral progress events, recomputed from the live
450
+ * subscription + stream. Treat as derived, not identity-stable.
451
+ */
452
+ events: Accessor<ReadonlyArray<AgentToolEvent>>;
453
+ }
454
+ /**
455
+ * A focused view of a thread's tool activity: tool calls, their results,
456
+ * human-in-the-loop approval pauses, and live `ctx.reportProgress(...)` events —
457
+ * without the full chat message surface. The Solid counterpart to React's
458
+ * `useAgentToolEvents`, re-expressed as a memo.
459
+ *
460
+ * It composes the existing primitives rather than adding transport:
461
+ * `createSubscription(api.agents.agentMessages)` for the durable lifecycle and
462
+ * {@link createStream} over the optional app event stream for ephemeral progress.
463
+ * Progress events are live-only (the durable path never emits them): they ride
464
+ * the same sink as token deltas and are surfaced here, correlated to their tool
465
+ * call by `toolCallId`. For the conversational surface (messages + streaming text
466
+ * + approvals) use `createAgentChat`; this primitive is the tool-observability slice.
467
+ */
468
+ declare const createAgentToolEvents: (options: CreateAgentToolEventsOptions) => CreateAgentToolEventsResult;
469
+ /**
470
+ * Children accepted by this adapter's components.
471
+ *
472
+ * Structurally identical to Solid 2.0's `Element`, which is in turn a widening
473
+ * of 1.x's `JSX.Element` (a DOM `Node` satisfies `object` with no
474
+ * `call`/`apply`/`bind`). Children are contravariant, so one union that accepts
475
+ * both majors' element types is enough — no `any` required here.
476
+ */
477
+ type SolidChildren = SolidChildrenArray | boolean | null | number | (object & {
478
+ readonly apply?: never;
479
+ readonly bind?: never;
480
+ readonly call?: never;
481
+ }) | (string & {}) | undefined;
482
+ interface SolidChildrenArray extends Array<SolidChildren> {}
483
+ /**
484
+ * The return type of this adapter's components.
485
+ *
486
+ * Deliberately `any`, and the one place in the package where that is the right
487
+ * answer. TypeScript checks a component's return type against the *renderer's*
488
+ * `JSX.Element`, and the two majors define that incompatibly — 1.x's is rooted
489
+ * in the DOM `Node` interface, 2.0's in an opaque `RenderedElement`. Neither is
490
+ * assignable to the other, so no concrete type satisfies both, and a structural
491
+ * union (as used for {@link SolidChildren}) fails in the return position. `any`
492
+ * is what lets one set of `.d.ts` files type-check inside a 1.x app and a 2.x
493
+ * app alike.
494
+ */
495
+ type SolidElement = any;
24
496
  interface UseAuthResult {
25
497
  setToken: (token: string | null) => void;
26
498
  token: Accessor<string | null>;
27
499
  user: Accessor<User | null>;
28
500
  }
29
501
  /**
30
- * Token + identity plumbing for Solid. Returns `{ token, user, setToken }`
31
- * where `token` and `user` are fine-grained signals. `setToken(jwt)` after
32
- * sign-in updates the shared client token; `user` resolves asynchronously via
33
- * `client.getCurrentUser()` and updates on every token change.
34
- */
502
+ * Token + identity plumbing for Solid. Returns `{ token, user, setToken }`
503
+ * where `token` and `user` are fine-grained signals. `setToken(jwt)` after
504
+ * sign-in updates the shared client token; `user` resolves asynchronously via
505
+ * `client.getCurrentUser()` and updates on every token change.
506
+ */
35
507
  declare const createAuth: () => UseAuthResult;
36
508
  interface AuthGateProps {
37
- children: JSX.Element;
38
- }
39
- /**
40
- * Render `children` only after authentication has settled and a token + user
41
- * are both present.
42
- */
43
- declare const Authenticated: (props: AuthGateProps) => JSX.Element;
44
- /**
45
- * Render `children` while authentication is still in progress — token is set
46
- * but the user has not yet resolved.
47
- */
48
- declare const AuthLoading: (props: AuthGateProps) => JSX.Element;
49
- /**
50
- * Render `children` only when auth has settled and no token is present (the
51
- * signed-out state).
52
- */
53
- declare const Unauthenticated: (props: AuthGateProps) => JSX.Element;
54
- /**
55
- * Reactive accessor of the client's aggregate live-socket status across all
56
- * shard connections. Reads the current status synchronously and updates on
57
- * every transition (`idle` `connecting` `connected` `offline`) — Solid's
58
- * fine-grained signals mean only the components that read the accessor
59
- * re-render. The Solid equivalent of `@lunora/react`'s `useConnectionStatus`.
60
- *
61
- * The status listener is torn down via `onCleanup` when the owning reactive
62
- * scope disposes (component unmount). Call inside a component / reactive root.
63
- */
509
+ children: SolidChildren;
510
+ }
511
+ /** An auth-gate component: renders its children only while the gate's condition holds. */
512
+ type AuthGate = (props: AuthGateProps) => SolidElement;
513
+ /**
514
+ * Render `children` only after authentication has settled and a token + user
515
+ * are both present.
516
+ */
517
+ declare const Authenticated: AuthGate;
518
+ /**
519
+ * Render `children` while authentication is still in progress — token is set
520
+ * but the user has not yet resolved.
521
+ */
522
+ declare const AuthLoading: AuthGate;
523
+ /**
524
+ * Render `children` only when auth has settled and no token is present (the
525
+ * signed-out state).
526
+ */
527
+ declare const Unauthenticated: AuthGate;
528
+ /**
529
+ * Reactive accessor of the client's aggregate live-socket status across all
530
+ * shard connections. Reads the current status synchronously and updates on
531
+ * every transition (`idle` `connecting` `connected` → `offline`) — Solid's
532
+ * fine-grained signals mean only the components that read the accessor
533
+ * re-render. The Solid equivalent of `@lunora/react`'s `useConnectionStatus`.
534
+ *
535
+ * The listener is registered at **mount**, not in the component body, because
536
+ * `onConnectionStatus` invokes it synchronously on subscribe: Solid 2 rejects a
537
+ * signal write inside an owned scope (`REACTIVE_WRITE_IN_OWNED_SCOPE`) and — since
538
+ * the throw escapes render — halts the reactive system for the whole page, not
539
+ * just this component. Nothing is missed by waiting: the initial value comes
540
+ * from `client.connectionStatus()`, and the immediate callback re-syncs at
541
+ * mount. Torn down when the owning scope disposes. Call inside a component /
542
+ * reactive root.
543
+ */
64
544
  declare const createConnectionStatus: () => Accessor<ConnectionStatus>;
65
- /** A targeting context merged on top of the app's default (`defineFlags({ identify })`). */
66
- type FlagContext = Record<string, unknown>;
67
545
  /** The value kinds a flag resolves to — OpenFeature's boolean / number / string / structured (JSON) flags. */
68
546
  type FlagValue = boolean | number | string | {
69
547
  [key: string]: unknown;
70
548
  } | unknown[] | null;
71
- /** A plain value or a Solid accessor of it — matching `createQuery`'s reactive-args contract. */
72
- type MaybeAccessor<T> = Accessor<T> | T;
73
549
  /**
74
- * Subscribe to a single feature flag and return a reactive accessor of its value.
75
- *
76
- * The accessor reads `defaultValue` until the first evaluation lands, then the
77
- * server's resolved value — re-pushed whenever the provider re-evaluates (e.g. a
78
- * flag is toggled in Cloudflare Flagship). The flag's kind is inferred from
79
- * `defaultValue`'s runtime type, so `createFlag("dark", false)` reads a boolean
80
- * and `createFlag("hero", "control")` a string.
81
- *
82
- * `key` and `context` may be plain values or accessors; passing an accessor makes
83
- * the subscription reactive — when it changes the old subscription is torn down
84
- * (via `onCleanup`) and a fresh one opens. `context` supplies a per-call targeting
85
- * context merged on top of the app's default `identify` targeting key.
86
- *
87
- * Evaluation runs through whatever OpenFeature provider the app wired in
88
- * `lunora/flags.ts`; the read never throws a provider error resolves the
89
- * default (the same fail-open contract as server-side `ctx.flags`).
90
- */
91
- declare const createFlag: <T extends FlagValue>(key: MaybeAccessor<string>, defaultValue: T, context?: MaybeAccessor<FlagContext | undefined>) => Accessor<T>;
92
- /**
93
- * Subscribe to several feature flags at once and return a reactive accessor of
94
- * the resolved record.
95
- *
96
- * Pass a record of `key defaultValue`; each flag's kind is inferred from its
97
- * default, and the accessor reads the same-shaped record with resolved values
98
- * (the defaults until each evaluation lands). A single `context` applies to every
99
- * flag and may be an accessor. This is the batched form of {@link createFlag}.
100
- */
101
- declare const createFlags: <T extends Record<string, FlagValue>>(flags: T, context?: MaybeAccessor<FlagContext | undefined>) => Accessor<T>;
550
+ * Subscribe to a single feature flag and return a reactive accessor of its value.
551
+ *
552
+ * The accessor reads `defaultValue` until the first evaluation lands, then the
553
+ * server's resolved value — re-pushed whenever the provider re-evaluates (e.g. a
554
+ * flag is toggled in Cloudflare Flagship). The flag's kind is inferred from
555
+ * `defaultValue`'s runtime type, so `createFlag("dark", false)` reads a boolean
556
+ * and `createFlag("hero", "control")` a string.
557
+ *
558
+ * `key` may be a plain value or an accessor; passing an accessor makes the
559
+ * subscription reactive — when it changes the old subscription is torn down (via
560
+ * `onCleanup`) and a fresh one opens.
561
+ *
562
+ * The reactive channel is public, so the server evaluates every flag under the
563
+ * socket's own verified identity the targeting key your `defineFlags({
564
+ * identify })` derives and accepts no client-supplied targeting context. For
565
+ * evaluation under a context you compute, call `ctx.flags.*` inside a query,
566
+ * mutation, or action and return the resolved value.
567
+ *
568
+ * Evaluation runs through whatever OpenFeature provider the app wired in
569
+ * `lunora/flags.ts`; the read never throws a provider error resolves the
570
+ * default (the same fail-open contract as server-side `ctx.flags`).
571
+ */
572
+ declare const createFlag: <T extends FlagValue>(key: MaybeAccessor<string>, defaultValue: T) => Accessor<T>;
573
+ /**
574
+ * Subscribe to several feature flags at once and return a reactive accessor of
575
+ * the resolved record.
576
+ *
577
+ * Pass a record of `key defaultValue`; each flag's kind is inferred from its
578
+ * default, and the accessor reads the same-shaped record with resolved values
579
+ * (the defaults until each evaluation lands). This is the batched form of
580
+ * {@link createFlag}, and evaluates under the socket's server-verified identity
581
+ * only. The flag set is fixed for the primitive's lifetime, so nothing here is
582
+ * reactive — the subscriptions open on mount and tear down on cleanup.
583
+ */
584
+ declare const createFlags: <T extends Record<string, FlagValue>>(flags: T) => Accessor<T>;
102
585
  interface MutationHandle<F extends FunctionReference> {
103
586
  /** The latest invocation's resolved value, or `undefined` before the first success. */
104
587
  data: Accessor<ReturnOf<F> | undefined>;
@@ -112,44 +595,49 @@ interface MutationHandle<F extends FunctionReference> {
112
595
  reset: () => void;
113
596
  }
114
597
  /**
115
- * The transport surface {@link createMutation} actually needs — just
116
- * `client.mutation`. Narrowed so the primitive can be exercised against a stub
117
- * in tests without constructing a full `LunoraClient`.
118
- */
598
+ * The transport surface {@link createMutation} actually needs — just
599
+ * `client.mutation`. Narrowed so the primitive can be exercised against a stub
600
+ * in tests without constructing a full `LunoraClient`.
601
+ */
119
602
  interface MutationClient<F extends FunctionReference> {
120
603
  mutation: (function_: F, args: ArgsOf<F>, options?: MutationCallOptions<unknown, unknown, ArgsOf<F>>) => Promise<ReturnOf<F>>;
121
604
  }
122
605
  /**
123
- * Build a mutation handle bound to an explicit client. Internal seam used by the
124
- * provider-bound {@link createMutation}; exported for tests that inject a stub.
125
- * The ref-counted pending + error-normalize orchestration is the shared
126
- * `createMutationRunner` from `@lunora/client`; only the reactive sinks (Solid
127
- * signals) are adapter-specific.
128
- */
606
+ * Build a mutation handle bound to an explicit client. Internal seam used by the
607
+ * provider-bound {@link createMutation}; exported for tests that inject a stub.
608
+ * The ref-counted pending + error-normalize orchestration is the shared
609
+ * `createCallRunner` from `@lunora/client`; only the reactive sinks (Solid
610
+ * signals) are adapter-specific.
611
+ *
612
+ * `data`/`error` follow the adapter-wide contract: both track the LATEST
613
+ * invocation (an earlier call settling later cannot clobber a newer one), a
614
+ * success clears `error`, and a failure leaves the previous `data` in place.
615
+ * `reset()` clears both; it does not cancel an in-flight call.
616
+ */
129
617
  declare const createMutationForClient: <F extends FunctionReference>(client: MutationClient<F>, function_: F) => MutationHandle<F>;
130
618
  /**
131
- * Returns a reactive handle `{ mutate, pending, data, error, reset }` for the
132
- * given mutation reference, bound to the `LunoraClient` from the nearest
133
- * `&lt;LunoraProvider>`.
134
- *
135
- * Optimistic updates stay client-owned: the `optimistic` / `optimisticUpdate`
136
- * call options pass straight through to `client.mutation`, which applies and
137
- * rolls them back against the live Lunora subscription cache — the same
138
- * machinery `createQuery`/`hydratePreloaded` subscribe to, so an optimistic
139
- * write reflects in those accessors immediately and reverts on failure.
140
- *
141
- * `pending` is ref-counted across overlapping invocations of *this* handle, so
142
- * it only flips back to `false` once every concurrent call has settled. The
143
- * mutation also engages `@lunora/client`'s offline queue when the socket is
144
- * down, so `mutate` stays durable across reconnects.
145
- */
619
+ * Returns a reactive handle `{ mutate, pending, data, error, reset }` for the
620
+ * given mutation reference, bound to the `LunoraClient` from the nearest
621
+ * `<LunoraProvider>`.
622
+ *
623
+ * Optimistic updates stay client-owned: the `optimistic` / `optimisticUpdate`
624
+ * call options pass straight through to `client.mutation`, which applies and
625
+ * rolls them back against the live Lunora subscription cache — the same
626
+ * machinery `createQuery`/`hydratePreloaded` subscribe to, so an optimistic
627
+ * write reflects in those accessors immediately and reverts on failure.
628
+ *
629
+ * `pending` is ref-counted across overlapping invocations of *this* handle, so
630
+ * it only flips back to `false` once every concurrent call has settled. The
631
+ * mutation also engages `@lunora/client`'s offline queue when the socket is
632
+ * down, so `mutate` stays durable across reconnects.
633
+ */
146
634
  declare const createMutation: <F extends FunctionReference>(function_: F) => MutationHandle<F>;
147
635
  /**
148
- * The reactive handle returned by {@link createMutator} — the Solid counterpart
149
- * to `@lunora/react`'s `useMutator`, re-expressed with signals.
150
- * `error`/`isError`/`pending` are accessors and `mutate` is an awaitable that
151
- * resolves once the write is persisted (or rejects).
152
- */
636
+ * The reactive handle returned by {@link createMutator} — the Solid counterpart
637
+ * to `@lunora/react`'s `useMutator`, re-expressed with signals.
638
+ * `error`/`isError`/`pending` are accessors and `mutate` is an awaitable that
639
+ * resolves once the write is persisted (or rejects).
640
+ */
153
641
  interface MutatorHook<TArgs> {
154
642
  /** The latest invocation's error, or `undefined`. */
155
643
  error: Accessor<Error | undefined>;
@@ -163,18 +651,18 @@ interface MutatorHook<TArgs> {
163
651
  reset: () => void;
164
652
  }
165
653
  /**
166
- * Ergonomic `{ mutate, pending, error, isError, reset }` wrapper over a bound
167
- * custom-mutator handle from `@lunora/db`'s `bindMutators` — the Solid
168
- * equivalent of `@lunora/react`'s `useMutator`. The optimistic overlay and
169
- * server-authoritative push are owned by the bound handle (and TanStack DB's
170
- * optimistic-transaction layer rebases pending overlays on every sync tick);
171
- * this primitive only surfaces signal state for the in-flight/error lifecycle.
172
- * Reads stay on the existing TanStack `useLiveQuery`; no new query primitive is
173
- * needed.
174
- *
175
- * `pending` is ref-counted across overlapping invocations of THIS handle, so it
176
- * clears only once every concurrent call has settled.
177
- */
654
+ * Ergonomic `{ mutate, pending, error, isError, reset }` wrapper over a bound
655
+ * custom-mutator handle from `@lunora/db`'s `bindMutators` — the Solid
656
+ * equivalent of `@lunora/react`'s `useMutator`. The optimistic overlay and
657
+ * server-authoritative push are owned by the bound handle (and TanStack DB's
658
+ * optimistic-transaction layer rebases pending overlays on every sync tick);
659
+ * this primitive only surfaces signal state for the in-flight/error lifecycle.
660
+ * Reads stay on the existing TanStack `useLiveQuery`; no new query primitive is
661
+ * needed.
662
+ *
663
+ * `pending` is ref-counted across overlapping invocations of THIS handle, so it
664
+ * clears only once every concurrent call has settled.
665
+ */
178
666
  declare const createMutator: <TArgs = Record<string, unknown>>(handle: MutatorHandle<TArgs>) => MutatorHook<TArgs>;
179
667
  /** The args a paginated query exposes minus the framework-supplied page cursor. */
180
668
  type PaginatedArgs<F extends FunctionReference> = Omit<ArgsOf<F>, "paginationOpts">;
@@ -215,46 +703,46 @@ interface CreateInfiniteQueryResult<T> {
215
703
  status: Accessor<PaginationStatus>;
216
704
  }
217
705
  /**
218
- * Subscribe to a reactively-paginated query and grow the feed page by page.
219
- *
220
- * The query function must accept a `paginationOpts: { numItems, cursor,
221
- * endCursor }` arg and return a `PaginationResult`. `loadMore` appends the next
222
- * page off the open-ended tail's `continueCursor`; it is a no-op unless
223
- * `status === "CanLoadMore"`.
224
- *
225
- * Call inside a reactive context (component / `createRoot`).
226
- */
706
+ * Subscribe to a reactively-paginated query and grow the feed page by page.
707
+ *
708
+ * The query function must accept a `paginationOpts: { numItems, cursor,
709
+ * endCursor }` arg and return a `PaginationResult`. `loadMore` appends the next
710
+ * page off the open-ended tail's `continueCursor`; it is a no-op unless
711
+ * `status === "CanLoadMore"`.
712
+ *
713
+ * Call inside a reactive context (component / `createRoot`).
714
+ */
227
715
  declare const createPaginatedQuery: <F extends FunctionReference>(function_: F, args: "skip" | Accessor<"skip" | PaginatedArgs<F>> | PaginatedArgs<F>, options: CreatePaginatedQueryOptions) => CreatePaginatedQueryResult<PageItemOf<F>>;
228
716
  /**
229
- * Subscribe to a reactively-paginated query and expose its pages discretely.
230
- *
231
- * Shares `createPaginatedQuery`'s pagination engine but keeps each page as its
232
- * own inner array (TanStack-Query-style `fetchNextPage` / `hasNextPage` shape).
233
- *
234
- * Call inside a reactive context (component / `createRoot`).
235
- */
717
+ * Subscribe to a reactively-paginated query and expose its pages discretely.
718
+ *
719
+ * Shares `createPaginatedQuery`'s pagination engine but keeps each page as its
720
+ * own inner array (TanStack-Query-style `fetchNextPage` / `hasNextPage` shape).
721
+ *
722
+ * Call inside a reactive context (component / `createRoot`).
723
+ */
236
724
  declare const createInfiniteQuery: <F extends FunctionReference>(function_: F, args: "skip" | Accessor<"skip" | PaginatedArgs<F>> | PaginatedArgs<F>, options: CreateInfiniteQueryOptions) => CreateInfiniteQueryResult<PageItemOf<F>>;
237
725
  /**
238
- * `createPresence` — collaborative-awareness primitive, the client half of the
239
- * `@lunora/server` `definePresence` preset.
240
- *
241
- * Drives the heartbeat mutation (on mount, interval, and tab re-focus) and
242
- * subscribes to the live `listPresent` query for the given room.
243
- *
244
- * Call inside a reactive context (component / `createRoot`).
245
- */
246
- /**
247
- * A heartbeat mutation reference: takes `{ roomId, sessionId, data? }`.
248
- */
726
+ * `createPresence` — collaborative-awareness primitive, the client half of the
727
+ * `@lunora/server` `definePresence` preset.
728
+ *
729
+ * Drives the heartbeat mutation (on mount, interval, and tab re-focus) and
730
+ * subscribes to the live `listPresent` query for the given room.
731
+ *
732
+ * Call inside a reactive context (component / `createRoot`).
733
+ */
734
+ /**
735
+ * A heartbeat mutation reference: takes `{ roomId, sessionId, data? }`.
736
+ */
249
737
  type HeartbeatReference = FunctionReference<"mutation", {
250
738
  data?: Record<string, unknown>;
251
739
  roomId: string;
252
740
  sessionId: string;
253
741
  }>;
254
742
  /**
255
- * A listPresent query reference: takes `{ roomId }` and returns the array of
256
- * present members.
257
- */
743
+ * A listPresent query reference: takes `{ roomId }` and returns the array of
744
+ * present members.
745
+ */
258
746
  type ListPresentReference = FunctionReference<"query", {
259
747
  roomId: string;
260
748
  }>;
@@ -268,9 +756,9 @@ interface CreatePresenceOptions<H extends HeartbeatReference, L extends ListPres
268
756
  /** The `api.*` reference for the presence listPresent query. */
269
757
  listPresent: L;
270
758
  /**
271
- * Stable id for this presence row. Defaults to a fresh per-mount id.
272
- * Pass a user/connection id to control deduping across tabs.
273
- */
759
+ * Stable id for this presence row. Defaults to a fresh per-mount id.
760
+ * Pass a user/connection id to control deduping across tabs.
761
+ */
274
762
  sessionId?: string;
275
763
  /** Forwarded to the heartbeat mutation / listPresent subscription when sharding by room. */
276
764
  shardKey?: string;
@@ -285,35 +773,45 @@ interface CreatePresenceResult<L extends ListPresentReference> {
285
773
  }
286
774
  declare const createPresence: <H extends HeartbeatReference, L extends ListPresentReference>(roomId: string, options: CreatePresenceOptions<H, L>) => CreatePresenceResult<L>;
287
775
  interface CreateQueryOptions {
776
+ /**
777
+ * Called when the server pushes a subscription-scoped error (an RLS denial, a
778
+ * query that starts failing server-side). Without a handler such an error has
779
+ * nowhere to go and the accessor simply freezes at its last good value.
780
+ */
781
+ onError?: SubscriptionErrorCallback;
288
782
  /** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
289
783
  shardKey?: string;
290
784
  }
291
785
  /**
292
- * Subscribe to a server query and return a reactive accessor of its value.
293
- *
294
- * The accessor reads `undefined` until the first server frame lands, then
295
- * updates on every delta the WebSocket pushes — Solid's fine-grained signals
296
- * mean only the components that read the accessor re-render, which maps cleanly
297
- * onto Lunora's per-subscription delta model.
298
- *
299
- * `args` may be a plain value or an accessor; passing an accessor makes the
300
- * subscription reactive — when the args change the old subscription is torn down
301
- * (via `onCleanup`) and a fresh one opens for the new args. Pass `"skip"` (or an
302
- * accessor returning `"skip"`) to short-circuit: no network call, no socket.
303
- *
304
- * ```tsx
305
- * const messages = createQuery(api.messages.list, () => ({ channelId: channelId() }));
306
- * return &lt;For each={messages()?.messages}>{(m) => &lt;li>{m.text}&lt;/li>}&lt;/For>;
307
- * ```
308
- */
786
+ * Subscribe to a server query and return a reactive accessor of its value.
787
+ *
788
+ * The accessor reads `undefined` until the first server frame lands, then
789
+ * updates on every delta the WebSocket pushes — Solid's fine-grained signals
790
+ * mean only the components that read the accessor re-render, which maps cleanly
791
+ * onto Lunora's per-subscription delta model.
792
+ *
793
+ * `args` may be a plain value or an accessor; passing an accessor makes the
794
+ * subscription reactive — when the args change the old subscription is torn down
795
+ * (via `onCleanup`) and a fresh one opens for the new args. Pass `"skip"` (or an
796
+ * accessor returning `"skip"`) to short-circuit: no network call, no socket.
797
+ *
798
+ * ```tsx
799
+ * const messages = createQuery(api.messages.list, () => ({ channelId: channelId() }));
800
+ * return <For each={messages()?.messages}>{(m) => <li>{m.text}</li>}</For>;
801
+ * ```
802
+ *
803
+ * Pass `onError` to surface a subscription-scoped error the server pushes (an RLS
804
+ * denial, a query that starts failing server-side). Without it such an error is
805
+ * dropped and the accessor just freezes at its last good value.
806
+ */
309
807
  declare const createQuery: <F extends FunctionReference>(function_: F, args: (ArgsOf<F> | "skip") | Accessor<ArgsOf<F> | "skip">, options?: CreateQueryOptions) => Accessor<ReturnOf<F> | undefined>;
310
808
  interface CreateRateLimitOptions {
311
809
  /** Clock injection for tests. Defaults to `Date.now`. */
312
810
  now?: () => number;
313
811
  /**
314
- * Re-evaluation cadence in milliseconds while throttled, so `retryAfter`
315
- * ticks down and `disabled` flips back automatically. Defaults to `1000`.
316
- */
812
+ * Re-evaluation cadence in milliseconds while throttled, so `retryAfter`
813
+ * ticks down and `disabled` flips back automatically. Defaults to `1000`.
814
+ */
317
815
  tickMs?: number;
318
816
  }
319
817
  interface CreateRateLimitResult {
@@ -331,78 +829,276 @@ interface CreateRateLimitResult {
331
829
  retryAfter: () => number;
332
830
  }
333
831
  /**
334
- * Client-side mirror of a rate limit for instant UX — disable a button or show
335
- * a countdown without a round-trip. It runs the same token-bucket / fixed-window
336
- * math as `@lunora/ratelimit` on the server, so the prediction agrees with the
337
- * authoritative check; the server remains the source of truth.
338
- *
339
- * `config` is read on every call; pass a stable reference (module constant) so
340
- * the derived memos stay settled.
341
- */
832
+ * Client-side mirror of a rate limit for instant UX — disable a button or show
833
+ * a countdown without a round-trip. It runs the same token-bucket / fixed-window
834
+ * math as `@lunora/ratelimit` on the server, so the prediction agrees with the
835
+ * authoritative check; the server remains the source of truth.
836
+ *
837
+ * `config` is read on every call; pass a stable reference (module constant) so
838
+ * the derived memos stay settled.
839
+ */
342
840
  declare const createRateLimit: (config: RateLimitConfig, options?: CreateRateLimitOptions) => CreateRateLimitResult;
841
+ /** The lifecycle of a stream the primitive is observing. */
842
+ type CreateStreamStatus = "complete" | "error" | "idle" | "streaming";
843
+ interface CreateStreamResult<T> {
844
+ /** Force-cancel the stream and resolve the iterator. Safe to call multiple times. */
845
+ cancel: () => void;
846
+ /** Chunks the server has pushed so far, in arrival order. */
847
+ chunks: Accessor<ReadonlyArray<T>>;
848
+ error: Accessor<Error | undefined>;
849
+ status: Accessor<CreateStreamStatus>;
850
+ }
851
+ interface CreateStreamOptions {
852
+ /** Forwarded to `client.stream()` — caps the in-flight chunk buffer. */
853
+ maxBuffer?: number;
854
+ shardKey?: string;
855
+ }
856
+ /**
857
+ * Subscribe to a streaming query. Returns the chunks pushed so far plus a
858
+ * lifecycle status and a cancel function, all as accessors. Changing the
859
+ * resolved `args` resets the stream — the previous iterator is cancelled and a
860
+ * fresh one opens with empty `chunks`.
861
+ *
862
+ * `args` may be a plain value or an accessor; resolving it to `"skip"` keeps the
863
+ * primitive mounted without opening a stream (mirrors `createSubscription`). The
864
+ * Solid counterpart to React's `useStream`, re-expressed with signals.
865
+ */
866
+ declare const createStream: <F extends FunctionReference<"stream">>(function_: F, args: ArgsOf<F> | "skip" | Accessor<ArgsOf<F> | "skip">, options?: CreateStreamOptions) => CreateStreamResult<ReturnOf<F>>;
343
867
  interface CreateSubscriptionResult<T> {
344
868
  data: Accessor<T | undefined>;
345
869
  error: Accessor<Error | undefined>;
346
870
  }
347
871
  /**
348
- * Subscribe to a reactive server push stream. Returns `{ data, error }`
349
- * accessors that update whenever the server emits. Passing `"skip"` as `args`
350
- * (or an accessor that resolves to `"skip"`) tears down the subscription.
351
- */
872
+ * Subscribe to a reactive server push stream. Returns `{ data, error }`
873
+ * accessors that update whenever the server emits. Passing `"skip"` as `args`
874
+ * (or an accessor that resolves to `"skip"`) tears down the subscription.
875
+ */
352
876
  declare const createSubscription: <F extends FunctionReference>(function_: F, args: ArgsOf<F> | "skip" | Accessor<ArgsOf<F> | "skip">, options?: {
353
877
  shardKey?: string;
354
878
  }) => CreateSubscriptionResult<ReturnOf<F>>;
355
879
  /**
356
- * Hydrate a query from a {@link Preloaded} token produced by `preloadQuery`
357
- * during SSR, then keep it live.
358
- *
359
- * This is the client half of PLAN4's "your loaders are live" handoff. The
360
- * returned accessor is seeded **synchronously** from `preloaded.value`, so the
361
- * very first read — during hydration — returns the server-rendered value with
362
- * no loading flash and no `Suspense` fallback (unlike `createResource`, which
363
- * always starts pending). After the component mounts, a WebSocket subscription
364
- * attaches in an effect and every subsequent server delta flows into the same
365
- * signal, so the UI goes live with zero refetch.
366
- *
367
- * ```tsx
368
- * // route loader (server): const preloaded = await preloadQuery(client, api.messages.list, args);
369
- * const messages = hydratePreloaded(preloaded); // seeded from SSR, then live
370
- * return &lt;pre>{JSON.stringify(messages())}&lt;/pre>;
371
- * ```
372
- *
373
- * Effects do not run on the server during SSR (Solid only runs them after
374
- * hydration), so the subscription is strictly client-side the seed is the
375
- * only value the server render ever sees.
376
- */
880
+ * Browser Web Audio subsystems for `createVoiceAgent` the default microphone
881
+ * capture and speaker playback implementations injected into the primitive via
882
+ * its `createMicrophone` / `createSpeaker` seams. Kept in a sibling module so the
883
+ * heavy Web Audio graph (and its structural DOM typings) stays isolated from the
884
+ * primitive's transport + reactive-state logic and remains mockable in a
885
+ * non-browser test env.
886
+ */
887
+ /**
888
+ * The negotiated audio format the voice DO streams back. Mirrors
889
+ * `@lunora/agent`'s `VoiceServerFrame` `ready.audioFormat` re-declared (not
890
+ * imported) so this Solid package never pulls in the server-only `@lunora/agent`
891
+ * module graph.
892
+ */
893
+ type VoiceAudioFormat = "mp3" | "wav";
894
+ /** Captures microphone audio and reports level / turn boundaries back to the primitive. */
895
+ interface VoiceMicrophone {
896
+ /** Mute/unmute the mic without tearing down the capture graph. */
897
+ setMuted: (muted: boolean) => void;
898
+ /** Stop capture and release the media stream + audio graph. */
899
+ stop: () => void;
900
+ }
901
+ /** Plays the server's streamed audio chunks and supports a mid-utterance barge-in. */
902
+ interface VoiceSpeaker {
903
+ /** Queue a decoded audio chunk for gap-minimized playback. */
904
+ enqueue: (audio: Uint8Array) => void;
905
+ /** Drop everything queued and stop the current chunk (barge-in). */
906
+ interrupt: () => void;
907
+ /** Release the playback audio context. */
908
+ stop: () => void;
909
+ }
910
+ /** Config passed to a {@link CreateMicrophone} factory. */
911
+ interface MicrophoneConfig {
912
+ /** The consecutive above-threshold chunk count that counts as a barge-in. */
913
+ interruptChunks: number;
914
+ /** RMS above which the user is considered to be barging in while the agent speaks. */
915
+ interruptThreshold: number;
916
+ /** `true` while `status === "speaking"` — gates barge-in detection. */
917
+ isSpeaking: () => boolean;
918
+ /** One 16 kHz mono 16-bit little-endian PCM frame captured from the mic. */
919
+ onAudio: (pcm: Uint8Array) => void;
920
+ /** A barge-in was detected (RMS spike while the agent is speaking). */
921
+ onInterrupt: () => void;
922
+ /** The current input RMS (0–1), for a level meter. */
923
+ onLevel: (rms: number) => void;
924
+ /** A spoken utterance ended (speech followed by `silenceDurationMs` of silence). */
925
+ onSilence: () => void;
926
+ /** Milliseconds of sub-threshold audio (after speech) that closes an utterance. */
927
+ silenceDurationMs: number;
928
+ /** RMS below which audio counts as silence. */
929
+ silenceThreshold: number;
930
+ }
931
+ type CreateMicrophone = (config: MicrophoneConfig) => Promise<VoiceMicrophone>;
932
+ type CreateSpeaker = (config: {
933
+ audioFormat: VoiceAudioFormat;
934
+ }) => VoiceSpeaker;
935
+ /**
936
+ * The `agents.<name>Voice` reference codegen emits for a voice-enabled agent — a
937
+ * live, WS-backed session keyed by `threadKey`. A structural subset of the
938
+ * generated member, so passing `api.agents.<name>Voice` type-checks.
939
+ */
940
+ type VoiceReference = FunctionReference<"stream", {
941
+ threadKey: string;
942
+ }, Record<string, unknown>>;
943
+ /** The lifecycle of a voice call, mirrored to the UI. */
944
+ type VoiceStatus = "idle" | "listening" | "speaking" | "thinking";
945
+ /** A minimal structural subset of the DOM `WebSocket` the primitive drives. */
946
+ interface VoiceSocket {
947
+ binaryType: string;
948
+ close: () => void;
949
+ onclose: ((event: unknown) => void) | null;
950
+ onerror: ((event: unknown) => void) | null;
951
+ onmessage: ((event: {
952
+ data: unknown;
953
+ }) => void) | null;
954
+ onopen: ((event: unknown) => void) | null;
955
+ readonly readyState: number;
956
+ send: (data: ArrayBufferView | ArrayBufferLike | string) => void;
957
+ }
958
+ type CreateSocket = (url: string) => VoiceSocket;
959
+ interface CreateVoiceAgentOptions {
960
+ /**
961
+ * Advanced/test seam: build the microphone capture subsystem. Defaults to a
962
+ * `getUserMedia` + Web Audio implementation. Injected wholesale so the Web
963
+ * Audio graph stays isolated (and mockable in a non-browser test env).
964
+ */
965
+ createMicrophone?: CreateMicrophone;
966
+ /** Advanced/test seam: open the transport. Defaults to `new WebSocket(url)`. */
967
+ createSocket?: CreateSocket;
968
+ /** Advanced/test seam: build the audio playback subsystem. Defaults to a Web Audio implementation. */
969
+ createSpeaker?: CreateSpeaker;
970
+ /** Consecutive above-`interruptThreshold` chunks that trigger a barge-in. Default `3`. */
971
+ interruptChunks?: number;
972
+ /** Input RMS above which the user is treated as barging in while the agent speaks. Default `0.15`. */
973
+ interruptThreshold?: number;
974
+ /** Milliseconds of silence (after speech) that auto-commits an utterance. Default `1200`. */
975
+ silenceDurationMs?: number;
976
+ /** Input RMS below which audio counts as silence. Default `0.01`. */
977
+ silenceThreshold?: number;
978
+ /** The thread to converse on — shared with the agent's text turns. May be a plain value or accessor (resolved when the call opens). */
979
+ threadKey: MaybeAccessor<string>;
980
+ /** The generated `api.agents.<name>Voice` reference — identifies the voice DO endpoint. */
981
+ voice: VoiceReference;
982
+ }
983
+ interface CreateVoiceAgentResult {
984
+ /** The current input RMS (0–1) — drive a mic level meter. */
985
+ audioLevel: Accessor<number>;
986
+ /** `true` once the WS `ready` handshake completed. */
987
+ connected: Accessor<boolean>;
988
+ /** Tear down the call: close the socket, stop the mic, release audio. Idempotent. */
989
+ endCall: () => void;
990
+ /** The last transport/pipeline error, or `undefined`. */
991
+ error: Accessor<Error | undefined>;
992
+ /** The live assistant text for the in-flight turn (grows via deltas; finalized on done). */
993
+ interimTranscript: Accessor<string>;
994
+ /** `true` while the mic is muted. */
995
+ isMuted: Accessor<boolean>;
996
+ /** Send a typed turn (no audio) — a text message spoken back by the agent. */
997
+ sendText: (text: string) => void;
998
+ /** Open the mic, connect the socket, and start the conversation. Idempotent while active. */
999
+ startCall: () => Promise<void>;
1000
+ /** The current call lifecycle. */
1001
+ status: Accessor<VoiceStatus>;
1002
+ /** Mute/unmute the microphone. Returns the new muted state. */
1003
+ toggleMute: () => boolean;
1004
+ /** The last finalized user utterance (STT result). */
1005
+ transcript: Accessor<string>;
1006
+ }
1007
+ /**
1008
+ * A first-class voice-call surface for a voice-enabled agent: it opens a
1009
+ * WebSocket to the agent's `VoiceSessionDO`, captures mic audio as 16 kHz PCM,
1010
+ * streams the agent's synthesized speech back through the browser's audio output,
1011
+ * and mirrors the call lifecycle (`status`, `transcript`, `interimTranscript`,
1012
+ * `audioLevel`) to Solid signals. Pass the generated `api.agents.<name>Voice`
1013
+ * reference (never a string), matching `createAgentChat`'s reference-passing style.
1014
+ * The Solid counterpart to React's `useVoiceAgent`, re-expressed with signals; the
1015
+ * per-call connection lives in a closure variable (a primitive runs once per
1016
+ * component, so no signal-of-signal indirection is needed).
1017
+ *
1018
+ * v1 transport is plain binary WebSocket frames with push-to-talk / silence-timer
1019
+ * turn detection and client-side RMS barge-in. The heavy Web Audio capture and
1020
+ * playback subsystems are injectable (`createMicrophone` / `createSpeaker` /
1021
+ * `createSocket`) so the primitive is drivable outside a browser.
1022
+ */
1023
+ declare const createVoiceAgent: (options: CreateVoiceAgentOptions) => CreateVoiceAgentResult;
1024
+ /**
1025
+ * Hydrate a query from a {@link Preloaded} token produced by `preloadQuery`
1026
+ * during SSR, then keep it live.
1027
+ *
1028
+ * This is the client half of PLAN4's "your loaders are live" handoff. The
1029
+ * returned accessor is seeded **synchronously** from `preloaded.value`, so the
1030
+ * very first read — during hydration — returns the server-rendered value with
1031
+ * no loading flash and no `Suspense` fallback (unlike `createResource`, which
1032
+ * always starts pending). Once the component mounts, a WebSocket subscription
1033
+ * attaches and every subsequent server delta flows into the same signal, so the
1034
+ * UI goes live with zero refetch.
1035
+ *
1036
+ * ```tsx
1037
+ * // route loader (server): const preloaded = await preloadQuery(client, api.messages.list, args);
1038
+ * const messages = hydratePreloaded(preloaded); // seeded from SSR, then live
1039
+ * return <pre>{JSON.stringify(messages())}</pre>;
1040
+ * ```
1041
+ *
1042
+ * Mount callbacks do not run on the server during SSR (both Solid majors defer
1043
+ * them until after hydration), so the subscription is strictly client-side —
1044
+ * the seed is the only value the server render ever sees.
1045
+ */
377
1046
  declare const hydratePreloaded: <T>(preloaded: Preloaded<T>) => Accessor<T>;
378
1047
  interface LunoraProviderProps {
379
- children: JSX.Element;
1048
+ children: SolidChildren;
380
1049
  /**
381
- * The framework-neutral transport. Build it once at the app root with
382
- * `new LunoraClient({ url })` (or `createServerClient` during SSR) and pass
383
- * it here — the provider does not own its lifecycle, so the same instance
384
- * survives across route navigations.
385
- */
1050
+ * The framework-neutral transport. Build it once at the app root with
1051
+ * `new LunoraClient({ url })` (or `createServerClient` during SSR) and pass
1052
+ * it here — the provider does not own its lifecycle, so the same instance
1053
+ * survives across route navigations.
1054
+ */
386
1055
  client: LunoraClient;
387
1056
  }
388
1057
  /**
389
- * Provides a {@link LunoraClient} to the Solid tree via {@link LunoraContext}.
390
- *
391
- * Solid's context is reactive-graph scoped rather than render scoped, so unlike
392
- * the React provider there is no QueryClient to detect or lazily create — the
393
- * adapter's reactive primitives (`createQuery`, `createMutation`,
394
- * `hydratePreloaded`) own their own signals and read the client straight from
395
- * context. Drop one of these at the root of your app:
396
- *
397
- * ```tsx
398
- * const client = new LunoraClient({ url: window.location.origin });
399
- *
400
- * render(() => (
401
- * &lt;LunoraProvider client={client}>
402
- * &lt;App />
403
- * &lt;/LunoraProvider>
404
- * ), root);
405
- * ```
406
- */
407
- declare const LunoraProvider: (props: LunoraProviderProps) => JSX.Element;
408
- export { AuthLoading, Authenticated, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreatePaginatedQueryOptions, type CreatePaginatedQueryResult, type CreatePresenceOptions, type CreatePresenceResult, type CreateQueryOptions, type CreateRateLimitOptions, type CreateRateLimitResult, type CreateSubscriptionResult, type FlagContext, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraContext, LunoraProvider, type LunoraProviderProps, type MutationClient, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAuthResult, createAuth, createConnectionStatus, createFlag, createFlags, createInfiniteQuery, createMutation, createMutationForClient, createMutator, createPaginatedQuery, createPresence, createQuery, createRateLimit, createSubscription, hydratePreloaded, useLunora };
1058
+ * Provides a {@link LunoraClient} to the Solid tree via {@link LunoraContext}.
1059
+ *
1060
+ * Solid's context is reactive-graph scoped rather than render scoped, so unlike
1061
+ * the React provider there is no QueryClient to detect or lazily create — the
1062
+ * adapter's reactive primitives (`createQuery`, `createMutation`,
1063
+ * `hydratePreloaded`) own their own signals and read the client straight from
1064
+ * context. Drop one of these at the root of your app:
1065
+ *
1066
+ * ```tsx
1067
+ * const client = new LunoraClient({ url: window.location.origin });
1068
+ *
1069
+ * render(() => (
1070
+ * <LunoraProvider client={client}>
1071
+ * <App />
1072
+ * </LunoraProvider>
1073
+ * ), root);
1074
+ * ```
1075
+ *
1076
+ * Written with `createComponent` rather than JSX on purpose. Solid 1.x and 2.0
1077
+ * compile JSX against different runtimes (`solid-js/web` vs `@solidjs/web`), so
1078
+ * a JSX source file would force this package to ship two builds; `createComponent`
1079
+ * is exported from the `solid-js` root in both majors, and the provider component
1080
+ * itself is resolved per-major by {@link providerOf}. The `get` accessors keep
1081
+ * both props lazy, so swapping the `client` prop re-provides the new value to
1082
+ * descendants exactly as the JSX form did.
1083
+ */
1084
+ declare const LunoraProvider: (props: LunoraProviderProps) => SolidElement;
1085
+ export { type ActionClient, type ActionHandle, type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type CreateAgentApi, type CreateAgentChatApi, type CreateAgentChatOptions, type CreateAgentChatResult, type CreateAgentOptions, type CreateAgentResult, type CreateAgentStateApi, type CreateAgentStateOptions, type CreateAgentStateResult, type CreateAgentToolEventsApi, type CreateAgentToolEventsOptions, type CreateAgentToolEventsResult, type CreateInfiniteQueryOptions, type CreateInfiniteQueryResult, type CreatePaginatedQueryOptions, type CreatePaginatedQueryResult, type CreatePresenceOptions, type CreatePresenceResult, type CreateQueryOptions, type CreateRateLimitOptions, type CreateRateLimitResult, type CreateStreamOptions, type CreateStreamResult, type CreateStreamStatus, type CreateSubscriptionResult, type CreateVoiceAgentOptions, type CreateVoiceAgentResult, type FlagValue, type HeartbeatReference, type ListPresentReference, LunoraContext, LunoraProvider,
1086
+ /**
1087
+ * SolidJS adapter for Lunora.
1088
+ *
1089
+ * Thin, idiomatic glue over the framework-neutral `@lunora/client`. Solid's
1090
+ * fine-grained signals map directly onto Lunora's per-subscription deltas, so a
1091
+ * live query is just a signal the WebSocket writes to. The adapter exposes
1092
+ * `LunoraProvider` / `useLunora` (context carrying the `LunoraClient`),
1093
+ * `createQuery` (a live query accessor that opens a subscription and updates on
1094
+ * every delta), `createMutation` (an optimistic mutation handle), and
1095
+ * `hydratePreloaded` (seed a query from an SSR `Preloaded` token synchronously —
1096
+ * no loading flash — then attach the live subscription; the client half of
1097
+ * PLAN4's "your loaders are live" reactive-loader handoff).
1098
+ *
1099
+ * Server-side preloading (`createServerClient`, `preloadQuery`) lives in the
1100
+ * socket-free `@lunora/solid/server` entry (a re-export of `@lunora/client/ssr`, the
1101
+ * framework-neutral server contract) — call it from your SolidStart route loader
1102
+ * and hand the resulting `Preloaded` token to `hydratePreloaded`.
1103
+ */
1104
+ type LunoraProviderProps, type MutationClient, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, type SolidChildren, Unauthenticated, type UseAuthResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, createAction, createActionForClient, createAgent, createAgentChat, createAgentState, createAgentToolEvents, createAuth, createConnectionStatus, createFlag, createFlags, createInfiniteQuery, createMutation, createMutationForClient, createMutator, createPaginatedQuery, createPresence, createQuery, createRateLimit, createStream, createSubscription, createVoiceAgent, hydratePreloaded, useLunora };