@estuary-ai/sdk 0.2.1 → 0.4.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
@@ -247,7 +247,32 @@ interface EstuaryConfig {
247
247
  realtimeMemory?: boolean; // Enable real-time memory extraction events. Default: false
248
248
  suppressMicDuringPlayback?: boolean; // Mute mic while bot audio plays (software AEC). Default: false
249
249
  autoInterruptOnSpeech?: boolean; // Interrupt bot audio when user speaks. Default: true
250
+ capabilities?: SessionCapabilities; // Per-session device capability declaration
250
251
  }
252
+
253
+ interface SessionCapabilities {
254
+ version?: string; // Schema version, defaults to "1"
255
+ camera?: boolean; // Device has a usable camera
256
+ microphone?: boolean; // Device has a usable microphone
257
+ speaker?: boolean; // Device has a usable speaker
258
+ }
259
+ ```
260
+
261
+ ### Capability Declaration
262
+
263
+ Tell the server what the device can physically do. The server hides tools that require a missing capability — e.g. `request_camera_image` is suppressed when `camera: false`, so the LLM won't ask to see the camera on text-only clients.
264
+
265
+ When `capabilities` is omitted, the server defaults every field to `true` for backward compatibility — existing clients keep working unchanged.
266
+
267
+ ```typescript
268
+ const client = new EstuaryClient({
269
+ serverUrl, apiKey, characterId, playerId,
270
+ capabilities: {
271
+ camera: false, // No camera on this client (e.g. share link, text-only widget)
272
+ microphone: true,
273
+ speaker: true,
274
+ },
275
+ });
251
276
  ```
252
277
 
253
278
  ## Runtime Properties
package/dist/index.d.mts CHANGED
@@ -27,8 +27,25 @@ interface EstuaryConfig {
27
27
  suppressMicDuringPlayback?: boolean;
28
28
  /** Proactively interrupt bot audio when user starts speaking (default: true) */
29
29
  autoInterruptOnSpeech?: boolean;
30
+ /** Per-session client capability declaration. Tells the server what the device
31
+ * can physically do (camera, microphone, speaker). When omitted, the server
32
+ * defaults all fields to true for backward compatibility. Tools requiring a
33
+ * capability are hidden from the LLM when that capability is false (e.g.
34
+ * `request_camera_image` is suppressed when `camera: false`). */
35
+ capabilities?: SessionCapabilities;
30
36
  }
31
37
  type VoiceTransport = 'websocket' | 'livekit' | 'auto';
38
+ /** Per-session client capability declaration. Pass on `EstuaryConfig.capabilities`. */
39
+ interface SessionCapabilities {
40
+ /** Schema version. Defaults to "1" when omitted. */
41
+ version?: string;
42
+ /** Device has a camera the SDK can call `sendCameraImage()` against. */
43
+ camera?: boolean;
44
+ /** Device has a microphone usable for voice capture. */
45
+ microphone?: boolean;
46
+ /** Device has a speaker usable for TTS playback. */
47
+ speaker?: boolean;
48
+ }
32
49
  declare enum ConnectionState {
33
50
  Disconnected = "disconnected",
34
51
  Connecting = "connecting",
@@ -122,6 +139,15 @@ interface CharacterInfo {
122
139
  modelStatus: string | null;
123
140
  sourceImageUrl: string | null;
124
141
  }
142
+ interface ShareOpenResponse {
143
+ sessionToken: string;
144
+ characterId: string;
145
+ playerId: string;
146
+ serverUrl: string;
147
+ character: CharacterInfo & {
148
+ personality?: string | null;
149
+ };
150
+ }
125
151
  interface CharacterAction {
126
152
  /** Action name (e.g., "follow_user", "sit", "look_at") */
127
153
  name: string;
@@ -339,6 +365,12 @@ declare class EstuaryClient extends TypedEventEmitter<EstuaryEventMap> {
339
365
  get memory(): MemoryClient;
340
366
  /** Fetch character details including 3D model and avatar URLs. */
341
367
  getCharacter(characterId?: string): Promise<CharacterInfo>;
368
+ /**
369
+ * Open a permanent share link. Calls the backend's /open endpoint to mint a
370
+ * fresh session token and resolve character metadata (including modelUrl).
371
+ * Use the returned fields to construct an EstuaryClient with sessionToken auth.
372
+ */
373
+ static openShare(serverUrl: string, shareId: string): Promise<ShareOpenResponse>;
342
374
  /** Current session info (null if not connected) */
343
375
  get session(): SessionInfo | null;
344
376
  /** Current connection state */
@@ -438,4 +470,4 @@ declare class CharacterClient {
438
470
  dispose(): void;
439
471
  }
440
472
 
441
- export { type BotResponse, type BotVoice, type CameraCaptureRequest, type CharacterAction, CharacterClient, type CharacterInfo, ConnectionState, type CoreFact, type CoreFactsResponse, ErrorCode, EstuaryClient, type EstuaryConfig, EstuaryError, type EstuaryEventMap, type InterruptData, type LiveKitTokenResponse, MemoryClient, type MemoryData, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphOptions, type MemoryGraphResponse, type MemoryListOptions, type MemoryListResponse, type MemorySearchOptions, type MemorySearchResponse, type MemoryStatsResponse, type MemoryTimelineOptions, type MemoryTimelineResponse, type MemoryUpdatedEvent, type ParsedAction, type QuotaExceededData, type SessionInfo, type SttResponse, type VoiceManager, type VoiceTransport, parseActions };
473
+ export { type BotResponse, type BotVoice, type CameraCaptureRequest, type CharacterAction, CharacterClient, type CharacterInfo, ConnectionState, type CoreFact, type CoreFactsResponse, ErrorCode, EstuaryClient, type EstuaryConfig, EstuaryError, type EstuaryEventMap, type InterruptData, type LiveKitTokenResponse, MemoryClient, type MemoryData, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphOptions, type MemoryGraphResponse, type MemoryListOptions, type MemoryListResponse, type MemorySearchOptions, type MemorySearchResponse, type MemoryStatsResponse, type MemoryTimelineOptions, type MemoryTimelineResponse, type MemoryUpdatedEvent, type ParsedAction, type QuotaExceededData, type SessionInfo, type ShareOpenResponse, type SttResponse, type VoiceManager, type VoiceTransport, parseActions };
package/dist/index.d.ts CHANGED
@@ -27,8 +27,25 @@ interface EstuaryConfig {
27
27
  suppressMicDuringPlayback?: boolean;
28
28
  /** Proactively interrupt bot audio when user starts speaking (default: true) */
29
29
  autoInterruptOnSpeech?: boolean;
30
+ /** Per-session client capability declaration. Tells the server what the device
31
+ * can physically do (camera, microphone, speaker). When omitted, the server
32
+ * defaults all fields to true for backward compatibility. Tools requiring a
33
+ * capability are hidden from the LLM when that capability is false (e.g.
34
+ * `request_camera_image` is suppressed when `camera: false`). */
35
+ capabilities?: SessionCapabilities;
30
36
  }
31
37
  type VoiceTransport = 'websocket' | 'livekit' | 'auto';
38
+ /** Per-session client capability declaration. Pass on `EstuaryConfig.capabilities`. */
39
+ interface SessionCapabilities {
40
+ /** Schema version. Defaults to "1" when omitted. */
41
+ version?: string;
42
+ /** Device has a camera the SDK can call `sendCameraImage()` against. */
43
+ camera?: boolean;
44
+ /** Device has a microphone usable for voice capture. */
45
+ microphone?: boolean;
46
+ /** Device has a speaker usable for TTS playback. */
47
+ speaker?: boolean;
48
+ }
32
49
  declare enum ConnectionState {
33
50
  Disconnected = "disconnected",
34
51
  Connecting = "connecting",
@@ -122,6 +139,15 @@ interface CharacterInfo {
122
139
  modelStatus: string | null;
123
140
  sourceImageUrl: string | null;
124
141
  }
142
+ interface ShareOpenResponse {
143
+ sessionToken: string;
144
+ characterId: string;
145
+ playerId: string;
146
+ serverUrl: string;
147
+ character: CharacterInfo & {
148
+ personality?: string | null;
149
+ };
150
+ }
125
151
  interface CharacterAction {
126
152
  /** Action name (e.g., "follow_user", "sit", "look_at") */
127
153
  name: string;
@@ -339,6 +365,12 @@ declare class EstuaryClient extends TypedEventEmitter<EstuaryEventMap> {
339
365
  get memory(): MemoryClient;
340
366
  /** Fetch character details including 3D model and avatar URLs. */
341
367
  getCharacter(characterId?: string): Promise<CharacterInfo>;
368
+ /**
369
+ * Open a permanent share link. Calls the backend's /open endpoint to mint a
370
+ * fresh session token and resolve character metadata (including modelUrl).
371
+ * Use the returned fields to construct an EstuaryClient with sessionToken auth.
372
+ */
373
+ static openShare(serverUrl: string, shareId: string): Promise<ShareOpenResponse>;
342
374
  /** Current session info (null if not connected) */
343
375
  get session(): SessionInfo | null;
344
376
  /** Current connection state */
@@ -438,4 +470,4 @@ declare class CharacterClient {
438
470
  dispose(): void;
439
471
  }
440
472
 
441
- export { type BotResponse, type BotVoice, type CameraCaptureRequest, type CharacterAction, CharacterClient, type CharacterInfo, ConnectionState, type CoreFact, type CoreFactsResponse, ErrorCode, EstuaryClient, type EstuaryConfig, EstuaryError, type EstuaryEventMap, type InterruptData, type LiveKitTokenResponse, MemoryClient, type MemoryData, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphOptions, type MemoryGraphResponse, type MemoryListOptions, type MemoryListResponse, type MemorySearchOptions, type MemorySearchResponse, type MemoryStatsResponse, type MemoryTimelineOptions, type MemoryTimelineResponse, type MemoryUpdatedEvent, type ParsedAction, type QuotaExceededData, type SessionInfo, type SttResponse, type VoiceManager, type VoiceTransport, parseActions };
473
+ export { type BotResponse, type BotVoice, type CameraCaptureRequest, type CharacterAction, CharacterClient, type CharacterInfo, ConnectionState, type CoreFact, type CoreFactsResponse, ErrorCode, EstuaryClient, type EstuaryConfig, EstuaryError, type EstuaryEventMap, type InterruptData, type LiveKitTokenResponse, MemoryClient, type MemoryData, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphOptions, type MemoryGraphResponse, type MemoryListOptions, type MemoryListResponse, type MemorySearchOptions, type MemorySearchResponse, type MemoryStatsResponse, type MemoryTimelineOptions, type MemoryTimelineResponse, type MemoryUpdatedEvent, type ParsedAction, type QuotaExceededData, type SessionInfo, type ShareOpenResponse, type SttResponse, type VoiceManager, type VoiceTransport, parseActions };
package/dist/index.js CHANGED
@@ -9038,6 +9038,9 @@ var SocketManager = class extends TypedEventEmitter {
9038
9038
  } else if (this.config.apiKey) {
9039
9039
  authPayload.api_key = this.config.apiKey;
9040
9040
  }
9041
+ if (this.config.capabilities) {
9042
+ authPayload.capabilities = { version: "1", ...this.config.capabilities };
9043
+ }
9041
9044
  this.socket.emit("authenticate", authPayload);
9042
9045
  };
9043
9046
  const onSessionInfo = (data) => {
@@ -9669,6 +9672,26 @@ var EstuaryClient = class extends TypedEventEmitter {
9669
9672
  }
9670
9673
  return this._character.getCharacter(characterId ?? this.config.characterId);
9671
9674
  }
9675
+ /**
9676
+ * Open a permanent share link. Calls the backend's /open endpoint to mint a
9677
+ * fresh session token and resolve character metadata (including modelUrl).
9678
+ * Use the returned fields to construct an EstuaryClient with sessionToken auth.
9679
+ */
9680
+ static async openShare(serverUrl, shareId) {
9681
+ const url2 = `${serverUrl.replace(/\/+$/, "")}/api/v1/share/${shareId}/open`;
9682
+ const res = await fetch(url2, {
9683
+ method: "POST",
9684
+ headers: { "Content-Type": "application/json" }
9685
+ });
9686
+ if (!res.ok) {
9687
+ const detail = await res.text().catch(() => "");
9688
+ throw new exports.EstuaryError(
9689
+ "REST_ERROR" /* REST_ERROR */,
9690
+ `Share open failed (${res.status}): ${detail}`
9691
+ );
9692
+ }
9693
+ return res.json();
9694
+ }
9672
9695
  /** Current session info (null if not connected) */
9673
9696
  get session() {
9674
9697
  return this._sessionInfo;