1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//! `uor-addr-1`'s public entry point — the ψ-pipeline content-address
//! inference.
//!
//! 1. The host runs the boundary [`crate::ops::canonicalize::jcs_nfc`]
//! transform on a raw JSON byte sequence to produce canonical-form
//! bytes.
//! 2. [`AddressModel`]'s `forward()` (from the foundation `PrismModel`
//! trait) invokes the ψ-chain verb
//! ([`crate::verbs::address_inference`]) end-to-end via foundation's
//! catamorphism. The catamorphism dispatches each resolver-bound
//! ψ-Term through [`crate::resolvers::AddressResolverTuple`].
//! 3. The terminal ψ_9 resolver
//! ([`crate::resolvers::AddressKInvariantResolver`]) structurally
//! κ-derives the 71-byte wire-format address from the typed
//! `JsonInput` via the canonical hash axis (one σ-projection —
//! deterministic, no enumeration). The κ-label IS the
//! `sha256:<64hex>` ASCII bytes.
//! 4. [`address`] returns the 71-byte address — well-formed
//! `JsonInput` always yields exactly one κ-label.
//!
//! Per wiki ADR-039 (verdict realisation), the address-derivation
//! verdict envelope is **total**: every well-formed `JsonInput`
//! produces an `Ok(AddressOutcome)` carrying the κ-label, because the
//! constraint nerve N(C) is non-empty for every input. There is no
//! `PipelineFailure::DidNotAdmit`-style admission filter at the host
//! boundary; the κ-label IS the address. The defensive
//! [`AddressFailure::PipelineFailure`] variant is reserved for
//! substrate-level shape violations that ADR-039 classifies as
//! impossibility certificates — unreachable in normal flow.
extern crate alloc;
use String;
use PrismModel;
use DefaultHostTypes;
use crate;
use cratejcs_nfc;
use crateAddressResolverTuple;
use crateAddrBounds;
use crateSha256Hasher;
/// The result of a successful [`address`] invocation.
///
/// Not `Clone` — the underlying foundation `Grounded<AddressLabel>` is
/// not `Clone`, so cloning the outcome would require either re-running
/// the pipeline (expensive) or losing the witness. Applications that
/// need to share the address out cheaply should extract `.address`
/// (a plain `String`, which is `Clone`) and drop the witness.
/// Newtype around a `Grounded<AddressLabel>` carrying the κ-label.
/// Sealed by foundation; constructible only through the model's
/// `forward()` (constraint TC-02). Inherits the `Grounded` non-`Clone`
/// property — the κ-label is content-addressed, so reuse goes through
/// the borrow `AddressOutcome::witness.grounded()` rather than a
/// shallow copy.
;
/// Failure modes from [`address`].
/// **uor-addr-1's public entry point** — one ψ-pipeline content-address
/// inference per JSON input.
///
/// 1. JCS+NFC canonicalises `input_bytes` at the host boundary.
/// 2. Constructs a typed [`JsonInput`].
/// 3. Invokes [`AddressModel`]'s `forward()` (from the foundation
/// `PrismModel` trait) which always produces a κ-label for
/// well-formed inputs.
/// 4. Returns the [`AddressOutcome`] carrying the κ-label.
///
/// # Errors
///
/// - [`AddressFailure::InvalidJson`] — `input_bytes` is not valid UTF-8 JSON.
/// - [`AddressFailure::TooLarge`] — canonical-form bytes exceed the
/// `JsonInput` cap.
/// - [`AddressFailure::PipelineFailure`] — defensive variant for
/// substrate-level shape violations; unreachable in normal flow.