@lunora/angular 1.0.0-alpha.13 → 1.0.0-alpha.130
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 +42 -0
- package/dist/index.d.mts +250 -45
- package/dist/index.d.ts +250 -45
- package/dist/index.mjs +1 -19
- package/dist/packem_shared/LUNORA_CLIENT-B0toApHY.mjs +1 -0
- package/dist/packem_shared/agent-BCt1D_wQ.mjs +1 -0
- package/dist/packem_shared/agentChat-DMMjTLnF.mjs +1 -0
- package/dist/packem_shared/agentState-Cdyss0S4.mjs +1 -0
- package/dist/packem_shared/agentToolEvents-BOp6-TK8.mjs +1 -0
- package/dist/packem_shared/auth-C3dB8sYS.mjs +1 -0
- package/dist/packem_shared/connectionStatus-UhmuwzMa.mjs +1 -0
- package/dist/packem_shared/flag-BJxkgJR2.mjs +1 -0
- package/dist/packem_shared/hydratePreloaded-Bgt9hkmH.mjs +1 -0
- package/dist/packem_shared/infiniteQuery-yZS4F7PI.mjs +1 -0
- package/dist/packem_shared/liveQuery-ZIgKq4et.mjs +1 -0
- package/dist/packem_shared/mutate-BZvLQLyu.mjs +1 -0
- package/dist/packem_shared/mutator-DjG1yGk8.mjs +1 -0
- package/dist/packem_shared/platform-DNlq-CRU.mjs +1 -0
- package/dist/packem_shared/presence-DUkZtSSL.mjs +1 -0
- package/dist/packem_shared/rateLimit-B3h9qzh-.mjs +1 -0
- package/dist/packem_shared/runAction-BfiPq4Xz.mjs +1 -0
- package/dist/packem_shared/stream-CVSnLbC2.mjs +1 -0
- package/dist/packem_shared/subscription-B_Xj8Ezd.mjs +1 -0
- package/dist/packem_shared/voiceAgent-CyPFWGUt.mjs +1 -0
- package/dist/server.d.mts +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.mjs +1 -0
- package/dist/upload.d.mts +57 -0
- package/dist/upload.d.ts +57 -0
- package/dist/upload.mjs +1 -0
- package/package.json +12 -3
- package/dist/packem_shared/LUNORA_CLIENT-DHUfNu9x.mjs +0 -23
- package/dist/packem_shared/agent-DDKvrG4u.mjs +0 -31
- package/dist/packem_shared/agentChat-DDZlxK1v.mjs +0 -111
- package/dist/packem_shared/agentState-C8GWf3t3.mjs +0 -10
- package/dist/packem_shared/agentToolEvents-sXgYggvi.mjs +0 -59
- package/dist/packem_shared/auth-Df9N87Z4.mjs +0 -27
- package/dist/packem_shared/connectionStatus-BlLodleK.mjs +0 -15
- package/dist/packem_shared/flag-CGBo90HJ.mjs +0 -70
- package/dist/packem_shared/hydratePreloaded-DIpD1cAM.mjs +0 -33
- package/dist/packem_shared/infiniteQuery-nboKfr5E.mjs +0 -221
- package/dist/packem_shared/liveQuery-DVxKidjM.mjs +0 -32
- package/dist/packem_shared/mutate-D3rEHwbb.mjs +0 -8
- package/dist/packem_shared/mutator-BHL8bakL.mjs +0 -19
- package/dist/packem_shared/platform-Dg8Bppgq.mjs +0 -14
- package/dist/packem_shared/presence-BTuq19dS.mjs +0 -77
- package/dist/packem_shared/rateLimit-I4kRT9qV.mjs +0 -58
- package/dist/packem_shared/stream-PL64AghO.mjs +0 -47
- package/dist/packem_shared/subscription-oZ-WTmpp.mjs +0 -39
- package/dist/packem_shared/voiceAgent-DwbrDnB9.mjs +0 -401
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DestroyRef, Signal, InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
2
|
-
import { FunctionReference, LunoraClient, SubscriptionError, User, LunoraClientOptions, ConnectionStatus, Preloaded, ArgsOf, ReturnOf, MutationCallOptions, MutatorHandle } from '@lunora/client';
|
|
1
|
+
import { DestroyRef, Signal, InjectionToken, EnvironmentProviders, Injector } from '@angular/core';
|
|
2
|
+
import { FunctionReference, LunoraClient, SubscriptionErrorCallback, SubscriptionError, User, LunoraClientOptions, ConnectionStatus, Preloaded, ArgsOf, ReturnOf, MutationCallOptions, MutatorHandle, ActionCallOptions } from '@lunora/client';
|
|
3
3
|
export type { ArgsOf, ConnectionStatus, FunctionReference, LunoraClient, LunoraClientOptions, MutationCallOptions, Preloaded, ReturnOf, SubscriptionError, Unsubscribe } from '@lunora/client';
|
|
4
|
+
import { AuthStatus } from '@lunora/client/auth';
|
|
4
5
|
import { PaginationStatus } from '@lunora/client/pagination';
|
|
5
6
|
import { RateLimitStatus, RateLimitConfig } from '@lunora/ratelimit';
|
|
6
7
|
export { SKIP } from '@lunora/client/query';
|
|
@@ -22,8 +23,12 @@ type AgentThreadStatus = "awaiting_input" | "cancelled" | "error" | "idle" | "ru
|
|
|
22
23
|
*/
|
|
23
24
|
interface AgentThreadRecord {
|
|
24
25
|
createdAt?: number;
|
|
25
|
-
/**
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* The failure message when `status === "error"`, `null` once a later run
|
|
28
|
+
* cleared it, absent on a thread that has never failed. Read it for
|
|
29
|
+
* truthiness — `null` and absent both mean "no error".
|
|
30
|
+
*/
|
|
31
|
+
error?: null | string;
|
|
27
32
|
/** The workflow instance id of the in-flight run — the handle `cancel` targets. */
|
|
28
33
|
instanceId?: string;
|
|
29
34
|
messageCount?: number;
|
|
@@ -125,7 +130,7 @@ interface AgentOptions {
|
|
|
125
130
|
api: AgentApi;
|
|
126
131
|
/**
|
|
127
132
|
* Optional app mutation over the agent's cancel path
|
|
128
|
-
* (`ctx.agents
|
|
133
|
+
* (`ctx.agents.<name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
|
|
129
134
|
* When omitted (or no run is in flight) {@link AgentResult.cancel} is a no-op.
|
|
130
135
|
*/
|
|
131
136
|
cancel?: FunctionReference<"mutation">;
|
|
@@ -136,9 +141,15 @@ interface AgentOptions {
|
|
|
136
141
|
* `inject(DestroyRef)` — the calling component/service.
|
|
137
142
|
*/
|
|
138
143
|
destroyRef?: DestroyRef;
|
|
144
|
+
/**
|
|
145
|
+
* Called when the live thread subscription reports an error (a session
|
|
146
|
+
* expiry, an RLS denial). Without it — and without reading `error` — such a
|
|
147
|
+
* failure is invisible and `thread` / `status` are cleared until a later frame arrives.
|
|
148
|
+
*/
|
|
149
|
+
onError?: SubscriptionErrorCallback;
|
|
139
150
|
/**
|
|
140
151
|
* The app mutation that starts (or continues) a run — a thin wrapper over
|
|
141
|
-
* `ctx.agents
|
|
152
|
+
* `ctx.agents.<name>.run(...)`. Called with `{ threadKey, input }` merged with
|
|
142
153
|
* {@link AgentOptions.runArgs} and the per-call args.
|
|
143
154
|
*/
|
|
144
155
|
run: FunctionReference<"mutation">;
|
|
@@ -157,6 +168,8 @@ interface AgentResult {
|
|
|
157
168
|
* no-op when no `cancel` mutation was supplied or no run is in flight.
|
|
158
169
|
*/
|
|
159
170
|
cancel: () => Promise<void>;
|
|
171
|
+
/** The live thread subscription's last error, or `undefined`. */
|
|
172
|
+
error: Signal<SubscriptionError | undefined>;
|
|
160
173
|
/** `true` while a `run` invocation is in flight. */
|
|
161
174
|
pending: Signal<boolean>;
|
|
162
175
|
/** Start (or continue) a run with a user message; extra args merge over `runArgs`. */
|
|
@@ -174,7 +187,7 @@ interface AgentResult {
|
|
|
174
187
|
* conversation surface (durable history + streaming + approvals) use `agentChat`.
|
|
175
188
|
*
|
|
176
189
|
* `run` and `cancel` stay generic over the app-defined mutations that wrap
|
|
177
|
-
* `ctx.agents
|
|
190
|
+
* `ctx.agents.<name>.run` / `.cancel`, so the primitive hard-codes no function
|
|
178
191
|
* names beyond the `agents:*` surface.
|
|
179
192
|
*
|
|
180
193
|
* Call from an injection context (component/service field or constructor); pass an
|
|
@@ -232,7 +245,7 @@ interface AgentChatOptions {
|
|
|
232
245
|
api: AgentChatApi;
|
|
233
246
|
/**
|
|
234
247
|
* Optional app mutation over the agent's cancel path
|
|
235
|
-
* (`ctx.agents
|
|
248
|
+
* (`ctx.agents.<name>.cancel(id)`). Called with `{ instanceId, threadKey }`.
|
|
236
249
|
* When omitted (or no run is in flight) {@link AgentChatResult.cancel} is a
|
|
237
250
|
* no-op.
|
|
238
251
|
*/
|
|
@@ -246,9 +259,15 @@ interface AgentChatOptions {
|
|
|
246
259
|
destroyRef?: DestroyRef;
|
|
247
260
|
/** History depth forwarded to `agents:agentMessages`. */
|
|
248
261
|
limit?: number;
|
|
262
|
+
/**
|
|
263
|
+
* Called when the live history or thread subscription reports an error (a
|
|
264
|
+
* session expiry, an RLS denial). Without it — and without reading `error` —
|
|
265
|
+
* such a failure is invisible and `messages` / `status` are cleared until a later frame arrives.
|
|
266
|
+
*/
|
|
267
|
+
onError?: SubscriptionErrorCallback;
|
|
249
268
|
/**
|
|
250
269
|
* The app mutation that starts (or continues) a run — a thin wrapper over
|
|
251
|
-
* `ctx.agents
|
|
270
|
+
* `ctx.agents.<name>.run(...)`. Called with `{ threadKey, input }` merged with
|
|
252
271
|
* {@link AgentChatOptions.sendArgs} and the per-call args.
|
|
253
272
|
*/
|
|
254
273
|
send: FunctionReference<"mutation">;
|
|
@@ -275,6 +294,8 @@ interface AgentChatResult {
|
|
|
275
294
|
* no-op when no `cancel` mutation was supplied or no run is in flight.
|
|
276
295
|
*/
|
|
277
296
|
cancel: () => Promise<void>;
|
|
297
|
+
/** The history or thread subscription's last error, or `undefined`. */
|
|
298
|
+
error: Signal<SubscriptionError | undefined>;
|
|
278
299
|
/** Durable thread history (oldest first) plus any un-acknowledged optimistic user turns. */
|
|
279
300
|
messages: Signal<ReadonlyArray<AgentChatMessage>>;
|
|
280
301
|
/** Reject a paused human-in-the-loop tool call (optionally with a reason). */
|
|
@@ -363,7 +384,7 @@ interface AgentStateResult<T> {
|
|
|
363
384
|
* only on a real `setState`. The Angular counterpart to React's `useAgentState`,
|
|
364
385
|
* re-expressed with signals.
|
|
365
386
|
*
|
|
366
|
-
* Generic over the app's state shape (`agentState
|
|
387
|
+
* Generic over the app's state shape (`agentState<SupportState>(...)`, itself a
|
|
367
388
|
* record) — the reference is typed as an optional record because codegen cannot see
|
|
368
389
|
* the per-agent state type; the generic casts to `T`. The `extends` bound (not a
|
|
369
390
|
* bare unbounded type parameter) is required: this `.ts` file is parsed JSX-aware by
|
|
@@ -502,6 +523,12 @@ interface AuthOptions {
|
|
|
502
523
|
interface AuthResult {
|
|
503
524
|
/** Set the auth token (sign-in / sign-out). */
|
|
504
525
|
setToken: (token: string | null) => void;
|
|
526
|
+
/**
|
|
527
|
+
* The resolved auth state. Branch on this, not on `user() === null` — see the
|
|
528
|
+
* contract in `@lunora/client/auth`; `user` is `null` both when signed out
|
|
529
|
+
* and when a held credential's identity could not be resolved.
|
|
530
|
+
*/
|
|
531
|
+
status: Signal<AuthStatus>;
|
|
505
532
|
/** The current auth token, or `null`. */
|
|
506
533
|
token: Signal<string | null>;
|
|
507
534
|
/** The resolved user from `store.getUser()`, or `null`. */
|
|
@@ -524,6 +551,34 @@ interface AuthResult {
|
|
|
524
551
|
* @experimental
|
|
525
552
|
*/
|
|
526
553
|
declare const auth: (options?: AuthOptions) => AuthResult;
|
|
554
|
+
/**
|
|
555
|
+
* `AuthGateResult` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
556
|
+
* @experimental
|
|
557
|
+
*/
|
|
558
|
+
interface AuthGateResult {
|
|
559
|
+
/** `true` once a credential is held and nothing has contradicted it. */
|
|
560
|
+
isAuthenticated: Signal<boolean>;
|
|
561
|
+
/** `true` while a credential's first identity resolve is in flight. */
|
|
562
|
+
isLoading: Signal<boolean>;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Derived auth-gate signals for template gating (Angular's `\@if` control
|
|
566
|
+
* flow), built on {@link auth}. Angular has no JSX-style `Authenticated` slot
|
|
567
|
+
* component the way React/Vue/Solid do, so this exposes the same three-state
|
|
568
|
+
* logic as two booleans instead, mapped from the shared `AuthStatus` contract in
|
|
569
|
+
* `@lunora/client/auth`: a credential whose first identity resolve is in flight
|
|
570
|
+
* is `isLoading`; a credential nothing has contradicted — including one whose
|
|
571
|
+
* identity endpoint is unreachable — is `isAuthenticated`; no session is neither
|
|
572
|
+
* (the signed-out state a template checks for with a plain `\@else`).
|
|
573
|
+
*
|
|
574
|
+
* Call from an injection context (component/service field or constructor):
|
|
575
|
+
* ```ts
|
|
576
|
+
* protected readonly authState = authGate();
|
|
577
|
+
* // template: \@if (authState.isAuthenticated()) { ... } \@else if (authState.isLoading()) { ... }
|
|
578
|
+
* ```
|
|
579
|
+
* @experimental
|
|
580
|
+
*/
|
|
581
|
+
declare const authGate: (options?: AuthOptions) => AuthGateResult;
|
|
527
582
|
/**
|
|
528
583
|
* DI token carrying the framework-neutral {@link LunoraClient}. Every reactive
|
|
529
584
|
* primitive in this adapter (`liveQuery`, `mutate`, `connectionStatus`) reads the
|
|
@@ -599,16 +654,15 @@ interface ConnectionStatusOptions {
|
|
|
599
654
|
* @experimental
|
|
600
655
|
*/
|
|
601
656
|
declare const connectionStatus: (options?: ConnectionStatusOptions) => Signal<ConnectionStatus>;
|
|
657
|
+
/** The value kinds a flag resolves to — OpenFeature's boolean / number / string / structured (JSON) flags. */
|
|
658
|
+
type FlagValue$1 = boolean | number | string | {
|
|
659
|
+
[key: string]: unknown;
|
|
660
|
+
} | unknown[] | null;
|
|
602
661
|
/**
|
|
603
662
|
* The value kinds a flag resolves to — OpenFeature's boolean / number / string / structured (JSON) flags.
|
|
604
663
|
* @experimental
|
|
605
664
|
*/
|
|
606
|
-
type FlagValue =
|
|
607
|
-
/**
|
|
608
|
-
* Targeting context bag forwarded to the OpenFeature provider.
|
|
609
|
-
* @experimental
|
|
610
|
-
*/
|
|
611
|
-
type FlagContext = Record<string, unknown>;
|
|
665
|
+
type FlagValue = FlagValue$1;
|
|
612
666
|
/**
|
|
613
667
|
* `FlagOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
614
668
|
* @experimental
|
|
@@ -616,11 +670,6 @@ type FlagContext = Record<string, unknown>;
|
|
|
616
670
|
interface FlagOptions {
|
|
617
671
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
618
672
|
client?: LunoraClient;
|
|
619
|
-
/**
|
|
620
|
-
* Per-call targeting context merged on top of the app's default `identify`
|
|
621
|
-
* targeting key.
|
|
622
|
-
*/
|
|
623
|
-
context?: FlagContext;
|
|
624
673
|
/** `DestroyRef` whose `onDestroy` tears down the subscription. Defaults to `inject(DestroyRef)`. */
|
|
625
674
|
destroyRef?: DestroyRef;
|
|
626
675
|
}
|
|
@@ -632,9 +681,16 @@ interface FlagOptions {
|
|
|
632
681
|
* The flag's kind is inferred from `defaultValue`'s runtime type, so
|
|
633
682
|
* `flag("dark", false)` reads a boolean and `flag("hero", "control")` a string.
|
|
634
683
|
*
|
|
684
|
+
* The reactive channel is public, so the server evaluates every flag under the
|
|
685
|
+
* socket's own verified identity — the targeting key your `defineFlags({
|
|
686
|
+
* identify })` derives — and accepts no client-supplied targeting context. For
|
|
687
|
+
* evaluation under a context you compute, call `ctx.flags.*` inside a query,
|
|
688
|
+
* mutation, or action and return the resolved value.
|
|
689
|
+
*
|
|
635
690
|
* Evaluation runs through whatever OpenFeature provider the app wired in
|
|
636
691
|
* `lunora/flags.ts`; the read never throws — a provider error resolves the
|
|
637
|
-
* default (the same fail-open contract as server-side `ctx.flags`).
|
|
692
|
+
* default (the same fail-open contract as server-side `ctx.flags`). No
|
|
693
|
+
* subscription opens during SSR; the signal stays at `defaultValue`.
|
|
638
694
|
*
|
|
639
695
|
* Call from an injection context:
|
|
640
696
|
* ```ts
|
|
@@ -650,11 +706,6 @@ declare const flag: <T extends FlagValue>(key: string, defaultValue: T, options?
|
|
|
650
706
|
interface FlagsOptions {
|
|
651
707
|
/** Client to bind to. Defaults to the injected `LUNORA_CLIENT`. */
|
|
652
708
|
client?: LunoraClient;
|
|
653
|
-
/**
|
|
654
|
-
* Targeting context shared by every flag in the set, merged on top of the
|
|
655
|
-
* app's default `identify` targeting key.
|
|
656
|
-
*/
|
|
657
|
-
context?: FlagContext;
|
|
658
709
|
/** `DestroyRef` whose `onDestroy` tears down the subscriptions. Defaults to `inject(DestroyRef)`. */
|
|
659
710
|
destroyRef?: DestroyRef;
|
|
660
711
|
}
|
|
@@ -663,7 +714,8 @@ interface FlagsOptions {
|
|
|
663
714
|
*
|
|
664
715
|
* Pass a record of `key → defaultValue`; each flag's kind is inferred from its
|
|
665
716
|
* default, and the returned signal holds the same-shaped record with resolved
|
|
666
|
-
* values (the defaults until each evaluation lands).
|
|
717
|
+
* values (the defaults until each evaluation lands). Like {@link flag} it
|
|
718
|
+
* evaluates under the socket's server-verified identity only.
|
|
667
719
|
*
|
|
668
720
|
* Call from an injection context:
|
|
669
721
|
* ```ts
|
|
@@ -687,7 +739,7 @@ interface HydratePreloadedOptions {
|
|
|
687
739
|
* @experimental
|
|
688
740
|
*/
|
|
689
741
|
interface HydratePreloadedResult<T> {
|
|
690
|
-
/** The latest value pushed by the server. Seeded synchronously from the preloaded value. */
|
|
742
|
+
/** The latest value pushed by the server. Seeded synchronously from the preloaded value until an identity is retired. */
|
|
691
743
|
data: Signal<T | undefined>;
|
|
692
744
|
/** The latest subscription error, or `undefined`. */
|
|
693
745
|
error: Signal<SubscriptionError | undefined>;
|
|
@@ -705,6 +757,12 @@ interface HydratePreloadedResult<T> {
|
|
|
705
757
|
*
|
|
706
758
|
* The subscription tears down when the owning `DestroyRef` fires.
|
|
707
759
|
*
|
|
760
|
+
* The preloaded value was read for whoever was signed in when the page loaded.
|
|
761
|
+
* After a sign-out or user switch retires that identity
|
|
762
|
+
* (`client.identityEpoch() > 0`), every `hydratePreloaded` on the client (created
|
|
763
|
+
* then or later) stops using it and `data` holds `undefined` until the live value
|
|
764
|
+
* arrives — matching `@lunora/react`'s `usePreloadedQuery`.
|
|
765
|
+
*
|
|
708
766
|
* Call from an injection context:
|
|
709
767
|
* ```ts
|
|
710
768
|
* readonly { data, error } = hydratePreloaded(preloadedMessages);
|
|
@@ -728,6 +786,16 @@ interface LiveQueryOptions {
|
|
|
728
786
|
* component is destroyed. Pass one explicitly to control the lifetime yourself.
|
|
729
787
|
*/
|
|
730
788
|
destroyRef?: DestroyRef;
|
|
789
|
+
/**
|
|
790
|
+
* `Injector` to create the reactive-args `effect()` from. Only needed when
|
|
791
|
+
* `args` is a function/`Signal` AND `liveQuery` is called outside an injection
|
|
792
|
+
* context (an explicit `destroyRef` is also being passed — e.g. from
|
|
793
|
+
* `ngOnInit`, or from a test with no `TestBed`) — `effect()` cannot resolve an
|
|
794
|
+
* injector on its own there. Defaults to the ambient injection context, the
|
|
795
|
+
* same source `inject(DestroyRef)` already relies on. Unused for the static
|
|
796
|
+
* `args` form, which never creates an `effect()`.
|
|
797
|
+
*/
|
|
798
|
+
injector?: Injector;
|
|
731
799
|
/**
|
|
732
800
|
* Called when the subscription errors after the initial attach — the async
|
|
733
801
|
* error channel `createQuerySubscription` only wires when a sink is present.
|
|
@@ -761,9 +829,17 @@ interface LiveQueryOptions {
|
|
|
761
829
|
* short-circuit — no network call, no socket; the signal stays `undefined`. To
|
|
762
830
|
* call outside an injection context (e.g. lazily in `ngOnInit`), supply `client`
|
|
763
831
|
* and `destroyRef` via {@link LiveQueryOptions}.
|
|
832
|
+
*
|
|
833
|
+
* `args` also accepts a function/`Signal` — `() => ({ channelId: channelId() })`
|
|
834
|
+
* — to make the subscription reactive: an args change tears the old
|
|
835
|
+
* subscription down, resets the signal to `undefined`, and opens a fresh one
|
|
836
|
+
* for the new args, mirroring
|
|
837
|
+
* `@lunora/solid`'s `createQuery`/`@lunora/vue`'s `useQuery`. A static (plain
|
|
838
|
+
* object) `args` resolves once and never re-runs — no `effect()` is created for
|
|
839
|
+
* it, so it carries none of the reactive form's DI requirement.
|
|
764
840
|
* @experimental
|
|
765
841
|
*/
|
|
766
|
-
declare const liveQuery: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip", options?: LiveQueryOptions) => Signal<ReturnOf<F> | undefined>;
|
|
842
|
+
declare const liveQuery: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip" | (() => ArgsOf<F> | "skip"), options?: LiveQueryOptions) => Signal<ReturnOf<F> | undefined>;
|
|
767
843
|
/**
|
|
768
844
|
* `MutateOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
769
845
|
* @experimental
|
|
@@ -851,6 +927,15 @@ interface PaginatedQueryOptions {
|
|
|
851
927
|
destroyRef?: DestroyRef;
|
|
852
928
|
/** Page size for the first page (and the default for `loadMore`). */
|
|
853
929
|
initialNumItems: number;
|
|
930
|
+
/**
|
|
931
|
+
* `Injector` to create the reactive-args `effect()` from. Only needed when
|
|
932
|
+
* `args` is a function/`Signal` AND the call is outside an injection context
|
|
933
|
+
* (an explicit `destroyRef` is also being passed). Defaults to the ambient
|
|
934
|
+
* injection context. Unused for the static `args` form.
|
|
935
|
+
*/
|
|
936
|
+
injector?: Injector;
|
|
937
|
+
/** Called when a page subscription reports an error (also surfaced on the `error` signal). */
|
|
938
|
+
onError?: SubscriptionErrorCallback;
|
|
854
939
|
/** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
|
|
855
940
|
shardKey?: string;
|
|
856
941
|
}
|
|
@@ -859,6 +944,13 @@ interface PaginatedQueryOptions {
|
|
|
859
944
|
* @experimental
|
|
860
945
|
*/
|
|
861
946
|
interface PaginatedQueryResult<T> {
|
|
947
|
+
/**
|
|
948
|
+
* The last page subscription error, or `undefined`. A tail page that fails
|
|
949
|
+
* before its first frame is dropped so `status` returns to `"CanLoadMore"`
|
|
950
|
+
* and `loadMore` can retry it; cleared by the next successful frame,
|
|
951
|
+
* `loadMore`, or an args change.
|
|
952
|
+
*/
|
|
953
|
+
error: Signal<SubscriptionError | undefined>;
|
|
862
954
|
/** `true` while the first page or a `loadMore` page is in flight. */
|
|
863
955
|
isLoading: Signal<boolean>;
|
|
864
956
|
/** Request the next page. A no-op unless `status === "CanLoadMore"`. */
|
|
@@ -873,6 +965,8 @@ interface PaginatedQueryResult<T> {
|
|
|
873
965
|
* @experimental
|
|
874
966
|
*/
|
|
875
967
|
interface InfiniteQueryResult<T> {
|
|
968
|
+
/** The last page subscription error, or `undefined` — see `PaginatedQueryResult.error`. */
|
|
969
|
+
error: Signal<SubscriptionError | undefined>;
|
|
876
970
|
/** Request the next page. A no-op unless `status === "CanLoadMore"`. */
|
|
877
971
|
fetchNextPage: (numberItems?: number) => void;
|
|
878
972
|
/** `true` when the loaded tail reports it can load another page. */
|
|
@@ -901,9 +995,13 @@ interface InfiniteQueryResult<T> {
|
|
|
901
995
|
* ```ts
|
|
902
996
|
* readonly messages = paginatedQuery(api.messages.list, {}, { initialNumItems: 20 });
|
|
903
997
|
* ```
|
|
998
|
+
*
|
|
999
|
+
* `args` also accepts a function/`Signal` to make the query reactive — an args
|
|
1000
|
+
* change disposes the current pagination engine and builds a fresh one for the
|
|
1001
|
+
* new args. A static (plain object) `args` resolves once and never re-runs.
|
|
904
1002
|
* @experimental
|
|
905
1003
|
*/
|
|
906
|
-
declare const paginatedQuery: <F extends FunctionReference>(reference: F, args: PaginatedArgs<F> | "skip", options: PaginatedQueryOptions) => PaginatedQueryResult<PageItemOf<F>>;
|
|
1004
|
+
declare const paginatedQuery: <F extends FunctionReference>(reference: F, args: PaginatedArgs<F> | "skip" | (() => PaginatedArgs<F> | "skip"), options: PaginatedQueryOptions) => PaginatedQueryResult<PageItemOf<F>>;
|
|
907
1005
|
/**
|
|
908
1006
|
* Subscribe to a reactively-paginated query and expose its pages discretely.
|
|
909
1007
|
*
|
|
@@ -915,9 +1013,12 @@ declare const paginatedQuery: <F extends FunctionReference>(reference: F, args:
|
|
|
915
1013
|
* ```ts
|
|
916
1014
|
* readonly feed = infiniteQuery(api.messages.list, {}, { initialNumItems: 20 });
|
|
917
1015
|
* ```
|
|
1016
|
+
*
|
|
1017
|
+
* `args` also accepts a function/`Signal` to make the query reactive — see
|
|
1018
|
+
* `paginatedQuery`'s equivalent note.
|
|
918
1019
|
* @experimental
|
|
919
1020
|
*/
|
|
920
|
-
declare const infiniteQuery: <F extends FunctionReference>(reference: F, args: PaginatedArgs<F> | "skip", options: PaginatedQueryOptions) => InfiniteQueryResult<PageItemOf<F>>;
|
|
1021
|
+
declare const infiniteQuery: <F extends FunctionReference>(reference: F, args: PaginatedArgs<F> | "skip" | (() => PaginatedArgs<F> | "skip"), options: PaginatedQueryOptions) => InfiniteQueryResult<PageItemOf<F>>;
|
|
921
1022
|
/**
|
|
922
1023
|
* `HeartbeatReference` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
923
1024
|
* @experimental
|
|
@@ -951,6 +1052,12 @@ interface PresenceOptions<H extends HeartbeatReference, L extends ListPresentRef
|
|
|
951
1052
|
intervalMs?: number;
|
|
952
1053
|
/** The `api.*` reference for the presence listPresent query. */
|
|
953
1054
|
listPresent: L;
|
|
1055
|
+
/**
|
|
1056
|
+
* Called when the `listPresent` subscription reports an error (a session
|
|
1057
|
+
* expiry, an RLS denial). Without it — and without reading `error` — such a
|
|
1058
|
+
* failure is invisible and `present` is cleared until a later frame arrives.
|
|
1059
|
+
*/
|
|
1060
|
+
onError?: SubscriptionErrorCallback;
|
|
954
1061
|
/**
|
|
955
1062
|
* Stable id for this presence row. Defaults to a fresh per-call id.
|
|
956
1063
|
* Pass a user/connection id to control deduping across tabs.
|
|
@@ -964,6 +1071,8 @@ interface PresenceOptions<H extends HeartbeatReference, L extends ListPresentRef
|
|
|
964
1071
|
* @experimental
|
|
965
1072
|
*/
|
|
966
1073
|
interface PresenceResult<L extends ListPresentReference> {
|
|
1074
|
+
/** The `listPresent` subscription's last error, or `undefined`. */
|
|
1075
|
+
error: Signal<SubscriptionError | undefined>;
|
|
967
1076
|
/** The present members for the room. `undefined` until the first push. */
|
|
968
1077
|
present: Signal<ReturnOf<L> | undefined>;
|
|
969
1078
|
/** This mount's session id (generated when not supplied). */
|
|
@@ -1039,6 +1148,43 @@ interface RateLimitResult {
|
|
|
1039
1148
|
* @experimental
|
|
1040
1149
|
*/
|
|
1041
1150
|
declare const rateLimit: (config: RateLimitConfig, options?: RateLimitOptions) => RateLimitResult;
|
|
1151
|
+
/**
|
|
1152
|
+
* `RunActionOptions` is part of the experimental `@lunora/angular` API and may change without a major version bump.
|
|
1153
|
+
* @experimental
|
|
1154
|
+
*/
|
|
1155
|
+
interface RunActionOptions extends ActionCallOptions {
|
|
1156
|
+
/**
|
|
1157
|
+
* Client to run the action on. Defaults to the injected `LUNORA_CLIENT`.
|
|
1158
|
+
* Because actions usually fire from event handlers — which run *outside* an
|
|
1159
|
+
* injection context — capture the client once (`injectLunoraClient()` in a
|
|
1160
|
+
* field) and pass it here, or call `client.action(...)` directly.
|
|
1161
|
+
*/
|
|
1162
|
+
client?: LunoraClient;
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Run a Lunora action and resolve with the server result (rejects on failure).
|
|
1166
|
+
*
|
|
1167
|
+
* The sibling of `mutate`, and a plain function for the same reason: Angular's
|
|
1168
|
+
* adapter models writes as calls rather than reactive handles, because they fire
|
|
1169
|
+
* from event handlers where a signal-returning primitive has nothing to bind to.
|
|
1170
|
+
* The other adapters return a reactive `{ call, pending, … }` handle because
|
|
1171
|
+
* their idioms make that natural; this one does not.
|
|
1172
|
+
*
|
|
1173
|
+
* Unlike `mutate` there are no `optimistic` / `optimisticUpdate` options. An
|
|
1174
|
+
* optimistic update patches the subscription cache on the assumption a write
|
|
1175
|
+
* will land; an action is not a write — it runs in the Worker, may call a third
|
|
1176
|
+
* party, and has no declared effect on any query.
|
|
1177
|
+
*
|
|
1178
|
+
* ```ts
|
|
1179
|
+
* private readonly client = injectLunoraClient();
|
|
1180
|
+
* verify = () => runAction(api.commands.run, { command: "lunora", args: ["verify"] }, { client: this.client });
|
|
1181
|
+
* ```
|
|
1182
|
+
*
|
|
1183
|
+
* When called from within an injection context you may omit `client` and let it
|
|
1184
|
+
* resolve from the injector.
|
|
1185
|
+
* @experimental
|
|
1186
|
+
*/
|
|
1187
|
+
declare const runAction: <F extends FunctionReference>(reference: F, args: ArgsOf<F>, options?: RunActionOptions) => Promise<ReturnOf<F>>;
|
|
1042
1188
|
/**
|
|
1043
1189
|
* The lifecycle of a stream the primitive is observing.
|
|
1044
1190
|
* @experimental
|
|
@@ -1056,6 +1202,13 @@ interface StreamOptions {
|
|
|
1056
1202
|
* `inject(DestroyRef)` — the calling component/service.
|
|
1057
1203
|
*/
|
|
1058
1204
|
destroyRef?: DestroyRef;
|
|
1205
|
+
/**
|
|
1206
|
+
* Opt into resume-on-reconnect for a stream the server declared `durable`.
|
|
1207
|
+
* The chunks already received are kept and the socket re-attaches to the same
|
|
1208
|
+
* run, so a dropped connection mid-generation continues instead of surfacing
|
|
1209
|
+
* `STREAM_DISCONNECTED`. Has no effect on an ephemeral stream.
|
|
1210
|
+
*/
|
|
1211
|
+
durable?: boolean;
|
|
1059
1212
|
/** Forwarded to `client.stream()` — caps the in-flight chunk buffer. */
|
|
1060
1213
|
maxBuffer?: number;
|
|
1061
1214
|
/** Route to a specific shard when the target function is `.shardBy(...)`-partitioned. */
|
|
@@ -1083,8 +1236,8 @@ interface StreamResult<T> {
|
|
|
1083
1236
|
* chunk the server pushes — use it for token-by-token deltas and other append-only
|
|
1084
1237
|
* feeds. Pass `"skip"` as `args` to keep the primitive mounted without opening a
|
|
1085
1238
|
* stream (mirrors `subscription`); the stream tears down when the owning
|
|
1086
|
-
* `DestroyRef` fires.
|
|
1087
|
-
* with signals.
|
|
1239
|
+
* `DestroyRef` fires. Nothing opens on the Angular server platform (SSR). The
|
|
1240
|
+
* Angular counterpart to React's `useStream`, re-expressed with signals.
|
|
1088
1241
|
*
|
|
1089
1242
|
* Call from an injection context (component/service field or constructor):
|
|
1090
1243
|
* ```ts
|
|
@@ -1105,6 +1258,14 @@ interface SubscriptionOptions {
|
|
|
1105
1258
|
* `inject(DestroyRef)` — the calling component/service.
|
|
1106
1259
|
*/
|
|
1107
1260
|
destroyRef?: DestroyRef;
|
|
1261
|
+
/**
|
|
1262
|
+
* `Injector` to create the reactive-args `effect()` from. Only needed when
|
|
1263
|
+
* `args` is a function/`Signal` AND `subscription` is called outside an
|
|
1264
|
+
* injection context (an explicit `destroyRef` is also being passed).
|
|
1265
|
+
* Defaults to the ambient injection context. Unused for the static `args`
|
|
1266
|
+
* form, which never creates an `effect()`.
|
|
1267
|
+
*/
|
|
1268
|
+
injector?: Injector;
|
|
1108
1269
|
/**
|
|
1109
1270
|
* Called when the subscription errors after the initial attach. Without it,
|
|
1110
1271
|
* a post-attach failure is dropped silently.
|
|
@@ -1138,9 +1299,13 @@ interface SubscriptionResult<T> {
|
|
|
1138
1299
|
* ```ts
|
|
1139
1300
|
* readonly stream = subscription(api.events.stream, { roomId: "general" });
|
|
1140
1301
|
* ```
|
|
1302
|
+
*
|
|
1303
|
+
* `args` also accepts a function/`Signal` to make the subscription reactive —
|
|
1304
|
+
* an args change tears the old subscription down and opens a fresh one for the
|
|
1305
|
+
* new args. A static (plain object) `args` resolves once and never re-runs.
|
|
1141
1306
|
* @experimental
|
|
1142
1307
|
*/
|
|
1143
|
-
declare const subscription: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip", options?: SubscriptionOptions) => SubscriptionResult<ReturnOf<F>>;
|
|
1308
|
+
declare const subscription: <F extends FunctionReference>(reference: F, args: ArgsOf<F> | "skip" | (() => ArgsOf<F> | "skip"), options?: SubscriptionOptions) => SubscriptionResult<ReturnOf<F>>;
|
|
1144
1309
|
/**
|
|
1145
1310
|
* Browser Web Audio subsystems for `voiceAgent` — the default microphone capture
|
|
1146
1311
|
* and speaker playback implementations injected into the primitive via its
|
|
@@ -1179,8 +1344,24 @@ interface MicrophoneConfig {
|
|
|
1179
1344
|
interruptChunks: number;
|
|
1180
1345
|
/** RMS above which the user is considered to be barging in while the agent speaks. */
|
|
1181
1346
|
interruptThreshold: number;
|
|
1182
|
-
/**
|
|
1183
|
-
|
|
1347
|
+
/**
|
|
1348
|
+
* `true` from the moment a turn is committed until it completes — the whole
|
|
1349
|
+
* `thinking` + `speaking` window, not just the audible half.
|
|
1350
|
+
*
|
|
1351
|
+
* It gates BOTH branches below, and the wider span is the point. Gated only
|
|
1352
|
+
* on "audibly speaking", turn detection kept running through the entire
|
|
1353
|
+
* STT+LLM window after a `commit`: room noise at the (deliberately low)
|
|
1354
|
+
* `silenceThreshold` re-armed `sawSpeech`, another quiet gap fired a SECOND
|
|
1355
|
+
* `commit`, and the DO refused it with "a turn is already in progress" —
|
|
1356
|
+
* a refusal that returns before draining the audio buffer, so the PCM
|
|
1357
|
+
* captured since the first commit leaked into the next utterance.
|
|
1358
|
+
*
|
|
1359
|
+
* A genuine barge-in still works in that window: it routes through the
|
|
1360
|
+
* `onInterrupt` branch, which needs `interruptChunks` consecutive chunks at
|
|
1361
|
+
* `interruptThreshold` — an order of magnitude above `silenceThreshold` —
|
|
1362
|
+
* and `interrupt` is exactly what the DO tells the client to send.
|
|
1363
|
+
*/
|
|
1364
|
+
isTurnActive: () => boolean;
|
|
1184
1365
|
/** One 16 kHz mono 16-bit little-endian PCM frame captured from the mic. */
|
|
1185
1366
|
onAudio: (pcm: Uint8Array) => void;
|
|
1186
1367
|
/** A barge-in was detected (RMS spike while the agent is speaking). */
|
|
@@ -1199,9 +1380,9 @@ type CreateSpeaker = (config: {
|
|
|
1199
1380
|
audioFormat: VoiceAudioFormat;
|
|
1200
1381
|
}) => VoiceSpeaker;
|
|
1201
1382
|
/**
|
|
1202
|
-
* The `agents
|
|
1383
|
+
* The `agents.<name>Voice` reference codegen emits for a voice-enabled agent — a
|
|
1203
1384
|
* live, WS-backed session keyed by `threadKey`. A structural subset of the
|
|
1204
|
-
* generated member, so passing `api.agents
|
|
1385
|
+
* generated member, so passing `api.agents.<name>Voice` type-checks.
|
|
1205
1386
|
* @experimental
|
|
1206
1387
|
*/
|
|
1207
1388
|
type VoiceReference = FunctionReference<"stream", {
|
|
@@ -1239,7 +1420,11 @@ interface VoiceAgentOptions {
|
|
|
1239
1420
|
* Audio graph stays isolated (and mockable in a non-browser test env).
|
|
1240
1421
|
*/
|
|
1241
1422
|
createMicrophone?: CreateMicrophone;
|
|
1242
|
-
/**
|
|
1423
|
+
/**
|
|
1424
|
+
* Advanced/test seam: open the transport. Defaults to the WebSocket
|
|
1425
|
+
* implementation the client was built with (`client.getWebSocketImpl()`),
|
|
1426
|
+
* NOT a raw `globalThis.WebSocket`.
|
|
1427
|
+
*/
|
|
1243
1428
|
createSocket?: CreateSocket;
|
|
1244
1429
|
/** Advanced/test seam: build the audio playback subsystem. Defaults to a Web Audio implementation. */
|
|
1245
1430
|
createSpeaker?: CreateSpeaker;
|
|
@@ -1256,9 +1441,13 @@ interface VoiceAgentOptions {
|
|
|
1256
1441
|
silenceDurationMs?: number;
|
|
1257
1442
|
/** Input RMS below which audio counts as silence. Default `0.01`. */
|
|
1258
1443
|
silenceThreshold?: number;
|
|
1259
|
-
/**
|
|
1260
|
-
|
|
1261
|
-
|
|
1444
|
+
/**
|
|
1445
|
+
* The thread to converse on — shared with the agent's text turns. A plain
|
|
1446
|
+
* value, or a `Signal`/getter resolved afresh every time a call opens — the
|
|
1447
|
+
* reactive-args form the package's other primitives take.
|
|
1448
|
+
*/
|
|
1449
|
+
threadKey: (() => string) | string;
|
|
1450
|
+
/** The generated `api.agents.<name>Voice` reference — identifies the voice DO endpoint. */
|
|
1262
1451
|
voice: VoiceReference;
|
|
1263
1452
|
}
|
|
1264
1453
|
/**
|
|
@@ -1294,7 +1483,7 @@ interface VoiceAgentResult {
|
|
|
1294
1483
|
* WebSocket to the agent's `VoiceSessionDO`, captures mic audio as 16 kHz PCM,
|
|
1295
1484
|
* streams the agent's synthesized speech back through the browser's audio output,
|
|
1296
1485
|
* and mirrors the call lifecycle (`status`, `transcript`, `interimTranscript`,
|
|
1297
|
-
* `audioLevel`) to Angular signals. Pass the generated `api.agents
|
|
1486
|
+
* `audioLevel`) to Angular signals. Pass the generated `api.agents.<name>Voice`
|
|
1298
1487
|
* reference (never a string), matching `agentChat`'s reference-passing style. The
|
|
1299
1488
|
* Angular counterpart to React's `useVoiceAgent`, re-expressed with signals; the
|
|
1300
1489
|
* per-call connection lives in a closure variable (the primitive runs once per
|
|
@@ -1310,4 +1499,20 @@ interface VoiceAgentResult {
|
|
|
1310
1499
|
* @experimental
|
|
1311
1500
|
*/
|
|
1312
1501
|
declare const voiceAgent: (options: VoiceAgentOptions) => VoiceAgentResult;
|
|
1313
|
-
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
|
|
1502
|
+
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 AuthGateResult, type AuthOptions, type AuthResult, type ConnectionStatusOptions, 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,
|
|
1503
|
+
/**
|
|
1504
|
+
* The Angular adapter for Lunora.
|
|
1505
|
+
*
|
|
1506
|
+
* Thin, idiomatic glue over the framework-neutral `@lunora/client`. Angular
|
|
1507
|
+
* signals map directly onto Lunora's per-subscription deltas, so a live query is
|
|
1508
|
+
* just a `signal` the WebSocket writes to.
|
|
1509
|
+
*
|
|
1510
|
+
* `provideLunora` / `LUNORA_CLIENT` / `injectLunoraClient` are the injectable
|
|
1511
|
+
* provider carrying one `LunoraClient` (opens its socket lazily), wired once in the
|
|
1512
|
+
* application config. `liveQuery` is a live-query `signal` that opens a
|
|
1513
|
+
* subscription and updates on every delta, torn down automatically on
|
|
1514
|
+
* `DestroyRef.onDestroy`. `mutate` runs a mutation (optimistic updates + offline
|
|
1515
|
+
* queue pass through to the client). `connectionStatus` is a `signal` of the
|
|
1516
|
+
* aggregate live-socket status.
|
|
1517
|
+
*/
|
|
1518
|
+
type ProvideLunoraOptions, type RateLimitOptions, type RateLimitResult, type RunActionOptions, 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, authGate, connectionStatus, flag, flags, hydratePreloaded, infiniteQuery, injectLunoraClient, liveQuery, mutate, mutator, paginatedQuery, presence, provideLunora, rateLimit, runAction, stream, subscription, voiceAgent };
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { agentChat } from './packem_shared/agentChat-DDZlxK1v.mjs';
|
|
3
|
-
export { agentState } from './packem_shared/agentState-C8GWf3t3.mjs';
|
|
4
|
-
export { agentToolEvents } from './packem_shared/agentToolEvents-sXgYggvi.mjs';
|
|
5
|
-
export { auth } from './packem_shared/auth-Df9N87Z4.mjs';
|
|
6
|
-
export { LUNORA_CLIENT, injectLunoraClient, provideLunora } from './packem_shared/LUNORA_CLIENT-DHUfNu9x.mjs';
|
|
7
|
-
export { connectionStatus } from './packem_shared/connectionStatus-BlLodleK.mjs';
|
|
8
|
-
export { flag, flags } from './packem_shared/flag-CGBo90HJ.mjs';
|
|
9
|
-
export { hydratePreloaded } from './packem_shared/hydratePreloaded-DIpD1cAM.mjs';
|
|
10
|
-
export { liveQuery } from './packem_shared/liveQuery-DVxKidjM.mjs';
|
|
11
|
-
export { mutate } from './packem_shared/mutate-D3rEHwbb.mjs';
|
|
12
|
-
export { mutator } from './packem_shared/mutator-BHL8bakL.mjs';
|
|
13
|
-
export { infiniteQuery, paginatedQuery } from './packem_shared/infiniteQuery-nboKfr5E.mjs';
|
|
14
|
-
export { presence } from './packem_shared/presence-BTuq19dS.mjs';
|
|
15
|
-
export { rateLimit } from './packem_shared/rateLimit-I4kRT9qV.mjs';
|
|
16
|
-
export { stream } from './packem_shared/stream-PL64AghO.mjs';
|
|
17
|
-
export { subscription } from './packem_shared/subscription-oZ-WTmpp.mjs';
|
|
18
|
-
export { voiceAgent } from './packem_shared/voiceAgent-DwbrDnB9.mjs';
|
|
19
|
-
export { SKIP } from '@lunora/client/query';
|
|
1
|
+
import{agent as t}from"./packem_shared/agent-BCt1D_wQ.mjs";import{agentChat as m}from"./packem_shared/agentChat-DMMjTLnF.mjs";import{agentState as f}from"./packem_shared/agentState-Cdyss0S4.mjs";import{agentToolEvents as n}from"./packem_shared/agentToolEvents-BOp6-TK8.mjs";import{auth as i,authGate as u}from"./packem_shared/auth-C3dB8sYS.mjs";import{LUNORA_CLIENT as c,injectLunoraClient as s,provideLunora as l}from"./packem_shared/LUNORA_CLIENT-B0toApHY.mjs";import{connectionStatus as L}from"./packem_shared/connectionStatus-UhmuwzMa.mjs";import{flag as v,flags as y}from"./packem_shared/flag-BJxkgJR2.mjs";import{hydratePreloaded as C}from"./packem_shared/hydratePreloaded-Bgt9hkmH.mjs";import{liveQuery as S}from"./packem_shared/liveQuery-ZIgKq4et.mjs";import{mutate as I}from"./packem_shared/mutate-BZvLQLyu.mjs";import{mutator as P}from"./packem_shared/mutator-DjG1yGk8.mjs";import{infiniteQuery as b,paginatedQuery as j}from"./packem_shared/infiniteQuery-yZS4F7PI.mjs";import{presence as K}from"./packem_shared/presence-DUkZtSSL.mjs";import{rateLimit as R}from"./packem_shared/rateLimit-B3h9qzh-.mjs";import{runAction as _}from"./packem_shared/runAction-BfiPq4Xz.mjs";import{stream as q}from"./packem_shared/stream-CVSnLbC2.mjs";import{subscription as z}from"./packem_shared/subscription-B_Xj8Ezd.mjs";import{voiceAgent as D}from"./packem_shared/voiceAgent-CyPFWGUt.mjs";import{SKIP as H}from"@lunora/client/query";export{c as LUNORA_CLIENT,H as SKIP,t as agent,m as agentChat,f as agentState,n as agentToolEvents,i as auth,u as authGate,L as connectionStatus,v as flag,y as flags,C as hydratePreloaded,b as infiniteQuery,s as injectLunoraClient,S as liveQuery,I as mutate,P as mutator,j as paginatedQuery,K as presence,l as provideLunora,R as rateLimit,_ as runAction,q as stream,z as subscription,D as voiceAgent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{InjectionToken as t,makeEnvironmentProviders as i,inject as c}from"@angular/core";import{LunoraClient as r}from"@lunora/client";const o=()=>globalThis.location?.origin??"",e=new t("lunora.client",{factory:()=>new r({url:o()}),providedIn:"root"}),s=(n={})=>i([{provide:e,useFactory:()=>n instanceof r?n:new r({...n,url:n.url??o()})}]),a=()=>c(e),m=n=>n??a();export{e as LUNORA_CLIENT,a as injectLunoraClient,s as provideLunora,m as resolveLunoraClient};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{computed as o,signal as R}from"@angular/core";import{resolveLunoraClient as h}from"./LUNORA_CLIENT-B0toApHY.mjs";import{subscription as v}from"./subscription-B_Xj8Ezd.mjs";const x=t=>{const{api:i,cancel:c,onError:d,run:l,runArgs:u,threadKey:n}=t,a=h(t.client),{data:f,error:m}=v(i.agents.agentThread,{key:n},{client:a,destroyRef:t.destroyRef,onError:d}),r=o(()=>f()),y=o(()=>r()?.status),s=R(!1),g=async(e,p)=>{s.set(!0);try{await a.mutation(l,{input:e,threadKey:n,...u,...p})}finally{s.set(!1)}};return{cancel:async()=>{const e=r()?.instanceId;c===void 0||e===void 0||await a.mutation(c,{instanceId:e,threadKey:n})},error:m,pending:s.asReadonly(),run:g,status:y,thread:r}};export{x as agent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{computed as a,signal as L}from"@angular/core";import{reconcileOptimistic as k,maxSeq as w}from"@lunora/client";import{resolveLunoraClient as N}from"./LUNORA_CLIENT-B0toApHY.mjs";import{stream as $}from"./stream-CVSnLbC2.mjs";import{subscription as x}from"./subscription-B_Xj8Ezd.mjs";const z={__lunoraRef:""},W=m=>{const{api:d,cancel:g,limit:h,onError:f,send:A,sendArgs:E,stream:y,threadKey:r}=m,s=N(m.client),{destroyRef:l}=m,b=h===void 0?{key:r}:{key:r,limit:h},{data:I,error:S}=x(d.agents.agentMessages,b,{client:s,destroyRef:l,onError:f}),{data:j,error:q}=x(d.agents.agentThread,{key:r},{client:s,destroyRef:l,onError:f}),C=a(()=>S()??q()),_=y===void 0?"skip":{key:r},{chunks:D}=$(y??z,_,{client:s,destroyRef:l}),c=L([]);let v=0;const u=a(()=>j()),T=a(()=>u()?.status),i=a(()=>I()??[]),K=a(()=>{const t=i(),e=k(c(),t);if(e.length===0)return t;const n=w(t);return[...t,...e.map((o,p)=>({content:o.content,optimistic:!0,role:"user",seq:n+1+p}))]}),M=a(()=>{const t=i().filter(e=>e.role==="assistant").length;return D().filter(e=>e.kind!=="progress"&&e.threadKey===r&&e.turn>=t).map(e=>e.text).join("")}),O=async(t,e)=>{const n=v;v+=1;const o=w(i());c.set([...k(c(),i()),{content:t,id:n,maxDurableSeqAtSend:o}]);try{await s.mutation(A,{input:t,threadKey:r,...E,...e})}catch(p){throw c.set(c().filter(F=>F.id!==n)),p}},R=async(t,e,n)=>{const o=u()?.instanceId;if(o===void 0)throw new Error(`agentChat: cannot ${t} — no in-flight run (thread has no instanceId)`);await s.mutation(d.agents.agentResolveApproval,{decision:t,instanceId:o,threadKey:r,toolCallId:e,...n===void 0?{}:{note:n}})};return{approve:async(t,e)=>R("approve",t,e),cancel:async()=>{const t=u()?.instanceId;g===void 0||t===void 0||await s.mutation(g,{instanceId:t,threadKey:r})},error:C,messages:K,reject:async(t,e)=>R("reject",t,e),send:O,status:T,streamingText:M}};export{W as agentChat};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{computed as c}from"@angular/core";import{subscription as n}from"./subscription-B_Xj8Ezd.mjs";const d=t=>{const{data:e,error:r}=n(t.api.agents.agentState,{key:t.threadKey},{client:t.client,destroyRef:t.destroyRef}),a=c(()=>e());return{error:r,state:a}};export{d as agentState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{computed as v}from"@angular/core";import{resolveLunoraClient as f}from"./LUNORA_CLIENT-B0toApHY.mjs";import{stream as C}from"./stream-CVSnLbC2.mjs";import{subscription as y}from"./subscription-B_Xj8Ezd.mjs";const I={__lunoraRef:""},N=[],m=t=>{if(t.role==="assistant"&&t.toolCalls)return t.toolCalls.map(l=>({input:l.input,seq:t.seq,toolCallId:l.id,toolName:l.name,type:"call"}));if(t.role==="tool")return t.status==="awaiting_approval"?[{seq:t.seq,type:"awaiting-approval",...t.toolCallId===void 0?{}:{toolCallId:t.toolCallId},...t.toolName===void 0?{}:{toolName:t.toolName}}]:[{output:t.content,seq:t.seq,type:"result",...t.status==="approved"||t.status==="rejected"?{status:t.status}:{},...t.toolCallId===void 0?{}:{toolCallId:t.toolCallId},...t.toolName===void 0?{}:{toolName:t.toolName}}]},R=t=>{const{api:l,limit:n,stream:e,threadKey:r}=t,a=f(t.client),{destroyRef:i}=t,u=n===void 0?{key:r}:{key:r,limit:n},{data:p}=y(l.agents.agentMessages,u,{client:a,destroyRef:i}),s=e===void 0?"skip":{key:r},{chunks:c}=C(e??I,s,{client:a,destroyRef:i});return{events:v(()=>{const d=(p()??N).flatMap(o=>m(o)??[]);for(const o of c())o.kind==="progress"&&o.threadKey===r&&d.push({data:o.data,toolCallId:o.toolCallId,type:"progress"});return d})}};export{R as agentToolEvents};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inject as h,DestroyRef as k,signal as o,computed as c}from"@angular/core";import{getIdentityStore as l,isLoadingStatus as y,isAuthenticatedStatus as m}from"@lunora/client/auth";import{resolveLunoraClient as A}from"./LUNORA_CLIENT-B0toApHY.mjs";const T=(s={})=>{const t=A(s.client),n=s.destroyRef??h(k),e=l(t),u=o(t.getAuthToken()),r=o(e.getUser()),a=o(e.getStatus()),i=t.onAuthTokenChange(()=>{u.set(t.getAuthToken())}),d=e.subscribe(()=>{r.set(e.getUser()),a.set(e.getStatus())});return n.onDestroy(()=>{i(),d()}),{setToken:g=>{t.setAuthToken(g)},status:a.asReadonly(),token:u.asReadonly(),user:r.asReadonly()}},p=(s={})=>{const{status:t}=T(s),n=c(()=>y(t()));return{isAuthenticated:c(()=>m(t())),isLoading:n}};export{T as auth,p as authGate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inject as r,DestroyRef as i,signal as a}from"@angular/core";import{resolveLunoraClient as u}from"./LUNORA_CLIENT-B0toApHY.mjs";const y=(t={})=>{const n=u(t.client),e=t.destroyRef??r(i),o=a(n.connectionStatus()),s=n.onConnectionStatus(c=>{o.set(c)});return e.onDestroy(s),o.asReadonly()};export{y as connectionStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inject as l,DestroyRef as u,signal as a}from"@angular/core";import{resolveLunoraClient as i}from"./LUNORA_CLIENT-B0toApHY.mjs";import{s as d}from"./platform-DNlq-CRU.mjs";const m="__lunora_flags__:eval",_=t=>{const e=typeof t;return e==="boolean"||e==="number"||e==="string"?e:"object"},v={__lunoraRef:m},y=(t,e,n)=>{try{return t.subscribe(v,{default:e.default,key:e.key,type:_(e.default)},c=>{n(c)},{onError:()=>{n(e.default)}})}catch{return()=>{}}},k=(t,e,n={})=>{const c=i(n.client),f=n.destroyRef===void 0,o=n.destroyRef??l(u),r=a(e);return d(f)&&o.onDestroy(y(c,{default:e,key:t},s=>{r.set(s)})),r.asReadonly()},h=(t,e={})=>{const n=i(e.client),c=e.destroyRef===void 0,f=e.destroyRef??l(u),o=a({...t});if(!d(c))return o.asReadonly();const r=[];for(const[s,b]of Object.entries(t))r.push(y(n,{default:b,key:s},R=>{o.set({...o(),[s]:R})}));return f.onDestroy(()=>{for(const s of r)s()}),o.asReadonly()};export{k as flag,h as flags};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{inject as v,DestroyRef as h,signal as s}from"@angular/core";import{resolveLunoraClient as b}from"./LUNORA_CLIENT-B0toApHY.mjs";import{s as p}from"./platform-DNlq-CRU.mjs";const j=(i,e={})=>{const o=b(e.client),c=e.destroyRef===void 0,d=e.destroyRef??v(h),{args:a,functionPath:f,shardKey:y,value:l}=i,t=s(o.identityEpoch()===0?l:void 0),n=s(void 0),u={__lunoraRef:f};if(p(c)){const R=o.subscribe(u,a,r=>{t.set(r),n.set(void 0)},{onError:r=>{n.set(r)},shardKey:y}),m=o.onIdentityChange(()=>{t.set(void 0)});d.onDestroy(()=>{m(),R()})}return{data:t.asReadonly(),error:n.asReadonly()}};export{j as hydratePreloaded};
|