@canarycoders/ai 0.3.0 → 0.5.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
@@ -57,7 +57,7 @@ interface Citation {
57
57
  startIndex?: number;
58
58
  endIndex?: number;
59
59
  }
60
- /** The standard CanaryLLM success envelope: `{ success: true, data: T }`. */
60
+ /** The standard CanaryCoders AI success envelope: `{ success: true, data: T }`. */
61
61
  interface ApiEnvelope<T> {
62
62
  success: boolean;
63
63
  data: T;
@@ -124,6 +124,12 @@ interface CreateConversationSessionParams {
124
124
  interface ConversationSession {
125
125
  session: ConversationSessionRecord;
126
126
  signedUrl: string;
127
+ /**
128
+ * Pass verbatim into the ElevenLabs client's `Conversation.startSession({ dynamicVariables })`
129
+ * so the post-call webhook correlates this session deterministically. Contains
130
+ * `canary_session_id` (this session's id).
131
+ */
132
+ dynamicVariables: Record<string, string>;
127
133
  /** seconds until the signed URL expires (≈900) */
128
134
  expiresIn: number;
129
135
  textOnly: boolean;
@@ -179,6 +185,8 @@ declare class Transport {
179
185
  raw(method: HttpMethod, path: string, opts?: RequestOptions): Promise<Response>;
180
186
  /** Perform the request and return the raw text body (CSV, YAML, …). */
181
187
  text(method: HttpMethod, path: string, opts?: RequestOptions): Promise<string>;
188
+ /** Perform the request and return the raw binary body (audio, …). */
189
+ bytes(method: HttpMethod, path: string, opts?: RequestOptions): Promise<ArrayBuffer>;
182
190
  /** Open a streaming response. Throws if the initial response is an error. */
183
191
  stream(method: HttpMethod, path: string, opts?: RequestOptions): Promise<Response>;
184
192
  private maybeUnwrap;
@@ -447,6 +455,13 @@ interface ImageGenerateParams {
447
455
  size?: string;
448
456
  aspectRatio?: string;
449
457
  quality?: "standard" | "hd" | "ultra";
458
+ /**
459
+ * Reference/input images for image-to-image and subject/style consistency.
460
+ * Each entry is an http(s) URL, a `data:` URI, or a bare base64 string. When
461
+ * present, the provider routes to its image-edit path. Per-provider max:
462
+ * openai 16, gemini 14, vertex 4, xai 3. Not supported by ollama.
463
+ */
464
+ referenceImages?: string[];
450
465
  tag?: string;
451
466
  service?: string;
452
467
  }
@@ -665,6 +680,12 @@ declare class SessionsAPI extends BaseResource {
665
680
  templateId?: number;
666
681
  }, signal?: AbortSignal): Promise<ConversationSessionRecord[]>;
667
682
  get(id: number, signal?: AbortSignal): Promise<ConversationSessionRecord>;
683
+ /**
684
+ * Fetch the session recording as raw audio bytes. Single use: the recording
685
+ * is deleted from ElevenLabs on retrieval, so a second call rejects with 404.
686
+ * Unfetched recordings are purged after 30 days.
687
+ */
688
+ getAudio(id: number, signal?: AbortSignal): Promise<ArrayBuffer>;
668
689
  }
669
690
  declare class ConversationsResource extends BaseResource {
670
691
  readonly templates: TemplatesAPI;
@@ -956,7 +977,7 @@ declare class VisionResource extends BaseResource {
956
977
  }>;
957
978
  }
958
979
 
959
- interface CanaryLLMOptions {
980
+ interface CanaryCodersAIOptions {
960
981
  /** API key. Defaults to `process.env.CANARY_AI_API_KEY` (legacy `CANARYLLM_API_KEY` still read). */
961
982
  apiKey?: string;
962
983
  /** Base URL. Defaults to `https://api.ai.canarycoders.es`. */
@@ -975,7 +996,7 @@ interface CanaryLLMOptions {
975
996
  /** Default polling behavior for queued operations. */
976
997
  poll?: PollOptions;
977
998
  }
978
- declare class CanaryLLM {
999
+ declare class CanaryCodersAI {
979
1000
  readonly chat: ChatResource;
980
1001
  readonly queue: QueueResource;
981
1002
  readonly images: ImagesResource;
@@ -994,7 +1015,7 @@ declare class CanaryLLM {
994
1015
  private readonly transport;
995
1016
  private readonly baseURL;
996
1017
  private readonly apiKey?;
997
- constructor(options?: CanaryLLMOptions);
1018
+ constructor(options?: CanaryCodersAIOptions);
998
1019
  /** Targets to plug into the official `openai` / `@anthropic-ai/sdk` clients. */
999
1020
  get compat(): {
1000
1021
  openai: () => CompatTarget;
@@ -1066,5 +1087,5 @@ interface StreamAdapterOptions extends SSEOptions {
1066
1087
  }
1067
1088
 
1068
1089
  // @ts-ignore
1069
- export = CanaryLLM;
1070
- export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryLLM, type CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, toBrokeredCredential };
1090
+ export = CanaryCodersAI;
1091
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, toBrokeredCredential };
package/dist/index.d.ts CHANGED
@@ -57,7 +57,7 @@ interface Citation {
57
57
  startIndex?: number;
58
58
  endIndex?: number;
59
59
  }
60
- /** The standard CanaryLLM success envelope: `{ success: true, data: T }`. */
60
+ /** The standard CanaryCoders AI success envelope: `{ success: true, data: T }`. */
61
61
  interface ApiEnvelope<T> {
62
62
  success: boolean;
63
63
  data: T;
@@ -124,6 +124,12 @@ interface CreateConversationSessionParams {
124
124
  interface ConversationSession {
125
125
  session: ConversationSessionRecord;
126
126
  signedUrl: string;
127
+ /**
128
+ * Pass verbatim into the ElevenLabs client's `Conversation.startSession({ dynamicVariables })`
129
+ * so the post-call webhook correlates this session deterministically. Contains
130
+ * `canary_session_id` (this session's id).
131
+ */
132
+ dynamicVariables: Record<string, string>;
127
133
  /** seconds until the signed URL expires (≈900) */
128
134
  expiresIn: number;
129
135
  textOnly: boolean;
@@ -179,6 +185,8 @@ declare class Transport {
179
185
  raw(method: HttpMethod, path: string, opts?: RequestOptions): Promise<Response>;
180
186
  /** Perform the request and return the raw text body (CSV, YAML, …). */
181
187
  text(method: HttpMethod, path: string, opts?: RequestOptions): Promise<string>;
188
+ /** Perform the request and return the raw binary body (audio, …). */
189
+ bytes(method: HttpMethod, path: string, opts?: RequestOptions): Promise<ArrayBuffer>;
182
190
  /** Open a streaming response. Throws if the initial response is an error. */
183
191
  stream(method: HttpMethod, path: string, opts?: RequestOptions): Promise<Response>;
184
192
  private maybeUnwrap;
@@ -447,6 +455,13 @@ interface ImageGenerateParams {
447
455
  size?: string;
448
456
  aspectRatio?: string;
449
457
  quality?: "standard" | "hd" | "ultra";
458
+ /**
459
+ * Reference/input images for image-to-image and subject/style consistency.
460
+ * Each entry is an http(s) URL, a `data:` URI, or a bare base64 string. When
461
+ * present, the provider routes to its image-edit path. Per-provider max:
462
+ * openai 16, gemini 14, vertex 4, xai 3. Not supported by ollama.
463
+ */
464
+ referenceImages?: string[];
450
465
  tag?: string;
451
466
  service?: string;
452
467
  }
@@ -665,6 +680,12 @@ declare class SessionsAPI extends BaseResource {
665
680
  templateId?: number;
666
681
  }, signal?: AbortSignal): Promise<ConversationSessionRecord[]>;
667
682
  get(id: number, signal?: AbortSignal): Promise<ConversationSessionRecord>;
683
+ /**
684
+ * Fetch the session recording as raw audio bytes. Single use: the recording
685
+ * is deleted from ElevenLabs on retrieval, so a second call rejects with 404.
686
+ * Unfetched recordings are purged after 30 days.
687
+ */
688
+ getAudio(id: number, signal?: AbortSignal): Promise<ArrayBuffer>;
668
689
  }
669
690
  declare class ConversationsResource extends BaseResource {
670
691
  readonly templates: TemplatesAPI;
@@ -956,7 +977,7 @@ declare class VisionResource extends BaseResource {
956
977
  }>;
957
978
  }
958
979
 
959
- interface CanaryLLMOptions {
980
+ interface CanaryCodersAIOptions {
960
981
  /** API key. Defaults to `process.env.CANARY_AI_API_KEY` (legacy `CANARYLLM_API_KEY` still read). */
961
982
  apiKey?: string;
962
983
  /** Base URL. Defaults to `https://api.ai.canarycoders.es`. */
@@ -975,7 +996,7 @@ interface CanaryLLMOptions {
975
996
  /** Default polling behavior for queued operations. */
976
997
  poll?: PollOptions;
977
998
  }
978
- declare class CanaryLLM {
999
+ declare class CanaryCodersAI {
979
1000
  readonly chat: ChatResource;
980
1001
  readonly queue: QueueResource;
981
1002
  readonly images: ImagesResource;
@@ -994,7 +1015,7 @@ declare class CanaryLLM {
994
1015
  private readonly transport;
995
1016
  private readonly baseURL;
996
1017
  private readonly apiKey?;
997
- constructor(options?: CanaryLLMOptions);
1018
+ constructor(options?: CanaryCodersAIOptions);
998
1019
  /** Targets to plug into the official `openai` / `@anthropic-ai/sdk` clients. */
999
1020
  get compat(): {
1000
1021
  openai: () => CompatTarget;
@@ -1065,4 +1086,4 @@ interface StreamAdapterOptions extends SSEOptions {
1065
1086
  includeRaw?: boolean;
1066
1087
  }
1067
1088
 
1068
- export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryLLM, type CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, CanaryLLM as default, toBrokeredCredential };
1089
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, CanaryCodersAI as default, toBrokeredCredential };
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);
@@ -1572,7 +1590,7 @@ function readEnv(key) {
1572
1590
  if (typeof process !== "undefined" && process.env) return process.env[key];
1573
1591
  return void 0;
1574
1592
  }
1575
- var CanaryLLM = class {
1593
+ var CanaryCodersAI = class {
1576
1594
  chat;
1577
1595
  queue;
1578
1596
  images;
@@ -1631,8 +1649,8 @@ var CanaryLLM = class {
1631
1649
  };
1632
1650
 
1633
1651
  // src/index.ts
1634
- var src_default = CanaryLLM;
1652
+ var src_default = CanaryCodersAI;
1635
1653
 
1636
- export { APIConnectionError, APIConnectionTimeoutError, APIError, AuthenticationError, BadRequestError, CanaryLLM, ConflictError, InternalServerError, Job, NotFoundError, PermissionError, RateLimitError, UnprocessableEntityError, anthropicTarget, src_default as default, openaiTarget, toBrokeredCredential };
1654
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, AuthenticationError, BadRequestError, CanaryCodersAI, CanaryCodersAI as CanaryLLM, ConflictError, InternalServerError, Job, NotFoundError, PermissionError, RateLimitError, UnprocessableEntityError, anthropicTarget, src_default as default, openaiTarget, toBrokeredCredential };
1637
1655
  //# sourceMappingURL=index.js.map
1638
1656
  //# sourceMappingURL=index.js.map