pinecall-protocol 0.1.0__tar.gz
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.
- pinecall_protocol-0.1.0/.gitignore +14 -0
- pinecall_protocol-0.1.0/.python-version +1 -0
- pinecall_protocol-0.1.0/LICENSE +202 -0
- pinecall_protocol-0.1.0/PKG-INFO +15 -0
- pinecall_protocol-0.1.0/README.md +4 -0
- pinecall_protocol-0.1.0/pinecall_protocol/__init__.py +41 -0
- pinecall_protocol-0.1.0/pinecall_protocol/_base.py +13 -0
- pinecall_protocol-0.1.0/pinecall_protocol/_version.py +4 -0
- pinecall_protocol-0.1.0/pinecall_protocol/codec.py +52 -0
- pinecall_protocol-0.1.0/pinecall_protocol/commands.py +208 -0
- pinecall_protocol-0.1.0/pinecall_protocol/defs.py +407 -0
- pinecall_protocol-0.1.0/pinecall_protocol/envelope.py +30 -0
- pinecall_protocol-0.1.0/pinecall_protocol/events.py +471 -0
- pinecall_protocol-0.1.0/pinecall_protocol/fixtures/__init__.py +7 -0
- pinecall_protocol-0.1.0/pinecall_protocol/fixtures/call-log-golden.json +127 -0
- pinecall_protocol-0.1.0/pinecall_protocol/fixtures/call-log-golden.state.json +39 -0
- pinecall_protocol-0.1.0/pinecall_protocol/metrics.py +303 -0
- pinecall_protocol-0.1.0/pinecall_protocol/py.typed +0 -0
- pinecall_protocol-0.1.0/pinecall_protocol/registry.py +341 -0
- pinecall_protocol-0.1.0/pinecall_protocol/rest.py +344 -0
- pinecall_protocol-0.1.0/pinecall_protocol/room.py +83 -0
- pinecall_protocol-0.1.0/pinecall_protocol/state.py +241 -0
- pinecall_protocol-0.1.0/pinecall_protocol/verbs.py +63 -0
- pinecall_protocol-0.1.0/pyproject.toml +56 -0
- pinecall_protocol-0.1.0/uv.lock +1933 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
.pytest_cache/
|
|
4
|
+
.ruff_cache/
|
|
5
|
+
node_modules/
|
|
6
|
+
dist/
|
|
7
|
+
|
|
8
|
+
# The decision page is this laptop's engineering notes, not documentation: on disk, out of every clone.
|
|
9
|
+
docs/decision.md
|
|
10
|
+
|
|
11
|
+
# Ruby
|
|
12
|
+
Gemfile.lock
|
|
13
|
+
pkg/
|
|
14
|
+
.bundle/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Pinecall
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: pinecall-protocol
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The Pinecall wire: pydantic models generated from the protocol schema
|
|
5
|
+
Author-email: Bernardo Castro <me@bernardocastro.dev>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Requires-Dist: pydantic<3,>=2.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# pinecall-protocol
|
|
13
|
+
|
|
14
|
+
The Python side of the Pinecall wire: pydantic v2 models, the event and command registries and
|
|
15
|
+
the codec, generated from the schema one directory up. Never edited by hand; see `../README.md`.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Generated from schema/ by `python generate`. Never edited by hand."""
|
|
2
|
+
|
|
3
|
+
from pinecall_protocol._base import ProtocolError, WireModel
|
|
4
|
+
from pinecall_protocol.codec import (
|
|
5
|
+
command_of,
|
|
6
|
+
decode_entries,
|
|
7
|
+
decode_entry,
|
|
8
|
+
encode,
|
|
9
|
+
event_of,
|
|
10
|
+
)
|
|
11
|
+
from pinecall_protocol.envelope import Command, Entry
|
|
12
|
+
from pinecall_protocol.registry import (
|
|
13
|
+
COMMANDS,
|
|
14
|
+
EPHEMERAL_EVENTS,
|
|
15
|
+
EVENTS,
|
|
16
|
+
PRODUCES,
|
|
17
|
+
TERMINAL_EVENT,
|
|
18
|
+
CommandType,
|
|
19
|
+
EventType,
|
|
20
|
+
)
|
|
21
|
+
from pinecall_protocol.state import State
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"COMMANDS",
|
|
25
|
+
"EPHEMERAL_EVENTS",
|
|
26
|
+
"EVENTS",
|
|
27
|
+
"PRODUCES",
|
|
28
|
+
"TERMINAL_EVENT",
|
|
29
|
+
"Command",
|
|
30
|
+
"CommandType",
|
|
31
|
+
"Entry",
|
|
32
|
+
"EventType",
|
|
33
|
+
"ProtocolError",
|
|
34
|
+
"State",
|
|
35
|
+
"WireModel",
|
|
36
|
+
"command_of",
|
|
37
|
+
"decode_entries",
|
|
38
|
+
"decode_entry",
|
|
39
|
+
"encode",
|
|
40
|
+
"event_of",
|
|
41
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""The base every wire model shares: unknown keys are refused; a field builds by name or alias."""
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, ConfigDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class WireModel(BaseModel):
|
|
7
|
+
"""A shape on the wire. extra=forbid is the schema's additionalProperties: false."""
|
|
8
|
+
|
|
9
|
+
model_config = ConfigDict(extra="forbid", validate_by_name=True, validate_by_alias=True)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ProtocolError(ValueError):
|
|
13
|
+
"""A message did not match the protocol: unknown type, bad shape, a seq out of order."""
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""JSON in, models out, and back. The only file that touches a key name: aliases, by_alias."""
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from pydantic import TypeAdapter, ValidationError
|
|
6
|
+
|
|
7
|
+
from pinecall_protocol._base import ProtocolError, WireModel
|
|
8
|
+
from pinecall_protocol.envelope import Command, Entry
|
|
9
|
+
from pinecall_protocol.registry import COMMANDS, EVENTS
|
|
10
|
+
|
|
11
|
+
_LOG: TypeAdapter[list[Entry]] = TypeAdapter(list[Entry])
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def decode_entry(raw: dict[str, Any]) -> Entry:
|
|
15
|
+
"""One log line from decoded JSON. A bad shape is a ProtocolError."""
|
|
16
|
+
return _validate(Entry, raw, "entry")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def decode_entries(text: str) -> list[Entry]:
|
|
20
|
+
"""A whole log from a JSON array text, in the order it came."""
|
|
21
|
+
try:
|
|
22
|
+
return _LOG.validate_json(text)
|
|
23
|
+
except ValidationError as error:
|
|
24
|
+
raise ProtocolError(f"log: {error}") from error
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def event_of(entry: Entry) -> WireModel:
|
|
28
|
+
"""The entry's data as the model its type names. Unknown type or bad shape: ProtocolError."""
|
|
29
|
+
model = EVENTS.get(entry.type)
|
|
30
|
+
if model is None:
|
|
31
|
+
raise ProtocolError(f"unknown event type: {entry.type}")
|
|
32
|
+
return _validate(model, entry.data, entry.type)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def command_of(command: Command) -> WireModel:
|
|
36
|
+
"""The command's data as the model its type names. Unknown type or bad shape: ProtocolError."""
|
|
37
|
+
model = COMMANDS.get(command.type)
|
|
38
|
+
if model is None:
|
|
39
|
+
raise ProtocolError(f"unknown command type: {command.type}")
|
|
40
|
+
return _validate(model, command.data, command.type)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def encode(model: WireModel) -> dict[str, Any]:
|
|
44
|
+
"""A model as it goes on the wire: wire key names, absent fields absent, JSON-ready values."""
|
|
45
|
+
return model.model_dump(mode="json", by_alias=True, exclude_unset=True)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _validate[T: WireModel](model: type[T], raw: dict[str, Any], what: str) -> T:
|
|
49
|
+
try:
|
|
50
|
+
return model.model_validate(raw)
|
|
51
|
+
except ValidationError as error:
|
|
52
|
+
raise ProtocolError(f"{what}: {error}") from error
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"""Generated from schema/commands/: one model per command."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from pinecall_protocol._base import WireModel
|
|
8
|
+
from pinecall_protocol.defs import AgentConfig, Contact, Route, Supervisor, ToolSpec, TransferMode
|
|
9
|
+
from pinecall_protocol.verbs import Verb
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# Declare or change what the agent is: voice, models, language, greeting, the full tool list. Only
|
|
13
|
+
# the fields sent change.
|
|
14
|
+
class AgentConfigure(WireModel):
|
|
15
|
+
"""Declare or change what the agent is."""
|
|
16
|
+
|
|
17
|
+
config: AgentConfig
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# The gateway answers agent.registered, or error.
|
|
21
|
+
class AgentRegister(WireModel):
|
|
22
|
+
"""The app's first message: this socket speaks for this agent and answers these doors."""
|
|
23
|
+
|
|
24
|
+
routes: list[Route]
|
|
25
|
+
sdk: str | None = None
|
|
26
|
+
takes_unclaimed: bool = True
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Make the model speak now, guided by an instruction it reads and the caller never hears: 'tell them
|
|
30
|
+
# a slot at 10:15 just opened'. On livekit's session.generate_reply; the sibling of agent.say, which
|
|
31
|
+
# speaks verbatim. The reply lands as turn.agent.
|
|
32
|
+
class AgentReply(WireModel):
|
|
33
|
+
"""Make the model speak now, guided by an instruction it reads and the caller never hears."""
|
|
34
|
+
|
|
35
|
+
instructions: str
|
|
36
|
+
allow_interruptions: bool | None = None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Make the agent say this text now, verbatim, outside the model's turn: a greeting, a read-back, a
|
|
40
|
+
# system notice. The reply lands as turn.agent.
|
|
41
|
+
class AgentSay(WireModel):
|
|
42
|
+
"""Make the agent say this text now, verbatim, outside the model's turn."""
|
|
43
|
+
|
|
44
|
+
text: str
|
|
45
|
+
allow_interruptions: bool | None = None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# The new call's log opens with call.dialing; call.started follows when the far end answers.
|
|
49
|
+
class CallDial(WireModel):
|
|
50
|
+
"""Place an outbound call as this agent."""
|
|
51
|
+
|
|
52
|
+
to: str
|
|
53
|
+
from_: str | None = Field(None, alias="from")
|
|
54
|
+
caller: Contact | None = None
|
|
55
|
+
metadata: dict[str, Any] | None = None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class CallDtmf(WireModel):
|
|
59
|
+
"""Send touch tones down the line, for an IVR on the far end."""
|
|
60
|
+
|
|
61
|
+
digits: str
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# Hand the agent a fact from the tenant's backend: a slot freed, an order shipped, a payment
|
|
65
|
+
# confirmed. Lands as event.received with source app. The agent must have declared the name in its
|
|
66
|
+
# events with app among the senders, or the gateway answers error and nothing touches the log.
|
|
67
|
+
class CallEvent(WireModel):
|
|
68
|
+
"""Hand the agent a fact from the tenant's backend."""
|
|
69
|
+
|
|
70
|
+
name: str
|
|
71
|
+
data: dict[str, Any]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# call.ended follows with reason agent_hung_up.
|
|
75
|
+
class CallHangup(WireModel):
|
|
76
|
+
"""End the call from the app's side."""
|
|
77
|
+
|
|
78
|
+
reason: str | None = None
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class CallHold(WireModel):
|
|
82
|
+
"""Put the caller on hold: they hear hold audio, the agent hears nothing."""
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# It gets a seq like everything else and lands as custom.
|
|
86
|
+
class CallLog(WireModel):
|
|
87
|
+
"""Write a line of the app's own into the call's log."""
|
|
88
|
+
|
|
89
|
+
name: str
|
|
90
|
+
data: dict[str, Any]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class CallMute(WireModel):
|
|
94
|
+
"""Mute the agent: it keeps listening and thinking, produces no audio."""
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# call.transferred says whether it worked.
|
|
98
|
+
class CallTransfer(WireModel):
|
|
99
|
+
"""Send the caller to another number."""
|
|
100
|
+
|
|
101
|
+
to: str
|
|
102
|
+
mode: TransferMode
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class CallUnhold(WireModel):
|
|
106
|
+
"""Take the caller off hold."""
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class CallUnmute(WireModel):
|
|
110
|
+
"""Unmute the agent."""
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# Why the verb did not run, in the words the console shows: the status it travels under, and the
|
|
114
|
+
# sentence.
|
|
115
|
+
class DevRefusal(WireModel):
|
|
116
|
+
"""Why the verb did not run, in the words the console shows."""
|
|
117
|
+
|
|
118
|
+
status: int
|
|
119
|
+
detail: str
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class DevAnswer(WireModel):
|
|
123
|
+
"""What came of one dev.request, named by its id."""
|
|
124
|
+
|
|
125
|
+
id: str
|
|
126
|
+
result: dict[str, Any] | None = None
|
|
127
|
+
refused: DevRefusal | None = None
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# Silence a participant for the rest of the call: their audio leaves the room, for everyone in it.
|
|
131
|
+
# Lands as track.unpublished for their microphone. There is no unmute; a leg that must speak again
|
|
132
|
+
# is invited again.
|
|
133
|
+
class ParticipantMute(WireModel):
|
|
134
|
+
"""Silence a participant for the rest of the call."""
|
|
135
|
+
|
|
136
|
+
identity: str
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# Lands as participant.left with reason participant_removed. Removing the caller ends the call.
|
|
140
|
+
class ParticipantRemove(WireModel):
|
|
141
|
+
"""Put a participant out of the room."""
|
|
142
|
+
|
|
143
|
+
identity: str
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class Ping(WireModel):
|
|
147
|
+
"""Is the socket alive? The gateway answers pong."""
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# The name must be one of the agent's declared blocks, or one of the default four; anything else is
|
|
151
|
+
# refused with the name.
|
|
152
|
+
class PromptSet(WireModel):
|
|
153
|
+
"""Rewrite one block of the prompt, whole, by name."""
|
|
154
|
+
|
|
155
|
+
name: str
|
|
156
|
+
text: str
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
# A second SIP leg dialed to a number is the warm path: the agent stays on with the caller while the
|
|
160
|
+
# other side answers. Lands as participant.joined when they arrive, or error when they do not.
|
|
161
|
+
class RoomInvite(WireModel):
|
|
162
|
+
"""Bring somebody else into the call's room."""
|
|
163
|
+
|
|
164
|
+
to: str
|
|
165
|
+
kind: Literal["sip", "participant"]
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# Push a payload to a browser in the room over the DataChannel: a card to render, a form to open.
|
|
169
|
+
# Lands as room.sent with the size, never the payload. The widget listens on pinecall.ui; a topic of
|
|
170
|
+
# the tenant's own reaches the tenant's own page code.
|
|
171
|
+
class RoomSend(WireModel):
|
|
172
|
+
"""Push a payload to a browser in the room over the DataChannel."""
|
|
173
|
+
|
|
174
|
+
topic: str
|
|
175
|
+
data: dict[str, Any]
|
|
176
|
+
to: str | None = None
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# Set up this one call before the first turn: the app's initial state, and any config that differs
|
|
180
|
+
# from the agent's defaults for this caller.
|
|
181
|
+
class SessionConfigure(WireModel):
|
|
182
|
+
"""Set up this one call before the first turn."""
|
|
183
|
+
|
|
184
|
+
state: dict[str, Any] | None = None
|
|
185
|
+
config: AgentConfig | None = None
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
# The platform logs state.changed and re-renders.
|
|
189
|
+
class StateSet(WireModel):
|
|
190
|
+
"""The app's state changed and this is all of it."""
|
|
191
|
+
|
|
192
|
+
state: dict[str, Any]
|
|
193
|
+
changed: list[str] | None = None
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class SupervisorVerb(WireModel):
|
|
197
|
+
"""One supervise verb, from the human the door named."""
|
|
198
|
+
|
|
199
|
+
by: Supervisor
|
|
200
|
+
verb: Verb
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# The full list was declared in agent.configure; this is the subset whose when allows them in this
|
|
204
|
+
# state.
|
|
205
|
+
class ToolsSet(WireModel):
|
|
206
|
+
"""The tools the model may see now."""
|
|
207
|
+
|
|
208
|
+
tools: list[ToolSpec]
|