@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,168 @@
|
|
|
1
|
+
// Generated from schema/commands/: one schema per command. Never edited by hand.
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { AgentConfigSchema, ContactSchema, RouteSchema, SupervisorSchema, ToolSpecSchema, TransferModeSchema, } from "./defs.js";
|
|
4
|
+
import { VerbSchema } from "./verbs.js";
|
|
5
|
+
/**
|
|
6
|
+
* Declare or change what the agent is: voice, models, language, greeting, the full tool list. Only
|
|
7
|
+
* the fields sent change.
|
|
8
|
+
*/
|
|
9
|
+
export const AgentConfigureSchema = z.strictObject({
|
|
10
|
+
config: AgentConfigSchema,
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* The app's first message: this socket speaks for this agent and answers these doors. The gateway
|
|
14
|
+
* answers agent.registered, or error.
|
|
15
|
+
*/
|
|
16
|
+
export const AgentRegisterSchema = z.strictObject({
|
|
17
|
+
routes: z.array(RouteSchema),
|
|
18
|
+
sdk: z.string().nullish(),
|
|
19
|
+
takes_unclaimed: z.boolean().nullish(),
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Make the model speak now, guided by an instruction it reads and the caller never hears: 'tell
|
|
23
|
+
* them a slot at 10:15 just opened'. On livekit's session.generate_reply; the sibling of
|
|
24
|
+
* agent.say, which speaks verbatim. The reply lands as turn.agent.
|
|
25
|
+
*/
|
|
26
|
+
export const AgentReplySchema = z.strictObject({
|
|
27
|
+
instructions: z.string(),
|
|
28
|
+
allow_interruptions: z.boolean().nullish(),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Make the agent say this text now, verbatim, outside the model's turn: a greeting, a read-back, a
|
|
32
|
+
* system notice. The reply lands as turn.agent.
|
|
33
|
+
*/
|
|
34
|
+
export const AgentSaySchema = z.strictObject({
|
|
35
|
+
text: z.string(),
|
|
36
|
+
allow_interruptions: z.boolean().nullish(),
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Place an outbound call as this agent. The new call's log opens with call.dialing; call.started
|
|
40
|
+
* follows when the far end answers.
|
|
41
|
+
*/
|
|
42
|
+
export const CallDialSchema = z.strictObject({
|
|
43
|
+
to: z.string(),
|
|
44
|
+
from: z.string().nullish(),
|
|
45
|
+
caller: ContactSchema.nullish(),
|
|
46
|
+
metadata: z.record(z.string(), z.unknown()).nullish(),
|
|
47
|
+
});
|
|
48
|
+
/** Send touch tones down the line, for an IVR on the far end. */
|
|
49
|
+
export const CallDtmfSchema = z.strictObject({
|
|
50
|
+
digits: z.string(),
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Hand the agent a fact from the tenant's backend: a slot freed, an order shipped, a payment
|
|
54
|
+
* confirmed. Lands as event.received with source app. The agent must have declared the name in its
|
|
55
|
+
* events with app among the senders, or the gateway answers error and nothing touches the log.
|
|
56
|
+
*/
|
|
57
|
+
export const CallEventSchema = z.strictObject({
|
|
58
|
+
name: z.string(),
|
|
59
|
+
data: z.record(z.string(), z.unknown()),
|
|
60
|
+
});
|
|
61
|
+
/** End the call from the app's side. call.ended follows with reason agent_hung_up. */
|
|
62
|
+
export const CallHangupSchema = z.strictObject({
|
|
63
|
+
reason: z.string().nullish(),
|
|
64
|
+
});
|
|
65
|
+
/** Put the caller on hold: they hear hold audio, the agent hears nothing. */
|
|
66
|
+
export const CallHoldSchema = z.strictObject({});
|
|
67
|
+
/**
|
|
68
|
+
* Write a line of the app's own into the call's log. It gets a seq like everything else and lands
|
|
69
|
+
* as custom.
|
|
70
|
+
*/
|
|
71
|
+
export const CallLogSchema = z.strictObject({
|
|
72
|
+
name: z.string(),
|
|
73
|
+
data: z.record(z.string(), z.unknown()),
|
|
74
|
+
});
|
|
75
|
+
/** Mute the agent: it keeps listening and thinking, produces no audio. */
|
|
76
|
+
export const CallMuteSchema = z.strictObject({});
|
|
77
|
+
/** Send the caller to another number. call.transferred says whether it worked. */
|
|
78
|
+
export const CallTransferSchema = z.strictObject({
|
|
79
|
+
to: z.string(),
|
|
80
|
+
mode: TransferModeSchema,
|
|
81
|
+
});
|
|
82
|
+
/** Take the caller off hold. */
|
|
83
|
+
export const CallUnholdSchema = z.strictObject({});
|
|
84
|
+
/** Unmute the agent. */
|
|
85
|
+
export const CallUnmuteSchema = z.strictObject({});
|
|
86
|
+
/**
|
|
87
|
+
* Why the verb did not run, in the words the console shows: the status it travels under, and the
|
|
88
|
+
* sentence.
|
|
89
|
+
*/
|
|
90
|
+
export const DevRefusalSchema = z.strictObject({
|
|
91
|
+
status: z.int(),
|
|
92
|
+
detail: z.string(),
|
|
93
|
+
});
|
|
94
|
+
/** What came of one dev.request, named by its id. */
|
|
95
|
+
export const DevAnswerSchema = z.strictObject({
|
|
96
|
+
id: z.string(),
|
|
97
|
+
result: z.record(z.string(), z.unknown()).nullish(),
|
|
98
|
+
refused: DevRefusalSchema.nullish(),
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* Silence a participant for the rest of the call: their audio leaves the room, for everyone in it.
|
|
102
|
+
* Lands as track.unpublished for their microphone. There is no unmute; a leg that must speak again
|
|
103
|
+
* is invited again.
|
|
104
|
+
*/
|
|
105
|
+
export const ParticipantMuteSchema = z.strictObject({
|
|
106
|
+
identity: z.string(),
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* Put a participant out of the room. Lands as participant.left with reason participant_removed.
|
|
110
|
+
* Removing the caller ends the call.
|
|
111
|
+
*/
|
|
112
|
+
export const ParticipantRemoveSchema = z.strictObject({
|
|
113
|
+
identity: z.string(),
|
|
114
|
+
});
|
|
115
|
+
/** Is the socket alive? The gateway answers pong. */
|
|
116
|
+
export const PingSchema = z.strictObject({});
|
|
117
|
+
/**
|
|
118
|
+
* Rewrite one block of the prompt, whole, by name. The name must be one of the agent's declared
|
|
119
|
+
* blocks, or one of the default four; anything else is refused with the name.
|
|
120
|
+
*/
|
|
121
|
+
export const PromptSetSchema = z.strictObject({
|
|
122
|
+
name: z.string(),
|
|
123
|
+
text: z.string(),
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* Bring somebody else into the call's room. A second SIP leg dialed to a number is the warm path:
|
|
127
|
+
* the agent stays on with the caller while the other side answers. Lands as participant.joined
|
|
128
|
+
* when they arrive, or error when they do not.
|
|
129
|
+
*/
|
|
130
|
+
export const RoomInviteSchema = z.strictObject({
|
|
131
|
+
to: z.string(),
|
|
132
|
+
kind: z.enum(["sip", "participant"]),
|
|
133
|
+
});
|
|
134
|
+
/**
|
|
135
|
+
* Push a payload to a browser in the room over the DataChannel: a card to render, a form to open.
|
|
136
|
+
* Lands as room.sent with the size, never the payload. The widget listens on pinecall.ui; a topic
|
|
137
|
+
* of the tenant's own reaches the tenant's own page code.
|
|
138
|
+
*/
|
|
139
|
+
export const RoomSendSchema = z.strictObject({
|
|
140
|
+
topic: z.string(),
|
|
141
|
+
data: z.record(z.string(), z.unknown()),
|
|
142
|
+
to: z.string().nullish(),
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* Set up this one call before the first turn: the app's initial state, and any config that differs
|
|
146
|
+
* from the agent's defaults for this caller.
|
|
147
|
+
*/
|
|
148
|
+
export const SessionConfigureSchema = z.strictObject({
|
|
149
|
+
state: z.record(z.string(), z.unknown()).nullish(),
|
|
150
|
+
config: AgentConfigSchema.nullish(),
|
|
151
|
+
});
|
|
152
|
+
/** The app's state changed and this is all of it. The platform logs state.changed and re-renders. */
|
|
153
|
+
export const StateSetSchema = z.strictObject({
|
|
154
|
+
state: z.record(z.string(), z.unknown()),
|
|
155
|
+
changed: z.array(z.string()).nullish(),
|
|
156
|
+
});
|
|
157
|
+
/** One supervise verb, from the human the door named. */
|
|
158
|
+
export const SupervisorVerbSchema = z.strictObject({
|
|
159
|
+
by: SupervisorSchema,
|
|
160
|
+
verb: VerbSchema,
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* The tools the model may see now. The full list was declared in agent.configure; this is the
|
|
164
|
+
* subset whose when allows them in this state.
|
|
165
|
+
*/
|
|
166
|
+
export const ToolsSetSchema = z.strictObject({
|
|
167
|
+
tools: z.array(ToolSpecSchema),
|
|
168
|
+
});
|