@siere.ai/core
v0.4.0
Published
Shared core for AEO middleware — agent detection, transform, analytics, licensing
Maintainers
Readme
@siere.ai/core
Core building blocks for Siere AI agent detection, content transformation, analytics, health checks, and licensing.
npm install @siere.ai/coreSee Siere documentation for integration guidance.
Agent response caching
Transformed Markdown responses default to Cache-Control: private, no-store
and Vary: User-Agent, Accept. Custom Vary values are preserved and
normalized with those required fields. A custom Cache-Control header cannot
weaken this default unless unsafePublicAgentCaching: true is set explicitly.
That advanced escape hatch is only for deployments whose shared-cache key has
been verified to separate every agent representation by both User-Agent and
Accept; the internal Hermes transformation cache remains available without it.
Detection contract
detectAgent() always returns a typed result. A User-Agent match is classified
as unverified; it is not proof of the crawler's identity.
The canonical classification is purpose (search-index, user-retrieval,
model-training, other, or unknown). The legacy type projection remains
available for the 0.x compatibility cycle. Every result also exposes the
registry version and evidence level used for the classification.
import { detectAgent } from "@siere.ai/core";
const detection = detectAgent(request.headers.get("user-agent") ?? "");
if (detection.matchedAgent) {
console.log(detection.detectionMethod, detection.verificationStatus);
}Delivery decision contract
decideDeliveryAction() is the framework-neutral authority for whether a
request passes through to the origin or receives Markdown. It returns a typed
action, reason, strategy, purpose, evidence level, detection method, and
verification status so adapters can expose the decision without retaining raw
request headers.
import { decideDeliveryAction, detectAgent } from "@siere.ai/core";
const detection = detectAgent(request.headers.get("user-agent") ?? "");
const decision = decideDeliveryAction({
strategy: "observe",
detection,
acceptHeader: request.headers.get("accept"),
});The strategies are:
observe: always pass through while recording the classified request.negotiate-markdown: serve Markdown only whenAcceptnegotiates it.recognized-agent-markdown: serve recognized User-Agent or negotiated requests; this remains the omitted-config default for existing integrations.verified-agent-markdown: reserved for a future verified-identity provider; unverified requests currently pass through.
Missing, stale, unknown, transform-error, fidelity-drifted, and
fidelity-unverifiable content always fails open to the origin. Adapter response
headers and /__aeo/health expose the active strategy, and
onDeliveryDecision can receive the typed decision for structured logging.
