@agenticprimitives/edge-runtime

中文文档
0.0.0-alpha.22发布于 2026/10/26MITTypeScriptES Module零依赖近 30 天下载 3356

Vendor-neutral edge ADMISSION layer: the EdgeAdapter interface, trusted-header hygiene, the GatewayAssertion verification port, and the admission pipeline (route resolution + size/depth/envelope + Stage-1 abuse limit). Owns admission only, never authority

原始使用文档
文档目录3 节
  1. What's in the box (W1)
  2. Not in the core
  3. License

@agenticprimitives/edge-runtime

Part of Agentic Primitives — the open-source trust substrate for agentic applications: identity that can sign, authority checked at act time, evidence the owner carries. Developer kit · All packages

The vendor-neutral edge admission layer. The edge is the only public surface; it admits or rejects requests cheaply, then forwards to the A2A/MCP origin behind a Service Binding. It owns admission only — it never owns authority (delegation, revocation, entitlement, KAS, signing, decryption all run behind the binding, never imported here — ADR-0043).

See spec 288 §4.

What's in the box (W1)

  • EdgeAdapter — the interface Cloudflare / Zuplo / API Shield implement. The admission protocol doesn't change when the gateway does.
  • Trusted-header hygiene — TRUSTED_HEADERS + sanitizeTrustedHeaders(headers, { authenticated }) strip internal headers (x-agent-subdomain, x-agentic-principal, …) from an unauthenticated caller so they can't be spoofed.
  • GatewayAssertion verification port — verifyGatewayAssertion(...) proves, issuer-agnostically, that a gateway admitted these exact bytes for this route. It proves admission only — never SA authorization (the native pipeline still does that). The signature check is injected, so the default issuer and a future Zuplo lane are the same code path.
  • Admission pipeline — runAdmission(req, opts): resolve route (from a surface-catalog) → sanitize headers → body-size / JSON-depth / envelope checks → Stage-1 abuse limit (an injected rate-control SoftRateLimiter, fail-soft) → correlation id.
import { runAdmission } from '@agenticprimitives/edge-runtime';

const result = await runAdmission(extractedRequest, {
  resolveRoute: (r) => registry.get(routeToId(r.path)),
  softLimiter,                       // from @agenticprimitives/rate-control (fail-soft)
  authenticated: false,              // direct public caller → strip trusted headers
});
if (!result.ok) return reject(result.status);   // single generic error; reason is internal-only
forwardToOrigin(result.descriptor, result.headers, result.correlationId);  // origin still validates authoritatively

Not in the core

  • The Cloudflare adapter (Worker rate-limiter binding, Service-Binding dispatch, cf-connecting-ip) and the deployed agentic-edge Worker — ship separately (spec 288 §5); the production edge is external (ADR-0037).
  • Any authority logic — forbidden imports; reached via Service Binding.

License

MIT

版本与发布记录

@agenticprimitives/edge-runtime 共发布 22 个版本,首次发布于 2026/07/01;过去 12 个月发布了 22 个版本。

版本发布日期距今
0.0.0-alpha.22latest2026/10/2612 天前
0.0.0-alpha.212026/10/1722 天前
0.0.0-alpha.202026/10/1622 天前
0.0.0-alpha.192026/10/1622 天前
0.0.0-alpha.182026/10/1622 天前
0.0.0-alpha.172026/10/1622 天前

关于 @agenticprimitives/edge-runtime 的常见问题

@agenticprimitives/edge-runtime 是什么?

Vendor-neutral edge ADMISSION layer: the EdgeAdapter interface, trusted-header hygiene, the GatewayAssertion verification port, and the admission pipeline (route resolution + size/depth/envelope + Stage-1 abuse limit). Owns admission only, never authority

如何安装 @agenticprimitives/edge-runtime?

在项目目录运行 npm install @agenticprimitives/edge-runtime,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@agenticprimitives/types(^1.0.0-alpha.45)、@agenticprimitives/rate-control(^0.0.0-alpha.5)、@agenticprimitives/surface-catalog(^0.0.0-alpha.5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@agenticprimitives/edge-runtime 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agenticprimitives/edge-runtime 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agenticprimitives/edge-runtime 可以商用吗?

@agenticprimitives/edge-runtime 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agenticprimitives/edge-runtime 的下载量有多少?

根据 npm 官方下载统计,@agenticprimitives/edge-runtime 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,356 次,日均约 112 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agenticprimitives/edge-runtime 还在维护吗?

最新版本 0.0.0-alpha.22 发布于 2026/10/26(12 天前);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2026/07/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。