omp-channel 0.0.0-stage → 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,283 @@
1
+ # Integration protocol (version 1)
2
+
3
+ This document is the public contract between an external **service** (any system that exchanges
4
+ messages with a person or with another agent) and an agent
5
+ session of [Oh My Pi](https://github.com/can1357/oh-my-pi) running omp-channel. Any service can
6
+ implement it. The contract is independent of any product.
7
+
8
+ The machine-readable schemas are in [`schema/`](../schema):
9
+
10
+ | File | Describes |
11
+ | ---------------------------- | ----------------------------------------------------------------------- |
12
+ | `inbound-event.schema.json` | events the service sends to the agent (`message`, `interrupt`, `close`) |
13
+ | `outbound-reply.schema.json` | a reply the agent posts to the service |
14
+ | `status.schema.json` | agent state the agent reports to the service |
15
+ | `config.schema.json` | the omp-channel configuration file |
16
+
17
+ The TypeScript module `src/protocol.ts` implements the same rules. Both must change together.
18
+
19
+ ## 1. Transports
20
+
21
+ A service can connect in one of three ways. They carry the same events.
22
+
23
+ 1. **MCP push** (`notifications/omp/channel`). An MCP server running next to the agent sends a
24
+ JSON-RPC notification whose `params` is an inbound event. Notifications are not leased: a lost
25
+ notification is not redelivered. Use it for local tools and tests.
26
+ 2. **HTTP service with leases** (section 4). omp-channel polls the service over HTTPS. Delivery is
27
+ at least once, and each delivery is acknowledged. This is the transport for most integrations
28
+ and needs only configuration.
29
+ 3. **Custom adapter module** (section 6). A JavaScript module implements the `ChannelAdapter`
30
+ interface. Use it when the service needs its own protocol.
31
+
32
+ ## 2. Identifiers
33
+
34
+ `conversationId`, `messageId`, `replyTo` and `deliveryId` are strings that match
35
+ `^[A-Za-z0-9._:-]{1,128}$`.
36
+
37
+ Why: such identifiers are safe in URLs, headers, file names and log lines without escaping, and
38
+ they cannot hide control characters or path separators. The service chooses the format within
39
+ that pattern (a UUID or a prefixed counter are both fine). The agent treats them as opaque
40
+ strings and compares them exactly; they are case-sensitive.
41
+
42
+ Uniqueness: `messageId` should be unique for the service. The agent remembers the last 1000
43
+ admitted message ids and never admits the same one twice.
44
+
45
+ ## 3. Inbound events (service to agent)
46
+
47
+ Every event is a JSON object. Unknown fields are rejected, so a typo is detected instead of
48
+ silently ignored. Limits are configurable (`limits` in the configuration file); the values below
49
+ are the defaults.
50
+
51
+ ### 3.1 `message`
52
+
53
+ | Field | Required | Type and limits | Meaning |
54
+ | ---------------- | -------- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------- |
55
+ | `type` | yes | `"message"` | |
56
+ | `conversationId` | yes | identifier | The conversation the message belongs to (section 5). |
57
+ | `messageId` | yes | identifier | Unique id of this message. Used to reply and to deduplicate. |
58
+ | `sender` | yes | string, 1 to 64 characters after cleanup | Display name. Control characters become spaces. |
59
+ | `text` | yes | string, 1 to 4000 characters, no control characters except tab and line feed | The content. |
60
+ | `sentAt` | no | ISO 8601 timestamp | Set by the service. Informational. |
61
+ | `replyTo` | no | identifier | `messageId` of an earlier message this one answers. Informational. |
62
+ | `attribution` | yes | `"user"` or `"agent"` | Who wrote the message. Passed to Oh My Pi unchanged. See section 3.4. |
63
+
64
+ ### 3.2 `interrupt`
65
+
66
+ ```json
67
+ { "type": "interrupt", "conversationId": "c1" }
68
+ ```
69
+
70
+ Asks the agent to stop the turn in progress in that conversation. Effects, as implemented:
71
+
72
+ - If the agent is busy and the conversation is the open one, the current turn is aborted.
73
+ - Tool results already produced in the turn stay in the session. The interrupt does not undo them.
74
+ - Follow-up messages already queued are not removed; they run after the interrupt.
75
+ - If the agent is idle, nothing is aborted.
76
+ - An interrupt for a conversation that is not open is acknowledged and ignored.
77
+
78
+ ### 3.3 `close`
79
+
80
+ ```json
81
+ { "type": "close", "conversationId": "c1" }
82
+ ```
83
+
84
+ Ends the open conversation so another conversation can start. A turn in progress is not
85
+ aborted; send `interrupt` first to stop it. A `close` for a conversation that is not open is
86
+ acknowledged and ignored.
87
+
88
+ ### 3.4 `attribution` values
89
+
90
+ `attribution` is required on every message, and omp-channel sets no default for it. The value is
91
+ handed to Oh My Pi as the `attribution` option of `sendUserMessage`. The service sets it to the value
92
+ that describes who wrote the message: `"user"` for text a person wrote (the example server sends
93
+ `"user"`), `"agent"` for text another agent wrote. omp-channel does not choose a value on the
94
+ service's behalf.
95
+
96
+ What Oh My Pi does with each value (for example whether it changes how the turn is billed or which
97
+ initiator it records) is **not verified**. The result will be recorded in
98
+ `docs/omp-verification.md`, section "Attribution".
99
+
100
+ ### 3.5 Delivery while the agent is busy
101
+
102
+ An inbound `message` that arrives while a turn runs is delivered with `delivery.deliverAs`
103
+ (default `followUp`; `steer` and `aside` are the other values, see the README). The contract for
104
+ `followUp`:
105
+
106
+ - The message is not lost and is not dropped.
107
+ - It is taken at a turn boundary: the next `turn_end` of the running agent, or the `agent_end` when
108
+ no turn follows. It is never inserted inside a tool call.
109
+ - It is not guaranteed to wait for the final `agent_end` of the run. Oh My Pi 19.2.1 can take it at
110
+ an earlier turn boundary of the same run, and that is the expected behaviour.
111
+
112
+ The check in `test/omp-e2e/run.mjs` tests this rule (scenario 2). It is `not-exercised` when the
113
+ model finishes before the second push.
114
+
115
+ ## 4. HTTP transport
116
+
117
+ Paths are relative to `service.url` and configurable in `service.paths`. Defaults:
118
+
119
+ | Call | Method and path | Body or query |
120
+ | ----------- | ----------------------- | --------------------------- |
121
+ | Poll | `GET /messages?limit=N` | none |
122
+ | Acknowledge | `POST /messages/ack` | `{ "deliveryIds": ["d1"] }` |
123
+ | Reply | `POST /replies` | outbound reply (section 7) |
124
+ | Status | `POST /status` | agent status (section 8) |
125
+
126
+ All calls carry `Authorization: Bearer <key>`. A non-2xx answer is an error. The key is never
127
+ included in a log line, an error message or a tool result.
128
+
129
+ ### 4.1 Poll response
130
+
131
+ ```json
132
+ {
133
+ "deliveries": [
134
+ {
135
+ "deliveryId": "d1",
136
+ "leaseExpiresAt": "2026-11-26T10:00:30Z",
137
+ "event": {
138
+ "type": "message",
139
+ "conversationId": "c1",
140
+ "messageId": "m1",
141
+ "sender": "ann",
142
+ "text": "Hello"
143
+ }
144
+ }
145
+ ]
146
+ }
147
+ ```
148
+
149
+ - `deliveries` is in the order the service wants them handled. The agent handles them in that
150
+ order, one at a time.
151
+ - `deliveryId` identifies one delivery. The same message can be delivered more than once under
152
+ different `deliveryId`s, so the agent also deduplicates by `messageId`.
153
+ - `event` is an inbound event (section 3).
154
+ - A delivery whose `event` is invalid is acknowledged and discarded, and the reason is logged
155
+ with its `deliveryId` only. It is not retried, because a retry would fail the same way.
156
+
157
+ ### 4.2 Lease policy
158
+
159
+ This is the rule that keeps a message from being lost or handled twice.
160
+
161
+ 1. The service leases each delivery until `leaseExpiresAt`. While the lease is valid the service
162
+ does not return that delivery again. The service chooses the lease length; 30 to 60 seconds
163
+ is a sensible range.
164
+ 2. The agent acknowledges a delivery **after** the agent has admitted it into the session. An
165
+ event that is refused (another conversation is open) or rejected by the session is **not**
166
+ acknowledged.
167
+ 3. If the agent stops before the acknowledgement, or does not acknowledge in time, the lease
168
+ ends and the service delivers the event again. Nothing is lost.
169
+ 4. If the agent acknowledges but the acknowledgement does not reach the service, the event may
170
+ come back. The agent then recognizes the `messageId` (or the `deliveryId` of an interrupt or
171
+ close) and acknowledges again without running the event a second time.
172
+
173
+ Result: **at-least-once delivery with idempotent handling**. The agent admits each message once
174
+ per process. Across a restart, the memory of admitted ids is lost, so a message whose
175
+ acknowledgement never arrived can be admitted again. Services that need stronger guarantees
176
+ should make their own `messageId` idempotent on their side, for example by not re-sending a
177
+ message whose reply they have already received.
178
+
179
+ ### 4.3 Polling behaviour
180
+
181
+ - The agent polls every `poll.intervalMs` (default 2000 ms) when the last poll was empty.
182
+ - After a failed poll it waits longer each time, doubling up to `poll.maxBackoffMs` (default
183
+ 30000 ms).
184
+ - Each request has a timeout of `service.requestTimeoutMs` (default 10000 ms).
185
+ - Polling stops when the session shuts down.
186
+
187
+ ## 5. Conversations
188
+
189
+ - One conversation is open at a time per agent session. The first admitted `message` opens its
190
+ conversation.
191
+ - A `message` for another conversation is **refused**: it is not admitted and not
192
+ acknowledged, so the service delivers it again after the open conversation has closed.
193
+ - A `close` event ends the open conversation. The next message for another conversation opens it.
194
+
195
+ Rationale: one agent session has one context. Mixing two conversations in it would send replies
196
+ to the wrong party. Holding the second conversation until the first closes keeps the order and the
197
+ replies correct, and needs no extra state from the service.
198
+
199
+ ## 6. Custom adapter module
200
+
201
+ A module (path in `adapterModule`, relative to the working directory) exports a default object
202
+ that implements `ChannelAdapter` (`src/adapter.ts`):
203
+
204
+ ```ts
205
+ interface ChannelAdapter {
206
+ receive(signal: AbortSignal): AsyncIterable<{ deliveryId?: string; event: InboundEvent }>;
207
+ reply(reply: OutboundReply): Promise<void>; // required
208
+ ack?(deliveryId: string): Promise<void>; // after admission
209
+ status?(status: OutboundStatus): Promise<void>; // best effort
210
+ interrupt?(conversationId: string): Promise<void>; // after an interrupt is applied
211
+ close?(conversationId: string): Promise<void>; // after a close is applied
212
+ describe?(): Promise<string> | string; // plain-text state for the /channel-status command
213
+ }
214
+ ```
215
+
216
+ `receive` must stop when `signal` aborts. Yield deliveries in order. Throwing from `reply` means
217
+ the reply was not accepted. Errors must not contain secrets.
218
+
219
+ `describe` is optional. The `/channel-status` command shows the transport in use and the text the
220
+ adapter returns. That text is for the person who runs the agent: it must not contain keys or
221
+ message text. A `describe` that throws is reported as one line; its error text is not shown.
222
+
223
+ ## 7. Outbound reply (agent to service)
224
+
225
+ ```json
226
+ {
227
+ "type": "reply",
228
+ "conversationId": "c1",
229
+ "messageId": "r-7f3a2c10",
230
+ "replyTo": "m1",
231
+ "text": "Answer",
232
+ "at": "2026-11-26T10:00:00.000Z"
233
+ }
234
+ ```
235
+
236
+ - `replyTo` is the `messageId` of the inbound message being answered. The agent accepts a reply
237
+ only for a `messageId` it admitted in this session, and the reply goes to that message's
238
+ conversation.
239
+ - `messageId` is generated by the agent for each reply. The service may use it as an
240
+ idempotency key.
241
+ - A 2xx answer means accepted. Any other answer is reported to the model as a failure. The agent
242
+ does not retry automatically.
243
+
244
+ ## 8. Agent status (agent to service)
245
+
246
+ ```json
247
+ { "type": "status", "conversationId": "c1", "status": "working", "at": "2026-11-26T10:00:00.000Z" }
248
+ ```
249
+
250
+ `status` is `working` when a turn starts and `free` when it ends, for the open conversation.
251
+ Status is best effort: a failed report is logged and not retried. Status is not part of the
252
+ acknowledgement logic.
253
+
254
+ ## 9. Activity (optional, not emitted in version 1)
255
+
256
+ The protocol reserves an optional `activity` report (for example, a tool started or finished)
257
+ for showing progress to the service. Version 1 of omp-channel does not emit it. A service must
258
+ not require it.
259
+
260
+ ## 10. Security rules
261
+
262
+ - The service key is read from an environment variable named in the configuration
263
+ (`service.keyEnv`), or from a file named by `<keyEnv>_FILE`. It is never written in the
264
+ configuration file or in the code.
265
+ - The key is never given to the model, never returned by a tool, and never written to a log.
266
+ - `service.url` must use `https`. Plain `http` is accepted only for loopback addresses. URLs
267
+ with credentials are refused.
268
+ - Inbound text is data from an outside party. It is handed to the model inside an envelope that
269
+ says so, and angle brackets are escaped so the text cannot close the envelope.
270
+ - Inbound events are validated before use. Unknown fields and out-of-range values are rejected.
271
+
272
+ ## 11. Versioning
273
+
274
+ `PROTOCOL_VERSION` is `1`. Version 1 is alpha: fields may still change before the first stable
275
+ release, and each change is recorded in CHANGELOG.md. A future incompatible change will use a
276
+ new version number.
277
+
278
+ ## 12. Not in this contract
279
+
280
+ - Delivery of messages from the agent to a person without a reply to a message.
281
+ - Attachments and other non-text content.
282
+ - Multiple concurrent conversations in one agent session.
283
+ - Authentication schemes other than a bearer key. Use an adapter module for anything else.
package/package.json CHANGED
@@ -1,6 +1,78 @@
1
1
  {
2
2
  "name": "omp-channel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Oh My Pi extension that delivers messages from an external console into an agent session and sends replies back.",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "schema",
12
+ "docs/protocol.md",
13
+ "README.md",
14
+ "CHANGELOG.md",
15
+ "LICENSE",
16
+ "NOTICE"
17
+ ],
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "omp": {
26
+ "extensions": [
27
+ "./dist/index.js"
28
+ ]
29
+ },
30
+ "engines": {
31
+ "node": ">=20"
32
+ },
33
+ "scripts": {
34
+ "build": "tsc -p tsconfig.build.json",
35
+ "typecheck": "tsc -p tsconfig.json --noEmit",
36
+ "lint": "biome lint .",
37
+ "format": "biome format --write .",
38
+ "format:check": "biome format .",
39
+ "test": "node --import tsx --test test/*.test.ts",
40
+ "check": "npm run typecheck && npm run lint && npm run format:check && npm test",
41
+ "omp:e2e": "node test/omp-e2e/run.mjs",
42
+ "prepack": "npm run build",
43
+ "pack:check": "npm pack --dry-run"
44
+ },
45
+ "keywords": [
46
+ "oh-my-pi",
47
+ "omp",
48
+ "extension",
49
+ "coding-agent",
50
+ "agent",
51
+ "channel",
52
+ "mcp",
53
+ "messaging"
54
+ ],
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/tommasomarchionni/omp-channel.git"
58
+ },
59
+ "bugs": {
60
+ "url": "https://github.com/tommasomarchionni/omp-channel/issues"
61
+ },
62
+ "homepage": "https://github.com/tommasomarchionni/omp-channel#readme",
63
+ "author": "Tommaso Marchionni",
64
+ "devDependencies": {
65
+ "@biomejs/biome": "^2.6.9",
66
+ "@oh-my-pi/pi-coding-agent": "19.2.1",
67
+ "@types/node": "^20.19.43",
68
+ "tsx": "^4.23.15",
69
+ "typescript": "^5.9.3"
70
+ },
71
+ "dependencies": {
72
+ "ajv": "^8.20.0"
73
+ },
74
+ "publishConfig": {
75
+ "access": "public",
76
+ "provenance": true
77
+ }
78
+ }
@@ -0,0 +1,141 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://example.com/omp-channel/schema/config.schema.json",
4
+ "title": "omp-channel configuration",
5
+ "description": "Configuration file read by omp-channel. Secrets are never stored here: keyEnv names the environment variable that holds the key.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string"
11
+ },
12
+ "mcpServer": {
13
+ "description": "Name of the MCP server (as in the Oh My Pi MCP configuration) that may push messages.",
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "maxLength": 64,
17
+ "default": "omp-channel"
18
+ },
19
+ "service": {
20
+ "description": "HTTP service that exchanges messages with the agent. Omit it to use only MCP push or a custom adapter.",
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "required": ["url"],
24
+ "properties": {
25
+ "url": {
26
+ "description": "Base URL of the service. https is required, except for loopback addresses.",
27
+ "type": "string",
28
+ "minLength": 8
29
+ },
30
+ "keyEnv": {
31
+ "description": "Name of the environment variable that holds the service key. A file path may be given in the variable named <keyEnv>_FILE.",
32
+ "type": "string",
33
+ "pattern": "^[A-Z_][A-Z0-9_]{0,63}$",
34
+ "default": "OMP_CHANNEL_KEY"
35
+ },
36
+ "requestTimeoutMs": {
37
+ "type": "integer",
38
+ "minimum": 100,
39
+ "maximum": 120000,
40
+ "default": 10000
41
+ },
42
+ "paths": {
43
+ "type": "object",
44
+ "additionalProperties": false,
45
+ "properties": {
46
+ "messages": {
47
+ "type": "string",
48
+ "pattern": "^/",
49
+ "default": "/messages"
50
+ },
51
+ "ack": {
52
+ "type": "string",
53
+ "pattern": "^/",
54
+ "default": "/messages/ack"
55
+ },
56
+ "replies": {
57
+ "type": "string",
58
+ "pattern": "^/",
59
+ "default": "/replies"
60
+ },
61
+ "status": {
62
+ "type": "string",
63
+ "pattern": "^/",
64
+ "default": "/status"
65
+ }
66
+ },
67
+ "default": {}
68
+ }
69
+ }
70
+ },
71
+ "poll": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "properties": {
75
+ "intervalMs": {
76
+ "type": "integer",
77
+ "minimum": 100,
78
+ "maximum": 60000,
79
+ "default": 2000
80
+ },
81
+ "maxBackoffMs": {
82
+ "type": "integer",
83
+ "minimum": 100,
84
+ "maximum": 300000,
85
+ "default": 30000
86
+ },
87
+ "batchSize": {
88
+ "type": "integer",
89
+ "minimum": 1,
90
+ "maximum": 100,
91
+ "default": 10
92
+ }
93
+ },
94
+ "default": {}
95
+ },
96
+ "limits": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "properties": {
100
+ "maxTextLength": {
101
+ "type": "integer",
102
+ "minimum": 1,
103
+ "maximum": 20000,
104
+ "default": 4000
105
+ },
106
+ "maxSenderLength": {
107
+ "type": "integer",
108
+ "minimum": 1,
109
+ "maximum": 256,
110
+ "default": 64
111
+ },
112
+ "maxPending": {
113
+ "type": "integer",
114
+ "minimum": 1,
115
+ "maximum": 100,
116
+ "default": 5
117
+ }
118
+ },
119
+ "default": {}
120
+ },
121
+ "delivery": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "properties": {
125
+ "deliverAs": {
126
+ "description": "How an incoming message is queued in Oh My Pi while the agent is busy.",
127
+ "type": "string",
128
+ "enum": ["steer", "followUp", "aside"],
129
+ "default": "followUp"
130
+ }
131
+ },
132
+ "default": {}
133
+ },
134
+ "adapterModule": {
135
+ "description": "Path (relative to the working directory) of a JavaScript module whose default export implements ChannelAdapter. Replaces the HTTP service transport.",
136
+ "type": "string",
137
+ "minLength": 1,
138
+ "maxLength": 1024
139
+ }
140
+ }
141
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://example.com/omp-channel/schema/inbound-event.schema.json",
4
+ "title": "Inbound event (service to agent)",
5
+ "description": "An event the service sends to the agent. Identifiers use letters, digits, dot, colon, underscore and dash.",
6
+ "$defs": {
7
+ "id": {
8
+ "type": "string",
9
+ "minLength": 1,
10
+ "maxLength": 128,
11
+ "pattern": "^[A-Za-z0-9._:-]+$"
12
+ }
13
+ },
14
+ "oneOf": [
15
+ {
16
+ "title": "message",
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["type", "conversationId", "messageId", "sender", "text", "attribution"],
20
+ "properties": {
21
+ "type": {
22
+ "const": "message"
23
+ },
24
+ "conversationId": {
25
+ "$ref": "#/$defs/id"
26
+ },
27
+ "messageId": {
28
+ "$ref": "#/$defs/id"
29
+ },
30
+ "sender": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "maxLength": 64
34
+ },
35
+ "text": {
36
+ "type": "string",
37
+ "minLength": 1,
38
+ "maxLength": 4000
39
+ },
40
+ "sentAt": {
41
+ "type": "string",
42
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
43
+ },
44
+ "replyTo": {
45
+ "$ref": "#/$defs/id"
46
+ },
47
+ "attribution": {
48
+ "type": "string",
49
+ "enum": ["user", "agent"]
50
+ }
51
+ }
52
+ },
53
+ {
54
+ "title": "interrupt",
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": ["type", "conversationId"],
58
+ "properties": {
59
+ "type": {
60
+ "const": "interrupt"
61
+ },
62
+ "conversationId": {
63
+ "$ref": "#/$defs/id"
64
+ }
65
+ }
66
+ },
67
+ {
68
+ "title": "close",
69
+ "type": "object",
70
+ "additionalProperties": false,
71
+ "required": ["type", "conversationId"],
72
+ "properties": {
73
+ "type": {
74
+ "const": "close"
75
+ },
76
+ "conversationId": {
77
+ "$ref": "#/$defs/id"
78
+ }
79
+ }
80
+ }
81
+ ]
82
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://example.com/omp-channel/schema/outbound-reply.schema.json",
4
+ "title": "Outbound reply (agent to service)",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["type", "conversationId", "messageId", "replyTo", "text", "at"],
8
+ "properties": {
9
+ "type": { "const": "reply" },
10
+ "conversationId": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "maxLength": 128,
14
+ "pattern": "^[A-Za-z0-9._:-]+$"
15
+ },
16
+ "messageId": {
17
+ "type": "string",
18
+ "minLength": 1,
19
+ "maxLength": 128,
20
+ "pattern": "^[A-Za-z0-9._:-]+$"
21
+ },
22
+ "replyTo": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "maxLength": 128,
26
+ "pattern": "^[A-Za-z0-9._:-]+$"
27
+ },
28
+ "text": { "type": "string", "minLength": 1, "maxLength": 20000 },
29
+ "at": {
30
+ "type": "string",
31
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://example.com/omp-channel/schema/status.schema.json",
4
+ "title": "Agent status (agent to service)",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["type", "conversationId", "status", "at"],
8
+ "properties": {
9
+ "type": { "const": "status" },
10
+ "conversationId": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "maxLength": 128,
14
+ "pattern": "^[A-Za-z0-9._:-]+$"
15
+ },
16
+ "status": { "type": "string", "enum": ["working", "free"] },
17
+ "at": {
18
+ "type": "string",
19
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
20
+ }
21
+ }
22
+ }