@pinecall/protocol 0.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.
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+ import { type Command, type Entry } from "./envelope.js";
3
+ import { COMMAND_SCHEMAS, EVENT_SCHEMAS, type CommandType, type EventType } from "./registry.js";
4
+ export declare class ProtocolError extends Error {
5
+ readonly name = "ProtocolError";
6
+ }
7
+ /** The data shape of one event type. */
8
+ export type EventData<K extends EventType> = z.infer<(typeof EVENT_SCHEMAS)[K]>;
9
+ /** One event, typed by its type: switch on `type` and `data` narrows with it. */
10
+ export type Event = {
11
+ [K in EventType]: {
12
+ type: K;
13
+ data: EventData<K>;
14
+ };
15
+ }[EventType];
16
+ /** The data shape of one command type. */
17
+ export type CommandData<K extends CommandType> = z.infer<(typeof COMMAND_SCHEMAS)[K]>;
18
+ /** One command, typed by its type. */
19
+ export type AnyCommand = {
20
+ [K in CommandType]: {
21
+ type: K;
22
+ data: CommandData<K>;
23
+ };
24
+ }[CommandType];
25
+ /** One log line from decoded JSON. A bad shape throws. */
26
+ export declare function decodeEntry(raw: unknown): Entry;
27
+ /** A whole log from a JSON array text, in the order it came. */
28
+ export declare function decodeEntries(text: string): Entry[];
29
+ /** The entry's data as the shape its type names. An unknown type or a bad shape throws. */
30
+ export declare function eventOf(entry: Entry): Event;
31
+ /** The command's data as the shape its type names. An unknown type or a bad shape throws. */
32
+ export declare function commandOf(command: Command): AnyCommand;
33
+ export declare function isEventType(type: string): type is EventType;
34
+ export declare function isCommandType(type: string): type is CommandType;
35
+ /** "llm_node_ttft" as a type becomes "llmNodeTtft". */
36
+ export type CamelCase<S extends string> = S extends `${infer Head}_${infer Tail}` ? `${Head}${Capitalize<CamelCase<Tail>>}` : S;
37
+ /** "llmNodeTtft" as a type becomes "llm_node_ttft". */
38
+ export type SnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${SnakeCase<Tail>}` : `_${Lowercase<Head>}${SnakeCase<Tail>}` : S;
39
+ /** A wire shape with every key camelCased, deep, except under the opaque keys. */
40
+ export type Camel<T> = T extends readonly (infer Item)[] ? Camel<Item>[] : T extends object ? {
41
+ [K in keyof T as K extends string ? CamelCase<K> : K]: K extends OpaqueKey ? T[K] : Camel<T[K]>;
42
+ } : T;
43
+ /** A camelCased shape back to the wire's keys, deep, except under the opaque keys. */
44
+ export type Snake<T> = T extends readonly (infer Item)[] ? Snake<Item>[] : T extends object ? {
45
+ [K in keyof T as K extends string ? SnakeCase<K> : K]: K extends OpaqueKey ? T[K] : Snake<T[K]>;
46
+ } : T;
47
+ /** The keys whose values belong to the app (its state, a tool's arguments, a map it named): never renamed below them. */
48
+ export declare const OPAQUE_KEYS: Set<string>;
49
+ export type OpaqueKey = "app_state" | "arguments" | "attributes" | "data" | "input" | "metadata" | "output" | "parameters" | "prompt" | "result" | "state";
50
+ /** Rename every key from snake_case to camelCase, deep. Values are never touched. */
51
+ export declare function toCamel<T>(value: T): Camel<T>;
52
+ /** Rename every key from camelCase to snake_case, deep. Values are never touched. */
53
+ export declare function toSnake<T>(value: T): Snake<T>;
@@ -0,0 +1,67 @@
1
+ // The wire, decoded and typed. The only file that touches a key name: snake_case on the wire,
2
+ // camelCase for whoever wants it. Never edited by hand.
3
+ import { z } from "zod";
4
+ import { EntrySchema } from "./envelope.js";
5
+ import { COMMAND_SCHEMAS, EVENT_SCHEMAS } from "./registry.js";
6
+ export class ProtocolError extends Error {
7
+ name = "ProtocolError";
8
+ }
9
+ /** One log line from decoded JSON. A bad shape throws. */
10
+ export function decodeEntry(raw) {
11
+ return EntrySchema.parse(raw);
12
+ }
13
+ /** A whole log from a JSON array text, in the order it came. */
14
+ export function decodeEntries(text) {
15
+ return z.array(EntrySchema).parse(JSON.parse(text));
16
+ }
17
+ /** The entry's data as the shape its type names. An unknown type or a bad shape throws. */
18
+ export function eventOf(entry) {
19
+ if (!isEventType(entry.type)) {
20
+ throw new ProtocolError(`unknown event type: ${entry.type}`);
21
+ }
22
+ const data = EVENT_SCHEMAS[entry.type].parse(entry.data);
23
+ return { type: entry.type, data };
24
+ }
25
+ /** The command's data as the shape its type names. An unknown type or a bad shape throws. */
26
+ export function commandOf(command) {
27
+ if (!isCommandType(command.type)) {
28
+ throw new ProtocolError(`unknown command type: ${command.type}`);
29
+ }
30
+ const data = COMMAND_SCHEMAS[command.type].parse(command.data);
31
+ return { type: command.type, data };
32
+ }
33
+ export function isEventType(type) {
34
+ return Object.hasOwn(EVENT_SCHEMAS, type);
35
+ }
36
+ export function isCommandType(type) {
37
+ return Object.hasOwn(COMMAND_SCHEMAS, type);
38
+ }
39
+ /** The keys whose values belong to the app (its state, a tool's arguments, a map it named): never renamed below them. */
40
+ export const OPAQUE_KEYS = new Set(["app_state", "arguments", "attributes", "data", "input", "metadata", "output", "parameters", "prompt", "result", "state"]);
41
+ /** Rename every key from snake_case to camelCase, deep. Values are never touched. */
42
+ export function toCamel(value) {
43
+ return renameKeys(value, camelCase);
44
+ }
45
+ /** Rename every key from camelCase to snake_case, deep. Values are never touched. */
46
+ export function toSnake(value) {
47
+ return renameKeys(value, snakeCase);
48
+ }
49
+ function renameKeys(value, rename) {
50
+ if (Array.isArray(value)) {
51
+ return value.map((item) => renameKeys(item, rename));
52
+ }
53
+ if (value === null || typeof value !== "object") {
54
+ return value;
55
+ }
56
+ const renamed = {};
57
+ for (const [key, inner] of Object.entries(value)) {
58
+ renamed[rename(key)] = OPAQUE_KEYS.has(key) ? inner : renameKeys(inner, rename);
59
+ }
60
+ return renamed;
61
+ }
62
+ function camelCase(key) {
63
+ return key.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
64
+ }
65
+ function snakeCase(key) {
66
+ return key.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
67
+ }
@@ -0,0 +1,423 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Declare or change what the agent is: voice, models, language, greeting, the full tool list. Only
4
+ * the fields sent change.
5
+ */
6
+ export declare const AgentConfigureSchema: z.ZodObject<{
7
+ config: z.ZodObject<{
8
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
9
+ name: z.ZodString;
10
+ region: z.ZodEnum<{
11
+ static: "static";
12
+ dynamic: "dynamic";
13
+ }>;
14
+ }, z.core.$strict>>>>;
15
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
+ greeting: z.ZodOptional<z.ZodNullable<z.ZodObject<{
17
+ say: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ reply: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ allow_interruptions: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
20
+ }, z.core.$strict>>>;
21
+ voice: z.ZodOptional<z.ZodNullable<z.ZodObject<{
22
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
+ voice_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ }, z.core.$strict>>>;
27
+ llm: z.ZodOptional<z.ZodNullable<z.ZodObject<{
28
+ provider: z.ZodString;
29
+ model: z.ZodString;
30
+ temperature: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
31
+ }, z.core.$strict>>>;
32
+ stt: z.ZodOptional<z.ZodNullable<z.ZodObject<{
33
+ provider: z.ZodString;
34
+ model: z.ZodString;
35
+ temperature: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
36
+ }, z.core.$strict>>>;
37
+ turn: z.ZodOptional<z.ZodNullable<z.ZodObject<{
38
+ min_interruption_words: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
39
+ endpointing_ms: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
40
+ }, z.core.$strict>>>;
41
+ says: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
42
+ word: z.ZodString;
43
+ spoken: z.ZodString;
44
+ }, z.core.$strict>>>>;
45
+ hears: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
46
+ knowledge: z.ZodOptional<z.ZodNullable<z.ZodObject<{
47
+ path: z.ZodString;
48
+ text: z.ZodString;
49
+ }, z.core.$strict>>>;
50
+ docs: z.ZodOptional<z.ZodNullable<z.ZodObject<{
51
+ base: z.ZodString;
52
+ mode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
53
+ retrieved: "retrieved";
54
+ tool: "tool";
55
+ }>>>;
56
+ k: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
57
+ min_score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
58
+ }, z.core.$strict>>>;
59
+ memory: z.ZodOptional<z.ZodNullable<z.ZodObject<{
60
+ remember: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
61
+ forget: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
62
+ }, z.core.$strict>>>;
63
+ hangup: z.ZodOptional<z.ZodNullable<z.ZodObject<{
64
+ when: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ }, z.core.$strict>>>;
66
+ tools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
67
+ name: z.ZodString;
68
+ description: z.ZodString;
69
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
70
+ side_effect: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
71
+ read: "read";
72
+ write: "write";
73
+ irreversible: "irreversible";
74
+ }>>>;
75
+ confirm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
+ pii: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
77
+ timeout_s: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
78
+ }, z.core.$strict>>>>;
79
+ state_fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
80
+ name: z.ZodString;
81
+ visibility: z.ZodEnum<{
82
+ public: "public";
83
+ tenant: "tenant";
84
+ pii: "pii";
85
+ }>;
86
+ }, z.core.$strict>>>>;
87
+ events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
88
+ name: z.ZodString;
89
+ from: z.ZodArray<z.ZodEnum<{
90
+ app: "app";
91
+ participant: "participant";
92
+ }>>;
93
+ }, z.core.$strict>>>>;
94
+ }, z.core.$strict>;
95
+ }, z.core.$strict>;
96
+ export type AgentConfigure = z.infer<typeof AgentConfigureSchema>;
97
+ /**
98
+ * The app's first message: this socket speaks for this agent and answers these doors. The gateway
99
+ * answers agent.registered, or error.
100
+ */
101
+ export declare const AgentRegisterSchema: z.ZodObject<{
102
+ routes: z.ZodArray<z.ZodObject<{
103
+ channel: z.ZodEnum<{
104
+ phone: "phone";
105
+ web: "web";
106
+ whatsapp: "whatsapp";
107
+ }>;
108
+ number: z.ZodNullable<z.ZodString>;
109
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
+ }, z.core.$strict>>;
111
+ sdk: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
+ takes_unclaimed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
113
+ }, z.core.$strict>;
114
+ export type AgentRegister = z.infer<typeof AgentRegisterSchema>;
115
+ /**
116
+ * Make the model speak now, guided by an instruction it reads and the caller never hears: 'tell
117
+ * them a slot at 10:15 just opened'. On livekit's session.generate_reply; the sibling of
118
+ * agent.say, which speaks verbatim. The reply lands as turn.agent.
119
+ */
120
+ export declare const AgentReplySchema: z.ZodObject<{
121
+ instructions: z.ZodString;
122
+ allow_interruptions: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
123
+ }, z.core.$strict>;
124
+ export type AgentReply = z.infer<typeof AgentReplySchema>;
125
+ /**
126
+ * Make the agent say this text now, verbatim, outside the model's turn: a greeting, a read-back, a
127
+ * system notice. The reply lands as turn.agent.
128
+ */
129
+ export declare const AgentSaySchema: z.ZodObject<{
130
+ text: z.ZodString;
131
+ allow_interruptions: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
132
+ }, z.core.$strict>;
133
+ export type AgentSay = z.infer<typeof AgentSaySchema>;
134
+ /**
135
+ * Place an outbound call as this agent. The new call's log opens with call.dialing; call.started
136
+ * follows when the far end answers.
137
+ */
138
+ export declare const CallDialSchema: z.ZodObject<{
139
+ to: z.ZodString;
140
+ from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ caller: z.ZodOptional<z.ZodNullable<z.ZodObject<{
142
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
+ external_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
147
+ }, z.core.$strict>>>;
148
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
149
+ }, z.core.$strict>;
150
+ export type CallDial = z.infer<typeof CallDialSchema>;
151
+ /** Send touch tones down the line, for an IVR on the far end. */
152
+ export declare const CallDtmfSchema: z.ZodObject<{
153
+ digits: z.ZodString;
154
+ }, z.core.$strict>;
155
+ export type CallDtmf = z.infer<typeof CallDtmfSchema>;
156
+ /**
157
+ * Hand the agent a fact from the tenant's backend: a slot freed, an order shipped, a payment
158
+ * confirmed. Lands as event.received with source app. The agent must have declared the name in its
159
+ * events with app among the senders, or the gateway answers error and nothing touches the log.
160
+ */
161
+ export declare const CallEventSchema: z.ZodObject<{
162
+ name: z.ZodString;
163
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
164
+ }, z.core.$strict>;
165
+ export type CallEvent = z.infer<typeof CallEventSchema>;
166
+ /** End the call from the app's side. call.ended follows with reason agent_hung_up. */
167
+ export declare const CallHangupSchema: z.ZodObject<{
168
+ reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
169
+ }, z.core.$strict>;
170
+ export type CallHangup = z.infer<typeof CallHangupSchema>;
171
+ /** Put the caller on hold: they hear hold audio, the agent hears nothing. */
172
+ export declare const CallHoldSchema: z.ZodObject<{}, z.core.$strict>;
173
+ export type CallHold = z.infer<typeof CallHoldSchema>;
174
+ /**
175
+ * Write a line of the app's own into the call's log. It gets a seq like everything else and lands
176
+ * as custom.
177
+ */
178
+ export declare const CallLogSchema: z.ZodObject<{
179
+ name: z.ZodString;
180
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
181
+ }, z.core.$strict>;
182
+ export type CallLog = z.infer<typeof CallLogSchema>;
183
+ /** Mute the agent: it keeps listening and thinking, produces no audio. */
184
+ export declare const CallMuteSchema: z.ZodObject<{}, z.core.$strict>;
185
+ export type CallMute = z.infer<typeof CallMuteSchema>;
186
+ /** Send the caller to another number. call.transferred says whether it worked. */
187
+ export declare const CallTransferSchema: z.ZodObject<{
188
+ to: z.ZodString;
189
+ mode: z.ZodEnum<{
190
+ cold: "cold";
191
+ warm: "warm";
192
+ }>;
193
+ }, z.core.$strict>;
194
+ export type CallTransfer = z.infer<typeof CallTransferSchema>;
195
+ /** Take the caller off hold. */
196
+ export declare const CallUnholdSchema: z.ZodObject<{}, z.core.$strict>;
197
+ export type CallUnhold = z.infer<typeof CallUnholdSchema>;
198
+ /** Unmute the agent. */
199
+ export declare const CallUnmuteSchema: z.ZodObject<{}, z.core.$strict>;
200
+ export type CallUnmute = z.infer<typeof CallUnmuteSchema>;
201
+ /**
202
+ * Why the verb did not run, in the words the console shows: the status it travels under, and the
203
+ * sentence.
204
+ */
205
+ export declare const DevRefusalSchema: z.ZodObject<{
206
+ status: z.ZodInt;
207
+ detail: z.ZodString;
208
+ }, z.core.$strict>;
209
+ export type DevRefusal = z.infer<typeof DevRefusalSchema>;
210
+ /** What came of one dev.request, named by its id. */
211
+ export declare const DevAnswerSchema: z.ZodObject<{
212
+ id: z.ZodString;
213
+ result: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
214
+ refused: z.ZodOptional<z.ZodNullable<z.ZodObject<{
215
+ status: z.ZodInt;
216
+ detail: z.ZodString;
217
+ }, z.core.$strict>>>;
218
+ }, z.core.$strict>;
219
+ export type DevAnswer = z.infer<typeof DevAnswerSchema>;
220
+ /**
221
+ * Silence a participant for the rest of the call: their audio leaves the room, for everyone in it.
222
+ * Lands as track.unpublished for their microphone. There is no unmute; a leg that must speak again
223
+ * is invited again.
224
+ */
225
+ export declare const ParticipantMuteSchema: z.ZodObject<{
226
+ identity: z.ZodString;
227
+ }, z.core.$strict>;
228
+ export type ParticipantMute = z.infer<typeof ParticipantMuteSchema>;
229
+ /**
230
+ * Put a participant out of the room. Lands as participant.left with reason participant_removed.
231
+ * Removing the caller ends the call.
232
+ */
233
+ export declare const ParticipantRemoveSchema: z.ZodObject<{
234
+ identity: z.ZodString;
235
+ }, z.core.$strict>;
236
+ export type ParticipantRemove = z.infer<typeof ParticipantRemoveSchema>;
237
+ /** Is the socket alive? The gateway answers pong. */
238
+ export declare const PingSchema: z.ZodObject<{}, z.core.$strict>;
239
+ export type Ping = z.infer<typeof PingSchema>;
240
+ /**
241
+ * Rewrite one block of the prompt, whole, by name. The name must be one of the agent's declared
242
+ * blocks, or one of the default four; anything else is refused with the name.
243
+ */
244
+ export declare const PromptSetSchema: z.ZodObject<{
245
+ name: z.ZodString;
246
+ text: z.ZodString;
247
+ }, z.core.$strict>;
248
+ export type PromptSet = z.infer<typeof PromptSetSchema>;
249
+ /**
250
+ * Bring somebody else into the call's room. A second SIP leg dialed to a number is the warm path:
251
+ * the agent stays on with the caller while the other side answers. Lands as participant.joined
252
+ * when they arrive, or error when they do not.
253
+ */
254
+ export declare const RoomInviteSchema: z.ZodObject<{
255
+ to: z.ZodString;
256
+ kind: z.ZodEnum<{
257
+ sip: "sip";
258
+ participant: "participant";
259
+ }>;
260
+ }, z.core.$strict>;
261
+ export type RoomInvite = z.infer<typeof RoomInviteSchema>;
262
+ /**
263
+ * Push a payload to a browser in the room over the DataChannel: a card to render, a form to open.
264
+ * Lands as room.sent with the size, never the payload. The widget listens on pinecall.ui; a topic
265
+ * of the tenant's own reaches the tenant's own page code.
266
+ */
267
+ export declare const RoomSendSchema: z.ZodObject<{
268
+ topic: z.ZodString;
269
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
270
+ to: z.ZodOptional<z.ZodNullable<z.ZodString>>;
271
+ }, z.core.$strict>;
272
+ export type RoomSend = z.infer<typeof RoomSendSchema>;
273
+ /**
274
+ * Set up this one call before the first turn: the app's initial state, and any config that differs
275
+ * from the agent's defaults for this caller.
276
+ */
277
+ export declare const SessionConfigureSchema: z.ZodObject<{
278
+ state: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
279
+ config: z.ZodOptional<z.ZodNullable<z.ZodObject<{
280
+ prompt: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
281
+ name: z.ZodString;
282
+ region: z.ZodEnum<{
283
+ static: "static";
284
+ dynamic: "dynamic";
285
+ }>;
286
+ }, z.core.$strict>>>>;
287
+ language: z.ZodOptional<z.ZodNullable<z.ZodString>>;
288
+ greeting: z.ZodOptional<z.ZodNullable<z.ZodObject<{
289
+ say: z.ZodOptional<z.ZodNullable<z.ZodString>>;
290
+ reply: z.ZodOptional<z.ZodNullable<z.ZodString>>;
291
+ allow_interruptions: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
292
+ }, z.core.$strict>>>;
293
+ voice: z.ZodOptional<z.ZodNullable<z.ZodObject<{
294
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
295
+ provider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
296
+ model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
+ voice_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
298
+ }, z.core.$strict>>>;
299
+ llm: z.ZodOptional<z.ZodNullable<z.ZodObject<{
300
+ provider: z.ZodString;
301
+ model: z.ZodString;
302
+ temperature: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
303
+ }, z.core.$strict>>>;
304
+ stt: z.ZodOptional<z.ZodNullable<z.ZodObject<{
305
+ provider: z.ZodString;
306
+ model: z.ZodString;
307
+ temperature: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
308
+ }, z.core.$strict>>>;
309
+ turn: z.ZodOptional<z.ZodNullable<z.ZodObject<{
310
+ min_interruption_words: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
311
+ endpointing_ms: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
312
+ }, z.core.$strict>>>;
313
+ says: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
314
+ word: z.ZodString;
315
+ spoken: z.ZodString;
316
+ }, z.core.$strict>>>>;
317
+ hears: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
318
+ knowledge: z.ZodOptional<z.ZodNullable<z.ZodObject<{
319
+ path: z.ZodString;
320
+ text: z.ZodString;
321
+ }, z.core.$strict>>>;
322
+ docs: z.ZodOptional<z.ZodNullable<z.ZodObject<{
323
+ base: z.ZodString;
324
+ mode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
325
+ retrieved: "retrieved";
326
+ tool: "tool";
327
+ }>>>;
328
+ k: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
329
+ min_score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
330
+ }, z.core.$strict>>>;
331
+ memory: z.ZodOptional<z.ZodNullable<z.ZodObject<{
332
+ remember: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
333
+ forget: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
334
+ }, z.core.$strict>>>;
335
+ hangup: z.ZodOptional<z.ZodNullable<z.ZodObject<{
336
+ when: z.ZodOptional<z.ZodNullable<z.ZodString>>;
337
+ }, z.core.$strict>>>;
338
+ tools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
339
+ name: z.ZodString;
340
+ description: z.ZodString;
341
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
342
+ side_effect: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
343
+ read: "read";
344
+ write: "write";
345
+ irreversible: "irreversible";
346
+ }>>>;
347
+ confirm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
348
+ pii: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
349
+ timeout_s: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
350
+ }, z.core.$strict>>>>;
351
+ state_fields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
352
+ name: z.ZodString;
353
+ visibility: z.ZodEnum<{
354
+ public: "public";
355
+ tenant: "tenant";
356
+ pii: "pii";
357
+ }>;
358
+ }, z.core.$strict>>>>;
359
+ events: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
360
+ name: z.ZodString;
361
+ from: z.ZodArray<z.ZodEnum<{
362
+ app: "app";
363
+ participant: "participant";
364
+ }>>;
365
+ }, z.core.$strict>>>>;
366
+ }, z.core.$strict>>>;
367
+ }, z.core.$strict>;
368
+ export type SessionConfigure = z.infer<typeof SessionConfigureSchema>;
369
+ /** The app's state changed and this is all of it. The platform logs state.changed and re-renders. */
370
+ export declare const StateSetSchema: z.ZodObject<{
371
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
372
+ changed: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
373
+ }, z.core.$strict>;
374
+ export type StateSet = z.infer<typeof StateSetSchema>;
375
+ /** One supervise verb, from the human the door named. */
376
+ export declare const SupervisorVerbSchema: z.ZodObject<{
377
+ by: z.ZodObject<{
378
+ id: z.ZodString;
379
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
380
+ }, z.core.$strict>;
381
+ verb: z.ZodDiscriminatedUnion<[z.ZodObject<{
382
+ verb: z.ZodLiteral<"say">;
383
+ text: z.ZodString;
384
+ }, z.core.$strict>, z.ZodObject<{
385
+ verb: z.ZodLiteral<"whisper">;
386
+ text: z.ZodString;
387
+ }, z.core.$strict>, z.ZodObject<{
388
+ verb: z.ZodLiteral<"takeover">;
389
+ }, z.core.$strict>, z.ZodObject<{
390
+ verb: z.ZodLiteral<"release">;
391
+ }, z.core.$strict>, z.ZodObject<{
392
+ verb: z.ZodLiteral<"transfer">;
393
+ to: z.ZodString;
394
+ mode: z.ZodEnum<{
395
+ cold: "cold";
396
+ warm: "warm";
397
+ }>;
398
+ }, z.core.$strict>, z.ZodObject<{
399
+ verb: z.ZodLiteral<"end">;
400
+ reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
401
+ }, z.core.$strict>], "verb">;
402
+ }, z.core.$strict>;
403
+ export type SupervisorVerb = z.infer<typeof SupervisorVerbSchema>;
404
+ /**
405
+ * The tools the model may see now. The full list was declared in agent.configure; this is the
406
+ * subset whose when allows them in this state.
407
+ */
408
+ export declare const ToolsSetSchema: z.ZodObject<{
409
+ tools: z.ZodArray<z.ZodObject<{
410
+ name: z.ZodString;
411
+ description: z.ZodString;
412
+ parameters: z.ZodRecord<z.ZodString, z.ZodUnknown>;
413
+ side_effect: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
414
+ read: "read";
415
+ write: "write";
416
+ irreversible: "irreversible";
417
+ }>>>;
418
+ confirm: z.ZodOptional<z.ZodNullable<z.ZodString>>;
419
+ pii: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
420
+ timeout_s: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
421
+ }, z.core.$strict>>;
422
+ }, z.core.$strict>;
423
+ export type ToolsSet = z.infer<typeof ToolsSetSchema>;