@vellumai/plugin-api 0.10.10-dev.202607211337.6d2617c → 0.10.10-dev.202607211519.4a4e758

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 +202 -0
  2. package/index.js +1 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2393,6 +2393,11 @@ declare interface CopyBlockSurfaceData {
2393
2393
  language?: string;
2394
2394
  }
2395
2395
 
2396
+ /** Create a live voice connection bound to the caller's `send` transport. */
2397
+ export declare function createLiveVoiceConnection(options: {
2398
+ send: LiveVoiceFrameSender;
2399
+ }): LiveVoiceConnection;
2400
+
2396
2401
  /**
2397
2402
  * Plugin-facing credential resolution.
2398
2403
  *
@@ -3717,6 +3722,203 @@ declare interface ListSurfaceData {
3717
3722
  selectionMode: "single" | "multiple" | "none";
3718
3723
  }
3719
3724
 
3725
+ declare const _LIVE_VOICE_SERVER_FRAME_TYPES: readonly ["ready", "busy", "speech_started", "utterance_end", "utterance_discarded", "stt_partial", "stt_final", "thinking", "assistant_text_delta", "tts_audio", "tts_done", "turn_cancelled", "metrics", "archived", "error"];
3726
+
3727
+ declare const LIVE_VOICE_TURN_DETECTION_MODES: readonly ["manual", "server_vad"];
3728
+
3729
+ declare interface LiveVoiceArchivedServerFrame extends LiveVoiceServerFrameBase {
3730
+ readonly type: "archived";
3731
+ readonly conversationId: string;
3732
+ readonly sessionId: string;
3733
+ readonly turnId?: string;
3734
+ readonly role?: "user" | "assistant";
3735
+ readonly attachmentId?: string;
3736
+ readonly attachmentIds?: string[];
3737
+ readonly warning?: {
3738
+ readonly code: string;
3739
+ readonly message: string;
3740
+ };
3741
+ }
3742
+
3743
+ declare interface LiveVoiceAssistantTextDeltaServerFrame extends LiveVoiceServerFrameBase {
3744
+ readonly type: "assistant_text_delta";
3745
+ readonly text: string;
3746
+ }
3747
+
3748
+ declare interface LiveVoiceBusyServerFrame extends LiveVoiceServerFrameBase {
3749
+ readonly type: "busy";
3750
+ readonly activeSessionId: string;
3751
+ }
3752
+
3753
+ export declare interface LiveVoiceConnection {
3754
+ /**
3755
+ * The active session id once a `start` frame has been accepted, else
3756
+ * `undefined`. Read-only — the connection assigns it on `start` and clears
3757
+ * it on `end`, teardown, or a session that the manager no longer knows.
3758
+ */
3759
+ readonly sessionId: string | undefined;
3760
+ /**
3761
+ * Handle one inbound transport message — a JSON text frame or a binary
3762
+ * audio chunk. Never rejects: protocol and handler failures are reported
3763
+ * back to the client as `error` frames.
3764
+ */
3765
+ handleMessage(message: string | ArrayBuffer | ArrayBufferView): Promise<void>;
3766
+ /**
3767
+ * Release the session bound to this connection when the transport closes.
3768
+ * Idempotent — a no-op when no session is active.
3769
+ */
3770
+ release(reason?: LiveVoiceSessionCloseReason): void;
3771
+ }
3772
+
3773
+ declare interface LiveVoiceErrorServerFrame extends LiveVoiceServerFrameBase {
3774
+ readonly type: "error";
3775
+ readonly code: LiveVoiceProtocolErrorCode;
3776
+ readonly message: string;
3777
+ /**
3778
+ * True when the session continues past the error (e.g. a transient
3779
+ * transcriber blip or one failed TTS segment). Absent (including on frames
3780
+ * from older daemons) means the error is terminal for the session.
3781
+ */
3782
+ readonly recoverable?: boolean;
3783
+ }
3784
+
3785
+ /**
3786
+ * Sends one fully-sequenced server frame to the client over the caller's
3787
+ * transport. The frame is a plain object; the caller is responsible for wire
3788
+ * encoding (e.g. `JSON.stringify` for a text WebSocket).
3789
+ */
3790
+ export declare type LiveVoiceFrameSender = (frame: LiveVoiceServerFrame) => void;
3791
+
3792
+ declare interface LiveVoiceMetricsServerFrame extends LiveVoiceServerFrameBase {
3793
+ readonly type: "metrics";
3794
+ readonly event?: string;
3795
+ readonly sessionId?: string;
3796
+ readonly conversationId?: string;
3797
+ readonly turnId: string;
3798
+ readonly metrics?: unknown;
3799
+ readonly sttMs: number | null;
3800
+ readonly llmFirstDeltaMs: number | null;
3801
+ readonly ttsFirstAudioMs: number | null;
3802
+ /** End-of-speech (utterance_end, or ptt_release in manual mode) to first TTS audio. */
3803
+ readonly roundTripMs: number | null;
3804
+ readonly totalMs: number | null;
3805
+ /**
3806
+ * Semantic-endpointing "hold" decisions taken during the turn. Present only
3807
+ * when the endpoint decider was consulted (otherwise the field is absent,
3808
+ * keeping frames unchanged).
3809
+ */
3810
+ readonly endpointHoldCount?: number;
3811
+ /** Worst endpoint-decision latency observed during the turn. */
3812
+ readonly endpointDecisionMaxLatencyMs?: number;
3813
+ /** Which floor-holding ack actually spoke during the turn, if any. */
3814
+ readonly ackSpoken?: "first_delta" | "tool_use";
3815
+ }
3816
+
3817
+ declare const LiveVoiceProtocolErrorCode: {
3818
+ readonly InvalidJson: "invalid_json";
3819
+ readonly InvalidFrame: "invalid_frame";
3820
+ readonly UnknownType: "unknown_type";
3821
+ readonly MissingRequiredField: "missing_required_field";
3822
+ readonly InvalidField: "invalid_field";
3823
+ readonly InvalidAudioPayload: "invalid_audio_payload";
3824
+ /**
3825
+ * Session startup was rejected because the daemon cannot run both audio
3826
+ * legs (STT/TTS providers or credentials are unresolved). The error
3827
+ * `message` names the offending provider(s) and missing credential(s).
3828
+ */
3829
+ readonly CredentialsUnavailable: "credentials_unavailable";
3830
+ };
3831
+
3832
+ declare type LiveVoiceProtocolErrorCode = (typeof LiveVoiceProtocolErrorCode)[keyof typeof LiveVoiceProtocolErrorCode];
3833
+
3834
+ declare interface LiveVoiceReadyServerFrame extends LiveVoiceServerFrameBase {
3835
+ readonly type: "ready";
3836
+ readonly sessionId: string;
3837
+ readonly conversationId: string;
3838
+ /**
3839
+ * Echoes the turn-detection mode the session is actually running, so
3840
+ * clients can detect a daemon that ignored a requested mode. Absent
3841
+ * (older daemons) means "manual".
3842
+ */
3843
+ readonly turnDetection?: LiveVoiceTurnDetectionMode;
3844
+ }
3845
+
3846
+ export declare type LiveVoiceServerFrame = LiveVoiceReadyServerFrame | LiveVoiceBusyServerFrame | LiveVoiceSpeechStartedServerFrame | LiveVoiceUtteranceEndServerFrame | LiveVoiceUtteranceDiscardedServerFrame | LiveVoiceSttPartialServerFrame | LiveVoiceSttFinalServerFrame | LiveVoiceThinkingServerFrame | LiveVoiceAssistantTextDeltaServerFrame | LiveVoiceTtsAudioServerFrame | LiveVoiceTtsDoneServerFrame | LiveVoiceTurnCancelledServerFrame | LiveVoiceMetricsServerFrame | LiveVoiceArchivedServerFrame | LiveVoiceErrorServerFrame;
3847
+
3848
+ declare interface LiveVoiceServerFrameBase {
3849
+ readonly type: LiveVoiceServerFrameType;
3850
+ readonly seq: number;
3851
+ }
3852
+
3853
+ declare type LiveVoiceServerFrameType = (typeof _LIVE_VOICE_SERVER_FRAME_TYPES)[number];
3854
+
3855
+ export declare type LiveVoiceSessionCloseReason = "client_end" | "error" | "websocket_close" | "transport_closed" | "manager_shutdown";
3856
+
3857
+ /**
3858
+ * Emitted when the server VAD detects user speech. The client MUST
3859
+ * immediately stop local TTS playback — this doubles as the flush-tail-audio
3860
+ * signal (the in-app analog of the phone stack's buffered-audio clear).
3861
+ */
3862
+ declare interface LiveVoiceSpeechStartedServerFrame extends LiveVoiceServerFrameBase {
3863
+ readonly type: "speech_started";
3864
+ }
3865
+
3866
+ declare interface LiveVoiceSttFinalServerFrame extends LiveVoiceServerFrameBase {
3867
+ readonly type: "stt_final";
3868
+ readonly text: string;
3869
+ }
3870
+
3871
+ declare interface LiveVoiceSttPartialServerFrame extends LiveVoiceServerFrameBase {
3872
+ readonly type: "stt_partial";
3873
+ readonly text: string;
3874
+ }
3875
+
3876
+ declare interface LiveVoiceThinkingServerFrame extends LiveVoiceServerFrameBase {
3877
+ readonly type: "thinking";
3878
+ readonly turnId: string;
3879
+ }
3880
+
3881
+ declare interface LiveVoiceTtsAudioServerFrame extends LiveVoiceServerFrameBase {
3882
+ readonly type: "tts_audio";
3883
+ readonly mimeType: string;
3884
+ readonly sampleRate: number;
3885
+ readonly dataBase64: string;
3886
+ }
3887
+
3888
+ declare interface LiveVoiceTtsDoneServerFrame extends LiveVoiceServerFrameBase {
3889
+ readonly type: "tts_done";
3890
+ readonly turnId: string;
3891
+ }
3892
+
3893
+ /**
3894
+ * Emitted when an in-flight assistant turn is aborted by barge-in. The client
3895
+ * must drop any buffered tts_audio for that turn; no tts_done will follow.
3896
+ */
3897
+ declare interface LiveVoiceTurnCancelledServerFrame extends LiveVoiceServerFrameBase {
3898
+ readonly type: "turn_cancelled";
3899
+ readonly turnId: string;
3900
+ }
3901
+
3902
+ declare type LiveVoiceTurnDetectionMode = (typeof LIVE_VOICE_TURN_DETECTION_MODES)[number];
3903
+
3904
+ /**
3905
+ * Emitted only in server_vad mode when the closed utterance produced no
3906
+ * usable speech: it is dropped without an assistant turn and the client
3907
+ * should return to listening.
3908
+ */
3909
+ declare interface LiveVoiceUtteranceDiscardedServerFrame extends LiveVoiceServerFrameBase {
3910
+ readonly type: "utterance_discarded";
3911
+ }
3912
+
3913
+ /**
3914
+ * Emitted when the server VAD closes the utterance and the turn's
3915
+ * transcription begins (plays the role ptt_release plays in manual mode).
3916
+ */
3917
+ declare interface LiveVoiceUtteranceEndServerFrame extends LiveVoiceServerFrameBase {
3918
+ readonly type: "utterance_end";
3919
+ readonly reason: "silence" | "max-duration";
3920
+ }
3921
+
3720
3922
  export declare type LLMCallSite = z.infer<typeof LLMCallSiteEnum>;
3721
3923
 
3722
3924
  /**
package/index.js CHANGED
@@ -10,6 +10,7 @@ export const TtsSynthesisError = api.TtsSynthesisError;
10
10
  export const addMessage = api.addMessage;
11
11
  export const assistantEventHub = api.assistantEventHub;
12
12
  export const buildMessageExcerpt = api.buildMessageExcerpt;
13
+ export const createLiveVoiceConnection = api.createLiveVoiceConnection;
13
14
  export const deleteConversation = api.deleteConversation;
14
15
  export const doesSupportVision = api.doesSupportVision;
15
16
  export const embedAndUpsert = api.embedAndUpsert;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/plugin-api",
3
- "version": "0.10.10-dev.202607211337.6d2617c",
3
+ "version": "0.10.10-dev.202607211519.4a4e758",
4
4
  "description": "Public TypeScript authoring contract for Vellum assistant plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",