@lunora/vue 1.0.0-alpha.39 → 1.0.0-alpha.40

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 (3) hide show
  1. package/dist/index.d.mts +436 -447
  2. package/dist/index.d.ts +436 -447
  3. package/package.json +5 -5
package/dist/index.d.mts CHANGED
@@ -5,67 +5,67 @@ import { PaginationStatus } from '@lunora/client/pagination';
5
5
  export type { PaginationResult, PaginationStatus } from '@lunora/client/pagination';
6
6
  import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
7
7
  /**
8
- * Render the default slot only after auth has settled and a token + user are
9
- * both present. Hides the slot on first render and when signed out.
10
- */
8
+ * Render the default slot only after auth has settled and a token + user are
9
+ * both present. Hides the slot on first render and when signed out.
10
+ */
11
11
  declare const Authenticated: Component;
12
12
  /**
13
- * Render the default slot only when auth has settled and no token is present
14
- * (the signed-out state). Hidden while the user is still loading.
15
- */
13
+ * Render the default slot only when auth has settled and no token is present
14
+ * (the signed-out state). Hidden while the user is still loading.
15
+ */
16
16
  declare const Unauthenticated: Component;
17
17
  /**
18
- * Render the default slot while authentication is still in progress — token is
19
- * set but `getCurrentUser()` has not yet resolved.
20
- */
18
+ * Render the default slot while authentication is still in progress — token is
19
+ * set but `getCurrentUser()` has not yet resolved.
20
+ */
21
21
  declare const AuthLoading: Component;
22
22
  /**
23
- * Hydrate a query from a {@link Preloaded} token produced by `preloadQuery`
24
- * during SSR, then keep it live — the Vue half of PLAN4's reactive-loader
25
- * handoff.
26
- *
27
- * The returned `ref` is seeded **synchronously** from `preloaded.value`, so the
28
- * very first read (during hydration) shows the server value: no loading flash,
29
- * no hydration mismatch. After seeding it opens a WebSocket subscription on the
30
- * same `(functionPath, args, shardKey)` the SSR loader used, so every later
31
- * server delta updates the ref exactly like `useQuery`.
32
- *
33
- * The subscription tears down with the surrounding effect scope (component
34
- * unmount or `effectScope().stop()`), inherited from `subscribeToQuery`.
35
- */
23
+ * Hydrate a query from a {@link Preloaded} token produced by `preloadQuery`
24
+ * during SSR, then keep it live — the Vue half of PLAN4's reactive-loader
25
+ * handoff.
26
+ *
27
+ * The returned `ref` is seeded **synchronously** from `preloaded.value`, so the
28
+ * very first read (during hydration) shows the server value: no loading flash,
29
+ * no hydration mismatch. After seeding it opens a WebSocket subscription on the
30
+ * same `(functionPath, args, shardKey)` the SSR loader used, so every later
31
+ * server delta updates the ref exactly like `useQuery`.
32
+ *
33
+ * The subscription tears down with the surrounding effect scope (component
34
+ * unmount or `effectScope().stop()`), inherited from `subscribeToQuery`.
35
+ */
36
36
  declare const hydratePreloaded: <T>(preloaded: Preloaded<T>) => Ref<T | undefined>;
37
37
  /**
38
- * Injection key carrying the {@link LunoraClient} down the component tree.
39
- * Exported so advanced consumers can inject it by hand; most apps use
40
- * {@link createLunora} or {@link provideLunora}.
41
- */
38
+ * Injection key carrying the {@link LunoraClient} down the component tree.
39
+ * Exported so advanced consumers can inject it by hand; most apps use
40
+ * {@link createLunora} or {@link provideLunora}.
41
+ */
42
42
  declare const LUNORA_INJECTION_KEY: InjectionKey<LunoraClient>;
43
43
  /**
44
- * Vue plugin form: `app.use(createLunora(client))`. Mirrors the React
45
- * `LunoraProvider` — establishes the single app-wide client every composable
46
- * resolves through {@link useLunora}.
47
- *
48
- * The client is framework-neutral (`@lunora/client`): it owns the WebSocket
49
- * transport, subscription registry, offline queue, and delta-merge. This plugin
50
- * only wires it into Vue's `provide`/`inject` graph (read it with
51
- * {@link useLunora}); it adds no React, no store, and no extra reactivity layer.
52
- */
44
+ * Vue plugin form: `app.use(createLunora(client))`. Mirrors the React
45
+ * `LunoraProvider` — establishes the single app-wide client every composable
46
+ * resolves through {@link useLunora}.
47
+ *
48
+ * The client is framework-neutral (`@lunora/client`): it owns the WebSocket
49
+ * transport, subscription registry, offline queue, and delta-merge. This plugin
50
+ * only wires it into Vue's `provide`/`inject` graph (read it with
51
+ * {@link useLunora}); it adds no React, no store, and no extra reactivity layer.
52
+ */
53
53
  declare const createLunora: (client: LunoraClient) => {
54
54
  install: (app: App) => void;
55
55
  };
56
56
  /**
57
- * Composition-API form: call inside a parent component's `setup()` to provide
58
- * the client to its subtree. The counterpart to `app.use(createLunora(client))`
59
- * when you'd rather scope the client to a subtree than the whole app. Must run
60
- * synchronously inside `setup()` (Vue's `provide` constraint).
61
- */
57
+ * Composition-API form: call inside a parent component's `setup()` to provide
58
+ * the client to its subtree. The counterpart to `app.use(createLunora(client))`
59
+ * when you'd rather scope the client to a subtree than the whole app. Must run
60
+ * synchronously inside `setup()` (Vue's `provide` constraint).
61
+ */
62
62
  declare const provideLunora: (client: LunoraClient) => void;
63
63
  /**
64
- * Read the {@link LunoraClient} from the nearest provider — the Vue counterpart
65
- * to `@lunora/react`/`@lunora/solid`'s `useLunora`. Throws with a clear message
66
- * when called outside a `createLunora`/`provideLunora` scope so the failure
67
- * points at the missing provider rather than a later `undefined` deref.
68
- */
64
+ * Read the {@link LunoraClient} from the nearest provider — the Vue counterpart
65
+ * to `@lunora/react`/`@lunora/solid`'s `useLunora`. Throws with a clear message
66
+ * when called outside a `createLunora`/`provideLunora` scope so the failure
67
+ * points at the missing provider rather than a later `undefined` deref.
68
+ */
69
69
  declare const useLunora: () => LunoraClient;
70
70
  /** Options shared by the live-query composables. */
71
71
  interface UseQueryOptions {
@@ -73,19 +73,19 @@ interface UseQueryOptions {
73
73
  shardKey?: string;
74
74
  }
75
75
  /**
76
- * The lifecycle status stored on an agent thread. Client-safe mirror of
77
- * `@lunora/agent`'s `AgentThreadStatus` — re-declared here (rather than imported)
78
- * so this Vue entry never pulls in the server-only `@lunora/agent` module graph
79
- * (the adapter stays Vue + `@lunora/client` only). Keep in sync with
80
- * `packages/agent/src/types.ts`.
81
- */
76
+ * The lifecycle status stored on an agent thread. Client-safe mirror of
77
+ * `@lunora/agent`'s `AgentThreadStatus` — re-declared here (rather than imported)
78
+ * so this Vue entry never pulls in the server-only `@lunora/agent` module graph
79
+ * (the adapter stays Vue + `@lunora/client` only). Keep in sync with
80
+ * `packages/agent/src/types.ts`.
81
+ */
82
82
  type AgentThreadStatus = "awaiting_input" | "cancelled" | "error" | "idle" | "running";
83
83
  /**
84
- * The live thread record surfaced by the `agents:agentThread` query. A structural
85
- * subset of the persisted thread row — every field beyond `status` is optional so
86
- * the shape stays forgiving as the server schema grows. Keep in sync with the
87
- * `agent_threads` table in `packages/agent/src/component.ts`.
88
- */
84
+ * The live thread record surfaced by the `agents:agentThread` query. A structural
85
+ * subset of the persisted thread row — every field beyond `status` is optional so
86
+ * the shape stays forgiving as the server schema grows. Keep in sync with the
87
+ * `agent_threads` table in `packages/agent/src/component.ts`.
88
+ */
89
89
  interface AgentThreadRecord {
90
90
  createdAt?: number;
91
91
  /** The failure message when `status === "error"`. */
@@ -100,11 +100,11 @@ interface AgentThreadRecord {
100
100
  updatedAt?: number;
101
101
  }
102
102
  /**
103
- * The `agents.agentThread` reference the composable subscribes to for live thread
104
- * state (status + the in-flight `instanceId`). A structural subset of the
105
- * generated `api.agents` surface, so the whole generated `api` object is
106
- * assignable.
107
- */
103
+ * The `agents.agentThread` reference the composable subscribes to for live thread
104
+ * state (status + the in-flight `instanceId`). A structural subset of the
105
+ * generated `api.agents` surface, so the whole generated `api` object is
106
+ * assignable.
107
+ */
108
108
  interface UseAgentApi {
109
109
  agents: {
110
110
  agentThread: FunctionReference<"query", {
@@ -116,17 +116,17 @@ interface UseAgentOptions {
116
116
  /** The generated `api` — its `agents.agentThread` query drives live thread state. */
117
117
  api: UseAgentApi;
118
118
  /**
119
- * Optional app mutation over the agent's cancel path
120
- * (`ctx.agents.&lt;name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
121
- * When omitted (or no run is in flight) {@link UseAgentResult.cancel} is a
122
- * no-op.
123
- */
119
+ * Optional app mutation over the agent's cancel path
120
+ * (`ctx.agents.&lt;name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
121
+ * When omitted (or no run is in flight) {@link UseAgentResult.cancel} is a
122
+ * no-op.
123
+ */
124
124
  cancel?: FunctionReference<"mutation">;
125
125
  /**
126
- * The app mutation that starts (or continues) a run — a thin wrapper over
127
- * `ctx.agents.&lt;name>.run(...)`. Called with `{ threadKey, input }` merged with
128
- * {@link UseAgentOptions.runArgs} and the per-call args.
129
- */
126
+ * The app mutation that starts (or continues) a run — a thin wrapper over
127
+ * `ctx.agents.&lt;name>.run(...)`. Called with `{ threadKey, input }` merged with
128
+ * {@link UseAgentOptions.runArgs} and the per-call args.
129
+ */
130
130
  run: FunctionReference<"mutation">;
131
131
  /** Extra args merged into every `run` call (e.g. an `owner` or `title`). */
132
132
  runArgs?: Record<string, unknown>;
@@ -135,9 +135,9 @@ interface UseAgentOptions {
135
135
  }
136
136
  interface UseAgentResult {
137
137
  /**
138
- * Terminate the in-flight run and mark its thread `"cancelled"`. Resolves as a
139
- * no-op when no `cancel` mutation was supplied or no run is in flight.
140
- */
138
+ * Terminate the in-flight run and mark its thread `"cancelled"`. Resolves as a
139
+ * no-op when no `cancel` mutation was supplied or no run is in flight.
140
+ */
141
141
  cancel: () => Promise<void>;
142
142
  /** `true` while a `run` invocation is in flight. */
143
143
  pending: Readonly<Ref<boolean>>;
@@ -149,38 +149,32 @@ interface UseAgentResult {
149
149
  thread: ComputedRef<AgentThreadRecord | undefined>;
150
150
  }
151
151
  /**
152
- * A placeholder mutation reference so `useMutation` is called unconditionally even
153
- * when the caller supplies no `cancel` mutation. Its `__lunoraRef` is never
154
- * dispatched `cancel()` short-circuits before invoking it unless a real
155
- * reference was provided.
156
- */
157
- /**
158
- * A thin agent handle: live thread `status` plus `run` / `cancel`, without the
159
- * chat message surface. Composes `useSubscription(api.agents.agentThread)` for
160
- * live state and `useMutation` for the run/cancel writes the Vue counterpart to
161
- * React's `useAgent`, re-expressed with refs. For the full conversation surface
162
- * (durable history + streaming + approvals) use `useAgentChat`.
163
- *
164
- * `run` and `cancel` stay generic over the app-defined mutations that wrap
165
- * `ctx.agents.&lt;name>.run` / `.cancel`, so the composable hard-codes no function
166
- * names beyond the `agents:*` surface. `threadKey` may be reactive — a changing
167
- * key re-subscribes to the new thread.
168
- */
152
+ * A thin agent handle: live thread `status` plus `run` / `cancel`, without the
153
+ * chat message surface. Composes `useSubscription(api.agents.agentThread)` for
154
+ * live state and `useMutation` for the run/cancel writes the Vue counterpart to
155
+ * React's `useAgent`, re-expressed with refs. For the full conversation surface
156
+ * (durable history + streaming + approvals) use `useAgentChat`.
157
+ *
158
+ * `run` and `cancel` stay generic over the app-defined mutations that wrap
159
+ * `ctx.agents.&lt;name>.run` / `.cancel`, so the composable hard-codes no function
160
+ * names beyond the `agents:*` surface. `threadKey` may be reactivea changing
161
+ * key re-subscribes to the new thread.
162
+ */
169
163
  declare const useAgent: (options: UseAgentOptions) => UseAgentResult;
170
164
  /**
171
- * One persisted (or optimistic) thread message, as `agents:agentMessages`
172
- * surfaces it. Client-safe mirror of `@lunora/agent`'s `AgentMessageRow` —
173
- * re-declared here (rather than imported) so this Vue entry never pulls in the
174
- * server-only `@lunora/agent` module graph. Keep in sync with the
175
- * `agent_messages` table in `packages/agent/src/component.ts`.
176
- */
165
+ * One persisted (or optimistic) thread message, as `agents:agentMessages`
166
+ * surfaces it. Client-safe mirror of `@lunora/agent`'s `AgentMessageRow` —
167
+ * re-declared here (rather than imported) so this Vue entry never pulls in the
168
+ * server-only `@lunora/agent` module graph. Keep in sync with the
169
+ * `agent_messages` table in `packages/agent/src/component.ts`.
170
+ */
177
171
  interface AgentChatMessage {
178
172
  content: string;
179
173
  createdAt?: number;
180
174
  /**
181
- * `true` for a client-side optimistic user message not yet acknowledged by
182
- * the server. Cleared once the durable history carries the matching user turn.
183
- */
175
+ * `true` for a client-side optimistic user message not yet acknowledged by
176
+ * the server. Cleared once the durable history carries the matching user turn.
177
+ */
184
178
  optimistic?: boolean;
185
179
  role: "assistant" | "system" | "tool" | "user";
186
180
  seq: number;
@@ -195,11 +189,11 @@ interface AgentChatMessage {
195
189
  toolName?: string;
196
190
  }
197
191
  /**
198
- * A live token delta streamed while a turn is generating. Client-safe mirror of
199
- * `@lunora/agent`'s `AgentTokenDelta`. Ephemeral — deltas feed
200
- * {@link UseAgentChatResult.streamingText} live and are never replayed; the
201
- * persisted assistant message stays the single source of truth.
202
- */
192
+ * A live token delta streamed while a turn is generating. Client-safe mirror of
193
+ * `@lunora/agent`'s `AgentTokenDelta`. Ephemeral — deltas feed
194
+ * {@link UseAgentChatResult.streamingText} live and are never replayed; the
195
+ * persisted assistant message stays the single source of truth.
196
+ */
203
197
  interface AgentTokenDelta {
204
198
  /** Discriminates the token arm of {@link AgentLiveEvent}; unset on the wire (token is the default). */
205
199
  kind?: "token";
@@ -211,10 +205,10 @@ interface AgentTokenDelta {
211
205
  turn: number;
212
206
  }
213
207
  /**
214
- * A live tool-progress event streamed via `ctx.reportProgress(...)`. Client-safe
215
- * mirror of `@lunora/agent`'s `AgentProgressEvent`. Ephemeral and `toolCallId`-keyed;
216
- * surfaced by `useAgentToolEvents`, ignored by {@link UseAgentChatResult.streamingText}.
217
- */
208
+ * A live tool-progress event streamed via `ctx.reportProgress(...)`. Client-safe
209
+ * mirror of `@lunora/agent`'s `AgentProgressEvent`. Ephemeral and `toolCallId`-keyed;
210
+ * surfaced by `useAgentToolEvents`, ignored by {@link UseAgentChatResult.streamingText}.
211
+ */
218
212
  interface AgentProgressEvent {
219
213
  /** The arbitrary, JSON-serializable payload the tool reported. */
220
214
  data: unknown;
@@ -226,11 +220,11 @@ interface AgentProgressEvent {
226
220
  toolCallId: string;
227
221
  }
228
222
  /**
229
- * A single event on the agent's live-only channel — a streamed token delta or a
230
- * tool progress event. Client-safe mirror of `@lunora/agent`'s `AgentLiveEvent`.
231
- * Discriminate on `kind` (`"progress"` for the progress arm; token deltas leave
232
- * it unset).
233
- */
223
+ * A single event on the agent's live-only channel — a streamed token delta or a
224
+ * tool progress event. Client-safe mirror of `@lunora/agent`'s `AgentLiveEvent`.
225
+ * Discriminate on `kind` (`"progress"` for the progress arm; token deltas leave
226
+ * it unset).
227
+ */
234
228
  type AgentLiveEvent = AgentProgressEvent | AgentTokenDelta;
235
229
  /** The `agents:agentMessages` reference — live durable thread history. */
236
230
  type AgentMessagesReference$1 = FunctionReference<"query", {
@@ -252,18 +246,18 @@ type AgentThreadReference = FunctionReference<"query", {
252
246
  key: string;
253
247
  }, Record<string, unknown> | undefined>;
254
248
  /**
255
- * An app stream reference that tees the agent's in-flight live events, keyed by
256
- * thread. Carries token deltas and — since `ctx.reportProgress` rides the same
257
- * sink — tool progress events; this composable consumes only the token arm.
258
- */
249
+ * An app stream reference that tees the agent's in-flight live events, keyed by
250
+ * thread. Carries token deltas and — since `ctx.reportProgress` rides the same
251
+ * sink — tool progress events; this composable consumes only the token arm.
252
+ */
259
253
  type AgentTokenStreamReference = FunctionReference<"stream", {
260
254
  key: string;
261
255
  }, AgentLiveEvent>;
262
256
  /**
263
- * The `agents.*` reference surface the chat composable reads. A structural subset
264
- * of the generated `api.agents`, so the whole generated `api` object is
265
- * assignable.
266
- */
257
+ * The `agents.*` reference surface the chat composable reads. A structural subset
258
+ * of the generated `api.agents`, so the whole generated `api` object is
259
+ * assignable.
260
+ */
267
261
  interface UseAgentChatApi {
268
262
  agents: {
269
263
  agentMessages: AgentMessagesReference$1;
@@ -275,27 +269,27 @@ interface UseAgentChatOptions {
275
269
  /** The generated `api` — its `agents.*` surface provides history, thread state, and approval resolution. */
276
270
  api: UseAgentChatApi;
277
271
  /**
278
- * Optional app mutation over the agent's cancel path
279
- * (`ctx.agents.&lt;name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
280
- * When omitted (or no run is in flight) {@link UseAgentChatResult.cancel} is a
281
- * no-op.
282
- */
272
+ * Optional app mutation over the agent's cancel path
273
+ * (`ctx.agents.&lt;name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
274
+ * When omitted (or no run is in flight) {@link UseAgentChatResult.cancel} is a
275
+ * no-op.
276
+ */
283
277
  cancel?: FunctionReference<"mutation">;
284
278
  /** History depth forwarded to `agents:agentMessages`. */
285
279
  limit?: number;
286
280
  /**
287
- * The app mutation that starts (or continues) a run — a thin wrapper over
288
- * `ctx.agents.&lt;name>.run(...)`. Called with `{ threadKey, input }` merged with
289
- * {@link UseAgentChatOptions.sendArgs} and the per-call args.
290
- */
281
+ * The app mutation that starts (or continues) a run — a thin wrapper over
282
+ * `ctx.agents.&lt;name>.run(...)`. Called with `{ threadKey, input }` merged with
283
+ * {@link UseAgentChatOptions.sendArgs} and the per-call args.
284
+ */
291
285
  send: FunctionReference<"mutation">;
292
286
  /** Extra args merged into every `send` call (e.g. an `owner` or `title`). */
293
287
  sendArgs?: Record<string, unknown>;
294
288
  /**
295
- * Optional live token-delta stream — an app stream function that tees the
296
- * agent's in-flight deltas. When omitted {@link UseAgentChatResult.streamingText}
297
- * stays empty and the UI updates message-by-message from durable history.
298
- */
289
+ * Optional live token-delta stream — an app stream function that tees the
290
+ * agent's in-flight deltas. When omitted {@link UseAgentChatResult.streamingText}
291
+ * stays empty and the UI updates message-by-message from durable history.
292
+ */
299
293
  stream?: AgentTokenStreamReference;
300
294
  /** The thread to observe and continue — may be a plain value, `ref`, or getter (a reactive source re-subscribes). */
301
295
  threadKey: MaybeRefOrGetter<string>;
@@ -304,9 +298,9 @@ interface UseAgentChatResult {
304
298
  /** Approve a paused human-in-the-loop tool call (optionally with a note). */
305
299
  approve: (toolCallId: string, note?: string) => Promise<void>;
306
300
  /**
307
- * Terminate the in-flight run and mark its thread `"cancelled"`. Resolves as a
308
- * no-op when no `cancel` mutation was supplied or no run is in flight.
309
- */
301
+ * Terminate the in-flight run and mark its thread `"cancelled"`. Resolves as a
302
+ * no-op when no `cancel` mutation was supplied or no run is in flight.
303
+ */
310
304
  cancel: () => Promise<void>;
311
305
  /** Durable thread history (oldest first) plus any un-acknowledged optimistic user turns. */
312
306
  messages: ComputedRef<ReadonlyArray<AgentChatMessage>>;
@@ -320,34 +314,34 @@ interface UseAgentChatResult {
320
314
  streamingText: ComputedRef<string>;
321
315
  }
322
316
  /**
323
- * A first-class agent chat surface: live durable history + in-flight token
324
- * streaming + the send / approve / reject / cancel writes, keyed by `threadKey` —
325
- * the Vue counterpart to React's `useAgentChat`, re-expressed with refs.
326
- *
327
- * It composes the existing primitives rather than adding transport:
328
- * `useSubscription(api.agents.agentMessages)` for durable history,
329
- * `useSubscription(api.agents.agentThread)` for live status + the in-flight
330
- * `instanceId`, {@link useStream} over an app token stream for in-flight deltas,
331
- * and `useMutation` for the writes (`api.agents.agentResolveApproval` for
332
- * approvals; app-defined wrappers for `send`/`cancel`). Only the `agents:*`
333
- * surface is hard-coded — `send`/`cancel`/`stream` stay generic references.
334
- *
335
- * A `send` optimistically appends the user turn so it renders immediately; the
336
- * optimistic row clears once the durable history carries the acknowledged turn.
337
- * `streamingText` is live-only: it holds the current turn's streamed text and
338
- * empties as soon as that turn's assistant message lands in `messages` (the
339
- * persisted message is the source of truth), consistent with the loop's
340
- * replay-safe, live-only delta design.
341
- */
317
+ * A first-class agent chat surface: live durable history + in-flight token
318
+ * streaming + the send / approve / reject / cancel writes, keyed by `threadKey` —
319
+ * the Vue counterpart to React's `useAgentChat`, re-expressed with refs.
320
+ *
321
+ * It composes the existing primitives rather than adding transport:
322
+ * `useSubscription(api.agents.agentMessages)` for durable history,
323
+ * `useSubscription(api.agents.agentThread)` for live status + the in-flight
324
+ * `instanceId`, {@link useStream} over an app token stream for in-flight deltas,
325
+ * and `useMutation` for the writes (`api.agents.agentResolveApproval` for
326
+ * approvals; app-defined wrappers for `send`/`cancel`). Only the `agents:*`
327
+ * surface is hard-coded — `send`/`cancel`/`stream` stay generic references.
328
+ *
329
+ * A `send` optimistically appends the user turn so it renders immediately; the
330
+ * optimistic row clears once the durable history carries the acknowledged turn.
331
+ * `streamingText` is live-only: it holds the current turn's streamed text and
332
+ * empties as soon as that turn's assistant message lands in `messages` (the
333
+ * persisted message is the source of truth), consistent with the loop's
334
+ * replay-safe, live-only delta design.
335
+ */
342
336
  declare const useAgentChat: (options: UseAgentChatOptions) => UseAgentChatResult;
343
337
  /**
344
- * The `agents.agentState` reference the composable subscribes to for the thread's
345
- * live synced state. A structural subset of the generated `api.agents` surface
346
- * (like `UseAgentApi` for `agentThread`), so the whole generated `api` object is
347
- * assignable. Client-safe: no `@lunora/agent` import — the per-agent state type is
348
- * mirrored by the composable's generic `T`, since codegen pins the reference
349
- * return as an optional record (it never evaluates agent config).
350
- */
338
+ * The `agents.agentState` reference the composable subscribes to for the thread's
339
+ * live synced state. A structural subset of the generated `api.agents` surface
340
+ * (like `UseAgentApi` for `agentThread`), so the whole generated `api` object is
341
+ * assignable. Client-safe: no `@lunora/agent` import — the per-agent state type is
342
+ * mirrored by the composable's generic `T`, since codegen pins the reference
343
+ * return as an optional record (it never evaluates agent config).
344
+ */
351
345
  interface UseAgentStateApi {
352
346
  agents: {
353
347
  agentState: FunctionReference<"query", {
@@ -368,22 +362,22 @@ interface UseAgentStateResult<T> {
368
362
  state: ComputedRef<T | undefined>;
369
363
  }
370
364
  /**
371
- * Subscribe to an agent thread's synced state — the `setState`-style value a tool
372
- * writes with `ctx.setState(...)`, seeded by `defineAgent({ initialState })`. A
373
- * thin wrapper over `useSubscription(api.agents.agentState, { key })`: the server
374
- * pushes a fresh frame whenever the state changes (the dedicated query's
375
- * per-socket JSON memo suppresses no-op pushes on unrelated thread writes), so
376
- * `state` updates only on a real `setState`. The Vue counterpart to React's
377
- * `useAgentState`, re-expressed with refs.
378
- *
379
- * Generic over the app's state shape (`useAgentState` with a `SupportState` type
380
- * argument, itself a record) — the reference is typed as an optional record
381
- * because codegen cannot see the per-agent state type; the generic casts to `T`.
382
- * The `extends` bound (not
383
- * a bare unbounded type parameter) is required: this `.ts` file is parsed
384
- * JSX-aware by the bundler, where an unbounded type-param arrow is ambiguous with
385
- * a JSX element.
386
- */
365
+ * Subscribe to an agent thread's synced state — the `setState`-style value a tool
366
+ * writes with `ctx.setState(...)`, seeded by `defineAgent({ initialState })`. A
367
+ * thin wrapper over `useSubscription(api.agents.agentState, { key })`: the server
368
+ * pushes a fresh frame whenever the state changes (the dedicated query's
369
+ * per-socket JSON memo suppresses no-op pushes on unrelated thread writes), so
370
+ * `state` updates only on a real `setState`. The Vue counterpart to React's
371
+ * `useAgentState`, re-expressed with refs.
372
+ *
373
+ * Generic over the app's state shape (`useAgentState` with a `SupportState` type
374
+ * argument, itself a record) — the reference is typed as an optional record
375
+ * because codegen cannot see the per-agent state type; the generic casts to `T`.
376
+ * The `extends` bound (not
377
+ * a bare unbounded type parameter) is required: this `.ts` file is parsed
378
+ * JSX-aware by the bundler, where an unbounded type-param arrow is ambiguous with
379
+ * a JSX element.
380
+ */
387
381
  declare const useAgentState: <T extends Record<string, unknown> = Record<string, unknown>>(options: UseAgentStateOptions) => UseAgentStateResult<T>;
388
382
  /** The `agents:agentMessages` reference — live durable thread history. */
389
383
  type AgentMessagesReference = FunctionReference<"query", {
@@ -391,18 +385,18 @@ type AgentMessagesReference = FunctionReference<"query", {
391
385
  limit?: number;
392
386
  }, ReadonlyArray<Record<string, unknown>>>;
393
387
  /**
394
- * An app stream reference that tees the agent's in-flight live events, keyed by
395
- * thread. Carries token deltas and tool progress events; this composable consumes
396
- * only the progress arm (`kind === "progress"`).
397
- */
388
+ * An app stream reference that tees the agent's in-flight live events, keyed by
389
+ * thread. Carries token deltas and tool progress events; this composable consumes
390
+ * only the progress arm (`kind === "progress"`).
391
+ */
398
392
  type AgentLiveStreamReference = FunctionReference<"stream", {
399
393
  key: string;
400
394
  }, AgentLiveEvent>;
401
395
  /**
402
- * The `agents.*` reference surface the tool-events composable reads. A structural
403
- * subset of the generated `api.agents`, so the whole generated `api` object is
404
- * assignable.
405
- */
396
+ * The `agents.*` reference surface the tool-events composable reads. A structural
397
+ * subset of the generated `api.agents`, so the whole generated `api` object is
398
+ * assignable.
399
+ */
406
400
  interface UseAgentToolEventsApi {
407
401
  agents: {
408
402
  agentMessages: AgentMessagesReference;
@@ -414,21 +408,21 @@ interface UseAgentToolEventsOptions {
414
408
  /** History depth forwarded to `agents:agentMessages`. */
415
409
  limit?: number;
416
410
  /**
417
- * Optional live event stream — the same app stream function `useAgentChat`
418
- * uses. When supplied, ephemeral `ctx.reportProgress(...)` events for the
419
- * thread are surfaced as `{ type: "progress" }` entries; when omitted only the
420
- * durable lifecycle (call / result / awaiting-approval) is returned.
421
- */
411
+ * Optional live event stream — the same app stream function `useAgentChat`
412
+ * uses. When supplied, ephemeral `ctx.reportProgress(...)` events for the
413
+ * thread are surfaced as `{ type: "progress" }` entries; when omitted only the
414
+ * durable lifecycle (call / result / awaiting-approval) is returned.
415
+ */
422
416
  stream?: AgentLiveStreamReference;
423
417
  /** The thread whose tool activity to observe — may be a plain value, `ref`, or getter (a reactive source re-subscribes). */
424
418
  threadKey: MaybeRefOrGetter<string>;
425
419
  }
426
420
  /**
427
- * A single tool-lifecycle event for a thread. The durable arms
428
- * (`call`/`result`/`awaiting-approval`) are derived from `agents:agentMessages`
429
- * and carry the persisted `seq`; the ephemeral `progress` arm comes live off the
430
- * stream and has no `seq`. Discriminate on `type`.
431
- */
421
+ * A single tool-lifecycle event for a thread. The durable arms
422
+ * (`call`/`result`/`awaiting-approval`) are derived from `agents:agentMessages`
423
+ * and carry the persisted `seq`; the ephemeral `progress` arm comes live off the
424
+ * stream and has no `seq`. Discriminate on `type`.
425
+ */
432
426
  type AgentToolEvent = {
433
427
  data: unknown;
434
428
  toolCallId: string;
@@ -454,26 +448,26 @@ type AgentToolEvent = {
454
448
  };
455
449
  interface UseAgentToolEventsResult {
456
450
  /**
457
- * The thread's tool events: the durable lifecycle (oldest first, by `seq`)
458
- * followed by any in-flight ephemeral progress events, recomputed from the live
459
- * subscription + stream. Treat as derived, not identity-stable.
460
- */
451
+ * The thread's tool events: the durable lifecycle (oldest first, by `seq`)
452
+ * followed by any in-flight ephemeral progress events, recomputed from the live
453
+ * subscription + stream. Treat as derived, not identity-stable.
454
+ */
461
455
  events: ComputedRef<ReadonlyArray<AgentToolEvent>>;
462
456
  }
463
457
  /**
464
- * A focused view of a thread's tool activity: tool calls, their results,
465
- * human-in-the-loop approval pauses, and live `ctx.reportProgress(...)` events —
466
- * without the full chat message surface. The Vue counterpart to React's
467
- * `useAgentToolEvents`, re-expressed as a `computed`.
468
- *
469
- * It composes the existing primitives rather than adding transport:
470
- * `useSubscription(api.agents.agentMessages)` for the durable lifecycle and
471
- * {@link useStream} over the optional app event stream for ephemeral progress.
472
- * Progress events are live-only (the durable path never emits them): they ride
473
- * the same sink as token deltas and are surfaced here, correlated to their tool
474
- * call by `toolCallId`. For the conversational surface (messages + streaming text
475
- * + approvals) use `useAgentChat`; this composable is the tool-observability slice.
476
- */
458
+ * A focused view of a thread's tool activity: tool calls, their results,
459
+ * human-in-the-loop approval pauses, and live `ctx.reportProgress(...)` events —
460
+ * without the full chat message surface. The Vue counterpart to React's
461
+ * `useAgentToolEvents`, re-expressed as a `computed`.
462
+ *
463
+ * It composes the existing primitives rather than adding transport:
464
+ * `useSubscription(api.agents.agentMessages)` for the durable lifecycle and
465
+ * {@link useStream} over the optional app event stream for ephemeral progress.
466
+ * Progress events are live-only (the durable path never emits them): they ride
467
+ * the same sink as token deltas and are surfaced here, correlated to their tool
468
+ * call by `toolCallId`. For the conversational surface (messages + streaming text
469
+ * + approvals) use `useAgentChat`; this composable is the tool-observability slice.
470
+ */
477
471
  declare const useAgentToolEvents: (options: UseAgentToolEventsOptions) => UseAgentToolEventsResult;
478
472
  interface UseAuthResult {
479
473
  setToken: (token: string | null) => void;
@@ -481,28 +475,28 @@ interface UseAuthResult {
481
475
  user: DeepReadonly<Ref<User | null>>;
482
476
  }
483
477
  /**
484
- * Token + identity plumbing for Vue. `token` is a readonly ref tracking the
485
- * client's auth token; `user` is a readonly ref resolved from `getCurrentUser()`
486
- * whenever the token changes. `setToken(jwt)` after sign-in makes subsequent
487
- * RPC calls carry the `Authorization` header.
488
- *
489
- * Multiple `useAuth` instances within the same effect scope share a single
490
- * per-client identity store (from `@lunora/client/auth`) — a `setToken` from
491
- * one component re-renders every watcher with the freshly-resolved user.
492
- */
478
+ * Token + identity plumbing for Vue. `token` is a readonly ref tracking the
479
+ * client's auth token; `user` is a readonly ref resolved from `getCurrentUser()`
480
+ * whenever the token changes. `setToken(jwt)` after sign-in makes subsequent
481
+ * RPC calls carry the `Authorization` header.
482
+ *
483
+ * Multiple `useAuth` instances within the same effect scope share a single
484
+ * per-client identity store (from `@lunora/client/auth`) — a `setToken` from
485
+ * one component re-renders every watcher with the freshly-resolved user.
486
+ */
493
487
  declare const useAuth: () => UseAuthResult;
494
488
  /**
495
- * Reactive view of the client's aggregate live-socket status across all shard
496
- * connections, exposed as a read-only `ref`. The value transitions through
497
- * `idle` → `connecting` → `connected` → `offline` as sockets open and drop —
498
- * use it to drive a connection indicator so an operator can tell a healthy live
499
- * channel from a silently-dropped one. The Vue-idiomatic equivalent of
500
- * `@lunora/react`'s `useConnectionStatus`.
501
- *
502
- * Teardown is wired to the active effect scope (`onScopeDispose`), so the
503
- * status listener is released on component unmount (or `effectScope().stop()`).
504
- * Call inside `setup()` / an active effect scope.
505
- */
489
+ * Reactive view of the client's aggregate live-socket status across all shard
490
+ * connections, exposed as a read-only `ref`. The value transitions through
491
+ * `idle` → `connecting` → `connected` → `offline` as sockets open and drop —
492
+ * use it to drive a connection indicator so an operator can tell a healthy live
493
+ * channel from a silently-dropped one. The Vue-idiomatic equivalent of
494
+ * `@lunora/react`'s `useConnectionStatus`.
495
+ *
496
+ * Teardown is wired to the active effect scope (`onScopeDispose`), so the
497
+ * status listener is released on component unmount (or `effectScope().stop()`).
498
+ * Call inside `setup()` / an active effect scope.
499
+ */
506
500
  declare const useConnectionStatus: () => Readonly<Ref<ConnectionStatus>>;
507
501
  /** A targeting context merged on top of the app's default (`defineFlags({ identify })`). */
508
502
  type FlagContext = Record<string, unknown>;
@@ -511,43 +505,43 @@ type FlagValue = boolean | number | string | {
511
505
  [key: string]: unknown;
512
506
  } | unknown[] | null;
513
507
  /**
514
- * Subscribe to a single feature flag, live over Lunora's WebSocket.
515
- *
516
- * The returned `ref` holds `defaultValue` until the first evaluation lands, then
517
- * the server's resolved value — re-pushed whenever the provider re-evaluates
518
- * (e.g. a flag is toggled in Cloudflare Flagship). The flag's kind is inferred
519
- * from `defaultValue`'s runtime type, so `useFlag("dark", false)` reads a boolean
520
- * and `useFlag("hero", "control")` a string.
521
- *
522
- * `key` and `context` may be plain values, `ref`s, or getters: passing a reactive
523
- * source makes the subscription reactive — when it changes the old subscription
524
- * is torn down and a fresh one opens. `context` supplies a per-call targeting
525
- * context merged on top of the app's default `identify` targeting key.
526
- *
527
- * Evaluation runs through whatever OpenFeature provider the app wired in
528
- * `lunora/flags.ts`; the read never throws — a provider error resolves the
529
- * default (the same fail-open contract as server-side `ctx.flags`). Call inside
530
- * `setup()` (or any active effect scope); the subscription tears down on unmount.
531
- */
508
+ * Subscribe to a single feature flag, live over Lunora's WebSocket.
509
+ *
510
+ * The returned `ref` holds `defaultValue` until the first evaluation lands, then
511
+ * the server's resolved value — re-pushed whenever the provider re-evaluates
512
+ * (e.g. a flag is toggled in Cloudflare Flagship). The flag's kind is inferred
513
+ * from `defaultValue`'s runtime type, so `useFlag("dark", false)` reads a boolean
514
+ * and `useFlag("hero", "control")` a string.
515
+ *
516
+ * `key` and `context` may be plain values, `ref`s, or getters: passing a reactive
517
+ * source makes the subscription reactive — when it changes the old subscription
518
+ * is torn down and a fresh one opens. `context` supplies a per-call targeting
519
+ * context merged on top of the app's default `identify` targeting key.
520
+ *
521
+ * Evaluation runs through whatever OpenFeature provider the app wired in
522
+ * `lunora/flags.ts`; the read never throws — a provider error resolves the
523
+ * default (the same fail-open contract as server-side `ctx.flags`). Call inside
524
+ * `setup()` (or any active effect scope); the subscription tears down on unmount.
525
+ */
532
526
  declare const useFlag: <T extends FlagValue>(key: MaybeRefOrGetter<string>, defaultValue: T, context?: MaybeRefOrGetter<FlagContext | undefined>) => Readonly<Ref<T>>;
533
527
  /**
534
- * Subscribe to several feature flags at once, live over Lunora's WebSocket.
535
- *
536
- * Pass a record of `key → defaultValue`; each flag's kind is inferred from its
537
- * default, and the returned `ref` holds the same-shaped record with resolved
538
- * values (the defaults until each evaluation lands). A single `context` applies
539
- * to every flag and may be reactive. This is the batched form of {@link useFlag}
540
- * — one watcher manages one subscription per key.
541
- */
528
+ * Subscribe to several feature flags at once, live over Lunora's WebSocket.
529
+ *
530
+ * Pass a record of `key → defaultValue`; each flag's kind is inferred from its
531
+ * default, and the returned `ref` holds the same-shaped record with resolved
532
+ * values (the defaults until each evaluation lands). A single `context` applies
533
+ * to every flag and may be reactive. This is the batched form of {@link useFlag}
534
+ * — one watcher manages one subscription per key.
535
+ */
542
536
  declare const useFlags: <T extends Record<string, FlagValue>>(flags: T, context?: MaybeRefOrGetter<FlagContext | undefined>) => Readonly<Ref<T>>;
543
537
  /**
544
- * The reactive handle returned by {@link useMutation} — the Vue counterpart to
545
- * React's `useMutation`, re-expressed with refs. The surface is identical across
546
- * the Lunora adapters (`@lunora/solid`, `/svelte`): `data`/`error`/`pending` are
547
- * refs you read in a template, `mutate` is an awaitable that resolves with the
548
- * server value (or rejects). Per-call `optimistic` / `optimisticUpdate` options
549
- * pass straight through to `client.mutation`.
550
- */
538
+ * The reactive handle returned by {@link useMutation} — the Vue counterpart to
539
+ * React's `useMutation`, re-expressed with refs. The surface is identical across
540
+ * the Lunora adapters (`@lunora/solid`, `/svelte`): `data`/`error`/`pending` are
541
+ * refs you read in a template, `mutate` is an awaitable that resolves with the
542
+ * server value (or rejects). Per-call `optimistic` / `optimisticUpdate` options
543
+ * pass straight through to `client.mutation`.
544
+ */
551
545
  interface MutationHandle<F extends FunctionReference> {
552
546
  /** The latest invocation's resolved value, or `undefined` before the first success. */
553
547
  data: Ref<ReturnOf<F> | undefined>;
@@ -561,27 +555,27 @@ interface MutationHandle<F extends FunctionReference> {
561
555
  reset: () => void;
562
556
  }
563
557
  /**
564
- * Returns a reactive {@link MutationHandle} for the given mutation reference —
565
- * the Vue equivalent of React's `useMutation`.
566
- *
567
- * Optimistic updates stay client-owned: the `optimistic` / `optimisticUpdate`
568
- * call options pass straight through to `client.mutation`, which applies and
569
- * rolls them back against the Lunora subscription cache (Convex parity).
570
- *
571
- * `pending` is ref-counted across overlapping invocations of THIS handle, so it
572
- * flips back to `false` only once every concurrent call has settled. The
573
- * ref-counted pending + error-normalize orchestration is the shared
574
- * `createMutationRunner` from `@lunora/client`; only the refs are
575
- * adapter-specific.
576
- */
558
+ * Returns a reactive {@link MutationHandle} for the given mutation reference —
559
+ * the Vue equivalent of React's `useMutation`.
560
+ *
561
+ * Optimistic updates stay client-owned: the `optimistic` / `optimisticUpdate`
562
+ * call options pass straight through to `client.mutation`, which applies and
563
+ * rolls them back against the Lunora subscription cache (Convex parity).
564
+ *
565
+ * `pending` is ref-counted across overlapping invocations of THIS handle, so it
566
+ * flips back to `false` only once every concurrent call has settled. The
567
+ * ref-counted pending + error-normalize orchestration is the shared
568
+ * `createMutationRunner` from `@lunora/client`; only the refs are
569
+ * adapter-specific.
570
+ */
577
571
  declare const useMutation: <F extends FunctionReference>(function_: F) => MutationHandle<F>;
578
572
  /**
579
- * The reactive handle returned by {@link useMutator} — the Vue counterpart to
580
- * `@lunora/react`'s `useMutator`, re-expressed with refs. The surface is
581
- * identical across the Lunora adapters (`@lunora/solid`, `/svelte`):
582
- * `error`/`isError`/`pending` are refs you read in a template and `mutate` is an
583
- * awaitable that resolves once the write is persisted (or rejects).
584
- */
573
+ * The reactive handle returned by {@link useMutator} — the Vue counterpart to
574
+ * `@lunora/react`'s `useMutator`, re-expressed with refs. The surface is
575
+ * identical across the Lunora adapters (`@lunora/solid`, `/svelte`):
576
+ * `error`/`isError`/`pending` are refs you read in a template and `mutate` is an
577
+ * awaitable that resolves once the write is persisted (or rejects).
578
+ */
585
579
  interface MutatorHook<TArgs> {
586
580
  /** The latest invocation's error, or `undefined`. */
587
581
  error: Ref<Error | undefined>;
@@ -595,18 +589,18 @@ interface MutatorHook<TArgs> {
595
589
  reset: () => void;
596
590
  }
597
591
  /**
598
- * Ergonomic `{ mutate, pending, error, isError, reset }` wrapper over a bound
599
- * custom-mutator handle from `@lunora/db`'s `bindMutators` — the Vue equivalent
600
- * of `@lunora/react`'s `useMutator`. The optimistic overlay and
601
- * server-authoritative push are owned by the bound handle (and TanStack DB's
602
- * optimistic-transaction layer rebases pending overlays on every sync tick);
603
- * this composable only surfaces reactive state for the in-flight/error
604
- * lifecycle. Reads stay on the existing TanStack `useLiveQuery`; no new query
605
- * composable is needed.
606
- *
607
- * `pending` is ref-counted across overlapping invocations of THIS handle, so it
608
- * clears only once every concurrent call has settled.
609
- */
592
+ * Ergonomic `{ mutate, pending, error, isError, reset }` wrapper over a bound
593
+ * custom-mutator handle from `@lunora/db`'s `bindMutators` — the Vue equivalent
594
+ * of `@lunora/react`'s `useMutator`. The optimistic overlay and
595
+ * server-authoritative push are owned by the bound handle (and TanStack DB's
596
+ * optimistic-transaction layer rebases pending overlays on every sync tick);
597
+ * this composable only surfaces reactive state for the in-flight/error
598
+ * lifecycle. Reads stay on the existing TanStack `useLiveQuery`; no new query
599
+ * composable is needed.
600
+ *
601
+ * `pending` is ref-counted across overlapping invocations of THIS handle, so it
602
+ * clears only once every concurrent call has settled.
603
+ */
610
604
  declare const useMutator: <TArgs = Record<string, unknown>>(handle: MutatorHandle<TArgs>) => MutatorHook<TArgs>;
611
605
  /** The args a paginated query exposes minus the framework-supplied page cursor. */
612
606
  type PaginatedArgs<F extends FunctionReference> = Omit<ArgsOf<F>, "paginationOpts">;
@@ -629,24 +623,24 @@ interface UsePaginatedQueryResult<T> {
629
623
  status: Ref<PaginationStatus>;
630
624
  }
631
625
  /**
632
- * Subscribe to a reactively-paginated query and grow the feed page by page.
633
- *
634
- * The query function must accept a `paginationOpts: { numItems, cursor,
635
- * endCursor }` arg and return a `PaginationResult`. Pages are tracked as an
636
- * ordered list of stable boundary cursors; each loaded page is a live
637
- * subscription over a FIXED `(lower, upper]` range. Inserting or deleting a row
638
- * grows/shrinks the affected page without duplicating or skipping rows across
639
- * boundaries.
640
- *
641
- * `loadMore` appends the next page off the open-ended tail's `continueCursor`;
642
- * it is a no-op unless `status === "CanLoadMore"`. Background split/join
643
- * maintenance keeps page sizes near `initialNumItems` as edits accumulate.
644
- *
645
- * Changing `fn`, the base `args`, `initialNumItems`, or `shardKey` resets the
646
- * feed to its first page.
647
- *
648
- * Call inside `setup()` (or any active effect scope).
649
- */
626
+ * Subscribe to a reactively-paginated query and grow the feed page by page.
627
+ *
628
+ * The query function must accept a `paginationOpts: { numItems, cursor,
629
+ * endCursor }` arg and return a `PaginationResult`. Pages are tracked as an
630
+ * ordered list of stable boundary cursors; each loaded page is a live
631
+ * subscription over a FIXED `(lower, upper]` range. Inserting or deleting a row
632
+ * grows/shrinks the affected page without duplicating or skipping rows across
633
+ * boundaries.
634
+ *
635
+ * `loadMore` appends the next page off the open-ended tail's `continueCursor`;
636
+ * it is a no-op unless `status === "CanLoadMore"`. Background split/join
637
+ * maintenance keeps page sizes near `initialNumItems` as edits accumulate.
638
+ *
639
+ * Changing `fn`, the base `args`, `initialNumItems`, or `shardKey` resets the
640
+ * feed to its first page.
641
+ *
642
+ * Call inside `setup()` (or any active effect scope).
643
+ */
650
644
  declare const usePaginatedQuery: <F extends FunctionReference>(function_: F, args: MaybeRefOrGetter<"skip" | PaginatedArgs<F>>, options: UsePaginatedQueryOptions) => UsePaginatedQueryResult<PageItemOf<F>>;
651
645
  interface UseInfiniteQueryOptions {
652
646
  /** Page size for the first page (and the default for `fetchNextPage`). */
@@ -667,37 +661,37 @@ interface UseInfiniteQueryResult<T> {
667
661
  status: Ref<PaginationStatus>;
668
662
  }
669
663
  /**
670
- * Subscribe to a reactively-paginated query and expose its pages discretely.
671
- *
672
- * Shares `usePaginatedQuery`'s reactive-pagination engine but keeps each page
673
- * as its own inner array rather than flattening them, and adds the
674
- * TanStack-Query-style `fetchNextPage` / `hasNextPage` / `isFetchingNextPage`
675
- * shape.
676
- *
677
- * Call inside `setup()` (or any active effect scope).
678
- */
664
+ * Subscribe to a reactively-paginated query and expose its pages discretely.
665
+ *
666
+ * Shares `usePaginatedQuery`'s reactive-pagination engine but keeps each page
667
+ * as its own inner array rather than flattening them, and adds the
668
+ * TanStack-Query-style `fetchNextPage` / `hasNextPage` / `isFetchingNextPage`
669
+ * shape.
670
+ *
671
+ * Call inside `setup()` (or any active effect scope).
672
+ */
679
673
  declare const useInfiniteQuery: <F extends FunctionReference>(function_: F, args: MaybeRefOrGetter<"skip" | PaginatedArgs<F>>, options: UseInfiniteQueryOptions) => UseInfiniteQueryResult<PageItemOf<F>>;
680
674
  /**
681
- * `usePresence` — collaborative-awareness composable, the client half of the
682
- * `@lunora/server` `definePresence` preset.
683
- *
684
- * Drives the heartbeat mutation (on mount, interval, and tab re-focus) and
685
- * subscribes to the live `listPresent` query for the given room.
686
- *
687
- * Call inside `setup()` (or any active effect scope).
688
- */
689
- /**
690
- * A heartbeat mutation reference: takes `{ roomId, sessionId, data? }`.
691
- */
675
+ * `usePresence` — collaborative-awareness composable, the client half of the
676
+ * `@lunora/server` `definePresence` preset.
677
+ *
678
+ * Drives the heartbeat mutation (on mount, interval, and tab re-focus) and
679
+ * subscribes to the live `listPresent` query for the given room.
680
+ *
681
+ * Call inside `setup()` (or any active effect scope).
682
+ */
683
+ /**
684
+ * A heartbeat mutation reference: takes `{ roomId, sessionId, data? }`.
685
+ */
692
686
  type HeartbeatReference = FunctionReference<"mutation", {
693
687
  data?: Record<string, unknown>;
694
688
  roomId: string;
695
689
  sessionId: string;
696
690
  }>;
697
691
  /**
698
- * A listPresent query reference: takes `{ roomId }` and returns the array of
699
- * present members.
700
- */
692
+ * A listPresent query reference: takes `{ roomId }` and returns the array of
693
+ * present members.
694
+ */
701
695
  type ListPresentReference = FunctionReference<"query", {
702
696
  roomId: string;
703
697
  }>;
@@ -711,9 +705,9 @@ interface UsePresenceOptions<H extends HeartbeatReference, L extends ListPresent
711
705
  /** The `api.*` reference for the presence listPresent query. */
712
706
  listPresent: L;
713
707
  /**
714
- * Stable id for this presence row. Defaults to a fresh per-mount id.
715
- * Pass a user/connection id to control deduping across tabs.
716
- */
708
+ * Stable id for this presence row. Defaults to a fresh per-mount id.
709
+ * Pass a user/connection id to control deduping across tabs.
710
+ */
717
711
  sessionId?: string;
718
712
  /** Forwarded to the heartbeat mutation / listPresent subscription when sharding by room. */
719
713
  shardKey?: string;
@@ -728,51 +722,51 @@ interface UsePresenceResult<L extends ListPresentReference> {
728
722
  }
729
723
  declare const usePresence: <H extends HeartbeatReference, L extends ListPresentReference>(roomId: string, options: UsePresenceOptions<H, L>) => UsePresenceResult<L>;
730
724
  /**
731
- * Open a live subscription against `client` for FIXED args and stream its values
732
- * into a `ref`. The low-level primitive behind `hydratePreloaded` (whose args
733
- * come from an immutable `Preloaded` token and never change); {@link useQuery}
734
- * handles the reactive-args case separately.
735
- *
736
- * `client.subscribe` already dedupes by `(functionPath, args, shardKey)` and
737
- * replays the last value synchronously, so multiple consumers of the same query
738
- * ride one server-side registration. `seed` sets the ref's value synchronously
739
- * before the subscription attaches, so the first read shows the SSR value with
740
- * no loading flash.
741
- *
742
- * Teardown is wired to the active effect scope (`onScopeDispose`), so it fires
743
- * on component unmount or `effectScope().stop()`. Call it inside `setup()` / an
744
- * effect scope (as `hydratePreloaded` does); outside any scope there is nothing
745
- * to own the subscription, so it would leak until the process exits — the
746
- * `getCurrentScope` guard only avoids throwing, it does not auto-clean.
747
- */
725
+ * Open a live subscription against `client` for FIXED args and stream its values
726
+ * into a `ref`. The low-level primitive behind `hydratePreloaded` (whose args
727
+ * come from an immutable `Preloaded` token and never change); {@link useQuery}
728
+ * handles the reactive-args case separately.
729
+ *
730
+ * `client.subscribe` already dedupes by `(functionPath, args, shardKey)` and
731
+ * replays the last value synchronously, so multiple consumers of the same query
732
+ * ride one server-side registration. `seed` sets the ref's value synchronously
733
+ * before the subscription attaches, so the first read shows the SSR value with
734
+ * no loading flash.
735
+ *
736
+ * Teardown is wired to the active effect scope (`onScopeDispose`), so it fires
737
+ * on component unmount or `effectScope().stop()`. Call it inside `setup()` / an
738
+ * effect scope (as `hydratePreloaded` does); outside any scope there is nothing
739
+ * to own the subscription, so it would leak until the process exits — the
740
+ * `getCurrentScope` guard only avoids throwing, it does not auto-clean.
741
+ */
748
742
  declare const subscribeToQuery: <F extends FunctionReference, T = ReturnOf<F>>(client: LunoraClient, function_: F, args: ArgsOf<F>, options?: {
749
743
  seed?: T;
750
744
  shardKey?: string;
751
745
  }) => Ref<T | undefined>;
752
746
  /**
753
- * Subscribe to a server query and expose its latest value as a `ref`.
754
- *
755
- * The returned ref is `undefined` until the first server response lands, then
756
- * updates on every delta the server pushes — the Vue-idiomatic equivalent of
757
- * React's `useQuery`. `args` may be a plain value, a `ref`, or a getter: passing
758
- * a reactive source makes the subscription reactive — when the args change the
759
- * old subscription is torn down and a fresh one opens for the new args (matching
760
- * `@lunora/react`/`@lunora/solid`). Pass `"skip"` (or a source resolving to
761
- * `"skip"`) to short-circuit: no network call, no socket. The subscription tears
762
- * down automatically when the owning component unmounts (or the effect scope
763
- * stops).
764
- *
765
- * Call inside `setup()` (or any active effect scope). For SSR seeding with no
766
- * loading flash, use `hydratePreloaded` instead.
767
- */
747
+ * Subscribe to a server query and expose its latest value as a `ref`.
748
+ *
749
+ * The returned ref is `undefined` until the first server response lands, then
750
+ * updates on every delta the server pushes — the Vue-idiomatic equivalent of
751
+ * React's `useQuery`. `args` may be a plain value, a `ref`, or a getter: passing
752
+ * a reactive source makes the subscription reactive — when the args change the
753
+ * old subscription is torn down and a fresh one opens for the new args (matching
754
+ * `@lunora/react`/`@lunora/solid`). Pass `"skip"` (or a source resolving to
755
+ * `"skip"`) to short-circuit: no network call, no socket. The subscription tears
756
+ * down automatically when the owning component unmounts (or the effect scope
757
+ * stops).
758
+ *
759
+ * Call inside `setup()` (or any active effect scope). For SSR seeding with no
760
+ * loading flash, use `hydratePreloaded` instead.
761
+ */
768
762
  declare const useQuery: <F extends FunctionReference>(function_: F, args: MaybeRefOrGetter<ArgsOf<F> | "skip">, options?: UseQueryOptions) => Ref<ReturnOf<F> | undefined>;
769
763
  interface UseRateLimitOptions {
770
764
  /** Clock injection for tests. Defaults to `Date.now`. */
771
765
  now?: () => number;
772
766
  /**
773
- * Re-render cadence in milliseconds while throttled, so `retryAfter` ticks
774
- * down and `disabled` flips back automatically. Defaults to `1000`.
775
- */
767
+ * Re-render cadence in milliseconds while throttled, so `retryAfter` ticks
768
+ * down and `disabled` flips back automatically. Defaults to `1000`.
769
+ */
776
770
  tickMs?: number;
777
771
  }
778
772
  interface UseRateLimitResult {
@@ -790,17 +784,17 @@ interface UseRateLimitResult {
790
784
  retryAfter: ComputedRef<number>;
791
785
  }
792
786
  /**
793
- * Client-side mirror of a rate limit for instant UX — disable a button or show
794
- * a countdown without a round-trip. It runs the same token-bucket / fixed-window
795
- * math as `@lunora/ratelimit` on the server, so the prediction agrees with the
796
- * authoritative check; the server remains the source of truth.
797
- *
798
- * `config` accepts a plain object, a `ref`, or a getter (`MaybeRefOrGetter`).
799
- * When you pass a ref/getter it is tracked reactively — changing the config
800
- * re-derives `status` (and the `ok` / `disabled` / `retryAfter` views) on the
801
- * fly. A plain object keeps working unchanged; pass a stable reference (module
802
- * constant) so the reactive derived values stay settled.
803
- */
787
+ * Client-side mirror of a rate limit for instant UX — disable a button or show
788
+ * a countdown without a round-trip. It runs the same token-bucket / fixed-window
789
+ * math as `@lunora/ratelimit` on the server, so the prediction agrees with the
790
+ * authoritative check; the server remains the source of truth.
791
+ *
792
+ * `config` accepts a plain object, a `ref`, or a getter (`MaybeRefOrGetter`).
793
+ * When you pass a ref/getter it is tracked reactively — changing the config
794
+ * re-derives `status` (and the `ok` / `disabled` / `retryAfter` views) on the
795
+ * fly. A plain object keeps working unchanged; pass a stable reference (module
796
+ * constant) so the reactive derived values stay settled.
797
+ */
804
798
  declare const useRateLimit: (config: MaybeRefOrGetter<RateLimitConfig>, options?: UseRateLimitOptions) => UseRateLimitResult;
805
799
  /** The lifecycle of a stream the composable is observing. */
806
800
  type UseStreamStatus = "complete" | "error" | "idle" | "streaming";
@@ -818,45 +812,45 @@ interface UseStreamOptions {
818
812
  shardKey?: string;
819
813
  }
820
814
  /**
821
- * Subscribe to a streaming query. Returns the chunks pushed so far plus a
822
- * lifecycle status and a cancel function, all as refs. Changing the resolved
823
- * `args` resets the stream — the previous iterator is cancelled and a fresh one
824
- * opens with empty `chunks`.
825
- *
826
- * `args` may be a plain value, `ref`, or getter; resolving it to `"skip"` keeps
827
- * the composable mounted without opening a stream (mirrors `useSubscription`).
828
- * The Vue counterpart to React's `useStream`, re-expressed with refs.
829
- */
815
+ * Subscribe to a streaming query. Returns the chunks pushed so far plus a
816
+ * lifecycle status and a cancel function, all as refs. Changing the resolved
817
+ * `args` resets the stream — the previous iterator is cancelled and a fresh one
818
+ * opens with empty `chunks`.
819
+ *
820
+ * `args` may be a plain value, `ref`, or getter; resolving it to `"skip"` keeps
821
+ * the composable mounted without opening a stream (mirrors `useSubscription`).
822
+ * The Vue counterpart to React's `useStream`, re-expressed with refs.
823
+ */
830
824
  declare const useStream: <F extends FunctionReference<"stream">>(function_: F, args: MaybeRefOrGetter<"skip" | ArgsOf<F>>, options?: UseStreamOptions) => UseStreamResult<ReturnOf<F>>;
831
825
  interface UseSubscriptionResult<T> {
832
826
  data: Ref<T | undefined>;
833
827
  error: Ref<Error | undefined>;
834
828
  }
835
829
  /**
836
- * Subscribe to a reactive server push stream. Returns `{ data, error }` refs
837
- * that update whenever the server emits a new value. Passing `"skip"` as `args`
838
- * (or a ref/getter that resolves to `"skip"`) tears down the subscription
839
- * without unmounting.
840
- *
841
- * Unlike `useQuery`, which tracks the full reactive cache, `useSubscription`
842
- * owns a single lightweight subscription and is suitable for ephemeral,
843
- * high-frequency streams.
844
- */
830
+ * Subscribe to a reactive server push stream. Returns `{ data, error }` refs
831
+ * that update whenever the server emits a new value. Passing `"skip"` as `args`
832
+ * (or a ref/getter that resolves to `"skip"`) tears down the subscription
833
+ * without unmounting.
834
+ *
835
+ * Unlike `useQuery`, which tracks the full reactive cache, `useSubscription`
836
+ * owns a single lightweight subscription and is suitable for ephemeral,
837
+ * high-frequency streams.
838
+ */
845
839
  declare const useSubscription: <F extends FunctionReference>(function_: F, args: MaybeRefOrGetter<ArgsOf<F> | "skip">, options?: UseQueryOptions) => UseSubscriptionResult<ReturnOf<F>>;
846
840
  /**
847
- * Browser Web Audio subsystems for `useVoiceAgent` — the default microphone
848
- * capture and speaker playback implementations injected into the composable via
849
- * its `createMicrophone` / `createSpeaker` seams. Kept in a sibling module so the
850
- * heavy Web Audio graph (and its structural DOM typings) stays isolated from the
851
- * composable's transport + reactive-state logic and remains mockable in a
852
- * non-browser test env.
853
- */
854
- /**
855
- * The negotiated audio format the voice DO streams back. Mirrors
856
- * `@lunora/agent`'s `VoiceServerFrame` `ready.audioFormat` — re-declared (not
857
- * imported) so this Vue package never pulls in the server-only `@lunora/agent`
858
- * module graph.
859
- */
841
+ * Browser Web Audio subsystems for `useVoiceAgent` — the default microphone
842
+ * capture and speaker playback implementations injected into the composable via
843
+ * its `createMicrophone` / `createSpeaker` seams. Kept in a sibling module so the
844
+ * heavy Web Audio graph (and its structural DOM typings) stays isolated from the
845
+ * composable's transport + reactive-state logic and remains mockable in a
846
+ * non-browser test env.
847
+ */
848
+ /**
849
+ * The negotiated audio format the voice DO streams back. Mirrors
850
+ * `@lunora/agent`'s `VoiceServerFrame` `ready.audioFormat` — re-declared (not
851
+ * imported) so this Vue package never pulls in the server-only `@lunora/agent`
852
+ * module graph.
853
+ */
860
854
  type VoiceAudioFormat = "mp3" | "wav";
861
855
  /** Captures microphone audio and reports level / turn boundaries back to the composable. */
862
856
  interface VoiceMicrophone {
@@ -900,15 +894,10 @@ type CreateSpeaker = (config: {
900
894
  audioFormat: VoiceAudioFormat;
901
895
  }) => VoiceSpeaker;
902
896
  /**
903
- * The default browser microphone: `getUserMedia` a Web Audio `ScriptProcessor`
904
- * that tees 16 kHz PCM frames, tracks input RMS, auto-commits an utterance after
905
- * a silence gap, and flags a barge-in while the agent is speaking.
906
- */
907
- /**
908
- * The `agents.&lt;name>Voice` reference codegen emits for a voice-enabled agent — a
909
- * live, WS-backed session keyed by `threadKey`. A structural subset of the
910
- * generated member, so passing `api.agents.&lt;name>Voice` type-checks.
911
- */
897
+ * The `agents.&lt;name>Voice` reference codegen emits for a voice-enabled agent — a
898
+ * live, WS-backed session keyed by `threadKey`. A structural subset of the
899
+ * generated member, so passing `api.agents.&lt;name>Voice` type-checks.
900
+ */
912
901
  type VoiceReference = FunctionReference<"stream", {
913
902
  threadKey: string;
914
903
  }, Record<string, unknown>>;
@@ -930,10 +919,10 @@ interface VoiceSocket {
930
919
  type CreateSocket = (url: string) => VoiceSocket;
931
920
  interface UseVoiceAgentOptions {
932
921
  /**
933
- * Advanced/test seam: build the microphone capture subsystem. Defaults to a
934
- * `getUserMedia` + Web Audio implementation. Injected wholesale so the Web
935
- * Audio graph stays isolated (and mockable in a non-browser test env).
936
- */
922
+ * Advanced/test seam: build the microphone capture subsystem. Defaults to a
923
+ * `getUserMedia` + Web Audio implementation. Injected wholesale so the Web
924
+ * Audio graph stays isolated (and mockable in a non-browser test env).
925
+ */
937
926
  createMicrophone?: CreateMicrophone;
938
927
  /** Advanced/test seam: open the transport. Defaults to `new WebSocket(url)`. */
939
928
  createSocket?: CreateSocket;
@@ -977,20 +966,20 @@ interface UseVoiceAgentResult {
977
966
  transcript: Readonly<Ref<string>>;
978
967
  }
979
968
  /**
980
- * A first-class voice-call surface for a voice-enabled agent: it opens a
981
- * WebSocket to the agent's `VoiceSessionDO`, captures mic audio as 16 kHz PCM,
982
- * streams the agent's synthesized speech back through the browser's audio output,
983
- * and mirrors the call lifecycle (`status`, `transcript`, `interimTranscript`,
984
- * `audioLevel`) to Vue refs. Pass the generated `api.agents.&lt;name>Voice`
985
- * reference (never a string), matching `useAgentChat`'s reference-passing style.
986
- * The Vue counterpart to React's `useVoiceAgent`, re-expressed with refs; the
987
- * per-call connection lives in a closure variable (a composable runs once per
988
- * component, so no `ref`-of-ref indirection is needed).
989
- *
990
- * v1 transport is plain binary WebSocket frames with push-to-talk / silence-timer
991
- * turn detection and client-side RMS barge-in. The heavy Web Audio capture and
992
- * playback subsystems are injectable (`createMicrophone` / `createSpeaker` /
993
- * `createSocket`) so the composable is drivable outside a browser.
994
- */
969
+ * A first-class voice-call surface for a voice-enabled agent: it opens a
970
+ * WebSocket to the agent's `VoiceSessionDO`, captures mic audio as 16 kHz PCM,
971
+ * streams the agent's synthesized speech back through the browser's audio output,
972
+ * and mirrors the call lifecycle (`status`, `transcript`, `interimTranscript`,
973
+ * `audioLevel`) to Vue refs. Pass the generated `api.agents.&lt;name>Voice`
974
+ * reference (never a string), matching `useAgentChat`'s reference-passing style.
975
+ * The Vue counterpart to React's `useVoiceAgent`, re-expressed with refs; the
976
+ * per-call connection lives in a closure variable (a composable runs once per
977
+ * component, so no `ref`-of-ref indirection is needed).
978
+ *
979
+ * v1 transport is plain binary WebSocket frames with push-to-talk / silence-timer
980
+ * turn detection and client-side RMS barge-in. The heavy Web Audio capture and
981
+ * playback subsystems are injectable (`createMicrophone` / `createSpeaker` /
982
+ * `createSocket`) so the composable is drivable outside a browser.
983
+ */
995
984
  declare const useVoiceAgent: (options: UseVoiceAgentOptions) => UseVoiceAgentResult;
996
985
  export { type AgentChatMessage, type AgentLiveEvent, type AgentProgressEvent, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentToolEvent, AuthLoading, Authenticated, type FlagContext, type FlagValue, type HeartbeatReference, LUNORA_INJECTION_KEY, type ListPresentReference, type MutationHandle, type MutatorHook, type PageItemOf, type PaginatedArgs, Unauthenticated, type UseAgentApi, type UseAgentChatApi, type UseAgentChatOptions, type UseAgentChatResult, type UseAgentOptions, type UseAgentResult, type UseAgentStateApi, type UseAgentStateOptions, type UseAgentStateResult, type UseAgentToolEventsApi, type UseAgentToolEventsOptions, type UseAgentToolEventsResult, type UseAuthResult, type UseInfiniteQueryOptions, type UseInfiniteQueryResult, type UsePaginatedQueryOptions, type UsePaginatedQueryResult, type UsePresenceOptions, type UsePresenceResult, type UseQueryOptions, type UseRateLimitOptions, type UseRateLimitResult, type UseStreamOptions, type UseStreamResult, type UseStreamStatus, type UseSubscriptionResult, type UseVoiceAgentOptions, type UseVoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, createLunora, hydratePreloaded, provideLunora, subscribeToQuery, useAgent, useAgentChat, useAgentState, useAgentToolEvents, useAuth, useConnectionStatus, useFlag, useFlags, useInfiniteQuery, useLunora, useMutation, useMutator, usePaginatedQuery, usePresence, useQuery, useRateLimit, useStream, useSubscription, useVoiceAgent };