@livekit/agents-plugin-openai 1.0.50 → 1.1.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.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/llm.cjs +8 -0
- package/dist/llm.cjs.map +1 -1
- package/dist/llm.d.cts +1 -0
- package/dist/llm.d.ts +1 -0
- package/dist/llm.d.ts.map +1 -1
- package/dist/llm.js +8 -0
- package/dist/llm.js.map +1 -1
- package/dist/llm.test.cjs +31 -16
- package/dist/llm.test.cjs.map +1 -1
- package/dist/llm.test.js +32 -17
- package/dist/llm.test.js.map +1 -1
- package/dist/realtime/api_proto.cjs.map +1 -1
- package/dist/realtime/api_proto.d.cts +7 -3
- package/dist/realtime/api_proto.d.ts +7 -3
- package/dist/realtime/api_proto.d.ts.map +1 -1
- package/dist/realtime/api_proto.js.map +1 -1
- package/dist/realtime/realtime_model.cjs +46 -22
- package/dist/realtime/realtime_model.cjs.map +1 -1
- package/dist/realtime/realtime_model.d.cts +2 -1
- package/dist/realtime/realtime_model.d.ts +2 -1
- package/dist/realtime/realtime_model.d.ts.map +1 -1
- package/dist/realtime/realtime_model.js +46 -22
- package/dist/realtime/realtime_model.js.map +1 -1
- package/dist/realtime/realtime_model.test.cjs +104 -14
- package/dist/realtime/realtime_model.test.cjs.map +1 -1
- package/dist/realtime/realtime_model.test.js +104 -14
- package/dist/realtime/realtime_model.test.js.map +1 -1
- package/dist/realtime/realtime_model_beta.cjs +40 -22
- package/dist/realtime/realtime_model_beta.cjs.map +1 -1
- package/dist/realtime/realtime_model_beta.d.ts.map +1 -1
- package/dist/realtime/realtime_model_beta.js +40 -22
- package/dist/realtime/realtime_model_beta.js.map +1 -1
- package/dist/responses/llm.cjs +71 -16
- package/dist/responses/llm.cjs.map +1 -1
- package/dist/responses/llm.d.cts +10 -25
- package/dist/responses/llm.d.ts +10 -25
- package/dist/responses/llm.d.ts.map +1 -1
- package/dist/responses/llm.js +71 -14
- package/dist/responses/llm.js.map +1 -1
- package/dist/responses/llm.test.cjs +32 -17
- package/dist/responses/llm.test.cjs.map +1 -1
- package/dist/responses/llm.test.js +33 -18
- package/dist/responses/llm.test.js.map +1 -1
- package/dist/stt.cjs +18 -3
- package/dist/stt.cjs.map +1 -1
- package/dist/stt.d.cts +2 -0
- package/dist/stt.d.ts +2 -0
- package/dist/stt.d.ts.map +1 -1
- package/dist/stt.js +19 -4
- package/dist/stt.js.map +1 -1
- package/dist/stt.test.cjs +11 -3
- package/dist/stt.test.cjs.map +1 -1
- package/dist/stt.test.js +12 -4
- package/dist/stt.test.js.map +1 -1
- package/dist/tts.cjs +11 -0
- package/dist/tts.cjs.map +1 -1
- package/dist/tts.d.cts +2 -0
- package/dist/tts.d.ts +2 -0
- package/dist/tts.d.ts.map +1 -1
- package/dist/tts.js +11 -0
- package/dist/tts.js.map +1 -1
- package/dist/tts.test.cjs +11 -3
- package/dist/tts.test.cjs.map +1 -1
- package/dist/tts.test.js +12 -4
- package/dist/tts.test.js.map +1 -1
- package/dist/ws/index.cjs +29 -0
- package/dist/ws/index.cjs.map +1 -0
- package/dist/ws/index.d.cts +3 -0
- package/dist/ws/index.d.ts +3 -0
- package/dist/ws/index.d.ts.map +1 -0
- package/dist/ws/index.js +5 -0
- package/dist/ws/index.js.map +1 -0
- package/dist/ws/llm.cjs +502 -0
- package/dist/ws/llm.cjs.map +1 -0
- package/dist/ws/llm.d.cts +74 -0
- package/dist/ws/llm.d.ts +74 -0
- package/dist/ws/llm.d.ts.map +1 -0
- package/dist/ws/llm.js +485 -0
- package/dist/ws/llm.js.map +1 -0
- package/dist/ws/llm.test.cjs +26 -0
- package/dist/ws/llm.test.cjs.map +1 -0
- package/dist/ws/llm.test.d.cts +2 -0
- package/dist/ws/llm.test.d.ts +2 -0
- package/dist/ws/llm.test.d.ts.map +1 -0
- package/dist/ws/llm.test.js +25 -0
- package/dist/ws/llm.test.js.map +1 -0
- package/dist/ws/types.cjs +128 -0
- package/dist/ws/types.cjs.map +1 -0
- package/dist/ws/types.d.cts +167 -0
- package/dist/ws/types.d.ts +167 -0
- package/dist/ws/types.d.ts.map +1 -0
- package/dist/ws/types.js +95 -0
- package/dist/ws/types.js.map +1 -0
- package/package.json +6 -5
- package/src/index.ts +1 -0
- package/src/llm.test.ts +31 -17
- package/src/llm.ts +9 -0
- package/src/realtime/api_proto.ts +8 -2
- package/src/realtime/realtime_model.test.ts +129 -14
- package/src/realtime/realtime_model.ts +51 -26
- package/src/realtime/realtime_model_beta.ts +42 -25
- package/src/responses/llm.test.ts +32 -18
- package/src/responses/llm.ts +105 -19
- package/src/stt.test.ts +12 -4
- package/src/stt.ts +21 -4
- package/src/tts.test.ts +12 -4
- package/src/tts.ts +13 -0
- package/src/ws/index.ts +17 -0
- package/src/ws/llm.test.ts +30 -0
- package/src/ws/llm.ts +665 -0
- package/src/ws/types.ts +131 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { initializeLogger } from "@livekit/agents";
|
|
2
|
+
import { llm, llmStrict } from "@livekit/agents-plugins-test";
|
|
3
|
+
import { describe } from "vitest";
|
|
4
|
+
import { LLM } from "../responses/llm.js";
|
|
5
|
+
initializeLogger({ level: "silent", pretty: false });
|
|
6
|
+
describe("OpenAI Responses WS wrapper", async () => {
|
|
7
|
+
await llm(
|
|
8
|
+
new LLM({
|
|
9
|
+
temperature: 0,
|
|
10
|
+
strictToolSchema: false,
|
|
11
|
+
useWebSocket: true
|
|
12
|
+
}),
|
|
13
|
+
true
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
describe("OpenAI Responses WS wrapper strict tool schema", async () => {
|
|
17
|
+
await llmStrict(
|
|
18
|
+
new LLM({
|
|
19
|
+
temperature: 0,
|
|
20
|
+
strictToolSchema: true,
|
|
21
|
+
useWebSocket: true
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=llm.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ws/llm.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { initializeLogger } from '@livekit/agents';\nimport { llm, llmStrict } from '@livekit/agents-plugins-test';\nimport { describe } from 'vitest';\nimport { LLM } from '../responses/llm.js';\n\ninitializeLogger({ level: 'silent', pretty: false });\n\ndescribe('OpenAI Responses WS wrapper', async () => {\n await llm(\n new LLM({\n temperature: 0,\n strictToolSchema: false,\n useWebSocket: true,\n }),\n true,\n );\n});\n\ndescribe('OpenAI Responses WS wrapper strict tool schema', async () => {\n await llmStrict(\n new LLM({\n temperature: 0,\n strictToolSchema: true,\n useWebSocket: true,\n }),\n );\n});\n"],"mappings":"AAGA,SAAS,wBAAwB;AACjC,SAAS,KAAK,iBAAiB;AAC/B,SAAS,gBAAgB;AACzB,SAAS,WAAW;AAEpB,iBAAiB,EAAE,OAAO,UAAU,QAAQ,MAAM,CAAC;AAEnD,SAAS,+BAA+B,YAAY;AAClD,QAAM;AAAA,IACJ,IAAI,IAAI;AAAA,MACN,aAAa;AAAA,MACb,kBAAkB;AAAA,MAClB,cAAc;AAAA,IAChB,CAAC;AAAA,IACD;AAAA,EACF;AACF,CAAC;AAED,SAAS,kDAAkD,YAAY;AACrE,QAAM;AAAA,IACJ,IAAI,IAAI;AAAA,MACN,aAAa;AAAA,MACb,kBAAkB;AAAA,MAClB,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
__export(types_exports, {
|
|
21
|
+
wsErrorEventSchema: () => wsErrorEventSchema,
|
|
22
|
+
wsFunctionCallItemSchema: () => wsFunctionCallItemSchema,
|
|
23
|
+
wsOutputItemDoneEventSchema: () => wsOutputItemDoneEventSchema,
|
|
24
|
+
wsOutputItemSchema: () => wsOutputItemSchema,
|
|
25
|
+
wsOutputTextDeltaEventSchema: () => wsOutputTextDeltaEventSchema,
|
|
26
|
+
wsResponseCompletedEventSchema: () => wsResponseCompletedEventSchema,
|
|
27
|
+
wsResponseCreateEventSchema: () => wsResponseCreateEventSchema,
|
|
28
|
+
wsResponseCreatedEventSchema: () => wsResponseCreatedEventSchema,
|
|
29
|
+
wsResponseFailedEventSchema: () => wsResponseFailedEventSchema,
|
|
30
|
+
wsServerEventSchema: () => wsServerEventSchema
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(types_exports);
|
|
33
|
+
var import_zod = require("zod");
|
|
34
|
+
const wsResponseCreateEventSchema = import_zod.z.object({
|
|
35
|
+
type: import_zod.z.literal("response.create"),
|
|
36
|
+
model: import_zod.z.string(),
|
|
37
|
+
input: import_zod.z.array(import_zod.z.unknown()),
|
|
38
|
+
tools: import_zod.z.array(import_zod.z.unknown()).optional(),
|
|
39
|
+
previous_response_id: import_zod.z.string().nullable().optional(),
|
|
40
|
+
store: import_zod.z.boolean().optional(),
|
|
41
|
+
temperature: import_zod.z.number().optional(),
|
|
42
|
+
metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).optional()
|
|
43
|
+
}).passthrough();
|
|
44
|
+
const wsResponseCreatedEventSchema = import_zod.z.object({
|
|
45
|
+
type: import_zod.z.literal("response.created"),
|
|
46
|
+
response: import_zod.z.object({
|
|
47
|
+
id: import_zod.z.string()
|
|
48
|
+
}).passthrough()
|
|
49
|
+
});
|
|
50
|
+
const wsFunctionCallItemSchema = import_zod.z.object({
|
|
51
|
+
type: import_zod.z.literal("function_call"),
|
|
52
|
+
call_id: import_zod.z.string(),
|
|
53
|
+
name: import_zod.z.string(),
|
|
54
|
+
arguments: import_zod.z.string()
|
|
55
|
+
});
|
|
56
|
+
const wsOutputItemSchema = import_zod.z.discriminatedUnion("type", [
|
|
57
|
+
wsFunctionCallItemSchema,
|
|
58
|
+
import_zod.z.object({ type: import_zod.z.literal("message") }).passthrough(),
|
|
59
|
+
import_zod.z.object({ type: import_zod.z.literal("reasoning") }).passthrough(),
|
|
60
|
+
import_zod.z.object({ type: import_zod.z.literal("file") }).passthrough(),
|
|
61
|
+
import_zod.z.object({ type: import_zod.z.literal("computer_call") }).passthrough(),
|
|
62
|
+
import_zod.z.object({ type: import_zod.z.literal("web_search_call") }).passthrough()
|
|
63
|
+
]);
|
|
64
|
+
const wsOutputItemDoneEventSchema = import_zod.z.object({
|
|
65
|
+
type: import_zod.z.literal("response.output_item.done"),
|
|
66
|
+
item: wsOutputItemSchema
|
|
67
|
+
});
|
|
68
|
+
const wsOutputTextDeltaEventSchema = import_zod.z.object({
|
|
69
|
+
type: import_zod.z.literal("response.output_text.delta"),
|
|
70
|
+
delta: import_zod.z.string()
|
|
71
|
+
});
|
|
72
|
+
const wsResponseCompletedEventSchema = import_zod.z.object({
|
|
73
|
+
type: import_zod.z.literal("response.completed"),
|
|
74
|
+
response: import_zod.z.object({
|
|
75
|
+
id: import_zod.z.string(),
|
|
76
|
+
usage: import_zod.z.object({
|
|
77
|
+
output_tokens: import_zod.z.number(),
|
|
78
|
+
input_tokens: import_zod.z.number(),
|
|
79
|
+
total_tokens: import_zod.z.number(),
|
|
80
|
+
input_tokens_details: import_zod.z.object({
|
|
81
|
+
cached_tokens: import_zod.z.number()
|
|
82
|
+
}).passthrough()
|
|
83
|
+
}).optional()
|
|
84
|
+
}).passthrough()
|
|
85
|
+
});
|
|
86
|
+
const wsResponseFailedEventSchema = import_zod.z.object({
|
|
87
|
+
type: import_zod.z.literal("response.failed"),
|
|
88
|
+
response: import_zod.z.object({
|
|
89
|
+
id: import_zod.z.string().optional(),
|
|
90
|
+
error: import_zod.z.object({
|
|
91
|
+
code: import_zod.z.string().optional(),
|
|
92
|
+
message: import_zod.z.string().optional()
|
|
93
|
+
}).optional()
|
|
94
|
+
}).passthrough()
|
|
95
|
+
});
|
|
96
|
+
const wsErrorEventSchema = import_zod.z.object({
|
|
97
|
+
type: import_zod.z.literal("error"),
|
|
98
|
+
status: import_zod.z.number().optional(),
|
|
99
|
+
error: import_zod.z.object({
|
|
100
|
+
type: import_zod.z.string().optional(),
|
|
101
|
+
code: import_zod.z.string().optional(),
|
|
102
|
+
message: import_zod.z.string().optional(),
|
|
103
|
+
param: import_zod.z.string().optional()
|
|
104
|
+
}).optional(),
|
|
105
|
+
message: import_zod.z.string().optional()
|
|
106
|
+
});
|
|
107
|
+
const wsServerEventSchema = import_zod.z.discriminatedUnion("type", [
|
|
108
|
+
wsResponseCreatedEventSchema,
|
|
109
|
+
wsOutputItemDoneEventSchema,
|
|
110
|
+
wsOutputTextDeltaEventSchema,
|
|
111
|
+
wsResponseCompletedEventSchema,
|
|
112
|
+
wsResponseFailedEventSchema,
|
|
113
|
+
wsErrorEventSchema
|
|
114
|
+
]);
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
wsErrorEventSchema,
|
|
118
|
+
wsFunctionCallItemSchema,
|
|
119
|
+
wsOutputItemDoneEventSchema,
|
|
120
|
+
wsOutputItemSchema,
|
|
121
|
+
wsOutputTextDeltaEventSchema,
|
|
122
|
+
wsResponseCompletedEventSchema,
|
|
123
|
+
wsResponseCreateEventSchema,
|
|
124
|
+
wsResponseCreatedEventSchema,
|
|
125
|
+
wsResponseFailedEventSchema,
|
|
126
|
+
wsServerEventSchema
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ws/types.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\n// ============================================================================\n// Client → Server events\n// ============================================================================\n\nexport const wsResponseCreateEventSchema = z\n .object({\n type: z.literal('response.create'),\n model: z.string(),\n input: z.array(z.unknown()),\n tools: z.array(z.unknown()).optional(),\n previous_response_id: z.string().nullable().optional(),\n store: z.boolean().optional(),\n temperature: z.number().optional(),\n metadata: z.record(z.string(), z.string()).optional(),\n })\n .passthrough();\n\nexport type WsResponseCreateEvent = z.infer<typeof wsResponseCreateEventSchema>;\n\n// ============================================================================\n// Server → Client events\n// ============================================================================\n\nexport const wsResponseCreatedEventSchema = z.object({\n type: z.literal('response.created'),\n response: z\n .object({\n id: z.string(),\n })\n .passthrough(),\n});\n\nexport const wsFunctionCallItemSchema = z.object({\n type: z.literal('function_call'),\n call_id: z.string(),\n name: z.string(),\n arguments: z.string(),\n});\n\nexport const wsOutputItemSchema = z.discriminatedUnion('type', [\n wsFunctionCallItemSchema,\n z.object({ type: z.literal('message') }).passthrough(),\n z.object({ type: z.literal('reasoning') }).passthrough(),\n z.object({ type: z.literal('file') }).passthrough(),\n z.object({ type: z.literal('computer_call') }).passthrough(),\n z.object({ type: z.literal('web_search_call') }).passthrough(),\n]);\n\nexport const wsOutputItemDoneEventSchema = z.object({\n type: z.literal('response.output_item.done'),\n item: wsOutputItemSchema,\n});\n\nexport const wsOutputTextDeltaEventSchema = z.object({\n type: z.literal('response.output_text.delta'),\n delta: z.string(),\n});\n\nexport const wsResponseCompletedEventSchema = z.object({\n type: z.literal('response.completed'),\n response: z\n .object({\n id: z.string(),\n usage: z\n .object({\n output_tokens: z.number(),\n input_tokens: z.number(),\n total_tokens: z.number(),\n input_tokens_details: z\n .object({\n cached_tokens: z.number(),\n })\n .passthrough(),\n })\n .optional(),\n })\n .passthrough(),\n});\n\nexport const wsResponseFailedEventSchema = z.object({\n type: z.literal('response.failed'),\n response: z\n .object({\n id: z.string().optional(),\n error: z\n .object({\n code: z.string().optional(),\n message: z.string().optional(),\n })\n .optional(),\n })\n .passthrough(),\n});\n\nexport const wsErrorEventSchema = z.object({\n type: z.literal('error'),\n status: z.number().optional(),\n error: z\n .object({\n type: z.string().optional(),\n code: z.string().optional(),\n message: z.string().optional(),\n param: z.string().optional(),\n })\n .optional(),\n message: z.string().optional(),\n});\n\nexport const wsServerEventSchema = z.discriminatedUnion('type', [\n wsResponseCreatedEventSchema,\n wsOutputItemDoneEventSchema,\n wsOutputTextDeltaEventSchema,\n wsResponseCompletedEventSchema,\n wsResponseFailedEventSchema,\n wsErrorEventSchema,\n]);\n\nexport type WsResponseCreatedEvent = z.infer<typeof wsResponseCreatedEventSchema>;\nexport type WsFunctionCallItem = z.infer<typeof wsFunctionCallItemSchema>;\nexport type WsOutputItem = z.infer<typeof wsOutputItemSchema>;\nexport type WsOutputItemDoneEvent = z.infer<typeof wsOutputItemDoneEventSchema>;\nexport type WsOutputTextDeltaEvent = z.infer<typeof wsOutputTextDeltaEventSchema>;\nexport type WsResponseCompletedEvent = z.infer<typeof wsResponseCompletedEventSchema>;\nexport type WsResponseFailedEvent = z.infer<typeof wsResponseFailedEventSchema>;\nexport type WsErrorEvent = z.infer<type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AQ,OAAO;AAAA,EACvB,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,OAAO,aACJ,OAAO;AAAA,IACN,MAAM,aAAE,OAAO,EAAE,SAAS;AAAA,IAC1B,MAAM,aAAE,OAAO,EAAE,SAAS;AAAA,IAC1B,SAAS,aAAE,OAAO,EAAE,SAAS;AAAA,IAC7B,OAAO,aAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,CAAC,EACA,SAAS;AAAA,EACZ,SAAS,aAAE,OAAO,EAAE,SAAS;AAC/B,CAAC;AAEM,MAAM,sBAAsB,aAAE,mBAAmB,QAAQ;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const wsResponseCreateEventSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"response.create">;
|
|
4
|
+
model: z.ZodString;
|
|
5
|
+
input: z.ZodArray<z.ZodUnknown>;
|
|
6
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
7
|
+
previous_response_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
store: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
export type WsResponseCreateEvent = z.infer<typeof wsResponseCreateEventSchema>;
|
|
13
|
+
export declare const wsResponseCreatedEventSchema: z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"response.created">;
|
|
15
|
+
response: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
}, z.core.$loose>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const wsFunctionCallItemSchema: z.ZodObject<{
|
|
20
|
+
type: z.ZodLiteral<"function_call">;
|
|
21
|
+
call_id: z.ZodString;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
arguments: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const wsOutputItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"function_call">;
|
|
27
|
+
call_id: z.ZodString;
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
arguments: z.ZodString;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"message">;
|
|
32
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
33
|
+
type: z.ZodLiteral<"reasoning">;
|
|
34
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
35
|
+
type: z.ZodLiteral<"file">;
|
|
36
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
37
|
+
type: z.ZodLiteral<"computer_call">;
|
|
38
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"web_search_call">;
|
|
40
|
+
}, z.core.$loose>], "type">;
|
|
41
|
+
export declare const wsOutputItemDoneEventSchema: z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"response.output_item.done">;
|
|
43
|
+
item: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"function_call">;
|
|
45
|
+
call_id: z.ZodString;
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
arguments: z.ZodString;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"message">;
|
|
50
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
51
|
+
type: z.ZodLiteral<"reasoning">;
|
|
52
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"file">;
|
|
54
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
55
|
+
type: z.ZodLiteral<"computer_call">;
|
|
56
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"web_search_call">;
|
|
58
|
+
}, z.core.$loose>], "type">;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export declare const wsOutputTextDeltaEventSchema: z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"response.output_text.delta">;
|
|
62
|
+
delta: z.ZodString;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export declare const wsResponseCompletedEventSchema: z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"response.completed">;
|
|
66
|
+
response: z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
output_tokens: z.ZodNumber;
|
|
70
|
+
input_tokens: z.ZodNumber;
|
|
71
|
+
total_tokens: z.ZodNumber;
|
|
72
|
+
input_tokens_details: z.ZodObject<{
|
|
73
|
+
cached_tokens: z.ZodNumber;
|
|
74
|
+
}, z.core.$loose>;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
}, z.core.$loose>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
export declare const wsResponseFailedEventSchema: z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"response.failed">;
|
|
80
|
+
response: z.ZodObject<{
|
|
81
|
+
id: z.ZodOptional<z.ZodString>;
|
|
82
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
code: z.ZodOptional<z.ZodString>;
|
|
84
|
+
message: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
}, z.core.$loose>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export declare const wsErrorEventSchema: z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"error">;
|
|
90
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
type: z.ZodOptional<z.ZodString>;
|
|
93
|
+
code: z.ZodOptional<z.ZodString>;
|
|
94
|
+
message: z.ZodOptional<z.ZodString>;
|
|
95
|
+
param: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
message: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export declare const wsServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
100
|
+
type: z.ZodLiteral<"response.created">;
|
|
101
|
+
response: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
}, z.core.$loose>;
|
|
104
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
+
type: z.ZodLiteral<"response.output_item.done">;
|
|
106
|
+
item: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"function_call">;
|
|
108
|
+
call_id: z.ZodString;
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
arguments: z.ZodString;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"message">;
|
|
113
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"reasoning">;
|
|
115
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
116
|
+
type: z.ZodLiteral<"file">;
|
|
117
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
118
|
+
type: z.ZodLiteral<"computer_call">;
|
|
119
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
120
|
+
type: z.ZodLiteral<"web_search_call">;
|
|
121
|
+
}, z.core.$loose>], "type">;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
type: z.ZodLiteral<"response.output_text.delta">;
|
|
124
|
+
delta: z.ZodString;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
type: z.ZodLiteral<"response.completed">;
|
|
127
|
+
response: z.ZodObject<{
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
output_tokens: z.ZodNumber;
|
|
131
|
+
input_tokens: z.ZodNumber;
|
|
132
|
+
total_tokens: z.ZodNumber;
|
|
133
|
+
input_tokens_details: z.ZodObject<{
|
|
134
|
+
cached_tokens: z.ZodNumber;
|
|
135
|
+
}, z.core.$loose>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
}, z.core.$loose>;
|
|
138
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"response.failed">;
|
|
140
|
+
response: z.ZodObject<{
|
|
141
|
+
id: z.ZodOptional<z.ZodString>;
|
|
142
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
code: z.ZodOptional<z.ZodString>;
|
|
144
|
+
message: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
}, z.core.$loose>;
|
|
147
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
148
|
+
type: z.ZodLiteral<"error">;
|
|
149
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
151
|
+
type: z.ZodOptional<z.ZodString>;
|
|
152
|
+
code: z.ZodOptional<z.ZodString>;
|
|
153
|
+
message: z.ZodOptional<z.ZodString>;
|
|
154
|
+
param: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>>;
|
|
156
|
+
message: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>], "type">;
|
|
158
|
+
export type WsResponseCreatedEvent = z.infer<typeof wsResponseCreatedEventSchema>;
|
|
159
|
+
export type WsFunctionCallItem = z.infer<typeof wsFunctionCallItemSchema>;
|
|
160
|
+
export type WsOutputItem = z.infer<typeof wsOutputItemSchema>;
|
|
161
|
+
export type WsOutputItemDoneEvent = z.infer<typeof wsOutputItemDoneEventSchema>;
|
|
162
|
+
export type WsOutputTextDeltaEvent = z.infer<typeof wsOutputTextDeltaEventSchema>;
|
|
163
|
+
export type WsResponseCompletedEvent = z.infer<typeof wsResponseCompletedEventSchema>;
|
|
164
|
+
export type WsResponseFailedEvent = z.infer<typeof wsResponseFailedEventSchema>;
|
|
165
|
+
export type WsErrorEvent = z.infer<typeof wsErrorEventSchema>;
|
|
166
|
+
export type WsServerEvent = z.infer<typeof wsServerEventSchema>;
|
|
167
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const wsResponseCreateEventSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"response.create">;
|
|
4
|
+
model: z.ZodString;
|
|
5
|
+
input: z.ZodArray<z.ZodUnknown>;
|
|
6
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
7
|
+
previous_response_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
store: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
export type WsResponseCreateEvent = z.infer<typeof wsResponseCreateEventSchema>;
|
|
13
|
+
export declare const wsResponseCreatedEventSchema: z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"response.created">;
|
|
15
|
+
response: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
}, z.core.$loose>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const wsFunctionCallItemSchema: z.ZodObject<{
|
|
20
|
+
type: z.ZodLiteral<"function_call">;
|
|
21
|
+
call_id: z.ZodString;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
arguments: z.ZodString;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const wsOutputItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"function_call">;
|
|
27
|
+
call_id: z.ZodString;
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
arguments: z.ZodString;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"message">;
|
|
32
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
33
|
+
type: z.ZodLiteral<"reasoning">;
|
|
34
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
35
|
+
type: z.ZodLiteral<"file">;
|
|
36
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
37
|
+
type: z.ZodLiteral<"computer_call">;
|
|
38
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"web_search_call">;
|
|
40
|
+
}, z.core.$loose>], "type">;
|
|
41
|
+
export declare const wsOutputItemDoneEventSchema: z.ZodObject<{
|
|
42
|
+
type: z.ZodLiteral<"response.output_item.done">;
|
|
43
|
+
item: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"function_call">;
|
|
45
|
+
call_id: z.ZodString;
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
arguments: z.ZodString;
|
|
48
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"message">;
|
|
50
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
51
|
+
type: z.ZodLiteral<"reasoning">;
|
|
52
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"file">;
|
|
54
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
55
|
+
type: z.ZodLiteral<"computer_call">;
|
|
56
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"web_search_call">;
|
|
58
|
+
}, z.core.$loose>], "type">;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export declare const wsOutputTextDeltaEventSchema: z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"response.output_text.delta">;
|
|
62
|
+
delta: z.ZodString;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export declare const wsResponseCompletedEventSchema: z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"response.completed">;
|
|
66
|
+
response: z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
69
|
+
output_tokens: z.ZodNumber;
|
|
70
|
+
input_tokens: z.ZodNumber;
|
|
71
|
+
total_tokens: z.ZodNumber;
|
|
72
|
+
input_tokens_details: z.ZodObject<{
|
|
73
|
+
cached_tokens: z.ZodNumber;
|
|
74
|
+
}, z.core.$loose>;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
}, z.core.$loose>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
export declare const wsResponseFailedEventSchema: z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"response.failed">;
|
|
80
|
+
response: z.ZodObject<{
|
|
81
|
+
id: z.ZodOptional<z.ZodString>;
|
|
82
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
83
|
+
code: z.ZodOptional<z.ZodString>;
|
|
84
|
+
message: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
}, z.core.$loose>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
export declare const wsErrorEventSchema: z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"error">;
|
|
90
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
type: z.ZodOptional<z.ZodString>;
|
|
93
|
+
code: z.ZodOptional<z.ZodString>;
|
|
94
|
+
message: z.ZodOptional<z.ZodString>;
|
|
95
|
+
param: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
message: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export declare const wsServerEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
100
|
+
type: z.ZodLiteral<"response.created">;
|
|
101
|
+
response: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
}, z.core.$loose>;
|
|
104
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
+
type: z.ZodLiteral<"response.output_item.done">;
|
|
106
|
+
item: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"function_call">;
|
|
108
|
+
call_id: z.ZodString;
|
|
109
|
+
name: z.ZodString;
|
|
110
|
+
arguments: z.ZodString;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"message">;
|
|
113
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"reasoning">;
|
|
115
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
116
|
+
type: z.ZodLiteral<"file">;
|
|
117
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
118
|
+
type: z.ZodLiteral<"computer_call">;
|
|
119
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
120
|
+
type: z.ZodLiteral<"web_search_call">;
|
|
121
|
+
}, z.core.$loose>], "type">;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
type: z.ZodLiteral<"response.output_text.delta">;
|
|
124
|
+
delta: z.ZodString;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
type: z.ZodLiteral<"response.completed">;
|
|
127
|
+
response: z.ZodObject<{
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
130
|
+
output_tokens: z.ZodNumber;
|
|
131
|
+
input_tokens: z.ZodNumber;
|
|
132
|
+
total_tokens: z.ZodNumber;
|
|
133
|
+
input_tokens_details: z.ZodObject<{
|
|
134
|
+
cached_tokens: z.ZodNumber;
|
|
135
|
+
}, z.core.$loose>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
}, z.core.$loose>;
|
|
138
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"response.failed">;
|
|
140
|
+
response: z.ZodObject<{
|
|
141
|
+
id: z.ZodOptional<z.ZodString>;
|
|
142
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
code: z.ZodOptional<z.ZodString>;
|
|
144
|
+
message: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
}, z.core.$loose>;
|
|
147
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
148
|
+
type: z.ZodLiteral<"error">;
|
|
149
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
151
|
+
type: z.ZodOptional<z.ZodString>;
|
|
152
|
+
code: z.ZodOptional<z.ZodString>;
|
|
153
|
+
message: z.ZodOptional<z.ZodString>;
|
|
154
|
+
param: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>>;
|
|
156
|
+
message: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>], "type">;
|
|
158
|
+
export type WsResponseCreatedEvent = z.infer<typeof wsResponseCreatedEventSchema>;
|
|
159
|
+
export type WsFunctionCallItem = z.infer<typeof wsFunctionCallItemSchema>;
|
|
160
|
+
export type WsOutputItem = z.infer<typeof wsOutputItemSchema>;
|
|
161
|
+
export type WsOutputItemDoneEvent = z.infer<typeof wsOutputItemDoneEventSchema>;
|
|
162
|
+
export type WsOutputTextDeltaEvent = z.infer<typeof wsOutputTextDeltaEventSchema>;
|
|
163
|
+
export type WsResponseCompletedEvent = z.infer<typeof wsResponseCompletedEventSchema>;
|
|
164
|
+
export type WsResponseFailedEvent = z.infer<typeof wsResponseFailedEventSchema>;
|
|
165
|
+
export type WsErrorEvent = z.infer<typeof wsErrorEventSchema>;
|
|
166
|
+
export type WsServerEvent = z.infer<typeof wsServerEventSchema>;
|
|
167
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ws/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,2BAA2B;;;;;;;;;iBAWxB,CAAC;AAEjB,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAMhF,eAAO,MAAM,4BAA4B;;;;;iBAOvC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;iBAKnC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;2BAO7B,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;iBAGtC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;iBAGvC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;iBAmBzC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;iBAatC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;iBAY7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAO9B,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAClF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/ws/types.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const wsResponseCreateEventSchema = z.object({
|
|
3
|
+
type: z.literal("response.create"),
|
|
4
|
+
model: z.string(),
|
|
5
|
+
input: z.array(z.unknown()),
|
|
6
|
+
tools: z.array(z.unknown()).optional(),
|
|
7
|
+
previous_response_id: z.string().nullable().optional(),
|
|
8
|
+
store: z.boolean().optional(),
|
|
9
|
+
temperature: z.number().optional(),
|
|
10
|
+
metadata: z.record(z.string(), z.string()).optional()
|
|
11
|
+
}).passthrough();
|
|
12
|
+
const wsResponseCreatedEventSchema = z.object({
|
|
13
|
+
type: z.literal("response.created"),
|
|
14
|
+
response: z.object({
|
|
15
|
+
id: z.string()
|
|
16
|
+
}).passthrough()
|
|
17
|
+
});
|
|
18
|
+
const wsFunctionCallItemSchema = z.object({
|
|
19
|
+
type: z.literal("function_call"),
|
|
20
|
+
call_id: z.string(),
|
|
21
|
+
name: z.string(),
|
|
22
|
+
arguments: z.string()
|
|
23
|
+
});
|
|
24
|
+
const wsOutputItemSchema = z.discriminatedUnion("type", [
|
|
25
|
+
wsFunctionCallItemSchema,
|
|
26
|
+
z.object({ type: z.literal("message") }).passthrough(),
|
|
27
|
+
z.object({ type: z.literal("reasoning") }).passthrough(),
|
|
28
|
+
z.object({ type: z.literal("file") }).passthrough(),
|
|
29
|
+
z.object({ type: z.literal("computer_call") }).passthrough(),
|
|
30
|
+
z.object({ type: z.literal("web_search_call") }).passthrough()
|
|
31
|
+
]);
|
|
32
|
+
const wsOutputItemDoneEventSchema = z.object({
|
|
33
|
+
type: z.literal("response.output_item.done"),
|
|
34
|
+
item: wsOutputItemSchema
|
|
35
|
+
});
|
|
36
|
+
const wsOutputTextDeltaEventSchema = z.object({
|
|
37
|
+
type: z.literal("response.output_text.delta"),
|
|
38
|
+
delta: z.string()
|
|
39
|
+
});
|
|
40
|
+
const wsResponseCompletedEventSchema = z.object({
|
|
41
|
+
type: z.literal("response.completed"),
|
|
42
|
+
response: z.object({
|
|
43
|
+
id: z.string(),
|
|
44
|
+
usage: z.object({
|
|
45
|
+
output_tokens: z.number(),
|
|
46
|
+
input_tokens: z.number(),
|
|
47
|
+
total_tokens: z.number(),
|
|
48
|
+
input_tokens_details: z.object({
|
|
49
|
+
cached_tokens: z.number()
|
|
50
|
+
}).passthrough()
|
|
51
|
+
}).optional()
|
|
52
|
+
}).passthrough()
|
|
53
|
+
});
|
|
54
|
+
const wsResponseFailedEventSchema = z.object({
|
|
55
|
+
type: z.literal("response.failed"),
|
|
56
|
+
response: z.object({
|
|
57
|
+
id: z.string().optional(),
|
|
58
|
+
error: z.object({
|
|
59
|
+
code: z.string().optional(),
|
|
60
|
+
message: z.string().optional()
|
|
61
|
+
}).optional()
|
|
62
|
+
}).passthrough()
|
|
63
|
+
});
|
|
64
|
+
const wsErrorEventSchema = z.object({
|
|
65
|
+
type: z.literal("error"),
|
|
66
|
+
status: z.number().optional(),
|
|
67
|
+
error: z.object({
|
|
68
|
+
type: z.string().optional(),
|
|
69
|
+
code: z.string().optional(),
|
|
70
|
+
message: z.string().optional(),
|
|
71
|
+
param: z.string().optional()
|
|
72
|
+
}).optional(),
|
|
73
|
+
message: z.string().optional()
|
|
74
|
+
});
|
|
75
|
+
const wsServerEventSchema = z.discriminatedUnion("type", [
|
|
76
|
+
wsResponseCreatedEventSchema,
|
|
77
|
+
wsOutputItemDoneEventSchema,
|
|
78
|
+
wsOutputTextDeltaEventSchema,
|
|
79
|
+
wsResponseCompletedEventSchema,
|
|
80
|
+
wsResponseFailedEventSchema,
|
|
81
|
+
wsErrorEventSchema
|
|
82
|
+
]);
|
|
83
|
+
export {
|
|
84
|
+
wsErrorEventSchema,
|
|
85
|
+
wsFunctionCallItemSchema,
|
|
86
|
+
wsOutputItemDoneEventSchema,
|
|
87
|
+
wsOutputItemSchema,
|
|
88
|
+
wsOutputTextDeltaEventSchema,
|
|
89
|
+
wsResponseCompletedEventSchema,
|
|
90
|
+
wsResponseCreateEventSchema,
|
|
91
|
+
wsResponseCreatedEventSchema,
|
|
92
|
+
wsResponseFailedEventSchema,
|
|
93
|
+
wsServerEventSchema
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ws/types.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\n// ============================================================================\n// Client → Server events\n// ============================================================================\n\nexport const wsResponseCreateEventSchema = z\n .object({\n type: z.literal('response.create'),\n model: z.string(),\n input: z.array(z.unknown()),\n tools: z.array(z.unknown()).optional(),\n previous_response_id: z.string().nullable().optional(),\n store: z.boolean().optional(),\n temperature: z.number().optional(),\n metadata: z.record(z.string(), z.string()).optional(),\n })\n .passthrough();\n\nexport type WsResponseCreateEvent = z.infer<typeof wsResponseCreateEventSchema>;\n\n// ============================================================================\n// Server → Client events\n// ============================================================================\n\nexport const wsResponseCreatedEventSchema = z.object({\n type: z.literal('response.created'),\n response: z\n .object({\n id: z.string(),\n })\n .passthrough(),\n});\n\nexport const wsFunctionCallItemSchema = z.object({\n type: z.literal('function_call'),\n call_id: z.string(),\n name: z.string(),\n arguments: z.string(),\n});\n\nexport const wsOutputItemSchema = z.discriminatedUnion('type', [\n wsFunctionCallItemSchema,\n z.object({ type: z.literal('message') }).passthrough(),\n z.object({ type: z.literal('reasoning') }).passthrough(),\n z.object({ type: z.literal('file') }).passthrough(),\n z.object({ type: z.literal('computer_call') }).passthrough(),\n z.object({ type: z.literal('web_search_call') }).passthrough(),\n]);\n\nexport const wsOutputItemDoneEventSchema = z.object({\n type: z.literal('response.output_item.done'),\n item: wsOutputItemSchema,\n});\n\nexport const wsOutputTextDeltaEventSchema = z.object({\n type: z.literal('response.output_text.delta'),\n delta: z.string(),\n});\n\nexport const wsResponseCompletedEventSchema = z.object({\n type: z.literal('response.completed'),\n response: z\n .object({\n id: z.string(),\n usage: z\n .object({\n output_tokens: z.number(),\n input_tokens: z.number(),\n total_tokens: z.number(),\n input_tokens_details: z\n .object({\n cached_tokens: z.number(),\n })\n .passthrough(),\n })\n .optional(),\n })\n .passthrough(),\n});\n\nexport const wsResponseFailedEventSchema = z.object({\n type: z.literal('response.failed'),\n response: z\n .object({\n id: z.string().optional(),\n error: z\n .object({\n code: z.string().optional(),\n message: z.string().optional(),\n })\n .optional(),\n })\n .passthrough(),\n});\n\nexport const wsErrorEventSchema = z.object({\n type: z.literal('error'),\n status: z.number().optional(),\n error: z\n .object({\n type: z.string().optional(),\n code: z.string().optional(),\n message: z.string().optional(),\n param: z.string().optional(),\n })\n .optional(),\n message: z.string().optional(),\n});\n\nexport const wsServerEventSchema = z.discriminatedUnion('type', [\n wsResponseCreatedEventSchema,\n wsOutputItemDoneEventSchema,\n wsOutputTextDeltaEventSchema,\n wsResponseCompletedEventSchema,\n wsResponseFailedEventSchema,\n wsErrorEventSchema,\n]);\n\nexport type WsResponseCreatedEvent = z.infer<typeof wsResponseCreatedEventSchema>;\nexport type WsFunctionCallItem = z.infer<typeof wsFunctionCallItemSchema>;\nexport type WsOutputItem = z.infer<typeof wsOutputItemSchema>;\nexport type WsOutputItemDoneEvent = z.infer<typeof wsOutputItemDoneEventSchema>;\nexport type WsOutputTextDeltaEvent = z.infer<typeof wsOutputTextDeltaEventSchema>;\nexport type WsResponseCompletedEvent = z.infer<typeof wsResponseCompletedEventSchema>;\nexport type WsResponseFailedEvent = z.infer<typeof wsResponseFailedEventSchema>;\nexport type WsErrorEvent = z.infer<typeof wsErrorEventSchema>;\nexport type WsServerEvent = z.infer<typeof wsServerEventSchema>;\n"],"mappings":"AAGA,SAAS,SAAS;AAMX,MAAM,8BAA8B,EACxC,OAAO;AAAA,EACN,MAAM,EAAE,QAAQ,iBAAiB;AAAA,EACjC,OAAO,EAAE,OAAO;AAAA,EAChB,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC;AAAA,EAC1B,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS;AAAA,EACrC,sBAAsB,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,EACrD,OAAO,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC5B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAAE,SAAS;AACtD,CAAC,EACA,YAAY;AAQR,MAAM,+BAA+B,EAAE,OAAO;AAAA,EACnD,MAAM,EAAE,QAAQ,kBAAkB;AAAA,EAClC,UAAU,EACP,OAAO;AAAA,IACN,IAAI,EAAE,OAAO;AAAA,EACf,CAAC,EACA,YAAY;AACjB,CAAC;AAEM,MAAM,2BAA2B,EAAE,OAAO;AAAA,EAC/C,MAAM,EAAE,QAAQ,eAAe;AAAA,EAC/B,SAAS,EAAE,OAAO;AAAA,EAClB,MAAM,EAAE,OAAO;AAAA,EACf,WAAW,EAAE,OAAO;AACtB,CAAC;AAEM,MAAM,qBAAqB,EAAE,mBAAmB,QAAQ;AAAA,EAC7D;AAAA,EACA,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAS,EAAE,CAAC,EAAE,YAAY;AAAA,EACrD,EAAE,OAAO,EAAE,MAAM,EAAE,QAA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B,CAAC;AAEM,MAAM,qBAAqB,EAAE,OAAO;AAAA,EACzC,MAAM,EAAE,QAAQ,OAAO;AAAA,EACvB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,OAAO,EACJ,OAAO;AAAA,IACN,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,IAC1B,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,IAC1B,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,IAC7B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,CAAC,EACA,SAAS;AAAA,EACZ,SAAS,EAAE,OAAO,EAAE,SAAS;AAC/B,CAAC;AAEM,MAAM,sBAAsB,EAAE,mBAAmB,QAAQ;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livekit/agents-plugin-openai",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "OpenAI plugin for LiveKit Node Agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"require": "dist/index.cjs",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@types/ws": "^8.5.10",
|
|
31
31
|
"tsup": "^8.3.5",
|
|
32
32
|
"typescript": "^5.0.0",
|
|
33
|
-
"@livekit/agents": "1.0
|
|
34
|
-
"@livekit/agents-plugin-silero": "1.0
|
|
35
|
-
"@livekit/agents-plugins-test": "1.0
|
|
33
|
+
"@livekit/agents": "1.1.0",
|
|
34
|
+
"@livekit/agents-plugin-silero": "1.1.0",
|
|
35
|
+
"@livekit/agents-plugins-test": "1.1.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@livekit/mutex": "^1.1.1",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@livekit/rtc-node": "^0.13.24",
|
|
44
|
-
"
|
|
44
|
+
"zod": "^3.25.76 || ^4.1.8",
|
|
45
|
+
"@livekit/agents": "1.1.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
47
48
|
"build": "tsup --onSuccess \"pnpm build:types\"",
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * as realtime from './realtime/index.js';
|
|
|
9
9
|
export * as responses from './responses/index.js';
|
|
10
10
|
export { STT, type STTOptions } from './stt.js';
|
|
11
11
|
export { ChunkedStream, TTS, type TTSOptions } from './tts.js';
|
|
12
|
+
export * as ws from './ws/index.js';
|
|
12
13
|
|
|
13
14
|
class OpenAIPlugin extends Plugin {
|
|
14
15
|
constructor() {
|