@agentcomms/events-daemon 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -11
- package/THIRD_PARTY_LICENSES +2 -2
- package/dist/{b3-contract-03AO67VB.mjs → b3-contract-B6UBBK7F.mjs} +306 -55
- package/dist/cli.mjs +5083 -1385
- package/dist/index.d.mts +192 -35
- package/dist/index.mjs +1 -1
- package/dist/{mcp-DXXb3Vv3-B0sHZfig.mjs → mcp-DIH4cS6P-YuKZfqTg.mjs} +181 -68
- package/dist/records-DjE5a4_H.mjs +2 -0
- package/dist/{records-3rGS8spn.mjs → records-DsUxYBwb.mjs} +2 -2
- package/dist/{stdio-CD7QQBAh.mjs → stdio-Dp1EE6ok.mjs} +28 -3
- package/dist/{webhook-target-BkA_wHIu.mjs → webhook-target-DyDTwWhV.mjs} +38 -27
- package/package.json +11 -11
- package/dist/records-DojbuTaG.mjs +0 -2
package/README.md
CHANGED
|
@@ -27,7 +27,8 @@ agent-events run # in a terminal you keep open: the owner of
|
|
|
27
27
|
cleanly on `agent-events stop` or when the terminal closes. There is no background service or autostart in this
|
|
28
28
|
release; the desktop app will supervise it later. Its state lives in an owner-only directory. A state directory so
|
|
29
29
|
deep that its control socket's path would pass the system limit (103 bytes on macOS, 107 on Linux) is refused, with
|
|
30
|
-
a hint to pin a shorter one.
|
|
30
|
+
a hint to pin a shorter one. `agent-events --version` (or `-V`) prints the installed daemon version; a subcommand's
|
|
31
|
+
`--version <number>` continues to select an immutable rule, target, subscriber or judge version.
|
|
31
32
|
|
|
32
33
|
## A first rule: Gmail into the dry-run log
|
|
33
34
|
|
|
@@ -95,7 +96,8 @@ approval preview then shows exactly what changes.
|
|
|
95
96
|
|
|
96
97
|
The event catalogue, `agent-events catalogue list`, gives every event type and field.
|
|
97
98
|
- **Conditions and mapping:** checks on an event's fields, and a mapping that names exactly the fields a target
|
|
98
|
-
receives. Nothing else leaves.
|
|
99
|
+
receives. Nothing else leaves. Once you enable a judge, a rule can also ask a model one yes/no question
|
|
100
|
+
([Judges](#judges)).
|
|
99
101
|
- **Targets:**
|
|
100
102
|
- **Webhooks:** HTTPS, or plain HTTP to the literal loopback address only. Addresses are pinned, and every attempt
|
|
101
103
|
is signed (Standard Webhooks). Each delivery can be retried or dropped (`delivery retry`, `delivery drop`).
|
|
@@ -111,16 +113,20 @@ approval preview then shows exactly what changes.
|
|
|
111
113
|
|
|
112
114
|
## Agents and approvals
|
|
113
115
|
|
|
114
|
-
`agent-events mcp` serves the same operations to a coding agent over MCP. Register it
|
|
115
|
-
|
|
116
|
+
`agent-events mcp` serves the same operations to a coding agent over MCP. Register it through the core's managed
|
|
117
|
+
installer — for example, `agentcomms mcp install --server events --client claude-code` — or call
|
|
118
|
+
`comms_server_install` with `channel: "events"` from the core MCP server. The same preview-and-approval flow used for
|
|
119
|
+
channel servers applies, and the result tells you to restart the client. The
|
|
116
120
|
[`agentcomms-events` skill](../../skills/agentcomms-events/SKILL.md) tells an agent how to use it.
|
|
117
121
|
|
|
118
|
-
- **An agent can:** read the catalogue and your rules, propose rules
|
|
119
|
-
event
|
|
122
|
+
- **An agent can:** read the catalogue and your rules, propose rules, targets, judges and a judge budget, test a rule
|
|
123
|
+
against a sample event, test an active judge on the daemon's synthetic event, prepare a judge kind's enablement,
|
|
124
|
+
and turn a judge kind off.
|
|
120
125
|
- **An agent can never:**
|
|
121
126
|
- approve anything;
|
|
122
127
|
- read what the dry-run log kept;
|
|
123
128
|
- see, set or rotate a webhook secret or stream token;
|
|
129
|
+
- see, set or rotate a hosted judge's API key;
|
|
124
130
|
- resume a target;
|
|
125
131
|
- decide a held event.
|
|
126
132
|
|
|
@@ -129,9 +135,129 @@ any MCP server, with `npx -y @agentcomms/events-daemon mcp` as the command. The
|
|
|
129
135
|
|
|
130
136
|
## Judges
|
|
131
137
|
|
|
132
|
-
A rule can
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
A rule can ask a model one yes/no question about an event, after the rule's own conditions on its fields have matched.
|
|
139
|
+
Two kinds of judge are available:
|
|
140
|
+
- **`typesafe`:** TypeSafe's hosted **Jev** (`jev-1.13.0`), through its System One API at
|
|
141
|
+
`https://api.typesafe.ai/v1/systemone`. The fields the rule names leave this machine for TypeSafe, sent with your
|
|
142
|
+
TypeSafe API key.
|
|
143
|
+
- **`local-endpoint`:** a model server you run on this machine, at a plain-HTTP URL whose host is the literal
|
|
144
|
+
`127.0.0.1` or `::1`; hostnames, HTTPS and any other address are refused. It is sent the same System One request
|
|
145
|
+
as Jev. A server that answers in its own JSON says where its number is, with `"protocol": "json-score"` and a
|
|
146
|
+
`scorePointer`, and that number is labelled an uncalibrated score. Nothing leaves this machine.
|
|
147
|
+
|
|
148
|
+
The third kind, **`laya`**, runs the Laya model inside the daemon. It is not available yet: `agent-events judge kinds
|
|
149
|
+
list` shows it as unavailable, and a judge naming it is refused.
|
|
150
|
+
|
|
151
|
+
**Every judge kind is off until you enable it, at your terminal.** Installing, updating, a rule or a budget never
|
|
152
|
+
turns one on. Turning a kind off also cancels any pending global enablement that captured a rule of that kind. Removing
|
|
153
|
+
a judge cancels its pending rule activations, and a rule that embeds that revoked judge cannot later become active. To
|
|
154
|
+
ask Jev about received mail:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# 1. turn the kind on: you approve its exact enablement at this terminal
|
|
158
|
+
agent-events judge kind enable typesafe
|
|
159
|
+
agent-events approve <approval-id>
|
|
160
|
+
|
|
161
|
+
# 2. the daemon-wide judge budget: no judge is called without one
|
|
162
|
+
agent-events budget update "$(cat budget.json)"
|
|
163
|
+
agent-events approve <approval-id>
|
|
164
|
+
|
|
165
|
+
# 3. the judge, then its TypeSafe API key, which you enter at this terminal
|
|
166
|
+
agent-events judge add "$(cat judge.json)"
|
|
167
|
+
agent-events judge key set jev --version 1
|
|
168
|
+
|
|
169
|
+
# 4. a rule that asks it; its approval shows the question, the fields the judge sees and where they go
|
|
170
|
+
agent-events rule create "$(cat rule.json)"
|
|
171
|
+
agent-events rule enable mail-asks 1
|
|
172
|
+
agent-events approve <approval-id>
|
|
173
|
+
|
|
174
|
+
# 5. try the judge on the daemon's own synthetic event, never one of yours
|
|
175
|
+
agent-events judge test jev --version 1
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`judge.json`:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"judgeId": "jev",
|
|
183
|
+
"version": 1,
|
|
184
|
+
"kind": "typesafe",
|
|
185
|
+
"provider": "typesafe",
|
|
186
|
+
"model": "jev-1.13.0",
|
|
187
|
+
"endpoint": "https://api.typesafe.ai/v1/systemone",
|
|
188
|
+
"promptTemplate": "typesafe-jev-noul-v1",
|
|
189
|
+
"protocol": "noul"
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`budget.json`, the ceilings for every judge call, overall and per provider:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"budgetId": "judge-budget",
|
|
198
|
+
"version": 1,
|
|
199
|
+
"global": { "callsPerRollingHour": 60, "inputTokensPerRolling30Days": 1000000, "concurrency": 2 },
|
|
200
|
+
"providers": [
|
|
201
|
+
{ "provider": "typesafe", "callsPerRollingHour": 60, "inputTokensPerRolling30Days": 1000000, "concurrency": 2 }
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`rule.json` is the first rule with `"ruleId": "mail-asks"` and an `agentic` part beside its `condition`. Its `judge`
|
|
207
|
+
is the judge document exactly as you added it:
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
"agentic": {
|
|
211
|
+
"judge": {
|
|
212
|
+
"judgeId": "jev",
|
|
213
|
+
"version": 1,
|
|
214
|
+
"kind": "typesafe",
|
|
215
|
+
"provider": "typesafe",
|
|
216
|
+
"model": "jev-1.13.0",
|
|
217
|
+
"endpoint": "https://api.typesafe.ai/v1/systemone",
|
|
218
|
+
"promptTemplate": "typesafe-jev-noul-v1",
|
|
219
|
+
"protocol": "noul"
|
|
220
|
+
},
|
|
221
|
+
"question": "Does this message ask me to do something today?",
|
|
222
|
+
"inputs": ["/subject"],
|
|
223
|
+
"threshold": 0.8,
|
|
224
|
+
"onUncertain": "hold",
|
|
225
|
+
"callsPerRollingHour": 20,
|
|
226
|
+
"inputTokensPerRolling30Days": 100000,
|
|
227
|
+
"concurrency": 1,
|
|
228
|
+
"maxInputTokens": 512,
|
|
229
|
+
"maxOutputTokens": 64
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
A local judge has `"kind": "local-endpoint"`, your server's `provider`, `model` and `endpoint`, and that endpoint's
|
|
234
|
+
address in `"approvedAddressSet": ["127.0.0.1"]`. It needs no key.
|
|
235
|
+
|
|
236
|
+
**What a judge sees, and what it decides:**
|
|
237
|
+
- Only the fields in `inputs`, sanitised and marked as untrusted inside a fixed prompt. The rule's `condition` must
|
|
238
|
+
check a content field too (`/subject` above), so a judge is never asked about every event.
|
|
239
|
+
- It has no tools, secrets or authority. Its answer is one number from 0 to 1, and the rule matches when that number
|
|
240
|
+
reaches `threshold`. A message written to talk the judge into a match can move only that number; it cannot change
|
|
241
|
+
the rule, its fields or its targets.
|
|
242
|
+
- An answer up to 0.1 below the threshold is uncertain. It is no match or, with `"onUncertain": "hold"`, a held
|
|
243
|
+
decision that waits for you: `agent-events held list` shows them, and `agent-events held decide <decision-id> accept`
|
|
244
|
+
(or `reject`) settles one, at your terminal.
|
|
245
|
+
- A timeout, a malformed answer or a spent budget is no match. Retrying a delivery never asks the judge again.
|
|
246
|
+
|
|
247
|
+
**Budgets.** Each rule sets its own ceilings: calls per rolling hour, input tokens per rolling 30 days, concurrent
|
|
248
|
+
calls, and the most input and output tokens per call. The daemon-wide budget caps every rule, overall and per
|
|
249
|
+
provider, and a rule cannot raise it. A rule's new version inherits the charges of the versions before it, so a new
|
|
250
|
+
version never resets a budget. `judge test` runs at most ten times an hour per judge version, charged to the overall
|
|
251
|
+
budget. A call is charged once it reaches the network: one refused, out of time or cut short before its first
|
|
252
|
+
connection costs nothing, and a retry is a call of its own.
|
|
253
|
+
|
|
254
|
+
**Turning a kind off.** `agent-events judge kind disable typesafe` takes effect at once: decisions waiting on its
|
|
255
|
+
judges, and the deliveries, dry-run records and stream entries bound to them, are cancelled and purged. Rules that
|
|
256
|
+
name its judges stay, but cannot call them; turning the kind back on needs a new approval. `disable-all` stops judges
|
|
257
|
+
along with everything else.
|
|
258
|
+
|
|
259
|
+
`doctor` shows each kind's state, the active budget version and its reservations, how many decisions are held and
|
|
260
|
+
when the next one expires, any hosted judge whose key is missing, and Laya as not available yet, all without content.
|
|
135
261
|
|
|
136
262
|
## For desktop and tool builders
|
|
137
263
|
|
|
@@ -139,8 +265,9 @@ The data-only control contract is
|
|
|
139
265
|
[`b3-control-v1.schema.json`](src/operations/contracts/b3-control-v1.schema.json). Its content-free
|
|
140
266
|
request, result and error vectors are in [`test/fixtures/b3-control-contract-v1`](test/fixtures/b3-control-contract-v1),
|
|
141
267
|
and the terminal approval-preview vectors are in [`test/fixtures/b3-approval-preview-v1`](test/fixtures/b3-approval-preview-v1).
|
|
142
|
-
It covers every capability a desktop app may call, and never contains a secret value. Its doctor result is
|
|
143
|
-
[`doctor-v1.schema.json`](src/operations/contracts/doctor-v1.schema.json)
|
|
268
|
+
It covers every B3 capability a desktop app may call, and never contains a secret value. Its frozen doctor result is
|
|
269
|
+
the closed [`doctor-v1.schema.json`](src/operations/contracts/doctor-v1.schema.json); the released daemon reports the
|
|
270
|
+
additive Phase-E [`doctor-v2.schema.json`](src/operations/contracts/doctor-v2.schema.json).
|
|
144
271
|
|
|
145
272
|
## Licence
|
|
146
273
|
|
package/THIRD_PARTY_LICENSES
CHANGED
|
@@ -8,7 +8,7 @@ Generated by scripts/third-party-licenses.mjs from the 4 packages the bundler pu
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
----------------------------------------------------------------------------------------------------
|
|
11
|
-
@modelcontextprotocol/core@2.
|
|
11
|
+
@modelcontextprotocol/core@2.3.1 — Apache-2.0
|
|
12
12
|
https://modelcontextprotocol.io
|
|
13
13
|
----------------------------------------------------------------------------------------------------
|
|
14
14
|
The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
|
|
@@ -228,7 +228,7 @@ Documentation in this project (excluding specifications) is licensed under
|
|
|
228
228
|
CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
|
|
229
229
|
the full license text.
|
|
230
230
|
----------------------------------------------------------------------------------------------------
|
|
231
|
-
@modelcontextprotocol/server@2.
|
|
231
|
+
@modelcontextprotocol/server@2.3.1 — Apache-2.0
|
|
232
232
|
https://modelcontextprotocol.io
|
|
233
233
|
----------------------------------------------------------------------------------------------------
|
|
234
234
|
The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
|