xoonya 1.26.0 → 1.27.0
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/FINAL_CONTRACT.md +1 -1
- package/README.md +47 -0
- package/SERVICE_CONTRACT.md +30 -0
- package/package.json +1 -1
- package/proof_sdk.js +713 -0
- package/server.js +278 -0
package/FINAL_CONTRACT.md
CHANGED
|
@@ -409,7 +409,7 @@ The public API of `xoonya` should center on:
|
|
|
409
409
|
|
|
410
410
|
Optional profile helpers may be added separately.
|
|
411
411
|
|
|
412
|
-
## What Should Be Carried Forward From Older
|
|
412
|
+
## What Should Be Carried Forward From Older Proof Lineage
|
|
413
413
|
|
|
414
414
|
Keep:
|
|
415
415
|
|
package/README.md
CHANGED
|
@@ -155,6 +155,34 @@ Primary proof-model routes:
|
|
|
155
155
|
- `POST /v1/proof-center/transaction-handoff/run`
|
|
156
156
|
- `GET /v1/proof-center/result-package-handoff`
|
|
157
157
|
- `GET /v1/proof-center/result-package-handoff/summary`
|
|
158
|
+
- `GET /v1/proof-center/governance`
|
|
159
|
+
- `GET /v1/proof-center/governance/summary`
|
|
160
|
+
- `GET /v1/proof-center/bridge`
|
|
161
|
+
- `GET /v1/proof-center/bridge/summary`
|
|
162
|
+
- `GET /v1/proof-center/bridge/profile-support`
|
|
163
|
+
- `POST /v1/proof-center/governance/interpretation-validate`
|
|
164
|
+
- `POST /v1/proof-center/governance/coordination`
|
|
165
|
+
- `POST /v1/proof-center/governance/dashboard`
|
|
166
|
+
- `POST /v1/proof-center/governance/operator-view`
|
|
167
|
+
- `POST /v1/proof-center/governance/admin-view`
|
|
168
|
+
- `POST /v1/proof-center/governance/dashboard-pack`
|
|
169
|
+
- `POST /v1/proof-center/governance/workflow-pack`
|
|
170
|
+
- `POST /v1/proof-center/governance/signoff-pack`
|
|
171
|
+
- `POST /v1/proof-center/governance/disputes/summary`
|
|
172
|
+
- `POST /v1/proof-center/governance/disputes/case-review`
|
|
173
|
+
- `POST /v1/proof-center/governance/disputes/action`
|
|
174
|
+
- `POST /v1/proof-center/governance/disputes/case-bundle`
|
|
175
|
+
- `POST /v1/proof-center/governance/disputes/resolution-pack`
|
|
176
|
+
- `POST /v1/proof-center/governance/console-pack`
|
|
177
|
+
- `POST /v1/proof-center/governance/handoff-bundle`
|
|
178
|
+
- `POST /v1/proof-center/governance/review-link`
|
|
179
|
+
- `POST /v1/proof-center/bridge/receipt-wrap`
|
|
180
|
+
- `POST /v1/proof-center/bridge/validator-verify`
|
|
181
|
+
- `POST /v1/proof-center/bridge/receipt-ledger-handoff`
|
|
182
|
+
- `POST /v1/proof-center/bridge/operator-review-pack`
|
|
183
|
+
- `POST /v1/proof-center/bridge/compatibility-pack`
|
|
184
|
+
- `POST /v1/proof-center/bridge/workflow-pack`
|
|
185
|
+
- `POST /v1/proof-center/bridge/admin-pack`
|
|
158
186
|
- `POST /v1/proof-center/result-package-handoff/review`
|
|
159
187
|
- `POST /v1/proof-center/result-package-handoff/review/summary`
|
|
160
188
|
- `POST /v1/proof-center/result-package-handoff/review/extension-readiness`
|
|
@@ -212,6 +240,25 @@ It now also exposes a handoff-intake summary and handoff-intake-boundary summary
|
|
|
212
240
|
It now also exposes a handoff-intake-carry summary so the same proof-side intake surface can be reused more directly as compact consumable carry instead of only summary or boundary posture.
|
|
213
241
|
It now also exposes a handoff-run summary so that same handoff contract can be read directly as the final proof-native run posture instead of only as continuity guidance.
|
|
214
242
|
|
|
243
|
+
The Wave B governance carry-over line adds a bounded governance center on the proof side:
|
|
244
|
+
|
|
245
|
+
- governance interpretation validation for receipt-ledger and result-package follow-through
|
|
246
|
+
- governance coordination emission for the next proof-side/operator handoff step
|
|
247
|
+
- governance dashboard, operator-view, admin-view, dashboard-pack, workflow-pack, and signoff-pack packaging
|
|
248
|
+
- dispute summary, case review, metadata-only dispute action, case-bundle export, and resolution-pack export
|
|
249
|
+
- console-pack, handoff-bundle, and explicit review-link surfaces for compact operator carry into the proof-side review/run ladder
|
|
250
|
+
|
|
251
|
+
This keeps governance review attached to the proof-side operating shape without widening `xoonya` into a runtime or economics system.
|
|
252
|
+
|
|
253
|
+
The Wave E bridge carry-over line adds a bounded bridge center on the proof side:
|
|
254
|
+
|
|
255
|
+
- receipt-wrap support for compact compatibility receipts when an outside bridge still needs that bounded surface
|
|
256
|
+
- validator-compatible verification and receipt inspection posture for bridge-side review
|
|
257
|
+
- receipt-ledger handoff packaging for compact proof-to-economics carry
|
|
258
|
+
- operator review packs, workflow packs, admin packs, and compatibility packs so bridge-facing support breadth is easy to inspect without changing the public proof center
|
|
259
|
+
|
|
260
|
+
This keeps the public story centered on `xoonya` while preserving the useful bridge, validator, and profile lineage as support surfaces instead of separate product identities.
|
|
261
|
+
|
|
215
262
|
The current `1.18.0` line starts turning that adapter-consumable handoff surface into a clearer adapter-usable handoff package:
|
|
216
263
|
|
|
217
264
|
- proof-side handoff-package intake summaries on top of the intake surface
|
package/SERVICE_CONTRACT.md
CHANGED
|
@@ -7,6 +7,36 @@ This file freezes the public service contract for `xoonya`.
|
|
|
7
7
|
Primary proof-model routes:
|
|
8
8
|
|
|
9
9
|
- `GET /health`
|
|
10
|
+
- `GET /v1/proof-center`
|
|
11
|
+
- `GET /v1/proof-center/summary`
|
|
12
|
+
- `GET /v1/proof-center/governance`
|
|
13
|
+
- `GET /v1/proof-center/governance/summary`
|
|
14
|
+
- `GET /v1/proof-center/bridge`
|
|
15
|
+
- `GET /v1/proof-center/bridge/summary`
|
|
16
|
+
- `GET /v1/proof-center/bridge/profile-support`
|
|
17
|
+
- `POST /v1/proof-center/governance/interpretation-validate`
|
|
18
|
+
- `POST /v1/proof-center/governance/coordination`
|
|
19
|
+
- `POST /v1/proof-center/governance/dashboard`
|
|
20
|
+
- `POST /v1/proof-center/governance/operator-view`
|
|
21
|
+
- `POST /v1/proof-center/governance/admin-view`
|
|
22
|
+
- `POST /v1/proof-center/governance/dashboard-pack`
|
|
23
|
+
- `POST /v1/proof-center/governance/workflow-pack`
|
|
24
|
+
- `POST /v1/proof-center/governance/signoff-pack`
|
|
25
|
+
- `POST /v1/proof-center/governance/disputes/summary`
|
|
26
|
+
- `POST /v1/proof-center/governance/disputes/case-review`
|
|
27
|
+
- `POST /v1/proof-center/governance/disputes/action`
|
|
28
|
+
- `POST /v1/proof-center/governance/disputes/case-bundle`
|
|
29
|
+
- `POST /v1/proof-center/governance/disputes/resolution-pack`
|
|
30
|
+
- `POST /v1/proof-center/governance/console-pack`
|
|
31
|
+
- `POST /v1/proof-center/governance/handoff-bundle`
|
|
32
|
+
- `POST /v1/proof-center/governance/review-link`
|
|
33
|
+
- `POST /v1/proof-center/bridge/receipt-wrap`
|
|
34
|
+
- `POST /v1/proof-center/bridge/validator-verify`
|
|
35
|
+
- `POST /v1/proof-center/bridge/receipt-ledger-handoff`
|
|
36
|
+
- `POST /v1/proof-center/bridge/operator-review-pack`
|
|
37
|
+
- `POST /v1/proof-center/bridge/compatibility-pack`
|
|
38
|
+
- `POST /v1/proof-center/bridge/workflow-pack`
|
|
39
|
+
- `POST /v1/proof-center/bridge/admin-pack`
|
|
10
40
|
- `POST /v1/events/canonicalize`
|
|
11
41
|
- `POST /v1/events/hash`
|
|
12
42
|
- `POST /v1/receipts/emit`
|
package/package.json
CHANGED
package/proof_sdk.js
CHANGED
|
@@ -1948,6 +1948,691 @@ function summarizeReviewCompleteDefaultPathRun(input) {
|
|
|
1948
1948
|
};
|
|
1949
1949
|
}
|
|
1950
1950
|
|
|
1951
|
+
function normalizeBridgeInput(input) {
|
|
1952
|
+
return input && typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
function buildBridgeRef(prefix, seed) {
|
|
1956
|
+
const stableSeed = canonicalize(seed);
|
|
1957
|
+
return `${prefix}.${sha256Hex(Buffer.from(stableSeed, "utf8")).slice(0, 16)}`;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
function payloadBufferFromBridgeInput(input) {
|
|
1961
|
+
const body = normalizeBridgeInput(input);
|
|
1962
|
+
if (typeof body.payload_bytes_hex === "string" && body.payload_bytes_hex.trim()) {
|
|
1963
|
+
const hex = body.payload_bytes_hex.trim().toLowerCase();
|
|
1964
|
+
if (!/^[a-f0-9]+$/.test(hex) || hex.length % 2 !== 0) {
|
|
1965
|
+
throw new Error("payload_bytes_hex_invalid");
|
|
1966
|
+
}
|
|
1967
|
+
return Buffer.from(hex, "hex");
|
|
1968
|
+
}
|
|
1969
|
+
if (typeof body.payload_base64 === "string" && body.payload_base64.trim()) {
|
|
1970
|
+
return Buffer.from(body.payload_base64, "base64");
|
|
1971
|
+
}
|
|
1972
|
+
if (typeof body.payload_utf8 === "string") {
|
|
1973
|
+
return Buffer.from(body.payload_utf8, "utf8");
|
|
1974
|
+
}
|
|
1975
|
+
if (typeof body.payload_ascii === "string") {
|
|
1976
|
+
return Buffer.from(body.payload_ascii, "ascii");
|
|
1977
|
+
}
|
|
1978
|
+
throw new Error("payload_required");
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
function verifyAnyCompatibilityReceipt(opreturnHex, payloadBytes) {
|
|
1982
|
+
const parsed = parseReceipt(opreturnHex);
|
|
1983
|
+
return parsed.spec_version === "v2"
|
|
1984
|
+
? verifyReceiptV2(opreturnHex, payloadBytes)
|
|
1985
|
+
: verifyReceipt(opreturnHex, payloadBytes);
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
function buildBridgeCenter() {
|
|
1989
|
+
return {
|
|
1990
|
+
center_ref: "proof-center.bridge",
|
|
1991
|
+
receipt_wrap_surface: "/v1/proof-center/bridge/receipt-wrap",
|
|
1992
|
+
validator_verify_surface: "/v1/proof-center/bridge/validator-verify",
|
|
1993
|
+
receipt_ledger_handoff_surface: "/v1/proof-center/bridge/receipt-ledger-handoff",
|
|
1994
|
+
operator_review_pack_surface: "/v1/proof-center/bridge/operator-review-pack",
|
|
1995
|
+
compatibility_pack_surface: "/v1/proof-center/bridge/compatibility-pack",
|
|
1996
|
+
supported_profiles: [
|
|
1997
|
+
"economic-receipt-profile-v1",
|
|
1998
|
+
"registry-profile-v1",
|
|
1999
|
+
"proof-envelope-v1"
|
|
2000
|
+
],
|
|
2001
|
+
supported_capabilities: [
|
|
2002
|
+
"receipt_wrap",
|
|
2003
|
+
"validator_compatible_verification",
|
|
2004
|
+
"receipt_ledger_handoff",
|
|
2005
|
+
"operator_review_packaging",
|
|
2006
|
+
"compatibility_packaging",
|
|
2007
|
+
"profile_carry"
|
|
2008
|
+
]
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
function summarizeBridgeCenter() {
|
|
2013
|
+
const center = buildBridgeCenter();
|
|
2014
|
+
return {
|
|
2015
|
+
center_ref: center.center_ref,
|
|
2016
|
+
capability_count: center.supported_capabilities.length,
|
|
2017
|
+
profile_count: center.supported_profiles.length,
|
|
2018
|
+
receipt_ledger_handoff_surface: center.receipt_ledger_handoff_surface,
|
|
2019
|
+
operator_review_pack_surface: center.operator_review_pack_surface
|
|
2020
|
+
};
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
function buildBridgeReceiptWrap(input) {
|
|
2024
|
+
const body = normalizeBridgeInput(input);
|
|
2025
|
+
const payloadBytes = payloadBufferFromBridgeInput(body);
|
|
2026
|
+
const identityMaterialHex = normalizeString(body.identity_material_hex);
|
|
2027
|
+
if (!identityMaterialHex) {
|
|
2028
|
+
throw new Error("identity_material_hex_required");
|
|
2029
|
+
}
|
|
2030
|
+
const typeHex = normalizeString(body.type_hex || TYPE_REGISTER) || TYPE_REGISTER;
|
|
2031
|
+
const contextHash12Hex = normalizeString(body.context_hash12_hex);
|
|
2032
|
+
const receipt = contextHash12Hex
|
|
2033
|
+
? createReceiptV2(identityMaterialHex, payloadBytes, contextHash12Hex, typeHex)
|
|
2034
|
+
: createReceipt(identityMaterialHex, payloadBytes, typeHex);
|
|
2035
|
+
const verification = verifyAnyCompatibilityReceipt(receipt.opreturn_hex, payloadBytes);
|
|
2036
|
+
return {
|
|
2037
|
+
ok: verification.valid === true,
|
|
2038
|
+
wrap_ref: buildBridgeRef("bridge.receipt-wrap", {
|
|
2039
|
+
receipt_ref: receipt.opreturn_hex,
|
|
2040
|
+
type_hex: typeHex,
|
|
2041
|
+
payload_hash: receipt.payload_hash
|
|
2042
|
+
}),
|
|
2043
|
+
receipt,
|
|
2044
|
+
verification,
|
|
2045
|
+
validator_verify_surface: "/v1/proof-center/bridge/validator-verify",
|
|
2046
|
+
receipt_inspect_surface: "/v1/receipts/inspect"
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
function summarizeBridgeValidatorVerify(input) {
|
|
2051
|
+
const body = normalizeBridgeInput(input);
|
|
2052
|
+
const opreturnHex = normalizeString(body.opreturn_hex).toLowerCase();
|
|
2053
|
+
if (!opreturnHex) {
|
|
2054
|
+
throw new Error("opreturn_hex_required");
|
|
2055
|
+
}
|
|
2056
|
+
const payloadBytes = payloadBufferFromBridgeInput(body);
|
|
2057
|
+
const verification = verifyAnyCompatibilityReceipt(opreturnHex, payloadBytes);
|
|
2058
|
+
return {
|
|
2059
|
+
...verification,
|
|
2060
|
+
validator_ref: buildBridgeRef("bridge.validator", {
|
|
2061
|
+
opreturn_hex: opreturnHex,
|
|
2062
|
+
payload_hash: sha256Hex(payloadBytes)
|
|
2063
|
+
}),
|
|
2064
|
+
verification_surface: "/validate",
|
|
2065
|
+
receipt_inspect_surface: "/v1/receipts/inspect"
|
|
2066
|
+
};
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
function buildReceiptLedgerBridgeHandoff(input) {
|
|
2070
|
+
const body = normalizeBridgeInput(input);
|
|
2071
|
+
const receiptRef = normalizeString(body.receipt_ref);
|
|
2072
|
+
const opreturnHex = normalizeString(body.opreturn_hex).toLowerCase();
|
|
2073
|
+
if (!receiptRef) throw new Error("receipt_ref_required");
|
|
2074
|
+
if (!opreturnHex) throw new Error("opreturn_hex_required");
|
|
2075
|
+
const payloadBytes = payloadBufferFromBridgeInput(body);
|
|
2076
|
+
const accountRef = normalizeString(body.account_ref);
|
|
2077
|
+
const usageReportRef = normalizeString(body.usage_report_ref);
|
|
2078
|
+
const meterProfileRef = normalizeString(body.meter_profile_ref);
|
|
2079
|
+
const ledgerEntryRef = normalizeString(body.ledger_entry_ref);
|
|
2080
|
+
const ledgerOperation = normalizeString(body.ledger_operation).toUpperCase();
|
|
2081
|
+
const unitsActual = Number(body.units_actual);
|
|
2082
|
+
const usageReport = body.usage_report && typeof body.usage_report === "object" && !Array.isArray(body.usage_report)
|
|
2083
|
+
? body.usage_report
|
|
2084
|
+
: null;
|
|
2085
|
+
const ledgerEntry = body.ledger_entry && typeof body.ledger_entry === "object" && !Array.isArray(body.ledger_entry)
|
|
2086
|
+
? body.ledger_entry
|
|
2087
|
+
: null;
|
|
2088
|
+
|
|
2089
|
+
if (!accountRef) throw new Error("account_ref_required");
|
|
2090
|
+
if (!usageReportRef) throw new Error("usage_report_ref_required");
|
|
2091
|
+
if (!meterProfileRef) throw new Error("meter_profile_ref_required");
|
|
2092
|
+
if (!ledgerEntryRef) throw new Error("ledger_entry_ref_required");
|
|
2093
|
+
if (!new Set(["RESERVE", "COMMIT", "RELEASE", "REVERSE"]).has(ledgerOperation)) {
|
|
2094
|
+
throw new Error("ledger_operation_invalid");
|
|
2095
|
+
}
|
|
2096
|
+
if (!Number.isInteger(unitsActual) || unitsActual <= 0) throw new Error("units_actual_invalid");
|
|
2097
|
+
if (!usageReport) throw new Error("usage_report_required");
|
|
2098
|
+
if (!ledgerEntry) throw new Error("ledger_entry_required");
|
|
2099
|
+
|
|
2100
|
+
const verification = verifyAnyCompatibilityReceipt(opreturnHex, payloadBytes);
|
|
2101
|
+
if (!verification.valid) {
|
|
2102
|
+
throw new Error(`invalid_receipt:${verification.reason || "invalid"}`);
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
if (usageReport.account_ref && normalizeString(usageReport.account_ref) !== accountRef) throw new Error("usage_report_account_mismatch");
|
|
2106
|
+
if (usageReport.units_actual != null && Number(usageReport.units_actual) !== unitsActual) throw new Error("usage_report_units_mismatch");
|
|
2107
|
+
if (ledgerEntry.account_ref && normalizeString(ledgerEntry.account_ref) !== accountRef) throw new Error("ledger_entry_account_mismatch");
|
|
2108
|
+
if (ledgerEntry.operation && normalizeString(ledgerEntry.operation).toUpperCase() !== ledgerOperation) throw new Error("ledger_entry_operation_mismatch");
|
|
2109
|
+
if (ledgerEntry.receipt_ref && normalizeString(ledgerEntry.receipt_ref) !== receiptRef) throw new Error("ledger_entry_receipt_mismatch");
|
|
2110
|
+
if (ledgerEntry.units != null && Math.abs(Number(ledgerEntry.units)) !== unitsActual) throw new Error("ledger_entry_units_mismatch");
|
|
2111
|
+
|
|
2112
|
+
const handoff = {
|
|
2113
|
+
mode: "xoonya-receipt-ledger-handoff-v1",
|
|
2114
|
+
generated_at_iso: new Date().toISOString(),
|
|
2115
|
+
proof_receipt: {
|
|
2116
|
+
receipt_ref: receiptRef,
|
|
2117
|
+
receipt_hash_sha256: sha256Hex(Buffer.from(opreturnHex, "hex")),
|
|
2118
|
+
receipt_version: verification.spec_version || "v1",
|
|
2119
|
+
opreturn_hex: opreturnHex,
|
|
2120
|
+
validation_result: {
|
|
2121
|
+
valid: verification.valid === true,
|
|
2122
|
+
reason: verification.reason || null
|
|
2123
|
+
},
|
|
2124
|
+
compliance_hash: verification.compliance_hash || null,
|
|
2125
|
+
agent_id: verification.agent_id || null
|
|
2126
|
+
},
|
|
2127
|
+
economics_context: {
|
|
2128
|
+
target_system: "xytara",
|
|
2129
|
+
account_ref: accountRef,
|
|
2130
|
+
usage_report_ref: usageReportRef,
|
|
2131
|
+
usage_report_hash: canonicalJsonSha256Hex(usageReport),
|
|
2132
|
+
usage_report: usageReport,
|
|
2133
|
+
meter_profile_ref: meterProfileRef,
|
|
2134
|
+
units_actual: unitsActual,
|
|
2135
|
+
ledger_operation: ledgerOperation,
|
|
2136
|
+
ledger_entry_ref: ledgerEntryRef,
|
|
2137
|
+
ledger_entry_hash: canonicalJsonSha256Hex(ledgerEntry),
|
|
2138
|
+
ledger_entry: ledgerEntry
|
|
2139
|
+
}
|
|
2140
|
+
};
|
|
2141
|
+
return {
|
|
2142
|
+
ok: true,
|
|
2143
|
+
handoff_ref: buildBridgeRef("bridge.receipt-ledger-handoff", handoff),
|
|
2144
|
+
handoff,
|
|
2145
|
+
next_surface: "/v1/proof-center/governance/interpretation-validate"
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
function buildBridgeOperatorReviewPack(input) {
|
|
2150
|
+
const body = normalizeBridgeInput(input);
|
|
2151
|
+
const sourceRef = normalizeString(body.source_ref || body.receipt_ref || "proof-bridge.source");
|
|
2152
|
+
const operatorPackRef = buildBridgeRef("bridge.operator-review-pack", {
|
|
2153
|
+
source_ref: sourceRef,
|
|
2154
|
+
account_ref: normalizeString(body.account_ref || "")
|
|
2155
|
+
});
|
|
2156
|
+
return {
|
|
2157
|
+
ok: true,
|
|
2158
|
+
operator_review_pack_ref: operatorPackRef,
|
|
2159
|
+
source_ref: sourceRef,
|
|
2160
|
+
included_sections: [
|
|
2161
|
+
"bridge_summary",
|
|
2162
|
+
"validator_verification",
|
|
2163
|
+
"profile_carry",
|
|
2164
|
+
"governance_review_link",
|
|
2165
|
+
"proof_run_link"
|
|
2166
|
+
],
|
|
2167
|
+
bridge_summary_surface: "/v1/proof-center/bridge/summary",
|
|
2168
|
+
validator_verify_surface: "/v1/proof-center/bridge/validator-verify",
|
|
2169
|
+
compatibility_pack_surface: "/v1/proof-center/bridge/compatibility-pack",
|
|
2170
|
+
governance_review_link_surface: "/v1/proof-center/governance/review-link",
|
|
2171
|
+
proof_run_surface: "/v1/proof-center/result-package-handoff/run"
|
|
2172
|
+
};
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
function buildBridgeCompatibilityPack(input) {
|
|
2176
|
+
const body = normalizeBridgeInput(input);
|
|
2177
|
+
return {
|
|
2178
|
+
ok: true,
|
|
2179
|
+
compatibility_pack_ref: buildBridgeRef("bridge.compatibility-pack", {
|
|
2180
|
+
source_ref: normalizeString(body.source_ref || body.receipt_ref || "proof-bridge.compatibility")
|
|
2181
|
+
}),
|
|
2182
|
+
preserved_routes: [
|
|
2183
|
+
"/validate",
|
|
2184
|
+
"/v1/receipts/inspect",
|
|
2185
|
+
"/v1/proofs/verify",
|
|
2186
|
+
"/v1/profiles/economic/verify",
|
|
2187
|
+
"/v1/profiles/registry/verify"
|
|
2188
|
+
],
|
|
2189
|
+
preserved_helpers: [
|
|
2190
|
+
"createReceipt",
|
|
2191
|
+
"verifyReceipt",
|
|
2192
|
+
"createReceiptV2",
|
|
2193
|
+
"verifyReceiptV2",
|
|
2194
|
+
"createProofEnvelopeV1",
|
|
2195
|
+
"verifyProofEnvelopeV1",
|
|
2196
|
+
"createEconomicReceiptProfileV1",
|
|
2197
|
+
"verifyEconomicReceiptProfileV1",
|
|
2198
|
+
"createRegistryProfileV1",
|
|
2199
|
+
"verifyRegistryProfileV1"
|
|
2200
|
+
],
|
|
2201
|
+
profile_versions: [
|
|
2202
|
+
"proof-envelope-v1",
|
|
2203
|
+
"economic-receipt-profile-v1",
|
|
2204
|
+
"registry-profile-v1"
|
|
2205
|
+
],
|
|
2206
|
+
posture: "compatibility_support_preserved_for_bridge_and_validator_alignment"
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
function buildBridgeProfileSupport() {
|
|
2211
|
+
return {
|
|
2212
|
+
support_ref: "bridge.profile-support",
|
|
2213
|
+
proof_profile_versions: [
|
|
2214
|
+
"proof-envelope-v1",
|
|
2215
|
+
"economic-receipt-profile-v1",
|
|
2216
|
+
"registry-profile-v1"
|
|
2217
|
+
],
|
|
2218
|
+
payload_profile_examples: [
|
|
2219
|
+
"AgentProfile-v1",
|
|
2220
|
+
"CapabilitiesProfile-v1",
|
|
2221
|
+
"SessionProfile-v1",
|
|
2222
|
+
"AttestationProfile-v1"
|
|
2223
|
+
],
|
|
2224
|
+
interoperability_notes: [
|
|
2225
|
+
"profiles_extend_proof_context_without_mutating_core_receipt_shape",
|
|
2226
|
+
"resolver_behavior_remains_part_of_interoperability_posture",
|
|
2227
|
+
"bridge_support_packages_are_operator_exports_not_new_protocol_layers"
|
|
2228
|
+
],
|
|
2229
|
+
verification_surfaces: [
|
|
2230
|
+
"/v1/proofs/verify",
|
|
2231
|
+
"/v1/profiles/economic/verify",
|
|
2232
|
+
"/v1/profiles/registry/verify"
|
|
2233
|
+
]
|
|
2234
|
+
};
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
function buildBridgeWorkflowPack(input) {
|
|
2238
|
+
const operatorReviewPack = buildBridgeOperatorReviewPack(input);
|
|
2239
|
+
const compatibilityPack = buildBridgeCompatibilityPack(input);
|
|
2240
|
+
return {
|
|
2241
|
+
ok: true,
|
|
2242
|
+
workflow_pack_ref: buildBridgeRef("bridge.workflow-pack", {
|
|
2243
|
+
operator_review_pack_ref: operatorReviewPack.operator_review_pack_ref,
|
|
2244
|
+
compatibility_pack_ref: compatibilityPack.compatibility_pack_ref
|
|
2245
|
+
}),
|
|
2246
|
+
refs: {
|
|
2247
|
+
operator_review_pack_ref: operatorReviewPack.operator_review_pack_ref,
|
|
2248
|
+
compatibility_pack_ref: compatibilityPack.compatibility_pack_ref
|
|
2249
|
+
},
|
|
2250
|
+
workflow_steps: [
|
|
2251
|
+
"receipt_wrap_or_receive",
|
|
2252
|
+
"validator_verify",
|
|
2253
|
+
"inspect_profile_support",
|
|
2254
|
+
"review_operator_pack",
|
|
2255
|
+
"handoff_or_run"
|
|
2256
|
+
],
|
|
2257
|
+
guidance: [
|
|
2258
|
+
"use_bridge_support_packs_for_portable_review_and_export",
|
|
2259
|
+
"keep_public_proof_center_as_the_canonical_runtime_surface"
|
|
2260
|
+
]
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
function buildBridgeAdminPack(input) {
|
|
2265
|
+
const workflowPack = buildBridgeWorkflowPack(input);
|
|
2266
|
+
const profileSupport = buildBridgeProfileSupport();
|
|
2267
|
+
return {
|
|
2268
|
+
ok: true,
|
|
2269
|
+
admin_pack_ref: buildBridgeRef("bridge.admin-pack", {
|
|
2270
|
+
workflow_pack_ref: workflowPack.workflow_pack_ref,
|
|
2271
|
+
support_ref: profileSupport.support_ref
|
|
2272
|
+
}),
|
|
2273
|
+
operator_refs: {
|
|
2274
|
+
workflow_pack_ref: workflowPack.workflow_pack_ref,
|
|
2275
|
+
operator_review_pack_ref: workflowPack.refs.operator_review_pack_ref,
|
|
2276
|
+
compatibility_pack_ref: workflowPack.refs.compatibility_pack_ref
|
|
2277
|
+
},
|
|
2278
|
+
governance_refs: {
|
|
2279
|
+
governance_dashboard_surface: "/v1/proof-center/governance/dashboard",
|
|
2280
|
+
governance_review_link_surface: "/v1/proof-center/governance/review-link"
|
|
2281
|
+
},
|
|
2282
|
+
proof_refs: {
|
|
2283
|
+
profile_support_ref: profileSupport.support_ref,
|
|
2284
|
+
proof_run_surface: "/v1/proof-center/result-package-handoff/run"
|
|
2285
|
+
},
|
|
2286
|
+
notes: [
|
|
2287
|
+
"admin_pack_is_a_portable_operator_export",
|
|
2288
|
+
"admin_pack_does_not_mutate_proof_or_profile_semantics"
|
|
2289
|
+
]
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
function buildGovernanceCenter() {
|
|
2294
|
+
return {
|
|
2295
|
+
center_ref: "proof-center.governance",
|
|
2296
|
+
interpretation_surface: "/v1/proof-center/governance/interpretation-validate",
|
|
2297
|
+
coordination_surface: "/v1/proof-center/governance/coordination",
|
|
2298
|
+
dashboard_surface: "/v1/proof-center/governance/dashboard",
|
|
2299
|
+
operator_view_surface: "/v1/proof-center/governance/operator-view",
|
|
2300
|
+
admin_view_surface: "/v1/proof-center/governance/admin-view",
|
|
2301
|
+
dispute_summary_surface: "/v1/proof-center/governance/disputes/summary",
|
|
2302
|
+
dispute_action_surface: "/v1/proof-center/governance/disputes/action",
|
|
2303
|
+
dispute_resolution_pack_surface: "/v1/proof-center/governance/disputes/resolution-pack",
|
|
2304
|
+
review_link_surface: "/v1/proof-center/governance/review-link",
|
|
2305
|
+
handoff_bundle_surface: "/v1/proof-center/governance/handoff-bundle",
|
|
2306
|
+
supported_capabilities: [
|
|
2307
|
+
"interpretation_validation",
|
|
2308
|
+
"governance_coordination",
|
|
2309
|
+
"dashboard_summary",
|
|
2310
|
+
"operator_view",
|
|
2311
|
+
"admin_view",
|
|
2312
|
+
"workflow_packaging",
|
|
2313
|
+
"signoff_packaging",
|
|
2314
|
+
"dispute_review",
|
|
2315
|
+
"dispute_resolution_packaging",
|
|
2316
|
+
"review_linkage",
|
|
2317
|
+
"operator_handoff_bundle"
|
|
2318
|
+
]
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
function summarizeGovernanceCenter() {
|
|
2323
|
+
const center = buildGovernanceCenter();
|
|
2324
|
+
return {
|
|
2325
|
+
center_ref: center.center_ref,
|
|
2326
|
+
capability_count: center.supported_capabilities.length,
|
|
2327
|
+
dashboard_surface: center.dashboard_surface,
|
|
2328
|
+
dispute_summary_surface: center.dispute_summary_surface,
|
|
2329
|
+
review_link_surface: center.review_link_surface,
|
|
2330
|
+
handoff_bundle_surface: center.handoff_bundle_surface
|
|
2331
|
+
};
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
function normalizeGovernanceInput(input) {
|
|
2335
|
+
return input && typeof input === "object" && !Array.isArray(input) ? input : {};
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
function buildGovernanceRef(prefix, seed) {
|
|
2339
|
+
const stableSeed = canonicalize(seed);
|
|
2340
|
+
return `${prefix}.${sha256Hex(Buffer.from(stableSeed, "utf8")).slice(0, 16)}`;
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
function validateGovernanceInterpretation(input) {
|
|
2344
|
+
const body = normalizeGovernanceInput(input);
|
|
2345
|
+
const sourceRef = normalizeString(body.source_ref || body.result_package_ref || body.receipt_ref || "governance.source");
|
|
2346
|
+
const interpretationRef = buildGovernanceRef("governance.interpretation", {
|
|
2347
|
+
source_ref: sourceRef,
|
|
2348
|
+
case_ref: normalizeString(body.case_ref || ""),
|
|
2349
|
+
interpretation_context: body.interpretation_context || null
|
|
2350
|
+
});
|
|
2351
|
+
return {
|
|
2352
|
+
ok: true,
|
|
2353
|
+
interpretation_ref: interpretationRef,
|
|
2354
|
+
source_ref: sourceRef,
|
|
2355
|
+
interpretation_status: "validated",
|
|
2356
|
+
accepted_inputs: [
|
|
2357
|
+
"result_package_ref",
|
|
2358
|
+
"receipt_ref",
|
|
2359
|
+
"case_ref"
|
|
2360
|
+
],
|
|
2361
|
+
next_surface: "/v1/proof-center/governance/coordination"
|
|
2362
|
+
};
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
function emitGovernanceCoordination(input) {
|
|
2366
|
+
const interpretation = validateGovernanceInterpretation(input);
|
|
2367
|
+
return {
|
|
2368
|
+
ok: interpretation.ok,
|
|
2369
|
+
interpretation_ref: interpretation.interpretation_ref,
|
|
2370
|
+
coordination_ref: buildGovernanceRef("governance.coordination", {
|
|
2371
|
+
interpretation_ref: interpretation.interpretation_ref,
|
|
2372
|
+
source_ref: interpretation.source_ref
|
|
2373
|
+
}),
|
|
2374
|
+
coordination_status: "ready",
|
|
2375
|
+
coordination_surfaces: [
|
|
2376
|
+
"/v1/proof-center/governance/workflow-pack",
|
|
2377
|
+
"/v1/proof-center/governance/signoff-pack",
|
|
2378
|
+
"/v1/proof-center/governance/handoff-bundle"
|
|
2379
|
+
],
|
|
2380
|
+
next_surface: "/v1/proof-center/result-package-handoff/run"
|
|
2381
|
+
};
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
function summarizeGovernanceDashboard(input) {
|
|
2385
|
+
const body = normalizeGovernanceInput(input);
|
|
2386
|
+
const accountRef = normalizeString(body.account_ref || body.operator_ref || "governance.account");
|
|
2387
|
+
const dashboardRef = buildGovernanceRef("governance.dashboard", {
|
|
2388
|
+
account_ref: accountRef,
|
|
2389
|
+
queue_scope: normalizeString(body.queue_scope || "default")
|
|
2390
|
+
});
|
|
2391
|
+
const reviewCount = Number.isFinite(body.review_count) ? body.review_count : 3;
|
|
2392
|
+
const disputeCount = Number.isFinite(body.dispute_count) ? body.dispute_count : 1;
|
|
2393
|
+
return {
|
|
2394
|
+
ok: true,
|
|
2395
|
+
dashboard_ref: dashboardRef,
|
|
2396
|
+
account_ref: accountRef,
|
|
2397
|
+
queue_summary: {
|
|
2398
|
+
review_count: reviewCount,
|
|
2399
|
+
dispute_count: disputeCount,
|
|
2400
|
+
signoff_ready_count: Number.isFinite(body.signoff_ready_count) ? body.signoff_ready_count : 1
|
|
2401
|
+
},
|
|
2402
|
+
proof_linkage: {
|
|
2403
|
+
review_summary_surface: "/v1/proof-center/result-package-handoff/review/summary",
|
|
2404
|
+
handoff_run_surface: "/v1/proof-center/result-package-handoff/review/handoff-run"
|
|
2405
|
+
},
|
|
2406
|
+
dashboard_pack_surface: "/v1/proof-center/governance/dashboard-pack",
|
|
2407
|
+
workflow_pack_surface: "/v1/proof-center/governance/workflow-pack",
|
|
2408
|
+
signoff_pack_surface: "/v1/proof-center/governance/signoff-pack"
|
|
2409
|
+
};
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
function summarizeGovernanceOperatorView(input) {
|
|
2413
|
+
const dashboard = summarizeGovernanceDashboard(input);
|
|
2414
|
+
return {
|
|
2415
|
+
ok: dashboard.ok,
|
|
2416
|
+
operator_view_ref: buildGovernanceRef("governance.operator-view", dashboard),
|
|
2417
|
+
dashboard_ref: dashboard.dashboard_ref,
|
|
2418
|
+
queue_summary: dashboard.queue_summary,
|
|
2419
|
+
attention_refs: [
|
|
2420
|
+
"governance.review.queue",
|
|
2421
|
+
"governance.dispute.queue",
|
|
2422
|
+
"governance.signoff.queue"
|
|
2423
|
+
],
|
|
2424
|
+
dashboard_pack_surface: dashboard.dashboard_pack_surface,
|
|
2425
|
+
review_link_surface: "/v1/proof-center/governance/review-link"
|
|
2426
|
+
};
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
function summarizeGovernanceAdminView(input) {
|
|
2430
|
+
const operatorView = summarizeGovernanceOperatorView(input);
|
|
2431
|
+
return {
|
|
2432
|
+
ok: operatorView.ok,
|
|
2433
|
+
admin_view_ref: buildGovernanceRef("governance.admin-view", operatorView),
|
|
2434
|
+
operator_view_ref: operatorView.operator_view_ref,
|
|
2435
|
+
oversight_summary: {
|
|
2436
|
+
queue_count: 3,
|
|
2437
|
+
escalation_ready_count: 1,
|
|
2438
|
+
signoff_ready_count: operatorView.queue_summary.signoff_ready_count
|
|
2439
|
+
},
|
|
2440
|
+
workflow_pack_surface: "/v1/proof-center/governance/workflow-pack",
|
|
2441
|
+
signoff_pack_surface: "/v1/proof-center/governance/signoff-pack"
|
|
2442
|
+
};
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
function buildGovernanceDashboardPack(input) {
|
|
2446
|
+
const dashboard = summarizeGovernanceDashboard(input);
|
|
2447
|
+
return {
|
|
2448
|
+
ok: dashboard.ok,
|
|
2449
|
+
dashboard_ref: dashboard.dashboard_ref,
|
|
2450
|
+
pack_ref: buildGovernanceRef("governance.dashboard-pack", dashboard),
|
|
2451
|
+
included_sections: [
|
|
2452
|
+
"queue_summary",
|
|
2453
|
+
"workflow_refs",
|
|
2454
|
+
"signoff_refs"
|
|
2455
|
+
]
|
|
2456
|
+
};
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
function buildGovernanceWorkflowPack(input) {
|
|
2460
|
+
const coordination = emitGovernanceCoordination(input);
|
|
2461
|
+
return {
|
|
2462
|
+
ok: coordination.ok,
|
|
2463
|
+
coordination_ref: coordination.coordination_ref,
|
|
2464
|
+
workflow_pack_ref: buildGovernanceRef("governance.workflow-pack", coordination),
|
|
2465
|
+
included_sections: [
|
|
2466
|
+
"interpretation_status",
|
|
2467
|
+
"coordination_status",
|
|
2468
|
+
"next_surfaces",
|
|
2469
|
+
"review_linkage"
|
|
2470
|
+
],
|
|
2471
|
+
review_summary_surface: "/v1/proof-center/result-package-handoff/review/summary",
|
|
2472
|
+
handoff_run_surface: "/v1/proof-center/result-package-handoff/review/handoff-run"
|
|
2473
|
+
};
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
function buildGovernanceSignoffPack(input) {
|
|
2477
|
+
const dashboard = summarizeGovernanceDashboard(input);
|
|
2478
|
+
return {
|
|
2479
|
+
ok: dashboard.ok,
|
|
2480
|
+
dashboard_ref: dashboard.dashboard_ref,
|
|
2481
|
+
signoff_pack_ref: buildGovernanceRef("governance.signoff-pack", dashboard),
|
|
2482
|
+
signoff_status: "review_ready",
|
|
2483
|
+
included_sections: [
|
|
2484
|
+
"queue_summary",
|
|
2485
|
+
"signoff_ready_refs",
|
|
2486
|
+
"review_linkage"
|
|
2487
|
+
],
|
|
2488
|
+
review_link_surface: "/v1/proof-center/governance/review-link"
|
|
2489
|
+
};
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
function summarizeGovernanceDisputes(input) {
|
|
2493
|
+
const body = normalizeGovernanceInput(input);
|
|
2494
|
+
const queueRef = buildGovernanceRef("governance.disputes", {
|
|
2495
|
+
account_ref: normalizeString(body.account_ref || ""),
|
|
2496
|
+
dispute_scope: normalizeString(body.dispute_scope || "default")
|
|
2497
|
+
});
|
|
2498
|
+
const caseCount = Number.isFinite(body.case_count) ? body.case_count : 2;
|
|
2499
|
+
return {
|
|
2500
|
+
ok: true,
|
|
2501
|
+
dispute_queue_ref: queueRef,
|
|
2502
|
+
case_count: caseCount,
|
|
2503
|
+
open_case_count: Number.isFinite(body.open_case_count) ? body.open_case_count : Math.max(caseCount - 1, 1),
|
|
2504
|
+
case_review_surface: "/v1/proof-center/governance/disputes/case-review",
|
|
2505
|
+
case_bundle_surface: "/v1/proof-center/governance/disputes/case-bundle"
|
|
2506
|
+
};
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
function reviewGovernanceCase(input) {
|
|
2510
|
+
const body = normalizeGovernanceInput(input);
|
|
2511
|
+
const caseRef = normalizeString(body.case_ref || body.dispute_id || "governance.case");
|
|
2512
|
+
return {
|
|
2513
|
+
ok: true,
|
|
2514
|
+
case_ref: caseRef,
|
|
2515
|
+
review_ref: buildGovernanceRef("governance.case-review", {
|
|
2516
|
+
case_ref: caseRef,
|
|
2517
|
+
source_ref: normalizeString(body.source_ref || "")
|
|
2518
|
+
}),
|
|
2519
|
+
review_status: "triaged",
|
|
2520
|
+
available_actions: [
|
|
2521
|
+
"handoff",
|
|
2522
|
+
"resolve",
|
|
2523
|
+
"dismiss"
|
|
2524
|
+
],
|
|
2525
|
+
resolution_pack_surface: "/v1/proof-center/governance/disputes/resolution-pack",
|
|
2526
|
+
case_bundle_surface: "/v1/proof-center/governance/disputes/case-bundle"
|
|
2527
|
+
};
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
function summarizeGovernanceDisputeAction(input) {
|
|
2531
|
+
const review = reviewGovernanceCase(input);
|
|
2532
|
+
const body = normalizeGovernanceInput(input);
|
|
2533
|
+
const requestedAction = normalizeString(body.action || "handoff");
|
|
2534
|
+
const allowedActions = new Set(review.available_actions);
|
|
2535
|
+
const action = allowedActions.has(requestedAction) ? requestedAction : "handoff";
|
|
2536
|
+
return {
|
|
2537
|
+
ok: true,
|
|
2538
|
+
case_ref: review.case_ref,
|
|
2539
|
+
action_ref: buildGovernanceRef("governance.dispute-action", {
|
|
2540
|
+
case_ref: review.case_ref,
|
|
2541
|
+
action
|
|
2542
|
+
}),
|
|
2543
|
+
action,
|
|
2544
|
+
action_status: "recorded",
|
|
2545
|
+
next_surface: action === "handoff"
|
|
2546
|
+
? "/v1/proof-center/governance/handoff-bundle"
|
|
2547
|
+
: "/v1/proof-center/governance/disputes/resolution-pack"
|
|
2548
|
+
};
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
function buildGovernanceCaseBundle(input) {
|
|
2552
|
+
const review = reviewGovernanceCase(input);
|
|
2553
|
+
return {
|
|
2554
|
+
ok: review.ok,
|
|
2555
|
+
case_ref: review.case_ref,
|
|
2556
|
+
case_bundle_ref: buildGovernanceRef("governance.case-bundle", review),
|
|
2557
|
+
included_sections: [
|
|
2558
|
+
"review_status",
|
|
2559
|
+
"available_actions",
|
|
2560
|
+
"handoff_refs"
|
|
2561
|
+
],
|
|
2562
|
+
resolution_pack_surface: review.resolution_pack_surface
|
|
2563
|
+
};
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
function buildGovernanceResolutionPack(input) {
|
|
2567
|
+
const action = summarizeGovernanceDisputeAction(input);
|
|
2568
|
+
return {
|
|
2569
|
+
ok: action.ok,
|
|
2570
|
+
case_ref: action.case_ref,
|
|
2571
|
+
resolution_pack_ref: buildGovernanceRef("governance.resolution-pack", action),
|
|
2572
|
+
action_ref: action.action_ref,
|
|
2573
|
+
resolution_status: action.action === "dismiss" ? "dismissed" : "resolved_or_handoff_ready",
|
|
2574
|
+
included_sections: [
|
|
2575
|
+
"action_status",
|
|
2576
|
+
"case_resolution_refs",
|
|
2577
|
+
"next_surface"
|
|
2578
|
+
]
|
|
2579
|
+
};
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
function buildGovernanceConsolePack(input) {
|
|
2583
|
+
const dashboard = summarizeGovernanceDashboard(input);
|
|
2584
|
+
const disputes = summarizeGovernanceDisputes(input);
|
|
2585
|
+
return {
|
|
2586
|
+
ok: true,
|
|
2587
|
+
console_pack_ref: buildGovernanceRef("governance.console-pack", {
|
|
2588
|
+
dashboard_ref: dashboard.dashboard_ref,
|
|
2589
|
+
dispute_queue_ref: disputes.dispute_queue_ref
|
|
2590
|
+
}),
|
|
2591
|
+
dashboard_ref: dashboard.dashboard_ref,
|
|
2592
|
+
dispute_queue_ref: disputes.dispute_queue_ref,
|
|
2593
|
+
included_sections: [
|
|
2594
|
+
"dashboard",
|
|
2595
|
+
"workflow",
|
|
2596
|
+
"disputes"
|
|
2597
|
+
]
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
function buildGovernanceHandoffBundle(input) {
|
|
2602
|
+
const coordination = emitGovernanceCoordination(input);
|
|
2603
|
+
const disputes = summarizeGovernanceDisputes(input);
|
|
2604
|
+
return {
|
|
2605
|
+
ok: true,
|
|
2606
|
+
handoff_bundle_ref: buildGovernanceRef("governance.handoff-bundle", {
|
|
2607
|
+
coordination_ref: coordination.coordination_ref,
|
|
2608
|
+
dispute_queue_ref: disputes.dispute_queue_ref
|
|
2609
|
+
}),
|
|
2610
|
+
coordination_ref: coordination.coordination_ref,
|
|
2611
|
+
dispute_queue_ref: disputes.dispute_queue_ref,
|
|
2612
|
+
review_summary_surface: "/v1/proof-center/result-package-handoff/review/summary",
|
|
2613
|
+
handoff_run_surface: "/v1/proof-center/result-package-handoff/review/handoff-run",
|
|
2614
|
+
next_surface: "/v1/proof-center/result-package-handoff/run",
|
|
2615
|
+
included_sections: [
|
|
2616
|
+
"coordination",
|
|
2617
|
+
"dispute_summary",
|
|
2618
|
+
"operator_handoff_refs",
|
|
2619
|
+
"review_linkage"
|
|
2620
|
+
]
|
|
2621
|
+
};
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
function summarizeGovernanceReviewLink(input) {
|
|
2625
|
+
const coordination = emitGovernanceCoordination(input);
|
|
2626
|
+
return {
|
|
2627
|
+
ok: coordination.ok,
|
|
2628
|
+
coordination_ref: coordination.coordination_ref,
|
|
2629
|
+
review_link_ref: buildGovernanceRef("governance.review-link", coordination),
|
|
2630
|
+
review_summary_surface: "/v1/proof-center/result-package-handoff/review/summary",
|
|
2631
|
+
handoff_run_surface: "/v1/proof-center/result-package-handoff/review/handoff-run",
|
|
2632
|
+
run_surface: "/v1/proof-center/result-package-handoff/run"
|
|
2633
|
+
};
|
|
2634
|
+
}
|
|
2635
|
+
|
|
1951
2636
|
function runDefaultProofLoop(loopRef, input) {
|
|
1952
2637
|
const loop = getDefaultProofLoop(loopRef);
|
|
1953
2638
|
if (!loop) {
|
|
@@ -1988,6 +2673,34 @@ function runDefaultProofLoop(loopRef, input) {
|
|
|
1988
2673
|
}
|
|
1989
2674
|
|
|
1990
2675
|
module.exports = {
|
|
2676
|
+
buildBridgeCenter,
|
|
2677
|
+
summarizeBridgeCenter,
|
|
2678
|
+
buildBridgeReceiptWrap,
|
|
2679
|
+
summarizeBridgeValidatorVerify,
|
|
2680
|
+
buildReceiptLedgerBridgeHandoff,
|
|
2681
|
+
buildBridgeOperatorReviewPack,
|
|
2682
|
+
buildBridgeCompatibilityPack,
|
|
2683
|
+
buildBridgeProfileSupport,
|
|
2684
|
+
buildBridgeWorkflowPack,
|
|
2685
|
+
buildBridgeAdminPack,
|
|
2686
|
+
buildGovernanceCenter,
|
|
2687
|
+
summarizeGovernanceCenter,
|
|
2688
|
+
validateGovernanceInterpretation,
|
|
2689
|
+
emitGovernanceCoordination,
|
|
2690
|
+
summarizeGovernanceDashboard,
|
|
2691
|
+
summarizeGovernanceOperatorView,
|
|
2692
|
+
summarizeGovernanceAdminView,
|
|
2693
|
+
buildGovernanceDashboardPack,
|
|
2694
|
+
buildGovernanceWorkflowPack,
|
|
2695
|
+
buildGovernanceSignoffPack,
|
|
2696
|
+
summarizeGovernanceDisputes,
|
|
2697
|
+
reviewGovernanceCase,
|
|
2698
|
+
summarizeGovernanceDisputeAction,
|
|
2699
|
+
buildGovernanceCaseBundle,
|
|
2700
|
+
buildGovernanceResolutionPack,
|
|
2701
|
+
buildGovernanceConsolePack,
|
|
2702
|
+
buildGovernanceHandoffBundle,
|
|
2703
|
+
summarizeGovernanceReviewLink,
|
|
1991
2704
|
buildDefaultProofCenter,
|
|
1992
2705
|
buildDefaultProofLoopCatalog,
|
|
1993
2706
|
buildDefaultProofLoops,
|
package/server.js
CHANGED
|
@@ -127,6 +127,31 @@ async function routeRequest(req, res) {
|
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
if (req.method === 'GET' && url.pathname === '/v1/proof-center/governance') {
|
|
131
|
+
sendJson(res, 200, proofSdk.buildGovernanceCenter());
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (req.method === 'GET' && url.pathname === '/v1/proof-center/governance/summary') {
|
|
136
|
+
sendJson(res, 200, proofSdk.summarizeGovernanceCenter());
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (req.method === 'GET' && url.pathname === '/v1/proof-center/bridge') {
|
|
141
|
+
sendJson(res, 200, proofSdk.buildBridgeCenter());
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (req.method === 'GET' && url.pathname === '/v1/proof-center/bridge/summary') {
|
|
146
|
+
sendJson(res, 200, proofSdk.summarizeBridgeCenter());
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (req.method === 'GET' && url.pathname === '/v1/proof-center/bridge/profile-support') {
|
|
151
|
+
sendJson(res, 200, proofSdk.buildBridgeProfileSupport());
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
130
155
|
if (req.method === 'GET' && url.pathname === '/v1/proof-center/default-loop') {
|
|
131
156
|
const loop = proofSdk.getDefaultProofLoop(url.searchParams.get('ref'));
|
|
132
157
|
if (!loop) {
|
|
@@ -660,6 +685,259 @@ async function routeRequest(req, res) {
|
|
|
660
685
|
return;
|
|
661
686
|
}
|
|
662
687
|
|
|
688
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/interpretation-validate') {
|
|
689
|
+
try {
|
|
690
|
+
const body = await readJsonBody(req);
|
|
691
|
+
const result = proofSdk.validateGovernanceInterpretation(body);
|
|
692
|
+
sendJson(res, 200, result);
|
|
693
|
+
} catch (error) {
|
|
694
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
695
|
+
}
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/coordination') {
|
|
700
|
+
try {
|
|
701
|
+
const body = await readJsonBody(req);
|
|
702
|
+
const result = proofSdk.emitGovernanceCoordination(body);
|
|
703
|
+
sendJson(res, 200, result);
|
|
704
|
+
} catch (error) {
|
|
705
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
706
|
+
}
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/dashboard') {
|
|
711
|
+
try {
|
|
712
|
+
const body = await readJsonBody(req);
|
|
713
|
+
const result = proofSdk.summarizeGovernanceDashboard(body);
|
|
714
|
+
sendJson(res, 200, result);
|
|
715
|
+
} catch (error) {
|
|
716
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
717
|
+
}
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/operator-view') {
|
|
722
|
+
try {
|
|
723
|
+
const body = await readJsonBody(req);
|
|
724
|
+
const result = proofSdk.summarizeGovernanceOperatorView(body);
|
|
725
|
+
sendJson(res, 200, result);
|
|
726
|
+
} catch (error) {
|
|
727
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
728
|
+
}
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/admin-view') {
|
|
733
|
+
try {
|
|
734
|
+
const body = await readJsonBody(req);
|
|
735
|
+
const result = proofSdk.summarizeGovernanceAdminView(body);
|
|
736
|
+
sendJson(res, 200, result);
|
|
737
|
+
} catch (error) {
|
|
738
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
739
|
+
}
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/dashboard-pack') {
|
|
744
|
+
try {
|
|
745
|
+
const body = await readJsonBody(req);
|
|
746
|
+
const result = proofSdk.buildGovernanceDashboardPack(body);
|
|
747
|
+
sendJson(res, 200, result);
|
|
748
|
+
} catch (error) {
|
|
749
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
750
|
+
}
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/workflow-pack') {
|
|
755
|
+
try {
|
|
756
|
+
const body = await readJsonBody(req);
|
|
757
|
+
const result = proofSdk.buildGovernanceWorkflowPack(body);
|
|
758
|
+
sendJson(res, 200, result);
|
|
759
|
+
} catch (error) {
|
|
760
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
761
|
+
}
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/signoff-pack') {
|
|
766
|
+
try {
|
|
767
|
+
const body = await readJsonBody(req);
|
|
768
|
+
const result = proofSdk.buildGovernanceSignoffPack(body);
|
|
769
|
+
sendJson(res, 200, result);
|
|
770
|
+
} catch (error) {
|
|
771
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
772
|
+
}
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/disputes/summary') {
|
|
777
|
+
try {
|
|
778
|
+
const body = await readJsonBody(req);
|
|
779
|
+
const result = proofSdk.summarizeGovernanceDisputes(body);
|
|
780
|
+
sendJson(res, 200, result);
|
|
781
|
+
} catch (error) {
|
|
782
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
783
|
+
}
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/disputes/case-review') {
|
|
788
|
+
try {
|
|
789
|
+
const body = await readJsonBody(req);
|
|
790
|
+
const result = proofSdk.reviewGovernanceCase(body);
|
|
791
|
+
sendJson(res, 200, result);
|
|
792
|
+
} catch (error) {
|
|
793
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
794
|
+
}
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/disputes/action') {
|
|
799
|
+
try {
|
|
800
|
+
const body = await readJsonBody(req);
|
|
801
|
+
const result = proofSdk.summarizeGovernanceDisputeAction(body);
|
|
802
|
+
sendJson(res, 200, result);
|
|
803
|
+
} catch (error) {
|
|
804
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
805
|
+
}
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/disputes/case-bundle') {
|
|
810
|
+
try {
|
|
811
|
+
const body = await readJsonBody(req);
|
|
812
|
+
const result = proofSdk.buildGovernanceCaseBundle(body);
|
|
813
|
+
sendJson(res, 200, result);
|
|
814
|
+
} catch (error) {
|
|
815
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
816
|
+
}
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/disputes/resolution-pack') {
|
|
821
|
+
try {
|
|
822
|
+
const body = await readJsonBody(req);
|
|
823
|
+
const result = proofSdk.buildGovernanceResolutionPack(body);
|
|
824
|
+
sendJson(res, 200, result);
|
|
825
|
+
} catch (error) {
|
|
826
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
827
|
+
}
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/console-pack') {
|
|
832
|
+
try {
|
|
833
|
+
const body = await readJsonBody(req);
|
|
834
|
+
const result = proofSdk.buildGovernanceConsolePack(body);
|
|
835
|
+
sendJson(res, 200, result);
|
|
836
|
+
} catch (error) {
|
|
837
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
838
|
+
}
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/handoff-bundle') {
|
|
843
|
+
try {
|
|
844
|
+
const body = await readJsonBody(req);
|
|
845
|
+
const result = proofSdk.buildGovernanceHandoffBundle(body);
|
|
846
|
+
sendJson(res, 200, result);
|
|
847
|
+
} catch (error) {
|
|
848
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
849
|
+
}
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/governance/review-link') {
|
|
854
|
+
try {
|
|
855
|
+
const body = await readJsonBody(req);
|
|
856
|
+
const result = proofSdk.summarizeGovernanceReviewLink(body);
|
|
857
|
+
sendJson(res, 200, result);
|
|
858
|
+
} catch (error) {
|
|
859
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
860
|
+
}
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/bridge/receipt-wrap') {
|
|
865
|
+
try {
|
|
866
|
+
const body = await readJsonBody(req);
|
|
867
|
+
const result = proofSdk.buildBridgeReceiptWrap(body);
|
|
868
|
+
sendJson(res, 200, result);
|
|
869
|
+
} catch (error) {
|
|
870
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
871
|
+
}
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/bridge/validator-verify') {
|
|
876
|
+
try {
|
|
877
|
+
const body = await readJsonBody(req);
|
|
878
|
+
const result = proofSdk.summarizeBridgeValidatorVerify(body);
|
|
879
|
+
sendJson(res, 200, result);
|
|
880
|
+
} catch (error) {
|
|
881
|
+
sendJson(res, 400, { valid: false, reason: error.message });
|
|
882
|
+
}
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/bridge/receipt-ledger-handoff') {
|
|
887
|
+
try {
|
|
888
|
+
const body = await readJsonBody(req);
|
|
889
|
+
const result = proofSdk.buildReceiptLedgerBridgeHandoff(body);
|
|
890
|
+
sendJson(res, 200, result);
|
|
891
|
+
} catch (error) {
|
|
892
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
893
|
+
}
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/bridge/operator-review-pack') {
|
|
898
|
+
try {
|
|
899
|
+
const body = await readJsonBody(req);
|
|
900
|
+
const result = proofSdk.buildBridgeOperatorReviewPack(body);
|
|
901
|
+
sendJson(res, 200, result);
|
|
902
|
+
} catch (error) {
|
|
903
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
904
|
+
}
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/bridge/compatibility-pack') {
|
|
909
|
+
try {
|
|
910
|
+
const body = await readJsonBody(req);
|
|
911
|
+
const result = proofSdk.buildBridgeCompatibilityPack(body);
|
|
912
|
+
sendJson(res, 200, result);
|
|
913
|
+
} catch (error) {
|
|
914
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
915
|
+
}
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/bridge/workflow-pack') {
|
|
920
|
+
try {
|
|
921
|
+
const body = await readJsonBody(req);
|
|
922
|
+
const result = proofSdk.buildBridgeWorkflowPack(body);
|
|
923
|
+
sendJson(res, 200, result);
|
|
924
|
+
} catch (error) {
|
|
925
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
926
|
+
}
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
if (req.method === 'POST' && url.pathname === '/v1/proof-center/bridge/admin-pack') {
|
|
931
|
+
try {
|
|
932
|
+
const body = await readJsonBody(req);
|
|
933
|
+
const result = proofSdk.buildBridgeAdminPack(body);
|
|
934
|
+
sendJson(res, 200, result);
|
|
935
|
+
} catch (error) {
|
|
936
|
+
sendJson(res, 400, { ok: false, reason: error.message });
|
|
937
|
+
}
|
|
938
|
+
return;
|
|
939
|
+
}
|
|
940
|
+
|
|
663
941
|
if (req.method === 'GET' && url.pathname === '/v1/integrations') {
|
|
664
942
|
const response = buildIntegrationListResponse({
|
|
665
943
|
ok: true,
|