@ouispec/contract 0.4.8 → 0.5.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 +224 -4
- package/dist/generated/contract.d.ts +387 -2
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/schemas.d.ts +33 -0
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +977 -2
- 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 +51 -2
- 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`.\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.\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.",
|
|
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`.\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.",
|
|
@@ -58,7 +58,22 @@
|
|
|
58
58
|
"conversationId": { "type": "string" },
|
|
59
59
|
"turnId": { "type": "string" },
|
|
60
60
|
"userId": { "description": "The user whose turn made the call: the only one who may decide it.", "type": "string" },
|
|
61
|
+
"accountId": { "description": "The user's account, when the product has one: carried on the call's receipt.", "type": "string", "minLength": 1 },
|
|
61
62
|
"tool": { "type": "string" },
|
|
63
|
+
"toolKind": {
|
|
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
|
+
"enum": ["ui", "backend"]
|
|
66
|
+
},
|
|
67
|
+
"operationId": {
|
|
68
|
+
"description": "For a generated API tool, its OpenAPI `operationId`: carried on the call's receipt.",
|
|
69
|
+
"type": "string",
|
|
70
|
+
"minLength": 1
|
|
71
|
+
},
|
|
72
|
+
"audience": {
|
|
73
|
+
"description": "The API the call's receipt is for, fixed when the approval is created: the origin (scheme, host and port) the tool calls. For a generated API tool, its operation's server URL's origin; for a host tool, its declared `approvalAudience`. Absent on a host tool that names none: the realtime server's default audience, the product's own origin, is used. Never set on a UI action.",
|
|
74
|
+
"type": "string",
|
|
75
|
+
"pattern": "^https?://[^/?#]+$"
|
|
76
|
+
},
|
|
62
77
|
"args": { "type": "object", "additionalProperties": true },
|
|
63
78
|
"argsHash": { "description": "`argsHash(args)`; the store checks it.", "$ref": "#/$defs/ArgsHash" },
|
|
64
79
|
"effect": { "$ref": "#/$defs/ApprovalEffect" },
|
|
@@ -169,6 +184,33 @@
|
|
|
169
184
|
"required": ["aid", "sub", "cid", "tool", "ah", "eff", "ch", "iat", "exp", "jti"],
|
|
170
185
|
"additionalProperties": false
|
|
171
186
|
},
|
|
187
|
+
"ApprovalReceiptClaims": {
|
|
188
|
+
"description": "An approval receipt's claims: a compact JWS whose header is `{ \"alg\": \"EdDSA\", \"typ\": \"oui-approval-receipt+jwt\", \"kid\" }`, signed by the realtime server with an Ed25519 key only it holds, when it redeems a token. It says this user approved exactly this call, in this conversation, and the approval was redeemed just now. A tool verifies it with the server's public keys (`verifyApprovalReceipt` in `@ouispec/agent-core`, or any JOSE library), refuses it once expired, and acts on each `jti` at most once.",
|
|
189
|
+
"type": "object",
|
|
190
|
+
"properties": {
|
|
191
|
+
"iss": {
|
|
192
|
+
"description": "The realtime server's public base URL. Its keys are published at `<iss>/.well-known/oui-approval-jwks.json`.",
|
|
193
|
+
"type": "string"
|
|
194
|
+
},
|
|
195
|
+
"aud": { "description": "The one API the receipt is for: an origin, fixed when the approval was created. Another API refuses it.", "type": "string" },
|
|
196
|
+
"approvalId": { "description": "The approval id, which is the tool call id.", "type": "string", "minLength": 1 },
|
|
197
|
+
"argsHash": {
|
|
198
|
+
"description": "The approved call's args hash. The tool computes it from the request it received and compares.",
|
|
199
|
+
"$ref": "#/$defs/ArgsHash"
|
|
200
|
+
},
|
|
201
|
+
"tool": { "description": "The tool's name, as the worker offered it.", "type": "string", "minLength": 1 },
|
|
202
|
+
"operationId": { "description": "For a generated API tool, its OpenAPI `operationId`.", "type": "string", "minLength": 1 },
|
|
203
|
+
"conversationId": { "type": "string", "minLength": 1 },
|
|
204
|
+
"userId": { "description": "The user who approved it.", "type": "string", "minLength": 1 },
|
|
205
|
+
"accountId": { "description": "The user's account, when the product has one.", "type": "string", "minLength": 1 },
|
|
206
|
+
"channel": { "description": "How it was approved.", "$ref": "#/$defs/ApprovalChannel" },
|
|
207
|
+
"iat": { "description": "Issued at, epoch seconds.", "type": "integer" },
|
|
208
|
+
"exp": { "description": "Expires at, epoch seconds: `iat` + 120.", "type": "integer" },
|
|
209
|
+
"jti": { "description": "Unique to this receipt: the call's idempotency key. A tool acts on each at most once.", "type": "string", "minLength": 1 }
|
|
210
|
+
},
|
|
211
|
+
"required": ["iss", "aud", "approvalId", "argsHash", "tool", "conversationId", "userId", "channel", "iat", "exp", "jti"],
|
|
212
|
+
"additionalProperties": false
|
|
213
|
+
},
|
|
172
214
|
"ApprovedCall": {
|
|
173
215
|
"description": "What redeeming a token returns: the stored call, exactly, for the worker to run.",
|
|
174
216
|
"type": "object",
|
|
@@ -192,7 +234,14 @@
|
|
|
192
234
|
"oneOf": [
|
|
193
235
|
{
|
|
194
236
|
"type": "object",
|
|
195
|
-
"properties": {
|
|
237
|
+
"properties": {
|
|
238
|
+
"ok": { "const": true },
|
|
239
|
+
"call": { "$ref": "#/$defs/ApprovedCall" },
|
|
240
|
+
"receipt": {
|
|
241
|
+
"description": "The receipt for this call (`ApprovalReceiptClaims`), when the realtime server holds receipt keys and the call is a host or API tool's. The worker hands it to the tool as `ctx.approval.receipt`.",
|
|
242
|
+
"type": "string"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
196
245
|
"required": ["ok", "call"],
|
|
197
246
|
"additionalProperties": false
|
|
198
247
|
},
|
|
@@ -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",
|