@ouispec/contract 0.4.9 → 0.6.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/INTEGRATOR-GUIDE.md +239 -6
- package/dist/generated/contract.d.ts +406 -11
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/schemas.d.ts +37 -0
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +1033 -6
- package/dist/generated/schemas.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/render-contract.d.ts.map +1 -1
- package/dist/render-contract.js +2 -0
- package/dist/render-contract.js.map +1 -1
- package/package.json +1 -1
- package/schemas/agent-evals.json +219 -0
- package/schemas/approvals.json +70 -5
- package/schemas/conversation-takeover.json +410 -0
- package/schemas/event-declarations.json +1 -1
package/schemas/approvals.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://schemas.closurestudio.ai/oui/v1/approvals.json",
|
|
4
4
|
"title": "Approvals",
|
|
5
|
-
"description": "Approvals: the shapes the agent worker, the approval store in the realtime server, the browser's approval card, OUI's surface runtime and a conversation engine exchange. An irreversible action — a `transaction`, or a `write` declared `destructive` — runs only on an approval the person gave, bound to the exact call by a single-use token.\n\n1. The worker stops the turn at the call and stores it (`PendingApprovalInput`); the person's tab receives `agent:approval_required` (`ApprovalRequiredEvent`) and renders the approval card from its `preview`, whose every word comes from the action's declaration, never from the model.\n2. In a UI only a click on the card counts: the card sends `approval:decide` (`ApprovalDecidePayload`) from the person's own socket. On a conversation channel, the verbatim `readback` and an affirmative next turn.\n3. The store answers the decider only (`ApprovalDecideResult`): a single-use token, a compact JWS (`ApprovalTokenClaims`), and the call's `argsHash`. The tab's OUI runtime holds an `ApprovalGrant
|
|
5
|
+
"description": "Approvals: the shapes the agent worker, the approval store in the realtime server, the browser's approval card, OUI's surface runtime and a conversation engine exchange. An irreversible action — a `transaction`, or a `write` declared `destructive` — runs only on an approval the person gave, bound to the exact call by a single-use token.\n\n1. The worker stops the turn at the call and stores it (`PendingApprovalInput`); the person's tab receives `agent:approval_required` (`ApprovalRequiredEvent`) and renders the approval card from its `preview`, whose every word comes from the action's declaration, never from the model.\n2. In a UI only a click on the card counts: the card sends `approval:decide` (`ApprovalDecidePayload`) from the person's own socket. On a conversation channel, the verbatim `readback` and an affirmative next turn. An action on the person's page is approved by its card, or on `voice`, `phone` and `chat` by its readback and an affirmative next turn: the store then pushes the tab a single-use grant (`ApprovalGrantedEvent`), which one tab claims (`ApprovalClaimPayload`, `ApprovalClaimResult`).\n3. The store answers the decider only (`ApprovalDecideResult`): a single-use token, a compact JWS (`ApprovalTokenClaims`), and the call's `argsHash`. The tab's OUI runtime holds an `ApprovalGrant`: from the click's answer, or from the claimed push.\n4. The next turn carries the token (`ApprovalContinuation`); the worker redeems it for the stored call, exactly (`ApprovedCall`), and runs it. A UI action request then carries `approval` (`ActionRequestApproval`), which the browser checks against its grant before it runs the handler.\n5. When the realtime server holds receipt keys, redemption also returns a receipt (`ApprovalReceiptClaims`): a compact JWS, EdDSA over Ed25519, that the approved host or API call carries to the tool's own API (the `OUI-Approval-Receipt` header). The tool verifies it offline against the realtime server's published keys (`/.well-known/oui-approval-jwks.json`); a UI action gets none.\n\nThe args hash is SHA-256 over the RFC 8785 (JCS) canonical JSON of the call's arguments, lowercase hex; `oui-spec/approval-vectors.json` holds every implementation, in any language, to it.",
|
|
6
6
|
"$defs": {
|
|
7
7
|
"ArgsHash": {
|
|
8
8
|
"description": "SHA-256 of the RFC 8785 canonical JSON of a call's arguments, lowercase hex.",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"pattern": "^[0-9a-f]{64}$"
|
|
11
11
|
},
|
|
12
12
|
"ApprovalChannel": {
|
|
13
|
-
"description": "Where the person confirmed. In a UI only a click on the card counts (`ui`); in a conversation channel, the verbatim readback and an affirmative next turn.",
|
|
13
|
+
"description": "Where the person confirmed. In a UI only a click on the card counts (`ui`); in a conversation channel, the verbatim readback and an affirmative next turn. An action on the person's page is approved by its card, or on `voice`, `phone` and `chat` (`READBACK_UI_APPROVAL_CHANNELS`) by its readback; never by SMS.",
|
|
14
14
|
"enum": ["ui", "voice", "phone", "sms", "chat"]
|
|
15
15
|
},
|
|
16
16
|
"ApprovalDecision": { "enum": ["approve", "decline"] },
|
|
@@ -64,6 +64,11 @@
|
|
|
64
64
|
"description": "`ui` for an action on the person's page, which gets no receipt (the browser checks its own grant); `backend` for a host or API tool. Absent is `backend`.",
|
|
65
65
|
"enum": ["ui", "backend"]
|
|
66
66
|
},
|
|
67
|
+
"room": {
|
|
68
|
+
"description": "For an action on the person's page: the realtime room of the turn that asked (its `socketRoom`), where the action is dispatched. When the person approves it by voice or in chat, its grant is pushed to this room and nowhere else. Never set on a host or API tool.",
|
|
69
|
+
"type": "string",
|
|
70
|
+
"minLength": 1
|
|
71
|
+
},
|
|
67
72
|
"operationId": {
|
|
68
73
|
"description": "For a generated API tool, its OpenAPI `operationId`: carried on the call's receipt.",
|
|
69
74
|
"type": "string",
|
|
@@ -127,7 +132,7 @@
|
|
|
127
132
|
"additionalProperties": false
|
|
128
133
|
},
|
|
129
134
|
"ApprovalRefusalReason": {
|
|
130
|
-
"description": "Why an approval was refused:\n\n- `unknown`: no such pending approval: never stored, already declined or redeemed, or expired and gone.\n- `forbidden`: another user's approval, or another conversation's.\n- `expired`.\n- `decided`: already decided.\n- `used`: already redeemed.\n- `invalid`: not a token this environment signed, or malformed.\n- `mismatch`: signed, but not for the stored call.\n- `channel`: a decision from a channel that may not make it.",
|
|
135
|
+
"description": "Why an approval was refused:\n\n- `unknown`: no such pending approval, or grant: never stored, already declined or redeemed, withdrawn, or expired and gone.\n- `forbidden`: another user's approval, or another conversation's; or a grant claimed from a socket that is not in its room.\n- `expired`.\n- `decided`: already decided.\n- `used`: already redeemed; or a grant another tab has claimed.\n- `invalid`: not a token this environment signed, or malformed.\n- `mismatch`: signed, but not for the stored call.\n- `channel`: a decision from a channel that may not make it: an action on the person's page approved by SMS, or by voice or chat when no room was stored with it.",
|
|
131
136
|
"enum": ["unknown", "forbidden", "expired", "decided", "used", "invalid", "mismatch", "channel"]
|
|
132
137
|
},
|
|
133
138
|
"ApprovalRefusal": {
|
|
@@ -166,6 +171,66 @@
|
|
|
166
171
|
{ "$ref": "#/$defs/ApprovalRefusal" }
|
|
167
172
|
]
|
|
168
173
|
},
|
|
174
|
+
"ApprovalGrantedEvent": {
|
|
175
|
+
"description": "`agent:approval_granted`: the person approved an action on their page by voice, on the phone or in chat, after its verbatim readback. The approval store pushes it, in the same step as the decision, to the room stored with the approval and nowhere else; the realtime server's emit API refuses it. A tab whose open conversation is `conversationId` and which is joined to `room` claims it (`approval:claim`); only the first claim is answered with the grant.",
|
|
176
|
+
"type": "object",
|
|
177
|
+
"properties": {
|
|
178
|
+
"approvalId": { "type": "string", "minLength": 1 },
|
|
179
|
+
"grantId": { "description": "This grant, single use: what a claim names.", "type": "string", "minLength": 1 },
|
|
180
|
+
"argsHash": { "description": "The approved call's args hash: what the tab's OUI runtime checks the request's params against.", "$ref": "#/$defs/ArgsHash" },
|
|
181
|
+
"expiresAt": {
|
|
182
|
+
"description": "Epoch ms: two minutes after the decision (`APPROVAL_GRANT_TTL_MS`), or the approval's own expiry if sooner. A claim after it is refused, and the runtime admits nothing after it.",
|
|
183
|
+
"type": "number"
|
|
184
|
+
},
|
|
185
|
+
"conversationId": { "type": "string", "minLength": 1 },
|
|
186
|
+
"room": { "description": "The room it was pushed to: that of the turn that asked.", "type": "string", "minLength": 1 },
|
|
187
|
+
"channel": { "description": "Where the person approved it.", "$ref": "#/$defs/ReadbackUIApprovalChannel" },
|
|
188
|
+
"timestamp": { "type": "number" }
|
|
189
|
+
},
|
|
190
|
+
"required": ["approvalId", "grantId", "argsHash", "expiresAt", "conversationId", "room", "channel", "timestamp"],
|
|
191
|
+
"additionalProperties": false
|
|
192
|
+
},
|
|
193
|
+
"ReadbackUIApprovalChannel": {
|
|
194
|
+
"description": "The conversation channels on which an action on the person's page is approved by its readback and an affirmative next turn, as well as by its card.",
|
|
195
|
+
"enum": ["voice", "phone", "chat"]
|
|
196
|
+
},
|
|
197
|
+
"ApprovalDeclinedEvent": {
|
|
198
|
+
"description": "`agent:approval_declined`: the person declined an action on their page in a conversation channel. Pushed by the approval store to the room stored with the approval, so the card on screen says so. The emit API refuses it.",
|
|
199
|
+
"type": "object",
|
|
200
|
+
"properties": {
|
|
201
|
+
"approvalId": { "type": "string", "minLength": 1 },
|
|
202
|
+
"conversationId": { "type": "string", "minLength": 1 },
|
|
203
|
+
"channel": { "description": "Where the person declined it: a conversation channel.", "enum": ["voice", "phone", "sms", "chat"] },
|
|
204
|
+
"timestamp": { "type": "number" }
|
|
205
|
+
},
|
|
206
|
+
"required": ["approvalId", "conversationId", "channel", "timestamp"],
|
|
207
|
+
"additionalProperties": false
|
|
208
|
+
},
|
|
209
|
+
"ApprovalClaimPayload": {
|
|
210
|
+
"description": "`approval:claim`, from the person's own socket: this tab takes the pushed grant. The store answers only the first claim, from a socket of the approval's user that is in the grant's room, before the grant expires.",
|
|
211
|
+
"type": "object",
|
|
212
|
+
"properties": { "approvalId": { "type": "string", "minLength": 1 }, "grantId": { "type": "string", "minLength": 1 } },
|
|
213
|
+
"required": ["approvalId", "grantId"],
|
|
214
|
+
"additionalProperties": false
|
|
215
|
+
},
|
|
216
|
+
"ApprovalClaimResult": {
|
|
217
|
+
"description": "The answer to a claim: the grant, for this tab's OUI runtime (`runtime.grantApproval`), with where the person approved it; or why not. Only one claim of a grant is ever answered with it.",
|
|
218
|
+
"oneOf": [
|
|
219
|
+
{
|
|
220
|
+
"type": "object",
|
|
221
|
+
"properties": {
|
|
222
|
+
"ok": { "const": true },
|
|
223
|
+
"approvalId": { "type": "string" },
|
|
224
|
+
"argsHash": { "$ref": "#/$defs/ArgsHash" },
|
|
225
|
+
"expiresAt": { "description": "Epoch ms after which the grant no longer admits anything.", "type": "number" },
|
|
226
|
+
"channel": { "$ref": "#/$defs/ReadbackUIApprovalChannel" }
|
|
227
|
+
},
|
|
228
|
+
"required": ["ok", "approvalId", "argsHash", "expiresAt", "channel"],
|
|
229
|
+
"additionalProperties": false
|
|
230
|
+
},
|
|
231
|
+
{ "$ref": "#/$defs/ApprovalRefusal" }
|
|
232
|
+
]
|
|
233
|
+
},
|
|
169
234
|
"ApprovalTokenClaims": {
|
|
170
235
|
"description": "The token's claims: a compact JWS (HS256), signed with the environment's approval key.",
|
|
171
236
|
"type": "object",
|
|
@@ -278,7 +343,7 @@
|
|
|
278
343
|
]
|
|
279
344
|
},
|
|
280
345
|
"ActionRequestApproval": {
|
|
281
|
-
"description": "What a UI action request carries when it runs an approved call (`OUIActionApproval`): the browser runs a `transaction` or destructive action only when this matches a grant this tab received from its own card click.",
|
|
346
|
+
"description": "What a UI action request carries when it runs an approved call (`OUIActionApproval`): the browser runs a `transaction` or destructive action only when this matches a grant this tab received from its own card click, or claimed from the push of an approval given by voice or in chat.",
|
|
282
347
|
"type": "object",
|
|
283
348
|
"properties": {
|
|
284
349
|
"approvalId": { "type": "string" },
|
|
@@ -288,7 +353,7 @@
|
|
|
288
353
|
"additionalProperties": false
|
|
289
354
|
},
|
|
290
355
|
"ApprovalGrant": {
|
|
291
|
-
"description": "What
|
|
356
|
+
"description": "What this tab's OUI runtime holds (`runtime.grantApproval`, `OUIApprovalGrant`): the request the person approved, from their click on the card or from a claimed push, until it expires.",
|
|
292
357
|
"type": "object",
|
|
293
358
|
"properties": {
|
|
294
359
|
"approvalId": { "type": "string" },
|
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schemas.closurestudio.ai/oui/v1/conversation-takeover.json",
|
|
4
|
+
"title": "Conversation takeover",
|
|
5
|
+
"description": "A person on the product's staff takes a live conversation from the agent, answers the customer as themselves, and hands it back: the shapes the realtime server, the agent worker, the product's API, the customer's tab and the staff console exchange.\n\n1. The product's own route checks that this person may take this conversation, then asks the realtime server to hold it (`POST /internal/conversations/{id}/hold`, `TakeOverRequest`). The server keeps one `ConversationHold`, stops any turn of the conversation that is running, and sends `agent:conversation_taken_over` (`ConversationTakenOverEvent`) to the conversation's room.\n2. While the conversation is held, the agent does not answer: a turn that arrives is not run by the model.\n3. The person's messages are stored by the product with `role: 'staff'` and their speaker, and announced (`POST /internal/conversations/{id}/messages`, `AnnounceMessageRequest`) as `agent:conversation_message` (`ConversationMessageEvent`), only while they hold the conversation.\n4. The holder, or the product on its own authority, hands it back (`POST /internal/conversations/{id}/hold/release`, `HandBackRequest`); `agent:conversation_handed_back` (`ConversationHandedBackEvent`) follows, and the agent's next turn reads the whole exchange in its history.\n\nThe realtime server never decides who may take over: its routes take the internal key, and the product calls them after its own check, as it does before it asks for a room token.",
|
|
6
|
+
"$defs": {
|
|
7
|
+
"StaffSpeaker": {
|
|
8
|
+
"description": "A person on the product's staff, as the conversation names them. `displayName` and `role` are shown to the customer; `userId` is what a hand-back and a staff message are checked against. It reaches the customer's tab, so name an id you are content to show (an opaque staff id).",
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"userId": {
|
|
12
|
+
"description": "The staff member's id, as the product's realtime identity names them.",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"minLength": 1,
|
|
15
|
+
"maxLength": 200
|
|
16
|
+
},
|
|
17
|
+
"displayName": {
|
|
18
|
+
"description": "The name the customer sees (\"Jordan\").",
|
|
19
|
+
"type": "string",
|
|
20
|
+
"minLength": 1,
|
|
21
|
+
"maxLength": 80
|
|
22
|
+
},
|
|
23
|
+
"role": {
|
|
24
|
+
"description": "What the customer sees beside the name (\"Toyota of Quillhaven sales\").",
|
|
25
|
+
"type": "string",
|
|
26
|
+
"minLength": 1,
|
|
27
|
+
"maxLength": 80
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"required": [
|
|
31
|
+
"userId",
|
|
32
|
+
"displayName"
|
|
33
|
+
],
|
|
34
|
+
"additionalProperties": false
|
|
35
|
+
},
|
|
36
|
+
"ConversationHold": {
|
|
37
|
+
"description": "A conversation a person holds: the agent does not answer it until it is handed back. One holder at a time.",
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"conversationId": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"minLength": 1
|
|
43
|
+
},
|
|
44
|
+
"holder": {
|
|
45
|
+
"$ref": "#/$defs/StaffSpeaker"
|
|
46
|
+
},
|
|
47
|
+
"since": {
|
|
48
|
+
"description": "When it was taken, epoch ms by the realtime server's clock.",
|
|
49
|
+
"type": "number"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": [
|
|
53
|
+
"conversationId",
|
|
54
|
+
"holder",
|
|
55
|
+
"since"
|
|
56
|
+
],
|
|
57
|
+
"additionalProperties": false
|
|
58
|
+
},
|
|
59
|
+
"TakeoverChange": {
|
|
60
|
+
"description": "A conversation changing hands, as its stored entry and its event say: `taken_over` by a person, `handed_back` to the agent.",
|
|
61
|
+
"enum": [
|
|
62
|
+
"taken_over",
|
|
63
|
+
"handed_back"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"HandBackCause": {
|
|
67
|
+
"description": "Who ended a hold: the person who held it (`holder`), or the product on its own authority (`product`: an idle policy, a manager, the end of a shift).",
|
|
68
|
+
"enum": [
|
|
69
|
+
"holder",
|
|
70
|
+
"product"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"ConversationMessageRole": {
|
|
74
|
+
"description": "Who wrote a message of the conversation: the customer (`user`), the agent (`assistant`), or a person on the staff (`staff`).",
|
|
75
|
+
"enum": [
|
|
76
|
+
"user",
|
|
77
|
+
"assistant",
|
|
78
|
+
"staff"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"ConversationMessage": {
|
|
82
|
+
"description": "A stored message of the conversation, as it is announced to the people watching it.",
|
|
83
|
+
"type": "object",
|
|
84
|
+
"properties": {
|
|
85
|
+
"id": {
|
|
86
|
+
"description": "The product's id for the stored message.",
|
|
87
|
+
"type": "string",
|
|
88
|
+
"minLength": 1,
|
|
89
|
+
"maxLength": 200
|
|
90
|
+
},
|
|
91
|
+
"role": {
|
|
92
|
+
"$ref": "#/$defs/ConversationMessageRole"
|
|
93
|
+
},
|
|
94
|
+
"content": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"maxLength": 100000
|
|
97
|
+
},
|
|
98
|
+
"createdAt": {
|
|
99
|
+
"description": "When it was stored, ISO 8601.",
|
|
100
|
+
"type": "string",
|
|
101
|
+
"minLength": 1
|
|
102
|
+
},
|
|
103
|
+
"speaker": {
|
|
104
|
+
"description": "Set on a `staff` message: who wrote it.",
|
|
105
|
+
"$ref": "#/$defs/StaffSpeaker"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"required": [
|
|
109
|
+
"id",
|
|
110
|
+
"role",
|
|
111
|
+
"content",
|
|
112
|
+
"createdAt"
|
|
113
|
+
],
|
|
114
|
+
"additionalProperties": false
|
|
115
|
+
},
|
|
116
|
+
"ConversationRooms": {
|
|
117
|
+
"description": "Where a conversation's event goes: the conversation's room, which the product names and guards with a room token, and any of the product's own (a team's board).",
|
|
118
|
+
"type": "array",
|
|
119
|
+
"items": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"minLength": 1
|
|
122
|
+
},
|
|
123
|
+
"minItems": 1,
|
|
124
|
+
"maxItems": 5,
|
|
125
|
+
"uniqueItems": true
|
|
126
|
+
},
|
|
127
|
+
"TakeOverRequest": {
|
|
128
|
+
"description": "`POST /internal/conversations/{conversationId}/hold`, from the product's API after its own check that this person may take this conversation.",
|
|
129
|
+
"type": "object",
|
|
130
|
+
"properties": {
|
|
131
|
+
"holder": {
|
|
132
|
+
"$ref": "#/$defs/StaffSpeaker"
|
|
133
|
+
},
|
|
134
|
+
"rooms": {
|
|
135
|
+
"$ref": "#/$defs/ConversationRooms"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"required": [
|
|
139
|
+
"holder",
|
|
140
|
+
"rooms"
|
|
141
|
+
],
|
|
142
|
+
"additionalProperties": false
|
|
143
|
+
},
|
|
144
|
+
"TakeOverResult": {
|
|
145
|
+
"description": "The answer to a take-over: `taken_over` the first time, with the approvals it withdrew; `already` when this holder had it; 409 `held` when someone else holds it.",
|
|
146
|
+
"oneOf": [
|
|
147
|
+
{
|
|
148
|
+
"type": "object",
|
|
149
|
+
"properties": {
|
|
150
|
+
"ok": {
|
|
151
|
+
"const": true
|
|
152
|
+
},
|
|
153
|
+
"change": {
|
|
154
|
+
"enum": [
|
|
155
|
+
"taken_over",
|
|
156
|
+
"already"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"hold": {
|
|
160
|
+
"$ref": "#/$defs/ConversationHold"
|
|
161
|
+
},
|
|
162
|
+
"withdrawn": {
|
|
163
|
+
"description": "On `taken_over`: the ids of the conversation's approvals that were waiting, or approved and not yet used, and are now withdrawn (`taken_over`), since the person now answering asked for none of them. Empty when there were none.",
|
|
164
|
+
"type": "array",
|
|
165
|
+
"items": {
|
|
166
|
+
"type": "string"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"required": [
|
|
171
|
+
"ok",
|
|
172
|
+
"change",
|
|
173
|
+
"hold"
|
|
174
|
+
],
|
|
175
|
+
"additionalProperties": false
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "object",
|
|
179
|
+
"properties": {
|
|
180
|
+
"ok": {
|
|
181
|
+
"const": false
|
|
182
|
+
},
|
|
183
|
+
"reason": {
|
|
184
|
+
"const": "held"
|
|
185
|
+
},
|
|
186
|
+
"hold": {
|
|
187
|
+
"$ref": "#/$defs/ConversationHold"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"required": [
|
|
191
|
+
"ok",
|
|
192
|
+
"reason",
|
|
193
|
+
"hold"
|
|
194
|
+
],
|
|
195
|
+
"additionalProperties": false
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"HandBackRequest": {
|
|
200
|
+
"description": "`POST /internal/conversations/{conversationId}/hold/release`. With `userId`, only the holder may hand it back; without it, the product releases it on its own authority.",
|
|
201
|
+
"type": "object",
|
|
202
|
+
"properties": {
|
|
203
|
+
"userId": {
|
|
204
|
+
"description": "The staff member handing it back; must be the holder.",
|
|
205
|
+
"type": "string",
|
|
206
|
+
"minLength": 1
|
|
207
|
+
},
|
|
208
|
+
"rooms": {
|
|
209
|
+
"$ref": "#/$defs/ConversationRooms"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"required": [
|
|
213
|
+
"rooms"
|
|
214
|
+
],
|
|
215
|
+
"additionalProperties": false
|
|
216
|
+
},
|
|
217
|
+
"HandBackResult": {
|
|
218
|
+
"description": "The answer to a hand-back: `handed_back` with the hold that ended, `not_held` when nobody held it; 409 `not_holder` when someone else holds it.",
|
|
219
|
+
"oneOf": [
|
|
220
|
+
{
|
|
221
|
+
"type": "object",
|
|
222
|
+
"properties": {
|
|
223
|
+
"ok": {
|
|
224
|
+
"const": true
|
|
225
|
+
},
|
|
226
|
+
"change": {
|
|
227
|
+
"const": "handed_back"
|
|
228
|
+
},
|
|
229
|
+
"hold": {
|
|
230
|
+
"$ref": "#/$defs/ConversationHold"
|
|
231
|
+
},
|
|
232
|
+
"by": {
|
|
233
|
+
"$ref": "#/$defs/HandBackCause"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"required": [
|
|
237
|
+
"ok",
|
|
238
|
+
"change",
|
|
239
|
+
"hold",
|
|
240
|
+
"by"
|
|
241
|
+
],
|
|
242
|
+
"additionalProperties": false
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"type": "object",
|
|
246
|
+
"properties": {
|
|
247
|
+
"ok": {
|
|
248
|
+
"const": true
|
|
249
|
+
},
|
|
250
|
+
"change": {
|
|
251
|
+
"const": "not_held"
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"required": [
|
|
255
|
+
"ok",
|
|
256
|
+
"change"
|
|
257
|
+
],
|
|
258
|
+
"additionalProperties": false
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"type": "object",
|
|
262
|
+
"properties": {
|
|
263
|
+
"ok": {
|
|
264
|
+
"const": false
|
|
265
|
+
},
|
|
266
|
+
"reason": {
|
|
267
|
+
"const": "not_holder"
|
|
268
|
+
},
|
|
269
|
+
"hold": {
|
|
270
|
+
"$ref": "#/$defs/ConversationHold"
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"required": [
|
|
274
|
+
"ok",
|
|
275
|
+
"reason",
|
|
276
|
+
"hold"
|
|
277
|
+
],
|
|
278
|
+
"additionalProperties": false
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
"AnnounceMessageRequest": {
|
|
283
|
+
"description": "`POST /internal/conversations/{conversationId}/messages`: a message the product has stored, for the people watching the conversation. A `staff` message is announced only while its speaker holds the conversation.",
|
|
284
|
+
"type": "object",
|
|
285
|
+
"properties": {
|
|
286
|
+
"message": {
|
|
287
|
+
"$ref": "#/$defs/ConversationMessage"
|
|
288
|
+
},
|
|
289
|
+
"rooms": {
|
|
290
|
+
"$ref": "#/$defs/ConversationRooms"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"required": [
|
|
294
|
+
"message",
|
|
295
|
+
"rooms"
|
|
296
|
+
],
|
|
297
|
+
"additionalProperties": false
|
|
298
|
+
},
|
|
299
|
+
"AnnounceMessageResult": {
|
|
300
|
+
"description": "The answer to an announcement: sent, or 409 because its staff speaker does not hold the conversation (`not_held`: nobody does; `not_holder`: someone else does).",
|
|
301
|
+
"oneOf": [
|
|
302
|
+
{
|
|
303
|
+
"type": "object",
|
|
304
|
+
"properties": {
|
|
305
|
+
"ok": {
|
|
306
|
+
"const": true
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"required": [
|
|
310
|
+
"ok"
|
|
311
|
+
],
|
|
312
|
+
"additionalProperties": false
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"type": "object",
|
|
316
|
+
"properties": {
|
|
317
|
+
"ok": {
|
|
318
|
+
"const": false
|
|
319
|
+
},
|
|
320
|
+
"reason": {
|
|
321
|
+
"enum": [
|
|
322
|
+
"not_held",
|
|
323
|
+
"not_holder"
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
"required": [
|
|
328
|
+
"ok",
|
|
329
|
+
"reason"
|
|
330
|
+
],
|
|
331
|
+
"additionalProperties": false
|
|
332
|
+
}
|
|
333
|
+
]
|
|
334
|
+
},
|
|
335
|
+
"ConversationTakenOverEvent": {
|
|
336
|
+
"description": "`agent:conversation_taken_over`, to the conversation's room: a person took it, and the agent stopped answering.",
|
|
337
|
+
"type": "object",
|
|
338
|
+
"properties": {
|
|
339
|
+
"conversationId": {
|
|
340
|
+
"type": "string",
|
|
341
|
+
"minLength": 1
|
|
342
|
+
},
|
|
343
|
+
"hold": {
|
|
344
|
+
"$ref": "#/$defs/ConversationHold"
|
|
345
|
+
},
|
|
346
|
+
"at": {
|
|
347
|
+
"description": "Epoch ms.",
|
|
348
|
+
"type": "number"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"required": [
|
|
352
|
+
"conversationId",
|
|
353
|
+
"hold",
|
|
354
|
+
"at"
|
|
355
|
+
],
|
|
356
|
+
"additionalProperties": false
|
|
357
|
+
},
|
|
358
|
+
"ConversationHandedBackEvent": {
|
|
359
|
+
"description": "`agent:conversation_handed_back`, to the conversation's room: the hold ended, and the agent answers again.",
|
|
360
|
+
"type": "object",
|
|
361
|
+
"properties": {
|
|
362
|
+
"conversationId": {
|
|
363
|
+
"type": "string",
|
|
364
|
+
"minLength": 1
|
|
365
|
+
},
|
|
366
|
+
"hold": {
|
|
367
|
+
"description": "The hold that ended.",
|
|
368
|
+
"$ref": "#/$defs/ConversationHold"
|
|
369
|
+
},
|
|
370
|
+
"by": {
|
|
371
|
+
"$ref": "#/$defs/HandBackCause"
|
|
372
|
+
},
|
|
373
|
+
"at": {
|
|
374
|
+
"description": "Epoch ms.",
|
|
375
|
+
"type": "number"
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
"required": [
|
|
379
|
+
"conversationId",
|
|
380
|
+
"hold",
|
|
381
|
+
"by",
|
|
382
|
+
"at"
|
|
383
|
+
],
|
|
384
|
+
"additionalProperties": false
|
|
385
|
+
},
|
|
386
|
+
"ConversationMessageEvent": {
|
|
387
|
+
"description": "`agent:conversation_message`, to the conversation's room: a message the product stored, for the people watching.",
|
|
388
|
+
"type": "object",
|
|
389
|
+
"properties": {
|
|
390
|
+
"conversationId": {
|
|
391
|
+
"type": "string",
|
|
392
|
+
"minLength": 1
|
|
393
|
+
},
|
|
394
|
+
"message": {
|
|
395
|
+
"$ref": "#/$defs/ConversationMessage"
|
|
396
|
+
},
|
|
397
|
+
"at": {
|
|
398
|
+
"description": "Epoch ms.",
|
|
399
|
+
"type": "number"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"required": [
|
|
403
|
+
"conversationId",
|
|
404
|
+
"message",
|
|
405
|
+
"at"
|
|
406
|
+
],
|
|
407
|
+
"additionalProperties": false
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
"pattern": "^[A-Z][A-Za-z0-9]*$"
|
|
202
202
|
},
|
|
203
203
|
"rooms": {
|
|
204
|
-
"description": "The rooms the event is published to: names from the document's `rooms
|
|
204
|
+
"description": "The rooms the event is published to: names from the document's `rooms`; `turn` for the room of the agent turn it belongs to (the host names that room in each turn); or `conversation` for the room of the conversation it belongs to (the host names that room too).",
|
|
205
205
|
"type": "array",
|
|
206
206
|
"items": {
|
|
207
207
|
"type": "string",
|