Function: defineAstmProfile()
defineAstmProfile(
opts):AstmProfile
Build a frozen AstmProfile from a validated options object. Throws
AstmProfileDefinitionError on a bad name, an unknown option key, an
invalid transport, or an invalid tolerate entry - including the safety
rule: a profile may never tolerate a safety-critical warning code (default-deny
across all three registries).
extends composes profiles: lineage, tolerate, transport, provenance, and
description merge (parents left-to-right, then self; scalars are child-wins).
The merged tolerate set is re-validated so a safety-critical code cannot sneak
in via a hand-crafted parent.
Parameters
opts
The profile definition; see DefineAstmProfileOptions.
Returns
A frozen, immutable profile with describe() attached.
Throws
AstmProfileDefinitionError on any invalid definition.
Example
import { defineAstmProfile } from "@cosyte/astm";
const site = defineAstmProfile({
name: "acme-analyzer",
description: "Acme's inbound raw-TCP analyzer",
transport: "raw",
tolerate: [
{ code: "ASTM_RECORD_UNKNOWN_TYPE", rationale: "emits a vendor QC record letter" },
],
provenance: { source: "Acme host-interface manual", reference: "internal-2026" },
});
site.lineage; // ["acme-analyzer"]
console.log(site.describe?.());