@cotal-ai/core 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acls.d.ts +31 -7
- package/dist/acls.d.ts.map +1 -1
- package/dist/acls.js +105 -17
- package/dist/acls.js.map +1 -1
- package/dist/agent-file.js +1 -1
- package/dist/agent-file.js.map +1 -1
- package/dist/auth-provider.d.ts +8 -0
- package/dist/auth-provider.d.ts.map +1 -1
- package/dist/auth-provider.js.map +1 -1
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +6 -4
- package/dist/backup.js.map +1 -1
- package/dist/broker-floor.d.ts +34 -0
- package/dist/broker-floor.d.ts.map +1 -0
- package/dist/broker-floor.js +39 -0
- package/dist/broker-floor.js.map +1 -0
- package/dist/canonical.d.ts +24 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +159 -0
- package/dist/canonical.js.map +1 -0
- package/dist/connector.d.ts +4 -0
- package/dist/connector.d.ts.map +1 -1
- package/dist/endpoint-action.d.ts +424 -0
- package/dist/endpoint-action.d.ts.map +1 -0
- package/dist/endpoint-action.js +910 -0
- package/dist/endpoint-action.js.map +1 -0
- package/dist/endpoint-binding.d.ts +344 -0
- package/dist/endpoint-binding.d.ts.map +1 -0
- package/dist/endpoint-binding.js +753 -0
- package/dist/endpoint-binding.js.map +1 -0
- package/dist/endpoint-checkpoint.d.ts +292 -0
- package/dist/endpoint-checkpoint.d.ts.map +1 -0
- package/dist/endpoint-checkpoint.js +818 -0
- package/dist/endpoint-checkpoint.js.map +1 -0
- package/dist/endpoint-cluster.d.ts +95 -0
- package/dist/endpoint-cluster.d.ts.map +1 -0
- package/dist/endpoint-cluster.js +194 -0
- package/dist/endpoint-cluster.js.map +1 -0
- package/dist/endpoint-contract-store.d.ts +90 -0
- package/dist/endpoint-contract-store.d.ts.map +1 -0
- package/dist/endpoint-contract-store.js +348 -0
- package/dist/endpoint-contract-store.js.map +1 -0
- package/dist/endpoint-envelope.d.ts +165 -0
- package/dist/endpoint-envelope.d.ts.map +1 -0
- package/dist/endpoint-envelope.js +346 -0
- package/dist/endpoint-envelope.js.map +1 -0
- package/dist/endpoint-grants.d.ts +123 -0
- package/dist/endpoint-grants.d.ts.map +1 -0
- package/dist/endpoint-grants.js +215 -0
- package/dist/endpoint-grants.js.map +1 -0
- package/dist/endpoint-guard.d.ts +222 -0
- package/dist/endpoint-guard.d.ts.map +1 -0
- package/dist/endpoint-guard.js +468 -0
- package/dist/endpoint-guard.js.map +1 -0
- package/dist/endpoint-handle.d.ts +176 -0
- package/dist/endpoint-handle.d.ts.map +1 -0
- package/dist/endpoint-handle.js +608 -0
- package/dist/endpoint-handle.js.map +1 -0
- package/dist/endpoint-journal.d.ts +225 -0
- package/dist/endpoint-journal.d.ts.map +1 -0
- package/dist/endpoint-journal.js +431 -0
- package/dist/endpoint-journal.js.map +1 -0
- package/dist/endpoint-receipt.d.ts +225 -0
- package/dist/endpoint-receipt.d.ts.map +1 -0
- package/dist/endpoint-receipt.js +417 -0
- package/dist/endpoint-receipt.js.map +1 -0
- package/dist/endpoint-records.d.ts +243 -0
- package/dist/endpoint-records.d.ts.map +1 -0
- package/dist/endpoint-records.js +591 -0
- package/dist/endpoint-records.js.map +1 -0
- package/dist/endpoint-serve.d.ts +176 -0
- package/dist/endpoint-serve.d.ts.map +1 -0
- package/dist/endpoint-serve.js +446 -0
- package/dist/endpoint-serve.js.map +1 -0
- package/dist/endpoint-service.d.ts +518 -0
- package/dist/endpoint-service.d.ts.map +1 -0
- package/dist/endpoint-service.js +973 -0
- package/dist/endpoint-service.js.map +1 -0
- package/dist/endpoint-session.d.ts +398 -0
- package/dist/endpoint-session.d.ts.map +1 -0
- package/dist/endpoint-session.js +834 -0
- package/dist/endpoint-session.js.map +1 -0
- package/dist/endpoint-signing.d.ts +105 -0
- package/dist/endpoint-signing.d.ts.map +1 -0
- package/dist/endpoint-signing.js +190 -0
- package/dist/endpoint-signing.js.map +1 -0
- package/dist/endpoint-subjects.d.ts +222 -0
- package/dist/endpoint-subjects.d.ts.map +1 -0
- package/dist/endpoint-subjects.js +381 -0
- package/dist/endpoint-subjects.js.map +1 -0
- package/dist/endpoint-supervisor.d.ts +19 -0
- package/dist/endpoint-supervisor.d.ts.map +1 -0
- package/dist/endpoint-supervisor.js +12 -0
- package/dist/endpoint-supervisor.js.map +1 -0
- package/dist/endpoint-traits.d.ts +225 -0
- package/dist/endpoint-traits.d.ts.map +1 -0
- package/dist/endpoint-traits.js +469 -0
- package/dist/endpoint-traits.js.map +1 -0
- package/dist/endpoint-verbs.d.ts +277 -0
- package/dist/endpoint-verbs.d.ts.map +1 -0
- package/dist/endpoint-verbs.js +576 -0
- package/dist/endpoint-verbs.js.map +1 -0
- package/dist/endpoint-virtual.d.ts +308 -0
- package/dist/endpoint-virtual.d.ts.map +1 -0
- package/dist/endpoint-virtual.js +440 -0
- package/dist/endpoint-virtual.js.map +1 -0
- package/dist/endpoint-work.d.ts +304 -0
- package/dist/endpoint-work.d.ts.map +1 -0
- package/dist/endpoint-work.js +728 -0
- package/dist/endpoint-work.js.map +1 -0
- package/dist/endpoint.d.ts +66 -22
- package/dist/endpoint.d.ts.map +1 -1
- package/dist/endpoint.js +289 -89
- package/dist/endpoint.js.map +1 -1
- package/dist/evict.d.ts +95 -32
- package/dist/evict.d.ts.map +1 -1
- package/dist/evict.js +193 -3
- package/dist/evict.js.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -1
- package/dist/lease.d.ts +4 -0
- package/dist/lease.d.ts.map +1 -1
- package/dist/lease.js.map +1 -1
- package/dist/members.d.ts +4 -4
- package/dist/members.d.ts.map +1 -1
- package/dist/members.js +12 -12
- package/dist/members.js.map +1 -1
- package/dist/provision.d.ts +70 -18
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +194 -33
- package/dist/provision.js.map +1 -1
- package/dist/safe-pattern.d.ts +33 -0
- package/dist/safe-pattern.d.ts.map +1 -0
- package/dist/safe-pattern.js +486 -0
- package/dist/safe-pattern.js.map +1 -0
- package/dist/schema-profile.d.ts +93 -0
- package/dist/schema-profile.d.ts.map +1 -0
- package/dist/schema-profile.js +284 -0
- package/dist/schema-profile.js.map +1 -0
- package/dist/streams.d.ts +13 -8
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +35 -18
- package/dist/streams.js.map +1 -1
- package/dist/subjects.d.ts +100 -40
- package/dist/subjects.d.ts.map +1 -1
- package/dist/subjects.js +136 -60
- package/dist/subjects.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RECEIPTS (SPEC §13.10): a receipt binds a request to its outcome, signed and non-repudiable,
|
|
3
|
+
* for metering, disputes, and pipeline causality; payment semantics stay opaque to core.
|
|
4
|
+
*
|
|
5
|
+
* The artifact is the normative `Receipt` shape, RFC 8785 canonical, Ed25519-signed (D28: the
|
|
6
|
+
* signature is over the sig-absent canonical form and is VERIFIED over the exact raw presented
|
|
7
|
+
* artifact, never a reconstructed projection). Lifecycle and epoch ride as EVIDENCE, never
|
|
8
|
+
* redemption authority. The fact lives create-only on the caller- and execution-scoped subject
|
|
9
|
+
* `epf.<endpoint>.receipt.<cOwner>.<cActor>.<cUid>.<id>.<sourceSeq>` (§13.2) — one receipt per
|
|
10
|
+
* accepted execution, forever; a lost publish CAS must observe a canonically IDENTICAL winner
|
|
11
|
+
* or fail loud (a foreign receipt on the subject never becomes "the" receipt), and the
|
|
12
|
+
* candidate is a DETACHED snapshot taken at entry, so a caller mutating the receipt across the
|
|
13
|
+
* publish await can neither change what is stored nor what the winner is compared against.
|
|
14
|
+
* The store seams run on a space-bonded context (§13.4): JS + JSM derive from ONE connection
|
|
15
|
+
* by construction, so a lost CAS can never adopt a "winner" read from a different broker.
|
|
16
|
+
*
|
|
17
|
+
* VERIFICATION (§13.10, unconditional): "signature against the anchor registry + digest
|
|
18
|
+
* recomputation" — BOTH are mandatory. `verifyReceipt` therefore REQUIRES the raw args
|
|
19
|
+
* evidence (and the raw result evidence exactly when the receipt carries a resultDigest); the
|
|
20
|
+
* digests are recomputed from evidence read ONCE at entry and compared BEFORE any await, so
|
|
21
|
+
* mid-verification mutation of the presented proof values can never split what was checked
|
|
22
|
+
* from what is attested. A reader that does not hold the raw evidence uses the deliberately
|
|
23
|
+
* weaker, separately named {@link verifyReceiptSignature} — authenticity and coordinates only,
|
|
24
|
+
* never a §13.10 verification. Forged or request-mismatched receipts fail loud; the artifact's
|
|
25
|
+
* caller evidence must NAME the subject's caller triple (a cross-caller receipt never attests).
|
|
26
|
+
* A command carrying `ai.cotal.priced` MUST emit one; receipts MAY be emitted for unpriced
|
|
27
|
+
* commands. Retention: default 90d, >= the idempotency horizon (§13.10) — realized by the EPF
|
|
28
|
+
* stream configuration, not per-message.
|
|
29
|
+
*/
|
|
30
|
+
import { jetstream, jetstreamManager } from "@nats-io/jetstream";
|
|
31
|
+
import { headers as natsHeaders } from "@nats-io/transport-node";
|
|
32
|
+
import { canonicalJson, contractDigest, isContractDigest } from "./canonical.js";
|
|
33
|
+
import { EpEnvelopeError } from "./endpoint-envelope.js";
|
|
34
|
+
import { epfSubject, assertIdToken } from "./endpoint-subjects.js";
|
|
35
|
+
import { epfStreamName, readLastFact } from "./endpoint-journal.js";
|
|
36
|
+
import { verifyArtifactSignature, resolveAnchorForUse, assertAnchorScopeCovers, signArtifact } from "./endpoint-signing.js";
|
|
37
|
+
/** The resources live here, unreachable from the context token itself. A structural look-alike
|
|
38
|
+
* never appears in this map, so it never authorizes; and `ctx.js`/`ctx.jsm` do not exist to be
|
|
39
|
+
* reassigned after construction. */
|
|
40
|
+
const RECEIPT_RESOURCES = new WeakMap();
|
|
41
|
+
/** The store's source connection, held privately for the §13.4 one-connection bond check. */
|
|
42
|
+
const RECEIPT_CONNECTIONS = new WeakMap();
|
|
43
|
+
/** Bond the resources to one space by CONSTRUCTION (frozen token + WeakMap-private resources,
|
|
44
|
+
* same discipline as the other store contexts): a hand-assembled structural look-alike is
|
|
45
|
+
* rejected at every seam, and the broker cannot be rebound out from under a live operation. */
|
|
46
|
+
export async function receiptStoreContext(nc, space) {
|
|
47
|
+
if (nc === null || typeof nc !== "object" || typeof nc.close !== "function")
|
|
48
|
+
throw new EpEnvelopeError("failed-precondition", "a receipt-store context is constructed from ONE binding-layer connection; separate resources are never accepted (SPEC 13.4)");
|
|
49
|
+
if (typeof space !== "string" || space.length === 0)
|
|
50
|
+
throw new EpEnvelopeError("failed-precondition", "a receipt-store context needs a space");
|
|
51
|
+
const js = jetstream(nc);
|
|
52
|
+
const jsm = await jetstreamManager(nc);
|
|
53
|
+
const ctx = Object.freeze({ space });
|
|
54
|
+
RECEIPT_RESOURCES.set(ctx, { js, jsm });
|
|
55
|
+
RECEIPT_CONNECTIONS.set(ctx, nc);
|
|
56
|
+
return ctx;
|
|
57
|
+
}
|
|
58
|
+
/** The brand check AND the resource fetch, in one: a context not minted by receiptStoreContext()
|
|
59
|
+
* is absent from the map and never authorizes. */
|
|
60
|
+
function resources(ctx) {
|
|
61
|
+
const r = ctx === null || typeof ctx !== "object" ? undefined : RECEIPT_RESOURCES.get(ctx);
|
|
62
|
+
if (r === undefined)
|
|
63
|
+
throw new EpEnvelopeError("failed-precondition", `the receipt-store context was not constructed by receiptStoreContext(); a hand-assembled resource bundle never authorizes - the space bond is constructed, not asserted (SPEC 13.4)`);
|
|
64
|
+
return r;
|
|
65
|
+
}
|
|
66
|
+
/** Prove a context is store-branded (minted by {@link receiptStoreContext}) without touching the
|
|
67
|
+
* broker: emission wiring is validated at seam ENTRY, so a hand-assembled store bundle refuses
|
|
68
|
+
* BEFORE any terminal is committed against it, never as a post-commit emission failure. */
|
|
69
|
+
export function assertReceiptStoreContext(ctx) { resources(ctx); }
|
|
70
|
+
/** Prove the store derives from EXACTLY this binding-layer connection (§13.4: "JS + JSM derive
|
|
71
|
+
* from ONE connection by construction"): a same-space store built over a DIFFERENT connection
|
|
72
|
+
* or broker passes any string-space compare, yet its publishes and lost-CAS winner reads land
|
|
73
|
+
* on ANOTHER broker's streams - splicing one operation's authority across brokers. The bond is
|
|
74
|
+
* connection IDENTITY, never a name. */
|
|
75
|
+
export function assertReceiptStoreConnection(ctx, nc) {
|
|
76
|
+
resources(ctx);
|
|
77
|
+
if (nc === undefined || RECEIPT_CONNECTIONS.get(ctx) !== nc)
|
|
78
|
+
throw new EpEnvelopeError("failed-precondition", "the receipt store does not derive from this operation's own connection; one operation binds ONE broker connection, so a cross-connection (or cross-broker) store never publishes (SPEC 13.4)");
|
|
79
|
+
}
|
|
80
|
+
/** Snapshot the ref to a validated, DETACHED copy at seam entry (single-read: every property
|
|
81
|
+
* is read exactly once, so a shifting getter cannot split one operation's identity across
|
|
82
|
+
* its subject derivation and its artifact binding). */
|
|
83
|
+
function snapshotReceiptRef(ref) {
|
|
84
|
+
if (ref === null || typeof ref !== "object")
|
|
85
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt ref must carry endpoint, the caller triple, requestId, and sourceSeq (SPEC 13.2)`);
|
|
86
|
+
const endpoint = ref.endpoint;
|
|
87
|
+
const requestId = ref.requestId;
|
|
88
|
+
const sourceSeq = ref.sourceSeq;
|
|
89
|
+
const c = ref.caller;
|
|
90
|
+
if (typeof endpoint !== "string" || typeof requestId !== "string" || c === null || typeof c !== "object")
|
|
91
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt ref must carry endpoint, the caller triple, requestId, and sourceSeq (SPEC 13.2)`);
|
|
92
|
+
const owner = c.owner;
|
|
93
|
+
const actor = c.actor;
|
|
94
|
+
const uid = c.uid;
|
|
95
|
+
if (typeof owner !== "string" || typeof actor !== "string" || typeof uid !== "string")
|
|
96
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt ref must carry endpoint, the caller triple, requestId, and sourceSeq (SPEC 13.2)`);
|
|
97
|
+
return Object.freeze({ endpoint, caller: Object.freeze({ owner, actor, uid }), requestId, sourceSeq });
|
|
98
|
+
}
|
|
99
|
+
const isRec = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
100
|
+
function garbled(what) { throw new EpEnvelopeError("internal", `${what}; a garbled receipt never attests (SPEC 13.10)`); }
|
|
101
|
+
/** The receipt-fact subject (`epf.<e>.receipt.<cO>.<cA>.<cUid>.<id>.<sourceSeq>`, §13.2). */
|
|
102
|
+
export function receiptSubject(space, ref) {
|
|
103
|
+
if (!Number.isSafeInteger(ref.sourceSeq) || ref.sourceSeq < 1)
|
|
104
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt's sourceSeq is the accepted submission's positive stream sequence; got ${JSON.stringify(ref.sourceSeq)} (SPEC 13.10)`);
|
|
105
|
+
return epfSubject(space, ref.endpoint, ["receipt", ref.caller.owner, ref.caller.actor, ref.caller.uid, assertIdToken(ref.requestId, "requestId"), String(ref.sourceSeq)]);
|
|
106
|
+
}
|
|
107
|
+
/** Build and SIGN a receipt from the raw execution evidence: the digests are computed HERE from
|
|
108
|
+
* the actual args/result (single source — an emitted digest can never mismatch what was
|
|
109
|
+
* digested), the outcome is closed, and the artifact signs D28 over its canonical form. */
|
|
110
|
+
export function mintReceipt(args, keyPair) {
|
|
111
|
+
if (!Number.isSafeInteger(args.ts) || args.ts < 0)
|
|
112
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt ts must be a non-negative safe integer; got ${JSON.stringify(args.ts)}`);
|
|
113
|
+
if (!isContractDigest(args.schemaDigests?.input) || !isContractDigest(args.schemaDigests?.output))
|
|
114
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt requires the described contract's input/output schema digests (SPEC 13.10)`);
|
|
115
|
+
if (typeof args.outcome?.ok !== "boolean" || (args.outcome.code !== undefined && typeof args.outcome.code !== "string"))
|
|
116
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt outcome is { ok: boolean, code?: string }; got ${JSON.stringify(args.outcome)}`);
|
|
117
|
+
if (args.result !== undefined && args.resultDigest !== undefined)
|
|
118
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt takes a raw result OR a pre-committed resultDigest, never both (a single source of the result digest, SPEC 13.10)`);
|
|
119
|
+
if (args.resultDigest !== undefined && !isContractDigest(args.resultDigest))
|
|
120
|
+
throw new EpEnvelopeError("failed-precondition", `a receipt resultDigest is a sha256 digest; got ${JSON.stringify(args.resultDigest)}`);
|
|
121
|
+
const resultDigest = args.resultDigest !== undefined ? args.resultDigest
|
|
122
|
+
: args.result !== undefined ? contractDigest(args.result) : undefined;
|
|
123
|
+
const body = {
|
|
124
|
+
v: 1, requestId: args.ref.requestId, sourceSeq: args.ref.sourceSeq, space: args.space,
|
|
125
|
+
endpoint: args.ref.endpoint, command: args.command, instance: args.instance, caller: args.caller,
|
|
126
|
+
schemaDigests: { input: args.schemaDigests.input, output: args.schemaDigests.output },
|
|
127
|
+
argsDigest: contractDigest(args.args === undefined ? null : args.args),
|
|
128
|
+
outcome: { ok: args.outcome.ok, ...(args.outcome.code !== undefined ? { code: args.outcome.code } : {}) },
|
|
129
|
+
...(resultDigest !== undefined ? { resultDigest } : {}),
|
|
130
|
+
ts: args.ts, signer: { keyId: args.signer.keyId },
|
|
131
|
+
};
|
|
132
|
+
receiptSubject(args.space, args.ref); // validates the subject coordinates before signing
|
|
133
|
+
return signArtifact(body, keyPair);
|
|
134
|
+
}
|
|
135
|
+
/** Map an action goal's committed terminal (`state` + its `outcomeDigest`) onto the receipt
|
|
136
|
+
* outcome: only `succeeded` is `ok`; every other terminal state IS its own catalog code, so a
|
|
137
|
+
* receipt's `outcome.code` can never disagree with the committed goal state. The digest is the
|
|
138
|
+
* terminal fact's OWN `outcomeDigest` (the receipt attests the committed value, never re-digests
|
|
139
|
+
* a substitute). Kept generic (state + digest, not the GoalResultFact type) so the receipt
|
|
140
|
+
* module stays free of an action-composite dependency. */
|
|
141
|
+
export function receiptOutcomeOfGoal(state, outcomeDigest) {
|
|
142
|
+
const OK_STATES = new Set(["succeeded"]);
|
|
143
|
+
const CODE_STATES = new Set(["failed", "cancelled", "expired", "uncertain"]);
|
|
144
|
+
if (!OK_STATES.has(state) && !CODE_STATES.has(state))
|
|
145
|
+
throw new EpEnvelopeError("internal", `goal terminal state ${JSON.stringify(state)} is not a §13.6 outcome; a receipt never attests an unknown terminal (SPEC 13.10)`);
|
|
146
|
+
if (!isContractDigest(outcomeDigest))
|
|
147
|
+
throw new EpEnvelopeError("internal", `a goal terminal's outcomeDigest is a sha256 digest; got ${JSON.stringify(outcomeDigest)} (SPEC 13.10)`);
|
|
148
|
+
return { ok: state === "succeeded", ...(state === "succeeded" ? {} : { code: state }), resultDigest: outcomeDigest };
|
|
149
|
+
}
|
|
150
|
+
/** Build and sign a receipt whose EVERY attestation field is DERIVED from the two authoritative
|
|
151
|
+
* facts, never a caller's free parameter (distsys CF-1: an emitted receipt can no longer attest
|
|
152
|
+
* an outcome or identity that disagrees with the committed record). Identity (requestId,
|
|
153
|
+
* sourceSeq, caller, endpoint, command, schema digests, argsDigest) comes from the ACCEPTANCE
|
|
154
|
+
* fact; the outcome (ok/code/resultDigest) comes from the committed TERMINAL. The only inputs
|
|
155
|
+
* the caller supplies are the executing-instance EVIDENCE, the wall clock, the signer id, and
|
|
156
|
+
* the key. A receipt minted here is reconstructable from the two facts, so a crash between
|
|
157
|
+
* effect and emission is repaired by re-minting from the same facts (idempotent publish). */
|
|
158
|
+
export function mintReceiptFromFacts(args, keyPair) {
|
|
159
|
+
const a = args.acceptance;
|
|
160
|
+
if (a === null || typeof a !== "object" || a.decision !== "accepted")
|
|
161
|
+
throw new EpEnvelopeError("internal", `a receipt is minted from an ACCEPTED submission's acceptance fact; got ${JSON.stringify(a?.decision)} (SPEC 13.10)`);
|
|
162
|
+
const op = a.request?.op;
|
|
163
|
+
if (op === undefined || typeof op.endpoint !== "string" || typeof op.command !== "string")
|
|
164
|
+
throw new EpEnvelopeError("internal", `the acceptance fact for "${a.id}" carries no invocation binding; a receipt derives its endpoint/command from the accepted request, never a free param (SPEC 13.10)`);
|
|
165
|
+
// The acceptance records the pinned contract digests twice (its `contractDigests` and the
|
|
166
|
+
// embedded request's op digests); they MUST agree, else the acceptance is internally garbled
|
|
167
|
+
// and a receipt built from either could disagree with the other.
|
|
168
|
+
if (a.contractDigests.input !== op.inputDigest || a.contractDigests.output !== op.outputDigest)
|
|
169
|
+
throw new EpEnvelopeError("internal", `the acceptance fact for "${a.id}" disagrees with its own embedded request on the pinned contract digests; a garbled acceptance never mints a receipt (SPEC 13.10)`);
|
|
170
|
+
// BIND the authoritative caller triple (from the acceptance subject) to the fact body's caller
|
|
171
|
+
// evidence: id = "owner.actor" and uid = lifecycleUid, else the receipt subject and its body
|
|
172
|
+
// would name different principals (forged attribution, the same class parseReceipt closes on read).
|
|
173
|
+
if (`${args.caller.owner}.${args.caller.actor}` !== a.caller.id || args.caller.uid !== a.caller.lifecycleUid)
|
|
174
|
+
throw new EpEnvelopeError("internal", `the acceptance subject caller ${args.caller.owner}.${args.caller.actor}/${args.caller.uid} disagrees with the fact body caller ${a.caller.id}/${a.caller.lifecycleUid}; a receipt never attests split attribution (SPEC 13.10)`);
|
|
175
|
+
if (typeof args.terminal?.ok !== "boolean"
|
|
176
|
+
|| (args.terminal.code !== undefined && typeof args.terminal.code !== "string")
|
|
177
|
+
|| (args.terminal.resultDigest !== undefined && !isContractDigest(args.terminal.resultDigest)))
|
|
178
|
+
throw new EpEnvelopeError("internal", `a receipt terminal is { ok, code?, resultDigest? } derived from the committed terminal; got ${JSON.stringify(args.terminal)} (SPEC 13.10)`);
|
|
179
|
+
return mintReceipt({
|
|
180
|
+
ref: { endpoint: op.endpoint, caller: args.caller, requestId: a.id, sourceSeq: a.sourceSeq },
|
|
181
|
+
space: args.space,
|
|
182
|
+
command: op.command,
|
|
183
|
+
instance: args.instance,
|
|
184
|
+
caller: a.caller,
|
|
185
|
+
schemaDigests: a.contractDigests,
|
|
186
|
+
args: a.request.args,
|
|
187
|
+
outcome: { ok: args.terminal.ok, ...(args.terminal.code !== undefined ? { code: args.terminal.code } : {}) },
|
|
188
|
+
...(args.terminal.resultDigest !== undefined ? { resultDigest: args.terminal.resultDigest } : {}),
|
|
189
|
+
ts: args.ts,
|
|
190
|
+
signer: args.signer,
|
|
191
|
+
}, keyPair);
|
|
192
|
+
}
|
|
193
|
+
/** Prove a RECORDED receipt attests the same facts as a freshly fact-derived candidate: every
|
|
194
|
+
* attestation field (identity + outcome) must agree; only the emission evidence (instance, ts,
|
|
195
|
+
* signer, sig) may differ, because two legitimate emitters — the inline commit path and the
|
|
196
|
+
* reconciler — mint from the SAME facts at different moments. First-recorded-wins is the §13.10
|
|
197
|
+
* rule; a recorded receipt that DISAGREES with the facts is exactly the forged-attestation class
|
|
198
|
+
* CF-1 closes and is a loud `conflict`, never silently adopted. */
|
|
199
|
+
export function assertReceiptAttestsSameFacts(recorded, candidate) {
|
|
200
|
+
const same = recorded.requestId === candidate.requestId && recorded.sourceSeq === candidate.sourceSeq
|
|
201
|
+
&& recorded.space === candidate.space && recorded.endpoint === candidate.endpoint
|
|
202
|
+
&& recorded.command === candidate.command
|
|
203
|
+
&& recorded.caller.id === candidate.caller.id && recorded.caller.lifecycleUid === candidate.caller.lifecycleUid
|
|
204
|
+
&& recorded.schemaDigests.input === candidate.schemaDigests.input
|
|
205
|
+
&& recorded.schemaDigests.output === candidate.schemaDigests.output
|
|
206
|
+
&& recorded.argsDigest === candidate.argsDigest
|
|
207
|
+
&& recorded.outcome.ok === candidate.outcome.ok && recorded.outcome.code === candidate.outcome.code
|
|
208
|
+
&& recorded.resultDigest === candidate.resultDigest;
|
|
209
|
+
if (!same)
|
|
210
|
+
throw new EpEnvelopeError("conflict", `the recorded receipt for ${recorded.endpoint}/${recorded.requestId}#${recorded.sourceSeq} disagrees with the committed facts it claims to attest; one execution has one receipt and it must attest the committed record (SPEC 13.10)`);
|
|
211
|
+
}
|
|
212
|
+
/** Closed shape validation, IDENTITY-BOUND to the ref/subject it was read for (§13.4/§13.10):
|
|
213
|
+
* a mis-subjected, cross-request, cross-caller, or garbled receipt never attests. The
|
|
214
|
+
* artifact's caller EVIDENCE must name the subject's caller triple — a receipt whose body
|
|
215
|
+
* names a different principal than its execution-scoped subject is forged attribution. */
|
|
216
|
+
export function parseReceipt(raw, ref, space) {
|
|
217
|
+
// Detach to a plain tree at ENTRY (distsys c50817d MEDIUM): the exported parser validates and
|
|
218
|
+
// RETURNS this snapshot, never the caller's live view. A caller getter/Proxy therefore cannot
|
|
219
|
+
// pass a check with one value and then answer a different one when a later field (or the
|
|
220
|
+
// returned `parsed.caller.id`) is read - the snapshot has no live accessors left.
|
|
221
|
+
const snap = snapshotRawReceipt(raw);
|
|
222
|
+
if (!isRec(snap))
|
|
223
|
+
garbled("the receipt is not an object");
|
|
224
|
+
const o = snap;
|
|
225
|
+
const allowed = new Set(["v", "requestId", "sourceSeq", "space", "endpoint", "command", "instance", "caller", "schemaDigests", "argsDigest", "outcome", "resultDigest", "ts", "signer", "sig"]);
|
|
226
|
+
for (const k of Object.keys(o))
|
|
227
|
+
if (!allowed.has(k))
|
|
228
|
+
garbled(`the receipt carries the unknown field "${k}" (closed schema)`);
|
|
229
|
+
if (o.v !== 1)
|
|
230
|
+
garbled("the receipt version is not 1");
|
|
231
|
+
if (o.requestId !== ref.requestId || o.sourceSeq !== ref.sourceSeq || o.endpoint !== ref.endpoint || o.space !== space)
|
|
232
|
+
garbled(`the receipt names (${String(o.space)}, ${String(o.endpoint)}, ${String(o.requestId)}, ${String(o.sourceSeq)}), not its subject's (${space}, ${ref.endpoint}, ${ref.requestId}, ${ref.sourceSeq}); request-mismatched receipts fail loud`);
|
|
233
|
+
if (typeof o.command !== "string" || o.command.length === 0)
|
|
234
|
+
garbled("the receipt has no command");
|
|
235
|
+
const inst = o.instance;
|
|
236
|
+
if (!isRec(inst) || typeof inst.id !== "string" || typeof inst.instanceId !== "string"
|
|
237
|
+
|| typeof inst.epoch !== "number" || !Number.isSafeInteger(inst.epoch) || inst.epoch < 0)
|
|
238
|
+
garbled("the receipt instance evidence is not { id, instanceId, epoch }");
|
|
239
|
+
const cal = o.caller;
|
|
240
|
+
if (!isRec(cal) || typeof cal.id !== "string" || typeof cal.lifecycleUid !== "string")
|
|
241
|
+
garbled("the receipt caller evidence is not { id, lifecycleUid }");
|
|
242
|
+
if (cal.id !== `${ref.caller.owner}.${ref.caller.actor}` || cal.lifecycleUid !== ref.caller.uid)
|
|
243
|
+
garbled(`the receipt's caller evidence (${String(cal.id)}/${String(cal.lifecycleUid)}) does not name its subject's caller (${ref.caller.owner}.${ref.caller.actor}/${ref.caller.uid}); a cross-caller receipt never attests`);
|
|
244
|
+
const sd = o.schemaDigests;
|
|
245
|
+
if (!isRec(sd) || !isContractDigest(sd.input) || !isContractDigest(sd.output))
|
|
246
|
+
garbled("the receipt schemaDigests are not sha256 digests");
|
|
247
|
+
if (!isContractDigest(o.argsDigest))
|
|
248
|
+
garbled("the receipt argsDigest is not a sha256 digest");
|
|
249
|
+
if (o.resultDigest !== undefined && !isContractDigest(o.resultDigest))
|
|
250
|
+
garbled("the receipt resultDigest is not a sha256 digest");
|
|
251
|
+
const out = o.outcome;
|
|
252
|
+
if (!isRec(out) || typeof out.ok !== "boolean" || (out.code !== undefined && typeof out.code !== "string"))
|
|
253
|
+
garbled("the receipt outcome is not { ok, code? }");
|
|
254
|
+
if (typeof o.ts !== "number" || !Number.isSafeInteger(o.ts) || o.ts < 0)
|
|
255
|
+
garbled("the receipt ts is not a non-negative safe integer");
|
|
256
|
+
if (!isRec(o.signer) || typeof o.signer.keyId !== "string")
|
|
257
|
+
garbled("the receipt names no signer keyId");
|
|
258
|
+
if (typeof o.sig !== "string" || o.sig.length === 0)
|
|
259
|
+
garbled("the receipt is unsigned");
|
|
260
|
+
return o;
|
|
261
|
+
}
|
|
262
|
+
/** Publish a receipt create-only on its execution-scoped subject, with EXPLICIT subject
|
|
263
|
+
* coordinates (the artifact's caller evidence carries `{id, lifecycleUid}`, not the subject
|
|
264
|
+
* triple, and a publisher never derives one by guessing). The receipt is SNAPSHOTTED to a
|
|
265
|
+
* detached canonical candidate at entry: the identity binding ({@link parseReceipt}), the
|
|
266
|
+
* published bytes, the lost-CAS winner comparison, and the returned value are all EXACTLY
|
|
267
|
+
* that candidate — a caller mutating the receipt across the publish await can neither change
|
|
268
|
+
* what is stored nor smuggle a "winner" past the equality proof. A lost CAS reads the winner
|
|
269
|
+
* through the SAME bonded context and PROVES canonical identity — a DIFFERENT receipt already
|
|
270
|
+
* on the subject is a loud `conflict` (one execution, one receipt, forever), never adopted. */
|
|
271
|
+
export async function publishReceipt(ctx, ref, receipt) {
|
|
272
|
+
const { js } = resources(ctx);
|
|
273
|
+
const refSnap = snapshotReceiptRef(ref);
|
|
274
|
+
let candidate;
|
|
275
|
+
try {
|
|
276
|
+
candidate = JSON.parse(canonicalJson(receipt));
|
|
277
|
+
} // detached; the caller's live object is never read again
|
|
278
|
+
catch (e) {
|
|
279
|
+
throw new EpEnvelopeError("internal", `the receipt is not interchangeable JSON (${e.message}); garbled state is never published (SPEC 13.10)`);
|
|
280
|
+
}
|
|
281
|
+
parseReceipt(candidate, refSnap, ctx.space); // identity-bind before writing
|
|
282
|
+
const subject = receiptSubject(ctx.space, refSnap);
|
|
283
|
+
const h = natsHeaders();
|
|
284
|
+
h.set("Nats-Expected-Last-Subject-Sequence", "0");
|
|
285
|
+
try {
|
|
286
|
+
await js.publish(subject, new TextEncoder().encode(canonicalJson(candidate)), { headers: h });
|
|
287
|
+
return { won: true, receipt: candidate };
|
|
288
|
+
}
|
|
289
|
+
catch (e) {
|
|
290
|
+
const code = e?.code;
|
|
291
|
+
if (code !== 10071 && code !== 10164)
|
|
292
|
+
throw e;
|
|
293
|
+
const winner = await readReceipt(ctx, refSnap);
|
|
294
|
+
if (winner === undefined)
|
|
295
|
+
throw new EpEnvelopeError("internal", `the receipt CAS for ${subject} was lost but no winning receipt is readable (SPEC 13.4)`);
|
|
296
|
+
if (canonicalJson(winner) !== canonicalJson(candidate))
|
|
297
|
+
throw new EpEnvelopeError("conflict", `a DIFFERENT receipt is already recorded for this execution (${subject}); one execution has one receipt, forever (SPEC 13.10)`);
|
|
298
|
+
return { won: false, receipt: winner };
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/** Read the execution's recorded receipt (`undefined` = none emitted yet), identity-bound. */
|
|
302
|
+
export async function readReceipt(ctx, ref) {
|
|
303
|
+
const { jsm } = resources(ctx);
|
|
304
|
+
const refSnap = snapshotReceiptRef(ref);
|
|
305
|
+
const subject = receiptSubject(ctx.space, refSnap);
|
|
306
|
+
const raw = await readLastFact(jsm, epfStreamName(ctx.space), subject);
|
|
307
|
+
return raw === undefined ? undefined : parseReceipt(raw, refSnap, ctx.space);
|
|
308
|
+
}
|
|
309
|
+
/** Race the anchor resolution against the verification budget: a stuck registry is a bounded
|
|
310
|
+
* `unavailable` refusal, never a hung verification. Races `Promise.resolve(p)` unconditionally
|
|
311
|
+
* (a non-native thenable must not bypass the deadline). */
|
|
312
|
+
async function withVerifyBudget(p, budgetMs, what) {
|
|
313
|
+
let timer;
|
|
314
|
+
const deadline = new Promise((_, reject) => {
|
|
315
|
+
timer = setTimeout(() => reject(new EpEnvelopeError("unavailable", `${what} did not answer within ${budgetMs}ms; receipt verification is bounded and fails closed (SPEC 13.10)`)), budgetMs);
|
|
316
|
+
});
|
|
317
|
+
try {
|
|
318
|
+
return await Promise.race([Promise.resolve(p), deadline]);
|
|
319
|
+
}
|
|
320
|
+
finally {
|
|
321
|
+
clearTimeout(timer);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function assertBudget(v) {
|
|
325
|
+
const budget = v ?? 5_000;
|
|
326
|
+
if (!Number.isSafeInteger(budget) || budget <= 0)
|
|
327
|
+
throw new EpEnvelopeError("failed-precondition", `verifyBudgetMs must be a positive integer; got ${JSON.stringify(v)}`);
|
|
328
|
+
return budget;
|
|
329
|
+
}
|
|
330
|
+
/** Snapshot the raw artifact to a DETACHED value at entry: the parse, the scope check, and the
|
|
331
|
+
* D28 signature all read EXACTLY these bytes, so a caller mutating the raw receipt during an
|
|
332
|
+
* awaited anchor resolution can never split what was parsed from what the signature verifies
|
|
333
|
+
* (the D28 consuming boundary). */
|
|
334
|
+
function snapshotRawReceipt(raw) {
|
|
335
|
+
try {
|
|
336
|
+
return JSON.parse(canonicalJson(raw));
|
|
337
|
+
} // throws on non-interchangeable I-JSON; the detached tree is unreachable to the caller
|
|
338
|
+
catch (e) {
|
|
339
|
+
throw new EpEnvelopeError("internal", `the receipt is not interchangeable JSON (${e.message}); garbled state never verifies (SPEC 13.10)`);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/** The shared authenticity core: FRESH-resolve the signer anchor (role `receipts`, scope
|
|
343
|
+
* covering the attested endpoint, window at the receipt's `ts`, bounded), then verify the D28
|
|
344
|
+
* signature over the detached snapshot. */
|
|
345
|
+
async function verifySignatureCore(rawSnapshot, receipt, resolveAnchor, budget) {
|
|
346
|
+
const anchor = await withVerifyBudget(resolveAnchorForUse(resolveAnchor, { keyId: receipt.signer.keyId, role: "receipts", at: receipt.ts }), budget, `the anchor resolution for receipt signer "${receipt.signer.keyId}"`);
|
|
347
|
+
assertAnchorScopeCovers(anchor, "receipts", receipt.endpoint, "the receipt's attested endpoint");
|
|
348
|
+
verifyArtifactSignature(rawSnapshot, anchor); // the DETACHED snapshot the parse read, not the live caller-owned raw
|
|
349
|
+
return anchor;
|
|
350
|
+
}
|
|
351
|
+
/** VERIFY a receipt (§13.10, fail loud, UNCONDITIONAL): D28 signature over the EXACT RAW
|
|
352
|
+
* artifact against the FRESH-resolved anchor PLUS digest recomputation — both mandatory
|
|
353
|
+
* ("signature against the anchor registry + digest recomputation", §13.10). The raw args
|
|
354
|
+
* evidence is REQUIRED (undefined digests as null); the raw result evidence is REQUIRED
|
|
355
|
+
* exactly when the receipt carries a resultDigest (a receipt attesting a result is only
|
|
356
|
+
* verified against that result), and FORBIDDEN when it does not (a receipt with no
|
|
357
|
+
* resultDigest cannot attest a presented result). The evidence is read ONCE and its digests
|
|
358
|
+
* are computed at ENTRY, then compared BEFORE the anchor await — mutating the presented proof
|
|
359
|
+
* values mid-verification changes nothing. A reader without raw evidence uses the explicitly
|
|
360
|
+
* weaker {@link verifyReceiptSignature}. Returns the parsed receipt. */
|
|
361
|
+
export async function verifyReceipt(raw, opts) {
|
|
362
|
+
const budget = assertBudget(opts.verifyBudgetMs);
|
|
363
|
+
// ENTRY SNAPSHOTS (single-read): ref, evidence, and the raw artifact all detach here.
|
|
364
|
+
const refSnap = snapshotReceiptRef(opts.ref);
|
|
365
|
+
const rec = opts.recompute;
|
|
366
|
+
if (rec === null || typeof rec !== "object" || Array.isArray(rec) || !("args" in rec))
|
|
367
|
+
throw new EpEnvelopeError("failed-precondition", `receipt verification is signature PLUS digest recomputation (SPEC 13.10, unconditional); the raw args evidence is mandatory - a reader without evidence uses verifyReceiptSignature, the explicitly weaker authenticity read`);
|
|
368
|
+
const argsEvidence = rec.args; // the ONLY read of rec.args
|
|
369
|
+
let argsProof;
|
|
370
|
+
let hasResult = false;
|
|
371
|
+
let resultProof;
|
|
372
|
+
try {
|
|
373
|
+
// Digest args IMMEDIATELY after its single read, BEFORE touching `rec` again (distsys c50817d
|
|
374
|
+
// HIGH): a `result` getter or Proxy has-trap must not run between the args read and its
|
|
375
|
+
// digest, or it could mutate the args object to match a foreign receipt. The evidence is
|
|
376
|
+
// single-read AND single-digest, not read-then-later-digest. Only once argsProof is a fixed
|
|
377
|
+
// scalar do we consult `rec` for the result evidence.
|
|
378
|
+
argsProof = contractDigest(argsEvidence === undefined ? null : argsEvidence);
|
|
379
|
+
hasResult = "result" in rec;
|
|
380
|
+
resultProof = hasResult ? contractDigest(rec.result) : undefined;
|
|
381
|
+
}
|
|
382
|
+
catch (e) {
|
|
383
|
+
throw new EpEnvelopeError("failed-precondition", `the presented evidence does not digest (${e.message}); evidence that cannot digest cannot verify (SPEC 13.10)`);
|
|
384
|
+
}
|
|
385
|
+
const rawSnapshot = snapshotRawReceipt(raw);
|
|
386
|
+
const receipt = parseReceipt(rawSnapshot, refSnap, opts.space);
|
|
387
|
+
// DIGEST RECOMPUTATION BEFORE THE ANCHOR AWAIT: the proofs are entry-time detached scalars,
|
|
388
|
+
// so nothing a caller mutates after entry can influence what is attested — and a mismatched
|
|
389
|
+
// receipt fails fast without touching the registry.
|
|
390
|
+
if (argsProof !== receipt.argsDigest)
|
|
391
|
+
throw new EpEnvelopeError("permission-denied", `the receipt's argsDigest does not recompute from the presented args; a request-mismatched receipt fails loud (SPEC 13.10)`);
|
|
392
|
+
if (receipt.resultDigest !== undefined) {
|
|
393
|
+
if (!hasResult)
|
|
394
|
+
throw new EpEnvelopeError("failed-precondition", `the receipt attests a result (resultDigest present) but no result evidence is presented; verification recomputes EVERY digest the receipt carries (SPEC 13.10)`);
|
|
395
|
+
if (resultProof !== receipt.resultDigest)
|
|
396
|
+
throw new EpEnvelopeError("permission-denied", `the receipt's resultDigest does not recompute from the presented result; a forged or mismatched receipt fails loud (SPEC 13.10)`);
|
|
397
|
+
}
|
|
398
|
+
else if (hasResult) {
|
|
399
|
+
throw new EpEnvelopeError("permission-denied", `the receipt carries no resultDigest but a result is presented for attestation; a receipt attests only what it digested (SPEC 13.10)`);
|
|
400
|
+
}
|
|
401
|
+
await verifySignatureCore(rawSnapshot, receipt, opts.resolveAnchor, budget);
|
|
402
|
+
return receipt;
|
|
403
|
+
}
|
|
404
|
+
/** The deliberately WEAKER, separately named authenticity read: closed identity-bound parse +
|
|
405
|
+
* D28 signature against the fresh-resolved anchor, with NO digest attestation — for a reader
|
|
406
|
+
* that does not hold the raw args/result. This is NOT the §13.10 verification (which is
|
|
407
|
+
* unconditionally signature PLUS digest recomputation, {@link verifyReceipt}); it proves the
|
|
408
|
+
* artifact is authentic and names these coordinates, nothing about what was executed. */
|
|
409
|
+
export async function verifyReceiptSignature(raw, opts) {
|
|
410
|
+
const budget = assertBudget(opts.verifyBudgetMs);
|
|
411
|
+
const refSnap = snapshotReceiptRef(opts.ref);
|
|
412
|
+
const rawSnapshot = snapshotRawReceipt(raw);
|
|
413
|
+
const receipt = parseReceipt(rawSnapshot, refSnap, opts.space);
|
|
414
|
+
await verifySignatureCore(rawSnapshot, receipt, opts.resolveAnchor, budget);
|
|
415
|
+
return receipt;
|
|
416
|
+
}
|
|
417
|
+
//# sourceMappingURL=endpoint-receipt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-receipt.js","sourceRoot":"","sources":["../src/endpoint-receipt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAA+C,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EAAE,OAAO,IAAI,WAAW,EAAuB,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAiB,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAuB,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,YAAY,EAA0C,MAAM,uBAAuB,CAAC;AAapK;;qCAEqC;AACrC,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAyC,CAAC;AAC/E,6FAA6F;AAC7F,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAuC,CAAC;AAE/E;;gGAEgG;AAChG,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EAAkB,EAAE,KAAa;IACzE,IAAI,EAAE,KAAK,IAAI,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,OAAQ,EAAqC,CAAC,KAAK,KAAK,UAAU;QAC7G,MAAM,I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