@lumavox/react 0.38.0 → 0.40.0

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.
@@ -102,6 +102,10 @@ export interface RecordingOptions extends TurnOptions {
102
102
  rate?: number;
103
103
  /** A dictation: the reply being spoken plays on. */
104
104
  transcribeOnly?: boolean;
105
+ /** A language hint for this recording, 2 to 8 characters, as `listen`'s. */
106
+ language?: string;
107
+ /** A transcription model (`STT_MODELS`); the agent's own when unset. */
108
+ model?: string;
105
109
  }
106
110
  export interface StopRecordingOptions {
107
111
  /** No turn: this recording's words, answered by `stopRecording`. */
package/dist/use-agent.js CHANGED
@@ -204,6 +204,9 @@ export function useAgent(target, options = {}) {
204
204
  const hush = useCallback(() => {
205
205
  silenced.current = true;
206
206
  latest.current.audio?.stop();
207
+ // Hands-free is told too: it hears each window of the reply open, and
208
+ // nothing drains what is no longer played (`Listening.silenced`).
209
+ handsFree.current?.engine?.silenced(current.current?.snapshot.turn?.id ?? null);
207
210
  setSpeaking(false);
208
211
  }, []);
209
212
  useEffect(() => {
@@ -517,6 +520,8 @@ export function useAgent(target, options = {}) {
517
520
  }
518
521
  c.startAudio({
519
522
  rate: granted,
523
+ ...(record.language ? { language: record.language } : {}),
524
+ ...(record.model ? { model: record.model } : {}),
520
525
  ...turnNow({
521
526
  ...(record.speech === undefined ? {} : { speech: record.speech }),
522
527
  ...(record.thoughts === undefined
@@ -1,12 +1,23 @@
1
1
  /**
2
- * What is remembered about the person (`useFacts`), and forgetting it. A
2
+ * What is remembered about the person (`useFacts`): reading it, telling
3
+ * the agents something, correcting or pinning a fact, and forgetting. A
3
4
  * person with nothing remembered — or talking only to agents with memory
4
5
  * off — has an empty list, which the route answers as one: never an
5
6
  * error (`apps/api/test/sdk-client.test.ts` holds it).
6
7
  */
7
- import type { Client, FactInfo } from "@lumavox/client";
8
+ import type { Client, FactCreateRequest, FactInfo, FactUpdateRequest } from "@lumavox/client";
8
9
  import { type Read } from "./read.js";
9
10
  export interface FactsRead extends Read<FactInfo[]> {
11
+ /**
12
+ * Tell the agents something about the person, `pinned` to have it
13
+ * recalled first: the list takes it. `created` is false when a fact
14
+ * already said it. Rejects with the API's error.
15
+ */
16
+ add(body: FactCreateRequest): Promise<FactInfo & {
17
+ created: boolean;
18
+ }>;
19
+ /** Correct one fact's words, pin or unpin it: the list takes the answer. */
20
+ update(id: string, body: FactUpdateRequest): Promise<FactInfo>;
10
21
  /** Forget one; a fact already gone is forgotten too. Rejects with the API's error. */
11
22
  forget(id: string): Promise<void>;
12
23
  /** Forget everything about the person. Their conversations stay. */
package/dist/use-facts.js CHANGED
@@ -3,7 +3,7 @@ import { useClient } from "./provider.js";
3
3
  import { useRead } from "./read.js";
4
4
  export function useFacts(client) {
5
5
  const c = useClient(client);
6
- // Every page: the route answers its one, the newest 100, for now.
6
+ // Every page, oldest first.
7
7
  const read = useRead("facts", async () => {
8
8
  const facts = [];
9
9
  for await (const fact of c.facts.list())
@@ -11,6 +11,22 @@ export function useFacts(client) {
11
11
  return facts;
12
12
  }, c);
13
13
  const { set } = read;
14
+ // In place, as `forget` is: an app on the hooks called the client for
15
+ // these and refreshed by hand (the agent audit, 2026-11-21).
16
+ const add = useCallback(async (body) => {
17
+ const { created, ...fact } = await c.facts.create(body);
18
+ set((facts) => facts === null
19
+ ? null
20
+ : facts.some((old) => old.id === fact.id)
21
+ ? facts.map((old) => (old.id === fact.id ? fact : old))
22
+ : [...facts, fact]);
23
+ return { ...fact, created };
24
+ }, [c, set]);
25
+ const update = useCallback(async (id, body) => {
26
+ const fact = await c.facts.update(id, body);
27
+ set((facts) => facts?.map((old) => (old.id === id ? fact : old)) ?? null);
28
+ return fact;
29
+ }, [c, set]);
14
30
  const forget = useCallback(async (id) => {
15
31
  await c.facts.delete(id);
16
32
  set((facts) => facts?.filter((fact) => fact.id !== id) ?? null);
@@ -24,6 +40,8 @@ export function useFacts(client) {
24
40
  error: read.error,
25
41
  loading: read.loading,
26
42
  refresh: read.refresh,
43
+ add,
44
+ update,
27
45
  forget,
28
46
  forgetAll,
29
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumavox/react",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "description": "React and React Native hooks for Lumavox agents: a conversation that keeps itself connected, sessions, memory and relations, over @lumavox/client.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,12 +42,12 @@
42
42
  "typecheck": "tsc --noEmit && tsc --noEmit -p test"
43
43
  },
44
44
  "peerDependencies": {
45
- "@lumavox/client": "0.38.0",
45
+ "@lumavox/client": "0.40.0",
46
46
  "react": ">=18"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@biomejs/biome": "2.6.4",
50
- "@lumavox/client": "0.38.0",
50
+ "@lumavox/client": "0.40.0",
51
51
  "@testing-library/react": "^16.3.3",
52
52
  "@types/node": "^24",
53
53
  "@types/react": "^19",