omp-channel 0.6.0 → 0.7.1
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/CHANGELOG.md +19 -0
- package/README.md +10 -3
- package/dist/adapter.d.ts +6 -1
- package/dist/adapter.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js.map +1 -1
- package/dist/dispatcher.d.ts +7 -2
- package/dist/dispatcher.js +21 -5
- package/dist/dispatcher.js.map +1 -1
- package/dist/extension.d.ts +1 -0
- package/dist/extension.js +21 -2
- package/dist/extension.js.map +1 -1
- package/dist/http-adapter.d.ts +1 -0
- package/dist/http-adapter.js +9 -0
- package/dist/http-adapter.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +28 -0
- package/dist/protocol.js +13 -0
- package/dist/protocol.js.map +1 -1
- package/dist/reasoning.d.ts +57 -0
- package/dist/reasoning.js +362 -0
- package/dist/reasoning.js.map +1 -0
- package/dist/redact.d.ts +11 -0
- package/dist/redact.js +24 -0
- package/dist/redact.js.map +1 -1
- package/dist/turn.d.ts +7 -2
- package/dist/turn.js +16 -4
- package/dist/turn.js.map +1 -1
- package/docs/protocol.md +79 -3
- package/package.json +1 -1
- package/schema/config.schema.json +10 -0
- package/schema/reasoning.schema.json +41 -0
package/dist/turn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn.js","sourceRoot":"","sources":["../src/turn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAe7C,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG,4CAA4C,CAAC;AAC5E,MAAM,CAAC,MAAM,cAAc,GAAG,gDAAgD,CAAC;AAC/E,MAAM,CAAC,MAAM,iBAAiB,GAAG,+CAA+C,CAAC;AAiBjF
|
|
1
|
+
{"version":3,"file":"turn.js","sourceRoot":"","sources":["../src/turn.ts"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,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/docs/protocol.md
CHANGED
|
@@ -20,6 +20,7 @@ The machine-readable schemas are in [`schema/`](https://github.com/tommasomarchi
|
|
|
20
20
|
| `status.schema.json` | agent state the agent reports to the service |
|
|
21
21
|
| `failure.schema.json` | a turn that ended in an error and left a message unanswered |
|
|
22
22
|
| `activity.schema.json` | a tool the agent uses for a message (optional report) |
|
|
23
|
+
| `reasoning.schema.json` | a piece of the agent's reasoning for a message (optional report) |
|
|
23
24
|
| `config.schema.json` | the omp-channel configuration file |
|
|
24
25
|
|
|
25
26
|
The TypeScript module `src/protocol.ts` implements the same rules. Both must change together.
|
|
@@ -158,6 +159,7 @@ Paths are relative to `service.url` and configurable in `service.paths`. Default
|
|
|
158
159
|
| Status | `POST /status` | agent status (section 8) |
|
|
159
160
|
| Failure | `POST /failures` | failed turn (section 9) |
|
|
160
161
|
| Activity | no default path | activity (section 10) |
|
|
162
|
+
| Reasoning | no default path | reasoning (section 11) |
|
|
161
163
|
|
|
162
164
|
All calls carry `Authorization: Bearer <key>`. A non-2xx answer is an error. The key is never
|
|
163
165
|
included in a log line, an error message or a tool result.
|
|
@@ -245,6 +247,7 @@ interface ChannelAdapter {
|
|
|
245
247
|
status?(status: OutboundStatus): Promise<void>; // best effort
|
|
246
248
|
failure?(failure: OutboundFailure): Promise<void>; // a message got no answer (section 9)
|
|
247
249
|
activity?(activity: OutboundActivity): Promise<void>; // a tool in use (section 10)
|
|
250
|
+
reasoning?(reasoning: OutboundReasoning): Promise<void>; // a piece of reasoning (section 11)
|
|
248
251
|
interrupt?(conversationId: string): Promise<void>; // after an interrupt is applied
|
|
249
252
|
close?(conversationId: string): Promise<void>; // after a close is applied
|
|
250
253
|
describe?(): Promise<string> | string; // plain-text state for the /channel-status command
|
|
@@ -356,6 +359,10 @@ Every message the agent took ends with exactly one outcome that the service rece
|
|
|
356
359
|
| Oh My Pi closes while a message is open | `failure`: `The agent was closed before it answered` (one attempt) |
|
|
357
360
|
| Oh My Pi retries, or background work will continue the run | nothing yet |
|
|
358
361
|
|
|
362
|
+
A message counts for the end of a run from the moment it enters the session. A compaction that
|
|
363
|
+
drops it before the run ends changes nothing: it gets the same outcome. A message that is still
|
|
364
|
+
queued waits for its own turn.
|
|
365
|
+
|
|
359
366
|
A process that is killed, or a machine that loses power or network for good, sends nothing: a
|
|
360
367
|
service should show that the agent is not connected.
|
|
361
368
|
|
|
@@ -447,7 +454,73 @@ made before it.
|
|
|
447
454
|
two. Nothing is sent about a message after its reply or failure report. A use still `running` when
|
|
448
455
|
that arrives has ended without a known outcome.
|
|
449
456
|
|
|
450
|
-
## 11.
|
|
457
|
+
## 11. Reasoning (optional)
|
|
458
|
+
|
|
459
|
+
While the agent works on a message, omp-channel can tell the service what the model thinks, as it
|
|
460
|
+
is written. A service must not require these reports.
|
|
461
|
+
|
|
462
|
+
```json
|
|
463
|
+
{
|
|
464
|
+
"type": "reasoning",
|
|
465
|
+
"conversationId": "c1",
|
|
466
|
+
"messageId": "r-3b7e90a1",
|
|
467
|
+
"replyTo": "m1",
|
|
468
|
+
"seq": 0,
|
|
469
|
+
"text": "The log shows a timeout, so I will look at the retry first.\n",
|
|
470
|
+
"final": false,
|
|
471
|
+
"at": "2026-11-27T10:00:01.000Z"
|
|
472
|
+
}
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
| Field | Meaning |
|
|
476
|
+
| ----------- | ---------------------------------------------------------------------------- |
|
|
477
|
+
| `messageId` | Generated by the agent for each report, so a retried POST can be recognized. |
|
|
478
|
+
| `replyTo` | The `messageId` of the inbound message the agent is working on. |
|
|
479
|
+
| `seq` | 0 for the first piece of a message, then 1, 2 and so on. |
|
|
480
|
+
| `text` | At most 4000 characters. Empty only on a final report. |
|
|
481
|
+
| `final` | `true` on the last piece of a message. |
|
|
482
|
+
| `truncated` | `true`, present once the reasoning was cut at the size limit (see below). |
|
|
483
|
+
|
|
484
|
+
The pieces of one message, in `seq` order and joined as they are, make its reasoning. They keep
|
|
485
|
+
their line breaks and spaces. Two blocks of thinking are separated by a blank line. A block the model
|
|
486
|
+
marks as redacted is not reported.
|
|
487
|
+
|
|
488
|
+
**When they are sent.** Only when both are true: `reports.reasoning` is not `false` (it is `true` by
|
|
489
|
+
default), and the transport takes the report. Over HTTP the path `service.paths.reasoning` has no
|
|
490
|
+
default, so a service that does not configure it receives no new request. A custom adapter takes the
|
|
491
|
+
reports when it has the `reasoning` method. MCP push has no way back, so nothing is sent. A service
|
|
492
|
+
that does not want the text can refuse the calls: a refusal is logged once and not repeated for
|
|
493
|
+
that piece.
|
|
494
|
+
|
|
495
|
+
**What a report holds.** The thinking text of the model, as Oh My Pi streams it. Before sending, known
|
|
496
|
+
shapes of secrets and the home folder name are hidden (`[hidden]`, `~`), as in section 9, and control
|
|
497
|
+
characters are replaced with spaces. This is a known-shapes filter, not a guarantee: a secret in a
|
|
498
|
+
shape it does not know, or a quoted value with spaces, can pass. The model can write anything in its
|
|
499
|
+
thinking. Use `reports.reasoning: false` when that is not acceptable.
|
|
500
|
+
|
|
501
|
+
**Where a piece ends.** Text is gathered for 500 ms and sent in pieces. A piece ends at a space or a
|
|
502
|
+
line break, never after the name of a secret (`password:`), and never inside a private key that is
|
|
503
|
+
not closed yet: the next piece would carry the rest of it unhidden. A run of 4000 characters with no
|
|
504
|
+
space is hidden whole and the rest of that run is dropped.
|
|
505
|
+
|
|
506
|
+
**Which message.** The same as for activity (section 10): the newest unanswered message among those
|
|
507
|
+
of the last prompt that carried one. A prompt typed at the terminal ends it: its thinking is not
|
|
508
|
+
reported. Switching to another session ends it too.
|
|
509
|
+
|
|
510
|
+
**Limits.** At most 4000 characters in a report and 64 KiB for one message. Over 64 KiB the start is
|
|
511
|
+
kept, the rest is dropped and the last report has `truncated: true`. Reports leave one at a time, in
|
|
512
|
+
order, about twice a second. At most 100 wait to be sent; more are dropped. A report that takes more
|
|
513
|
+
than 5 seconds counts as refused. The agent never waits for a report, except that a reply or a
|
|
514
|
+
failure report waits up to 1 second for the reports made before it.
|
|
515
|
+
|
|
516
|
+
**The end.** When a message gets its reply or its failure report, what is left is sent at once, as
|
|
517
|
+
the last piece (`final: true`). Nothing is sent about the message after that, and a service should
|
|
518
|
+
refuse it.
|
|
519
|
+
|
|
520
|
+
**What a service can count on.** Delivery is best effort: a piece can be missing. A message that
|
|
521
|
+
has no `final` piece ended without one.
|
|
522
|
+
|
|
523
|
+
## 12. Security rules
|
|
451
524
|
|
|
452
525
|
- The service key is read from an environment variable named in the configuration
|
|
453
526
|
(`service.keyEnv`), or from a file named by `<keyEnv>_FILE`. It is never written in the
|
|
@@ -461,14 +534,17 @@ that arrives has ended without a known outcome.
|
|
|
461
534
|
- The error text of a failed turn is cleaned of known secret shapes before it is sent (section 9).
|
|
462
535
|
- An activity report holds the tool name and the cleaned intent only, never arguments or results
|
|
463
536
|
(section 10).
|
|
537
|
+
- A reasoning report holds the thinking text of the model with known secret shapes and the home
|
|
538
|
+
folder name hidden. It is the most revealing report: `reports.reasoning: false` keeps it on the
|
|
539
|
+
machine (section 11).
|
|
464
540
|
|
|
465
|
-
##
|
|
541
|
+
## 13. Versioning
|
|
466
542
|
|
|
467
543
|
`PROTOCOL_VERSION` is `1`. Version 1 is alpha: fields may still change before the first stable
|
|
468
544
|
release, and each change is recorded in CHANGELOG.md. A future incompatible change will use a
|
|
469
545
|
new version number.
|
|
470
546
|
|
|
471
|
-
##
|
|
547
|
+
## 14. Not in this contract
|
|
472
548
|
|
|
473
549
|
- Delivery of messages from the agent to a person without a reply to a message.
|
|
474
550
|
- Attachments and other non-text content.
|
package/package.json
CHANGED
|
@@ -72,6 +72,11 @@
|
|
|
72
72
|
"description": "Where activity reports are posted. No default: without it none are sent.",
|
|
73
73
|
"type": "string",
|
|
74
74
|
"pattern": "^/"
|
|
75
|
+
},
|
|
76
|
+
"reasoning": {
|
|
77
|
+
"description": "Where pieces of the agent's reasoning are posted. No default: without it none are sent.",
|
|
78
|
+
"type": "string",
|
|
79
|
+
"pattern": "^/"
|
|
75
80
|
}
|
|
76
81
|
},
|
|
77
82
|
"default": {}
|
|
@@ -176,6 +181,11 @@
|
|
|
176
181
|
"description": "Report the tools used for a message (name and intent, never arguments or results), when the transport takes it.",
|
|
177
182
|
"type": "boolean",
|
|
178
183
|
"default": true
|
|
184
|
+
},
|
|
185
|
+
"reasoning": {
|
|
186
|
+
"description": "Report the reasoning of the agent for a message (secrets hidden, line breaks kept), when the transport takes it.",
|
|
187
|
+
"type": "boolean",
|
|
188
|
+
"default": true
|
|
179
189
|
}
|
|
180
190
|
},
|
|
181
191
|
"default": {}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://example.com/omp-channel/schema/reasoning.schema.json",
|
|
4
|
+
"title": "Reasoning (agent to service)",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["type", "conversationId", "messageId", "replyTo", "seq", "text", "final", "at"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"type": { "const": "reasoning" },
|
|
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
|
+
"seq": { "type": "integer", "minimum": 0 },
|
|
29
|
+
"text": {
|
|
30
|
+
"description": "At most 4000 characters. Empty only on a final report.",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"maxLength": 4000
|
|
33
|
+
},
|
|
34
|
+
"final": { "type": "boolean" },
|
|
35
|
+
"truncated": { "const": true },
|
|
36
|
+
"at": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|