behavior-contracts 0.2.5

Language-neutral IR runtime core (expression evaluation, template rendering, execution plan, canonical serialization) shared across DSL implementations. Passes the dsl-contracts conformance vectors byte-for-byte.
Documentation
//! behavior-contracts — language-neutral IR runtime COMMON core (Rust).
//!
//! Ports the same thin COMMON primitives as the TS/Python references. No backend,
//! key-resolution, retry-tuning, or DSL-specific concepts — those live in consumers.
//!
//! Public COMMON primitives (runtime-boundary.md §2.1):
//!   - [`validate_envelope`] — spec-version fail-closed check
//!   - [`evaluate_expression`] — expression-ir.md normative evaluation
//!   - [`render_template`] — `{param}` strict rendering
//!   - [`run_plan`] — execution-plan skeleton (stage / Skip propagation / Policy Kind)
//!   - [`canonical_value`] / [`canonical_json`] / [`py_float_repr`] — canonical serialization
//!   - [`assert_portable`] — Portability Guard
//!   - [`decode_value`] / [`deep_equals`] — conformance runner adapter COMMON part

pub mod behavior;
pub mod canonical;
pub mod codec;
pub mod envelope;
pub mod expr;
pub mod fingerprint;
pub mod guard;
pub mod plan;
pub mod primitives;
pub mod template;
pub mod value;

/// Supported spec versions (IR/vector versions; distinct from the crate semver).
pub struct SpecVersions;
impl SpecVersions {
    pub const EXPRESSION: i64 = 2; // v2: obj __proto__ own key -> FORBIDDEN_KEY (fail-closed)
    pub const TEMPLATE: i64 = 1;
    pub const PLAN: i64 = 1;
    pub const CANONICAL: i64 = 2; // v2: obj value __proto__ own key -> FORBIDDEN_KEY (fail-closed)
    pub const BEHAVIOR: i64 = 2; // v2: map.when / map.into / map.batched / handler ctx (bc#22; v1 IR semantics unchanged)
    pub const GUARD: i64 = 1; // v1 (bc#25: vector-pin assert_portable_component_graph accept/reject)
    pub const C2: i64 = 1; // v1 (bc#28: c2-catalog-swap — catalog-swap execution + IR structural identity)
}

/// Default graphddb-shaped supported envelope version (`"<major>.<minor>"`).
pub const ENVELOPE_SPEC_VERSION: &str = "1.1";

// ── re-exports (public surface) ──────────────────────────────────────────────
pub use value::{deep_equals, Value};

pub use expr::{cmp_code_points, evaluate as evaluate_expression, ExprFailure, ExprFailureCode};

pub use template::{render_template, resolve_partial, TemplateFailure, TemplateFailureCode};

pub use plan::{
    run_plan, run_plan_parallel, ExecOutcome, ExecutionPlanSpec, OpSpec, PlanFailure,
    PlanFailureCode, PolicyKind, RelationKind, RunResult,
};

pub use canonical::{
    canonical_json, canonical_value, py_float_repr, CanonicalFailure, CanonicalFailureCode,
};

pub use envelope::{validate_envelope, EnvelopeFailure, EnvelopeFailureCode};

pub use guard::{
    assert_portable, assert_portable_component_graph, PortabilityError, PORTABLE_EXPR_OPERATORS,
};

pub use behavior::{run_behavior, BehaviorError, BehaviorFailureCode, ComponentExec};

pub use fingerprint::{fingerprint_component_graph, FingerprintFailure, FingerprintFailureCode};

pub use codec::{decode_value, encode_value, DecodeError};

// ── codegen primitive surface (bc#36 / typed-codegen.md §3.4) ─────────────────
// 生成コードが直呼びできる安定 primitive 公開面。式演算子は `primitives` モジュールで
// 個別関数として公開する(意味論は SSoT `evaluate_expression` へ委譲する薄いラッパ)。
// bounded 並行 / skip・unproduced / hydration helper も同モジュールに含める。
pub use primitives::{
    concat_native, hydrate_into, map_with_concurrency, ref_native, ref_opt_native, skip_connection,
    skip_single, unproduced_value,
};