@muretai/agent-entry 1.3.0 → 1.5.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/conformance/run.mjs +119 -0
- package/conformance/vectors.json +637 -0
- package/examples/server.mjs +24 -1
- package/muretai-agent-entry.mjs +517 -17
- package/package.json +3 -1
package/examples/server.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* **This is a usage SAMPLE, not part of core Muretai.** It adds nothing to the protocol:
|
|
6
6
|
* it only wires the public primitive `createAgentEntry()` from
|
|
7
|
-
* `
|
|
7
|
+
* `muretai-agent-entry.mjs` to a demo booking desk. Copy it, gut the responder,
|
|
8
8
|
* point it at your backend — core stays byte-unchanged.
|
|
9
9
|
*
|
|
10
10
|
* Run it:
|
|
@@ -33,6 +33,16 @@
|
|
|
33
33
|
* AGENT_ENTRY_NAME public display name on the card
|
|
34
34
|
* AGENT_ENTRY_HOST bind address (default 127.0.0.1 — set 0.0.0.0 only behind TLS)
|
|
35
35
|
* AGENT_ENTRY_ANON "1" also accepts UNSIGNED walk-in inquiries (they mint no account)
|
|
36
|
+
* AGENT_ENTRY_SIGNED_RATE / AGENT_ENTRY_SIGNED_RATE_TOTAL
|
|
37
|
+
* signed replies per minute per ACCOUNT and for the whole entry.
|
|
38
|
+
* Defaults are generous; LOWER THEM if your responder calls a model —
|
|
39
|
+
* the signature costs microseconds, the answer may not. 0 disables a tier.
|
|
40
|
+
* AGENT_ENTRY_GUEST "1" = GUEST MOUNT: coexist with a site that keeps its own front
|
|
41
|
+
* page. The entry serves its card paths and the POST door named by
|
|
42
|
+
* AGENT_ENTRY_BASE_URL (which must then carry that path, e.g.
|
|
43
|
+
* https://example.com/agent) and answers NOTHING at `/` — no notice,
|
|
44
|
+
* no OPTIONS, no POST. Point your proxy at the door path and the
|
|
45
|
+
* well-known paths; the site keeps everything else, unchanged.
|
|
36
46
|
* AGENT_ENTRY_WBA_JWKS OPTIONAL: a JWKS document {"keys":[…]} as one JSON string —
|
|
37
47
|
* the Web Bot Auth key directory (verified out of band) whose
|
|
38
48
|
* holders this entry should RECOGNISE on inbound requests. Off
|
|
@@ -137,6 +147,15 @@ try {
|
|
|
137
147
|
responder,
|
|
138
148
|
openDoor: true, // "you may contact me, no introduction"
|
|
139
149
|
anonymousLane: process.env.AGENT_ENTRY_ANON === '1',
|
|
150
|
+
// The SIGNED lane's ceilings. Left unset they are the library defaults, which no
|
|
151
|
+
// conversational peer meets. LOWER THEM if this responder calls a model: verifying a
|
|
152
|
+
// signature costs microseconds, and what the ceiling actually protects is whatever you
|
|
153
|
+
// put behind `responder`.
|
|
154
|
+
...(process.env.AGENT_ENTRY_SIGNED_RATE
|
|
155
|
+
? { signedRatePerMin: Number(process.env.AGENT_ENTRY_SIGNED_RATE) } : {}),
|
|
156
|
+
...(process.env.AGENT_ENTRY_SIGNED_RATE_TOTAL
|
|
157
|
+
? { signedRatePerMinTotal: Number(process.env.AGENT_ENTRY_SIGNED_RATE_TOTAL) } : {}),
|
|
158
|
+
guest: process.env.AGENT_ENTRY_GUEST === '1',
|
|
140
159
|
wbaVerifiers,
|
|
141
160
|
});
|
|
142
161
|
} catch (err) {
|
|
@@ -154,6 +173,10 @@ const server = entry.listen(port, host, () => {
|
|
|
154
173
|
}
|
|
155
174
|
console.log(` Listening on ${host}:${port} — POST a signed message/send to `
|
|
156
175
|
+ `${entry.mount || '/'}`);
|
|
176
|
+
if (process.env.AGENT_ENTRY_GUEST === '1') {
|
|
177
|
+
console.log(` Guest mount: the site keeps GET / — this entry answers the card at `
|
|
178
|
+
+ `${AGENT_CARD_PATH} (and under ${entry.mount}) and POST ${entry.mount} only`);
|
|
179
|
+
}
|
|
157
180
|
});
|
|
158
181
|
|
|
159
182
|
// The observation counters, surfaced the way the ledger is: on this runner's stdout,
|