@livekit/agents-plugin-cartesia 1.0.40 → 1.0.41

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.
@@ -0,0 +1,133 @@
1
+ import { z } from 'zod';
2
+ /** Word timestamps schema - contains timing info for each word */
3
+ export declare const cartesiaWordTimestampsSchema: z.ZodObject<{
4
+ words: z.ZodArray<z.ZodString>;
5
+ start: z.ZodArray<z.ZodNumber>;
6
+ end: z.ZodArray<z.ZodNumber>;
7
+ }, z.core.$strip>;
8
+ /** Audio chunk message - type: "chunk" with base64-encoded audio data */
9
+ export declare const cartesiaChunkMessageSchema: z.ZodObject<{
10
+ type: z.ZodLiteral<"chunk">;
11
+ data: z.ZodString;
12
+ done: z.ZodBoolean;
13
+ status_code: z.ZodNumber;
14
+ step_time: z.ZodNumber;
15
+ context_id: z.ZodString;
16
+ }, z.core.$strip>;
17
+ /** Word timestamps message - type: "timestamps" with word timing data */
18
+ export declare const cartesiaTimestampsMessageSchema: z.ZodObject<{
19
+ type: z.ZodLiteral<"timestamps">;
20
+ done: z.ZodBoolean;
21
+ status_code: z.ZodNumber;
22
+ context_id: z.ZodString;
23
+ word_timestamps: z.ZodObject<{
24
+ words: z.ZodArray<z.ZodString>;
25
+ start: z.ZodArray<z.ZodNumber>;
26
+ end: z.ZodArray<z.ZodNumber>;
27
+ }, z.core.$strip>;
28
+ }, z.core.$strip>;
29
+ /** Done message - type: "done" indicates completion */
30
+ export declare const cartesiaDoneMessageSchema: z.ZodObject<{
31
+ type: z.ZodLiteral<"done">;
32
+ done: z.ZodBoolean;
33
+ status_code: z.ZodNumber;
34
+ context_id: z.ZodString;
35
+ }, z.core.$strip>;
36
+ /** Flush done message - type: "flush_done" indicates flush completion */
37
+ export declare const cartesiaFlushDoneMessageSchema: z.ZodObject<{
38
+ type: z.ZodLiteral<"flush_done">;
39
+ done: z.ZodBoolean;
40
+ flush_done: z.ZodBoolean;
41
+ flush_id: z.ZodNumber;
42
+ status_code: z.ZodNumber;
43
+ context_id: z.ZodString;
44
+ }, z.core.$strip>;
45
+ /** Error message - has error field */
46
+ export declare const cartesiaErrorMessageSchema: z.ZodObject<{
47
+ type: z.ZodString;
48
+ done: z.ZodBoolean;
49
+ error: z.ZodString;
50
+ status_code: z.ZodNumber;
51
+ context_id: z.ZodString;
52
+ }, z.core.$strip>;
53
+ /** Union of all possible Cartesia server messages using discriminated union on 'type' */
54
+ export declare const cartesiaServerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
55
+ type: z.ZodLiteral<"chunk">;
56
+ data: z.ZodString;
57
+ done: z.ZodBoolean;
58
+ status_code: z.ZodNumber;
59
+ step_time: z.ZodNumber;
60
+ context_id: z.ZodString;
61
+ }, z.core.$strip>, z.ZodObject<{
62
+ type: z.ZodLiteral<"timestamps">;
63
+ done: z.ZodBoolean;
64
+ status_code: z.ZodNumber;
65
+ context_id: z.ZodString;
66
+ word_timestamps: z.ZodObject<{
67
+ words: z.ZodArray<z.ZodString>;
68
+ start: z.ZodArray<z.ZodNumber>;
69
+ end: z.ZodArray<z.ZodNumber>;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ type: z.ZodLiteral<"done">;
73
+ done: z.ZodBoolean;
74
+ status_code: z.ZodNumber;
75
+ context_id: z.ZodString;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ type: z.ZodLiteral<"flush_done">;
78
+ done: z.ZodBoolean;
79
+ flush_done: z.ZodBoolean;
80
+ flush_id: z.ZodNumber;
81
+ status_code: z.ZodNumber;
82
+ context_id: z.ZodString;
83
+ }, z.core.$strip>], "type">;
84
+ export declare const cartesiaMessageSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
85
+ type: z.ZodLiteral<"chunk">;
86
+ data: z.ZodString;
87
+ done: z.ZodBoolean;
88
+ status_code: z.ZodNumber;
89
+ step_time: z.ZodNumber;
90
+ context_id: z.ZodString;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ type: z.ZodLiteral<"timestamps">;
93
+ done: z.ZodBoolean;
94
+ status_code: z.ZodNumber;
95
+ context_id: z.ZodString;
96
+ word_timestamps: z.ZodObject<{
97
+ words: z.ZodArray<z.ZodString>;
98
+ start: z.ZodArray<z.ZodNumber>;
99
+ end: z.ZodArray<z.ZodNumber>;
100
+ }, z.core.$strip>;
101
+ }, z.core.$strip>, z.ZodObject<{
102
+ type: z.ZodLiteral<"done">;
103
+ done: z.ZodBoolean;
104
+ status_code: z.ZodNumber;
105
+ context_id: z.ZodString;
106
+ }, z.core.$strip>, z.ZodObject<{
107
+ type: z.ZodLiteral<"flush_done">;
108
+ done: z.ZodBoolean;
109
+ flush_done: z.ZodBoolean;
110
+ flush_id: z.ZodNumber;
111
+ status_code: z.ZodNumber;
112
+ context_id: z.ZodString;
113
+ }, z.core.$strip>], "type">, z.ZodObject<{
114
+ type: z.ZodString;
115
+ done: z.ZodBoolean;
116
+ error: z.ZodString;
117
+ status_code: z.ZodNumber;
118
+ context_id: z.ZodString;
119
+ }, z.core.$strip>]>;
120
+ export type CartesiaWordTimestamps = z.infer<typeof cartesiaWordTimestampsSchema>;
121
+ export type CartesiaChunkMessage = z.infer<typeof cartesiaChunkMessageSchema>;
122
+ export type CartesiaTimestampsMessage = z.infer<typeof cartesiaTimestampsMessageSchema>;
123
+ export type CartesiaDoneMessage = z.infer<typeof cartesiaDoneMessageSchema>;
124
+ export type CartesiaFlushDoneMessage = z.infer<typeof cartesiaFlushDoneMessageSchema>;
125
+ export type CartesiaErrorMessage = z.infer<typeof cartesiaErrorMessageSchema>;
126
+ export type CartesiaServerMessage = z.infer<typeof cartesiaMessageSchema>;
127
+ export declare function isChunkMessage(msg: CartesiaServerMessage): msg is CartesiaChunkMessage;
128
+ export declare function isTimestampsMessage(msg: CartesiaServerMessage): msg is CartesiaTimestampsMessage;
129
+ export declare function isDoneMessage(msg: CartesiaServerMessage): msg is CartesiaDoneMessage;
130
+ export declare function isFlushDoneMessage(msg: CartesiaServerMessage): msg is CartesiaFlushDoneMessage;
131
+ export declare function isErrorMessage(msg: CartesiaServerMessage): msg is CartesiaErrorMessage;
132
+ export declare function hasWordTimestamps(msg: CartesiaServerMessage): msg is CartesiaTimestampsMessage;
133
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,133 @@
1
+ import { z } from 'zod';
2
+ /** Word timestamps schema - contains timing info for each word */
3
+ export declare const cartesiaWordTimestampsSchema: z.ZodObject<{
4
+ words: z.ZodArray<z.ZodString>;
5
+ start: z.ZodArray<z.ZodNumber>;
6
+ end: z.ZodArray<z.ZodNumber>;
7
+ }, z.core.$strip>;
8
+ /** Audio chunk message - type: "chunk" with base64-encoded audio data */
9
+ export declare const cartesiaChunkMessageSchema: z.ZodObject<{
10
+ type: z.ZodLiteral<"chunk">;
11
+ data: z.ZodString;
12
+ done: z.ZodBoolean;
13
+ status_code: z.ZodNumber;
14
+ step_time: z.ZodNumber;
15
+ context_id: z.ZodString;
16
+ }, z.core.$strip>;
17
+ /** Word timestamps message - type: "timestamps" with word timing data */
18
+ export declare const cartesiaTimestampsMessageSchema: z.ZodObject<{
19
+ type: z.ZodLiteral<"timestamps">;
20
+ done: z.ZodBoolean;
21
+ status_code: z.ZodNumber;
22
+ context_id: z.ZodString;
23
+ word_timestamps: z.ZodObject<{
24
+ words: z.ZodArray<z.ZodString>;
25
+ start: z.ZodArray<z.ZodNumber>;
26
+ end: z.ZodArray<z.ZodNumber>;
27
+ }, z.core.$strip>;
28
+ }, z.core.$strip>;
29
+ /** Done message - type: "done" indicates completion */
30
+ export declare const cartesiaDoneMessageSchema: z.ZodObject<{
31
+ type: z.ZodLiteral<"done">;
32
+ done: z.ZodBoolean;
33
+ status_code: z.ZodNumber;
34
+ context_id: z.ZodString;
35
+ }, z.core.$strip>;
36
+ /** Flush done message - type: "flush_done" indicates flush completion */
37
+ export declare const cartesiaFlushDoneMessageSchema: z.ZodObject<{
38
+ type: z.ZodLiteral<"flush_done">;
39
+ done: z.ZodBoolean;
40
+ flush_done: z.ZodBoolean;
41
+ flush_id: z.ZodNumber;
42
+ status_code: z.ZodNumber;
43
+ context_id: z.ZodString;
44
+ }, z.core.$strip>;
45
+ /** Error message - has error field */
46
+ export declare const cartesiaErrorMessageSchema: z.ZodObject<{
47
+ type: z.ZodString;
48
+ done: z.ZodBoolean;
49
+ error: z.ZodString;
50
+ status_code: z.ZodNumber;
51
+ context_id: z.ZodString;
52
+ }, z.core.$strip>;
53
+ /** Union of all possible Cartesia server messages using discriminated union on 'type' */
54
+ export declare const cartesiaServerMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
55
+ type: z.ZodLiteral<"chunk">;
56
+ data: z.ZodString;
57
+ done: z.ZodBoolean;
58
+ status_code: z.ZodNumber;
59
+ step_time: z.ZodNumber;
60
+ context_id: z.ZodString;
61
+ }, z.core.$strip>, z.ZodObject<{
62
+ type: z.ZodLiteral<"timestamps">;
63
+ done: z.ZodBoolean;
64
+ status_code: z.ZodNumber;
65
+ context_id: z.ZodString;
66
+ word_timestamps: z.ZodObject<{
67
+ words: z.ZodArray<z.ZodString>;
68
+ start: z.ZodArray<z.ZodNumber>;
69
+ end: z.ZodArray<z.ZodNumber>;
70
+ }, z.core.$strip>;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ type: z.ZodLiteral<"done">;
73
+ done: z.ZodBoolean;
74
+ status_code: z.ZodNumber;
75
+ context_id: z.ZodString;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ type: z.ZodLiteral<"flush_done">;
78
+ done: z.ZodBoolean;
79
+ flush_done: z.ZodBoolean;
80
+ flush_id: z.ZodNumber;
81
+ status_code: z.ZodNumber;
82
+ context_id: z.ZodString;
83
+ }, z.core.$strip>], "type">;
84
+ export declare const cartesiaMessageSchema: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
85
+ type: z.ZodLiteral<"chunk">;
86
+ data: z.ZodString;
87
+ done: z.ZodBoolean;
88
+ status_code: z.ZodNumber;
89
+ step_time: z.ZodNumber;
90
+ context_id: z.ZodString;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ type: z.ZodLiteral<"timestamps">;
93
+ done: z.ZodBoolean;
94
+ status_code: z.ZodNumber;
95
+ context_id: z.ZodString;
96
+ word_timestamps: z.ZodObject<{
97
+ words: z.ZodArray<z.ZodString>;
98
+ start: z.ZodArray<z.ZodNumber>;
99
+ end: z.ZodArray<z.ZodNumber>;
100
+ }, z.core.$strip>;
101
+ }, z.core.$strip>, z.ZodObject<{
102
+ type: z.ZodLiteral<"done">;
103
+ done: z.ZodBoolean;
104
+ status_code: z.ZodNumber;
105
+ context_id: z.ZodString;
106
+ }, z.core.$strip>, z.ZodObject<{
107
+ type: z.ZodLiteral<"flush_done">;
108
+ done: z.ZodBoolean;
109
+ flush_done: z.ZodBoolean;
110
+ flush_id: z.ZodNumber;
111
+ status_code: z.ZodNumber;
112
+ context_id: z.ZodString;
113
+ }, z.core.$strip>], "type">, z.ZodObject<{
114
+ type: z.ZodString;
115
+ done: z.ZodBoolean;
116
+ error: z.ZodString;
117
+ status_code: z.ZodNumber;
118
+ context_id: z.ZodString;
119
+ }, z.core.$strip>]>;
120
+ export type CartesiaWordTimestamps = z.infer<typeof cartesiaWordTimestampsSchema>;
121
+ export type CartesiaChunkMessage = z.infer<typeof cartesiaChunkMessageSchema>;
122
+ export type CartesiaTimestampsMessage = z.infer<typeof cartesiaTimestampsMessageSchema>;
123
+ export type CartesiaDoneMessage = z.infer<typeof cartesiaDoneMessageSchema>;
124
+ export type CartesiaFlushDoneMessage = z.infer<typeof cartesiaFlushDoneMessageSchema>;
125
+ export type CartesiaErrorMessage = z.infer<typeof cartesiaErrorMessageSchema>;
126
+ export type CartesiaServerMessage = z.infer<typeof cartesiaMessageSchema>;
127
+ export declare function isChunkMessage(msg: CartesiaServerMessage): msg is CartesiaChunkMessage;
128
+ export declare function isTimestampsMessage(msg: CartesiaServerMessage): msg is CartesiaTimestampsMessage;
129
+ export declare function isDoneMessage(msg: CartesiaServerMessage): msg is CartesiaDoneMessage;
130
+ export declare function isFlushDoneMessage(msg: CartesiaServerMessage): msg is CartesiaFlushDoneMessage;
131
+ export declare function isErrorMessage(msg: CartesiaServerMessage): msg is CartesiaErrorMessage;
132
+ export declare function hasWordTimestamps(msg: CartesiaServerMessage): msg is CartesiaTimestampsMessage;
133
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,kEAAkE;AAClE,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AAEH,yEAAyE;AACzE,eAAO,MAAM,0BAA0B;;;;;;;iBAOrC,CAAC;AAEH,yEAAyE;AACzE,eAAO,MAAM,+BAA+B;;;;;;;;;;iBAM1C,CAAC;AAEH,uDAAuD;AACvD,eAAO,MAAM,yBAAyB;;;;;iBAKpC,CAAC;AAEH,yEAAyE;AACzE,eAAO,MAAM,8BAA8B;;;;;;;iBAOzC,CAAC;AAEH,sCAAsC;AACtC,eAAO,MAAM,0BAA0B;;;;;;iBAMrC,CAAC;AAEH,yFAAyF;AACzF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAKtC,CAAC;AAGH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAGhC,CAAC;AAMH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAM1E,wBAAgB,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAG,GAAG,IAAI,oBAAoB,CAEtF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,qBAAqB,GAAG,GAAG,IAAI,yBAAyB,CAEhG;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,qBAAqB,GAAG,GAAG,IAAI,mBAAmB,CAEpF;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,qBAAqB,GAAG,GAAG,IAAI,wBAAwB,CAE9F;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAG,GAAG,IAAI,oBAAoB,CAEtF;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,GAAG,GAAG,IAAI,yBAAyB,CAE9F"}
package/dist/types.js ADDED
@@ -0,0 +1,87 @@
1
+ import { z } from "zod";
2
+ const cartesiaWordTimestampsSchema = z.object({
3
+ words: z.array(z.string()),
4
+ start: z.array(z.number()),
5
+ end: z.array(z.number())
6
+ });
7
+ const cartesiaChunkMessageSchema = z.object({
8
+ type: z.literal("chunk"),
9
+ data: z.string(),
10
+ done: z.boolean(),
11
+ status_code: z.number(),
12
+ step_time: z.number(),
13
+ context_id: z.string()
14
+ });
15
+ const cartesiaTimestampsMessageSchema = z.object({
16
+ type: z.literal("timestamps"),
17
+ done: z.boolean(),
18
+ status_code: z.number(),
19
+ context_id: z.string(),
20
+ word_timestamps: cartesiaWordTimestampsSchema
21
+ });
22
+ const cartesiaDoneMessageSchema = z.object({
23
+ type: z.literal("done"),
24
+ done: z.boolean(),
25
+ status_code: z.number(),
26
+ context_id: z.string()
27
+ });
28
+ const cartesiaFlushDoneMessageSchema = z.object({
29
+ type: z.literal("flush_done"),
30
+ done: z.boolean(),
31
+ flush_done: z.boolean(),
32
+ flush_id: z.number(),
33
+ status_code: z.number(),
34
+ context_id: z.string()
35
+ });
36
+ const cartesiaErrorMessageSchema = z.object({
37
+ type: z.string(),
38
+ done: z.boolean(),
39
+ error: z.string(),
40
+ status_code: z.number(),
41
+ context_id: z.string()
42
+ });
43
+ const cartesiaServerMessageSchema = z.discriminatedUnion("type", [
44
+ cartesiaChunkMessageSchema,
45
+ cartesiaTimestampsMessageSchema,
46
+ cartesiaDoneMessageSchema,
47
+ cartesiaFlushDoneMessageSchema
48
+ ]);
49
+ const cartesiaMessageSchema = z.union([
50
+ cartesiaServerMessageSchema,
51
+ cartesiaErrorMessageSchema
52
+ ]);
53
+ function isChunkMessage(msg) {
54
+ return "type" in msg && msg.type === "chunk";
55
+ }
56
+ function isTimestampsMessage(msg) {
57
+ return "type" in msg && msg.type === "timestamps";
58
+ }
59
+ function isDoneMessage(msg) {
60
+ return "type" in msg && msg.type === "done";
61
+ }
62
+ function isFlushDoneMessage(msg) {
63
+ return "type" in msg && msg.type === "flush_done";
64
+ }
65
+ function isErrorMessage(msg) {
66
+ return "error" in msg && typeof msg.error === "string";
67
+ }
68
+ function hasWordTimestamps(msg) {
69
+ return isTimestampsMessage(msg);
70
+ }
71
+ export {
72
+ cartesiaChunkMessageSchema,
73
+ cartesiaDoneMessageSchema,
74
+ cartesiaErrorMessageSchema,
75
+ cartesiaFlushDoneMessageSchema,
76
+ cartesiaMessageSchema,
77
+ cartesiaServerMessageSchema,
78
+ cartesiaTimestampsMessageSchema,
79
+ cartesiaWordTimestampsSchema,
80
+ hasWordTimestamps,
81
+ isChunkMessage,
82
+ isDoneMessage,
83
+ isErrorMessage,
84
+ isFlushDoneMessage,
85
+ isTimestampsMessage
86
+ };
87
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\n// ============================================================================\n// Cartesia WebSocket API Schemas\n// Ref: https://docs.cartesia.ai/api-reference/tts/websocket\n// ============================================================================\n\n/** Word timestamps schema - contains timing info for each word */\nexport const cartesiaWordTimestampsSchema = z.object({\n words: z.array(z.string()),\n start: z.array(z.number()),\n end: z.array(z.number()),\n});\n\n/** Audio chunk message - type: \"chunk\" with base64-encoded audio data */\nexport const cartesiaChunkMessageSchema = z.object({\n type: z.literal('chunk'),\n data: z.string(),\n done: z.boolean(),\n status_code: z.number(),\n step_time: z.number(),\n context_id: z.string(),\n});\n\n/** Word timestamps message - type: \"timestamps\" with word timing data */\nexport const cartesiaTimestampsMessageSchema = z.object({\n type: z.literal('timestamps'),\n done: z.boolean(),\n status_code: z.number(),\n context_id: z.string(),\n word_timestamps: cartesiaWordTimestampsSchema,\n});\n\n/** Done message - type: \"done\" indicates completion */\nexport const cartesiaDoneMessageSchema = z.object({\n type: z.literal('done'),\n done: z.boolean(),\n status_code: z.number(),\n context_id: z.string(),\n});\n\n/** Flush done message - type: \"flush_done\" indicates flush completion */\nexport const cartesiaFlushDoneMessageSchema = z.object({\n type: z.literal('flush_done'),\n done: z.boolean(),\n flush_done: z.boolean(),\n flush_id: z.number(),\n status_code: z.number(),\n context_id: z.string(),\n});\n\n/** Error message - has error field */\nexport const cartesiaErrorMessageSchema = z.object({\n type: z.string(),\n done: z.boolean(),\n error: z.string(),\n status_code: z.number(),\n context_id: z.string(),\n});\n\n/** Union of all possible Cartesia server messages using discriminated union on 'type' */\nexport const cartesiaServerMessageSchema = z.discriminatedUnion('type', [\n cartesiaChunkMessageSchema,\n cartesiaTimestampsMessageSchema,\n cartesiaDoneMessageSchema,\n cartesiaFlushDoneMessageSchema,\n]);\n\n// Fallback schema for error messages (can't be in discriminated union due to dynamic type)\nexport const cartesiaMessageSchema = z.union([\n cartesiaServerMessageSchema,\n cartesiaErrorMessageSchema,\n]);\n\n// ============================================================================\n// Type exports from Zod schemas\n// ============================================================================\n\nexport type CartesiaWordTimestamps = z.infer<typeof cartesiaWordTimestampsSchema>;\nexport type CartesiaChunkMessage = z.infer<typeof cartesiaChunkMessageSchema>;\nexport type CartesiaTimestampsMessage = z.infer<typeof cartesiaTimestampsMessageSchema>;\nexport type CartesiaDoneMessage = z.infer<typeof cartesiaDoneMessageSchema>;\nexport type CartesiaFlushDoneMessage = z.infer<typeof cartesiaFlushDoneMessageSchema>;\nexport type CartesiaErrorMessage = z.infer<typeof cartesiaErrorMessageSchema>;\nexport type CartesiaServerMessage = z.infer<typeof cartesiaMessageSchema>;\n\n// ============================================================================\n// Helper type guards for message discrimination\n// ============================================================================\n\nexport function isChunkMessage(msg: CartesiaServerMessage): msg is CartesiaChunkMessage {\n return 'type' in msg && msg.type === 'chunk';\n}\n\nexport function isTimestampsMessage(msg: CartesiaServerMessage): msg is CartesiaTimestampsMessage {\n return 'type' in msg && msg.type === 'timestamps';\n}\n\nexport function isDoneMessage(msg: CartesiaServerMessage): msg is CartesiaDoneMessage {\n return 'type' in msg && msg.type === 'done';\n}\n\nexport function isFlushDoneMessage(msg: CartesiaServerMessage): msg is CartesiaFlushDoneMessage {\n return 'type' in msg && msg.type === 'flush_done';\n}\n\nexport function isErrorMessage(msg: CartesiaServerMessage): msg is CartesiaErrorMessage {\n return 'error' in msg && typeof msg.error === 'string';\n}\n\nexport function hasWordTimestamps(msg: CartesiaServerMessage): msg is CartesiaTimestampsMessage {\n return isTimestampsMessage(msg);\n}\n"],"mappings":"AAGA,SAAS,SAAS;AAQX,MAAM,+BAA+B,EAAE,OAAO;AAAA,EACnD,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EACzB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,EACzB,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC;AACzB,CAAC;AAGM,MAAM,6BAA6B,EAAE,OAAO;AAAA,EACjD,MAAM,EAAE,QAAQ,OAAO;AAAA,EACvB,MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,QAAQ;AAAA,EAChB,aAAa,EAAE,OAAO;AAAA,EACtB,WAAW,EAAE,OAAO;AAAA,EACpB,YAAY,EAAE,OAAO;AACvB,CAAC;AAGM,MAAM,kCAAkC,EAAE,OAAO;AAAA,EACtD,MAAM,EAAE,QAAQ,YAAY;AAAA,EAC5B,MAAM,EAAE,QAAQ;AAAA,EAChB,aAAa,EAAE,OAAO;AAAA,EACtB,YAAY,EAAE,OAAO;AAAA,EACrB,iBAAiB;AACnB,CAAC;AAGM,MAAM,4BAA4B,EAAE,OAAO;AAAA,EAChD,MAAM,EAAE,QAAQ,MAAM;AAAA,EACtB,MAAM,EAAE,QAAQ;AAAA,EAChB,aAAa,EAAE,OAAO;AAAA,EACtB,YAAY,EAAE,OAAO;AACvB,CAAC;AAGM,MAAM,iCAAiC,EAAE,OAAO;AAAA,EACrD,MAAM,EAAE,QAAQ,YAAY;AAAA,EAC5B,MAAM,EAAE,QAAQ;AAAA,EAChB,YAAY,EAAE,QAAQ;AAAA,EACtB,UAAU,EAAE,OAAO;AAAA,EACnB,aAAa,EAAE,OAAO;AAAA,EACtB,YAAY,EAAE,OAAO;AACvB,CAAC;AAGM,MAAM,6BAA6B,EAAE,OAAO;AAAA,EACjD,MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,QAAQ;AAAA,EAChB,OAAO,EAAE,OAAO;AAAA,EAChB,aAAa,EAAE,OAAO;AAAA,EACtB,YAAY,EAAE,OAAO;AACvB,CAAC;AAGM,MAAM,8BAA8B,EAAE,mBAAmB,QAAQ;AAAA,EACtE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,MAAM,wBAAwB,EAAE,MAAM;AAAA,EAC3C;AAAA,EACA;AACF,CAAC;AAkBM,SAAS,eAAe,KAAyD;AACtF,SAAO,UAAU,OAAO,IAAI,SAAS;AACvC;AAEO,SAAS,oBAAoB,KAA8D;AAChG,SAAO,UAAU,OAAO,IAAI,SAAS;AACvC;AAEO,SAAS,cAAc,KAAwD;AACpF,SAAO,UAAU,OAAO,IAAI,SAAS;AACvC;AAEO,SAAS,mBAAmB,KAA6D;AAC9F,SAAO,UAAU,OAAO,IAAI,SAAS;AACvC;AAEO,SAAS,eAAe,KAAyD;AACtF,SAAO,WAAW,OAAO,OAAO,IAAI,UAAU;AAChD;AAEO,SAAS,kBAAkB,KAA8D;AAC9F,SAAO,oBAAoB,GAAG;AAChC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livekit/agents-plugin-cartesia",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Cartesia plugin for LiveKit Node Agents",
5
5
  "main": "dist/index.js",
6
6
  "require": "dist/index.cjs",
@@ -30,16 +30,17 @@
30
30
  "@types/ws": "^8.5.10",
31
31
  "tsup": "^8.3.5",
32
32
  "typescript": "^5.0.0",
33
- "@livekit/agents": "1.0.40",
34
- "@livekit/agents-plugin-openai": "1.0.40",
35
- "@livekit/agents-plugins-test": "1.0.40"
33
+ "@livekit/agents": "1.0.41",
34
+ "@livekit/agents-plugin-openai": "1.0.41",
35
+ "@livekit/agents-plugins-test": "1.0.41"
36
36
  },
37
37
  "dependencies": {
38
38
  "ws": "^8.16.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@livekit/rtc-node": "^0.13.24",
42
- "@livekit/agents": "1.0.40"
42
+ "zod": "^3.25.76 || ^4.1.8",
43
+ "@livekit/agents": "1.0.41"
43
44
  },
44
45
  "scripts": {
45
46
  "build": "tsup --onSuccess \"pnpm build:types\"",