@agentcomms/events-daemon 0.16.0 → 0.17.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 +129 -8
- package/dist/{b3-contract-03AO67VB.mjs → b3-contract-DFxcHY0I.mjs} +304 -53
- package/dist/cli.mjs +6615 -3175
- package/dist/index.d.mts +73 -23
- package/dist/index.mjs +1 -1
- package/dist/records-DjE5a4_H.mjs +2 -0
- package/dist/{records-3rGS8spn.mjs → records-DsUxYBwb.mjs} +2 -2
- package/dist/{webhook-target-BkA_wHIu.mjs → webhook-target-DyDTwWhV.mjs} +38 -27
- package/package.json +8 -8
- package/dist/records-DojbuTaG.mjs +0 -2
package/README.md
CHANGED
|
@@ -95,7 +95,8 @@ approval preview then shows exactly what changes.
|
|
|
95
95
|
|
|
96
96
|
The event catalogue, `agent-events catalogue list`, gives every event type and field.
|
|
97
97
|
- **Conditions and mapping:** checks on an event's fields, and a mapping that names exactly the fields a target
|
|
98
|
-
receives. Nothing else leaves.
|
|
98
|
+
receives. Nothing else leaves. Once you enable a judge, a rule can also ask a model one yes/no question
|
|
99
|
+
([Judges](#judges)).
|
|
99
100
|
- **Targets:**
|
|
100
101
|
- **Webhooks:** HTTPS, or plain HTTP to the literal loopback address only. Addresses are pinned, and every attempt
|
|
101
102
|
is signed (Standard Webhooks). Each delivery can be retried or dropped (`delivery retry`, `delivery drop`).
|
|
@@ -115,12 +116,14 @@ approval preview then shows exactly what changes.
|
|
|
115
116
|
any MCP server, with `npx -y @agentcomms/events-daemon mcp` as the command. The
|
|
116
117
|
[`agentcomms-events` skill](../../skills/agentcomms-events/SKILL.md) tells an agent how to use it.
|
|
117
118
|
|
|
118
|
-
- **An agent can:** read the catalogue and your rules, propose rules
|
|
119
|
-
event
|
|
119
|
+
- **An agent can:** read the catalogue and your rules, propose rules, targets, judges and a judge budget, test a rule
|
|
120
|
+
against a sample event, test an active judge on the daemon's synthetic event, prepare a judge kind's enablement,
|
|
121
|
+
and turn a judge kind off.
|
|
120
122
|
- **An agent can never:**
|
|
121
123
|
- approve anything;
|
|
122
124
|
- read what the dry-run log kept;
|
|
123
125
|
- see, set or rotate a webhook secret or stream token;
|
|
126
|
+
- see, set or rotate a hosted judge's API key;
|
|
124
127
|
- resume a target;
|
|
125
128
|
- decide a held event.
|
|
126
129
|
|
|
@@ -129,9 +132,126 @@ any MCP server, with `npx -y @agentcomms/events-daemon mcp` as the command. The
|
|
|
129
132
|
|
|
130
133
|
## Judges
|
|
131
134
|
|
|
132
|
-
A rule can
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
A rule can ask a model one yes/no question about an event, after the rule's own conditions on its fields have matched.
|
|
136
|
+
Two kinds of judge are available:
|
|
137
|
+
- **`typesafe`:** TypeSafe's hosted **Jev** (`jev-1.13.0`), through its System One API at
|
|
138
|
+
`https://api.typesafe.ai/v1/systemone`. The fields the rule names leave this machine for TypeSafe, sent with your
|
|
139
|
+
TypeSafe API key.
|
|
140
|
+
- **`local-endpoint`:** a model server you run on this machine, at a plain-HTTP URL whose host is the literal
|
|
141
|
+
`127.0.0.1` or `::1`; hostnames, HTTPS and any other address are refused. It is sent the same System One request
|
|
142
|
+
as Jev. A server that answers in its own JSON says where its number is, with `"protocol": "json-score"` and a
|
|
143
|
+
`scorePointer`, and that number is labelled an uncalibrated score. Nothing leaves this machine.
|
|
144
|
+
|
|
145
|
+
The third kind, **`laya`**, runs the Laya model inside the daemon. It is not available yet: `agent-events judge kinds
|
|
146
|
+
list` shows it as unavailable, and a judge naming it is refused.
|
|
147
|
+
|
|
148
|
+
**Every judge kind is off until you enable it, at your terminal.** Installing, updating, a rule or a budget never
|
|
149
|
+
turns one on. To ask Jev about received mail:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# 1. turn the kind on: you approve its exact enablement at this terminal
|
|
153
|
+
agent-events judge kind enable typesafe
|
|
154
|
+
agent-events approve <approval-id>
|
|
155
|
+
|
|
156
|
+
# 2. the daemon-wide judge budget: no judge is called without one
|
|
157
|
+
agent-events budget update "$(cat budget.json)"
|
|
158
|
+
agent-events approve <approval-id>
|
|
159
|
+
|
|
160
|
+
# 3. the judge, then its TypeSafe API key, which you enter at this terminal
|
|
161
|
+
agent-events judge add "$(cat judge.json)"
|
|
162
|
+
agent-events judge key set jev --version 1
|
|
163
|
+
|
|
164
|
+
# 4. a rule that asks it; its approval shows the question, the fields the judge sees and where they go
|
|
165
|
+
agent-events rule create "$(cat rule.json)"
|
|
166
|
+
agent-events rule enable mail-asks 1
|
|
167
|
+
agent-events approve <approval-id>
|
|
168
|
+
|
|
169
|
+
# 5. try the judge on the daemon's own synthetic event, never one of yours
|
|
170
|
+
agent-events judge test jev --version 1
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`judge.json`:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"judgeId": "jev",
|
|
178
|
+
"version": 1,
|
|
179
|
+
"kind": "typesafe",
|
|
180
|
+
"provider": "typesafe",
|
|
181
|
+
"model": "jev-1.13.0",
|
|
182
|
+
"endpoint": "https://api.typesafe.ai/v1/systemone",
|
|
183
|
+
"promptTemplate": "typesafe-jev-noul-v1",
|
|
184
|
+
"protocol": "noul"
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`budget.json`, the ceilings for every judge call, overall and per provider:
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"budgetId": "judge-budget",
|
|
193
|
+
"version": 1,
|
|
194
|
+
"global": { "callsPerRollingHour": 60, "inputTokensPerRolling30Days": 1000000, "concurrency": 2 },
|
|
195
|
+
"providers": [
|
|
196
|
+
{ "provider": "typesafe", "callsPerRollingHour": 60, "inputTokensPerRolling30Days": 1000000, "concurrency": 2 }
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
`rule.json` is the first rule with `"ruleId": "mail-asks"` and an `agentic` part beside its `condition`. Its `judge`
|
|
202
|
+
is the judge document exactly as you added it:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
"agentic": {
|
|
206
|
+
"judge": {
|
|
207
|
+
"judgeId": "jev",
|
|
208
|
+
"version": 1,
|
|
209
|
+
"kind": "typesafe",
|
|
210
|
+
"provider": "typesafe",
|
|
211
|
+
"model": "jev-1.13.0",
|
|
212
|
+
"endpoint": "https://api.typesafe.ai/v1/systemone",
|
|
213
|
+
"promptTemplate": "typesafe-jev-noul-v1",
|
|
214
|
+
"protocol": "noul"
|
|
215
|
+
},
|
|
216
|
+
"question": "Does this message ask me to do something today?",
|
|
217
|
+
"inputs": ["/subject"],
|
|
218
|
+
"threshold": 0.8,
|
|
219
|
+
"onUncertain": "hold",
|
|
220
|
+
"callsPerRollingHour": 20,
|
|
221
|
+
"inputTokensPerRolling30Days": 100000,
|
|
222
|
+
"concurrency": 1,
|
|
223
|
+
"maxInputTokens": 512,
|
|
224
|
+
"maxOutputTokens": 64
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
A local judge has `"kind": "local-endpoint"`, your server's `provider`, `model` and `endpoint`, and that endpoint's
|
|
229
|
+
address in `"approvedAddressSet": ["127.0.0.1"]`. It needs no key.
|
|
230
|
+
|
|
231
|
+
**What a judge sees, and what it decides:**
|
|
232
|
+
- Only the fields in `inputs`, sanitised and marked as untrusted inside a fixed prompt. The rule's `condition` must
|
|
233
|
+
check a content field too (`/subject` above), so a judge is never asked about every event.
|
|
234
|
+
- It has no tools, secrets or authority. Its answer is one number from 0 to 1, and the rule matches when that number
|
|
235
|
+
reaches `threshold`. A message written to talk the judge into a match can move only that number; it cannot change
|
|
236
|
+
the rule, its fields or its targets.
|
|
237
|
+
- An answer up to 0.1 below the threshold is uncertain. It is no match or, with `"onUncertain": "hold"`, a held
|
|
238
|
+
decision that waits for you: `agent-events held list` shows them, and `agent-events held decide <decision-id> accept`
|
|
239
|
+
(or `reject`) settles one, at your terminal.
|
|
240
|
+
- A timeout, a malformed answer or a spent budget is no match. Retrying a delivery never asks the judge again.
|
|
241
|
+
|
|
242
|
+
**Budgets.** Each rule sets its own ceilings: calls per rolling hour, input tokens per rolling 30 days, concurrent
|
|
243
|
+
calls, and the most input and output tokens per call. The daemon-wide budget caps every rule, overall and per
|
|
244
|
+
provider, and a rule cannot raise it. A rule's new version inherits the charges of the versions before it, so a new
|
|
245
|
+
version never resets a budget. `judge test` runs at most ten times an hour per judge version, charged to the overall
|
|
246
|
+
budget.
|
|
247
|
+
|
|
248
|
+
**Turning a kind off.** `agent-events judge kind disable typesafe` takes effect at once: decisions waiting on its
|
|
249
|
+
judges, and the deliveries, dry-run records and stream entries bound to them, are cancelled and purged. Rules that
|
|
250
|
+
name its judges stay, but cannot call them; turning the kind back on needs a new approval. `disable-all` stops judges
|
|
251
|
+
along with everything else.
|
|
252
|
+
|
|
253
|
+
`doctor` shows each kind's state, the active budget version and its reservations, how many decisions are held and
|
|
254
|
+
when the next one expires, any hosted judge whose key is missing, and Laya as not available yet, all without content.
|
|
135
255
|
|
|
136
256
|
## For desktop and tool builders
|
|
137
257
|
|
|
@@ -139,8 +259,9 @@ The data-only control contract is
|
|
|
139
259
|
[`b3-control-v1.schema.json`](src/operations/contracts/b3-control-v1.schema.json). Its content-free
|
|
140
260
|
request, result and error vectors are in [`test/fixtures/b3-control-contract-v1`](test/fixtures/b3-control-contract-v1),
|
|
141
261
|
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)
|
|
262
|
+
It covers every B3 capability a desktop app may call, and never contains a secret value. Its frozen doctor result is
|
|
263
|
+
the closed [`doctor-v1.schema.json`](src/operations/contracts/doctor-v1.schema.json); the released daemon reports the
|
|
264
|
+
additive Phase-E [`doctor-v2.schema.json`](src/operations/contracts/doctor-v2.schema.json).
|
|
144
265
|
|
|
145
266
|
## Licence
|
|
146
267
|
|