@lunora/angular 1.0.0-alpha.26 → 1.0.0-alpha.260

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +71 -0
  2. package/dist/index.d.mts +345 -47
  3. package/dist/index.d.ts +345 -47
  4. package/dist/index.mjs +1 -1
  5. package/dist/packem_shared/LUNORA_CLIENT-B0toApHY.mjs +1 -0
  6. package/dist/packem_shared/agent-DjMQf-yE.mjs +1 -0
  7. package/dist/packem_shared/agentChat-CQ3TWlc5.mjs +1 -0
  8. package/dist/packem_shared/agentState-Bjqf9q2f.mjs +1 -0
  9. package/dist/packem_shared/agentToolEvents-CFnjzw3X.mjs +1 -0
  10. package/dist/packem_shared/auth-C3dB8sYS.mjs +1 -0
  11. package/dist/packem_shared/connectionStatus-UhmuwzMa.mjs +1 -0
  12. package/dist/packem_shared/flag-BDKBQGos.mjs +1 -0
  13. package/dist/packem_shared/hydratePreloaded-QPAo50Am.mjs +1 -0
  14. package/dist/packem_shared/infiniteQuery-CnLj_eFx.mjs +1 -0
  15. package/dist/packem_shared/liveQuery-eE9zMaxo.mjs +1 -0
  16. package/dist/packem_shared/liveTopic-Cz1BDkMP.mjs +1 -0
  17. package/dist/packem_shared/mutate-Dg5AiM8y.mjs +1 -0
  18. package/dist/packem_shared/mutator-DjG1yGk8.mjs +1 -0
  19. package/dist/packem_shared/platform-DGTu4Ucl.mjs +1 -0
  20. package/dist/packem_shared/presence-NK13Gvdk.mjs +1 -0
  21. package/dist/packem_shared/rateLimit-B3h9qzh-.mjs +1 -0
  22. package/dist/packem_shared/runAction-BfiPq4Xz.mjs +1 -0
  23. package/dist/packem_shared/stream-BuhiwhIH.mjs +1 -0
  24. package/dist/packem_shared/subscription-zJv48q6C.mjs +1 -0
  25. package/dist/packem_shared/voiceAgent-DppK8OxH.mjs +1 -0
  26. package/dist/server.d.mts +1 -0
  27. package/dist/server.d.ts +1 -0
  28. package/dist/server.mjs +1 -0
  29. package/dist/upload.d.mts +20 -0
  30. package/dist/upload.d.ts +20 -0
  31. package/dist/upload.mjs +1 -1
  32. package/package.json +9 -4
  33. package/dist/packem_shared/LUNORA_CLIENT-B0pGE0Tv.mjs +0 -1
  34. package/dist/packem_shared/agent-C-GavfBl.mjs +0 -1
  35. package/dist/packem_shared/agentChat-DVHf7gsd.mjs +0 -1
  36. package/dist/packem_shared/agentState-BAfa0QuC.mjs +0 -1
  37. package/dist/packem_shared/agentToolEvents-CBTZ_DsO.mjs +0 -1
  38. package/dist/packem_shared/auth-BTEtMnGG.mjs +0 -1
  39. package/dist/packem_shared/connectionStatus-C53UhkPi.mjs +0 -1
  40. package/dist/packem_shared/flag-BYFWoQTg.mjs +0 -1
  41. package/dist/packem_shared/hydratePreloaded-BKHgpXzQ.mjs +0 -1
  42. package/dist/packem_shared/infiniteQuery-DyWJIpUr.mjs +0 -1
  43. package/dist/packem_shared/liveQuery-DEIqmTPj.mjs +0 -1
  44. package/dist/packem_shared/mutate-DR8Uo8Hs.mjs +0 -1
  45. package/dist/packem_shared/mutator-Cw6jpG06.mjs +0 -1
  46. package/dist/packem_shared/platform-BGZypnc9.mjs +0 -1
  47. package/dist/packem_shared/presence-BMrTlOCF.mjs +0 -1
  48. package/dist/packem_shared/rateLimit-CQazDrPJ.mjs +0 -1
  49. package/dist/packem_shared/stream-CcvHiJf2.mjs +0 -1
  50. package/dist/packem_shared/subscription-DJeoGEDR.mjs +0 -1
  51. package/dist/packem_shared/voiceAgent-DUFVwTWi.mjs +0 -1
package/README.md CHANGED
@@ -57,6 +57,60 @@ export class MessagesComponent {
57
57
 
58
58
  Pass `"skip"` as the args to short-circuit (no network call, no socket).
59
59
 
60
+ Pass a function/`Signal` instead of a plain object to make the args reactive —
61
+ each change tears the old subscription down, resets the signal to `undefined`,
62
+ and opens a fresh one for the new args:
63
+
64
+ ```ts
65
+ export class MessagesComponent {
66
+ private readonly channelId = input.required<string>();
67
+
68
+ readonly messages = liveQuery(api.messages.list, () => ({ channelId: this.channelId() }));
69
+ }
70
+ ```
71
+
72
+ `subscription` and `paginatedQuery`/`infiniteQuery` accept the same reactive
73
+ args form. Calling from outside an injection context (e.g. `ngOnInit`) needs an
74
+ explicit `injector` alongside `client`/`destroyRef` for the reactive form —
75
+ `effect()` can't resolve one on its own there:
76
+
77
+ ```ts
78
+ liveQuery(api.messages.list, () => ({ channelId: this.channelId() }), {
79
+ client: this.client,
80
+ destroyRef: this.destroyRef,
81
+ injector: this.injector,
82
+ });
83
+ ```
84
+
85
+ ## Live topics
86
+
87
+ `liveTopic` follows one topic a `defineLiveStream` declares, and mirrors the last
88
+ payload and any refusal into two signals: `lastEvent` and `error`. Pass the
89
+ reference `_generated/live.ts` hands out; the stream's route is resolved against
90
+ the injected `LunoraClient`, and `lastEvent` and `onEvent` are typed by the payload
91
+ the topic declares. It subscribes when the component is created and unsubscribes
92
+ on `DestroyRef`.
93
+
94
+ ```ts
95
+ import { input } from "@angular/core";
96
+ import { liveTopic } from "@lunora/angular";
97
+
98
+ import { live } from "../lunora/_generated/live";
99
+
100
+ export class PostComponent {
101
+ readonly postId = input.required<string>();
102
+
103
+ readonly comments = liveTopic(() => live.posts.comments({ postId: this.postId() }));
104
+ }
105
+ ```
106
+
107
+ A function makes the topic reactive: a new topic resubscribes, while a new
108
+ `onEvent` or `onError` callback is read at call time and does not. A plain
109
+ reference resolves once. Pass `{ client, destroyRef, injector }` as the second
110
+ argument when calling outside an injection context, as with `liveQuery`; the
111
+ options also take `shardKey` and `sessionKey` (each a string or a signal, which resubscribes on change) and the transport tuning `headers`,
112
+ `withCredentials`, `retryDelay` and `maxDelayMs`.
113
+
60
114
  ## Mutations
61
115
 
62
116
  ```ts
@@ -85,4 +139,21 @@ import { connectionStatus } from "@lunora/angular";
85
139
  readonly status = connectionStatus(); // Signal<"idle" | "connecting" | "connected" | "offline">
86
140
  ```
87
141
 
142
+ ## Agents
143
+
144
+ ```ts
145
+ import { agentToolEvents, voiceAgent } from "@lunora/angular";
146
+
147
+ // One thread's tool lifecycle: call / result / awaiting-approval / progress.
148
+ readonly events = agentToolEvents({ api, threadKey: "t1", stream: api.chat.liveEvents }).events;
149
+
150
+ // A full-duplex voice call against api.agents.<name>Voice.
151
+ readonly call = voiceAgent({ threadKey: "t1", voice: api.agents.supportVoice });
152
+ ```
153
+
154
+ `voiceAgent` opens nothing until `call.startCall()` — that call is what requests
155
+ the microphone, so it must run from a user gesture. `call.endCall()` releases the
156
+ socket, the mic tracks and the Web Audio graph, and the owning `DestroyRef` runs
157
+ it on destroy.
158
+
88
159
  Part of the [Lunora](https://github.com/anolilab/lunora) framework.