@lumavox/react 0.5.0 → 0.6.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.
package/README.md CHANGED
@@ -61,7 +61,9 @@ redial.
61
61
  | `conversation` | the `Conversation` itself |
62
62
 
63
63
  Every `@lumavox/client` handler is an option (`onText`, `onDone`, …), and
64
- `speech` and `thoughts`. **`audio`**, an `AgentAudio` — a player and a
64
+ `speech` and `thoughts`; **`tools`**, the agent's app tools your app runs
65
+ — `{ open_page: ({ page }) => … }` — named when it connects, each call
66
+ running the latest render's handler. **`audio`**, an `AgentAudio` — a player and a
65
67
  recorder — makes replies audible and `startRecording` work: replies play
66
68
  as they arrive and stop on `cancel`, `mute` or a new message; recording
67
69
  opens the microphone first and the recording at the rate it was granted.
package/dist/use-agent.js CHANGED
@@ -128,9 +128,17 @@ export function useAgent(target, options = {}) {
128
128
  setSession(detail);
129
129
  id = detail.id;
130
130
  }
131
+ // The app's tools are named at connect; each call runs the latest
132
+ // render's handler.
133
+ const named = latest.current.tools;
134
+ const tools = named && {};
135
+ for (const name in named) {
136
+ tools[name] = (...args) => latest.current.tools?.[name]?.(...args);
137
+ }
131
138
  made = client.connect(id, wire(), {
132
139
  speech: latest.current.speech,
133
140
  thoughts: latest.current.thoughts,
141
+ tools,
134
142
  });
135
143
  current.current = made;
136
144
  opening.current = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumavox/react",
3
- "version": "0.5.0",
3
+ "version": "0.6.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",
@@ -29,7 +29,7 @@
29
29
  "typecheck": "tsc --noEmit && tsc --noEmit -p test"
30
30
  },
31
31
  "dependencies": {
32
- "@lumavox/client": "0.5.0"
32
+ "@lumavox/client": "0.6.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": ">=18"