@simfinity/constellation-ui 1.0.7 → 1.0.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/dist/index.cjs CHANGED
@@ -43,12 +43,15 @@ var ConstellationContext = import_react.default.createContext(null);
43
43
  function ConstellationProvider({ client, children }) {
44
44
  const [sessionId, setSessionId] = (0, import_react.useState)(null);
45
45
  const [connected, setConnected] = (0, import_react.useState)(false);
46
+ const [voiceEnabled, setVoiceEnabled] = (0, import_react.useState)(false);
46
47
  const value = {
47
48
  client,
48
49
  sessionId,
49
50
  connected,
51
+ voiceEnabled,
50
52
  setSessionId,
51
- setConnected
53
+ setConnected,
54
+ setVoiceEnabled
52
55
  };
53
56
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConstellationContext.Provider, { value, children });
54
57
  }
@@ -56,11 +59,9 @@ function useConstellationClient() {
56
59
  const ctx = (0, import_react.useContext)(ConstellationContext);
57
60
  if (!ctx) throw new Error("Must be used inside ConstellationProvider");
58
61
  return {
59
- supportedTools: async () => {
60
- return await ctx.client.fetchSupportedTools();
61
- },
62
- startSession: async () => {
63
- await ctx.client.startSession();
62
+ startSession: async (voiceEnabled, voiceName) => {
63
+ await ctx.client.startSession(voiceEnabled, voiceName);
64
+ ctx.setVoiceEnabled(voiceEnabled);
64
65
  },
65
66
  endSession: async () => {
66
67
  await ctx.client.endSession();
@@ -82,7 +83,8 @@ function useConstellationSession() {
82
83
  if (!ctx) throw new Error("Must be used inside ConstellationProvider");
83
84
  return {
84
85
  sessionId: ctx.sessionId,
85
- connected: ctx.connected
86
+ connected: ctx.connected,
87
+ voiceEnabled: ctx.voiceEnabled
86
88
  };
87
89
  }
88
90
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.cts CHANGED
@@ -26,7 +26,6 @@ import { WebClient } from '@simfinity/constellation-client';
26
26
  * key: "YOUR_SECRET_KEY",
27
27
  * llm: "openai",
28
28
  * model: "gpt-4o-realtime-preview-2024-12-17",
29
- * voiceEnabled: false,
30
29
  * });
31
30
  *
32
31
  * function App() {
@@ -52,7 +51,7 @@ declare function ConstellationProvider({ client, children, }: {
52
51
  *
53
52
  * IMPORTANT SESSION ORDER:
54
53
  *
55
- * 1) startSession()
54
+ * 1) startSession(voiceEnabled, voiceName)
56
55
  * → Creates a persistent server-side session (REST)
57
56
  * → A session remains alive and can be re-joined within 5 minutes of inactivity
58
57
  *
@@ -120,7 +119,7 @@ declare function ConstellationProvider({ client, children, }: {
120
119
  * endSession
121
120
  * } = useConstellationClient();
122
121
  *
123
- * await startSession();
122
+ * await startSession(false);
124
123
  * await joinSession(false, {
125
124
  * onStreamClosed: console.log,
126
125
  * onTranscriptResponse: (text) => console.log(text),
@@ -140,6 +139,7 @@ declare function useConstellationClient(): any;
140
139
  * {
141
140
  * sessionId: string | null
142
141
  * connected: boolean
142
+ * voiceEnabled: boolean
143
143
  * }
144
144
  *
145
145
  * sessionId
@@ -148,9 +148,12 @@ declare function useConstellationClient(): any;
148
148
  * connected
149
149
  * - True after successful joinSession().
150
150
  *
151
+ * voiceEnabled
152
+ * - True if startSession() was called with voiceEnabled=true
153
+ *
151
154
  * @example
152
155
  * ```tsx
153
- * const { connected, sessionId } = useConstellationSession();
156
+ * const { connected, sessionId, voiceEnabled } = useConstellationSession();
154
157
  *
155
158
  * if (!connected) return <p>Disconnected</p>;
156
159
  * ```
package/dist/index.d.ts CHANGED
@@ -26,7 +26,6 @@ import { WebClient } from '@simfinity/constellation-client';
26
26
  * key: "YOUR_SECRET_KEY",
27
27
  * llm: "openai",
28
28
  * model: "gpt-4o-realtime-preview-2024-12-17",
29
- * voiceEnabled: false,
30
29
  * });
31
30
  *
32
31
  * function App() {
@@ -52,7 +51,7 @@ declare function ConstellationProvider({ client, children, }: {
52
51
  *
53
52
  * IMPORTANT SESSION ORDER:
54
53
  *
55
- * 1) startSession()
54
+ * 1) startSession(voiceEnabled, voiceName)
56
55
  * → Creates a persistent server-side session (REST)
57
56
  * → A session remains alive and can be re-joined within 5 minutes of inactivity
58
57
  *
@@ -120,7 +119,7 @@ declare function ConstellationProvider({ client, children, }: {
120
119
  * endSession
121
120
  * } = useConstellationClient();
122
121
  *
123
- * await startSession();
122
+ * await startSession(false);
124
123
  * await joinSession(false, {
125
124
  * onStreamClosed: console.log,
126
125
  * onTranscriptResponse: (text) => console.log(text),
@@ -140,6 +139,7 @@ declare function useConstellationClient(): any;
140
139
  * {
141
140
  * sessionId: string | null
142
141
  * connected: boolean
142
+ * voiceEnabled: boolean
143
143
  * }
144
144
  *
145
145
  * sessionId
@@ -148,9 +148,12 @@ declare function useConstellationClient(): any;
148
148
  * connected
149
149
  * - True after successful joinSession().
150
150
  *
151
+ * voiceEnabled
152
+ * - True if startSession() was called with voiceEnabled=true
153
+ *
151
154
  * @example
152
155
  * ```tsx
153
- * const { connected, sessionId } = useConstellationSession();
156
+ * const { connected, sessionId, voiceEnabled } = useConstellationSession();
154
157
  *
155
158
  * if (!connected) return <p>Disconnected</p>;
156
159
  * ```
package/dist/index.js CHANGED
@@ -5,12 +5,15 @@ var ConstellationContext = React.createContext(null);
5
5
  function ConstellationProvider({ client, children }) {
6
6
  const [sessionId, setSessionId] = useState(null);
7
7
  const [connected, setConnected] = useState(false);
8
+ const [voiceEnabled, setVoiceEnabled] = useState(false);
8
9
  const value = {
9
10
  client,
10
11
  sessionId,
11
12
  connected,
13
+ voiceEnabled,
12
14
  setSessionId,
13
- setConnected
15
+ setConnected,
16
+ setVoiceEnabled
14
17
  };
15
18
  return /* @__PURE__ */ jsx(ConstellationContext.Provider, { value, children });
16
19
  }
@@ -18,11 +21,9 @@ function useConstellationClient() {
18
21
  const ctx = useContext(ConstellationContext);
19
22
  if (!ctx) throw new Error("Must be used inside ConstellationProvider");
20
23
  return {
21
- supportedTools: async () => {
22
- return await ctx.client.fetchSupportedTools();
23
- },
24
- startSession: async () => {
25
- await ctx.client.startSession();
24
+ startSession: async (voiceEnabled, voiceName) => {
25
+ await ctx.client.startSession(voiceEnabled, voiceName);
26
+ ctx.setVoiceEnabled(voiceEnabled);
26
27
  },
27
28
  endSession: async () => {
28
29
  await ctx.client.endSession();
@@ -44,7 +45,8 @@ function useConstellationSession() {
44
45
  if (!ctx) throw new Error("Must be used inside ConstellationProvider");
45
46
  return {
46
47
  sessionId: ctx.sessionId,
47
- connected: ctx.connected
48
+ connected: ctx.connected,
49
+ voiceEnabled: ctx.voiceEnabled
48
50
  };
49
51
  }
50
52
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simfinity/constellation-ui",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -25,7 +25,7 @@
25
25
  "author": "Simfinity",
26
26
  "license": "MIT",
27
27
  "dependencies": {
28
- "@simfinity/constellation-client": "^1.0.11"
28
+ "@simfinity/constellation-client": "^1.0.17"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/react": "^19.2.11",