agent-customs 1.2.5 → 1.2.6
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 +8 -6
- package/package.json +1 -1
- package/site/customs/inspect.js +18 -18
- package/site/customs/protocols.js +4 -0
- package/tools/mcp-server.mjs +1 -1
package/README.md
CHANGED
|
@@ -62,8 +62,8 @@ Pick one of four ways. Each works with any site made with Cognizant's `agentify-
|
|
|
62
62
|
|
|
63
63
|
```html
|
|
64
64
|
<script type="module"
|
|
65
|
-
src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.
|
|
66
|
-
integrity="sha384-
|
|
65
|
+
src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.6/dist/agent-customs.js"
|
|
66
|
+
integrity="sha384-WMl/1x9IOgwlSJuAl5nKo4CtY/x421qU9tkM8wWXyzImP1odffmefCeSm3lfLZgj"
|
|
67
67
|
crossorigin="anonymous"></script>
|
|
68
68
|
```
|
|
69
69
|
|
|
@@ -76,7 +76,7 @@ Pick one of four ways. Each works with any site made with Cognizant's `agentify-
|
|
|
76
76
|
```js
|
|
77
77
|
// At the top of site.js
|
|
78
78
|
import { installCustomsGuard }
|
|
79
|
-
from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.
|
|
79
|
+
from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.6/site/customs/guard.js";
|
|
80
80
|
|
|
81
81
|
// Right after boot()
|
|
82
82
|
installCustomsGuard(booted.engine, { strict: true });
|
|
@@ -173,16 +173,16 @@ Each way to add the guard, step by step. All of them work with any site built wi
|
|
|
173
173
|
**1. One line (easiest).** Paste this into your page, above your other `<script>` tags. The guard switches itself on when your assistant starts.
|
|
174
174
|
|
|
175
175
|
```html
|
|
176
|
-
<script type="module" src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.
|
|
176
|
+
<script type="module" src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.6/dist/agent-customs.js" integrity="sha384-WMl/1x9IOgwlSJuAl5nKo4CtY/x421qU9tkM8wWXyzImP1odffmefCeSm3lfLZgj" crossorigin="anonymous"></script>
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
`integrity` is the file's fingerprint. If the file were ever changed, on the CDN or on the way, the browser would refuse to run it. The whole guard is in this one file ([`dist/agent-customs.js`](dist/agent-customs.js), built by `npm run bundle`), so the fingerprint covers all of it. `@v1.2.
|
|
179
|
+
`integrity` is the file's fingerprint. If the file were ever changed, on the CDN or on the way, the browser would refuse to run it. The whole guard is in this one file ([`dist/agent-customs.js`](dist/agent-customs.js), built by `npm run bundle`), so the fingerprint covers all of it. `@v1.2.6` is a fixed version; to update, take the new line from the next release. Above the other tags, the browser runs it before your page starts the assistant, and chats wait until the guard is on. If your page has a `Content-Security-Policy` with `script-src`, add `https://cdn.jsdelivr.net` to it.
|
|
180
180
|
|
|
181
181
|
**2. Two lines, with your own settings.** Load the guard from the same release and pass any of the *Guard options* below. A browser cannot check a fingerprint on an `import`, so for that use option 3 or 4.
|
|
182
182
|
|
|
183
183
|
```js
|
|
184
184
|
// At the top of site.js
|
|
185
|
-
import { installCustomsGuard } from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.
|
|
185
|
+
import { installCustomsGuard } from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v1.2.6/site/customs/guard.js";
|
|
186
186
|
|
|
187
187
|
// Right after the boot(...) call
|
|
188
188
|
installCustomsGuard(booted.engine, { strict: true });
|
|
@@ -601,6 +601,8 @@ This round fixed a weakness in how the rules handled their own exceptions, and i
|
|
|
601
601
|
- Two more languages. Dutch and Indonesian requests for passwords and card numbers are now read word by word. Takeover, chat-leak and "download and run" orders are caught in 14 languages.
|
|
602
602
|
- Honest numbers. False alarms on tools never seen before dropped from about 1 in 10 to about 1 in 18. New attack sets written after the changes were measured once before they were used. The details are in [How well it works](#how-well-it-works) and the [paper](PAPER.md#5--results).
|
|
603
603
|
|
|
604
|
+
**The terminal command gets its own window, and failed checks name their protocol (1.2.6).** When a site answers but the browser can't read it, the report now shows the command in a small terminal window with a *Copy* button, under the message instead of inside it. Paste it into PowerShell on Windows or Terminal on a Mac (it needs Node.js). In the report's JSON, the command is `verdict.command`. A failed check on an A2A Agent Card or an MCP file now shows *Google A2A* or *MCP Catalog* as its protocol, not *Open Agentic Web*, and an address where nothing was found shows no protocol.
|
|
605
|
+
|
|
604
606
|
**"Could not inspect" now says why, and the command line runs everywhere (1.2.5).** When the page could not read an address, it listed three possible reasons. It now finds the real one and says what to do:
|
|
605
607
|
- The site answered, but it sends no CORS header, so the browser kept the answer from the page. The message gives the command that checks it from a terminal instead: `npx -y agent-customs check <address>`.
|
|
606
608
|
- The address is a live MCP server (it ends in `/mcp` or `/sse`), which only MCP apps can talk to. The message asks for the server's `server.json`, which Agent Customs can read.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-customs",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Border control for the Open Agentic Web: inspect any agent network before it runs in your browser.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Monty Bagati (https://github.com/montbaga)",
|
package/site/customs/inspect.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { parseHocon } from "../runtime/hocon.js";
|
|
9
9
|
import { AgentNetwork, validateNetwork } from "../runtime/kernel.js";
|
|
10
10
|
import { VERDICTS, analyzeNetwork, escalateReport } from "./analyze.js";
|
|
11
|
-
import { detectProtocol, foreignDiscoveryCandidates, normalizeForeignSpec } from "./protocols.js";
|
|
11
|
+
import { detectProtocol, foreignDiscoveryCandidates, normalizeForeignSpec, protocolFromUrl } from "./protocols.js";
|
|
12
12
|
|
|
13
13
|
const DEFAULT_TIMEOUT_MS = 15000;
|
|
14
14
|
const MAX_BYTES = 2 * 1024 * 1024;
|
|
@@ -128,12 +128,10 @@ async function unreadableReason(error, input, { fetchImpl, timeoutMs, agenticSit
|
|
|
128
128
|
return { summary: `Nothing answered at ${host}. Check the address for typos, or try again later if the site is down.`, title: "The site answers", detail: `Nothing answered at ${error.url}.`, fix: "" };
|
|
129
129
|
}
|
|
130
130
|
return {
|
|
131
|
-
summary:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
`To check it anyway, run this in a terminal: npx -y agent-customs check ${commandAddress(input)}`,
|
|
136
|
-
].join(" "),
|
|
131
|
+
summary: agenticSite
|
|
132
|
+
? `${host} answered, but it doesn't let web pages read its files (it sends no CORS header), so your browser can't tell whether it publishes any agents. Most websites have none yet. If it does, agents on other websites can't call them either, because they run in their visitors' browsers too (spec sections 3.3 and 3.4).`
|
|
133
|
+
: `${host} answered, but it doesn't let web pages read this address (it sends no CORS header), so your browser kept the answer from this page.`,
|
|
134
|
+
command: `npx -y agent-customs check ${commandAddress(input)}`,
|
|
137
135
|
title: "Public files readable by other sites (CORS)",
|
|
138
136
|
detail: `${error.url} answered without an Access-Control-Allow-Origin header.`,
|
|
139
137
|
fix: agenticSite
|
|
@@ -232,7 +230,7 @@ export async function inspectNetworkUrl(input, options = {}) {
|
|
|
232
230
|
if (strictForeign) {
|
|
233
231
|
const reason = await unreadableReason(error, input, { fetchImpl, timeoutMs, agenticSite: false });
|
|
234
232
|
const rep = failureReport(directUrl, "P-CORS", "Discovery", reason.title, reason.detail, reason.fix);
|
|
235
|
-
rep.verdict = { ...VERDICTS.UNREADABLE, summary: reason.summary };
|
|
233
|
+
rep.verdict = { ...VERDICTS.UNREADABLE, summary: reason.summary, command: reason.command };
|
|
236
234
|
return rep;
|
|
237
235
|
}
|
|
238
236
|
lastError = error.message;
|
|
@@ -290,24 +288,26 @@ export async function inspectNetworkUrl(input, options = {}) {
|
|
|
290
288
|
const report = failureReport(String(input), "P-MANIFEST-FOUND", "3.2, 3.3", "agent-manifest.json is published", lastError || "No manifest found.",
|
|
291
289
|
"Publish agent-manifest.json in the folder of the network URL, with Access-Control-Allow-Origin: *.");
|
|
292
290
|
if (isLiveMcpAddress(input)) {
|
|
291
|
+
report.protocol = "mcp";
|
|
293
292
|
report.verdict = { ...VERDICTS.UNREADABLE, summary: "This is the address of a live MCP server, which only MCP apps can talk to. Agent Customs reads the files a server publishes: paste the address of its server.json instead. Publishers usually keep it in their GitHub repository, such as https://raw.githubusercontent.com/github/github-mcp-server/main/server.json." };
|
|
294
293
|
report.conformance.checks[0] = { id: unreachable ? "P-CORS" : "P-MANIFEST-FOUND", section: "Discovery", title: "A published file to inspect", status: "fail",
|
|
295
294
|
detail: lastError, fix: "Paste the address of the server's server.json or mcp.json." };
|
|
296
295
|
} else if (unreachable) {
|
|
297
296
|
const reason = await unreadableReason(unreadError, input, { fetchImpl, timeoutMs, agenticSite: true });
|
|
298
|
-
report.verdict = { ...VERDICTS.UNREADABLE, summary: reason.summary };
|
|
297
|
+
report.verdict = { ...VERDICTS.UNREADABLE, summary: reason.summary, command: reason.command };
|
|
299
298
|
report.conformance.checks[0] = { id: "P-CORS", section: "3.3, 3.4", title: reason.title, status: "fail", detail: reason.detail, fix: reason.fix };
|
|
300
299
|
}
|
|
301
300
|
return report;
|
|
302
301
|
}
|
|
303
302
|
const { manifest } = manifestInfo;
|
|
303
|
+
const failed = (...args) => ({ ...failureReport(...args), protocol: "open-agentic-web" });
|
|
304
304
|
const networks = Array.isArray(manifest.networks) ? manifest.networks : [];
|
|
305
305
|
let name = chosen.name;
|
|
306
306
|
if (!name) {
|
|
307
307
|
if (networks.length === 1 && networks[0]?.name) name = networks[0].name;
|
|
308
308
|
else {
|
|
309
309
|
const names = networks.map((n) => n?.name).filter(Boolean);
|
|
310
|
-
return
|
|
310
|
+
return failed(`${chosen.base}/`, "P-PICK", "3.2", "One network chosen",
|
|
311
311
|
names.length ? `This site publishes ${names.length} networks. Inspect one of: ${names.map((n) => `${chosen.base}/${n}`).join(", ")}` : "The manifest lists no networks.",
|
|
312
312
|
"Use a network URL: the folder that holds agent-manifest.json, then the network name.", { choices: names.map((n) => `${chosen.base}/${n}`) });
|
|
313
313
|
}
|
|
@@ -315,22 +315,22 @@ export async function inspectNetworkUrl(input, options = {}) {
|
|
|
315
315
|
const networkUrl = `${chosen.base}/${name}`;
|
|
316
316
|
const entry = networks.find((n) => n && n.name === name);
|
|
317
317
|
if (!entry) {
|
|
318
|
-
return
|
|
318
|
+
return failed(networkUrl, "P-EXACT", "3.2", "The manifest publishes this exact network",
|
|
319
319
|
`No network named "${name}" at ${hostOf(networkUrl)}. A runtime must fail rather than run another one. Published: ${networks.map((n) => n?.name).filter(Boolean).join(", ") || "none"}.`,
|
|
320
320
|
"Check the network name: it is the last part of the URL and must match networks[].name exactly.");
|
|
321
321
|
}
|
|
322
322
|
if (typeof entry.hocon !== "string" || !entry.hocon) {
|
|
323
|
-
return
|
|
323
|
+
return failed(networkUrl, "P-HOCON", "3.3", "The manifest says where the network file is", "The entry has no hocon path.", "Add \"hocon\": \"./<network>.network.json\".");
|
|
324
324
|
}
|
|
325
325
|
const hoconUrl = resolveUrl(chosen.base, entry.hocon);
|
|
326
326
|
let file;
|
|
327
327
|
try {
|
|
328
328
|
file = await fetchPublic(hoconUrl, fetchImpl, timeoutMs);
|
|
329
329
|
} catch (error) {
|
|
330
|
-
return
|
|
330
|
+
return failed(networkUrl, "P-NETWORK-FOUND", "3.3", "The network file is published", error.message, "Publish the file the manifest names, with CORS.");
|
|
331
331
|
}
|
|
332
332
|
if (!file.ok) {
|
|
333
|
-
return
|
|
333
|
+
return failed(networkUrl, "P-NETWORK-FOUND", "3.3", "The network file is published", `${hoconUrl} answered HTTP ${file.status}.`, "Publish the file the manifest names.");
|
|
334
334
|
}
|
|
335
335
|
if (file.redirected) redirects.push({ from: hoconUrl, to: file.finalUrl, crossOrigin: originOf(file.finalUrl) !== originOf(hoconUrl) });
|
|
336
336
|
|
|
@@ -338,10 +338,10 @@ export async function inspectNetworkUrl(input, options = {}) {
|
|
|
338
338
|
try {
|
|
339
339
|
config = parseHocon(file.text);
|
|
340
340
|
} catch (error) {
|
|
341
|
-
return
|
|
341
|
+
return failed(networkUrl, "P-PARSE", "2, 2.2", "The network file parses", `${hoconUrl}: ${error.message}`, "Publish resolved JSON (or the runtime's HOCON subset) with no includes or substitutions.");
|
|
342
342
|
}
|
|
343
343
|
if (!config || typeof config !== "object" || !Array.isArray(config.tools)) {
|
|
344
|
-
return
|
|
344
|
+
return failed(networkUrl, "P-PARSE", "2.1", "The network file has a tools list", "No top-level tools array.", "Put the agents in a top-level \"tools\" array.");
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
// links.json, merged the way the runtime merges it.
|
|
@@ -367,7 +367,7 @@ export async function inspectNetworkUrl(input, options = {}) {
|
|
|
367
367
|
validation = validateNetwork(network);
|
|
368
368
|
try { frontMan = network.findFrontMan(); } catch { frontMan = null; }
|
|
369
369
|
} catch (error) {
|
|
370
|
-
return
|
|
370
|
+
return failed(networkUrl, "P-VALID", "3.1", "Network passes the runtime's validator", error.message, "Fix the network structure.");
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
const cors = !pageOrigin ? "unchecked" : originOf(networkUrl) === pageOrigin ? "same-origin" : "ok";
|
|
@@ -486,7 +486,7 @@ function failureReport(url, id, section, title, detail, fix = "", extra = {}) {
|
|
|
486
486
|
counts: { critical: 0, high: 0, medium: 0, low: 0, info: 0 },
|
|
487
487
|
conformance: { passed: 0, warned: 0, failed: 1, total: 1, score: 0, checks: [{ id, section, title, status: "fail", detail, fix }] },
|
|
488
488
|
findings: [], itinerary: [], privacy: [], budget: {}, drift: null, conditions: [], snapshot: null,
|
|
489
|
-
failure: true, ...extra,
|
|
489
|
+
protocol: protocolFromUrl(url), failure: true, ...extra,
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
492
|
|
|
@@ -46,6 +46,10 @@ export function detectProtocol(doc, url = "") {
|
|
|
46
46
|
if (doc.serverInfo || Array.isArray(doc.prompts) || Array.isArray(doc.resources) || Array.isArray(doc.result?.prompts)) {
|
|
47
47
|
return "mcp";
|
|
48
48
|
}
|
|
49
|
+
return protocolFromUrl(url);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function protocolFromUrl(url = "") {
|
|
49
53
|
if (/(?:\/\.well-known\/agent(?:-card)?\.json|\/agent(?:-card)?\.json)$/i.test(url)) return "a2a";
|
|
50
54
|
if (/(?:\/\.well-known\/mcp\.json|\/mcp\.json|\/tools\/list)$/i.test(url)) return "mcp";
|
|
51
55
|
return null;
|
package/tools/mcp-server.mjs
CHANGED
|
@@ -166,7 +166,7 @@ function resolveKnownSample(raw) {
|
|
|
166
166
|
|
|
167
167
|
function buildInstallSnippets() {
|
|
168
168
|
return {
|
|
169
|
-
oneLineScript: `<script type="module" src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v${PKG_VERSION}/dist/agent-customs.js" integrity="sha384-
|
|
169
|
+
oneLineScript: `<script type="module" src="https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v${PKG_VERSION}/dist/agent-customs.js" integrity="sha384-WMl/1x9IOgwlSJuAl5nKo4CtY/x421qU9tkM8wWXyzImP1odffmefCeSm3lfLZgj" crossorigin="anonymous"></script>`,
|
|
170
170
|
twoLines: `import { installCustomsGuard } from "https://cdn.jsdelivr.net/gh/montbaga/agent-customs@v${PKG_VERSION}/site/customs/guard.js";\ninstallCustomsGuard(booted.engine, { strict: true });`,
|
|
171
171
|
npm: `npm install agent-customs\nimport { installCustomsGuard } from "agent-customs";\ninstallCustomsGuard(booted.engine);`,
|
|
172
172
|
cli: `npx agent-customs check https://your-site.example/\nnpx agent-customs check ./my-network --strict\nnpx agent-customs mcp`,
|