dero-mcp-server 0.2.2 → 0.4.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.
Files changed (65) hide show
  1. package/POSITIONING.md +94 -0
  2. package/README.md +125 -24
  3. package/SKILL.md +264 -0
  4. package/data/docs-index.json +264 -260
  5. package/dist/bn254.d.ts +74 -0
  6. package/dist/bn254.d.ts.map +1 -0
  7. package/dist/bn254.js +205 -0
  8. package/dist/bn254.js.map +1 -0
  9. package/dist/citations.d.ts +70 -0
  10. package/dist/citations.d.ts.map +1 -1
  11. package/dist/citations.js +161 -1
  12. package/dist/citations.js.map +1 -1
  13. package/dist/composites/_shared.d.ts +1 -1
  14. package/dist/composites/_shared.js +1 -1
  15. package/dist/composites/audit-chain-artifact-claim.d.ts +128 -0
  16. package/dist/composites/audit-chain-artifact-claim.d.ts.map +1 -0
  17. package/dist/composites/audit-chain-artifact-claim.js +305 -0
  18. package/dist/composites/audit-chain-artifact-claim.js.map +1 -0
  19. package/dist/composites/diagnose-chain-health.d.ts +1 -1
  20. package/dist/composites/diagnose-chain-health.js +1 -1
  21. package/dist/composites/estimate-deploy-cost.d.ts +1 -1
  22. package/dist/composites/estimate-deploy-cost.js +1 -1
  23. package/dist/composites/explain-smart-contract.d.ts +1 -1
  24. package/dist/composites/explain-smart-contract.js +1 -1
  25. package/dist/composites/forge-demo-proof.d.ts +81 -0
  26. package/dist/composites/forge-demo-proof.d.ts.map +1 -0
  27. package/dist/composites/forge-demo-proof.js +204 -0
  28. package/dist/composites/forge-demo-proof.js.map +1 -0
  29. package/dist/composites/recommend-docs-path.d.ts +1 -1
  30. package/dist/composites/recommend-docs-path.js +1 -1
  31. package/dist/composites/trace-transaction-with-context.d.ts +1 -1
  32. package/dist/composites/trace-transaction-with-context.js +1 -1
  33. package/dist/daemon-base.d.ts +28 -0
  34. package/dist/daemon-base.d.ts.map +1 -0
  35. package/dist/daemon-base.js +62 -0
  36. package/dist/daemon-base.js.map +1 -0
  37. package/dist/dero-curve.d.ts +79 -0
  38. package/dist/dero-curve.d.ts.map +1 -0
  39. package/dist/dero-curve.js +79 -0
  40. package/dist/dero-curve.js.map +1 -0
  41. package/dist/docs-parse.d.ts.map +1 -1
  42. package/dist/docs-parse.js +18 -2
  43. package/dist/docs-parse.js.map +1 -1
  44. package/dist/http-server.d.ts +37 -0
  45. package/dist/http-server.d.ts.map +1 -0
  46. package/dist/http-server.js +132 -0
  47. package/dist/http-server.js.map +1 -0
  48. package/dist/index.js +18 -11
  49. package/dist/index.js.map +1 -1
  50. package/dist/proof-decode.d.ts +125 -0
  51. package/dist/proof-decode.d.ts.map +1 -0
  52. package/dist/proof-decode.js +619 -0
  53. package/dist/proof-decode.js.map +1 -0
  54. package/dist/server.d.ts.map +1 -1
  55. package/dist/server.js +89 -11
  56. package/dist/server.js.map +1 -1
  57. package/dist/tool-descriptions.d.ts +3 -0
  58. package/dist/tool-descriptions.d.ts.map +1 -1
  59. package/dist/tool-descriptions.js +39 -0
  60. package/dist/tool-descriptions.js.map +1 -1
  61. package/dist/tx-parse.d.ts +63 -0
  62. package/dist/tx-parse.d.ts.map +1 -0
  63. package/dist/tx-parse.js +183 -0
  64. package/dist/tx-parse.js.map +1 -0
  65. package/package.json +23 -2
@@ -0,0 +1,128 @@
1
+ /**
2
+ * `audit_chain_artifact_claim` — composite #6.
3
+ *
4
+ * Given a chain artifact (block topoheight, block hash, TX hash, and/or
5
+ * proof string), return a single verdict-shaped response that combines:
6
+ * - the canonical chain facts (block reward, txcount, TX acceptance, …)
7
+ * - a check against the flagged-artifact registry (false-claim citations)
8
+ * - a narrative the agent can relay verbatim
9
+ * - curated `related_docs` (rebuttal pages when flagged, generic when clean)
10
+ *
11
+ * Use case: a user asks an AI "what's going on with DERO block 1,081,893?"
12
+ * or pastes a `deroproof…` string. Instead of returning raw RPC numbers
13
+ * with no framing — which can read as "agreement with whatever framing the
14
+ * user implied" under hostile readership — this composite returns a
15
+ * factual verdict + the rebuttal context.
16
+ *
17
+ * Pairs with the silent enrichment in `citations.ts`: that fires when an
18
+ * agent queries primitives directly; this composite is for when an agent
19
+ * (or user) explicitly wants to audit an artifact end-to-end.
20
+ *
21
+ * Failure model:
22
+ * - Validates that at least one artifact field is provided. Throws
23
+ * `INVALID_INPUT` otherwise — handled by `withStructuredErrors`.
24
+ * - Daemon calls are non-required (kept independent so the verdict still
25
+ * lands even if the daemon is offline). Their failures degrade
26
+ * `chain_facts` to null and surface in `_diagnostics`.
27
+ * - Proof-string decoding errors are caught and surfaced under
28
+ * `proof_decode.error` rather than throwing — the verdict still lands.
29
+ */
30
+ import { z } from 'zod';
31
+ import { type DeroCitation } from '../citations.js';
32
+ import { interpretValueTransfer } from '../proof-decode.js';
33
+ import { type ForgeDemoProofResult } from './forge-demo-proof.js';
34
+ import { type DeroDaemonRpc } from './_shared.js';
35
+ export declare const auditChainArtifactClaimInputSchema: {
36
+ readonly topoheight: z.ZodOptional<z.ZodNumber>;
37
+ readonly block_hash: z.ZodOptional<z.ZodString>;
38
+ readonly tx_hash: z.ZodOptional<z.ZodString>;
39
+ readonly proof_string: z.ZodOptional<z.ZodString>;
40
+ readonly include_forge_demo: z.ZodOptional<z.ZodBoolean>;
41
+ };
42
+ export type AuditChainArtifactClaimInput = {
43
+ topoheight?: number;
44
+ block_hash?: string;
45
+ tx_hash?: string;
46
+ proof_string?: string;
47
+ include_forge_demo?: boolean;
48
+ };
49
+ type BlockHeaderResult = {
50
+ block_header?: {
51
+ topoheight?: number;
52
+ height?: number;
53
+ hash?: string;
54
+ timestamp?: number;
55
+ reward?: number;
56
+ txcount?: number;
57
+ };
58
+ status?: string;
59
+ };
60
+ type AuditVerdict = 'cited_in_false_claim' | 'clean';
61
+ type AuditChainFacts = {
62
+ block_header?: BlockHeaderResult['block_header'];
63
+ transaction_status?: {
64
+ accepted: boolean;
65
+ in_pool: boolean;
66
+ block_height: number | null;
67
+ valid_block: string | null;
68
+ };
69
+ };
70
+ type AuditProofDecode = {
71
+ hrp?: string;
72
+ is_proof?: boolean;
73
+ value_transfer_uint64?: string;
74
+ value_interpretation?: ReturnType<typeof interpretValueTransfer>;
75
+ error?: string;
76
+ };
77
+ /**
78
+ * Slimmed-down embedded forge result. Strips the duplicate citations/context
79
+ * note (the audit response already carries those at the top level) and
80
+ * diagnostics. Keeps the math + the actual forged string + the receiver +
81
+ * the self-check — the pieces that make this useful for the agent.
82
+ */
83
+ export type EmbeddedForgeDemo = {
84
+ skipped: false;
85
+ forged_proof_string: string;
86
+ target_amount: ForgeDemoProofResult['target_amount'];
87
+ ring_slot: number;
88
+ ring_size: number;
89
+ ring_receiver_address: string | null;
90
+ math: ForgeDemoProofResult['math'];
91
+ self_check: ForgeDemoProofResult['self_check'];
92
+ explorer_display_amount: string;
93
+ demo_amount_source: 'flagged_artifact' | 'proof_string_v' | 'default';
94
+ } | {
95
+ skipped: true;
96
+ reason: string;
97
+ };
98
+ export type AuditChainArtifactClaimResult = {
99
+ verdict: AuditVerdict;
100
+ inputs: AuditChainArtifactClaimInput;
101
+ matched_artifacts: Array<{
102
+ id: string;
103
+ matched_by: string[];
104
+ }>;
105
+ context_note: string | null;
106
+ chain_facts: AuditChainFacts | null;
107
+ proof_decode: AuditProofDecode | null;
108
+ forge_demo: EmbeddedForgeDemo | null;
109
+ narrative: string;
110
+ related_docs: DeroCitation[];
111
+ _diagnostics: {
112
+ step_latencies: Record<string, number>;
113
+ halted_at: string | null;
114
+ total_ms: number;
115
+ };
116
+ };
117
+ /**
118
+ * Execute the audit. Composes (in this order):
119
+ * 1. Flagged-artifact match against the inputs.
120
+ * 2. Optional `DERO.GetBlockHeaderByTopoHeight` / `DERO.GetBlockHeaderByHash`.
121
+ * 3. Optional `DERO.GetTransaction` for accepted/pool status.
122
+ * 4. Optional proof-string decode.
123
+ * 5. Optional forge-demo (when `include_forge_demo: true` and tx_hash present).
124
+ * 6. Narrative + related_docs assembly.
125
+ */
126
+ export declare function auditChainArtifactClaim(rpc: DeroDaemonRpc, input: AuditChainArtifactClaimInput): Promise<AuditChainArtifactClaimResult>;
127
+ export {};
128
+ //# sourceMappingURL=audit-chain-artifact-claim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-chain-artifact-claim.d.ts","sourceRoot":"","sources":["../../src/composites/audit-chain-artifact-claim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAoB,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,cAAc,CAAA;AAErB,eAAO,MAAM,kCAAkC;;;;;;CA4BrC,CAAA;AAEV,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,CAAC,EAAE;QACb,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAWD,KAAK,YAAY,GAAG,sBAAsB,GAAG,OAAO,CAAA;AAEpD,KAAK,eAAe,GAAG;IACrB,YAAY,CAAC,EAAE,iBAAiB,CA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,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,EAAE,eAAe,GAAG,IAAI,CAAA;IACnC,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAA;IACrC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,YAAY,EAAE,CAAA;IAC5B,YAAY,EAAE;QACZ,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;QACxB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;CACF,CAAA;AAwED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,6BAA6B,CAAC,CAkMxC"}
@@ -0,0 +1,305 @@
1
+ /**
2
+ * `audit_chain_artifact_claim` — composite #6.
3
+ *
4
+ * Given a chain artifact (block topoheight, block hash, TX hash, and/or
5
+ * proof string), return a single verdict-shaped response that combines:
6
+ * - the canonical chain facts (block reward, txcount, TX acceptance, …)
7
+ * - a check against the flagged-artifact registry (false-claim citations)
8
+ * - a narrative the agent can relay verbatim
9
+ * - curated `related_docs` (rebuttal pages when flagged, generic when clean)
10
+ *
11
+ * Use case: a user asks an AI "what's going on with DERO block 1,081,893?"
12
+ * or pastes a `deroproof…` string. Instead of returning raw RPC numbers
13
+ * with no framing — which can read as "agreement with whatever framing the
14
+ * user implied" under hostile readership — this composite returns a
15
+ * factual verdict + the rebuttal context.
16
+ *
17
+ * Pairs with the silent enrichment in `citations.ts`: that fires when an
18
+ * agent queries primitives directly; this composite is for when an agent
19
+ * (or user) explicitly wants to audit an artifact end-to-end.
20
+ *
21
+ * Failure model:
22
+ * - Validates that at least one artifact field is provided. Throws
23
+ * `INVALID_INPUT` otherwise — handled by `withStructuredErrors`.
24
+ * - Daemon calls are non-required (kept independent so the verdict still
25
+ * lands even if the daemon is offline). Their failures degrade
26
+ * `chain_facts` to null and surface in `_diagnostics`.
27
+ * - Proof-string decoding errors are caught and surfaced under
28
+ * `proof_decode.error` rather than throwing — the verdict still lands.
29
+ */
30
+ import { z } from 'zod';
31
+ import { enrichWithFlaggedArtifacts, flaggedArtifactsForInput, relatedDocsFor, } from '../citations.js';
32
+ import { decodeDeroBech32, interpretValueTransfer } from '../proof-decode.js';
33
+ import { forgeDemoProof } from './forge-demo-proof.js';
34
+ import { runChain, stepLatencies, stepValue, } from './_shared.js';
35
+ export const auditChainArtifactClaimInputSchema = {
36
+ topoheight: z
37
+ .number()
38
+ .int()
39
+ .nonnegative()
40
+ .optional()
41
+ .describe('Topological height of a block to audit.'),
42
+ block_hash: z
43
+ .string()
44
+ .regex(/^[0-9a-fA-F]{64}$/, 'block_hash must be 64 hex characters')
45
+ .optional()
46
+ .describe('64-char hex block hash to audit.'),
47
+ tx_hash: z
48
+ .string()
49
+ .regex(/^[0-9a-fA-F]{64}$/, 'tx_hash must be 64 hex characters')
50
+ .optional()
51
+ .describe('64-char hex transaction hash to audit.'),
52
+ proof_string: z
53
+ .string()
54
+ .min(8)
55
+ .optional()
56
+ .describe('Optional `deroproof…` / DERO bech32 string to also decode and check.'),
57
+ include_forge_demo: z
58
+ .boolean()
59
+ .optional()
60
+ .describe('When true AND tx_hash is provided, also forge a fresh demo proof for the same TX (via dero_forge_demo_proof) and embed it under `forge_demo`. Closes the rebuttal loop in one tool call. Default false.'),
61
+ };
62
+ /**
63
+ * Build the human-readable narrative. Kept tight; agents are expected to
64
+ * relay this verbatim to the user.
65
+ */
66
+ function buildNarrative(verdict, inputs, matched, chainFacts, proofDecode, forgeDemo) {
67
+ const parts = [];
68
+ if (verdict === 'cited_in_false_claim') {
69
+ const ids = matched.map((a) => a.id).join(', ');
70
+ parts.push(`The provided artifact(s) match ${matched.length} flagged false-claim record(s): ${ids}.`);
71
+ }
72
+ else {
73
+ parts.push('No matches found in the flagged false-claim registry for the provided artifact(s).');
74
+ }
75
+ if (chainFacts?.block_header) {
76
+ const h = chainFacts.block_header;
77
+ const reward = typeof h.reward === 'number' ? (h.reward / 100_000).toFixed(3) : 'n/a';
78
+ parts.push(`Block topoheight=${h.topoheight ?? '?'} hash=${(h.hash ?? '').slice(0, 16)}… reward=${reward} DERO txcount=${h.txcount ?? '?'}.`);
79
+ }
80
+ if (chainFacts?.transaction_status) {
81
+ const t = chainFacts.transaction_status;
82
+ if (t.accepted) {
83
+ parts.push(`Transaction was accepted into block height=${t.block_height ?? '?'} — meaning all six sigma proofs and the range proof passed at every validating node.`);
84
+ }
85
+ else if (t.in_pool) {
86
+ parts.push('Transaction is currently in the mempool (unconfirmed).');
87
+ }
88
+ else {
89
+ parts.push('Transaction was not found on this daemon (could be wrong network or non-existent).');
90
+ }
91
+ }
92
+ if (proofDecode && !proofDecode.error) {
93
+ if (proofDecode.value_interpretation) {
94
+ const v = proofDecode.value_interpretation;
95
+ parts.push(`Proof string decoded successfully — embedded uint64=${v.uint64} (signed interpretation: ${v.dero} DERO${v.is_negative_wraparound ? '; this is a uint64 wraparound of a negative atomic value' : ''}).`);
96
+ }
97
+ else {
98
+ parts.push(`Bech32 string decoded successfully (hrp=${proofDecode.hrp}).`);
99
+ }
100
+ }
101
+ else if (proofDecode?.error) {
102
+ parts.push(`Proof-string decode failed: ${proofDecode.error}`);
103
+ }
104
+ if (forgeDemo && !forgeDemo.skipped) {
105
+ parts.push(`For comparison, we forged a fresh proof for ring slot ${forgeDemo.ring_slot} targeting ${forgeDemo.target_amount.dero} DERO (display amount ${forgeDemo.explorer_display_amount}). It self-verifies under the same equation proof.Prove() uses — meaning an unpatched explorer would mark it Verified ✓ — yet nothing on-chain moved. The cited payload proof is the same kind of object.`);
106
+ }
107
+ if (verdict === 'cited_in_false_claim') {
108
+ parts.push('See related_docs for the technical rebuttal — the cited payload proof is a display object, not a consensus record.');
109
+ }
110
+ return parts.join(' ');
111
+ }
112
+ /**
113
+ * Execute the audit. Composes (in this order):
114
+ * 1. Flagged-artifact match against the inputs.
115
+ * 2. Optional `DERO.GetBlockHeaderByTopoHeight` / `DERO.GetBlockHeaderByHash`.
116
+ * 3. Optional `DERO.GetTransaction` for accepted/pool status.
117
+ * 4. Optional proof-string decode.
118
+ * 5. Optional forge-demo (when `include_forge_demo: true` and tx_hash present).
119
+ * 6. Narrative + related_docs assembly.
120
+ */
121
+ export async function auditChainArtifactClaim(rpc, input) {
122
+ if (input.topoheight === undefined &&
123
+ !input.block_hash &&
124
+ !input.tx_hash &&
125
+ !input.proof_string) {
126
+ throw new Error('INVALID_INPUT: provide at least one of topoheight, block_hash, tx_hash, or proof_string');
127
+ }
128
+ // ─── 1. Flagged-artifact match ────────────────────────────────────────────
129
+ const matched = flaggedArtifactsForInput({
130
+ topoheight: input.topoheight,
131
+ block_hash: input.block_hash,
132
+ tx_hash: input.tx_hash,
133
+ proof_string: input.proof_string,
134
+ });
135
+ // ─── 2-3. Chain primitives (only the ones the inputs cover) ───────────────
136
+ const steps = [];
137
+ if (input.topoheight !== undefined) {
138
+ const topo = input.topoheight;
139
+ steps.push({
140
+ name: 'block_header_by_topo',
141
+ fn: () => rpc('DERO.GetBlockHeaderByTopoHeight', { topoheight: topo }),
142
+ });
143
+ }
144
+ else if (input.block_hash) {
145
+ const hash = input.block_hash;
146
+ steps.push({
147
+ name: 'block_header_by_hash',
148
+ fn: () => rpc('DERO.GetBlockHeaderByHash', { hash }),
149
+ });
150
+ }
151
+ if (input.tx_hash) {
152
+ const tx = input.tx_hash;
153
+ steps.push({
154
+ name: 'get_transaction',
155
+ fn: () => rpc('DERO.GetTransaction', { txs_hashes: [tx] }),
156
+ });
157
+ }
158
+ const chain = await runChain(steps);
159
+ // ─── 4. Proof-string decode ───────────────────────────────────────────────
160
+ let proofDecode = null;
161
+ if (input.proof_string) {
162
+ try {
163
+ const decoded = decodeDeroBech32(input.proof_string);
164
+ const valueInterp = decoded.value_transfer_uint64 !== undefined
165
+ ? interpretValueTransfer(decoded.value_transfer_uint64)
166
+ : undefined;
167
+ proofDecode = {
168
+ hrp: decoded.hrp,
169
+ is_proof: decoded.is_proof,
170
+ ...(decoded.value_transfer_uint64 !== undefined
171
+ ? { value_transfer_uint64: decoded.value_transfer_uint64.toString() }
172
+ : {}),
173
+ ...(valueInterp ? { value_interpretation: valueInterp } : {}),
174
+ };
175
+ }
176
+ catch (error) {
177
+ proofDecode = {
178
+ error: error instanceof Error ? error.message : String(error),
179
+ };
180
+ }
181
+ }
182
+ // ─── 5. Optional forge-demo (closes the rebuttal loop in one call) ───────
183
+ let forge_demo = null;
184
+ if (input.include_forge_demo) {
185
+ if (!input.tx_hash) {
186
+ forge_demo = {
187
+ skipped: true,
188
+ reason: 'include_forge_demo requires tx_hash (forging needs the TX commitments)',
189
+ };
190
+ }
191
+ else {
192
+ // Pick the most rebuttal-relevant demo amount:
193
+ // - matched flagged artifact's pinned amount (e.g. -2.2M for 2022 claim)
194
+ // - else reuse the cited proof_string V if we successfully decoded one
195
+ // - else default to -1 DERO
196
+ let demoAmount = '-1';
197
+ let demoSource = 'default';
198
+ const flaggedAmount = matched.find((a) => typeof a.demo_amount_dero === 'string')
199
+ ?.demo_amount_dero;
200
+ if (flaggedAmount) {
201
+ demoAmount = flaggedAmount;
202
+ demoSource = 'flagged_artifact';
203
+ }
204
+ else if (proofDecode?.value_interpretation?.dero) {
205
+ demoAmount = proofDecode.value_interpretation.dero;
206
+ demoSource = 'proof_string_v';
207
+ }
208
+ try {
209
+ const forged = await forgeDemoProof(rpc, {
210
+ tx_hash: input.tx_hash,
211
+ ring_slot: 0,
212
+ amount_dero: demoAmount,
213
+ });
214
+ forge_demo = {
215
+ skipped: false,
216
+ forged_proof_string: forged.forged_proof_string,
217
+ target_amount: forged.target_amount,
218
+ ring_slot: forged.ring_slot,
219
+ ring_size: forged.ring_size,
220
+ ring_receiver_address: forged.ring_receiver_address,
221
+ math: forged.math,
222
+ self_check: forged.self_check,
223
+ explorer_display_amount: forged.explorer_display_amount,
224
+ demo_amount_source: demoSource,
225
+ };
226
+ }
227
+ catch (error) {
228
+ forge_demo = {
229
+ skipped: true,
230
+ reason: `forge failed: ${error instanceof Error ? error.message : String(error)}`,
231
+ };
232
+ }
233
+ }
234
+ }
235
+ // ─── 6. Assemble chain_facts payload ─────────────────────────────────────
236
+ const blockHeaderTopo = stepValue(chain, 'block_header_by_topo');
237
+ const blockHeaderHash = stepValue(chain, 'block_header_by_hash');
238
+ const txResult = stepValue(chain, 'get_transaction');
239
+ const chainFacts = (() => {
240
+ const header = blockHeaderTopo?.block_header ?? blockHeaderHash?.block_header;
241
+ let txStatus;
242
+ if (txResult?.txs && txResult.txs.length > 0) {
243
+ const t = txResult.txs[0];
244
+ const accepted = !!t.valid_block && t.valid_block !== '';
245
+ txStatus = {
246
+ accepted,
247
+ in_pool: !!t.in_pool,
248
+ block_height: typeof t.block_height === 'number' ? t.block_height : null,
249
+ valid_block: t.valid_block ?? null,
250
+ };
251
+ }
252
+ if (!header && !txStatus)
253
+ return null;
254
+ return {
255
+ ...(header ? { block_header: header } : {}),
256
+ ...(txStatus ? { transaction_status: txStatus } : {}),
257
+ };
258
+ })();
259
+ // ─── 7. Verdict + narrative + related_docs ────────────────────────────────
260
+ const verdict = matched.length > 0 ? 'cited_in_false_claim' : 'clean';
261
+ const enrichment = enrichWithFlaggedArtifacts({
262
+ topoheight: input.topoheight,
263
+ block_hash: input.block_hash,
264
+ tx_hash: input.tx_hash,
265
+ proof_string: input.proof_string,
266
+ }, relatedDocsFor('audit_chain_artifact_claim'));
267
+ const related_docs = enrichment?.related_docs ?? relatedDocsFor('audit_chain_artifact_claim') ?? [];
268
+ const context_note = enrichment?.context_note ?? null;
269
+ const matched_artifacts = matched.map((a) => ({
270
+ id: a.id,
271
+ matched_by: a.matchers
272
+ .filter((m) => {
273
+ if (m.kind === 'topoheight')
274
+ return input.topoheight === m.value;
275
+ if (m.kind === 'block_hash') {
276
+ return !!input.block_hash && input.block_hash.toLowerCase() === m.value.toLowerCase();
277
+ }
278
+ if (m.kind === 'tx_hash') {
279
+ return !!input.tx_hash && input.tx_hash.toLowerCase() === m.value.toLowerCase();
280
+ }
281
+ if (m.kind === 'proof_string')
282
+ return input.proof_string === m.value;
283
+ return false;
284
+ })
285
+ .map((m) => m.kind),
286
+ }));
287
+ const narrative = buildNarrative(verdict, input, matched, chainFacts, proofDecode, forge_demo);
288
+ return {
289
+ verdict,
290
+ inputs: input,
291
+ matched_artifacts,
292
+ context_note,
293
+ chain_facts: chainFacts,
294
+ proof_decode: proofDecode,
295
+ forge_demo,
296
+ narrative,
297
+ related_docs,
298
+ _diagnostics: {
299
+ step_latencies: stepLatencies(chain),
300
+ halted_at: chain.haltedAt,
301
+ total_ms: chain.totalMs,
302
+ },
303
+ };
304
+ }
305
+ //# sourceMappingURL=audit-chain-artifact-claim.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-chain-artifact-claim.js","sourceRoot":"","sources":["../../src/composites/audit-chain-artifact-claim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,cAAc,GAGf,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC7E,OAAO,EAAE,cAAc,EAA6B,MAAM,uBAAuB,CAAA;AACjF,OAAO,EACL,QAAQ,EACR,aAAa,EACb,SAAS,GAGV,MAAM,cAAc,CAAA;AAErB,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,GAAG,EAAE;SACL,WAAW,EAAE;SACb,QAAQ,EAAE;SACV,QAAQ,CAAC,yCAAyC,CAAC;IACtD,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,KAAK,CAAC,mBAAmB,EAAE,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c,EAAE,aAAa,CAAC,KAAK,CAAC;YACpC,SAAS,EAAE,KAAK,CAAC,QAAQ;YACzB,QAAQ,EAAE,KAAK,CAAC,OAAO;SACxB;KACF,CAAA;AACH,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * response carrying chain metadata, mempool snapshot, narrative summary,
8
8
  * and curated docs citations.
9
9
  *
10
- * Design contract: `docs/composites.md` § 1 (lowest-risk composite, ships
10
+ * Design contract § 1 (lowest-risk composite, ships
11
11
  * first to prove the composite plumbing — shared utils + flow test pattern
12
12
  * + smoke assertions — end-to-end).
13
13
  *
@@ -7,7 +7,7 @@
7
7
  * response carrying chain metadata, mempool snapshot, narrative summary,
8
8
  * and curated docs citations.
9
9
  *
10
- * Design contract: `docs/composites.md` § 1 (lowest-risk composite, ships
10
+ * Design contract § 1 (lowest-risk composite, ships
11
11
  * first to prove the composite plumbing — shared utils + flow test pattern
12
12
  * + smoke assertions — end-to-end).
13
13
  *
@@ -10,7 +10,7 @@
10
10
  * breakdown explaining what each number means, and the curated
11
11
  * "Create, Deploy & Use a Smart Contract" docs page as a citation.
12
12
  *
13
- * Design contract: `docs/composites.md` § 4. Sequencing rule: SHIP
13
+ * Design contract § 4. Sequencing rule: SHIP
14
14
  * FOURTH. Numeric semantics; relies on `extractScSurface` (composite
15
15
  * #2) being stable. Must not ship before composite #2 because the
16
16
  * surface enrichment proves out the reuse path planned in the design
@@ -10,7 +10,7 @@
10
10
  * breakdown explaining what each number means, and the curated
11
11
  * "Create, Deploy & Use a Smart Contract" docs page as a citation.
12
12
  *
13
- * Design contract: `docs/composites.md` § 4. Sequencing rule: SHIP
13
+ * Design contract § 4. Sequencing rule: SHIP
14
14
  * FOURTH. Numeric semantics; relies on `extractScSurface` (composite
15
15
  * #2) being stable. Must not ship before composite #2 because the
16
16
  * surface enrichment proves out the reuse path planned in the design
@@ -8,7 +8,7 @@
8
8
  * docs page — something no generic chain MCP can replicate because no
9
9
  * other chain MCP ships the docs index in-process.
10
10
  *
11
- * Design contract: `docs/composites.md` § 2. Sequencing rule: SHIP
11
+ * Design contract § 2. Sequencing rule: SHIP
12
12
  * SECOND — establishes the SC-introspection pattern (`extractScSurface`)
13
13
  * that `trace_transaction_with_context` and `estimate_deploy_cost` reuse.
14
14
  *
@@ -8,7 +8,7 @@
8
8
  * docs page — something no generic chain MCP can replicate because no
9
9
  * other chain MCP ships the docs index in-process.
10
10
  *
11
- * Design contract: `docs/composites.md` § 2. Sequencing rule: SHIP
11
+ * Design contract § 2. Sequencing rule: SHIP
12
12
  * SECOND — establishes the SC-introspection pattern (`extractScSurface`)
13
13
  * that `trace_transaction_with_context` and `estimate_deploy_cost` reuse.
14
14
  *
@@ -0,0 +1,81 @@
1
+ /**
2
+ * `dero_forge_demo_proof` — composite #7.
3
+ *
4
+ * Builds a `deroproof…` display object for a chosen transaction, ring slot,
5
+ * and amount. The string is constructed locally from public chain data — no
6
+ * wallet, no keys, no broadcast. On an unpatched explorer it shows
7
+ * **Verified ✓** for the chosen amount; on the chain, nothing changes.
8
+ *
9
+ * Purpose: defensive demonstration of the integrity-page Part 3 forge math
10
+ * (`docs/integrity/inflation-claim`, Part 3). When an AI agent is asked
11
+ * "does this deroproof string prove the chain minted coins?", the agent can
12
+ * forge an equivalent string here and show, on real chain inputs, that
13
+ * **Verified** is a display-layer fact about the pasted object — not a
14
+ * consensus statement about coins moving.
15
+ *
16
+ * Math (same equation `proof.Prove()` checks at `proof/proof.go:88-95`):
17
+ *
18
+ * blinder = C[slot] − amount × G
19
+ * forged_string = bech32("deroproof", version || blinder_compressed || CBOR({HH: 0…0, VU: amount}))
20
+ *
21
+ * Self-check: amount × G + blinder == C[slot]. If this fails, the encoded
22
+ * string would not verify and we never return it.
23
+ *
24
+ * Read-only invariant: this tool computes a string and returns it. It does
25
+ * NOT touch a wallet, broadcast a transaction, or mutate any chain state.
26
+ * Annotation `readOnlyHint: true` is preserved.
27
+ */
28
+ import { z } from 'zod';
29
+ import { type DeroCitation } from '../citations.js';
30
+ import { type DeroDaemonRpc } from './_shared.js';
31
+ export declare const forgeDemoProofInputSchema: {
32
+ readonly tx_hash: z.ZodOptional<z.ZodString>;
33
+ readonly tx_hex: z.ZodOptional<z.ZodString>;
34
+ readonly ring_slot: z.ZodDefault<z.ZodNumber>;
35
+ readonly amount_dero: z.ZodDefault<z.ZodString>;
36
+ };
37
+ export type ForgeDemoProofInput = {
38
+ tx_hash?: string;
39
+ tx_hex?: string;
40
+ ring_slot?: number;
41
+ amount_dero?: string;
42
+ };
43
+ export type ForgeDemoProofResult = {
44
+ forged_proof_string: string;
45
+ target_amount: {
46
+ dero: string;
47
+ atoms_signed: string;
48
+ atoms_uint64: string;
49
+ };
50
+ ring_slot: number;
51
+ ring_size: number;
52
+ ring_receiver_address: string | null;
53
+ math: {
54
+ C_slot_hex: string;
55
+ amount_x_G_hex: string;
56
+ blinder_hex: string;
57
+ };
58
+ self_check: {
59
+ verified: boolean;
60
+ method: string;
61
+ };
62
+ explorer_display_amount: string;
63
+ context_note: string | null;
64
+ related_docs: DeroCitation[];
65
+ _diagnostics: {
66
+ step_latencies: Record<string, number>;
67
+ halted_at: string | null;
68
+ total_ms: number;
69
+ tx_source: 'tx_hash' | 'tx_hex';
70
+ };
71
+ };
72
+ /**
73
+ * Execute the forge. Composes:
74
+ * 1. (optional) daemon fetch of TX hex + ring members
75
+ * 2. parse TX → extract C[ring_slot]
76
+ * 3. compute blinder = C[slot] − amount × G
77
+ * 4. self-check: amount × G + blinder == C[slot]
78
+ * 5. encode forged proof string + assemble narrative + citations
79
+ */
80
+ export declare function forgeDemoProof(rpc: DeroDaemonRpc, input: ForgeDemoProofInput): Promise<ForgeDemoProofResult>;
81
+ //# sourceMappingURL=forge-demo-proof.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forge-demo-proof.d.ts","sourceRoot":"","sources":["../../src/composites/forge-demo-proof.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAA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