@pinecall/agents 0.9.20

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 (292) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +121 -0
  3. package/dist/agent/accepts.d.ts +31 -0
  4. package/dist/agent/accepts.d.ts.map +1 -0
  5. package/dist/agent/accepts.js +27 -0
  6. package/dist/agent/accepts.js.map +1 -0
  7. package/dist/agent/agent.d.ts +151 -0
  8. package/dist/agent/agent.d.ts.map +1 -0
  9. package/dist/agent/agent.js +240 -0
  10. package/dist/agent/agent.js.map +1 -0
  11. package/dist/agent/authors.d.ts +12 -0
  12. package/dist/agent/authors.d.ts.map +1 -0
  13. package/dist/agent/authors.js +26 -0
  14. package/dist/agent/authors.js.map +1 -0
  15. package/dist/agent/decorators.d.ts +16 -0
  16. package/dist/agent/decorators.d.ts.map +1 -0
  17. package/dist/agent/decorators.js +43 -0
  18. package/dist/agent/decorators.js.map +1 -0
  19. package/dist/agent/docstrings.d.ts +35 -0
  20. package/dist/agent/docstrings.d.ts.map +1 -0
  21. package/dist/agent/docstrings.js +301 -0
  22. package/dist/agent/docstrings.js.map +1 -0
  23. package/dist/agent/knowledge.d.ts +9 -0
  24. package/dist/agent/knowledge.d.ts.map +1 -0
  25. package/dist/agent/knowledge.js +3 -0
  26. package/dist/agent/knowledge.js.map +1 -0
  27. package/dist/agent/lifecycle.d.ts +29 -0
  28. package/dist/agent/lifecycle.d.ts.map +1 -0
  29. package/dist/agent/lifecycle.js +9 -0
  30. package/dist/agent/lifecycle.js.map +1 -0
  31. package/dist/agent/searching.d.ts +7 -0
  32. package/dist/agent/searching.d.ts.map +1 -0
  33. package/dist/agent/searching.js +35 -0
  34. package/dist/agent/searching.js.map +1 -0
  35. package/dist/agent/stages.d.ts +23 -0
  36. package/dist/agent/stages.d.ts.map +1 -0
  37. package/dist/agent/stages.js +29 -0
  38. package/dist/agent/stages.js.map +1 -0
  39. package/dist/agent/state.d.ts +36 -0
  40. package/dist/agent/state.d.ts.map +1 -0
  41. package/dist/agent/state.js +93 -0
  42. package/dist/agent/state.js.map +1 -0
  43. package/dist/agent/tools.d.ts +61 -0
  44. package/dist/agent/tools.d.ts.map +1 -0
  45. package/dist/agent/tools.js +145 -0
  46. package/dist/agent/tools.js.map +1 -0
  47. package/dist/agent/view.d.ts +29 -0
  48. package/dist/agent/view.d.ts.map +1 -0
  49. package/dist/agent/view.js +29 -0
  50. package/dist/agent/view.js.map +1 -0
  51. package/dist/agent/visibility.d.ts +32 -0
  52. package/dist/agent/visibility.d.ts.map +1 -0
  53. package/dist/agent/visibility.js +77 -0
  54. package/dist/agent/visibility.js.map +1 -0
  55. package/dist/call/call.d.ts +137 -0
  56. package/dist/call/call.d.ts.map +1 -0
  57. package/dist/call/call.js +228 -0
  58. package/dist/call/call.js.map +1 -0
  59. package/dist/call/history.d.ts +28 -0
  60. package/dist/call/history.d.ts.map +1 -0
  61. package/dist/call/history.js +32 -0
  62. package/dist/call/history.js.map +1 -0
  63. package/dist/call/room.d.ts +56 -0
  64. package/dist/call/room.d.ts.map +1 -0
  65. package/dist/call/room.js +66 -0
  66. package/dist/call/room.js.map +1 -0
  67. package/dist/client/agent.d.ts +93 -0
  68. package/dist/client/agent.d.ts.map +1 -0
  69. package/dist/client/agent.js +230 -0
  70. package/dist/client/agent.js.map +1 -0
  71. package/dist/client/calls.d.ts +87 -0
  72. package/dist/client/calls.d.ts.map +1 -0
  73. package/dist/client/calls.js +180 -0
  74. package/dist/client/calls.js.map +1 -0
  75. package/dist/client/client.d.ts +112 -0
  76. package/dist/client/client.d.ts.map +1 -0
  77. package/dist/client/client.js +284 -0
  78. package/dist/client/client.js.map +1 -0
  79. package/dist/client/connection.d.ts +52 -0
  80. package/dist/client/connection.d.ts.map +1 -0
  81. package/dist/client/connection.js +157 -0
  82. package/dist/client/connection.js.map +1 -0
  83. package/dist/client/endpoints.d.ts +9 -0
  84. package/dist/client/endpoints.d.ts.map +1 -0
  85. package/dist/client/endpoints.js +25 -0
  86. package/dist/client/endpoints.js.map +1 -0
  87. package/dist/client/frames.d.ts +29 -0
  88. package/dist/client/frames.d.ts.map +1 -0
  89. package/dist/client/frames.js +51 -0
  90. package/dist/client/frames.js.map +1 -0
  91. package/dist/client/index.d.ts +18 -0
  92. package/dist/client/index.d.ts.map +1 -0
  93. package/dist/client/index.js +13 -0
  94. package/dist/client/index.js.map +1 -0
  95. package/dist/client/listeners.d.ts +35 -0
  96. package/dist/client/listeners.d.ts.map +1 -0
  97. package/dist/client/listeners.js +60 -0
  98. package/dist/client/listeners.js.map +1 -0
  99. package/dist/client/lost.d.ts +4 -0
  100. package/dist/client/lost.d.ts.map +1 -0
  101. package/dist/client/lost.js +8 -0
  102. package/dist/client/lost.js.map +1 -0
  103. package/dist/client/observe.d.ts +50 -0
  104. package/dist/client/observe.d.ts.map +1 -0
  105. package/dist/client/observe.js +125 -0
  106. package/dist/client/observe.js.map +1 -0
  107. package/dist/client/signed.d.ts +14 -0
  108. package/dist/client/signed.d.ts.map +1 -0
  109. package/dist/client/signed.js +18 -0
  110. package/dist/client/signed.js.map +1 -0
  111. package/dist/client/testing/gateway.d.ts +58 -0
  112. package/dist/client/testing/gateway.d.ts.map +1 -0
  113. package/dist/client/testing/gateway.js +175 -0
  114. package/dist/client/testing/gateway.js.map +1 -0
  115. package/dist/client/testing/index.d.ts +4 -0
  116. package/dist/client/testing/index.d.ts.map +1 -0
  117. package/dist/client/testing/index.js +4 -0
  118. package/dist/client/testing/index.js.map +1 -0
  119. package/dist/client/testing/log.d.ts +24 -0
  120. package/dist/client/testing/log.d.ts.map +1 -0
  121. package/dist/client/testing/log.js +106 -0
  122. package/dist/client/testing/log.js.map +1 -0
  123. package/dist/client/testing/loopback.d.ts +3 -0
  124. package/dist/client/testing/loopback.d.ts.map +1 -0
  125. package/dist/client/testing/loopback.js +3 -0
  126. package/dist/client/testing/loopback.js.map +1 -0
  127. package/dist/index.d.ts +23 -0
  128. package/dist/index.d.ts.map +1 -0
  129. package/dist/index.js +27 -0
  130. package/dist/index.js.map +1 -0
  131. package/dist/runtime/connect.d.ts +42 -0
  132. package/dist/runtime/connect.d.ts.map +1 -0
  133. package/dist/runtime/connect.js +234 -0
  134. package/dist/runtime/connect.js.map +1 -0
  135. package/dist/runtime/dispatch.d.ts +32 -0
  136. package/dist/runtime/dispatch.d.ts.map +1 -0
  137. package/dist/runtime/dispatch.js +46 -0
  138. package/dist/runtime/dispatch.js.map +1 -0
  139. package/dist/runtime/environment.d.ts +7 -0
  140. package/dist/runtime/environment.d.ts.map +1 -0
  141. package/dist/runtime/environment.js +30 -0
  142. package/dist/runtime/environment.js.map +1 -0
  143. package/dist/runtime/recall.d.ts +9 -0
  144. package/dist/runtime/recall.d.ts.map +1 -0
  145. package/dist/runtime/recall.js +13 -0
  146. package/dist/runtime/recall.js.map +1 -0
  147. package/dist/runtime/run-tool.d.ts +18 -0
  148. package/dist/runtime/run-tool.d.ts.map +1 -0
  149. package/dist/runtime/run-tool.js +70 -0
  150. package/dist/runtime/run-tool.js.map +1 -0
  151. package/dist/serve/index.d.ts +5 -0
  152. package/dist/serve/index.d.ts.map +1 -0
  153. package/dist/serve/index.js +50 -0
  154. package/dist/serve/index.js.map +1 -0
  155. package/dist/serve/io.d.ts +14 -0
  156. package/dist/serve/io.d.ts.map +1 -0
  157. package/dist/serve/io.js +6 -0
  158. package/dist/serve/io.js.map +1 -0
  159. package/dist/serve/leaving.d.ts +12 -0
  160. package/dist/serve/leaving.d.ts.map +1 -0
  161. package/dist/serve/leaving.js +61 -0
  162. package/dist/serve/leaving.js.map +1 -0
  163. package/dist/serve/lines.d.ts +7 -0
  164. package/dist/serve/lines.d.ts.map +1 -0
  165. package/dist/serve/lines.js +25 -0
  166. package/dist/serve/lines.js.map +1 -0
  167. package/dist/serve/load.d.ts +26 -0
  168. package/dist/serve/load.d.ts.map +1 -0
  169. package/dist/serve/load.js +61 -0
  170. package/dist/serve/load.js.map +1 -0
  171. package/dist/serve/machine.d.ts +4 -0
  172. package/dist/serve/machine.d.ts.map +1 -0
  173. package/dist/serve/machine.js +33 -0
  174. package/dist/serve/machine.js.map +1 -0
  175. package/dist/serve/prompt.d.ts +7 -0
  176. package/dist/serve/prompt.d.ts.map +1 -0
  177. package/dist/serve/prompt.js +51 -0
  178. package/dist/serve/prompt.js.map +1 -0
  179. package/dist/serve/start.d.ts +7 -0
  180. package/dist/serve/start.d.ts.map +1 -0
  181. package/dist/serve/start.js +95 -0
  182. package/dist/serve/start.js.map +1 -0
  183. package/dist/serve/viewing.d.ts +17 -0
  184. package/dist/serve/viewing.d.ts.map +1 -0
  185. package/dist/serve/viewing.js +42 -0
  186. package/dist/serve/viewing.js.map +1 -0
  187. package/dist/views/built-in-rules.d.ts +9 -0
  188. package/dist/views/built-in-rules.d.ts.map +1 -0
  189. package/dist/views/built-in-rules.js +28 -0
  190. package/dist/views/built-in-rules.js.map +1 -0
  191. package/dist/views/components.d.ts +17 -0
  192. package/dist/views/components.d.ts.map +1 -0
  193. package/dist/views/components.js +33 -0
  194. package/dist/views/components.js.map +1 -0
  195. package/dist/views/jsx-dev-runtime.d.ts +3 -0
  196. package/dist/views/jsx-dev-runtime.d.ts.map +1 -0
  197. package/dist/views/jsx-dev-runtime.js +4 -0
  198. package/dist/views/jsx-dev-runtime.js.map +1 -0
  199. package/dist/views/jsx-runtime.d.ts +46 -0
  200. package/dist/views/jsx-runtime.d.ts.map +1 -0
  201. package/dist/views/jsx-runtime.js +63 -0
  202. package/dist/views/jsx-runtime.js.map +1 -0
  203. package/dist/views/layout.d.ts +19 -0
  204. package/dist/views/layout.d.ts.map +1 -0
  205. package/dist/views/layout.js +58 -0
  206. package/dist/views/layout.js.map +1 -0
  207. package/dist/views/nodes.d.ts +48 -0
  208. package/dist/views/nodes.d.ts.map +1 -0
  209. package/dist/views/nodes.js +45 -0
  210. package/dist/views/nodes.js.map +1 -0
  211. package/dist/views/panels.d.ts +17 -0
  212. package/dist/views/panels.d.ts.map +1 -0
  213. package/dist/views/panels.js +62 -0
  214. package/dist/views/panels.js.map +1 -0
  215. package/dist/views/render.d.ts +11 -0
  216. package/dist/views/render.d.ts.map +1 -0
  217. package/dist/views/render.js +19 -0
  218. package/dist/views/render.js.map +1 -0
  219. package/dist/wire/agent-config.d.ts +213 -0
  220. package/dist/wire/agent-config.d.ts.map +1 -0
  221. package/dist/wire/agent-config.js +126 -0
  222. package/dist/wire/agent-config.js.map +1 -0
  223. package/dist/wire/codec.d.ts +43 -0
  224. package/dist/wire/codec.d.ts.map +1 -0
  225. package/dist/wire/codec.js +51 -0
  226. package/dist/wire/codec.js.map +1 -0
  227. package/dist/wire/commands.d.ts +443 -0
  228. package/dist/wire/commands.d.ts.map +1 -0
  229. package/dist/wire/commands.js +203 -0
  230. package/dist/wire/commands.js.map +1 -0
  231. package/dist/wire/defs.d.ts +373 -0
  232. package/dist/wire/defs.d.ts.map +1 -0
  233. package/dist/wire/defs.js +212 -0
  234. package/dist/wire/defs.js.map +1 -0
  235. package/dist/wire/envelope.d.ts +29 -0
  236. package/dist/wire/envelope.d.ts.map +1 -0
  237. package/dist/wire/envelope.js +27 -0
  238. package/dist/wire/envelope.js.map +1 -0
  239. package/dist/wire/events-call.d.ts +446 -0
  240. package/dist/wire/events-call.d.ts.map +1 -0
  241. package/dist/wire/events-call.js +196 -0
  242. package/dist/wire/events-call.js.map +1 -0
  243. package/dist/wire/events.d.ts +946 -0
  244. package/dist/wire/events.d.ts.map +1 -0
  245. package/dist/wire/events.js +309 -0
  246. package/dist/wire/events.js.map +1 -0
  247. package/dist/wire/index.d.ts +19 -0
  248. package/dist/wire/index.d.ts.map +1 -0
  249. package/dist/wire/index.js +19 -0
  250. package/dist/wire/index.js.map +1 -0
  251. package/dist/wire/metrics.d.ts +366 -0
  252. package/dist/wire/metrics.d.ts.map +1 -0
  253. package/dist/wire/metrics.js +269 -0
  254. package/dist/wire/metrics.js.map +1 -0
  255. package/dist/wire/reduce.d.ts +10 -0
  256. package/dist/wire/reduce.d.ts.map +1 -0
  257. package/dist/wire/reduce.js +367 -0
  258. package/dist/wire/reduce.js.map +1 -0
  259. package/dist/wire/registry.d.ts +1789 -0
  260. package/dist/wire/registry.d.ts.map +1 -0
  261. package/dist/wire/registry.js +118 -0
  262. package/dist/wire/registry.js.map +1 -0
  263. package/dist/wire/rest-data.d.ts +170 -0
  264. package/dist/wire/rest-data.d.ts.map +1 -0
  265. package/dist/wire/rest-data.js +78 -0
  266. package/dist/wire/rest-data.js.map +1 -0
  267. package/dist/wire/rest-hosting.d.ts +74 -0
  268. package/dist/wire/rest-hosting.d.ts.map +1 -0
  269. package/dist/wire/rest-hosting.js +38 -0
  270. package/dist/wire/rest-hosting.js.map +1 -0
  271. package/dist/wire/rest-retrieval.d.ts +214 -0
  272. package/dist/wire/rest-retrieval.d.ts.map +1 -0
  273. package/dist/wire/rest-retrieval.js +161 -0
  274. package/dist/wire/rest-retrieval.js.map +1 -0
  275. package/dist/wire/rest.d.ts +786 -0
  276. package/dist/wire/rest.d.ts.map +1 -0
  277. package/dist/wire/rest.js +238 -0
  278. package/dist/wire/rest.js.map +1 -0
  279. package/dist/wire/room.d.ts +106 -0
  280. package/dist/wire/room.d.ts.map +1 -0
  281. package/dist/wire/room.js +73 -0
  282. package/dist/wire/room.js.map +1 -0
  283. package/dist/wire/state.d.ts +915 -0
  284. package/dist/wire/state.d.ts.map +1 -0
  285. package/dist/wire/state.js +189 -0
  286. package/dist/wire/state.js.map +1 -0
  287. package/dist/wire/verbs.d.ts +73 -0
  288. package/dist/wire/verbs.d.ts.map +1 -0
  289. package/dist/wire/verbs.js +50 -0
  290. package/dist/wire/verbs.js.map +1 -0
  291. package/package.json +74 -0
  292. package/tsconfig.tenant.json +24 -0
@@ -0,0 +1,212 @@
1
+ /** The shapes the rest of the wire is made of: channels, parts of a turn, tools, memory, 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
+ /** How a call is had: spoken (`voice`) or written (`text`). A web call can be either. */
9
+ export const MediumSchema = z.enum(["voice", "text"]);
10
+ /** Inbound: the public reached the agent. Outbound: the agent reached out (a dial). */
11
+ export const DirectionSchema = z.enum(["inbound", "outbound"]);
12
+ /**
13
+ * Which of the two worlds a key opens, and so which world an agent is held in and a call ran in. A
14
+ * key is issued into one; an agent registered on it and every call it takes carry that one; a door
15
+ * claimed in one is refused to a key of the other. `sandbox` is where things are written and
16
+ * `production` is what the public reaches — and whether a sandbox agent is one PERSON's copy or
17
+ * the team's shared one is not this field: it is whether the key that registered it names a
18
+ * person. Every key issued before the field existed is production.
19
+ */
20
+ export const EnvSchema = z.enum(["production", "sandbox"]);
21
+ /**
22
+ * What a console may ask of the process standing in the agent's directory, relayed by the gateway:
23
+ * a written call to the class mounted there (chat), a simulated caller put on the class it holds,
24
+ * its goldens and a suite of them, its knowledge folder pushed or its golden asked, its memory
25
+ * goldens, the panel it draws beside a conversation (view), a call promoted to a candidate file,
26
+ * the drift of the last two windows, and the reproductions a broken run left on that disk.
27
+ * Everything else a console needs is a door of the gateway.
28
+ */
29
+ 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"]);
30
+ /**
31
+ * Why the call is over. Who hung up, what failed before anybody could, drained: the platform took
32
+ * the worker down (a deploy, a stop) with the call still on it, or app_detached: the app holding
33
+ * the agent closed its socket mid-call, so nothing was rendering the prompt or answering a tool —
34
+ * both are nobody's fault and neither is an error.
35
+ */
36
+ export const EndReasonSchema = z.enum(["caller_hung_up", "agent_hung_up", "supervisor_ended", "transferred", "no_answer", "busy", "dial_failed", "timeout", "drained", "app_detached", "error"]);
37
+ /** Whose action ended the call. platform covers timeouts, errors and a drained worker. */
38
+ export const EndedBySchema = z.enum(["caller", "agent", "supervisor", "platform"]);
39
+ /**
40
+ * What one judge answered about a finished call. Held: the rule held. Broken: it did not, and the
41
+ * reason names the evidence. Deferred: the judge was asked and could not settle it. Skipped:
42
+ * nobody asked it — no model was reachable inside the call's judging budget.
43
+ */
44
+ export const ScoreVerdictSchema = z.enum(["held", "broken", "deferred", "skipped"]);
45
+ /**
46
+ * Cold: the caller is sent on with a REFER on their SIP leg and the call ends here. Warm: the
47
+ * number is dialled into the call's own room, the agent stays on the line until the other side
48
+ * answers and then falls silent; the call ends when either of them hangs up.
49
+ */
50
+ export const TransferModeSchema = z.enum(["cold", "warm"]);
51
+ /**
52
+ * Which region of the prompt a block lives in: static, before the history, cached by the provider;
53
+ * or dynamic, after the history, replaced every turn. The append-only history in between is never
54
+ * written by the app.
55
+ */
56
+ export const PromptRegionSchema = z.enum(["static", "dynamic"]);
57
+ /**
58
+ * How the knowledge base reaches the model: retrieved, the platform runs search itself when the
59
+ * caller's turn ends; or tool, the model calls search when it decides to. Either way the chunks
60
+ * arrive as a tool result.
61
+ */
62
+ export const DocsModeSchema = z.enum(["retrieved", "tool"]);
63
+ /**
64
+ * One named block of the prompt and the region it lives in. The default layout, when an agent
65
+ * declares none, is identity, knowledge and tools (static), then the history, then view (dynamic).
66
+ * A block's text is written per call with prompt.set.
67
+ */
68
+ export const PromptBlockSpecSchema = z.strictObject({
69
+ name: z.string().regex(/^[a-z][a-z0-9_]*$/),
70
+ region: PromptRegionSchema,
71
+ });
72
+ /**
73
+ * What the platform believes the person on the line is doing right now. The states are the
74
+ * session's own.
75
+ */
76
+ export const UserStateSchema = z.enum(["listening", "speaking", "away"]);
77
+ /**
78
+ * What the agent is doing right now, in the session's own words: warming up, waiting, hearing the
79
+ * caller, generating, or playing audio.
80
+ */
81
+ export const AgentStateSchema = z.enum(["initializing", "idle", "listening", "thinking", "speaking"]);
82
+ /**
83
+ * Who a participant is to the call: the person the agent serves (over SIP or the widget), the
84
+ * agent itself, a supervisor who took a seat in the room, a listener who only hears, or a second
85
+ * SIP leg that room.invite brought in.
86
+ */
87
+ export const ParticipantKindSchema = z.enum(["caller", "agent", "supervisor", "listener", "sip"]);
88
+ /** What a track carries: a microphone's audio, a camera's video, or a screen share. */
89
+ export const TrackKindSchema = z.enum(["audio", "video", "screen"]);
90
+ /** Where a track comes from, as livekit's TrackSource names it, in lower case. */
91
+ export const TrackSourceSchema = z.enum(["microphone", "camera", "screen_share", "screen_share_audio", "unknown"]);
92
+ /**
93
+ * Where an outside fact came from: the tenant's backend over the app socket (app), or a
94
+ * participant's browser over the DataChannel (participant).
95
+ */
96
+ export const EventSourceSchema = z.enum(["app", "participant"]);
97
+ /**
98
+ * Who may see a field of the app's state: everyone in the call (public), the tenant's own readers
99
+ * (tenant, the default for a field never declared), or nobody without masking (pii).
100
+ */
101
+ export const VisibilitySchema = z.enum(["public", "tenant", "pii"]);
102
+ /**
103
+ * Which projection a sink applies before a state or an entry leaves the platform: public for a
104
+ * participant reading its own call, tenant for the tenant's readers. The contract is
105
+ * docs/protocol/projections.md; a client never applies one.
106
+ */
107
+ export const ProjectionSchema = z.enum(["public", "tenant"]);
108
+ /**
109
+ * Who is on the line, as far as the platform knows. Everything is optional: a web visitor may be
110
+ * nobody yet.
111
+ */
112
+ export const ContactSchema = z.strictObject({
113
+ id: z.string().nullish(),
114
+ phone: z.string().nullish(),
115
+ name: z.string().nullish(),
116
+ email: z.string().nullish(),
117
+ external_id: z.string().nullish(),
118
+ });
119
+ /**
120
+ * One door to an agent: a channel and, for phone and WhatsApp, the number that answers. A number
121
+ * is a route, never an agent.
122
+ */
123
+ export const RouteSchema = z.strictObject({
124
+ channel: ChannelSchema,
125
+ number: z.string().nullable(),
126
+ label: z.string().nullish(),
127
+ });
128
+ /** The human who sent a supervise verb, as the token that let them in names them. */
129
+ export const SupervisorSchema = z.strictObject({
130
+ id: z.string(),
131
+ name: z.string().nullish(),
132
+ });
133
+ /**
134
+ * What the app declares about one tool: the contract the model sees and the rules the platform
135
+ * enforces before running it.
136
+ */
137
+ export const ToolSpecSchema = z.strictObject({
138
+ name: z.string(),
139
+ description: z.string(),
140
+ parameters: z.record(z.string(), z.unknown()),
141
+ side_effect: z.enum(["read", "write", "irreversible"]).nullish(),
142
+ confirm: z.string().nullish(),
143
+ pii: z.array(z.string()).nullish(),
144
+ timeout_s: z.number().nullish(),
145
+ });
146
+ /**
147
+ * What came back from running a tool in the app's process. Either an output or an error, never
148
+ * both.
149
+ */
150
+ export const ToolResultSchema = z.strictObject({
151
+ call_id: z.string(),
152
+ name: z.string(),
153
+ output: z.unknown().nullish(),
154
+ error: z.string().nullish(),
155
+ summary: z.string().nullish(),
156
+ duration_s: z.number().nullish(),
157
+ });
158
+ /**
159
+ * One thing remembered about a contact: a sentence, where it came from, and how well it matched
160
+ * when recalled.
161
+ */
162
+ export const MemoryFactSchema = z.strictObject({
163
+ id: z.string().nullish(),
164
+ text: z.string(),
165
+ category: z.string().nullish(),
166
+ score: z.number().nullish(),
167
+ source: z.string().nullish(),
168
+ });
169
+ /**
170
+ * One operation against the contact's memory: a recall during the turn, a remember at hangup, or a
171
+ * forget on request.
172
+ */
173
+ export const MemoryOpSchema = z.strictObject({
174
+ op: z.enum(["recall", "remember", "forget"]),
175
+ contact: z.string().nullish(),
176
+ query: z.string().nullish(),
177
+ facts: z.array(MemoryFactSchema),
178
+ took_ms: z.number(),
179
+ });
180
+ /** One chunk of the knowledge base that retrieval put in front of the model for this turn. */
181
+ export const DocSourceSchema = z.strictObject({
182
+ id: z.string(),
183
+ base: z.string().nullish(),
184
+ path: z.string(),
185
+ heading: z.string().nullish(),
186
+ score: z.number(),
187
+ excerpt: z.string().nullish(),
188
+ });
189
+ /** One priced line: a model, what was counted, how much, and what it came to. */
190
+ export const CostRowSchema = z.strictObject({
191
+ provider: z.string(),
192
+ model: z.string(),
193
+ unit: z.enum(["input_tokens", "cached_input_tokens", "cache_creation_tokens", "output_tokens", "characters", "audio_seconds", "requests", "session_seconds", "minutes"]),
194
+ quantity: z.number(),
195
+ unit_price_usd: z.number(),
196
+ usd: z.number(),
197
+ });
198
+ /** A usage row the price table does not know. It is listed, never priced at zero. */
199
+ export const UnpricedRowSchema = z.strictObject({
200
+ provider: z.string(),
201
+ model: z.string(),
202
+ });
203
+ /**
204
+ * What the call cost in provider fees, informational, in US dollars, the currency providers price
205
+ * in. The runtime never prices commercially; this is the provider's bill as best we know it.
206
+ */
207
+ export const CostSchema = z.strictObject({
208
+ usd: z.number(),
209
+ rows: z.array(CostRowSchema),
210
+ unpriced: z.array(UnpricedRowSchema),
211
+ });
212
+ //# sourceMappingURL=defs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defs.js","sourceRoot":"","sources":["../../src/wire/defs.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,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;AAIlE,yFAAyF;AACzF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAItD,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,EA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AC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;IAC5B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;CACrC,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /** The log entry and the command frame, as the socket and every door carry them. */
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
+ /**
18
+ * One instruction from an app to the gateway over its WebSocket. The gateway answers with the
19
+ * events the command produces, or with an error naming the command's id.
20
+ */
21
+ export declare const CommandSchema: z.ZodObject<{
22
+ type: z.ZodString;
23
+ agent: z.ZodString;
24
+ call: z.ZodNullable<z.ZodString>;
25
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
27
+ }, z.core.$strict>;
28
+ export type Command = z.infer<typeof CommandSchema>;
29
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/wire/envelope.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAEpF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;kBAQtB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;kBAMxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /** The log entry and the command frame, as the socket and every door carry them. */
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
+ /**
17
+ * One instruction from an app to the gateway over its WebSocket. The gateway answers with the
18
+ * events the command produces, or with an error naming the command's id.
19
+ */
20
+ export const CommandSchema = z.strictObject({
21
+ type: z.string(),
22
+ agent: z.string(),
23
+ call: z.string().nullable(),
24
+ id: z.string().nullish(),
25
+ data: z.record(z.string(), z.unknown()),
26
+ });
27
+ //# sourceMappingURL=envelope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/wire/envelope.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAEpF,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;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,YAAY,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;CACxC,CAAC,CAAC"}