@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.
- package/LICENSE +202 -0
- package/dist/fixtures/call-log-golden.json +127 -0
- package/dist/fixtures/call-log-golden.state.json +39 -0
- package/dist/generated/codec.d.ts +53 -0
- package/dist/generated/codec.js +67 -0
- package/dist/generated/commands.d.ts +423 -0
- package/dist/generated/commands.js +168 -0
- package/dist/generated/defs.d.ts +604 -0
- package/dist/generated/defs.js +328 -0
- package/dist/generated/envelope.d.ts +27 -0
- package/dist/generated/envelope.js +26 -0
- package/dist/generated/events.d.ts +1234 -0
- package/dist/generated/events.js +388 -0
- package/dist/generated/index.d.ts +12 -0
- package/dist/generated/index.js +13 -0
- package/dist/generated/metrics.d.ts +386 -0
- package/dist/generated/metrics.js +268 -0
- package/dist/generated/registry.d.ts +1591 -0
- package/dist/generated/registry.js +130 -0
- package/dist/generated/rest.d.ts +1031 -0
- package/dist/generated/rest.js +291 -0
- package/dist/generated/room.d.ts +111 -0
- package/dist/generated/room.js +72 -0
- package/dist/generated/state.d.ts +902 -0
- package/dist/generated/state.js +179 -0
- package/dist/generated/units.d.ts +2 -0
- package/dist/generated/units.js +80 -0
- package/dist/generated/verbs.d.ts +77 -0
- package/dist/generated/verbs.js +49 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/reduce.d.ts +10 -0
- package/dist/reduce.js +352 -0
- package/package.json +38 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
// Generated from schema/rest.json: the envelopes the read doors answer in. Never edited by hand.
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ChannelSchema, ContactSchema, CostSchema, DirectionSchema, EndReasonSchema, EnvSchema, KnowledgeFileSchema, PlatformToolSchema, } from "./defs.js";
|
|
4
|
+
import { EntrySchema } from "./envelope.js";
|
|
5
|
+
import { CallStatusSchema, StateSchema } from "./state.js";
|
|
6
|
+
/** GET /v1/calls/{call}/state: the whole log folded, and the seq a stream resumes from. */
|
|
7
|
+
export const CallStateSchema = z.strictObject({
|
|
8
|
+
state: StateSchema,
|
|
9
|
+
last_seq: z.int(),
|
|
10
|
+
live: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
/** One page of a log: what this reader may see, whether the log is open, and where to resume. */
|
|
13
|
+
export const LogPageSchema = z.strictObject({
|
|
14
|
+
entries: z.array(EntrySchema),
|
|
15
|
+
live: z.boolean(),
|
|
16
|
+
next: z.int().nullable(),
|
|
17
|
+
});
|
|
18
|
+
/** One call as a list draws it: which call, how far the log got, and the state's own fields. */
|
|
19
|
+
export const SessionLineSchema = z.strictObject({
|
|
20
|
+
call: z.string(),
|
|
21
|
+
agent: z.string(),
|
|
22
|
+
live: z.boolean(),
|
|
23
|
+
last_seq: z.int(),
|
|
24
|
+
status: CallStatusSchema,
|
|
25
|
+
channel: ChannelSchema.nullable(),
|
|
26
|
+
direction: DirectionSchema.nullable(),
|
|
27
|
+
from: z.string().nullable(),
|
|
28
|
+
to: z.string().nullable(),
|
|
29
|
+
caller: ContactSchema.nullable(),
|
|
30
|
+
started_at: z.number().nullable(),
|
|
31
|
+
ended_at: z.number().nullable(),
|
|
32
|
+
end_reason: EndReasonSchema.nullable(),
|
|
33
|
+
outcome: z.string().nullable(),
|
|
34
|
+
cost: CostSchema.nullable(),
|
|
35
|
+
});
|
|
36
|
+
/** GET /v1/agents/{slug}/sessions: which calls that agent handled, newest first. */
|
|
37
|
+
export const SessionListSchema = z.strictObject({
|
|
38
|
+
calls: z.array(SessionLineSchema),
|
|
39
|
+
});
|
|
40
|
+
/** One corner of a world holding an agent: the member whose it is, named so a person can read it. */
|
|
41
|
+
export const LineHolderSchema = z.strictObject({
|
|
42
|
+
holder: z.string().nullable(),
|
|
43
|
+
name: z.string().nullable(),
|
|
44
|
+
});
|
|
45
|
+
/** One agent, as somebody choosing which to open needs to see it: its name and its channels. */
|
|
46
|
+
export const HeldAgentSchema = z.strictObject({
|
|
47
|
+
slug: z.string(),
|
|
48
|
+
channels: z.array(ChannelSchema),
|
|
49
|
+
holder: LineHolderSchema.nullish(),
|
|
50
|
+
});
|
|
51
|
+
/** GET /v1/agents: every agent this fleet is holding right now, as the front page lists them. */
|
|
52
|
+
export const AgentListSchema = z.strictObject({
|
|
53
|
+
agents: z.array(HeldAgentSchema),
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* GET /v1/agents/{slug}/line: whose terminal a call that RINGS at this agent's doors lands in. An
|
|
57
|
+
* org shares one sandbox number, so it rings in one place and which one is claimed.
|
|
58
|
+
*/
|
|
59
|
+
export const TheLineSchema = z.strictObject({
|
|
60
|
+
agent: z.string(),
|
|
61
|
+
env: EnvSchema,
|
|
62
|
+
held: z.boolean(),
|
|
63
|
+
holding: LineHolderSchema.nullish(),
|
|
64
|
+
yours: z.boolean(),
|
|
65
|
+
waiting: z.array(LineHolderSchema),
|
|
66
|
+
calling: z.array(z.string()),
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* PUT /v1/knowledge/{base}, the body: the tenant's folder as of now, sent whole. The base is
|
|
70
|
+
* replaced, never merged.
|
|
71
|
+
*/
|
|
72
|
+
export const KnowledgePushSchema = z.strictObject({
|
|
73
|
+
files: z.array(KnowledgeFileSchema),
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* One question of a base's golden: what somebody asks, and the chunk that should answer it. A
|
|
77
|
+
* chunk answers when its file and heading path start with `expects`, so naming a file alone
|
|
78
|
+
* accepts any chunk of it and naming a heading accepts that section.
|
|
79
|
+
*/
|
|
80
|
+
export const GoldenQuestionSchema = z.strictObject({
|
|
81
|
+
asks: z.string(),
|
|
82
|
+
expects: z.string(),
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* POST /v1/knowledge/{base}/eval, the body: the questions a base is held to. A golden is fixed and
|
|
86
|
+
* the index is the variable; a question is never softened so a change can pass.
|
|
87
|
+
*/
|
|
88
|
+
export const KnowledgeGoldenSchema = z.strictObject({
|
|
89
|
+
questions: z.array(GoldenQuestionSchema),
|
|
90
|
+
k: z.int().nullish(),
|
|
91
|
+
});
|
|
92
|
+
/** One question whose expected chunk was not among the k returned, and what came back instead. */
|
|
93
|
+
export const GoldenMissSchema = z.strictObject({
|
|
94
|
+
asks: z.string(),
|
|
95
|
+
expects: z.string(),
|
|
96
|
+
found: z.array(z.string()),
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* POST /v1/knowledge/{base}/eval, the answer: how the index did on its own golden. Both figures
|
|
100
|
+
* are computed by code, with no model, so two runs of the same golden over the same base answer
|
|
101
|
+
* the same numbers.
|
|
102
|
+
*/
|
|
103
|
+
export const KnowledgeScoreSchema = z.strictObject({
|
|
104
|
+
base: z.string(),
|
|
105
|
+
model: z.string(),
|
|
106
|
+
questions: z.int(),
|
|
107
|
+
k: z.int(),
|
|
108
|
+
recall_at_k: z.number(),
|
|
109
|
+
ndcg_at_10: z.number(),
|
|
110
|
+
took_ms: z.number(),
|
|
111
|
+
misses: z.array(GoldenMissSchema),
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* PUT /v1/knowledge/{base}, the answer: which base, how many chunks it became, and how long that
|
|
115
|
+
* took.
|
|
116
|
+
*/
|
|
117
|
+
export const KnowledgePushedSchema = z.strictObject({
|
|
118
|
+
base: z.string(),
|
|
119
|
+
chunks: z.int(),
|
|
120
|
+
took_ms: z.number(),
|
|
121
|
+
});
|
|
122
|
+
/** One knowledge base as the list draws it: its name, its size, and when it was last pushed. */
|
|
123
|
+
export const KnowledgeBaseSchema = z.strictObject({
|
|
124
|
+
base: z.string(),
|
|
125
|
+
chunks: z.int(),
|
|
126
|
+
model: z.string(),
|
|
127
|
+
pushed_at: z.number(),
|
|
128
|
+
});
|
|
129
|
+
/** GET /v1/knowledge: every base this org has pushed. */
|
|
130
|
+
export const KnowledgeListSchema = z.strictObject({
|
|
131
|
+
bases: z.array(KnowledgeBaseSchema),
|
|
132
|
+
});
|
|
133
|
+
/**
|
|
134
|
+
* One fact of a contact's history: a MemoryFact with the two dates that bound it. A fact is never
|
|
135
|
+
* deleted, only superseded, so the history keeps every version.
|
|
136
|
+
*/
|
|
137
|
+
export const ContactFactSchema = z.strictObject({
|
|
138
|
+
id: z.string().nullish(),
|
|
139
|
+
text: z.string(),
|
|
140
|
+
category: z.string().nullish(),
|
|
141
|
+
source: z.string().nullish(),
|
|
142
|
+
valid_from: z.number(),
|
|
143
|
+
invalidated_at: z.number().nullable(),
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* GET /v1/contacts/{contact}/memory: everything memory ever kept about one contact, current facts
|
|
147
|
+
* first.
|
|
148
|
+
*/
|
|
149
|
+
export const ContactMemorySchema = z.strictObject({
|
|
150
|
+
facts: z.array(ContactFactSchema),
|
|
151
|
+
});
|
|
152
|
+
/**
|
|
153
|
+
* DELETE /v1/contacts/{contact}/memory, the answer: how many facts the right to be forgotten
|
|
154
|
+
* erased.
|
|
155
|
+
*/
|
|
156
|
+
export const ForgottenSchema = z.strictObject({
|
|
157
|
+
forgotten: z.int(),
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* One question of a memory golden: what memory holds about the contact who asks it, the words they
|
|
161
|
+
* just said, and the fact or facts that should come back. The facts are the question's own, so a
|
|
162
|
+
* golden needs no contact in any table.
|
|
163
|
+
*/
|
|
164
|
+
export const MemoryQuestionSchema = z.strictObject({
|
|
165
|
+
holds: z.array(z.string()),
|
|
166
|
+
asks: z.string(),
|
|
167
|
+
expects: z.array(z.string()),
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* POST /v1/contacts/memory/eval, the body: the questions memory is held to. Each question brings
|
|
171
|
+
* its own facts, which are written to a scratch contact of this org, asked, and deleted. A golden
|
|
172
|
+
* is fixed and the ranking is the variable; a question is never softened so a change can pass.
|
|
173
|
+
*/
|
|
174
|
+
export const MemoryGoldenSchema = z.strictObject({
|
|
175
|
+
questions: z.array(MemoryQuestionSchema),
|
|
176
|
+
k: z.int().nullish(),
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* One question memory did not answer whole: what it wanted and did not get, and what came back
|
|
180
|
+
* instead. GoldenMiss is the knowledge base's and names the one chunk that should have won; a
|
|
181
|
+
* memory question may expect several facts and miss some of them.
|
|
182
|
+
*/
|
|
183
|
+
export const MemoryMissSchema = z.strictObject({
|
|
184
|
+
asks: z.string(),
|
|
185
|
+
missing: z.array(z.string()),
|
|
186
|
+
found: z.array(z.string()),
|
|
187
|
+
});
|
|
188
|
+
/**
|
|
189
|
+
* POST /v1/contacts/memory/eval, the answer: how memory ranked the facts its own golden asked for.
|
|
190
|
+
* Both figures are computed by code, with no model in the loop, so two runs of one golden answer
|
|
191
|
+
* the same numbers.
|
|
192
|
+
*/
|
|
193
|
+
export const MemoryScoreSchema = z.strictObject({
|
|
194
|
+
model: z.string(),
|
|
195
|
+
questions: z.int(),
|
|
196
|
+
k: z.int(),
|
|
197
|
+
recall_at_k: z.number(),
|
|
198
|
+
ndcg_at_10: z.number(),
|
|
199
|
+
took_ms: z.number(),
|
|
200
|
+
misses: z.array(MemoryMissSchema),
|
|
201
|
+
});
|
|
202
|
+
/**
|
|
203
|
+
* What must come of one call's hang-up: each field is one of the four ways a hang-up costs a
|
|
204
|
+
* business. Nothing here compares one sentence to another — a category is the class's own word, a
|
|
205
|
+
* value is a literal the caller said out loud, and a supersession is an id — because two ways of
|
|
206
|
+
* writing one fact are one fact.
|
|
207
|
+
*/
|
|
208
|
+
export const ExtractionExpectedSchema = z.strictObject({
|
|
209
|
+
writes: z.array(z.string()).nullish(),
|
|
210
|
+
never: z.array(z.string()).nullish(),
|
|
211
|
+
never_says: z.array(z.string()).nullish(),
|
|
212
|
+
invalidates: z.array(z.string()).nullish(),
|
|
213
|
+
});
|
|
214
|
+
/**
|
|
215
|
+
* One call written down and what memory must make of it: the write side of the table, judged by
|
|
216
|
+
* code. The read side is MemoryGolden and neither answers for the other — a call may extract the
|
|
217
|
+
* perfect fact and never see it again, because six is what a turn is handed and the seventh is
|
|
218
|
+
* cut.
|
|
219
|
+
*/
|
|
220
|
+
export const ExtractionGoldenSchema = z.strictObject({
|
|
221
|
+
name: z.string(),
|
|
222
|
+
said: z.array(z.tuple([z.string(), z.string()])),
|
|
223
|
+
holds: z.array(z.string()).nullish(),
|
|
224
|
+
plants: z.array(z.string()).nullish(),
|
|
225
|
+
channel: ChannelSchema.nullish(),
|
|
226
|
+
expect: ExtractionExpectedSchema.nullish(),
|
|
227
|
+
});
|
|
228
|
+
/**
|
|
229
|
+
* POST /v1/agents/{slug}/memory/extraction, the body: the goldens whole, as the tenant wrote them
|
|
230
|
+
* down. Each costs ONE model call — the very one a hang-up makes — run on the org's own model and
|
|
231
|
+
* keys against the class the caller is holding.
|
|
232
|
+
*/
|
|
233
|
+
export const ExtractionCasesSchema = z.strictObject({
|
|
234
|
+
cases: z.array(ExtractionGoldenSchema),
|
|
235
|
+
});
|
|
236
|
+
/**
|
|
237
|
+
* One thing that did not hold about a case: which of the questions, and the evidence in a sentence
|
|
238
|
+
* a person can act on.
|
|
239
|
+
*/
|
|
240
|
+
export const ExtractionBrokeSchema = z.strictObject({
|
|
241
|
+
check: z.string(),
|
|
242
|
+
detail: z.string(),
|
|
243
|
+
});
|
|
244
|
+
/** One case, run: what memory would have kept, what admission refused, and what did not hold. */
|
|
245
|
+
export const ExtractionJudgedSchema = z.strictObject({
|
|
246
|
+
name: z.string(),
|
|
247
|
+
held: z.boolean(),
|
|
248
|
+
wrote: z.array(z.string()).nullish(),
|
|
249
|
+
refused: z.array(z.string()).nullish(),
|
|
250
|
+
broke: z.array(ExtractionBrokeSchema).nullish(),
|
|
251
|
+
});
|
|
252
|
+
/**
|
|
253
|
+
* POST /v1/agents/{slug}/memory/extraction, the answer: which model answered, how many cases held,
|
|
254
|
+
* and every one of them. A verb prints this and a pipeline exits on it.
|
|
255
|
+
*/
|
|
256
|
+
export const ExtractionRunSchema = z.strictObject({
|
|
257
|
+
agent: z.string(),
|
|
258
|
+
model: z.string(),
|
|
259
|
+
cases: z.int(),
|
|
260
|
+
held: z.int(),
|
|
261
|
+
took_ms: z.number(),
|
|
262
|
+
results: z.array(ExtractionJudgedSchema),
|
|
263
|
+
});
|
|
264
|
+
/**
|
|
265
|
+
* POST /v1/calls/{call}/lookup, the body: which platform tool to run for this turn, and what to
|
|
266
|
+
* run it with. Worker-only; the gateway runs it against its own stores and writes memory.ops or
|
|
267
|
+
* docs.sources on the call's log itself.
|
|
268
|
+
*/
|
|
269
|
+
export const LookupRequestSchema = z.strictObject({
|
|
270
|
+
tool: PlatformToolSchema,
|
|
271
|
+
input: z.record(z.string(), z.unknown()),
|
|
272
|
+
speech_id: z.string().nullish(),
|
|
273
|
+
});
|
|
274
|
+
/**
|
|
275
|
+
* POST /v1/calls/{call}/lookup, the answer: what the tool found, and how long finding it took. The
|
|
276
|
+
* output is JSON-encoded into a tool_result block, which is where everything from outside the
|
|
277
|
+
* conversation goes and the only place it goes.
|
|
278
|
+
*/
|
|
279
|
+
export const LookupResultSchema = z.strictObject({
|
|
280
|
+
output: z.record(z.string(), z.unknown()),
|
|
281
|
+
took_ms: z.number(),
|
|
282
|
+
});
|
|
283
|
+
/**
|
|
284
|
+
* POST /v1/calls/{call}/remember, the answer: what the call taught about the contact, counted.
|
|
285
|
+
* Worker-only; the body is empty, the gateway reads the turns off its own log and writes
|
|
286
|
+
* memory.ops itself.
|
|
287
|
+
*/
|
|
288
|
+
export const RememberedSchema = z.strictObject({
|
|
289
|
+
ops: z.int(),
|
|
290
|
+
took_ms: z.number(),
|
|
291
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The LiveKit room exists and the call lives in it. Phone and web calls have one; a text session
|
|
4
|
+
* has no room and never logs this.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RoomOpenedSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
sid: z.ZodString;
|
|
9
|
+
channel: z.ZodEnum<{
|
|
10
|
+
phone: "phone";
|
|
11
|
+
web: "web";
|
|
12
|
+
whatsapp: "whatsapp";
|
|
13
|
+
}>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type RoomOpened = z.infer<typeof RoomOpenedSchema>;
|
|
16
|
+
/**
|
|
17
|
+
* Somebody joined the room: the caller over SIP or the widget, the agent, a supervisor, a
|
|
18
|
+
* listener, or a second SIP leg. Their attributes travel verbatim: the caller's number is a fact
|
|
19
|
+
* of the room, not a field we invent.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ParticipantJoinedSchema: z.ZodObject<{
|
|
22
|
+
identity: z.ZodString;
|
|
23
|
+
kind: z.ZodEnum<{
|
|
24
|
+
agent: "agent";
|
|
25
|
+
caller: "caller";
|
|
26
|
+
supervisor: "supervisor";
|
|
27
|
+
listener: "listener";
|
|
28
|
+
sip: "sip";
|
|
29
|
+
}>;
|
|
30
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
attributes: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export type ParticipantJoined = z.infer<typeof ParticipantJoinedSchema>;
|
|
34
|
+
/** Somebody left the room. When it is the caller, call.ended follows. */
|
|
35
|
+
export declare const ParticipantLeftSchema: z.ZodObject<{
|
|
36
|
+
identity: z.ZodString;
|
|
37
|
+
reason: z.ZodString;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type ParticipantLeft = z.infer<typeof ParticipantLeftSchema>;
|
|
40
|
+
/**
|
|
41
|
+
* The room's own voice activity for one participant flipped. Ephemeral: it is a light for the
|
|
42
|
+
* console, and the turns say who spoke.
|
|
43
|
+
*/
|
|
44
|
+
export declare const ParticipantSpeakingSchema: z.ZodObject<{
|
|
45
|
+
identity: z.ZodString;
|
|
46
|
+
speaking: z.ZodBoolean;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
export type ParticipantSpeaking = z.infer<typeof ParticipantSpeakingSchema>;
|
|
49
|
+
/** A participant put a track on the room: their microphone, their camera, a screen. */
|
|
50
|
+
export declare const TrackPublishedSchema: z.ZodObject<{
|
|
51
|
+
identity: z.ZodString;
|
|
52
|
+
kind: z.ZodEnum<{
|
|
53
|
+
audio: "audio";
|
|
54
|
+
video: "video";
|
|
55
|
+
screen: "screen";
|
|
56
|
+
}>;
|
|
57
|
+
source: z.ZodEnum<{
|
|
58
|
+
unknown: "unknown";
|
|
59
|
+
microphone: "microphone";
|
|
60
|
+
camera: "camera";
|
|
61
|
+
screen_share: "screen_share";
|
|
62
|
+
screen_share_audio: "screen_share_audio";
|
|
63
|
+
}>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export type TrackPublished = z.infer<typeof TrackPublishedSchema>;
|
|
66
|
+
/**
|
|
67
|
+
* A participant's track left the room: they stopped sharing, or a participant.mute took their
|
|
68
|
+
* audio away.
|
|
69
|
+
*/
|
|
70
|
+
export declare const TrackUnpublishedSchema: z.ZodObject<{
|
|
71
|
+
identity: z.ZodString;
|
|
72
|
+
kind: z.ZodEnum<{
|
|
73
|
+
audio: "audio";
|
|
74
|
+
video: "video";
|
|
75
|
+
screen: "screen";
|
|
76
|
+
}>;
|
|
77
|
+
source: z.ZodEnum<{
|
|
78
|
+
unknown: "unknown";
|
|
79
|
+
microphone: "microphone";
|
|
80
|
+
camera: "camera";
|
|
81
|
+
screen_share: "screen_share";
|
|
82
|
+
screen_share_audio: "screen_share_audio";
|
|
83
|
+
}>;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
export type TrackUnpublished = z.infer<typeof TrackUnpublishedSchema>;
|
|
86
|
+
/**
|
|
87
|
+
* A fact arrived from outside the conversation: the tenant's backend sent call.event, or a
|
|
88
|
+
* participant's browser sent pinecall.event. One event for both, told apart by source. It reached
|
|
89
|
+
* the log only because the agent declared the name in its events, from that source; anything else
|
|
90
|
+
* was refused before this.
|
|
91
|
+
*/
|
|
92
|
+
export declare const EventReceivedSchema: z.ZodObject<{
|
|
93
|
+
name: z.ZodString;
|
|
94
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
95
|
+
source: z.ZodEnum<{
|
|
96
|
+
app: "app";
|
|
97
|
+
participant: "participant";
|
|
98
|
+
}>;
|
|
99
|
+
identity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
export type EventReceived = z.infer<typeof EventReceivedSchema>;
|
|
102
|
+
/**
|
|
103
|
+
* The agent pushed a payload to a browser in the room, on the tenant's room.send. Ephemeral, and
|
|
104
|
+
* the payload stays out of the log: the tenant chose what to send and to whom.
|
|
105
|
+
*/
|
|
106
|
+
export declare const RoomSentSchema: z.ZodObject<{
|
|
107
|
+
topic: z.ZodString;
|
|
108
|
+
to: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
|
+
bytes: z.ZodInt;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
export type RoomSent = z.infer<typeof RoomSentSchema>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Generated from schema/room.json: the room's facts and the outside world's. Never edited by hand.
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ChannelSchema, EventSourceSchema, ParticipantKindSchema, TrackKindSchema, TrackSourceSchema, } from "./defs.js";
|
|
4
|
+
/**
|
|
5
|
+
* The LiveKit room exists and the call lives in it. Phone and web calls have one; a text session
|
|
6
|
+
* has no room and never logs this.
|
|
7
|
+
*/
|
|
8
|
+
export const RoomOpenedSchema = z.strictObject({
|
|
9
|
+
name: z.string(),
|
|
10
|
+
sid: z.string(),
|
|
11
|
+
channel: ChannelSchema,
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Somebody joined the room: the caller over SIP or the widget, the agent, a supervisor, a
|
|
15
|
+
* listener, or a second SIP leg. Their attributes travel verbatim: the caller's number is a fact
|
|
16
|
+
* of the room, not a field we invent.
|
|
17
|
+
*/
|
|
18
|
+
export const ParticipantJoinedSchema = z.strictObject({
|
|
19
|
+
identity: z.string(),
|
|
20
|
+
kind: ParticipantKindSchema,
|
|
21
|
+
name: z.string().nullish(),
|
|
22
|
+
attributes: z.record(z.string(), z.unknown()),
|
|
23
|
+
});
|
|
24
|
+
/** Somebody left the room. When it is the caller, call.ended follows. */
|
|
25
|
+
export const ParticipantLeftSchema = z.strictObject({
|
|
26
|
+
identity: z.string(),
|
|
27
|
+
reason: z.string(),
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* The room's own voice activity for one participant flipped. Ephemeral: it is a light for the
|
|
31
|
+
* console, and the turns say who spoke.
|
|
32
|
+
*/
|
|
33
|
+
export const ParticipantSpeakingSchema = z.strictObject({
|
|
34
|
+
identity: z.string(),
|
|
35
|
+
speaking: z.boolean(),
|
|
36
|
+
});
|
|
37
|
+
/** A participant put a track on the room: their microphone, their camera, a screen. */
|
|
38
|
+
export const TrackPublishedSchema = z.strictObject({
|
|
39
|
+
identity: z.string(),
|
|
40
|
+
kind: TrackKindSchema,
|
|
41
|
+
source: TrackSourceSchema,
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* A participant's track left the room: they stopped sharing, or a participant.mute took their
|
|
45
|
+
* audio away.
|
|
46
|
+
*/
|
|
47
|
+
export const TrackUnpublishedSchema = z.strictObject({
|
|
48
|
+
identity: z.string(),
|
|
49
|
+
kind: TrackKindSchema,
|
|
50
|
+
source: TrackSourceSchema,
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* A fact arrived from outside the conversation: the tenant's backend sent call.event, or a
|
|
54
|
+
* participant's browser sent pinecall.event. One event for both, told apart by source. It reached
|
|
55
|
+
* the log only because the agent declared the name in its events, from that source; anything else
|
|
56
|
+
* was refused before this.
|
|
57
|
+
*/
|
|
58
|
+
export const EventReceivedSchema = z.strictObject({
|
|
59
|
+
name: z.string(),
|
|
60
|
+
data: z.record(z.string(), z.unknown()),
|
|
61
|
+
source: EventSourceSchema,
|
|
62
|
+
identity: z.string().nullish(),
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* The agent pushed a payload to a browser in the room, on the tenant's room.send. Ephemeral, and
|
|
66
|
+
* the payload stays out of the log: the tenant chose what to send and to whom.
|
|
67
|
+
*/
|
|
68
|
+
export const RoomSentSchema = z.strictObject({
|
|
69
|
+
topic: z.string(),
|
|
70
|
+
to: z.string().nullish(),
|
|
71
|
+
bytes: z.int(),
|
|
72
|
+
});
|