
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@peac/disc
Advanced tools
Thin loader / validator and remote fetcher for peac.txt policy documents (peac-policy/0.1; docs/specs/PEAC-TXT.md)
Thin loader / validator and remote fetcher for peac.txt policy documents.
pnpm add @peac/disc
@peac/disc is a thin wrapper around
@peac/policy-kit specialized for the peac.txt
discovery surface. It:
/.well-known/peac.txt with discover(origin),peac-policy/0.1 YAML / JSON bytes to
@peac/policy-kit.parsePolicyDocument,ParseResult (rather than throwing) that carries a
validated PolicyDocument, error messages, and advisory warnings,verify:, public_keys:, jwks:)
in older example documents by stripping them before validation and
surfacing a structured PEAC_LEGACY_PEAC_TXT_KEY_FIELD
DeprecationWarning.peac.txt is the policy-document surface per
docs/specs/PEAC-TXT.md. It is not a key discovery surface.
Cryptographic key resolution uses the normative chain
iss -> /.well-known/peac-issuer.json -> jwks_uri -> JWKS (see
docs/specs/PEAC-ISSUER.md). For that flow, use parseIssuerConfig /
fetchIssuerConfig from @peac/protocol.
import { parse } from '@peac/disc';
const result = parse(`
version: 'peac-policy/0.1'
defaults:
decision: deny
rules:
- name: allow-verified-agents
subject:
type: agent
labels: [verified]
purpose: inference
decision: allow
`);
if (result.valid) {
console.log(result.data?.version); // 'peac-policy/0.1'
console.log(result.data?.rules[0].decision); // 'allow'
}
if (result.warnings) {
// e.g. legacy key-discovery lines were stripped on parse
console.warn(result.warnings);
}
import { emit } from '@peac/disc';
import { createExamplePolicy } from '@peac/policy-kit';
const yaml = emit(createExamplePolicy());
// Serve at /.well-known/peac.txt
import { discover, WELL_KNOWN_PATH } from '@peac/disc';
const result = await discover('https://example.com');
if (result.valid) {
console.log(result.data);
}
console.log(WELL_KNOWN_PATH); // '/.well-known/peac.txt'
The caller's user-agent is taken from the PEAC_USER_AGENT environment
variable when present; otherwise peac-disc is used. @peac/disc does
not hard-code a package version in the user-agent (runtime-visible
version constants belong in release tooling).
Per docs/specs/PEAC-TXT.md §6.1, remote documents larger than
256 KiB are rejected by discover(). Nesting depth, array length,
and string length limits are enforced by the underlying
@peac/policy-kit validator.
@peac/policy-kit: canonical compiler / parser / evaluator for
peac-policy/0.1 documents. @peac/disc.parse delegates to
@peac/policy-kit.parsePolicyDocument.@peac/protocol: parseIssuerConfig / fetchIssuerConfig for the
normative key-discovery chain.Apache-2.0
PEAC Protocol is an open source project stewarded by Originary and community contributors.
FAQs
Thin loader / validator and remote fetcher for peac.txt policy documents (peac-policy/0.1; docs/specs/PEAC-TXT.md)
We found that @peac/disc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.