@pinecall/room 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +2 -2
  2. package/dist/code.js +1 -1
  3. package/dist/code.js.map +1 -1
  4. package/dist/karaoke.d.ts +1 -1
  5. package/dist/karaoke.d.ts.map +1 -1
  6. package/dist/karaoke.js +2 -1
  7. package/dist/karaoke.js.map +1 -1
  8. package/dist/log/fold.d.ts +2 -1
  9. package/dist/log/fold.d.ts.map +1 -1
  10. package/dist/log/fold.js +4 -1
  11. package/dist/log/fold.js.map +1 -1
  12. package/dist/log/follow.js +1 -1
  13. package/dist/log/follow.js.map +1 -1
  14. package/dist/room.d.ts +2 -1
  15. package/dist/room.d.ts.map +1 -1
  16. package/dist/room.js +3 -1
  17. package/dist/room.js.map +1 -1
  18. package/dist/rows.d.ts +1 -1
  19. package/dist/rows.d.ts.map +1 -1
  20. package/dist/rows.js +1 -0
  21. package/dist/rows.js.map +1 -1
  22. package/dist/wire/codec.d.ts +22 -0
  23. package/dist/wire/codec.d.ts.map +1 -0
  24. package/dist/wire/codec.js +23 -0
  25. package/dist/wire/codec.js.map +1 -0
  26. package/dist/wire/defs.d.ts +302 -0
  27. package/dist/wire/defs.d.ts.map +1 -0
  28. package/dist/wire/defs.js +171 -0
  29. package/dist/wire/defs.js.map +1 -0
  30. package/dist/wire/envelope.d.ts +17 -0
  31. package/dist/wire/envelope.d.ts.map +1 -0
  32. package/dist/wire/envelope.js +16 -0
  33. package/dist/wire/envelope.js.map +1 -0
  34. package/dist/wire/events-call.d.ts +422 -0
  35. package/dist/wire/events-call.d.ts.map +1 -0
  36. package/dist/wire/events-call.js +182 -0
  37. package/dist/wire/events-call.js.map +1 -0
  38. package/dist/wire/events.d.ts +923 -0
  39. package/dist/wire/events.d.ts.map +1 -0
  40. package/dist/wire/events.js +292 -0
  41. package/dist/wire/events.js.map +1 -0
  42. package/dist/wire/metrics.d.ts +366 -0
  43. package/dist/wire/metrics.d.ts.map +1 -0
  44. package/dist/wire/metrics.js +269 -0
  45. package/dist/wire/metrics.js.map +1 -0
  46. package/dist/wire/reduce.d.ts +12 -0
  47. package/dist/wire/reduce.d.ts.map +1 -0
  48. package/dist/wire/reduce.js +375 -0
  49. package/dist/wire/reduce.js.map +1 -0
  50. package/dist/wire/registry.d.ts +1395 -0
  51. package/dist/wire/registry.d.ts.map +1 -0
  52. package/dist/wire/registry.js +81 -0
  53. package/dist/wire/registry.js.map +1 -0
  54. package/dist/wire/rest.d.ts +18 -0
  55. package/dist/wire/rest.d.ts.map +1 -0
  56. package/dist/wire/rest.js +14 -0
  57. package/dist/wire/rest.js.map +1 -0
  58. package/dist/wire/room.d.ts +106 -0
  59. package/dist/wire/room.d.ts.map +1 -0
  60. package/dist/wire/room.js +73 -0
  61. package/dist/wire/room.js.map +1 -0
  62. package/dist/wire/state.d.ts +915 -0
  63. package/dist/wire/state.d.ts.map +1 -0
  64. package/dist/wire/state.js +189 -0
  65. package/dist/wire/state.js.map +1 -0
  66. package/package.json +2 -2
@@ -0,0 +1,302 @@
1
+ /** The shapes the rest of the wire is made of: channels, parts of a turn, tools, costs. */
2
+ import { z } from "zod";
3
+ /**
4
+ * The door the public came through: a phone call over SIP, the browser widget over WebRTC, or
5
+ * WhatsApp text.
6
+ */
7
+ export declare const ChannelSchema: z.ZodEnum<{
8
+ phone: "phone";
9
+ web: "web";
10
+ whatsapp: "whatsapp";
11
+ }>;
12
+ /** Inbound: the public reached the agent. Outbound: the agent reached out (a dial). */
13
+ export declare const DirectionSchema: z.ZodEnum<{
14
+ inbound: "inbound";
15
+ outbound: "outbound";
16
+ }>;
17
+ /**
18
+ * Which of the two worlds a key opens, and so which world an agent is held in and a call ran in. A
19
+ * key is issued into one; an agent registered on it and every call it takes carry that one; a door
20
+ * claimed in one is refused to a key of the other. `sandbox` is where things are written and
21
+ * `production` is what the public reaches — and whether a sandbox agent is one PERSON's copy or
22
+ * the team's shared one is not this field: it is whether the key that registered it names a
23
+ * person. Every key issued before the field existed is production.
24
+ */
25
+ export declare const EnvSchema: z.ZodEnum<{
26
+ production: "production";
27
+ sandbox: "sandbox";
28
+ }>;
29
+ /**
30
+ * What a console may ask of the process standing in the agent's directory, relayed by the gateway:
31
+ * a written call to the class mounted there (chat), a simulated caller put on the class it holds,
32
+ * its goldens and a suite of them, its knowledge folder pushed or its golden asked, its memory
33
+ * goldens, the panel it draws beside a conversation (view), a call promoted to a candidate file,
34
+ * the drift of the last two windows, and the reproductions a broken run left on that disk.
35
+ * Everything else a console needs is a door of the gateway.
36
+ */
37
+ export declare const DevVerbSchema: z.ZodEnum<{
38
+ "chat.end": "chat.end";
39
+ "chat.roster": "chat.roster";
40
+ "chat.say": "chat.say";
41
+ "chat.start": "chat.start";
42
+ "drift.read": "drift.read";
43
+ "goldens.roster": "goldens.roster";
44
+ "goldens.run": "goldens.run";
45
+ "knowledge.eval": "knowledge.eval";
46
+ "knowledge.push": "knowledge.push";
47
+ "knowledge.roster": "knowledge.roster";
48
+ "memory.eval": "memory.eval";
49
+ "memory.extraction": "memory.extraction";
50
+ "memory.roster": "memory.roster";
51
+ "promote.roster": "promote.roster";
52
+ "promote.write": "promote.write";
53
+ "reproductions.read": "reproductions.read";
54
+ "reproductions.roster": "reproductions.roster";
55
+ "simulate.start": "simulate.start";
56
+ "view.render": "view.render";
57
+ }>;
58
+ /**
59
+ * Why the call is over. Who hung up, what failed before anybody could, drained: the platform took
60
+ * the worker down (a deploy, a stop) with the call still on it, or app_detached: the app holding
61
+ * the agent closed its socket mid-call, so nothing was rendering the prompt or answering a tool —
62
+ * both are nobody's fault and neither is an error.
63
+ */
64
+ export declare const EndReasonSchema: z.ZodEnum<{
65
+ agent_hung_up: "agent_hung_up";
66
+ app_detached: "app_detached";
67
+ busy: "busy";
68
+ caller_hung_up: "caller_hung_up";
69
+ dial_failed: "dial_failed";
70
+ drained: "drained";
71
+ error: "error";
72
+ no_answer: "no_answer";
73
+ supervisor_ended: "supervisor_ended";
74
+ timeout: "timeout";
75
+ transferred: "transferred";
76
+ }>;
77
+ /** Whose action ended the call. platform covers timeouts, errors and a drained worker. */
78
+ export declare const EndedBySchema: z.ZodEnum<{
79
+ agent: "agent";
80
+ caller: "caller";
81
+ platform: "platform";
82
+ supervisor: "supervisor";
83
+ }>;
84
+ /**
85
+ * What one judge answered about a finished call. Held: the rule held. Broken: it did not, and the
86
+ * reason names the evidence. Deferred: the judge was asked and could not settle it. Skipped:
87
+ * nobody asked it — no model was reachable inside the call's judging budget.
88
+ */
89
+ export declare const ScoreVerdictSchema: z.ZodEnum<{
90
+ broken: "broken";
91
+ deferred: "deferred";
92
+ held: "held";
93
+ skipped: "skipped";
94
+ }>;
95
+ /**
96
+ * Cold: the caller is sent on with a REFER on their SIP leg and the call ends here. Warm: the
97
+ * number is dialled into the call's own room, the agent stays on the line until the other side
98
+ * answers and then falls silent; the call ends when either of them hangs up.
99
+ */
100
+ export declare const TransferModeSchema: z.ZodEnum<{
101
+ cold: "cold";
102
+ warm: "warm";
103
+ }>;
104
+ /**
105
+ * What the platform believes the person on the line is doing right now. The states are the
106
+ * session's own.
107
+ */
108
+ export declare const UserStateSchema: z.ZodEnum<{
109
+ away: "away";
110
+ listening: "listening";
111
+ speaking: "speaking";
112
+ }>;
113
+ /**
114
+ * What the agent is doing right now, in the session's own words: warming up, waiting, hearing the
115
+ * caller, generating, or playing audio.
116
+ */
117
+ export declare const AgentStateSchema: z.ZodEnum<{
118
+ idle: "idle";
119
+ initializing: "initializing";
120
+ listening: "listening";
121
+ speaking: "speaking";
122
+ thinking: "thinking";
123
+ }>;
124
+ /**
125
+ * Who a participant is to the call: the person the agent serves (over SIP or the widget), the
126
+ * agent itself, a supervisor who took a seat in the room, a listener who only hears, or a second
127
+ * SIP leg that room.invite brought in.
128
+ */
129
+ export declare const ParticipantKindSchema: z.ZodEnum<{
130
+ agent: "agent";
131
+ caller: "caller";
132
+ listener: "listener";
133
+ sip: "sip";
134
+ supervisor: "supervisor";
135
+ }>;
136
+ /** What a track carries: a microphone's audio, a camera's video, or a screen share. */
137
+ export declare const TrackKindSchema: z.ZodEnum<{
138
+ audio: "audio";
139
+ screen: "screen";
140
+ video: "video";
141
+ }>;
142
+ /** Where a track comes from, as livekit's TrackSource names it, in lower case. */
143
+ export declare const TrackSourceSchema: z.ZodEnum<{
144
+ camera: "camera";
145
+ microphone: "microphone";
146
+ screen_share: "screen_share";
147
+ screen_share_audio: "screen_share_audio";
148
+ unknown: "unknown";
149
+ }>;
150
+ /**
151
+ * Where an outside fact came from: the tenant's backend over the app socket (app), or a
152
+ * participant's browser over the DataChannel (participant).
153
+ */
154
+ export declare const EventSourceSchema: z.ZodEnum<{
155
+ app: "app";
156
+ participant: "participant";
157
+ }>;
158
+ /**
159
+ * Which projection a sink applies before a state or an entry leaves the platform: public for a
160
+ * participant reading its own call, tenant for the tenant's readers. The contract is
161
+ * docs/protocol/projections.md; a client never applies one.
162
+ */
163
+ export declare const ProjectionSchema: z.ZodEnum<{
164
+ public: "public";
165
+ tenant: "tenant";
166
+ }>;
167
+ /**
168
+ * Who is on the line, as far as the platform knows. Everything is optional: a web visitor may be
169
+ * nobody yet.
170
+ */
171
+ export declare const ContactSchema: z.ZodObject<{
172
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
173
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
174
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
175
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
176
+ external_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
177
+ }, z.core.$strict>;
178
+ /**
179
+ * One door to an agent: a channel and, for phone and WhatsApp, the number that answers. A number
180
+ * is a route, never an agent.
181
+ */
182
+ export declare const RouteSchema: z.ZodObject<{
183
+ channel: z.ZodEnum<{
184
+ phone: "phone";
185
+ web: "web";
186
+ whatsapp: "whatsapp";
187
+ }>;
188
+ number: z.ZodNullable<z.ZodString>;
189
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
190
+ }, z.core.$strict>;
191
+ /** The human who sent a supervise verb, as the token that let them in names them. */
192
+ export declare const SupervisorSchema: z.ZodObject<{
193
+ id: z.ZodString;
194
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
+ }, z.core.$strict>;
196
+ /**
197
+ * What came back from running a tool in the app's process. Either an output or an error, never
198
+ * both.
199
+ */
200
+ export declare const ToolResultSchema: z.ZodObject<{
201
+ call_id: z.ZodString;
202
+ name: z.ZodString;
203
+ output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
204
+ error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
205
+ summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ duration_s: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
207
+ }, z.core.$strict>;
208
+ /**
209
+ * One thing remembered about a contact: a sentence, where it came from, and how well it matched
210
+ * when recalled.
211
+ */
212
+ export declare const MemoryFactSchema: z.ZodObject<{
213
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
+ text: z.ZodString;
215
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
216
+ score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
217
+ source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
218
+ }, z.core.$strict>;
219
+ /**
220
+ * One operation against the contact's memory: a recall during the turn, a remember at hangup, or a
221
+ * forget on request.
222
+ */
223
+ export declare const MemoryOpSchema: z.ZodObject<{
224
+ op: z.ZodEnum<{
225
+ forget: "forget";
226
+ recall: "recall";
227
+ remember: "remember";
228
+ }>;
229
+ contact: z.ZodOptional<z.ZodNullable<z.ZodString>>;
230
+ query: z.ZodOptional<z.ZodNullable<z.ZodString>>;
231
+ facts: z.ZodArray<z.ZodObject<{
232
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
233
+ text: z.ZodString;
234
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
235
+ score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
236
+ source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
237
+ }, z.core.$strict>>;
238
+ took_ms: z.ZodNumber;
239
+ }, z.core.$strict>;
240
+ /** One chunk of the knowledge base that retrieval put in front of the model for this turn. */
241
+ export declare const DocSourceSchema: z.ZodObject<{
242
+ id: z.ZodString;
243
+ base: z.ZodOptional<z.ZodNullable<z.ZodString>>;
244
+ path: z.ZodString;
245
+ heading: z.ZodOptional<z.ZodNullable<z.ZodString>>;
246
+ score: z.ZodNumber;
247
+ excerpt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
248
+ }, z.core.$strict>;
249
+ /** One priced line: a model, what was counted, how much, and what it came to. */
250
+ export declare const CostRowSchema: z.ZodObject<{
251
+ provider: z.ZodString;
252
+ model: z.ZodString;
253
+ unit: z.ZodEnum<{
254
+ audio_seconds: "audio_seconds";
255
+ cache_creation_tokens: "cache_creation_tokens";
256
+ cached_input_tokens: "cached_input_tokens";
257
+ characters: "characters";
258
+ input_tokens: "input_tokens";
259
+ minutes: "minutes";
260
+ output_tokens: "output_tokens";
261
+ requests: "requests";
262
+ session_seconds: "session_seconds";
263
+ }>;
264
+ quantity: z.ZodNumber;
265
+ unit_price_usd: z.ZodNumber;
266
+ usd: z.ZodNumber;
267
+ }, z.core.$strict>;
268
+ /** A usage row the price table does not know. It is listed, never priced at zero. */
269
+ export declare const UnpricedRowSchema: z.ZodObject<{
270
+ provider: z.ZodString;
271
+ model: z.ZodString;
272
+ }, z.core.$strict>;
273
+ /**
274
+ * What the call cost in provider fees, informational, in US dollars, the currency providers price
275
+ * in. The runtime never prices commercially; this is the provider's bill as best we know it.
276
+ */
277
+ export declare const CostSchema: z.ZodObject<{
278
+ usd: z.ZodNumber;
279
+ rows: z.ZodArray<z.ZodObject<{
280
+ provider: z.ZodString;
281
+ model: z.ZodString;
282
+ unit: z.ZodEnum<{
283
+ audio_seconds: "audio_seconds";
284
+ cache_creation_tokens: "cache_creation_tokens";
285
+ cached_input_tokens: "cached_input_tokens";
286
+ characters: "characters";
287
+ input_tokens: "input_tokens";
288
+ minutes: "minutes";
289
+ output_tokens: "output_tokens";
290
+ requests: "requests";
291
+ session_seconds: "session_seconds";
292
+ }>;
293
+ quantity: z.ZodNumber;
294
+ unit_price_usd: z.ZodNumber;
295
+ usd: z.ZodNumber;
296
+ }, z.core.$strict>>;
297
+ unpriced: z.ZodArray<z.ZodObject<{
298
+ provider: z.ZodString;
299
+ model: z.ZodString;
300
+ }, z.core.$strict>>;
301
+ }, z.core.$strict>;
302
+ //# sourceMappingURL=defs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.d.ts","sourceRoot":"","sources":["../../src/wire/defs.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAE3F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;EAAuC,CAAC;AAElE,uFAAuF;AACvF,eAAO,MAAM,eAAe;;;EAAkC,CAAC;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;;;EAAoC,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;EAA8U,CAAC;AAEzW;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAAoK,CAAC;AAEjM,0FAA0F;AAC1F,eAAO,MAAM,aAAa;;;;;EAAwD,CAAC;AAEnF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;EAAoD,CAAC;AAEpF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;EAA2B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;EAA4C,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;EAAwE,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;EAA+D,CAAC;AAElG,uFAAuF;AACvF,eAAO,MAAM,eAAe;;;;EAAuC,CAAC;AAEpE,kFAAkF;AAClF,eAAO,MAAM,iBAAiB;;;;;;EAAoF,CAAC;AAEnH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;EAAiC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;EAA+B,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;kBAMxB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;kBAItB,CAAC;AAEH,qFAAqF;AACrF,eAAO,MAAM,gBAAgB;;;kBAG3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;kBAO3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;kBAM3B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;kBAMzB,CAAC;AAEH,8FAA8F;AAC9F,eAAO,MAAM,eAAe;;;;;;;kBAO1B,CAAC;AAEH,iFAAiF;AACjF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;kBAOxB,CAAC;AAEH,qFAAqF;AACrF,eAAO,MAAM,iBAAiB;;;kBAG5B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;kBAIrB,CAAC"}
@@ -0,0 +1,171 @@
1
+ /** The shapes the rest of the wire is made of: channels, parts of a turn, tools, costs. */
2
+ import { z } from "zod";
3
+ /**
4
+ * The door the public came through: a phone call over SIP, the browser widget over WebRTC, or
5
+ * WhatsApp text.
6
+ */
7
+ export const ChannelSchema = z.enum(["phone", "web", "whatsapp"]);
8
+ /** Inbound: the public reached the agent. Outbound: the agent reached out (a dial). */
9
+ export const DirectionSchema = z.enum(["inbound", "outbound"]);
10
+ /**
11
+ * Which of the two worlds a key opens, and so which world an agent is held in and a call ran in. A
12
+ * key is issued into one; an agent registered on it and every call it takes carry that one; a door
13
+ * claimed in one is refused to a key of the other. `sandbox` is where things are written and
14
+ * `production` is what the public reaches — and whether a sandbox agent is one PERSON's copy or
15
+ * the team's shared one is not this field: it is whether the key that registered it names a
16
+ * person. Every key issued before the field existed is production.
17
+ */
18
+ export const EnvSchema = z.enum(["production", "sandbox"]);
19
+ /**
20
+ * What a console may ask of the process standing in the agent's directory, relayed by the gateway:
21
+ * a written call to the class mounted there (chat), a simulated caller put on the class it holds,
22
+ * its goldens and a suite of them, its knowledge folder pushed or its golden asked, its memory
23
+ * goldens, the panel it draws beside a conversation (view), a call promoted to a candidate file,
24
+ * the drift of the last two windows, and the reproductions a broken run left on that disk.
25
+ * Everything else a console needs is a door of the gateway.
26
+ */
27
+ export const DevVerbSchema = z.enum(["chat.roster", "chat.start", "chat.say", "chat.end", "view.render", "simulate.start", "goldens.roster", "goldens.run", "knowledge.roster", "knowledge.push", "knowledge.eval", "memory.roster", "memory.eval", "memory.extraction", "promote.roster", "promote.write", "drift.read", "reproductions.roster", "reproductions.read"]);
28
+ /**
29
+ * Why the call is over. Who hung up, what failed before anybody could, drained: the platform took
30
+ * the worker down (a deploy, a stop) with the call still on it, or app_detached: the app holding
31
+ * the agent closed its socket mid-call, so nothing was rendering the prompt or answering a tool —
32
+ * both are nobody's fault and neither is an error.
33
+ */
34
+ export const EndReasonSchema = z.enum(["caller_hung_up", "agent_hung_up", "supervisor_ended", "transferred", "no_answer", "busy", "dial_failed", "timeout", "drained", "app_detached", "error"]);
35
+ /** Whose action ended the call. platform covers timeouts, errors and a drained worker. */
36
+ export const EndedBySchema = z.enum(["caller", "agent", "supervisor", "platform"]);
37
+ /**
38
+ * What one judge answered about a finished call. Held: the rule held. Broken: it did not, and the
39
+ * reason names the evidence. Deferred: the judge was asked and could not settle it. Skipped:
40
+ * nobody asked it — no model was reachable inside the call's judging budget.
41
+ */
42
+ export const ScoreVerdictSchema = z.enum(["held", "broken", "deferred", "skipped"]);
43
+ /**
44
+ * Cold: the caller is sent on with a REFER on their SIP leg and the call ends here. Warm: the
45
+ * number is dialled into the call's own room, the agent stays on the line until the other side
46
+ * answers and then falls silent; the call ends when either of them hangs up.
47
+ */
48
+ export const TransferModeSchema = z.enum(["cold", "warm"]);
49
+ /**
50
+ * What the platform believes the person on the line is doing right now. The states are the
51
+ * session's own.
52
+ */
53
+ export const UserStateSchema = z.enum(["listening", "speaking", "away"]);
54
+ /**
55
+ * What the agent is doing right now, in the session's own words: warming up, waiting, hearing the
56
+ * caller, generating, or playing audio.
57
+ */
58
+ export const AgentStateSchema = z.enum(["initializing", "idle", "listening", "thinking", "speaking"]);
59
+ /**
60
+ * Who a participant is to the call: the person the agent serves (over SIP or the widget), the
61
+ * agent itself, a supervisor who took a seat in the room, a listener who only hears, or a second
62
+ * SIP leg that room.invite brought in.
63
+ */
64
+ export const ParticipantKindSchema = z.enum(["caller", "agent", "supervisor", "listener", "sip"]);
65
+ /** What a track carries: a microphone's audio, a camera's video, or a screen share. */
66
+ export const TrackKindSchema = z.enum(["audio", "video", "screen"]);
67
+ /** Where a track comes from, as livekit's TrackSource names it, in lower case. */
68
+ export const TrackSourceSchema = z.enum(["microphone", "camera", "screen_share", "screen_share_audio", "unknown"]);
69
+ /**
70
+ * Where an outside fact came from: the tenant's backend over the app socket (app), or a
71
+ * participant's browser over the DataChannel (participant).
72
+ */
73
+ export const EventSourceSchema = z.enum(["app", "participant"]);
74
+ /**
75
+ * Which projection a sink applies before a state or an entry leaves the platform: public for a
76
+ * participant reading its own call, tenant for the tenant's readers. The contract is
77
+ * docs/protocol/projections.md; a client never applies one.
78
+ */
79
+ export const ProjectionSchema = z.enum(["public", "tenant"]);
80
+ /**
81
+ * Who is on the line, as far as the platform knows. Everything is optional: a web visitor may be
82
+ * nobody yet.
83
+ */
84
+ export const ContactSchema = z.strictObject({
85
+ id: z.string().nullish(),
86
+ phone: z.string().nullish(),
87
+ name: z.string().nullish(),
88
+ email: z.string().nullish(),
89
+ external_id: z.string().nullish(),
90
+ });
91
+ /**
92
+ * One door to an agent: a channel and, for phone and WhatsApp, the number that answers. A number
93
+ * is a route, never an agent.
94
+ */
95
+ export const RouteSchema = z.strictObject({
96
+ channel: ChannelSchema,
97
+ number: z.string().nullable(),
98
+ label: z.string().nullish(),
99
+ });
100
+ /** The human who sent a supervise verb, as the token that let them in names them. */
101
+ export const SupervisorSchema = z.strictObject({
102
+ id: z.string(),
103
+ name: z.string().nullish(),
104
+ });
105
+ /**
106
+ * What came back from running a tool in the app's process. Either an output or an error, never
107
+ * both.
108
+ */
109
+ export const ToolResultSchema = z.strictObject({
110
+ call_id: z.string(),
111
+ name: z.string(),
112
+ output: z.unknown().nullish(),
113
+ error: z.string().nullish(),
114
+ summary: z.string().nullish(),
115
+ duration_s: z.number().nullish(),
116
+ });
117
+ /**
118
+ * One thing remembered about a contact: a sentence, where it came from, and how well it matched
119
+ * when recalled.
120
+ */
121
+ export const MemoryFactSchema = z.strictObject({
122
+ id: z.string().nullish(),
123
+ text: z.string(),
124
+ category: z.string().nullish(),
125
+ score: z.number().nullish(),
126
+ source: z.string().nullish(),
127
+ });
128
+ /**
129
+ * One operation against the contact's memory: a recall during the turn, a remember at hangup, or a
130
+ * forget on request.
131
+ */
132
+ export const MemoryOpSchema = z.strictObject({
133
+ op: z.enum(["recall", "remember", "forget"]),
134
+ contact: z.string().nullish(),
135
+ query: z.string().nullish(),
136
+ facts: z.array(MemoryFactSchema),
137
+ took_ms: z.number(),
138
+ });
139
+ /** One chunk of the knowledge base that retrieval put in front of the model for this turn. */
140
+ export const DocSourceSchema = z.strictObject({
141
+ id: z.string(),
142
+ base: z.string().nullish(),
143
+ path: z.string(),
144
+ heading: z.string().nullish(),
145
+ score: z.number(),
146
+ excerpt: z.string().nullish(),
147
+ });
148
+ /** One priced line: a model, what was counted, how much, and what it came to. */
149
+ export const CostRowSchema = z.strictObject({
150
+ provider: z.string(),
151
+ model: z.string(),
152
+ unit: z.enum(["input_tokens", "cached_input_tokens", "cache_creation_tokens", "output_tokens", "characters", "audio_seconds", "requests", "session_seconds", "minutes"]),
153
+ quantity: z.number(),
154
+ unit_price_usd: z.number(),
155
+ usd: z.number(),
156
+ });
157
+ /** A usage row the price table does not know. It is listed, never priced at zero. */
158
+ export const UnpricedRowSchema = z.strictObject({
159
+ provider: z.string(),
160
+ model: z.string(),
161
+ });
162
+ /**
163
+ * What the call cost in provider fees, informational, in US dollars, the currency providers price
164
+ * in. The runtime never prices commercially; this is the provider's bill as best we know it.
165
+ */
166
+ export const CostSchema = z.strictObject({
167
+ usd: z.number(),
168
+ rows: z.array(CostRowSchema),
169
+ unpriced: z.array(UnpricedRowSchema),
170
+ });
171
+ //# sourceMappingURL=defs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.js","sourceRoot":"","sources":["../../src/wire/defs.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAE3F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;AAElE,uFAAuF;AACvF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,sBAAsB,EAAE,oBAA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AAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;CACrC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** The log entry, as the log door and its stream carry it. */
2
+ import { z } from "zod";
3
+ /**
4
+ * One line of a call's log, or of an agent's log when call is null. seq is written before control
5
+ * returns, so two readers never disagree about order.
6
+ */
7
+ export declare const EntrySchema: z.ZodObject<{
8
+ seq: z.ZodInt;
9
+ ts: z.ZodNumber;
10
+ call: z.ZodNullable<z.ZodString>;
11
+ agent: z.ZodString;
12
+ type: z.ZodString;
13
+ ephemeral: z.ZodBoolean;
14
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
15
+ }, z.core.$strict>;
16
+ export type Entry = z.infer<typeof EntrySchema>;
17
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/wire/envelope.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;kBAQtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /** The log entry, as the log door and its stream carry it. */
2
+ import { z } from "zod";
3
+ /**
4
+ * One line of a call's log, or of an agent's log when call is null. seq is written before control
5
+ * returns, so two readers never disagree about order.
6
+ */
7
+ export const EntrySchema = z.strictObject({
8
+ seq: z.int(),
9
+ ts: z.number(),
10
+ call: z.string().nullable(),
11
+ agent: z.string(),
12
+ type: z.string(),
13
+ ephemeral: z.boolean(),
14
+ data: z.record(z.string(), z.unknown()),
15
+ });
16
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/wire/envelope.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC;IACxC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE;IACZ,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;CACxC,CAAC,CAAC"}