@vellumai/plugin-api 0.10.7-dev.202607101252.74ea83d → 0.10.7-dev.202607101343.e727d4c

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.
Files changed (3) hide show
  1. package/index.d.ts +48 -0
  2. package/index.js +2 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -5518,6 +5518,29 @@ declare type _SyncInvalidationServerMessages = SyncChangedEvent;
5518
5518
  /** Re-sync one persisted message into the conversation's disk view. */
5519
5519
  export declare function syncMessageToDisk(conversationId: string, messageId: string, createdAtMs: number): Promise<void>;
5520
5520
 
5521
+ /**
5522
+ * Synthesize text to audio using the globally configured TTS provider.
5523
+ *
5524
+ * 1. Resolves the active provider and its config via `tts-config-resolver`.
5525
+ * 2. Looks up the provider adapter in the registry.
5526
+ * 3. Delegates to the adapter's `synthesize` method.
5527
+ *
5528
+ * Throws {@link TtsSynthesisError} when the provider is not registered
5529
+ * or synthesis fails.
5530
+ */
5531
+ export declare function synthesizeText(options: SynthesizeTextOptions): Promise<TtsSynthesisResult>;
5532
+
5533
+ export declare interface SynthesizeTextOptions {
5534
+ /** Text to speak. Sanitized internally — callers can pass raw model output. */
5535
+ text: string;
5536
+ /** Product surface requesting synthesis. */
5537
+ useCase: TtsUseCase;
5538
+ /** Optional voice override (provider-specific identifier). */
5539
+ voiceId?: string;
5540
+ /** Optional abort signal. */
5541
+ signal?: AbortSignal;
5542
+ }
5543
+
5521
5544
  declare interface TableCellValue {
5522
5545
  text: string;
5523
5546
  icon?: string;
@@ -6205,6 +6228,31 @@ declare const trustClassSchema: z.ZodEnum<{
6205
6228
  unverified_contact: "unverified_contact";
6206
6229
  }>;
6207
6230
 
6231
+ export declare class TtsSynthesisError extends Error {
6232
+ readonly code: TtsSynthesisErrorCode;
6233
+ constructor(code: TtsSynthesisErrorCode, message: string);
6234
+ }
6235
+
6236
+ declare type TtsSynthesisErrorCode = "TTS_PROVIDER_NOT_CONFIGURED" | "TTS_SYNTHESIS_FAILED";
6237
+
6238
+ /** Output of a completed TTS synthesis call. */
6239
+ export declare interface TtsSynthesisResult {
6240
+ /** Complete audio buffer. */
6241
+ audio: Buffer;
6242
+ /** MIME type of the returned audio (e.g. `"audio/mpeg"`, `"audio/wav"`). */
6243
+ contentType: string;
6244
+ }
6245
+
6246
+ /**
6247
+ * Describes the product surface that is requesting synthesis so providers
6248
+ * can tailor format, latency, and quality trade-offs.
6249
+ */
6250
+ declare type TtsUseCase =
6251
+ /** Real-time phone call — prioritize low latency and streaming. */
6252
+ "phone-call"
6253
+ /** In-app message playback — buffer-oriented, higher quality acceptable. */
6254
+ | "message-playback";
6255
+
6208
6256
  declare interface UiSurfaceComplete {
6209
6257
  type: "ui_surface_complete";
6210
6258
  conversationId: string;
package/index.js CHANGED
@@ -3,6 +3,7 @@ const api = globalThis[Symbol.for("vellum.plugin-api")] ?? {};
3
3
  export const CLI_COMMAND_HELP = api.CLI_COMMAND_HELP;
4
4
  export const HOOKS = api.HOOKS;
5
5
  export const RiskLevel = api.RiskLevel;
6
+ export const TtsSynthesisError = api.TtsSynthesisError;
6
7
  export const addMessage = api.addMessage;
7
8
  export const assistantEventHub = api.assistantEventHub;
8
9
  export const buildMessageExcerpt = api.buildMessageExcerpt;
@@ -29,4 +30,5 @@ export const searchMessageIdsLexical = api.searchMessageIdsLexical;
29
30
  export const selectedBackendSupportsMultimodal = api.selectedBackendSupportsMultimodal;
30
31
  export const stringifyMessageContent = api.stringifyMessageContent;
31
32
  export const syncMessageToDisk = api.syncMessageToDisk;
33
+ export const synthesizeText = api.synthesizeText;
32
34
  export const updateMessageMetadata = api.updateMessageMetadata;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.10.7-dev.202607101252.74ea83d",
3
+ "version": "0.10.7-dev.202607101343.e727d4c",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",