@lunora/angular 1.0.0-alpha.8 → 1.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.d.mts +185 -4
- package/dist/index.d.ts +185 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @lunora/angular
|
|
2
2
|
|
|
3
|
+
> **Experimental** — this package is outside the Lunora 1.0 stability promise: its API may change in any release, without a major version bump.
|
|
4
|
+
|
|
3
5
|
Angular reactive adapter for Lunora — signal-based live queries and mutations.
|
|
4
6
|
|
|
5
7
|
Thin, idiomatic glue over the framework-neutral `@lunora/client`. Angular signals
|
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ export { SKIP } from '@lunora/client/query';
|
|
|
10
10
|
* so this Angular entry never pulls in the server-only `@lunora/agent` module graph
|
|
11
11
|
* (the adapter stays Angular + `@lunora/client` only). Keep in sync with
|
|
12
12
|
* `packages/agent/src/types.ts`.
|
|
13
|
+
* @experimental
|
|
13
14
|
*/
|
|
14
15
|
type AgentThreadStatus = "awaiting_input" | "cancelled" | "error" | "idle" | "running";
|
|
15
16
|
/**
|
|
@@ -17,6 +18,7 @@ type AgentThreadStatus = "awaiting_input" | "cancelled" | "error" | "idle" | "ru
|
|
|
17
18
|
* subset of the persisted thread row — every field beyond `status` is optional so
|
|
18
19
|
* the shape stays forgiving as the server schema grows. Keep in sync with the
|
|
19
20
|
* `agent_threads` table in `packages/agent/src/component.ts`.
|
|
21
|
+
* @experimental
|
|
20
22
|
*/
|
|
21
23
|
interface AgentThreadRecord {
|
|
22
24
|
createdAt?: number;
|
|
@@ -37,6 +39,7 @@ interface AgentThreadRecord {
|
|
|
37
39
|
* re-declared here (rather than imported) so this Angular entry never pulls in the
|
|
38
40
|
* server-only `@lunora/agent` module graph. Keep in sync with the
|
|
39
41
|
* `agent_messages` table in `packages/agent/src/component.ts`.
|
|
42
|
+
* @experimental
|
|
40
43
|
*/
|
|
41
44
|
interface AgentChatMessage {
|
|
42
45
|
content: string;
|
|
@@ -63,6 +66,7 @@ interface AgentChatMessage {
|
|
|
63
66
|
* `@lunora/agent`'s `AgentTokenDelta`. Ephemeral — deltas feed the chat surface's
|
|
64
67
|
* streaming text live and are never replayed; the persisted assistant message
|
|
65
68
|
* stays the single source of truth.
|
|
69
|
+
* @experimental
|
|
66
70
|
*/
|
|
67
71
|
interface AgentTokenDelta {
|
|
68
72
|
/** Discriminates the token arm of {@link AgentLiveEvent}; unset on the wire (token is the default). */
|
|
@@ -78,6 +82,7 @@ interface AgentTokenDelta {
|
|
|
78
82
|
* A live tool-progress event streamed via `ctx.reportProgress(...)`. Client-safe
|
|
79
83
|
* mirror of `@lunora/agent`'s `AgentProgressEvent`. Ephemeral and `toolCallId`-keyed;
|
|
80
84
|
* surfaced by `agentToolEvents`, ignored by the chat surface's streaming text.
|
|
85
|
+
* @experimental
|
|
81
86
|
*/
|
|
82
87
|
interface AgentProgressEvent {
|
|
83
88
|
/** The arbitrary, JSON-serializable payload the tool reported. */
|
|
@@ -94,6 +99,7 @@ interface AgentProgressEvent {
|
|
|
94
99
|
* tool progress event. Client-safe mirror of `@lunora/agent`'s `AgentLiveEvent`.
|
|
95
100
|
* Discriminate on `kind` (`"progress"` for the progress arm; token deltas leave
|
|
96
101
|
* it unset).
|
|
102
|
+
* @experimental
|
|
97
103
|
*/
|
|
98
104
|
type AgentLiveEvent = AgentProgressEvent | AgentTokenDelta;
|
|
99
105
|
/**
|
|
@@ -101,6 +107,7 @@ type AgentLiveEvent = AgentProgressEvent | AgentTokenDelta;
|
|
|
101
107
|
* state (status + the in-flight `instanceId`). A structural subset of the
|
|
102
108
|
* generated `api.agents` surface, so the whole generated `api` object is
|
|
103
109
|
* assignable.
|
|
110
|
+
* @experimental
|
|
104
111
|
*/
|
|
105
112
|
interface AgentApi {
|
|
106
113
|
agents: {
|
|
@@ -109,6 +116,10 @@ interface AgentApi {
|
|
|
109
116
|
}, Record<string, unknown> | undefined>;
|
|
110
117
|
};
|
|
111
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* `AgentOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
121
|
+
* @experimental
|
|
122
|
+
*/
|
|
112
123
|
interface AgentOptions {
|
|
113
124
|
/** The generated `api` — its `agents.agentThread` query drives live thread state. */
|
|
114
125
|
api: AgentApi;
|
|
@@ -136,6 +147,10 @@ interface AgentOptions {
|
|
|
136
147
|
/** The thread to observe and drive. */
|
|
137
148
|
threadKey: string;
|
|
138
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* `AgentResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
152
|
+
* @experimental
|
|
153
|
+
*/
|
|
139
154
|
interface AgentResult {
|
|
140
155
|
/**
|
|
141
156
|
* Terminate the in-flight run and mark its thread `"cancelled"`. Resolves as a
|
|
@@ -164,6 +179,7 @@ interface AgentResult {
|
|
|
164
179
|
*
|
|
165
180
|
* Call from an injection context (component/service field or constructor); pass an
|
|
166
181
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
182
|
+
* @experimental
|
|
167
183
|
*/
|
|
168
184
|
declare const agent: (options: AgentOptions) => AgentResult;
|
|
169
185
|
/** The `agents:agentMessages` reference — live durable thread history. */
|
|
@@ -189,6 +205,7 @@ type AgentThreadReference = FunctionReference<"query", {
|
|
|
189
205
|
* An app stream reference that tees the agent's in-flight live events, keyed by
|
|
190
206
|
* thread. Carries token deltas and — since `ctx.reportProgress` rides the same
|
|
191
207
|
* sink — tool progress events; this primitive consumes only the token arm.
|
|
208
|
+
* @experimental
|
|
192
209
|
*/
|
|
193
210
|
type AgentTokenStreamReference = FunctionReference<"stream", {
|
|
194
211
|
key: string;
|
|
@@ -197,6 +214,7 @@ type AgentTokenStreamReference = FunctionReference<"stream", {
|
|
|
197
214
|
* The `agents.*` reference surface the chat primitive reads. A structural subset
|
|
198
215
|
* of the generated `api.agents`, so the whole generated `api` object is
|
|
199
216
|
* assignable.
|
|
217
|
+
* @experimental
|
|
200
218
|
*/
|
|
201
219
|
interface AgentChatApi {
|
|
202
220
|
agents: {
|
|
@@ -205,6 +223,10 @@ interface AgentChatApi {
|
|
|
205
223
|
agentThread: AgentThreadReference;
|
|
206
224
|
};
|
|
207
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* `AgentChatOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
228
|
+
* @experimental
|
|
229
|
+
*/
|
|
208
230
|
interface AgentChatOptions {
|
|
209
231
|
/** The generated `api` — its `agents.*` surface provides history, thread state, and approval resolution. */
|
|
210
232
|
api: AgentChatApi;
|
|
@@ -241,6 +263,10 @@ interface AgentChatOptions {
|
|
|
241
263
|
/** The thread to observe and continue. */
|
|
242
264
|
threadKey: string;
|
|
243
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* `AgentChatResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
268
|
+
* @experimental
|
|
269
|
+
*/
|
|
244
270
|
interface AgentChatResult {
|
|
245
271
|
/** Approve a paused human-in-the-loop tool call (optionally with a note). */
|
|
246
272
|
approve: (toolCallId: string, note?: string) => Promise<void>;
|
|
@@ -282,6 +308,7 @@ interface AgentChatResult {
|
|
|
282
308
|
*
|
|
283
309
|
* Call from an injection context (component/service field or constructor); pass an
|
|
284
310
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
311
|
+
* @experimental
|
|
285
312
|
*/
|
|
286
313
|
declare const agentChat: (options: AgentChatOptions) => AgentChatResult;
|
|
287
314
|
/**
|
|
@@ -291,6 +318,7 @@ declare const agentChat: (options: AgentChatOptions) => AgentChatResult;
|
|
|
291
318
|
* assignable. Client-safe: no `@lunora/agent` import — the per-agent state type is
|
|
292
319
|
* mirrored by the primitive's generic `T`, since codegen pins the reference return
|
|
293
320
|
* as an optional record (it never evaluates agent config).
|
|
321
|
+
* @experimental
|
|
294
322
|
*/
|
|
295
323
|
interface AgentStateApi {
|
|
296
324
|
agents: {
|
|
@@ -299,6 +327,10 @@ interface AgentStateApi {
|
|
|
299
327
|
}, Record<string, unknown> | undefined>;
|
|
300
328
|
};
|
|
301
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* `AgentStateOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
332
|
+
* @experimental
|
|
333
|
+
*/
|
|
302
334
|
interface AgentStateOptions {
|
|
303
335
|
/** The generated `api` — its `agents.agentState` query drives live thread state. */
|
|
304
336
|
api: AgentStateApi;
|
|
@@ -312,6 +344,10 @@ interface AgentStateOptions {
|
|
|
312
344
|
/** The thread whose synced state to observe. */
|
|
313
345
|
threadKey: string;
|
|
314
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* `AgentStateResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
349
|
+
* @experimental
|
|
350
|
+
*/
|
|
315
351
|
interface AgentStateResult<T> {
|
|
316
352
|
/** The subscription error, if the live channel reported one. */
|
|
317
353
|
error: Signal<SubscriptionError | undefined>;
|
|
@@ -335,6 +371,7 @@ interface AgentStateResult<T> {
|
|
|
335
371
|
*
|
|
336
372
|
* Call from an injection context (component/service field or constructor); pass an
|
|
337
373
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
374
|
+
* @experimental
|
|
338
375
|
*/
|
|
339
376
|
declare const agentState: <T extends Record<string, unknown> = Record<string, unknown>>(options: AgentStateOptions) => AgentStateResult<T>;
|
|
340
377
|
/** The `agents:agentMessages` reference — live durable thread history. */
|
|
@@ -354,12 +391,17 @@ type AgentLiveStreamReference = FunctionReference<"stream", {
|
|
|
354
391
|
* The `agents.*` reference surface the tool-events primitive reads. A structural
|
|
355
392
|
* subset of the generated `api.agents`, so the whole generated `api` object is
|
|
356
393
|
* assignable.
|
|
394
|
+
* @experimental
|
|
357
395
|
*/
|
|
358
396
|
interface AgentToolEventsApi {
|
|
359
397
|
agents: {
|
|
360
398
|
agentMessages: AgentMessagesReference;
|
|
361
399
|
};
|
|
362
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* `AgentToolEventsOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
403
|
+
* @experimental
|
|
404
|
+
*/
|
|
363
405
|
interface AgentToolEventsOptions {
|
|
364
406
|
/** The generated `api` — its `agents.agentMessages` query provides the durable tool lifecycle. */
|
|
365
407
|
api: AgentToolEventsApi;
|
|
@@ -387,6 +429,7 @@ interface AgentToolEventsOptions {
|
|
|
387
429
|
* (`call`/`result`/`awaiting-approval`) are derived from `agents:agentMessages`
|
|
388
430
|
* and carry the persisted `seq`; the ephemeral `progress` arm comes live off the
|
|
389
431
|
* stream and has no `seq`. Discriminate on `type`.
|
|
432
|
+
* @experimental
|
|
390
433
|
*/
|
|
391
434
|
type AgentToolEvent = {
|
|
392
435
|
data: unknown;
|
|
@@ -411,6 +454,10 @@ type AgentToolEvent = {
|
|
|
411
454
|
toolName?: string;
|
|
412
455
|
type: "awaiting-approval";
|
|
413
456
|
};
|
|
457
|
+
/**
|
|
458
|
+
* `AgentToolEventsResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
459
|
+
* @experimental
|
|
460
|
+
*/
|
|
414
461
|
interface AgentToolEventsResult {
|
|
415
462
|
/**
|
|
416
463
|
* The thread's tool events: the durable lifecycle (oldest first, by `seq`)
|
|
@@ -435,14 +482,23 @@ interface AgentToolEventsResult {
|
|
|
435
482
|
*
|
|
436
483
|
* Call from an injection context (component/service field or constructor); pass an
|
|
437
484
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
485
|
+
* @experimental
|
|
438
486
|
*/
|
|
439
487
|
declare const agentToolEvents: (options: AgentToolEventsOptions) => AgentToolEventsResult;
|
|
488
|
+
/**
|
|
489
|
+
* `AuthOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
490
|
+
* @experimental
|
|
491
|
+
*/
|
|
440
492
|
interface AuthOptions {
|
|
441
493
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
442
494
|
client?: LunoraClient;
|
|
443
495
|
/** `DestroyRef` whose `onDestroy` removes the listeners. Defaults to `inject(DestroyRef)`. */
|
|
444
496
|
destroyRef?: DestroyRef;
|
|
445
497
|
}
|
|
498
|
+
/**
|
|
499
|
+
* `AuthResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
500
|
+
* @experimental
|
|
501
|
+
*/
|
|
446
502
|
interface AuthResult {
|
|
447
503
|
/** Set the auth token (sign-in / sign-out). */
|
|
448
504
|
setToken: (token: string | null) => void;
|
|
@@ -465,6 +521,7 @@ interface AuthResult {
|
|
|
465
521
|
* ```ts
|
|
466
522
|
* const { token, user, setToken } = auth();
|
|
467
523
|
* ```
|
|
524
|
+
* @experimental
|
|
468
525
|
*/
|
|
469
526
|
declare const auth: (options?: AuthOptions) => AuthResult;
|
|
470
527
|
/**
|
|
@@ -477,6 +534,7 @@ declare const auth: (options?: AuthOptions) => AuthResult;
|
|
|
477
534
|
* {@link provideLunora}: it builds one same-origin browser client (which opens
|
|
478
535
|
* its WebSocket lazily on the first subscription). Call {@link provideLunora} to
|
|
479
536
|
* point it at a remote URL or hand it a pre-built client.
|
|
537
|
+
* @experimental
|
|
480
538
|
*/
|
|
481
539
|
declare const LUNORA_CLIENT: InjectionToken<LunoraClient>;
|
|
482
540
|
/**
|
|
@@ -484,6 +542,7 @@ declare const LUNORA_CLIENT: InjectionToken<LunoraClient>;
|
|
|
484
542
|
* except `url` is optional — it defaults to the page origin in the browser (and to
|
|
485
543
|
* `""` on the server; pass an explicit `url` for SSR data-loading — see
|
|
486
544
|
* {@link sameOriginUrl}).
|
|
545
|
+
* @experimental
|
|
487
546
|
*/
|
|
488
547
|
type ProvideLunoraOptions = Omit<LunoraClientOptions, "url"> & {
|
|
489
548
|
url?: string;
|
|
@@ -502,6 +561,7 @@ type ProvideLunoraOptions = Omit<LunoraClientOptions, "url"> & {
|
|
|
502
561
|
* Pass {@link LunoraClientOptions} to configure a fresh client (URL defaults to
|
|
503
562
|
* the page origin), or hand in an already-constructed {@link LunoraClient} to
|
|
504
563
|
* share one instance (e.g. a client you also preload against during SSR).
|
|
564
|
+
* @experimental
|
|
505
565
|
*/
|
|
506
566
|
declare const provideLunora: (optionsOrClient?: LunoraClient | ProvideLunoraOptions) => EnvironmentProviders;
|
|
507
567
|
/**
|
|
@@ -515,8 +575,13 @@ declare const provideLunora: (optionsOrClient?: LunoraClient | ProvideLunoraOpti
|
|
|
515
575
|
* private readonly client = injectLunoraClient();
|
|
516
576
|
* send = (text: string) => this.client.mutation(api.messages.send, { text });
|
|
517
577
|
* ```
|
|
578
|
+
* @experimental
|
|
518
579
|
*/
|
|
519
580
|
declare const injectLunoraClient: () => LunoraClient;
|
|
581
|
+
/**
|
|
582
|
+
* `ConnectionStatusOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
583
|
+
* @experimental
|
|
584
|
+
*/
|
|
520
585
|
interface ConnectionStatusOptions {
|
|
521
586
|
/** Client to observe. Defaults to the injected `LUNORA_CLIENT`. */
|
|
522
587
|
client?: LunoraClient;
|
|
@@ -531,12 +596,23 @@ interface ConnectionStatusOptions {
|
|
|
531
596
|
*
|
|
532
597
|
* The listener is removed when the owning `DestroyRef` fires. Call from an
|
|
533
598
|
* injection context (component/service field or constructor).
|
|
599
|
+
* @experimental
|
|
534
600
|
*/
|
|
535
601
|
declare const connectionStatus: (options?: ConnectionStatusOptions) => Signal<ConnectionStatus>;
|
|
536
|
-
/**
|
|
602
|
+
/**
|
|
603
|
+
* The value kinds a flag resolves to — OpenFeature's boolean / number / string / structured (JSON) flags.
|
|
604
|
+
* @experimental
|
|
605
|
+
*/
|
|
537
606
|
type FlagValue = boolean | number | string | Record<string, unknown> | unknown[] | null;
|
|
538
|
-
/**
|
|
607
|
+
/**
|
|
608
|
+
* Targeting context bag forwarded to the OpenFeature provider.
|
|
609
|
+
* @experimental
|
|
610
|
+
*/
|
|
539
611
|
type FlagContext = Record<string, unknown>;
|
|
612
|
+
/**
|
|
613
|
+
* `FlagOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
614
|
+
* @experimental
|
|
615
|
+
*/
|
|
540
616
|
interface FlagOptions {
|
|
541
617
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
542
618
|
client?: LunoraClient;
|
|
@@ -564,8 +640,13 @@ interface FlagOptions {
|
|
|
564
640
|
* ```ts
|
|
565
641
|
* readonly darkMode = flag("dark-mode", false);
|
|
566
642
|
* ```
|
|
643
|
+
* @experimental
|
|
567
644
|
*/
|
|
568
645
|
declare const flag: <T extends FlagValue>(key: string, defaultValue: T, options?: FlagOptions) => Signal<T>;
|
|
646
|
+
/**
|
|
647
|
+
* `FlagsOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
648
|
+
* @experimental
|
|
649
|
+
*/
|
|
569
650
|
interface FlagsOptions {
|
|
570
651
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
571
652
|
client?: LunoraClient;
|
|
@@ -588,14 +669,23 @@ interface FlagsOptions {
|
|
|
588
669
|
* ```ts
|
|
589
670
|
* readonly features = flags({ "dark-mode": false, "new-editor": false });
|
|
590
671
|
* ```
|
|
672
|
+
* @experimental
|
|
591
673
|
*/
|
|
592
674
|
declare const flags: <T extends Record<string, FlagValue>>(flagDefaults: T, options?: FlagsOptions) => Signal<T>;
|
|
675
|
+
/**
|
|
676
|
+
* `HydratePreloadedOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
677
|
+
* @experimental
|
|
678
|
+
*/
|
|
593
679
|
interface HydratePreloadedOptions {
|
|
594
680
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
595
681
|
client?: LunoraClient;
|
|
596
682
|
/** `DestroyRef` whose `onDestroy` tears the subscription down. Defaults to `inject(DestroyRef)`. */
|
|
597
683
|
destroyRef?: DestroyRef;
|
|
598
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* `HydratePreloadedResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
687
|
+
* @experimental
|
|
688
|
+
*/
|
|
599
689
|
interface HydratePreloadedResult<T> {
|
|
600
690
|
/** The latest value pushed by the server. Seeded synchronously from the preloaded value. */
|
|
601
691
|
data: Signal<T | undefined>;
|
|
@@ -619,8 +709,13 @@ interface HydratePreloadedResult<T> {
|
|
|
619
709
|
* ```ts
|
|
620
710
|
* readonly { data, error } = hydratePreloaded(preloadedMessages);
|
|
621
711
|
* ```
|
|
712
|
+
* @experimental
|
|
622
713
|
*/
|
|
623
714
|
declare const hydratePreloaded: <T>(preloaded: Preloaded<T>, options?: HydratePreloadedOptions) => HydratePreloadedResult<T>;
|
|
715
|
+
/**
|
|
716
|
+
* `LiveQueryOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
717
|
+
* @experimental
|
|
718
|
+
*/
|
|
624
719
|
interface LiveQueryOptions {
|
|
625
720
|
/**
|
|
626
721
|
* Client to bind to. Defaults to the injected `LUNORA_CLIENT`; pass one
|
|
@@ -666,8 +761,13 @@ interface LiveQueryOptions {
|
|
|
666
761
|
* short-circuit — no network call, no socket; the signal stays `undefined`. To
|
|
667
762
|
* call outside an injection context (e.g. lazily in `ngOnInit`), supply `client`
|
|
668
763
|
* and `destroyRef` via {@link LiveQueryOptions}.
|
|
764
|
+
* @experimental
|
|
669
765
|
*/
|
|
670
766
|
declare const liveQuery: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip", options?: LiveQueryOptions) => Signal<ReturnOf<F> | undefined>;
|
|
767
|
+
/**
|
|
768
|
+
* `MutateOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
769
|
+
* @experimental
|
|
770
|
+
*/
|
|
671
771
|
interface MutateOptions<F extends FunctionReference> extends MutationCallOptions<unknown, unknown, ArgsOf<F>> {
|
|
672
772
|
/**
|
|
673
773
|
* Client to run the mutation on. Defaults to the injected `LUNORA_CLIENT`.
|
|
@@ -694,8 +794,13 @@ interface MutateOptions<F extends FunctionReference> extends MutationCallOptions
|
|
|
694
794
|
*
|
|
695
795
|
* When called from within an injection context you may omit `client` and let it
|
|
696
796
|
* resolve from the injector.
|
|
797
|
+
* @experimental
|
|
697
798
|
*/
|
|
698
799
|
declare const mutate: <F extends FunctionReference>(reference: F, args: ArgsOf<F>, options?: MutateOptions<F>) => Promise<ReturnOf<F>>;
|
|
800
|
+
/**
|
|
801
|
+
* `MutatorResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
802
|
+
* @experimental
|
|
803
|
+
*/
|
|
699
804
|
interface MutatorResult<TArgs> {
|
|
700
805
|
/** The latest invocation's error, or `undefined`. */
|
|
701
806
|
error: Signal<Error | undefined>;
|
|
@@ -724,6 +829,7 @@ interface MutatorResult<TArgs> {
|
|
|
724
829
|
* private readonly collection = bindMutators(collections);
|
|
725
830
|
* readonly mutator = mutator(this.collection.insert);
|
|
726
831
|
* ```
|
|
832
|
+
* @experimental
|
|
727
833
|
*/
|
|
728
834
|
declare const mutator: <TArgs = Record<string, unknown>>(handle: MutatorHandle<TArgs>) => MutatorResult<TArgs>;
|
|
729
835
|
/** The args a paginated query exposes minus the framework-supplied page cursor. */
|
|
@@ -734,6 +840,10 @@ type PageItemOf<F extends FunctionReference> = ReturnTypeOf<F> extends {
|
|
|
734
840
|
} ? T : unknown;
|
|
735
841
|
type ArgsOfRaw<F extends FunctionReference> = F extends FunctionReference<"query", infer A> ? A : never;
|
|
736
842
|
type ReturnTypeOf<F extends FunctionReference> = F extends FunctionReference<"query", unknown, infer R> ? R : never;
|
|
843
|
+
/**
|
|
844
|
+
* Options for the paginated query — part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
845
|
+
* @experimental
|
|
846
|
+
*/
|
|
737
847
|
interface PaginatedQueryOptions {
|
|
738
848
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
739
849
|
client?: LunoraClient;
|
|
@@ -744,6 +854,10 @@ interface PaginatedQueryOptions {
|
|
|
744
854
|
/** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
|
|
745
855
|
shardKey?: string;
|
|
746
856
|
}
|
|
857
|
+
/**
|
|
858
|
+
* `PaginatedQueryResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
859
|
+
* @experimental
|
|
860
|
+
*/
|
|
747
861
|
interface PaginatedQueryResult<T> {
|
|
748
862
|
/** `true` while the first page or a `loadMore` page is in flight. */
|
|
749
863
|
isLoading: Signal<boolean>;
|
|
@@ -754,6 +868,10 @@ interface PaginatedQueryResult<T> {
|
|
|
754
868
|
/** The pagination status. */
|
|
755
869
|
status: Signal<PaginationStatus>;
|
|
756
870
|
}
|
|
871
|
+
/**
|
|
872
|
+
* `InfiniteQueryResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
873
|
+
* @experimental
|
|
874
|
+
*/
|
|
757
875
|
interface InfiniteQueryResult<T> {
|
|
758
876
|
/** Request the next page. A no-op unless `status === "CanLoadMore"`. */
|
|
759
877
|
fetchNextPage: (numberItems?: number) => void;
|
|
@@ -783,6 +901,7 @@ interface InfiniteQueryResult<T> {
|
|
|
783
901
|
* ```ts
|
|
784
902
|
* readonly messages = paginatedQuery(api.messages.list, {}, { initialNumItems: 20 });
|
|
785
903
|
* ```
|
|
904
|
+
* @experimental
|
|
786
905
|
*/
|
|
787
906
|
declare const paginatedQuery: <F extends FunctionReference>(reference: F, args: PaginatedArgs<F> | "skip", options: PaginatedQueryOptions) => PaginatedQueryResult<PageItemOf<F>>;
|
|
788
907
|
/**
|
|
@@ -796,16 +915,29 @@ declare const paginatedQuery: <F extends FunctionReference>(reference: F, args:
|
|
|
796
915
|
* ```ts
|
|
797
916
|
* readonly feed = infiniteQuery(api.messages.list, {}, { initialNumItems: 20 });
|
|
798
917
|
* ```
|
|
918
|
+
* @experimental
|
|
799
919
|
*/
|
|
800
920
|
declare const infiniteQuery: <F extends FunctionReference>(reference: F, args: PaginatedArgs<F> | "skip", options: PaginatedQueryOptions) => InfiniteQueryResult<PageItemOf<F>>;
|
|
921
|
+
/**
|
|
922
|
+
* `HeartbeatReference` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
923
|
+
* @experimental
|
|
924
|
+
*/
|
|
801
925
|
type HeartbeatReference = FunctionReference<"mutation", {
|
|
802
926
|
data?: Record<string, unknown>;
|
|
803
927
|
roomId: string;
|
|
804
928
|
sessionId: string;
|
|
805
929
|
}>;
|
|
930
|
+
/**
|
|
931
|
+
* `ListPresentReference` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
932
|
+
* @experimental
|
|
933
|
+
*/
|
|
806
934
|
type ListPresentReference = FunctionReference<"query", {
|
|
807
935
|
roomId: string;
|
|
808
936
|
}>;
|
|
937
|
+
/**
|
|
938
|
+
* `PresenceOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
939
|
+
* @experimental
|
|
940
|
+
*/
|
|
809
941
|
interface PresenceOptions<H extends HeartbeatReference, L extends ListPresentReference> {
|
|
810
942
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
811
943
|
client?: LunoraClient;
|
|
@@ -827,6 +959,10 @@ interface PresenceOptions<H extends HeartbeatReference, L extends ListPresentRef
|
|
|
827
959
|
/** Forwarded to the heartbeat mutation / listPresent subscription when sharding by room. */
|
|
828
960
|
shardKey?: string;
|
|
829
961
|
}
|
|
962
|
+
/**
|
|
963
|
+
* `PresenceResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
964
|
+
* @experimental
|
|
965
|
+
*/
|
|
830
966
|
interface PresenceResult<L extends ListPresentReference> {
|
|
831
967
|
/** The present members for the room. `undefined` until the first push. */
|
|
832
968
|
present: Signal<ReturnOf<L> | undefined>;
|
|
@@ -849,8 +985,13 @@ interface PresenceResult<L extends ListPresentReference> {
|
|
|
849
985
|
* listPresent: api.presence.listPresent,
|
|
850
986
|
* });
|
|
851
987
|
* ```
|
|
988
|
+
* @experimental
|
|
852
989
|
*/
|
|
853
990
|
declare const presence: <H extends HeartbeatReference, L extends ListPresentReference>(roomId: string, options: PresenceOptions<H, L>) => PresenceResult<L>;
|
|
991
|
+
/**
|
|
992
|
+
* `RateLimitOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
993
|
+
* @experimental
|
|
994
|
+
*/
|
|
854
995
|
interface RateLimitOptions {
|
|
855
996
|
/**
|
|
856
997
|
* `DestroyRef` whose `onDestroy` clears the interval. Defaults to
|
|
@@ -865,6 +1006,10 @@ interface RateLimitOptions {
|
|
|
865
1006
|
*/
|
|
866
1007
|
tickMs?: number;
|
|
867
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* `RateLimitResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1011
|
+
* @experimental
|
|
1012
|
+
*/
|
|
868
1013
|
interface RateLimitResult {
|
|
869
1014
|
/** Would consuming `count` (default 1) succeed right now? Does not consume. */
|
|
870
1015
|
check: (count?: number) => boolean;
|
|
@@ -891,10 +1036,18 @@ interface RateLimitResult {
|
|
|
891
1036
|
* ```ts
|
|
892
1037
|
* readonly sendLimit = rateLimit({ kind: "token bucket", period: 1000, rate: 10 });
|
|
893
1038
|
* ```
|
|
1039
|
+
* @experimental
|
|
894
1040
|
*/
|
|
895
1041
|
declare const rateLimit: (config: RateLimitConfig, options?: RateLimitOptions) => RateLimitResult;
|
|
896
|
-
/**
|
|
1042
|
+
/**
|
|
1043
|
+
* The lifecycle of a stream the primitive is observing.
|
|
1044
|
+
* @experimental
|
|
1045
|
+
*/
|
|
897
1046
|
type StreamStatus = "complete" | "error" | "idle" | "streaming";
|
|
1047
|
+
/**
|
|
1048
|
+
* `StreamOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1049
|
+
* @experimental
|
|
1050
|
+
*/
|
|
898
1051
|
interface StreamOptions {
|
|
899
1052
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
900
1053
|
client?: LunoraClient;
|
|
@@ -908,6 +1061,10 @@ interface StreamOptions {
|
|
|
908
1061
|
/** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
|
|
909
1062
|
shardKey?: string;
|
|
910
1063
|
}
|
|
1064
|
+
/**
|
|
1065
|
+
* `StreamResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1066
|
+
* @experimental
|
|
1067
|
+
*/
|
|
911
1068
|
interface StreamResult<T> {
|
|
912
1069
|
/** Force-cancel the stream and resolve the iterator. Safe to call multiple times. */
|
|
913
1070
|
cancel: () => void;
|
|
@@ -933,8 +1090,13 @@ interface StreamResult<T> {
|
|
|
933
1090
|
* ```ts
|
|
934
1091
|
* readonly tokens = stream(api.chat.liveEvents, { key: "thread-1" });
|
|
935
1092
|
* ```
|
|
1093
|
+
* @experimental
|
|
936
1094
|
*/
|
|
937
1095
|
declare const stream: <F extends FunctionReference<"stream">>(reference: F, args: ArgsOf<F> | "skip", options?: StreamOptions) => StreamResult<ReturnOf<F>>;
|
|
1096
|
+
/**
|
|
1097
|
+
* `SubscriptionOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1098
|
+
* @experimental
|
|
1099
|
+
*/
|
|
938
1100
|
interface SubscriptionOptions {
|
|
939
1101
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
940
1102
|
client?: LunoraClient;
|
|
@@ -951,6 +1113,10 @@ interface SubscriptionOptions {
|
|
|
951
1113
|
/** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
|
|
952
1114
|
shardKey?: string;
|
|
953
1115
|
}
|
|
1116
|
+
/**
|
|
1117
|
+
* `SubscriptionResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1118
|
+
* @experimental
|
|
1119
|
+
*/
|
|
954
1120
|
interface SubscriptionResult<T> {
|
|
955
1121
|
/** The latest value pushed by the server. `undefined` before the first frame. */
|
|
956
1122
|
data: Signal<T | undefined>;
|
|
@@ -972,6 +1138,7 @@ interface SubscriptionResult<T> {
|
|
|
972
1138
|
* ```ts
|
|
973
1139
|
* readonly stream = subscription(api.events.stream, { roomId: "general" });
|
|
974
1140
|
* ```
|
|
1141
|
+
* @experimental
|
|
975
1142
|
*/
|
|
976
1143
|
declare const subscription: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip", options?: SubscriptionOptions) => SubscriptionResult<ReturnOf<F>>;
|
|
977
1144
|
/**
|
|
@@ -987,6 +1154,7 @@ declare const subscription: <F extends FunctionReference>(reference: F, args: Ar
|
|
|
987
1154
|
* `@lunora/agent`'s `VoiceServerFrame` `ready.audioFormat` — re-declared (not
|
|
988
1155
|
* imported) so this Angular package never pulls in the server-only `@lunora/agent`
|
|
989
1156
|
* module graph.
|
|
1157
|
+
* @experimental
|
|
990
1158
|
*/
|
|
991
1159
|
type VoiceAudioFormat = "mp3" | "wav";
|
|
992
1160
|
/** Captures microphone audio and reports level / turn boundaries back to the primitive. */
|
|
@@ -1039,11 +1207,15 @@ type CreateSpeaker = (config: {
|
|
|
1039
1207
|
* The `agents.<name>Voice` reference codegen emits for a voice-enabled agent — a
|
|
1040
1208
|
* live, WS-backed session keyed by `threadKey`. A structural subset of the
|
|
1041
1209
|
* generated member, so passing `api.agents.<name>Voice` type-checks.
|
|
1210
|
+
* @experimental
|
|
1042
1211
|
*/
|
|
1043
1212
|
type VoiceReference = FunctionReference<"stream", {
|
|
1044
1213
|
threadKey: string;
|
|
1045
1214
|
}, Record<string, unknown>>;
|
|
1046
|
-
/**
|
|
1215
|
+
/**
|
|
1216
|
+
* The lifecycle of a voice call, mirrored to the UI.
|
|
1217
|
+
* @experimental
|
|
1218
|
+
*/
|
|
1047
1219
|
type VoiceStatus = "idle" | "listening" | "speaking" | "thinking";
|
|
1048
1220
|
/** A minimal structural subset of the DOM `WebSocket` the primitive drives. */
|
|
1049
1221
|
interface VoiceSocket {
|
|
@@ -1059,6 +1231,10 @@ interface VoiceSocket {
|
|
|
1059
1231
|
send: (data: ArrayBufferView | ArrayBufferLike | string) => void;
|
|
1060
1232
|
}
|
|
1061
1233
|
type CreateSocket = (url: string) => VoiceSocket;
|
|
1234
|
+
/**
|
|
1235
|
+
* `VoiceAgentOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1236
|
+
* @experimental
|
|
1237
|
+
*/
|
|
1062
1238
|
interface VoiceAgentOptions {
|
|
1063
1239
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
1064
1240
|
client?: LunoraClient;
|
|
@@ -1090,6 +1266,10 @@ interface VoiceAgentOptions {
|
|
|
1090
1266
|
/** The generated `api.agents.<name>Voice` reference — identifies the voice DO endpoint. */
|
|
1091
1267
|
voice: VoiceReference;
|
|
1092
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* `VoiceAgentResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1271
|
+
* @experimental
|
|
1272
|
+
*/
|
|
1093
1273
|
interface VoiceAgentResult {
|
|
1094
1274
|
/** The current input RMS (0–1) — drive a mic level meter. */
|
|
1095
1275
|
audioLevel: Signal<number>;
|
|
@@ -1132,6 +1312,7 @@ interface VoiceAgentResult {
|
|
|
1132
1312
|
*
|
|
1133
1313
|
* Call from an injection context (component/service field or constructor); pass an
|
|
1134
1314
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
1315
|
+
* @experimental
|
|
1135
1316
|
*/
|
|
1136
1317
|
declare const voiceAgent: (options: VoiceAgentOptions) => VoiceAgentResult;
|
|
1137
1318
|
export { type AgentApi, type AgentChatApi, type AgentChatMessage, type AgentChatOptions, type AgentChatResult, type AgentLiveEvent, type AgentOptions, type AgentProgressEvent, type AgentResult, type AgentStateApi, type AgentStateOptions, type AgentStateResult, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentTokenStreamReference, type AgentToolEvent, type AgentToolEventsApi, type AgentToolEventsOptions, type AgentToolEventsResult, type AuthOptions, type AuthResult, type ConnectionStatusOptions, type FlagContext, type FlagOptions, type FlagValue, type FlagsOptions, type HeartbeatReference, type HydratePreloadedOptions, type HydratePreloadedResult, type InfiniteQueryResult, LUNORA_CLIENT, type ListPresentReference, type LiveQueryOptions, type MutateOptions, type MutatorResult, type PaginatedQueryOptions, type PaginatedQueryResult, type PresenceOptions, type PresenceResult, type ProvideLunoraOptions, type RateLimitOptions, type RateLimitResult, type StreamOptions, type StreamResult, type StreamStatus, type SubscriptionOptions, type SubscriptionResult, type VoiceAgentOptions, type VoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, agent, agentChat, agentState, agentToolEvents, auth, connectionStatus, flag, flags, hydratePreloaded, infiniteQuery, injectLunoraClient, liveQuery, mutate, mutator, paginatedQuery, presence, provideLunora, rateLimit, stream, subscription, voiceAgent };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { SKIP } from '@lunora/client/query';
|
|
|
10
10
|
* so this Angular entry never pulls in the server-only `@lunora/agent` module graph
|
|
11
11
|
* (the adapter stays Angular + `@lunora/client` only). Keep in sync with
|
|
12
12
|
* `packages/agent/src/types.ts`.
|
|
13
|
+
* @experimental
|
|
13
14
|
*/
|
|
14
15
|
type AgentThreadStatus = "awaiting_input" | "cancelled" | "error" | "idle" | "running";
|
|
15
16
|
/**
|
|
@@ -17,6 +18,7 @@ type AgentThreadStatus = "awaiting_input" | "cancelled" | "error" | "idle" | "ru
|
|
|
17
18
|
* subset of the persisted thread row — every field beyond `status` is optional so
|
|
18
19
|
* the shape stays forgiving as the server schema grows. Keep in sync with the
|
|
19
20
|
* `agent_threads` table in `packages/agent/src/component.ts`.
|
|
21
|
+
* @experimental
|
|
20
22
|
*/
|
|
21
23
|
interface AgentThreadRecord {
|
|
22
24
|
createdAt?: number;
|
|
@@ -37,6 +39,7 @@ interface AgentThreadRecord {
|
|
|
37
39
|
* re-declared here (rather than imported) so this Angular entry never pulls in the
|
|
38
40
|
* server-only `@lunora/agent` module graph. Keep in sync with the
|
|
39
41
|
* `agent_messages` table in `packages/agent/src/component.ts`.
|
|
42
|
+
* @experimental
|
|
40
43
|
*/
|
|
41
44
|
interface AgentChatMessage {
|
|
42
45
|
content: string;
|
|
@@ -63,6 +66,7 @@ interface AgentChatMessage {
|
|
|
63
66
|
* `@lunora/agent`'s `AgentTokenDelta`. Ephemeral — deltas feed the chat surface's
|
|
64
67
|
* streaming text live and are never replayed; the persisted assistant message
|
|
65
68
|
* stays the single source of truth.
|
|
69
|
+
* @experimental
|
|
66
70
|
*/
|
|
67
71
|
interface AgentTokenDelta {
|
|
68
72
|
/** Discriminates the token arm of {@link AgentLiveEvent}; unset on the wire (token is the default). */
|
|
@@ -78,6 +82,7 @@ interface AgentTokenDelta {
|
|
|
78
82
|
* A live tool-progress event streamed via `ctx.reportProgress(...)`. Client-safe
|
|
79
83
|
* mirror of `@lunora/agent`'s `AgentProgressEvent`. Ephemeral and `toolCallId`-keyed;
|
|
80
84
|
* surfaced by `agentToolEvents`, ignored by the chat surface's streaming text.
|
|
85
|
+
* @experimental
|
|
81
86
|
*/
|
|
82
87
|
interface AgentProgressEvent {
|
|
83
88
|
/** The arbitrary, JSON-serializable payload the tool reported. */
|
|
@@ -94,6 +99,7 @@ interface AgentProgressEvent {
|
|
|
94
99
|
* tool progress event. Client-safe mirror of `@lunora/agent`'s `AgentLiveEvent`.
|
|
95
100
|
* Discriminate on `kind` (`"progress"` for the progress arm; token deltas leave
|
|
96
101
|
* it unset).
|
|
102
|
+
* @experimental
|
|
97
103
|
*/
|
|
98
104
|
type AgentLiveEvent = AgentProgressEvent | AgentTokenDelta;
|
|
99
105
|
/**
|
|
@@ -101,6 +107,7 @@ type AgentLiveEvent = AgentProgressEvent | AgentTokenDelta;
|
|
|
101
107
|
* state (status + the in-flight `instanceId`). A structural subset of the
|
|
102
108
|
* generated `api.agents` surface, so the whole generated `api` object is
|
|
103
109
|
* assignable.
|
|
110
|
+
* @experimental
|
|
104
111
|
*/
|
|
105
112
|
interface AgentApi {
|
|
106
113
|
agents: {
|
|
@@ -109,6 +116,10 @@ interface AgentApi {
|
|
|
109
116
|
}, Record<string, unknown> | undefined>;
|
|
110
117
|
};
|
|
111
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* `AgentOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
121
|
+
* @experimental
|
|
122
|
+
*/
|
|
112
123
|
interface AgentOptions {
|
|
113
124
|
/** The generated `api` — its `agents.agentThread` query drives live thread state. */
|
|
114
125
|
api: AgentApi;
|
|
@@ -136,6 +147,10 @@ interface AgentOptions {
|
|
|
136
147
|
/** The thread to observe and drive. */
|
|
137
148
|
threadKey: string;
|
|
138
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* `AgentResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
152
|
+
* @experimental
|
|
153
|
+
*/
|
|
139
154
|
interface AgentResult {
|
|
140
155
|
/**
|
|
141
156
|
* Terminate the in-flight run and mark its thread `"cancelled"`. Resolves as a
|
|
@@ -164,6 +179,7 @@ interface AgentResult {
|
|
|
164
179
|
*
|
|
165
180
|
* Call from an injection context (component/service field or constructor); pass an
|
|
166
181
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
182
|
+
* @experimental
|
|
167
183
|
*/
|
|
168
184
|
declare const agent: (options: AgentOptions) => AgentResult;
|
|
169
185
|
/** The `agents:agentMessages` reference — live durable thread history. */
|
|
@@ -189,6 +205,7 @@ type AgentThreadReference = FunctionReference<"query", {
|
|
|
189
205
|
* An app stream reference that tees the agent's in-flight live events, keyed by
|
|
190
206
|
* thread. Carries token deltas and — since `ctx.reportProgress` rides the same
|
|
191
207
|
* sink — tool progress events; this primitive consumes only the token arm.
|
|
208
|
+
* @experimental
|
|
192
209
|
*/
|
|
193
210
|
type AgentTokenStreamReference = FunctionReference<"stream", {
|
|
194
211
|
key: string;
|
|
@@ -197,6 +214,7 @@ type AgentTokenStreamReference = FunctionReference<"stream", {
|
|
|
197
214
|
* The `agents.*` reference surface the chat primitive reads. A structural subset
|
|
198
215
|
* of the generated `api.agents`, so the whole generated `api` object is
|
|
199
216
|
* assignable.
|
|
217
|
+
* @experimental
|
|
200
218
|
*/
|
|
201
219
|
interface AgentChatApi {
|
|
202
220
|
agents: {
|
|
@@ -205,6 +223,10 @@ interface AgentChatApi {
|
|
|
205
223
|
agentThread: AgentThreadReference;
|
|
206
224
|
};
|
|
207
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* `AgentChatOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
228
|
+
* @experimental
|
|
229
|
+
*/
|
|
208
230
|
interface AgentChatOptions {
|
|
209
231
|
/** The generated `api` — its `agents.*` surface provides history, thread state, and approval resolution. */
|
|
210
232
|
api: AgentChatApi;
|
|
@@ -241,6 +263,10 @@ interface AgentChatOptions {
|
|
|
241
263
|
/** The thread to observe and continue. */
|
|
242
264
|
threadKey: string;
|
|
243
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* `AgentChatResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
268
|
+
* @experimental
|
|
269
|
+
*/
|
|
244
270
|
interface AgentChatResult {
|
|
245
271
|
/** Approve a paused human-in-the-loop tool call (optionally with a note). */
|
|
246
272
|
approve: (toolCallId: string, note?: string) => Promise<void>;
|
|
@@ -282,6 +308,7 @@ interface AgentChatResult {
|
|
|
282
308
|
*
|
|
283
309
|
* Call from an injection context (component/service field or constructor); pass an
|
|
284
310
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
311
|
+
* @experimental
|
|
285
312
|
*/
|
|
286
313
|
declare const agentChat: (options: AgentChatOptions) => AgentChatResult;
|
|
287
314
|
/**
|
|
@@ -291,6 +318,7 @@ declare const agentChat: (options: AgentChatOptions) => AgentChatResult;
|
|
|
291
318
|
* assignable. Client-safe: no `@lunora/agent` import — the per-agent state type is
|
|
292
319
|
* mirrored by the primitive's generic `T`, since codegen pins the reference return
|
|
293
320
|
* as an optional record (it never evaluates agent config).
|
|
321
|
+
* @experimental
|
|
294
322
|
*/
|
|
295
323
|
interface AgentStateApi {
|
|
296
324
|
agents: {
|
|
@@ -299,6 +327,10 @@ interface AgentStateApi {
|
|
|
299
327
|
}, Record<string, unknown> | undefined>;
|
|
300
328
|
};
|
|
301
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* `AgentStateOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
332
|
+
* @experimental
|
|
333
|
+
*/
|
|
302
334
|
interface AgentStateOptions {
|
|
303
335
|
/** The generated `api` — its `agents.agentState` query drives live thread state. */
|
|
304
336
|
api: AgentStateApi;
|
|
@@ -312,6 +344,10 @@ interface AgentStateOptions {
|
|
|
312
344
|
/** The thread whose synced state to observe. */
|
|
313
345
|
threadKey: string;
|
|
314
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* `AgentStateResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
349
|
+
* @experimental
|
|
350
|
+
*/
|
|
315
351
|
interface AgentStateResult<T> {
|
|
316
352
|
/** The subscription error, if the live channel reported one. */
|
|
317
353
|
error: Signal<SubscriptionError | undefined>;
|
|
@@ -335,6 +371,7 @@ interface AgentStateResult<T> {
|
|
|
335
371
|
*
|
|
336
372
|
* Call from an injection context (component/service field or constructor); pass an
|
|
337
373
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
374
|
+
* @experimental
|
|
338
375
|
*/
|
|
339
376
|
declare const agentState: <T extends Record<string, unknown> = Record<string, unknown>>(options: AgentStateOptions) => AgentStateResult<T>;
|
|
340
377
|
/** The `agents:agentMessages` reference — live durable thread history. */
|
|
@@ -354,12 +391,17 @@ type AgentLiveStreamReference = FunctionReference<"stream", {
|
|
|
354
391
|
* The `agents.*` reference surface the tool-events primitive reads. A structural
|
|
355
392
|
* subset of the generated `api.agents`, so the whole generated `api` object is
|
|
356
393
|
* assignable.
|
|
394
|
+
* @experimental
|
|
357
395
|
*/
|
|
358
396
|
interface AgentToolEventsApi {
|
|
359
397
|
agents: {
|
|
360
398
|
agentMessages: AgentMessagesReference;
|
|
361
399
|
};
|
|
362
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* `AgentToolEventsOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
403
|
+
* @experimental
|
|
404
|
+
*/
|
|
363
405
|
interface AgentToolEventsOptions {
|
|
364
406
|
/** The generated `api` — its `agents.agentMessages` query provides the durable tool lifecycle. */
|
|
365
407
|
api: AgentToolEventsApi;
|
|
@@ -387,6 +429,7 @@ interface AgentToolEventsOptions {
|
|
|
387
429
|
* (`call`/`result`/`awaiting-approval`) are derived from `agents:agentMessages`
|
|
388
430
|
* and carry the persisted `seq`; the ephemeral `progress` arm comes live off the
|
|
389
431
|
* stream and has no `seq`. Discriminate on `type`.
|
|
432
|
+
* @experimental
|
|
390
433
|
*/
|
|
391
434
|
type AgentToolEvent = {
|
|
392
435
|
data: unknown;
|
|
@@ -411,6 +454,10 @@ type AgentToolEvent = {
|
|
|
411
454
|
toolName?: string;
|
|
412
455
|
type: "awaiting-approval";
|
|
413
456
|
};
|
|
457
|
+
/**
|
|
458
|
+
* `AgentToolEventsResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
459
|
+
* @experimental
|
|
460
|
+
*/
|
|
414
461
|
interface AgentToolEventsResult {
|
|
415
462
|
/**
|
|
416
463
|
* The thread's tool events: the durable lifecycle (oldest first, by `seq`)
|
|
@@ -435,14 +482,23 @@ interface AgentToolEventsResult {
|
|
|
435
482
|
*
|
|
436
483
|
* Call from an injection context (component/service field or constructor); pass an
|
|
437
484
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
485
|
+
* @experimental
|
|
438
486
|
*/
|
|
439
487
|
declare const agentToolEvents: (options: AgentToolEventsOptions) => AgentToolEventsResult;
|
|
488
|
+
/**
|
|
489
|
+
* `AuthOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
490
|
+
* @experimental
|
|
491
|
+
*/
|
|
440
492
|
interface AuthOptions {
|
|
441
493
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
442
494
|
client?: LunoraClient;
|
|
443
495
|
/** `DestroyRef` whose `onDestroy` removes the listeners. Defaults to `inject(DestroyRef)`. */
|
|
444
496
|
destroyRef?: DestroyRef;
|
|
445
497
|
}
|
|
498
|
+
/**
|
|
499
|
+
* `AuthResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
500
|
+
* @experimental
|
|
501
|
+
*/
|
|
446
502
|
interface AuthResult {
|
|
447
503
|
/** Set the auth token (sign-in / sign-out). */
|
|
448
504
|
setToken: (token: string | null) => void;
|
|
@@ -465,6 +521,7 @@ interface AuthResult {
|
|
|
465
521
|
* ```ts
|
|
466
522
|
* const { token, user, setToken } = auth();
|
|
467
523
|
* ```
|
|
524
|
+
* @experimental
|
|
468
525
|
*/
|
|
469
526
|
declare const auth: (options?: AuthOptions) => AuthResult;
|
|
470
527
|
/**
|
|
@@ -477,6 +534,7 @@ declare const auth: (options?: AuthOptions) => AuthResult;
|
|
|
477
534
|
* {@link provideLunora}: it builds one same-origin browser client (which opens
|
|
478
535
|
* its WebSocket lazily on the first subscription). Call {@link provideLunora} to
|
|
479
536
|
* point it at a remote URL or hand it a pre-built client.
|
|
537
|
+
* @experimental
|
|
480
538
|
*/
|
|
481
539
|
declare const LUNORA_CLIENT: InjectionToken<LunoraClient>;
|
|
482
540
|
/**
|
|
@@ -484,6 +542,7 @@ declare const LUNORA_CLIENT: InjectionToken<LunoraClient>;
|
|
|
484
542
|
* except `url` is optional — it defaults to the page origin in the browser (and to
|
|
485
543
|
* `""` on the server; pass an explicit `url` for SSR data-loading — see
|
|
486
544
|
* {@link sameOriginUrl}).
|
|
545
|
+
* @experimental
|
|
487
546
|
*/
|
|
488
547
|
type ProvideLunoraOptions = Omit<LunoraClientOptions, "url"> & {
|
|
489
548
|
url?: string;
|
|
@@ -502,6 +561,7 @@ type ProvideLunoraOptions = Omit<LunoraClientOptions, "url"> & {
|
|
|
502
561
|
* Pass {@link LunoraClientOptions} to configure a fresh client (URL defaults to
|
|
503
562
|
* the page origin), or hand in an already-constructed {@link LunoraClient} to
|
|
504
563
|
* share one instance (e.g. a client you also preload against during SSR).
|
|
564
|
+
* @experimental
|
|
505
565
|
*/
|
|
506
566
|
declare const provideLunora: (optionsOrClient?: LunoraClient | ProvideLunoraOptions) => EnvironmentProviders;
|
|
507
567
|
/**
|
|
@@ -515,8 +575,13 @@ declare const provideLunora: (optionsOrClient?: LunoraClient | ProvideLunoraOpti
|
|
|
515
575
|
* private readonly client = injectLunoraClient();
|
|
516
576
|
* send = (text: string) => this.client.mutation(api.messages.send, { text });
|
|
517
577
|
* ```
|
|
578
|
+
* @experimental
|
|
518
579
|
*/
|
|
519
580
|
declare const injectLunoraClient: () => LunoraClient;
|
|
581
|
+
/**
|
|
582
|
+
* `ConnectionStatusOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
583
|
+
* @experimental
|
|
584
|
+
*/
|
|
520
585
|
interface ConnectionStatusOptions {
|
|
521
586
|
/** Client to observe. Defaults to the injected `LUNORA_CLIENT`. */
|
|
522
587
|
client?: LunoraClient;
|
|
@@ -531,12 +596,23 @@ interface ConnectionStatusOptions {
|
|
|
531
596
|
*
|
|
532
597
|
* The listener is removed when the owning `DestroyRef` fires. Call from an
|
|
533
598
|
* injection context (component/service field or constructor).
|
|
599
|
+
* @experimental
|
|
534
600
|
*/
|
|
535
601
|
declare const connectionStatus: (options?: ConnectionStatusOptions) => Signal<ConnectionStatus>;
|
|
536
|
-
/**
|
|
602
|
+
/**
|
|
603
|
+
* The value kinds a flag resolves to — OpenFeature's boolean / number / string / structured (JSON) flags.
|
|
604
|
+
* @experimental
|
|
605
|
+
*/
|
|
537
606
|
type FlagValue = boolean | number | string | Record<string, unknown> | unknown[] | null;
|
|
538
|
-
/**
|
|
607
|
+
/**
|
|
608
|
+
* Targeting context bag forwarded to the OpenFeature provider.
|
|
609
|
+
* @experimental
|
|
610
|
+
*/
|
|
539
611
|
type FlagContext = Record<string, unknown>;
|
|
612
|
+
/**
|
|
613
|
+
* `FlagOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
614
|
+
* @experimental
|
|
615
|
+
*/
|
|
540
616
|
interface FlagOptions {
|
|
541
617
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
542
618
|
client?: LunoraClient;
|
|
@@ -564,8 +640,13 @@ interface FlagOptions {
|
|
|
564
640
|
* ```ts
|
|
565
641
|
* readonly darkMode = flag("dark-mode", false);
|
|
566
642
|
* ```
|
|
643
|
+
* @experimental
|
|
567
644
|
*/
|
|
568
645
|
declare const flag: <T extends FlagValue>(key: string, defaultValue: T, options?: FlagOptions) => Signal<T>;
|
|
646
|
+
/**
|
|
647
|
+
* `FlagsOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
648
|
+
* @experimental
|
|
649
|
+
*/
|
|
569
650
|
interface FlagsOptions {
|
|
570
651
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
571
652
|
client?: LunoraClient;
|
|
@@ -588,14 +669,23 @@ interface FlagsOptions {
|
|
|
588
669
|
* ```ts
|
|
589
670
|
* readonly features = flags({ "dark-mode": false, "new-editor": false });
|
|
590
671
|
* ```
|
|
672
|
+
* @experimental
|
|
591
673
|
*/
|
|
592
674
|
declare const flags: <T extends Record<string, FlagValue>>(flagDefaults: T, options?: FlagsOptions) => Signal<T>;
|
|
675
|
+
/**
|
|
676
|
+
* `HydratePreloadedOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
677
|
+
* @experimental
|
|
678
|
+
*/
|
|
593
679
|
interface HydratePreloadedOptions {
|
|
594
680
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
595
681
|
client?: LunoraClient;
|
|
596
682
|
/** `DestroyRef` whose `onDestroy` tears the subscription down. Defaults to `inject(DestroyRef)`. */
|
|
597
683
|
destroyRef?: DestroyRef;
|
|
598
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* `HydratePreloadedResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
687
|
+
* @experimental
|
|
688
|
+
*/
|
|
599
689
|
interface HydratePreloadedResult<T> {
|
|
600
690
|
/** The latest value pushed by the server. Seeded synchronously from the preloaded value. */
|
|
601
691
|
data: Signal<T | undefined>;
|
|
@@ -619,8 +709,13 @@ interface HydratePreloadedResult<T> {
|
|
|
619
709
|
* ```ts
|
|
620
710
|
* readonly { data, error } = hydratePreloaded(preloadedMessages);
|
|
621
711
|
* ```
|
|
712
|
+
* @experimental
|
|
622
713
|
*/
|
|
623
714
|
declare const hydratePreloaded: <T>(preloaded: Preloaded<T>, options?: HydratePreloadedOptions) => HydratePreloadedResult<T>;
|
|
715
|
+
/**
|
|
716
|
+
* `LiveQueryOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
717
|
+
* @experimental
|
|
718
|
+
*/
|
|
624
719
|
interface LiveQueryOptions {
|
|
625
720
|
/**
|
|
626
721
|
* Client to bind to. Defaults to the injected `LUNORA_CLIENT`; pass one
|
|
@@ -666,8 +761,13 @@ interface LiveQueryOptions {
|
|
|
666
761
|
* short-circuit — no network call, no socket; the signal stays `undefined`. To
|
|
667
762
|
* call outside an injection context (e.g. lazily in `ngOnInit`), supply `client`
|
|
668
763
|
* and `destroyRef` via {@link LiveQueryOptions}.
|
|
764
|
+
* @experimental
|
|
669
765
|
*/
|
|
670
766
|
declare const liveQuery: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip", options?: LiveQueryOptions) => Signal<ReturnOf<F> | undefined>;
|
|
767
|
+
/**
|
|
768
|
+
* `MutateOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
769
|
+
* @experimental
|
|
770
|
+
*/
|
|
671
771
|
interface MutateOptions<F extends FunctionReference> extends MutationCallOptions<unknown, unknown, ArgsOf<F>> {
|
|
672
772
|
/**
|
|
673
773
|
* Client to run the mutation on. Defaults to the injected `LUNORA_CLIENT`.
|
|
@@ -694,8 +794,13 @@ interface MutateOptions<F extends FunctionReference> extends MutationCallOptions
|
|
|
694
794
|
*
|
|
695
795
|
* When called from within an injection context you may omit `client` and let it
|
|
696
796
|
* resolve from the injector.
|
|
797
|
+
* @experimental
|
|
697
798
|
*/
|
|
698
799
|
declare const mutate: <F extends FunctionReference>(reference: F, args: ArgsOf<F>, options?: MutateOptions<F>) => Promise<ReturnOf<F>>;
|
|
800
|
+
/**
|
|
801
|
+
* `MutatorResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
802
|
+
* @experimental
|
|
803
|
+
*/
|
|
699
804
|
interface MutatorResult<TArgs> {
|
|
700
805
|
/** The latest invocation's error, or `undefined`. */
|
|
701
806
|
error: Signal<Error | undefined>;
|
|
@@ -724,6 +829,7 @@ interface MutatorResult<TArgs> {
|
|
|
724
829
|
* private readonly collection = bindMutators(collections);
|
|
725
830
|
* readonly mutator = mutator(this.collection.insert);
|
|
726
831
|
* ```
|
|
832
|
+
* @experimental
|
|
727
833
|
*/
|
|
728
834
|
declare const mutator: <TArgs = Record<string, unknown>>(handle: MutatorHandle<TArgs>) => MutatorResult<TArgs>;
|
|
729
835
|
/** The args a paginated query exposes minus the framework-supplied page cursor. */
|
|
@@ -734,6 +840,10 @@ type PageItemOf<F extends FunctionReference> = ReturnTypeOf<F> extends {
|
|
|
734
840
|
} ? T : unknown;
|
|
735
841
|
type ArgsOfRaw<F extends FunctionReference> = F extends FunctionReference<"query", infer A> ? A : never;
|
|
736
842
|
type ReturnTypeOf<F extends FunctionReference> = F extends FunctionReference<"query", unknown, infer R> ? R : never;
|
|
843
|
+
/**
|
|
844
|
+
* Options for the paginated query — part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
845
|
+
* @experimental
|
|
846
|
+
*/
|
|
737
847
|
interface PaginatedQueryOptions {
|
|
738
848
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
739
849
|
client?: LunoraClient;
|
|
@@ -744,6 +854,10 @@ interface PaginatedQueryOptions {
|
|
|
744
854
|
/** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
|
|
745
855
|
shardKey?: string;
|
|
746
856
|
}
|
|
857
|
+
/**
|
|
858
|
+
* `PaginatedQueryResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
859
|
+
* @experimental
|
|
860
|
+
*/
|
|
747
861
|
interface PaginatedQueryResult<T> {
|
|
748
862
|
/** `true` while the first page or a `loadMore` page is in flight. */
|
|
749
863
|
isLoading: Signal<boolean>;
|
|
@@ -754,6 +868,10 @@ interface PaginatedQueryResult<T> {
|
|
|
754
868
|
/** The pagination status. */
|
|
755
869
|
status: Signal<PaginationStatus>;
|
|
756
870
|
}
|
|
871
|
+
/**
|
|
872
|
+
* `InfiniteQueryResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
873
|
+
* @experimental
|
|
874
|
+
*/
|
|
757
875
|
interface InfiniteQueryResult<T> {
|
|
758
876
|
/** Request the next page. A no-op unless `status === "CanLoadMore"`. */
|
|
759
877
|
fetchNextPage: (numberItems?: number) => void;
|
|
@@ -783,6 +901,7 @@ interface InfiniteQueryResult<T> {
|
|
|
783
901
|
* ```ts
|
|
784
902
|
* readonly messages = paginatedQuery(api.messages.list, {}, { initialNumItems: 20 });
|
|
785
903
|
* ```
|
|
904
|
+
* @experimental
|
|
786
905
|
*/
|
|
787
906
|
declare const paginatedQuery: <F extends FunctionReference>(reference: F, args: PaginatedArgs<F> | "skip", options: PaginatedQueryOptions) => PaginatedQueryResult<PageItemOf<F>>;
|
|
788
907
|
/**
|
|
@@ -796,16 +915,29 @@ declare const paginatedQuery: <F extends FunctionReference>(reference: F, args:
|
|
|
796
915
|
* ```ts
|
|
797
916
|
* readonly feed = infiniteQuery(api.messages.list, {}, { initialNumItems: 20 });
|
|
798
917
|
* ```
|
|
918
|
+
* @experimental
|
|
799
919
|
*/
|
|
800
920
|
declare const infiniteQuery: <F extends FunctionReference>(reference: F, args: PaginatedArgs<F> | "skip", options: PaginatedQueryOptions) => InfiniteQueryResult<PageItemOf<F>>;
|
|
921
|
+
/**
|
|
922
|
+
* `HeartbeatReference` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
923
|
+
* @experimental
|
|
924
|
+
*/
|
|
801
925
|
type HeartbeatReference = FunctionReference<"mutation", {
|
|
802
926
|
data?: Record<string, unknown>;
|
|
803
927
|
roomId: string;
|
|
804
928
|
sessionId: string;
|
|
805
929
|
}>;
|
|
930
|
+
/**
|
|
931
|
+
* `ListPresentReference` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
932
|
+
* @experimental
|
|
933
|
+
*/
|
|
806
934
|
type ListPresentReference = FunctionReference<"query", {
|
|
807
935
|
roomId: string;
|
|
808
936
|
}>;
|
|
937
|
+
/**
|
|
938
|
+
* `PresenceOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
939
|
+
* @experimental
|
|
940
|
+
*/
|
|
809
941
|
interface PresenceOptions<H extends HeartbeatReference, L extends ListPresentReference> {
|
|
810
942
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
811
943
|
client?: LunoraClient;
|
|
@@ -827,6 +959,10 @@ interface PresenceOptions<H extends HeartbeatReference, L extends ListPresentRef
|
|
|
827
959
|
/** Forwarded to the heartbeat mutation / listPresent subscription when sharding by room. */
|
|
828
960
|
shardKey?: string;
|
|
829
961
|
}
|
|
962
|
+
/**
|
|
963
|
+
* `PresenceResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
964
|
+
* @experimental
|
|
965
|
+
*/
|
|
830
966
|
interface PresenceResult<L extends ListPresentReference> {
|
|
831
967
|
/** The present members for the room. `undefined` until the first push. */
|
|
832
968
|
present: Signal<ReturnOf<L> | undefined>;
|
|
@@ -849,8 +985,13 @@ interface PresenceResult<L extends ListPresentReference> {
|
|
|
849
985
|
* listPresent: api.presence.listPresent,
|
|
850
986
|
* });
|
|
851
987
|
* ```
|
|
988
|
+
* @experimental
|
|
852
989
|
*/
|
|
853
990
|
declare const presence: <H extends HeartbeatReference, L extends ListPresentReference>(roomId: string, options: PresenceOptions<H, L>) => PresenceResult<L>;
|
|
991
|
+
/**
|
|
992
|
+
* `RateLimitOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
993
|
+
* @experimental
|
|
994
|
+
*/
|
|
854
995
|
interface RateLimitOptions {
|
|
855
996
|
/**
|
|
856
997
|
* `DestroyRef` whose `onDestroy` clears the interval. Defaults to
|
|
@@ -865,6 +1006,10 @@ interface RateLimitOptions {
|
|
|
865
1006
|
*/
|
|
866
1007
|
tickMs?: number;
|
|
867
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* `RateLimitResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1011
|
+
* @experimental
|
|
1012
|
+
*/
|
|
868
1013
|
interface RateLimitResult {
|
|
869
1014
|
/** Would consuming `count` (default 1) succeed right now? Does not consume. */
|
|
870
1015
|
check: (count?: number) => boolean;
|
|
@@ -891,10 +1036,18 @@ interface RateLimitResult {
|
|
|
891
1036
|
* ```ts
|
|
892
1037
|
* readonly sendLimit = rateLimit({ kind: "token bucket", period: 1000, rate: 10 });
|
|
893
1038
|
* ```
|
|
1039
|
+
* @experimental
|
|
894
1040
|
*/
|
|
895
1041
|
declare const rateLimit: (config: RateLimitConfig, options?: RateLimitOptions) => RateLimitResult;
|
|
896
|
-
/**
|
|
1042
|
+
/**
|
|
1043
|
+
* The lifecycle of a stream the primitive is observing.
|
|
1044
|
+
* @experimental
|
|
1045
|
+
*/
|
|
897
1046
|
type StreamStatus = "complete" | "error" | "idle" | "streaming";
|
|
1047
|
+
/**
|
|
1048
|
+
* `StreamOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1049
|
+
* @experimental
|
|
1050
|
+
*/
|
|
898
1051
|
interface StreamOptions {
|
|
899
1052
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
900
1053
|
client?: LunoraClient;
|
|
@@ -908,6 +1061,10 @@ interface StreamOptions {
|
|
|
908
1061
|
/** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
|
|
909
1062
|
shardKey?: string;
|
|
910
1063
|
}
|
|
1064
|
+
/**
|
|
1065
|
+
* `StreamResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1066
|
+
* @experimental
|
|
1067
|
+
*/
|
|
911
1068
|
interface StreamResult<T> {
|
|
912
1069
|
/** Force-cancel the stream and resolve the iterator. Safe to call multiple times. */
|
|
913
1070
|
cancel: () => void;
|
|
@@ -933,8 +1090,13 @@ interface StreamResult<T> {
|
|
|
933
1090
|
* ```ts
|
|
934
1091
|
* readonly tokens = stream(api.chat.liveEvents, { key: "thread-1" });
|
|
935
1092
|
* ```
|
|
1093
|
+
* @experimental
|
|
936
1094
|
*/
|
|
937
1095
|
declare const stream: <F extends FunctionReference<"stream">>(reference: F, args: ArgsOf<F> | "skip", options?: StreamOptions) => StreamResult<ReturnOf<F>>;
|
|
1096
|
+
/**
|
|
1097
|
+
* `SubscriptionOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1098
|
+
* @experimental
|
|
1099
|
+
*/
|
|
938
1100
|
interface SubscriptionOptions {
|
|
939
1101
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
940
1102
|
client?: LunoraClient;
|
|
@@ -951,6 +1113,10 @@ interface SubscriptionOptions {
|
|
|
951
1113
|
/** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
|
|
952
1114
|
shardKey?: string;
|
|
953
1115
|
}
|
|
1116
|
+
/**
|
|
1117
|
+
* `SubscriptionResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1118
|
+
* @experimental
|
|
1119
|
+
*/
|
|
954
1120
|
interface SubscriptionResult<T> {
|
|
955
1121
|
/** The latest value pushed by the server. `undefined` before the first frame. */
|
|
956
1122
|
data: Signal<T | undefined>;
|
|
@@ -972,6 +1138,7 @@ interface SubscriptionResult<T> {
|
|
|
972
1138
|
* ```ts
|
|
973
1139
|
* readonly stream = subscription(api.events.stream, { roomId: "general" });
|
|
974
1140
|
* ```
|
|
1141
|
+
* @experimental
|
|
975
1142
|
*/
|
|
976
1143
|
declare const subscription: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip", options?: SubscriptionOptions) => SubscriptionResult<ReturnOf<F>>;
|
|
977
1144
|
/**
|
|
@@ -987,6 +1154,7 @@ declare const subscription: <F extends FunctionReference>(reference: F, args: Ar
|
|
|
987
1154
|
* `@lunora/agent`'s `VoiceServerFrame` `ready.audioFormat` — re-declared (not
|
|
988
1155
|
* imported) so this Angular package never pulls in the server-only `@lunora/agent`
|
|
989
1156
|
* module graph.
|
|
1157
|
+
* @experimental
|
|
990
1158
|
*/
|
|
991
1159
|
type VoiceAudioFormat = "mp3" | "wav";
|
|
992
1160
|
/** Captures microphone audio and reports level / turn boundaries back to the primitive. */
|
|
@@ -1039,11 +1207,15 @@ type CreateSpeaker = (config: {
|
|
|
1039
1207
|
* The `agents.<name>Voice` reference codegen emits for a voice-enabled agent — a
|
|
1040
1208
|
* live, WS-backed session keyed by `threadKey`. A structural subset of the
|
|
1041
1209
|
* generated member, so passing `api.agents.<name>Voice` type-checks.
|
|
1210
|
+
* @experimental
|
|
1042
1211
|
*/
|
|
1043
1212
|
type VoiceReference = FunctionReference<"stream", {
|
|
1044
1213
|
threadKey: string;
|
|
1045
1214
|
}, Record<string, unknown>>;
|
|
1046
|
-
/**
|
|
1215
|
+
/**
|
|
1216
|
+
* The lifecycle of a voice call, mirrored to the UI.
|
|
1217
|
+
* @experimental
|
|
1218
|
+
*/
|
|
1047
1219
|
type VoiceStatus = "idle" | "listening" | "speaking" | "thinking";
|
|
1048
1220
|
/** A minimal structural subset of the DOM `WebSocket` the primitive drives. */
|
|
1049
1221
|
interface VoiceSocket {
|
|
@@ -1059,6 +1231,10 @@ interface VoiceSocket {
|
|
|
1059
1231
|
send: (data: ArrayBufferView | ArrayBufferLike | string) => void;
|
|
1060
1232
|
}
|
|
1061
1233
|
type CreateSocket = (url: string) => VoiceSocket;
|
|
1234
|
+
/**
|
|
1235
|
+
* `VoiceAgentOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1236
|
+
* @experimental
|
|
1237
|
+
*/
|
|
1062
1238
|
interface VoiceAgentOptions {
|
|
1063
1239
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
1064
1240
|
client?: LunoraClient;
|
|
@@ -1090,6 +1266,10 @@ interface VoiceAgentOptions {
|
|
|
1090
1266
|
/** The generated `api.agents.<name>Voice` reference — identifies the voice DO endpoint. */
|
|
1091
1267
|
voice: VoiceReference;
|
|
1092
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* `VoiceAgentResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1271
|
+
* @experimental
|
|
1272
|
+
*/
|
|
1093
1273
|
interface VoiceAgentResult {
|
|
1094
1274
|
/** The current input RMS (0–1) — drive a mic level meter. */
|
|
1095
1275
|
audioLevel: Signal<number>;
|
|
@@ -1132,6 +1312,7 @@ interface VoiceAgentResult {
|
|
|
1132
1312
|
*
|
|
1133
1313
|
* Call from an injection context (component/service field or constructor); pass an
|
|
1134
1314
|
* explicit `client` / `destroyRef` to drive it outside one (e.g. in a test).
|
|
1315
|
+
* @experimental
|
|
1135
1316
|
*/
|
|
1136
1317
|
declare const voiceAgent: (options: VoiceAgentOptions) => VoiceAgentResult;
|
|
1137
1318
|
export { type AgentApi, type AgentChatApi, type AgentChatMessage, type AgentChatOptions, type AgentChatResult, type AgentLiveEvent, type AgentOptions, type AgentProgressEvent, type AgentResult, type AgentStateApi, type AgentStateOptions, type AgentStateResult, type AgentThreadRecord, type AgentThreadStatus, type AgentTokenDelta, type AgentTokenStreamReference, type AgentToolEvent, type AgentToolEventsApi, type AgentToolEventsOptions, type AgentToolEventsResult, type AuthOptions, type AuthResult, type ConnectionStatusOptions, type FlagContext, type FlagOptions, type FlagValue, type FlagsOptions, type HeartbeatReference, type HydratePreloadedOptions, type HydratePreloadedResult, type InfiniteQueryResult, LUNORA_CLIENT, type ListPresentReference, type LiveQueryOptions, type MutateOptions, type MutatorResult, type PaginatedQueryOptions, type PaginatedQueryResult, type PresenceOptions, type PresenceResult, type ProvideLunoraOptions, type RateLimitOptions, type RateLimitResult, type StreamOptions, type StreamResult, type StreamStatus, type SubscriptionOptions, type SubscriptionResult, type VoiceAgentOptions, type VoiceAgentResult, type VoiceAudioFormat, type VoiceReference, type VoiceStatus, agent, agentChat, agentState, agentToolEvents, auth, connectionStatus, flag, flags, hydratePreloaded, infiniteQuery, injectLunoraClient, liveQuery, mutate, mutator, paginatedQuery, presence, provideLunora, rateLimit, stream, subscription, voiceAgent };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/angular",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"description": "Angular reactive adapter for Lunora — signal-based live queries and mutations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@lunora/client": "1.0.0-alpha.
|
|
49
|
-
"@lunora/ratelimit": "1.0.0-alpha.
|
|
48
|
+
"@lunora/client": "1.0.0-alpha.23",
|
|
49
|
+
"@lunora/ratelimit": "1.0.0-alpha.8"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@angular/core": "^19.2.0 || ^20.0.0 || ^21.0.0 || ^22.0.0"
|