@babelforce/babelconnect-sdk 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.
@@ -0,0 +1,161 @@
1
+ // @generated by protoc-gen-connect-es v1.7.0 with parameter "target=ts"
2
+ // @generated from file babelconnect/v1/babelconnect.proto (package babelconnect.v1, syntax proto3)
3
+ /* eslint-disable */
4
+ // @ts-nocheck
5
+ // Package babelconnect.v1 is the control protocol between a babelconnect client
6
+ // (the SDK, via Go/Dart/gRPC-web) and babelconnect-server. It carries CONTROL
7
+ // ONLY — media is WebRTC on a separate plane; the server terminates the client's
8
+ // WebRTC leg.
9
+ //
10
+ // State lives on the SERVER, not the client. babelconnect-server holds the
11
+ // canonical per-agent AgentView and pushes an initial snapshot + entity-level
12
+ // patches over the Session stream; clients are DUMB RENDERERS — they apply
13
+ // patches mechanically and send Command intents, with no domain logic.
14
+ //
15
+ // Two entry points:
16
+ // - Authenticate: unary handshake → the agent's identity.
17
+ // - Session: a long-lived bidi stream. Client → server: Command intents
18
+ // (register/place/answer/hangup/mute/...). Server → client:
19
+ // StateUpdate (snapshot then patches). The WebRTC offer rides
20
+ // on CallState (when RINGING); the client answers via the
21
+ // AnswerCall intent — signaling fits the state model, no
22
+ // separate event channel.
23
+ //
24
+ // The bearer token travels in gRPC metadata ("authorization: Bearer <token>")
25
+ // on every call; Authenticate additionally returns the resolved identity.
26
+ //
27
+ // In addition to gRPC/gRPC-web, the unary RPCs are exposed as a REST+JSON surface
28
+ // via grpc-gateway (the google.api.http annotations below) with an OpenAPI v2 spec
29
+ // — one proto source of truth, two wire surfaces. Streaming stays gRPC/gRPC-web.
30
+ import { Ack, AgentView, AuthenticateRequest, Command, GetStateRequest, HistoryRequest, HistoryResponse, Identity, PhonebookRequest, PhonebookResponse, SendSmsRequest, SmsConversation, SmsThreadRequest, SmsThreadResponse, StateUpdate, SubscribeRequest } from "./babelconnect_pb.js";
31
+ import { MethodKind } from "@bufbuild/protobuf";
32
+ /**
33
+ * @generated from service babelconnect.v1.Agent
34
+ */
35
+ export const Agent = {
36
+ typeName: "babelconnect.v1.Agent",
37
+ methods: {
38
+ /**
39
+ * Authenticate validates the caller's bearer token and returns the resolved
40
+ * agent identity (id, account, presence).
41
+ *
42
+ * @generated from rpc babelconnect.v1.Agent.Authenticate
43
+ */
44
+ authenticate: {
45
+ name: "Authenticate",
46
+ I: AuthenticateRequest,
47
+ O: Identity,
48
+ kind: MethodKind.Unary,
49
+ },
50
+ /**
51
+ * Session opens the long-lived control stream. The client sends Command
52
+ * intents; the server streams StateUpdate (one snapshot on open, then
53
+ * entity-level patches). UI = f(AgentView).
54
+ *
55
+ * Native clients (Go/Dart desktop/mobile over HTTP/2) use this bidi stream.
56
+ *
57
+ * @generated from rpc babelconnect.v1.Agent.Session
58
+ */
59
+ session: {
60
+ name: "Session",
61
+ I: Command,
62
+ O: StateUpdate,
63
+ kind: MethodKind.BiDiStreaming,
64
+ },
65
+ /**
66
+ * Subscribe + Send are the browser-friendly split of Session: a browser speaks
67
+ * gRPC-web, which cannot client-stream, so the bidi Session is impossible there.
68
+ * Subscribe is the server→client half (the StateUpdate stream); Send is the
69
+ * client→server half (one Command per unary call). Together they are equivalent
70
+ * to Session for a single agent — the server keys both to the agent's one state
71
+ * store. Command rejections still arrive as an Error on the Subscribe stream
72
+ * (never on Send's reply), exactly as on Session.
73
+ *
74
+ * @generated from rpc babelconnect.v1.Agent.Subscribe
75
+ */
76
+ subscribe: {
77
+ name: "Subscribe",
78
+ I: SubscribeRequest,
79
+ O: StateUpdate,
80
+ kind: MethodKind.ServerStreaming,
81
+ },
82
+ /**
83
+ * @generated from rpc babelconnect.v1.Agent.Send
84
+ */
85
+ send: {
86
+ name: "Send",
87
+ I: Command,
88
+ O: Ack,
89
+ kind: MethodKind.Unary,
90
+ },
91
+ /**
92
+ * GetHistory returns the agent's past calls (the History tab). A unary query —
93
+ * history is on-demand reference data, not part of the live AgentView snapshot.
94
+ *
95
+ * @generated from rpc babelconnect.v1.Agent.GetHistory
96
+ */
97
+ getHistory: {
98
+ name: "GetHistory",
99
+ I: HistoryRequest,
100
+ O: HistoryResponse,
101
+ kind: MethodKind.Unary,
102
+ },
103
+ /**
104
+ * GetSmsThread returns the messages of one SMS conversation (the chat thread).
105
+ * A unary query like GetHistory — the live AgentView carries only the
106
+ * SmsConversation summary; the full thread is fetched on demand. conversation_id
107
+ * is a query param (it can be a peer phone number when no conversation id is
108
+ * available), so this stays distinct from the POST /v1/agent/sms send.
109
+ *
110
+ * @generated from rpc babelconnect.v1.Agent.GetSmsThread
111
+ */
112
+ getSmsThread: {
113
+ name: "GetSmsThread",
114
+ I: SmsThreadRequest,
115
+ O: SmsThreadResponse,
116
+ kind: MethodKind.Unary,
117
+ },
118
+ /**
119
+ * GetPhonebook returns the agent's dial-from contacts + recent numbers (the
120
+ * Contacts tab). A unary query like GetHistory: the live AgentView carries a
121
+ * phonebook snapshot frozen at register (AgentInfo.phonebook); this re-pulls the
122
+ * merged contacts+recents list on demand (refresh) so a long-running session can
123
+ * see new contacts. `query` filters by label/number.
124
+ *
125
+ * @generated from rpc babelconnect.v1.Agent.GetPhonebook
126
+ */
127
+ getPhonebook: {
128
+ name: "GetPhonebook",
129
+ I: PhonebookRequest,
130
+ O: PhonebookResponse,
131
+ kind: MethodKind.Unary,
132
+ },
133
+ /**
134
+ * GetState returns the agent's current AgentView as a single unary call — the
135
+ * REST/web "get current state" (the Subscribe stream is the realtime twin). When
136
+ * no live session backs the caller, the server builds the snapshot on demand
137
+ * (agent + presence + wrap-up); live call state requires a stream.
138
+ *
139
+ * @generated from rpc babelconnect.v1.Agent.GetState
140
+ */
141
+ getState: {
142
+ name: "GetState",
143
+ I: GetStateRequest,
144
+ O: AgentView,
145
+ kind: MethodKind.Unary,
146
+ },
147
+ /**
148
+ * SendSms sends an SMS and returns the (upserted) conversation summary. Exposed
149
+ * over REST as POST /v1/agent/sms and as the Command.send_sms intent on the
150
+ * stream — both send the same message.
151
+ *
152
+ * @generated from rpc babelconnect.v1.Agent.SendSms
153
+ */
154
+ sendSms: {
155
+ name: "SendSms",
156
+ I: SendSmsRequest,
157
+ O: SmsConversation,
158
+ kind: MethodKind.Unary,
159
+ },
160
+ }
161
+ };