@canarycoders/ai 0.3.0 → 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/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -321,6 +321,12 @@ var Transport = class {
|
|
|
321
321
|
if (!res.ok) throw await toAPIError(res);
|
|
322
322
|
return res.text();
|
|
323
323
|
}
|
|
324
|
+
/** Perform the request and return the raw binary body (audio, …). */
|
|
325
|
+
async bytes(method, path, opts = {}) {
|
|
326
|
+
const res = await this.send(method, path, opts);
|
|
327
|
+
if (!res.ok) throw await toAPIError(res);
|
|
328
|
+
return res.arrayBuffer();
|
|
329
|
+
}
|
|
324
330
|
/** Open a streaming response. Throws if the initial response is an error. */
|
|
325
331
|
async stream(method, path, opts = {}) {
|
|
326
332
|
const res = await this.send(method, path, {
|
|
@@ -1197,6 +1203,18 @@ var SessionsAPI = class extends BaseResource {
|
|
|
1197
1203
|
const data = await this.transport.json("GET", `/api/convagents/sessions/${id}`, { signal });
|
|
1198
1204
|
return data.session;
|
|
1199
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Fetch the session recording as raw audio bytes. Single use: the recording
|
|
1208
|
+
* is deleted from ElevenLabs on retrieval, so a second call rejects with 404.
|
|
1209
|
+
* Unfetched recordings are purged after 30 days.
|
|
1210
|
+
*/
|
|
1211
|
+
getAudio(id, signal) {
|
|
1212
|
+
return this.transport.bytes(
|
|
1213
|
+
"GET",
|
|
1214
|
+
`/api/convagents/sessions/${id}/audio`,
|
|
1215
|
+
{ signal }
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1200
1218
|
};
|
|
1201
1219
|
var ConversationsResource = class extends BaseResource {
|
|
1202
1220
|
templates = new TemplatesAPI(this.transport, this.defaultPoll);
|