@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.d.cts CHANGED
@@ -179,6 +179,8 @@ declare class Transport {
179
179
  raw(method: HttpMethod, path: string, opts?: RequestOptions): Promise<Response>;
180
180
  /** Perform the request and return the raw text body (CSV, YAML, …). */
181
181
  text(method: HttpMethod, path: string, opts?: RequestOptions): Promise<string>;
182
+ /** Perform the request and return the raw binary body (audio, …). */
183
+ bytes(method: HttpMethod, path: string, opts?: RequestOptions): Promise<ArrayBuffer>;
182
184
  /** Open a streaming response. Throws if the initial response is an error. */
183
185
  stream(method: HttpMethod, path: string, opts?: RequestOptions): Promise<Response>;
184
186
  private maybeUnwrap;
@@ -447,6 +449,13 @@ interface ImageGenerateParams {
447
449
  size?: string;
448
450
  aspectRatio?: string;
449
451
  quality?: "standard" | "hd" | "ultra";
452
+ /**
453
+ * Reference/input images for image-to-image and subject/style consistency.
454
+ * Each entry is an http(s) URL, a `data:` URI, or a bare base64 string. When
455
+ * present, the provider routes to its image-edit path. Per-provider max:
456
+ * openai 16, gemini 14, vertex 4, xai 3. Not supported by ollama.
457
+ */
458
+ referenceImages?: string[];
450
459
  tag?: string;
451
460
  service?: string;
452
461
  }
@@ -665,6 +674,12 @@ declare class SessionsAPI extends BaseResource {
665
674
  templateId?: number;
666
675
  }, signal?: AbortSignal): Promise<ConversationSessionRecord[]>;
667
676
  get(id: number, signal?: AbortSignal): Promise<ConversationSessionRecord>;
677
+ /**
678
+ * Fetch the session recording as raw audio bytes. Single use: the recording
679
+ * is deleted from ElevenLabs on retrieval, so a second call rejects with 404.
680
+ * Unfetched recordings are purged after 30 days.
681
+ */
682
+ getAudio(id: number, signal?: AbortSignal): Promise<ArrayBuffer>;
668
683
  }
669
684
  declare class ConversationsResource extends BaseResource {
670
685
  readonly templates: TemplatesAPI;
package/dist/index.d.ts CHANGED
@@ -179,6 +179,8 @@ declare class Transport {
179
179
  raw(method: HttpMethod, path: string, opts?: RequestOptions): Promise<Response>;
180
180
  /** Perform the request and return the raw text body (CSV, YAML, …). */
181
181
  text(method: HttpMethod, path: string, opts?: RequestOptions): Promise<string>;
182
+ /** Perform the request and return the raw binary body (audio, …). */
183
+ bytes(method: HttpMethod, path: string, opts?: RequestOptions): Promise<ArrayBuffer>;
182
184
  /** Open a streaming response. Throws if the initial response is an error. */
183
185
  stream(method: HttpMethod, path: string, opts?: RequestOptions): Promise<Response>;
184
186
  private maybeUnwrap;
@@ -447,6 +449,13 @@ interface ImageGenerateParams {
447
449
  size?: string;
448
450
  aspectRatio?: string;
449
451
  quality?: "standard" | "hd" | "ultra";
452
+ /**
453
+ * Reference/input images for image-to-image and subject/style consistency.
454
+ * Each entry is an http(s) URL, a `data:` URI, or a bare base64 string. When
455
+ * present, the provider routes to its image-edit path. Per-provider max:
456
+ * openai 16, gemini 14, vertex 4, xai 3. Not supported by ollama.
457
+ */
458
+ referenceImages?: string[];
450
459
  tag?: string;
451
460
  service?: string;
452
461
  }
@@ -665,6 +674,12 @@ declare class SessionsAPI extends BaseResource {
665
674
  templateId?: number;
666
675
  }, signal?: AbortSignal): Promise<ConversationSessionRecord[]>;
667
676
  get(id: number, signal?: AbortSignal): Promise<ConversationSessionRecord>;
677
+ /**
678
+ * Fetch the session recording as raw audio bytes. Single use: the recording
679
+ * is deleted from ElevenLabs on retrieval, so a second call rejects with 404.
680
+ * Unfetched recordings are purged after 30 days.
681
+ */
682
+ getAudio(id: number, signal?: AbortSignal): Promise<ArrayBuffer>;
668
683
  }
669
684
  declare class ConversationsResource extends BaseResource {
670
685
  readonly templates: TemplatesAPI;
package/dist/index.js CHANGED
@@ -317,6 +317,12 @@ var Transport = class {
317
317
  if (!res.ok) throw await toAPIError(res);
318
318
  return res.text();
319
319
  }
320
+ /** Perform the request and return the raw binary body (audio, …). */
321
+ async bytes(method, path, opts = {}) {
322
+ const res = await this.send(method, path, opts);
323
+ if (!res.ok) throw await toAPIError(res);
324
+ return res.arrayBuffer();
325
+ }
320
326
  /** Open a streaming response. Throws if the initial response is an error. */
321
327
  async stream(method, path, opts = {}) {
322
328
  const res = await this.send(method, path, {
@@ -1193,6 +1199,18 @@ var SessionsAPI = class extends BaseResource {
1193
1199
  const data = await this.transport.json("GET", `/api/convagents/sessions/${id}`, { signal });
1194
1200
  return data.session;
1195
1201
  }
1202
+ /**
1203
+ * Fetch the session recording as raw audio bytes. Single use: the recording
1204
+ * is deleted from ElevenLabs on retrieval, so a second call rejects with 404.
1205
+ * Unfetched recordings are purged after 30 days.
1206
+ */
1207
+ getAudio(id, signal) {
1208
+ return this.transport.bytes(
1209
+ "GET",
1210
+ `/api/convagents/sessions/${id}/audio`,
1211
+ { signal }
1212
+ );
1213
+ }
1196
1214
  };
1197
1215
  var ConversationsResource = class extends BaseResource {
1198
1216
  templates = new TemplatesAPI(this.transport, this.defaultPoll);