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