omp-channel 0.1.0 → 0.2.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 +31 -0
- package/README.md +44 -33
- package/dist/adapter.d.ts +6 -1
- package/dist/adapter.js.map +1 -1
- package/dist/config.d.ts +19 -6
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/dispatcher.d.ts +21 -0
- package/dist/dispatcher.js +147 -1
- package/dist/dispatcher.js.map +1 -1
- package/dist/extension.d.ts +4 -1
- package/dist/extension.js +38 -6
- package/dist/extension.js.map +1 -1
- package/dist/http-adapter.d.ts +2 -1
- package/dist/http-adapter.js +5 -1
- package/dist/http-adapter.js.map +1 -1
- package/dist/protocol.d.ts +20 -0
- package/dist/protocol.js +15 -0
- package/dist/protocol.js.map +1 -1
- package/dist/redact.d.ts +16 -0
- package/dist/redact.js +79 -0
- package/dist/redact.js.map +1 -0
- package/dist/turn.d.ts +37 -0
- package/dist/turn.js +79 -0
- package/dist/turn.js.map +1 -0
- package/docs/protocol.md +75 -9
- package/package.json +3 -3
- package/schema/config.schema.json +31 -0
- package/schema/failure.schema.json +34 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ and the project uses [Semantic Versioning](https://semver.org) once it reaches 1
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.2.1] - 2026-11-27
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- The `reply` tool is now among the tools sent to the model (`loadMode: "essential"`). Before,
|
|
13
|
+
Oh My Pi left it out, so the model could not answer and the message waited for ever.
|
|
14
|
+
- No message is left waiting. A run that ends without a `reply` call sends the final text of the
|
|
15
|
+
model as the reply (`replies.fromFinalText`, on by default), with secrets hidden. A stopped
|
|
16
|
+
turn, a closed or switched session and an answer the service refuses are reported as a
|
|
17
|
+
`failure`. Refused calls are tried again.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- An aborted turn is now reported as a `failure`.
|
|
22
|
+
|
|
23
|
+
## [0.2.0] - 2026-11-27
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- Failed turn report: when a run ends in a model error, each message it left unanswered is
|
|
28
|
+
reported to the service (`failure` event, `ChannelAdapter.failure`, `service.paths.failures`,
|
|
29
|
+
`schema/failure.schema.json`). `failures.includeReason` controls the error text, which is
|
|
30
|
+
cleaned of known secret shapes.
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- The state stays `working` while Oh My Pi retries a request, instead of turning `free` between
|
|
35
|
+
attempts.
|
|
36
|
+
|
|
37
|
+
## [0.1.0] - 2026-11-27
|
|
38
|
+
|
|
8
39
|
### Changed
|
|
9
40
|
|
|
10
41
|
- Configuration errors name the unknown key, the allowed keys or values, and the allowed range.
|
package/README.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# omp-channel
|
|
2
2
|
|
|
3
3
|
[](https://github.com/tommasomarchionni/omp-channel/actions/workflows/ci.yml)
|
|
4
|
+
|
|
4
5
|
[](LICENSE)
|
|
5
6
|

|
|
6
7
|
|
|
8
|
+
Documentation: <https://tommasomarchionni.github.io/omp-channel/>
|
|
9
|
+
|
|
7
10
|
**omp-channel** is an extension for [Oh My Pi](https://github.com/can1357/oh-my-pi) (OMP), a
|
|
8
11
|
terminal agent harness. It delivers messages from an external service (any system that exchanges messages
|
|
9
12
|
with a person) into an agent session, and sends the agent's replies
|
|
@@ -14,7 +17,7 @@ it work and receive the answers, including while the agent is busy. It is **not*
|
|
|
14
17
|
service, it contains **no models**, and it does **not** manage accounts. You provide the service
|
|
15
18
|
and the model; omp-channel is the link between them.
|
|
16
19
|
|
|
17
|
-
> **Status: alpha,
|
|
20
|
+
> **Status: alpha, version 0.2.1 on npm.** The behaviour is covered by automated tests that use fakes and
|
|
18
21
|
> a loopback HTTP service. Startup, delivery to an idle session, queueing during a turn and abort
|
|
19
22
|
> have passed in a live Oh My Pi session; the status report and the attribution values are not yet
|
|
20
23
|
> verified. See
|
|
@@ -50,18 +53,20 @@ until the open one is closed.
|
|
|
50
53
|
|
|
51
54
|
## Connect a service in three steps
|
|
52
55
|
|
|
53
|
-
### 0. Install
|
|
54
|
-
|
|
55
|
-
The package is not published yet. Until it is, install from a clone (step 1). When it is published,
|
|
56
|
-
the command is:
|
|
56
|
+
### 0. Install the extension
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
59
|
omp install omp-channel
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
adapter
|
|
62
|
+
This installs the published package into Oh My Pi's plugin folder (`~/.omp/plugins`). The
|
|
63
|
+
extension then loads in every session: no `-e` flag and no path to set. Check it by starting a
|
|
64
|
+
session and running `/channel-status`: it shows the transport in use and, when an adapter is
|
|
65
|
+
configured, what the adapter reports.
|
|
66
|
+
|
|
67
|
+
The configuration file is read from `.omp/omp-channel.json` in the directory where Oh My Pi
|
|
68
|
+
starts, or from the path in `OMP_CHANNEL_CONFIG` when that variable is set. Without either, the
|
|
69
|
+
extension has no transport and only offers MCP push. The steps below write this file.
|
|
65
70
|
|
|
66
71
|
A service that needs its own protocol connects through an adapter module (section 6 of
|
|
67
72
|
[docs/protocol.md](docs/protocol.md)). Point `adapterModule` at it in the configuration file, and
|
|
@@ -75,11 +80,9 @@ give the adapter the environment it reads:
|
|
|
75
80
|
}
|
|
76
81
|
```
|
|
77
82
|
|
|
78
|
-
|
|
83
|
+
### 1. Install from a clone (for development)
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
### 1. Install the extension from a clone
|
|
85
|
+
Use this only to change the extension itself. The steps below need the built `dist/index.js`:
|
|
83
86
|
|
|
84
87
|
```sh
|
|
85
88
|
git clone https://github.com/tommasomarchionni/omp-channel.git
|
|
@@ -88,11 +91,7 @@ npm ci
|
|
|
88
91
|
npm run build
|
|
89
92
|
```
|
|
90
93
|
|
|
91
|
-
|
|
92
|
-
the example below. You can also copy or link `dist/index.js` into one of the extension folders
|
|
93
|
-
that Oh My Pi reads (for example `<project>/.omp/extensions` or `~/.omp/agent/extensions`), or
|
|
94
|
-
list it in the `extensions` setting of your Oh My Pi configuration. Check the loading rules of
|
|
95
|
-
your Oh My Pi version.
|
|
94
|
+
Load the built file with the `-e` flag, as in the example below, instead of `omp install`.
|
|
96
95
|
|
|
97
96
|
### 2. Choose how messages arrive
|
|
98
97
|
|
|
@@ -208,21 +207,23 @@ extension still receives MCP pushes, but replies are reported as not configured.
|
|
|
208
207
|
validated against [schema/config.schema.json](schema/config.schema.json). An invalid file disables
|
|
209
208
|
the extension and writes the reason (with its path) to stderr.
|
|
210
209
|
|
|
211
|
-
| Key | Default
|
|
212
|
-
| -------------------------- |
|
|
213
|
-
| `mcpServer` | `"omp-channel"`
|
|
214
|
-
| `service.url` | none
|
|
215
|
-
| `service.keyEnv` | `"OMP_CHANNEL_KEY"`
|
|
216
|
-
| `service.requestTimeoutMs` | `10000`
|
|
217
|
-
| `service.paths.*` | `/messages`, `/messages/ack`, `/replies`, `/status` | Endpoint paths. |
|
|
218
|
-
| `poll.intervalMs` | `2000`
|
|
219
|
-
| `poll.maxBackoffMs` | `30000`
|
|
220
|
-
| `poll.batchSize` | `10`
|
|
221
|
-
| `limits.maxTextLength` | `4000`
|
|
222
|
-
| `limits.maxSenderLength` | `64`
|
|
223
|
-
| `limits.maxPending` | `5`
|
|
224
|
-
| `delivery.deliverAs` | `"followUp"`
|
|
225
|
-
| `
|
|
210
|
+
| Key | Default | Meaning |
|
|
211
|
+
| -------------------------- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
212
|
+
| `mcpServer` | `"omp-channel"` | MCP server name that may push messages. |
|
|
213
|
+
| `service.url` | none | Base URL of the service. `https` required; `http` only for loopback. |
|
|
214
|
+
| `service.keyEnv` | `"OMP_CHANNEL_KEY"` | Environment variable holding the key (`<keyEnv>_FILE` for a file). Required with `service.url`. |
|
|
215
|
+
| `service.requestTimeoutMs` | `10000` | Timeout of each request. |
|
|
216
|
+
| `service.paths.*` | `/messages`, `/messages/ack`, `/replies`, `/status`, `/failures` | Endpoint paths. |
|
|
217
|
+
| `poll.intervalMs` | `2000` | Wait between polls when the queue is empty. |
|
|
218
|
+
| `poll.maxBackoffMs` | `30000` | Longest wait after failed polls. |
|
|
219
|
+
| `poll.batchSize` | `10` | Deliveries requested per poll. |
|
|
220
|
+
| `limits.maxTextLength` | `4000` | Longest message text, in characters. |
|
|
221
|
+
| `limits.maxSenderLength` | `64` | Longest sender name. |
|
|
222
|
+
| `limits.maxPending` | `5` | Events waiting to be admitted; more are dropped and not acknowledged. |
|
|
223
|
+
| `delivery.deliverAs` | `"followUp"` | How a message is queued in Oh My Pi: `steer`, `followUp` or `aside`. |
|
|
224
|
+
| `failures.includeReason` | `true` | Send the cleaned error text when a turn fails and leaves a message unanswered. |
|
|
225
|
+
| `replies.fromFinalText` | `true` | Send the cleaned final text of the model as the reply when it did not use the `reply` tool. |
|
|
226
|
+
| `adapterModule` | none | Path to a module that exports a `ChannelAdapter`. Replaces the HTTP transport. |
|
|
226
227
|
|
|
227
228
|
Environment variables:
|
|
228
229
|
|
|
@@ -245,6 +246,16 @@ Environment variables:
|
|
|
245
246
|
addresses, for local tests.
|
|
246
247
|
- **Replies are limited.** The `reply` tool accepts only a `messageId` that was delivered in the
|
|
247
248
|
current session.
|
|
249
|
+
- **Error text is cleaned.** When a turn fails, the error from the model provider is sent with
|
|
250
|
+
known secret shapes and the home folder name hidden. `failures.includeReason: false` keeps it on
|
|
251
|
+
the machine.
|
|
252
|
+
|
|
253
|
+
## No message is left waiting
|
|
254
|
+
|
|
255
|
+
If the model answers at the terminal without calling `reply`, its final text is sent as the reply.
|
|
256
|
+
If there is no answer to send (a model error, a stopped turn, a closed session) the service
|
|
257
|
+
receives a `failure` report with the reason. All cases are listed in
|
|
258
|
+
[docs/protocol.md](docs/protocol.md), section 9.
|
|
248
259
|
|
|
249
260
|
Report vulnerabilities privately, as described in [SECURITY.md](SECURITY.md).
|
|
250
261
|
|
|
@@ -262,7 +273,7 @@ Report vulnerabilities privately, as described in [SECURITY.md](SECURITY.md).
|
|
|
262
273
|
plain JSON Schema where Oh My Pi declares a TypeBox schema.
|
|
263
274
|
- **Verified in a live Oh My Pi session (19.2.1, local model):** startup, delivery of a pushed
|
|
264
275
|
message to an idle session, a message pushed during a turn (taken at a turn boundary, see
|
|
265
|
-
[docs/protocol.md](docs/protocol.md) section 3.5), and
|
|
276
|
+
[docs/protocol.md](docs/protocol.md) section 3.5), abort, and the report of a refused model request.
|
|
266
277
|
- **Not verified yet:** the status report (`working`/`free`) to a service, and the effect of each
|
|
267
278
|
`attribution` value. See [docs/omp-verification.md](docs/omp-verification.md).
|
|
268
279
|
- `npm ci` also installs the Oh My Pi package for type checking; it is large.
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InboundEvent, OutboundReply, OutboundStatus } from "./protocol.js";
|
|
1
|
+
import type { InboundEvent, OutboundFailure, OutboundReply, OutboundStatus } from "./protocol.js";
|
|
2
2
|
/** One event from a service, with the lease id that the service uses for acknowledgement. */
|
|
3
3
|
export interface Delivery {
|
|
4
4
|
/** Present when the transport leases deliveries (the HTTP transport does). */
|
|
@@ -21,6 +21,11 @@ export interface ChannelAdapter {
|
|
|
21
21
|
ack?(deliveryId: string): Promise<void>;
|
|
22
22
|
/** Reports agent state for a conversation. Best effort. */
|
|
23
23
|
status?(status: OutboundStatus): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Reports that a message got no answer because the turn ended in an error. Without it the
|
|
26
|
+
* service learns nothing and the message stays unanswered. Throws when it is not accepted.
|
|
27
|
+
*/
|
|
28
|
+
failure?(failure: OutboundFailure): Promise<void>;
|
|
24
29
|
/** Tells the service that an interrupt was applied. Optional. */
|
|
25
30
|
interrupt?(conversationId: string): Promise<void>;
|
|
26
31
|
/** Tells the service that a conversation was closed on the agent side. Optional. */
|
package/dist/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAyCA,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,SAAS,GAAG,KAAgC,CAAC;IACnD,OAAO,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,UAAU,CAAC;AAC1F,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF"}
|
package/dist/config.d.ts
CHANGED
|
@@ -9,12 +9,7 @@ export interface ServiceConfig {
|
|
|
9
9
|
readonly url: URL;
|
|
10
10
|
readonly key: string;
|
|
11
11
|
readonly requestTimeoutMs: number;
|
|
12
|
-
readonly paths:
|
|
13
|
-
messages: string;
|
|
14
|
-
ack: string;
|
|
15
|
-
replies: string;
|
|
16
|
-
status: string;
|
|
17
|
-
};
|
|
12
|
+
readonly paths: ServicePaths;
|
|
18
13
|
}
|
|
19
14
|
export interface PollConfig {
|
|
20
15
|
readonly intervalMs: number;
|
|
@@ -24,6 +19,14 @@ export interface PollConfig {
|
|
|
24
19
|
export interface DeliveryConfig {
|
|
25
20
|
readonly deliverAs: "steer" | "followUp" | "aside";
|
|
26
21
|
}
|
|
22
|
+
export interface FailuresConfig {
|
|
23
|
+
/** Whether the cleaned error text is sent with a failure report. */
|
|
24
|
+
readonly includeReason: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface RepliesConfig {
|
|
27
|
+
/** Send the final text of the model as the reply when it did not use the reply tool. */
|
|
28
|
+
readonly fromFinalText: boolean;
|
|
29
|
+
}
|
|
27
30
|
export interface ChannelConfig {
|
|
28
31
|
readonly mcpServer: string;
|
|
29
32
|
readonly service: ServiceConfig | undefined;
|
|
@@ -33,6 +36,8 @@ export interface ChannelConfig {
|
|
|
33
36
|
maxPending: number;
|
|
34
37
|
};
|
|
35
38
|
readonly delivery: DeliveryConfig;
|
|
39
|
+
readonly failures: FailuresConfig;
|
|
40
|
+
readonly replies: RepliesConfig;
|
|
36
41
|
}
|
|
37
42
|
export interface ConfigSources {
|
|
38
43
|
readonly env: Readonly<Record<string, string | undefined>>;
|
|
@@ -46,5 +51,13 @@ export interface ConfigSources {
|
|
|
46
51
|
* by <keyEnv>_FILE. It is never read from the configuration file.
|
|
47
52
|
*/
|
|
48
53
|
export declare function loadConfig(sources: ConfigSources): ChannelConfig;
|
|
54
|
+
interface ServicePaths {
|
|
55
|
+
messages: string;
|
|
56
|
+
ack: string;
|
|
57
|
+
replies: string;
|
|
58
|
+
status: string;
|
|
59
|
+
failures: string;
|
|
60
|
+
}
|
|
49
61
|
/** https is required. Plain http is accepted only for loopback, and credentials are refused. */
|
|
50
62
|
export declare function parseServiceUrl(raw: string): URL;
|
|
63
|
+
export {};
|
package/dist/config.js
CHANGED
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAoB,MAAM,kBAAkB,CAAC;AAG7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC,MAAM,EAAE,kBAAkB,CA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,MAAM,IAAI,WAAW,CAAC,GAAG,MAAM,kCAAkC,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,IAAI,WAAW,CAAC,OAAO,MAAM,QAAQ,MAAM,2BAA2B,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,QAAQ,CAAC,KAAyB;IACzC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;AACpD,CAAC"}
|
package/dist/dispatcher.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type ChannelAdapter } from "./adapter.js";
|
|
|
2
2
|
import type { ChannelConfig } from "./config.js";
|
|
3
3
|
import type { SendUserMessageOptions } from "@oh-my-pi/pi-coding-agent/session/agent-session-types";
|
|
4
4
|
import { type AgentStatus, type InboundEvent } from "./protocol.js";
|
|
5
|
+
import { type Segment } from "./turn.js";
|
|
5
6
|
/** What happened to an inbound event. The outcomes marked as acknowledged may be acked. */
|
|
6
7
|
export type AdmitOutcome = "admitted" | "duplicate" | "ignored" | "refused" | "rejected" | "dropped";
|
|
7
8
|
export declare const ACKNOWLEDGED_OUTCOMES: ReadonlySet<AdmitOutcome>;
|
|
@@ -18,6 +19,8 @@ export interface DispatcherOptions {
|
|
|
18
19
|
readonly log: (line: string) => void;
|
|
19
20
|
readonly now?: () => Date;
|
|
20
21
|
readonly newId?: () => string;
|
|
22
|
+
/** Waits between two attempts to deliver (tests replace it). */
|
|
23
|
+
readonly wait?: (ms: number) => Promise<void>;
|
|
21
24
|
}
|
|
22
25
|
export type ReplyResult = {
|
|
23
26
|
ok: true;
|
|
@@ -25,6 +28,11 @@ export type ReplyResult = {
|
|
|
25
28
|
ok: false;
|
|
26
29
|
reason: string;
|
|
27
30
|
};
|
|
31
|
+
/** The reply a message gets when the answer to a later one covers it. */
|
|
32
|
+
export declare const ANSWERED_LATER_TEXT = "Answered together with a later message.";
|
|
33
|
+
export declare const UNDELIVERED_REASON = "The agent answered, but the answer could not be delivered";
|
|
34
|
+
export declare const CLOSED_REASON = "The agent was closed before it answered";
|
|
35
|
+
export declare const SWITCHED_REASON = "The agent moved to another session before it answered";
|
|
28
36
|
/**
|
|
29
37
|
* Applies inbound events to the agent session, one at a time and in arrival order.
|
|
30
38
|
*
|
|
@@ -34,6 +42,8 @@ export type ReplyResult = {
|
|
|
34
42
|
* without running again.
|
|
35
43
|
* - Interrupt stops the current turn only. Tool results already produced stay in the session.
|
|
36
44
|
* - Agent state is reported to the service for the open conversation.
|
|
45
|
+
* - A message is never left waiting: when a run ends, or the session goes away, every message
|
|
46
|
+
* without a reply gets the final answer of the model, a note, or a failure report.
|
|
37
47
|
*/
|
|
38
48
|
export declare class Dispatcher {
|
|
39
49
|
#private;
|
|
@@ -43,4 +53,15 @@ export declare class Dispatcher {
|
|
|
43
53
|
/** Reports the agent state for the open conversation. Best effort: errors are logged. */
|
|
44
54
|
setStatus(status: AgentStatus): void;
|
|
45
55
|
reply(messageId: string, text: string): Promise<ReplyResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Closes what a finished run left open. For each message without a reply or a report: the final
|
|
58
|
+
* text of the model as its reply (when the run completed with one), a note when a later message
|
|
59
|
+
* got the answer, or a failure report. Refused calls are tried again, and a message that could
|
|
60
|
+
* not be closed stays open for the end of the next run.
|
|
61
|
+
*/
|
|
62
|
+
settle(segments: readonly Segment[]): Promise<void>;
|
|
63
|
+
/** The session goes away: every open message is reported, with one attempt. */
|
|
64
|
+
abandon(reason: string): Promise<void>;
|
|
65
|
+
/** True while some admitted message has neither a reply nor a report. */
|
|
66
|
+
get hasOpenMessages(): boolean;
|
|
46
67
|
}
|
package/dist/dispatcher.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { AdapterError } from "./adapter.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cleanReason, cleanText } from "./redact.js";
|
|
4
|
+
import { buildFailure, buildReply, buildStatus, formatForSession, } from "./protocol.js";
|
|
5
|
+
import { NO_REPLY_REASON } from "./turn.js";
|
|
4
6
|
export const ACKNOWLEDGED_OUTCOMES = new Set([
|
|
5
7
|
"admitted",
|
|
6
8
|
"duplicate",
|
|
7
9
|
"ignored",
|
|
8
10
|
]);
|
|
9
11
|
const MAX_REMEMBERED = 1000;
|
|
12
|
+
/** Waits before each attempt to deliver what the end of a run owes the service. */
|
|
13
|
+
const ATTEMPT_DELAYS_MS = [0, 1_000, 5_000];
|
|
14
|
+
/** The reply a message gets when the answer to a later one covers it. */
|
|
15
|
+
export const ANSWERED_LATER_TEXT = "Answered together with a later message.";
|
|
16
|
+
export const UNDELIVERED_REASON = "The agent answered, but the answer could not be delivered";
|
|
17
|
+
export const CLOSED_REASON = "The agent was closed before it answered";
|
|
18
|
+
export const SWITCHED_REASON = "The agent moved to another session before it answered";
|
|
10
19
|
/**
|
|
11
20
|
* Applies inbound events to the agent session, one at a time and in arrival order.
|
|
12
21
|
*
|
|
@@ -16,6 +25,8 @@ const MAX_REMEMBERED = 1000;
|
|
|
16
25
|
* without running again.
|
|
17
26
|
* - Interrupt stops the current turn only. Tool results already produced stay in the session.
|
|
18
27
|
* - Agent state is reported to the service for the open conversation.
|
|
28
|
+
* - A message is never left waiting: when a run ends, or the session goes away, every message
|
|
29
|
+
* without a reply gets the final answer of the model, a note, or a failure report.
|
|
19
30
|
*/
|
|
20
31
|
export class Dispatcher {
|
|
21
32
|
#options;
|
|
@@ -24,6 +35,12 @@ export class Dispatcher {
|
|
|
24
35
|
#active;
|
|
25
36
|
#remembered = new RecentSet(MAX_REMEMBERED);
|
|
26
37
|
#conversationOf = new RecentMap(MAX_REMEMBERED);
|
|
38
|
+
#answered = new RecentSet(MAX_REMEMBERED);
|
|
39
|
+
#reportedFailed = new RecentSet(MAX_REMEMBERED);
|
|
40
|
+
/** Messages whose end is being sent now, so a second end of a run does not send it twice. */
|
|
41
|
+
#settling = new Set();
|
|
42
|
+
/** Admitted messages that have neither a reply nor a report yet, oldest first. */
|
|
43
|
+
#waiting = new Set();
|
|
27
44
|
constructor(options) {
|
|
28
45
|
this.#options = options;
|
|
29
46
|
}
|
|
@@ -72,6 +89,8 @@ export class Dispatcher {
|
|
|
72
89
|
});
|
|
73
90
|
try {
|
|
74
91
|
await adapter.reply(reply);
|
|
92
|
+
this.#answered.add(messageId);
|
|
93
|
+
this.#waiting.delete(messageId);
|
|
75
94
|
return { ok: true };
|
|
76
95
|
}
|
|
77
96
|
catch (error) {
|
|
@@ -79,6 +98,129 @@ export class Dispatcher {
|
|
|
79
98
|
return { ok: false, reason: `the service did not accept the reply: ${detail}` };
|
|
80
99
|
}
|
|
81
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Closes what a finished run left open. For each message without a reply or a report: the final
|
|
103
|
+
* text of the model as its reply (when the run completed with one), a note when a later message
|
|
104
|
+
* got the answer, or a failure report. Refused calls are tried again, and a message that could
|
|
105
|
+
* not be closed stays open for the end of the next run.
|
|
106
|
+
*/
|
|
107
|
+
async settle(segments) {
|
|
108
|
+
const order = segments.flatMap((segment) => segment.messageIds);
|
|
109
|
+
const open = new Set(order.filter((messageId) => this.#isOpen(messageId)));
|
|
110
|
+
// Taken before the first wait.
|
|
111
|
+
for (const messageId of open) {
|
|
112
|
+
this.#settling.add(messageId);
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
for (const segment of segments) {
|
|
116
|
+
const mine = segment.messageIds.filter((messageId) => open.has(messageId));
|
|
117
|
+
// Covered: a message that came after it already has its answer.
|
|
118
|
+
const covered = mine.filter((messageId) => order.slice(order.indexOf(messageId) + 1).some((later) => this.#answered.has(later)));
|
|
119
|
+
await this.#close(segment, mine.filter((id) => !covered.includes(id)), covered);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
for (const messageId of open) {
|
|
124
|
+
this.#settling.delete(messageId);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/** The session goes away: every open message is reported, with one attempt. */
|
|
129
|
+
async abandon(reason) {
|
|
130
|
+
const open = [...this.#waiting].filter((messageId) => this.#isOpen(messageId));
|
|
131
|
+
await Promise.all(open.map((messageId) => this.#reportFailure(messageId, reason, [0])));
|
|
132
|
+
}
|
|
133
|
+
/** True while some admitted message has neither a reply nor a report. */
|
|
134
|
+
get hasOpenMessages() {
|
|
135
|
+
return [...this.#waiting].some((messageId) => this.#isOpen(messageId));
|
|
136
|
+
}
|
|
137
|
+
async #close(segment, due, covered) {
|
|
138
|
+
const { config } = this.#options;
|
|
139
|
+
const newest = due.at(-1);
|
|
140
|
+
const text = newest !== undefined && config.replies.fromFinalText && segment.text !== undefined
|
|
141
|
+
? cleanText(segment.text, config.limits.maxTextLength)
|
|
142
|
+
: undefined;
|
|
143
|
+
let notes = covered;
|
|
144
|
+
if (newest !== undefined && text !== undefined) {
|
|
145
|
+
if (await this.#deliverReply(newest, text)) {
|
|
146
|
+
notes = [...covered, ...due.slice(0, -1)];
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
for (const messageId of due) {
|
|
150
|
+
await this.#reportFailure(messageId, UNDELIVERED_REASON);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
const reason = segment.reason ?? (segment.outcome === "completed" ? NO_REPLY_REASON : undefined);
|
|
156
|
+
for (const messageId of due) {
|
|
157
|
+
await this.#reportFailure(messageId, reason);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
for (const messageId of notes) {
|
|
161
|
+
if (!(await this.#deliverReply(messageId, ANSWERED_LATER_TEXT))) {
|
|
162
|
+
await this.#reportFailure(messageId, UNDELIVERED_REASON);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
#isOpen(messageId) {
|
|
167
|
+
return (this.#conversationOf.get(messageId) !== undefined &&
|
|
168
|
+
!this.#answered.has(messageId) &&
|
|
169
|
+
!this.#reportedFailed.has(messageId) &&
|
|
170
|
+
!this.#settling.has(messageId));
|
|
171
|
+
}
|
|
172
|
+
async #deliverReply(messageId, text) {
|
|
173
|
+
for (const delay of ATTEMPT_DELAYS_MS) {
|
|
174
|
+
await this.#wait(delay);
|
|
175
|
+
// The model may have answered while this waited.
|
|
176
|
+
if (this.#answered.has(messageId) || (await this.reply(messageId, text)).ok) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
this.#options.log("an answer could not be delivered");
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
async #reportFailure(messageId, reason, delays = ATTEMPT_DELAYS_MS) {
|
|
184
|
+
const conversation = this.#conversationOf.get(messageId);
|
|
185
|
+
if (conversation === undefined) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const adapter = this.#options.adapter;
|
|
189
|
+
if (adapter?.failure === undefined) {
|
|
190
|
+
this.#options.log("a message got no answer and the adapter does not report failures");
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const shown = this.#options.config.failures.includeReason && reason !== undefined
|
|
194
|
+
? cleanReason(reason)
|
|
195
|
+
: undefined;
|
|
196
|
+
const report = buildFailure(conversation, messageId, shown, {
|
|
197
|
+
messageId: this.#newId(),
|
|
198
|
+
at: this.#now(),
|
|
199
|
+
});
|
|
200
|
+
let failure = "unknown";
|
|
201
|
+
for (const delay of delays) {
|
|
202
|
+
await this.#wait(delay);
|
|
203
|
+
if (this.#answered.has(messageId)) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
await adapter.failure(report);
|
|
208
|
+
this.#reportedFailed.add(messageId);
|
|
209
|
+
this.#waiting.delete(messageId);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
failure = errorName(error);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
this.#options.log(`failure was not reported (${failure})`);
|
|
217
|
+
}
|
|
218
|
+
async #wait(ms) {
|
|
219
|
+
if (ms === 0) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
await (this.#options.wait?.(ms) ?? new Promise((resolve) => setTimeout(resolve, ms)));
|
|
223
|
+
}
|
|
82
224
|
async #apply(event, deliveryId) {
|
|
83
225
|
const { config, session } = this.#options;
|
|
84
226
|
if (event.type === "message") {
|
|
@@ -130,6 +272,7 @@ export class Dispatcher {
|
|
|
130
272
|
this.#active = event.conversationId;
|
|
131
273
|
this.#remembered.add(key);
|
|
132
274
|
this.#conversationOf.set(event.messageId, event.conversationId);
|
|
275
|
+
this.#waiting.add(event.messageId);
|
|
133
276
|
return "admitted";
|
|
134
277
|
}
|
|
135
278
|
async #notify(call, label) {
|
|
@@ -159,6 +302,9 @@ class RecentSet {
|
|
|
159
302
|
has(value) {
|
|
160
303
|
return this.#values.has(value);
|
|
161
304
|
}
|
|
305
|
+
delete(value) {
|
|
306
|
+
this.#values.delete(value);
|
|
307
|
+
}
|
|
162
308
|
add(value) {
|
|
163
309
|
this.#values.add(value);
|
|
164
310
|
if (this.#values.size > this.#capacity) {
|
package/dist/dispatcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher.js","sourceRoot":"","sources":["../src/dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAuB,MAAM,cAAc,CAAC;AAGjE,OAAO,EAEL,UAAU,EACV,WAAW,EACX,gBAAgB,GAGjB,MAAM,eAAe,CAAC;AAWvB,MAAM,CAAC,MAAM,qBAAqB,GAA8B,IAAI,GAAG,CAAC;IACtE,UAAU;IACV,WAAW;IACX,SAAS;CACV,CAAC,CAAC;AAoBH,MAAM,cAAc,GAAG,IAA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5B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;YAC1C,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC/B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/extension.d.ts
CHANGED
|
@@ -8,12 +8,15 @@ export interface ChannelExtensionOptions {
|
|
|
8
8
|
readonly adapter?: ChannelAdapter | undefined;
|
|
9
9
|
/** Receives short diagnostic lines. They never contain message text or keys. */
|
|
10
10
|
readonly log?: (line: string) => void;
|
|
11
|
+
/** Waits between two attempts to deliver (tests replace it). */
|
|
12
|
+
readonly wait?: (ms: number) => Promise<void>;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Creates the extension factory. It registers:
|
|
14
16
|
* - `mcp_notification`: messages pushed by the configured MCP server enter the agent;
|
|
15
17
|
* - the `reply` tool: the model answers a message by its messageId;
|
|
16
|
-
* - lifecycle hooks: agent state is reported
|
|
18
|
+
* - lifecycle hooks: the agent state is reported, no message is left without an answer or a
|
|
19
|
+
* report when a run ends or the session goes away, and the adapter stops on shutdown;
|
|
17
20
|
* - the adapter receive loop, when an adapter is given.
|
|
18
21
|
*/
|
|
19
22
|
export declare function createChannelExtension(options: ChannelExtensionOptions): ExtensionFactory;
|