Artifact Canonicalisation Utility (tasks/artifacts.py)

bernstein · src/bernstein/core/tasks/artifacts.py · python · Apache-2.0
infra, security, lang:python, tag:artifact, tag:canonicalisation, tag:validation

Defines artifact kinds, parses specifications, canonicalises artifact content, computes deterministic content hashes, and validates output paths for task artifacts. Reuse for any system needing content‑addressable, reproducible artifact handling.

# Source: https://github.com/sipyourdrink-ltd/bernstein | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Artifact contract: kinds, canonical serialisation, and typed criteria (#2608).

Slice 1 of the generalised task/artifact contract. A non-coding agent produces
a *report*, a *dataset*, an *action log*, or an *ops result* instead of a code
diff. Each such artifact needs a single, byte-stable canonical form so its
``content_hash`` is a deterministic content-addressed identity: two operators
with equal inputs must produce byte-identical bytes, hence the same hash, hence
the same signed lineage entry.

Every canonicaliser routes through one shared core (stable key ordering, fixed
U

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key