agentrail-edge 0.5.1 → 0.6.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 CHANGED
@@ -22,6 +22,13 @@ A request from a CLI that uses
22
22
  which command an agent ran, in which run and session. The edge records it
23
23
  on the request's step, with the session as a keyed hash in place of the
24
24
  visit cookie a CLI never sends back, and passes the header on to your origin.
25
+ Its `mid`, the CLI's machine id, goes on the step too, for Actor Trust.
26
+
27
+ A request carrying an Agentrail Self-Test token (the `x-agentrail-self-test`
28
+ header, or the `agentrail_self_test` or `agentrail_test` query parameter)
29
+ is recorded as the test run's. The request reaches your origin as it came,
30
+ the token, the page's `agentrail_at` actor-token cookie and the CLI header
31
+ with it, for your server's Actor Trust checkpoint to read.
25
32
 
26
33
  ## Install
27
34
 
package/dist/edge.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CLI_HEADER, createCollector, readCliHeader, TRACE_HANDOFF_HEADER, signTraceHandoff, traceHandoffTarget, createSignatureVerifier, formatTraceparent, hashKeyIdOf, keyedHash, newSessionId, newSpanId, newTraceId, parseMarker, parseTraceparent, sessionCookie, VERSION, } from 'agentrail-core';
1
+ import { CLI_HEADER, createCollector, readCliHeader, SELF_TEST_HEADER, selfTestTokenOf, TRACE_HANDOFF_HEADER, signTraceHandoff, traceHandoffTarget, createSignatureVerifier, formatTraceparent, hashKeyIdOf, keyedHash, newSessionId, newSpanId, newTraceId, parseMarker, parseTraceparent, sessionCookie, VERSION, } from 'agentrail-core';
2
2
  import { MARKER_PARAMETER, markLinks } from './links.js';
3
3
  /**
4
4
  * The edge adapter: in front of a customer's site, on the Fetch API, it
@@ -18,7 +18,13 @@ import { MARKER_PARAMETER, markLinks } from './links.js';
18
18
  * classifier of who the caller is: the `Accept`, the caller's header names
19
19
  * and `Accept-Encoding`, and fetch metadata, the
20
20
  * platform's word on the network and its verified bots, and a Web Bot
21
- * Auth signature checked against the keys the agent publishes.
21
+ * Auth signature checked against the keys the agent publishes;
22
+ * - for Actor Trust, an Agentrail Self-Test run's token, from the
23
+ * `x-agentrail-self-test` header or the `agentrail_self_test` (or
24
+ * `agentrail_test`) query parameter, and a CLI's machine id from its
25
+ * `x-agentrail-cli` header. The request reaches the origin unchanged,
26
+ * its `agentrail_at` cookie and CLI header with it, for the server SDK's
27
+ * checkpoint to read.
22
28
  *
23
29
  * The events go to the collector after the answer, through the platform's
24
30
  * `waitUntil`, so recording never slows a request. Requests one edge answers
@@ -317,6 +323,9 @@ export function createEdge(options) {
317
323
  agentVersion: header.agentVersion ?? null,
318
324
  evidence: header.evidence ?? [],
319
325
  sdkVersion: header.sdkVersion,
326
+ ...(header.machineId === undefined
327
+ ? {}
328
+ : { machineId: header.machineId }),
320
329
  },
321
330
  session: `cli:${hash}:${String(Math.floor(start / DAY_MS))}`,
322
331
  };
@@ -331,6 +340,8 @@ export function createEdge(options) {
331
340
  const actingUserId = principal?.actingUserId ?? null;
332
341
  const signature = await verify(request);
333
342
  const cli = await cliOf(request, input.start);
343
+ // A Self-Test run's token, as the request carried it: never an empty one.
344
+ const selfTestToken = selfTestTokenOf(url, request.headers.get(SELF_TEST_HEADER));
334
345
  const { signals } = input;
335
346
  return {
336
347
  schemaVersion: 1,
@@ -411,6 +422,7 @@ export function createEdge(options) {
411
422
  },
412
423
  registration: null,
413
424
  ...(cli === null ? {} : { cli: cli.facts }),
425
+ ...(selfTestToken === undefined ? {} : { selfTestToken }),
414
426
  markers: {
415
427
  served: observed.served === null
416
428
  ? []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentrail-edge",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "The Agentrail edge: in front of a site on Cloudflare Workers, Vercel or any Fetch API runtime, it records each request and marks the links agents follow.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "node": ">=22"
26
26
  },
27
27
  "dependencies": {
28
- "agentrail-core": "0.5.1"
28
+ "agentrail-core": "0.6.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "24.13.3",