dsh-realtime 0.1.0 → 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gDAAgD;AAChD,eAAO,MAAM,oBAAoB;IAC/B,iEAAiE;;IAEjE,yEAAyE;;IAEzE,yEAAyE;;IAEzE,wDAAwD;;IAExD,mEAAmE;;IAEnE,2CAA2C;;IAE3C,iGAAiG;;IAEjG,iGAAiG;;IAEjG,2DAA2D;;EAE3D,CAAA;AAEF,2CAA2C;AAC3C,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAA;AAEhG;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAEhC;;;;OAIG;IACH,YAAY,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,YAAY,EAU3E;CACF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gDAAgD;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,iEAAiE;IACjE,gBAAgB,EAAE,kBAAkB;IACpC,yEAAyE;IACzE,kBAAkB,EAAE,oBAAoB;IACxC,yEAAyE;IACzE,qBAAqB,EAAE,uBAAuB;IAC9C,wDAAwD;IACxD,UAAU,EAAE,YAAY;IACxB,mEAAmE;IACnE,cAAc,EAAE,gBAAgB;IAChC,2CAA2C;IAC3C,cAAc,EAAE,gBAAgB;IAChC,iGAAiG;IACjG,kBAAkB,EAAE,oBAAoB;IACxC,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CAAA;IAExC;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IAElC,gFAAgF;IAChF,SAAS,IAAI,IAAI,CAAA;IAEjB,6DAA6D;IAC7D,WAAW,IAAI,IAAI,CAAA;IAEnB;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEvE;;;;OAIG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAErE;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzE;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,OAAO,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsLH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-realtime",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Realtime voice capability seam for DeepSeek Harness: a provider registry plus the session adapter base.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -18,15 +18,12 @@
18
18
  "types": "./lib/error.d.ts",
19
19
  "default": "./lib/error.js"
20
20
  },
21
+ "./src/*": "./src/*",
21
22
  "./package.json": "./package.json"
22
23
  },
23
24
  "files": [
24
- "lib/index.js",
25
- "lib/index.d.ts",
26
- "lib/types.js",
27
- "lib/types.d.ts",
28
- "lib/error.js",
29
- "lib/error.d.ts"
25
+ "lib",
26
+ "src"
30
27
  ],
31
28
  "license": "MIT",
32
29
  "keywords": [
package/src/error.ts ADDED
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Typed failures for the realtime seam, carrying stable machine codes.
3
+ *
4
+ * Codes are the seam's API: a consumer branches on `code`, never on message text. Adding a code is a
5
+ * minor release; changing what an existing code means is a breaking one.
6
+ *
7
+ * @module dsh-realtime/error
8
+ */
9
+
10
+ /** Stable machine codes raised by this seam. */
11
+ export const REALTIME_ERROR_CODES = Object.freeze({
12
+ /** A registration named an empty or malformed provider route. */
13
+ INVALID_PROVIDER: 'INVALID_PROVIDER',
14
+ /** A route already has an adapter registered by another registration. */
15
+ DUPLICATE_PROVIDER: 'DUPLICATE_PROVIDER',
16
+ /** Registration was released, so it can no longer replace its routes. */
17
+ REGISTRATION_DISPOSED: 'REGISTRATION_DISPOSED',
18
+ /** No adapter is registered for the requested route. */
19
+ NO_ADAPTER: 'NO_ADAPTER',
20
+ /** An append was empty, not a string, or over the seam's bound. */
21
+ INVALID_APPEND: 'INVALID_APPEND',
22
+ /** The session has already been closed. */
23
+ SESSION_CLOSED: 'SESSION_CLOSED',
24
+ /** The credential an adapter needs is absent or unusable. Names the setting, never the value. */
25
+ MISSING_CREDENTIAL: 'MISSING_CREDENTIAL',
26
+ /** The provider reported a failure, or an operation it was expected to acknowledge never was. */
27
+ PROVIDER_ERROR: 'PROVIDER_ERROR',
28
+ /** A recorded session could not be read as a recording. */
29
+ INVALID_RECORDING: 'INVALID_RECORDING',
30
+ })
31
+
32
+ /** One of {@link REALTIME_ERROR_CODES}. */
33
+ export type RealtimeErrorCode = (typeof REALTIME_ERROR_CODES)[keyof typeof REALTIME_ERROR_CODES]
34
+
35
+ /**
36
+ * A typed seam failure.
37
+ *
38
+ * The constructor validates its own arguments rather than trusting callers: a failure raised while
39
+ * reporting a failure is the worst place to discover a malformed argument.
40
+ */
41
+ export class RealtimeError extends Error {
42
+ /** Stable machine code. Branch on this, never on `message`. */
43
+ readonly code: RealtimeErrorCode
44
+
45
+ /**
46
+ * @param message - non-empty human-readable summary. Must not contain secret material.
47
+ * @param code - one of {@link REALTIME_ERROR_CODES}.
48
+ * @param options - optional `cause`.
49
+ */
50
+ constructor(message: string, code: RealtimeErrorCode, options?: ErrorOptions) {
51
+ if (typeof message !== 'string' || message.length === 0) {
52
+ throw new TypeError('RealtimeError message must be a non-empty string')
53
+ }
54
+ if (typeof code !== 'string' || code.length === 0) {
55
+ throw new TypeError('RealtimeError code must be a non-empty string')
56
+ }
57
+ super(message, options)
58
+ this.name = 'RealtimeError'
59
+ this.code = code
60
+ }
61
+ }
package/src/index.ts ADDED
@@ -0,0 +1,320 @@
1
+ /**
2
+ * Realtime voice seam: a provider registry plus the adapter base every voice backend extends.
3
+ *
4
+ * Exports the `RealtimeRuntime` service as the **default** export (a DeepSeek Harness convention for
5
+ * service packages) and the abstract `RealtimeAdapter` for provider backends. Function plugins
6
+ * must supply `name` / `inject` / `Config` / `apply` and no default export; this package is a
7
+ * service package, so it is mounted as a class plugin and default-exports its service.
8
+ *
9
+ * @module dsh-realtime
10
+ */
11
+
12
+ import { Service, type Context } from '@deepseek-ai/cordis'
13
+ import { REALTIME_ERROR_CODES, RealtimeError } from './error.ts'
14
+ import type {
15
+ RealtimeDelegation,
16
+ RealtimeModelInfo,
17
+ RealtimeProviderInfo,
18
+ RealtimeSession,
19
+ RealtimeSessionHandlers,
20
+ RealtimeSessionOptions,
21
+ } from './types.ts'
22
+
23
+ export * from './types.ts'
24
+ export * from './error.ts'
25
+ export { RealtimeError, REALTIME_ERROR_CODES } from './error.ts'
26
+
27
+ declare module '@deepseek-ai/cordis' {
28
+ interface Context {
29
+ realtime: RealtimeRuntime
30
+ }
31
+ }
32
+
33
+ /**
34
+ * What {@link RealtimeRuntime.registerAdapter} returns: the disposer, plus an atomic route
35
+ * replacement for the same adapter instance.
36
+ */
37
+ export interface AdapterRegistrationHandle {
38
+ /** Release every route this registration currently holds. */
39
+ (): void
40
+ /**
41
+ * Replace this registration's routes, keeping the same adapter instance. The candidate set is
42
+ * validated in full first — a conflict with another registration or a malformed route throws and
43
+ * leaves the current routes untouched — and the swap is one synchronous section, so no observer
44
+ * can see the registry between release and re-registration.
45
+ *
46
+ * An empty array is legal here (a plugin whose configuration emptied holds zero routes while
47
+ * staying registered), unlike an empty initial registration.
48
+ *
49
+ * Throws `REGISTRATION_DISPOSED` once the registration was released: its routes are gone and its
50
+ * disposer has already run, so anything registered afterwards would have no owner left to release it.
51
+ * @param providers - the complete next route set for this registration.
52
+ */
53
+ replace(providers: string[]): void
54
+ }
55
+
56
+ /**
57
+ * Provider-wire adapter for the realtime session vocabulary.
58
+ *
59
+ * Register implementations with `ctx.realtime.registerAdapter(providers, adapter)`. The single
60
+ * required method is {@link session}; every other method exists so a provider can describe itself
61
+ * without the seam having to special-case it.
62
+ */
63
+ export abstract class RealtimeAdapter {
64
+ /**
65
+ * Describe one provider route owned by this adapter.
66
+ * @param provider - a route passed to `registerAdapter()` for this instance.
67
+ * @returns detached display metadata whose `id` must equal `provider`.
68
+ */
69
+ providerInfo(provider: string): RealtimeProviderInfo {
70
+ return { id: provider, name: provider }
71
+ }
72
+
73
+ /**
74
+ * List the voice models this adapter can currently advertise for one owned route.
75
+ *
76
+ * The result is advisory: an adapter may accept unlisted model ids, and consumers must not turn
77
+ * absence into request rejection.
78
+ * @param _provider - one provider route owned by this adapter.
79
+ * @returns discoverable models in adapter-preferred order.
80
+ */
81
+ listModels(_provider: string): Promise<readonly RealtimeModelInfo[]> {
82
+ return Promise.resolve([])
83
+ }
84
+
85
+ /**
86
+ * Open one voice session. The only required method.
87
+ *
88
+ * Implementations must honor `options.signal` during establishment, and must throw (rather than
89
+ * resolve with a dead session) when the session cannot open.
90
+ * @param options - the fully-resolved request; `options.provider` selects the registered route.
91
+ * @returns the live session, with `options.handlers` already wired.
92
+ */
93
+ abstract session(options: RealtimeSessionOptions): Promise<RealtimeSession>
94
+ }
95
+
96
+ /** One resolved route registration. */
97
+ interface AdapterRegistration {
98
+ readonly adapter: RealtimeAdapter
99
+ readonly provider: RealtimeProviderInfo
100
+ }
101
+
102
+ /**
103
+ * The `realtime` service: an adapter registry over the session vocabulary.
104
+ *
105
+ * Registration is effect-based, so HMR or a disposal unmounts routes with the contributing fiber —
106
+ * there is no separate teardown path that can be forgotten.
107
+ */
108
+ export class RealtimeRuntime extends Service {
109
+ private readonly adapters = new Map<string, AdapterRegistration>()
110
+
111
+ /**
112
+ * @param ctx - the Cordis context this service is mounted on.
113
+ */
114
+ constructor(ctx: Context) {
115
+ super(ctx, 'realtime')
116
+ }
117
+
118
+ /**
119
+ * Register an adapter for the given provider routes, all-or-nothing.
120
+ *
121
+ * Disposed with the fiber. Throws `INVALID_PROVIDER` for a malformed route, `DUPLICATE_PROVIDER`
122
+ * if any route is already held by another registration.
123
+ * @param providers - every provider route this adapter should serve.
124
+ * @param adapter - the adapter that opens sessions for those routes.
125
+ * @returns the disposer, carrying {@link AdapterRegistrationHandle.replace}.
126
+ */
127
+ registerAdapter(providers: string[], adapter: RealtimeAdapter): AdapterRegistrationHandle {
128
+ if (providers.length === 0) {
129
+ throw new RealtimeError('an adapter must register at least one provider', REALTIME_ERROR_CODES.INVALID_PROVIDER)
130
+ }
131
+ // Routes this registration currently holds; `replace` rewrites it, and the disposer releases
132
+ // whatever it holds at disposal time.
133
+ const owned = new Set<string>()
134
+ // `owned` being empty cannot report disposal on its own, because `replace([])` legally leaves a
135
+ // live registration holding none.
136
+ let released = false
137
+
138
+ const dispose = this.ctx.effect(function* (this: RealtimeRuntime) {
139
+ this.commit(owned, this.prepare(providers, adapter, owned))
140
+ yield () => {
141
+ released = true
142
+ for (const provider of owned) this.adapters.delete(provider)
143
+ owned.clear()
144
+ }
145
+ }.bind(this), 'realtime.registerAdapter()')
146
+
147
+ const handle = (() => void dispose()) as AdapterRegistrationHandle
148
+ handle.replace = (next: string[]): void => {
149
+ // Registering here would leak: the effect's disposer already ran, so nothing remains to
150
+ // release whatever this call would put in the map.
151
+ if (released) {
152
+ throw new RealtimeError(
153
+ 'a disposed adapter registration cannot replace its routes',
154
+ REALTIME_ERROR_CODES.REGISTRATION_DISPOSED,
155
+ )
156
+ }
157
+ this.commit(owned, this.prepare(next, adapter, owned))
158
+ }
159
+ return handle
160
+ }
161
+
162
+ /**
163
+ * Validate one candidate route set for `adapter`, treating routes this registration already holds
164
+ * as available.
165
+ *
166
+ * Nothing is mutated: a rejected candidate leaves the registry exactly as it was, which is what
167
+ * makes {@link AdapterRegistrationHandle.replace} a swap rather than a delete-then-add that can
168
+ * strand the registry empty.
169
+ * @param providers - candidate routes.
170
+ * @param adapter - the adapter that would own them.
171
+ * @param owned - routes this same registration already holds.
172
+ * @returns registrations ready to commit.
173
+ */
174
+ private prepare(providers: string[], adapter: RealtimeAdapter, owned: ReadonlySet<string>): AdapterRegistration[] {
175
+ const unique = new Set<string>()
176
+ const registrations: AdapterRegistration[] = []
177
+ for (const provider of providers) {
178
+ if (typeof provider !== 'string' || provider.length === 0) {
179
+ throw new RealtimeError('adapter provider names must be non-empty strings', REALTIME_ERROR_CODES.INVALID_PROVIDER)
180
+ }
181
+ if (unique.has(provider) || (this.adapters.has(provider) && !owned.has(provider))) {
182
+ throw new RealtimeError(
183
+ `an adapter for provider "${provider}" is already registered`,
184
+ REALTIME_ERROR_CODES.DUPLICATE_PROVIDER,
185
+ )
186
+ }
187
+ const info = adapter.providerInfo(provider)
188
+ if (typeof info.id !== 'string' || info.id !== provider
189
+ || typeof info.name !== 'string' || info.name.length === 0) {
190
+ throw new RealtimeError(
191
+ `adapter metadata for provider "${provider}" must preserve its id and have a non-empty name`,
192
+ REALTIME_ERROR_CODES.INVALID_PROVIDER,
193
+ )
194
+ }
195
+ unique.add(provider)
196
+ registrations.push({
197
+ adapter,
198
+ provider: info.description === undefined
199
+ ? { id: info.id, name: info.name }
200
+ : { id: info.id, name: info.name, description: info.description },
201
+ })
202
+ }
203
+ return registrations
204
+ }
205
+
206
+ /**
207
+ * Swap this registration's routes for the prepared ones in one synchronous section, so no
208
+ * observer can see the registry between the release and the re-registration.
209
+ * @param owned - mutable set tracking which routes this registration holds.
210
+ * @param registrations - validated registrations to install.
211
+ */
212
+ private commit(owned: Set<string>, registrations: readonly AdapterRegistration[]): void {
213
+ for (const provider of owned) this.adapters.delete(provider)
214
+ owned.clear()
215
+ for (const registration of registrations) {
216
+ this.adapters.set(registration.provider.id, registration)
217
+ owned.add(registration.provider.id)
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Describe the provider routes that currently have an adapter.
223
+ * @returns detached provider metadata in registration order.
224
+ */
225
+ listProviders(): RealtimeProviderInfo[] {
226
+ return [...this.adapters.values()].map(({ provider }) => ({ ...provider }))
227
+ }
228
+
229
+ /**
230
+ * Resolve the adapter owning one route.
231
+ * @param provider - registered route to look up.
232
+ * @returns that route's registration.
233
+ * @throws RealtimeError `NO_ADAPTER` when the route is unregistered.
234
+ */
235
+ private registration(provider: string): AdapterRegistration {
236
+ const registration = this.adapters.get(provider)
237
+ if (registration === undefined) {
238
+ throw new RealtimeError(`no realtime adapter registered for provider "${provider}"`, REALTIME_ERROR_CODES.NO_ADAPTER)
239
+ }
240
+ return registration
241
+ }
242
+
243
+ /**
244
+ * Discover the voice models one registered route advertises.
245
+ * @param provider - registered route to inspect.
246
+ * @returns detached model metadata in adapter-preferred order, duplicates removed.
247
+ */
248
+ async listModels(provider: string): Promise<RealtimeModelInfo[]> {
249
+ const models = await this.registration(provider).adapter.listModels(provider)
250
+ const seen = new Set<string>()
251
+ const detached: RealtimeModelInfo[] = []
252
+ for (const model of models) {
253
+ if (typeof model.id !== 'string' || model.id.length === 0 || seen.has(model.id)) continue
254
+ seen.add(model.id)
255
+ detached.push({
256
+ id: model.id,
257
+ name: typeof model.name === 'string' && model.name.length > 0 ? model.name : model.id,
258
+ ...model.inputModalities === undefined ? {} : { inputModalities: [...model.inputModalities] },
259
+ ...model.outputModalities === undefined ? {} : { outputModalities: [...model.outputModalities] },
260
+ })
261
+ }
262
+ return detached
263
+ }
264
+
265
+ /**
266
+ * Open one voice session through the adapter registered for its route.
267
+ *
268
+ * A field this seam cannot honor is rejected here rather than forwarded as a no-op — the caller
269
+ * learns the request is unsupported before a live conversation depends on it.
270
+ * @param options - the session request; `options.provider` selects the adapter.
271
+ * @returns the adapter's live session.
272
+ * @throws RealtimeError `NO_ADAPTER` for an unregistered route.
273
+ */
274
+ async session(options: RealtimeSessionOptions): Promise<RealtimeSession> {
275
+ if (typeof options.provider !== 'string' || options.provider.length === 0) {
276
+ throw new RealtimeError('a session needs a non-empty provider route', REALTIME_ERROR_CODES.INVALID_PROVIDER)
277
+ }
278
+ if (typeof options.model !== 'string' || options.model.length === 0) {
279
+ throw new RealtimeError('a session needs a non-empty model id', REALTIME_ERROR_CODES.INVALID_PROVIDER)
280
+ }
281
+ if (options.instructions !== undefined && options.instructions.length === 0) {
282
+ throw new RealtimeError('session instructions must be non-empty when supplied', REALTIME_ERROR_CODES.INVALID_APPEND)
283
+ }
284
+ if (options.signal?.aborted) {
285
+ throw new RealtimeError('session establishment was aborted before it started', REALTIME_ERROR_CODES.SESSION_CLOSED, {
286
+ cause: options.signal.reason,
287
+ })
288
+ }
289
+ return await this.registration(options.provider).adapter.session(options)
290
+ }
291
+
292
+ /**
293
+ * Validate one context append against the seam's bounds.
294
+ *
295
+ * Exposed so an adapter can enforce the same bound the seam promises, instead of each backend
296
+ * re-deriving it. Bound enforcement lives at the operation that makes the decision: a caller that
297
+ * bypasses this cannot silently send an over-long append.
298
+ * @param content - candidate append text.
299
+ * @param maxChars - character ceiling; defaults to the provider's documented bound.
300
+ * @returns the content unchanged, for convenient inline use.
301
+ * @throws RealtimeError `INVALID_APPEND` for a non-string, empty, or over-long value.
302
+ */
303
+ static assertAppendable(content: string, maxChars: number): string {
304
+ if (typeof content !== 'string' || content.length === 0) {
305
+ throw new RealtimeError('an append needs non-empty content', REALTIME_ERROR_CODES.INVALID_APPEND)
306
+ }
307
+ if (content.length > maxChars) {
308
+ throw new RealtimeError(
309
+ `an append of ${content.length} characters exceeds the ${maxChars}-character seam bound`,
310
+ REALTIME_ERROR_CODES.INVALID_APPEND,
311
+ )
312
+ }
313
+ return content
314
+ }
315
+ }
316
+
317
+ /** Re-exported so adapters can type their handler wiring without a second import. */
318
+ export type { RealtimeDelegation, RealtimeSessionHandlers }
319
+
320
+ export default RealtimeRuntime
package/src/types.ts ADDED
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Types for the realtime voice seam. This module contains **no runtime code** — a
3
+ * DeepSeek Harness convention that keeps type-only imports erasable.
4
+ *
5
+ * @module dsh-realtime/types
6
+ */
7
+
8
+ /** A model route a realtime adapter can serve. */
9
+ export interface RealtimeProviderInfo {
10
+ /** Route id a caller passes as `RealtimeSessionOptions.provider`. Must equal the registered route. */
11
+ id: string
12
+ /** Human-readable label for diagnostics and surfaces. */
13
+ name: string
14
+ /** Optional one-line description of what this route speaks. */
15
+ description?: string
16
+ }
17
+
18
+ /** One voice model advertised by an adapter. Catalog membership is advisory: it never gates a session. */
19
+ export interface RealtimeModelInfo {
20
+ /** Exact model id passed as `RealtimeSessionOptions.model`. */
21
+ id: string
22
+ /** Human-readable label. */
23
+ name: string
24
+ /** What the model can take in, e.g. `audio`, `text`, `image`. */
25
+ inputModalities?: readonly RealtimeModality[]
26
+ /** What the model puts out, e.g. `audio`, `text`. */
27
+ outputModalities?: readonly RealtimeModality[]
28
+ }
29
+
30
+ /** A modality a realtime model accepts or emits. */
31
+ export type RealtimeModality = 'audio' | 'text' | 'image'
32
+
33
+ /** Raw audio encoding expected on the wire. */
34
+ export interface RealtimeAudioFormat {
35
+ /** Sample rate in Hz. `24000` for GPT-Live-1. */
36
+ sampleRate: number
37
+ /** Channel count. `1` (mono) for GPT-Live-1. */
38
+ channels: number
39
+ /** Sample encoding. `pcm16` is signed little-endian 16-bit. */
40
+ encoding: 'pcm16'
41
+ }
42
+
43
+ /** What a caller asks an adapter to open. */
44
+ export interface RealtimeSessionOptions {
45
+ /** Registered route to use. Selects the adapter. */
46
+ provider: string
47
+ /** Exact model id. */
48
+ model: string
49
+ /**
50
+ * Opening system instructions.
51
+ *
52
+ * Advisory at the seam: the protocol may treat these as immutable once a session starts, in which
53
+ * case an adapter must surface a coded error rather than silently dropping the request. Extending
54
+ * live instructions is `RealtimeSession.appendInstructions`, not a new session.
55
+ */
56
+ instructions?: string
57
+ /** Output voice id. Provider-specific; `undefined` leaves the provider default. */
58
+ voice?: string
59
+ /** Cancellation for session establishment. Implementations must settle promptly after it aborts. */
60
+ signal?: AbortSignal
61
+ /** Handler callbacks for the life of the session. */
62
+ handlers?: RealtimeSessionHandlers
63
+ }
64
+
65
+ /** A delegated unit of work handed to the application by the voice model. */
66
+ export interface RealtimeDelegation {
67
+ /** Opaque correlation id. Preserve it unchanged on every update about this delegation. */
68
+ id: string
69
+ /** Who is expected to do the work. `client` means this application. */
70
+ target: 'client' | 'responses'
71
+ /**
72
+ * Position on the session timeline, in milliseconds.
73
+ *
74
+ * Note there is deliberately **no task text** here: the protocol sends metadata only, so a
75
+ * consumer reconstructs intent from transcripts plus its own application state.
76
+ */
77
+ offsetMs: number
78
+ }
79
+
80
+ /** A transcript fragment from either side of the conversation. */
81
+ export interface RealtimeTranscript {
82
+ /** Which side spoke. */
83
+ kind: 'input' | 'output'
84
+ /** The fragment text. Deltas concatenate in arrival order. */
85
+ text: string
86
+ /** Whether this fragment closes the utterance. */
87
+ final: boolean
88
+ }
89
+
90
+ /** Cumulative session usage. The protocol reports this in audio-seconds, not tokens. */
91
+ export interface RealtimeUsage {
92
+ /** Cumulative audio seconds billed for this session. */
93
+ seconds: number
94
+ }
95
+
96
+ /** Callbacks an adapter invokes for session lifetime events. */
97
+ export interface RealtimeSessionHandlers {
98
+ /** The session is established and can accept audio. */
99
+ onReady?(info: RealtimeSessionStarted): void
100
+ /** A transcript fragment arrived. */
101
+ onTranscript?(transcript: RealtimeTranscript): void
102
+ /** The model delegated work to this application. */
103
+ onDelegation?(delegation: RealtimeDelegation): void
104
+ /** Cumulative usage was updated. */
105
+ onUsage?(usage: RealtimeUsage): void
106
+ /** Raw output audio, already decoded from the wire encoding. */
107
+ onAudio?(pcm16: Uint8Array): void
108
+ /** The session ended. `reason` is provider-supplied when available. */
109
+ onClosed?(reason?: string): void
110
+ /**
111
+ * A session-scoped failure the adapter contained rather than throwing.
112
+ *
113
+ * Adapters report here for failures that occur *after* the session opened; failures that prevent
114
+ * the session opening are thrown from `session()`.
115
+ */
116
+ onError?(error: Error): void
117
+ }
118
+
119
+ /** Facts about an established session. */
120
+ export interface RealtimeSessionStarted {
121
+ /** The route that opened it. */
122
+ provider: string
123
+ /** The model the provider accepted — which may differ from the requested id if the provider aliases. */
124
+ model: string
125
+ /** The output voice the provider accepted. */
126
+ voice?: string
127
+ /** Audio encoding the session expects for input. */
128
+ inputAudio: RealtimeAudioFormat
129
+ /** Audio encoding the session emits. */
130
+ outputAudio: RealtimeAudioFormat
131
+ }
132
+
133
+ /**
134
+ * A live voice session.
135
+ *
136
+ * Implementations own the transport. Callers own the conversation: they push audio in, receive
137
+ * callbacks, and answer delegations through the append methods.
138
+ */
139
+ export interface RealtimeSession {
140
+ /** Provider-assigned session identifier, for correlation in logs. */
141
+ readonly id: string
142
+ /** Facts the provider accepted at startup. */
143
+ readonly started: RealtimeSessionStarted
144
+
145
+ /**
146
+ * Append one frame of microphone audio.
147
+ *
148
+ * There is deliberately **no end-of-utterance call**: endpointing belongs to the provider, and a
149
+ * client-side detector would be a second, competing turn boundary. Frames are the only input.
150
+ * @param pcm16 - raw samples in the session's `inputAudio` format.
151
+ */
152
+ sendAudio(pcm16: Uint8Array): void
153
+
154
+ /** Stop the provider consuming microphone audio, without ending the session. */
155
+ muteInput(): void
156
+
157
+ /** Resume microphone consumption after {@link muteInput}. */
158
+ unmuteInput(): void
159
+
160
+ /**
161
+ * Return a delegated result for the model to **speak aloud**.
162
+ * @param content - plain text, non-empty and within {@link MAX_APPEND_CHARS}.
163
+ * @param delegationId - the delegation this answers, or `undefined` for session-wide context.
164
+ */
165
+ appendCommentary(content: string, delegationId?: string): Promise<void>
166
+
167
+ /**
168
+ * Add context the model may use **without speaking it** — progress, facts, intermediate state.
169
+ * @param content - plain text, non-empty and within {@link MAX_APPEND_CHARS}.
170
+ * @param delegationId - the delegation this relates to, or `undefined` for session-wide context.
171
+ */
172
+ appendThinking(content: string, delegationId?: string): Promise<void>
173
+
174
+ /**
175
+ * Steer the live conversation's behaviour (tone, brevity, policy) without speaking anything.
176
+ * @param content - plain text, non-empty and within {@link MAX_APPEND_CHARS}.
177
+ * @param delegationId - `undefined` for session-wide steering.
178
+ */
179
+ appendInstructions(content: string, delegationId?: string): Promise<void>
180
+
181
+ /**
182
+ * End the session and release the transport. Idempotent.
183
+ * @returns a promise settling once the transport is released.
184
+ */
185
+ close(): Promise<void>
186
+ }
187
+
188
+ /**
189
+ * Upper bound, in characters, on one context append.
190
+ *
191
+ * The provider's real limit is **500 tokens**, which this seam cannot count without binding to a
192
+ * tokenizer it does not own. The character ceiling is therefore a deliberate conservative proxy:
193
+ * it is enforced here so that an over-long append fails locally with a coded error rather than
194
+ * halfway through a live conversation. Exact token accounting belongs to the adapter.
195
+ */
196
+ export const MAX_APPEND_CHARS = 2000