@breeze.blue/sdk 0.5.1 → 0.6.1

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { AudioResponse } from "./audio.js";
2
2
  export { BreezeBlueAPIError, BreezeBlueAuthenticationError, BreezeBlueBadRequestError, BreezeBlueConfigurationError, BreezeBlueConflictError, BreezeBlueError, BreezeBlueForbiddenError, BreezeBlueGenerationNotReadyError, BreezeBlueInsufficientCreditsError, BreezeBlueNotFoundError, BreezeBlueRateLimitError, BreezeBlueRealtimeError, BreezeBlueServiceUnavailableError, BreezeBlueUpstreamError, BreezeBlueValidationError, } from "./errors.js";
3
- export { BreezeBlueClient, RealtimeTextToSpeechConnection } from "./client.js";
3
+ export { BreezeBlueClient, ManagedRealtimeTextToSpeechConnection, RealtimeTextToSpeechConnection, } from "./client.js";
4
4
  export { SDK_NAME, SDK_VERSION } from "./version.js";
5
5
  export type * from "./types.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { AudioResponse } from "./audio.js";
2
2
  export { BreezeBlueAPIError, BreezeBlueAuthenticationError, BreezeBlueBadRequestError, BreezeBlueConfigurationError, BreezeBlueConflictError, BreezeBlueError, BreezeBlueForbiddenError, BreezeBlueGenerationNotReadyError, BreezeBlueInsufficientCreditsError, BreezeBlueNotFoundError, BreezeBlueRateLimitError, BreezeBlueRealtimeError, BreezeBlueServiceUnavailableError, BreezeBlueUpstreamError, BreezeBlueValidationError, } from "./errors.js";
3
- export { BreezeBlueClient, RealtimeTextToSpeechConnection } from "./client.js";
3
+ export { BreezeBlueClient, ManagedRealtimeTextToSpeechConnection, RealtimeTextToSpeechConnection, } from "./client.js";
4
4
  export { SDK_NAME, SDK_VERSION } from "./version.js";
package/dist/types.d.ts CHANGED
@@ -61,18 +61,86 @@ export interface RealtimeTextToSpeechConnectOptions extends RealtimeTextToSpeech
61
61
  clientSecret?: string;
62
62
  websocketUrl?: string;
63
63
  webSocket?: BreezeBlueWebSocketConstructor;
64
+ signal?: AbortSignal;
64
65
  /** Handshake timeout in milliseconds. Defaults to the client `timeout`. */
65
66
  timeout?: number;
66
67
  }
68
+ export type RealtimeTextToSpeechSessionCredentials = {
69
+ clientSecret: string;
70
+ websocketUrl?: string;
71
+ } | {
72
+ clientSecret?: string;
73
+ websocketUrl: string;
74
+ };
75
+ export interface RealtimeTextToSpeechSessionFactoryContext {
76
+ /**
77
+ * Aborted when the managed connection closes or the physical epoch exceeds
78
+ * its timeout. Pass it to the request that creates fresh credentials.
79
+ */
80
+ signal: AbortSignal;
81
+ }
82
+ /**
83
+ * Options for an SDK-managed logical realtime connection.
84
+ *
85
+ * Every physical WebSocket epoch obtains fresh credentials. Server-side callers
86
+ * can omit `sessionFactory` and let the SDK call `createSession`; browser
87
+ * callers should provide a callback that fetches a fresh client secret from
88
+ * their own backend.
89
+ */
90
+ export interface RealtimeTextToSpeechManagedConnectOptions extends RealtimeTextToSpeechSessionRequest {
91
+ sessionFactory?: (context: RealtimeTextToSpeechSessionFactoryContext) => Promise<RealtimeTextToSpeechSessionCredentials>;
92
+ webSocket?: BreezeBlueWebSocketConstructor;
93
+ /**
94
+ * Positive physical handshake and `session.ready` timeout in milliseconds.
95
+ * Defaults to the client `timeout`.
96
+ */
97
+ timeout?: number;
98
+ /**
99
+ * Keepalive interval in milliseconds. By default the SDK derives a safe
100
+ * interval from `session.ready.inactivityTimeoutSeconds`. Set to `0` to
101
+ * disable automatic keepalive.
102
+ */
103
+ heartbeatIntervalMs?: number;
104
+ /**
105
+ * Maximum wait for any server response after a managed keepalive ping.
106
+ * Defaults to 5 seconds. A timeout replaces an idle physical session and
107
+ * interrupts, but never replays, an active turn.
108
+ */
109
+ heartbeatTimeoutMs?: number;
110
+ /**
111
+ * How long before `maxSessionSeconds` to rotate at a turn boundary.
112
+ * Defaults to 120 seconds.
113
+ */
114
+ rotationMarginMs?: number;
115
+ /**
116
+ * Client-side age threshold for turn-boundary physical epoch rotation.
117
+ * Defaults to 10 minutes. An active turn may delay the switch; set to `0`
118
+ * to rely only on the server-advertised lifetime.
119
+ */
120
+ maxPhysicalSessionMs?: number;
121
+ /** Maximum attempts for one unexpected idle reconnect episode. Defaults to 3. */
122
+ maxReconnectAttempts?: number;
123
+ /** Initial unexpected reconnect delay in milliseconds. Defaults to 250. */
124
+ reconnectBaseDelayMs?: number;
125
+ }
67
126
  export interface RealtimeTextToSpeechSessionReadyEvent {
68
127
  type: "session.ready";
69
128
  sessionId: string;
129
+ /** Absolute session expiry when provided by current servers. */
130
+ expiresAt?: string;
70
131
  audioFormat: RealtimeTextToSpeechAudioFormat;
71
132
  maxAppendBytes: number;
72
133
  maxTurnCharacters: number;
73
134
  inactivityTimeoutSeconds: number;
74
135
  maxSessionSeconds: number;
75
136
  }
137
+ export interface RealtimeTextToSpeechSessionExpiringEvent {
138
+ type: "session.expiring";
139
+ sessionId: string;
140
+ expiresInSeconds: number;
141
+ maxSessionSeconds: number;
142
+ expiresAt: string;
143
+ }
76
144
  export interface RealtimeTextToSpeechPongEvent {
77
145
  type: "pong";
78
146
  }
@@ -141,7 +209,7 @@ export interface RealtimeTextToSpeechErrorEvent {
141
209
  * (with camelCase keys). Do not rely on an exhaustive `switch` over `type`;
142
210
  * ignore event types you do not recognize.
143
211
  */
144
- export type RealtimeTextToSpeechEvent = RealtimeTextToSpeechSessionReadyEvent | RealtimeTextToSpeechPongEvent | RealtimeTextToSpeechTurnStartedEvent | RealtimeTextToSpeechAudioStartedEvent | RealtimeTextToSpeechTurnDoneEvent | RealtimeTextToSpeechTurnCancelledEvent | RealtimeTextToSpeechUsageCommittedEvent | RealtimeTextToSpeechSessionClosedEvent | RealtimeTextToSpeechErrorEvent;
212
+ export type RealtimeTextToSpeechEvent = RealtimeTextToSpeechSessionReadyEvent | RealtimeTextToSpeechSessionExpiringEvent | RealtimeTextToSpeechPongEvent | RealtimeTextToSpeechTurnStartedEvent | RealtimeTextToSpeechAudioStartedEvent | RealtimeTextToSpeechTurnDoneEvent | RealtimeTextToSpeechTurnCancelledEvent | RealtimeTextToSpeechUsageCommittedEvent | RealtimeTextToSpeechSessionClosedEvent | RealtimeTextToSpeechErrorEvent;
145
213
  export interface RealtimeTextToSpeechAudioMessage {
146
214
  type: "audio";
147
215
  audio: Uint8Array;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "0.5.1";
1
+ export declare const SDK_VERSION = "0.6.1";
2
2
  export declare const SDK_NAME = "@breeze.blue/sdk";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const SDK_VERSION = "0.5.1";
1
+ export const SDK_VERSION = "0.6.1";
2
2
  export const SDK_NAME = "@breeze.blue/sdk";
package/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@breeze.blue/sdk",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
4
  "description": "ESM-first TypeScript SDK for the Breeze Blue Developer API.",
5
5
  "license": "MIT",
6
6
  "author": "Breeze Blue <support@breeze.blue>",
7
7
  "homepage": "https://breezeblue.ai",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/breezebluestudio/BreezeBlueStudio.git",
11
+ "directory": "packages/breeze-typescript"
12
+ },
8
13
  "keywords": [
9
14
  "audio",
10
15
  "breeze",