wiki-formant 0.9.4 → 0.11.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/README.md +39 -2
- package/bin/check-classes.mjs +119 -0
- package/dist/mcp.d.ts +3 -2
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js.map +1 -1
- package/dist/react-server.d.ts +78 -0
- package/dist/react-server.d.ts.map +1 -0
- package/dist/react-server.js +62 -0
- package/dist/react-server.js.map +1 -0
- package/dist/react.d.ts +57 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +27 -0
- package/dist/react.js.map +1 -1
- package/dist/rola.d.ts +128 -0
- package/dist/rola.d.ts.map +1 -0
- package/dist/rola.js +150 -0
- package/dist/rola.js.map +1 -0
- package/dist/x402.d.ts +104 -0
- package/dist/x402.d.ts.map +1 -0
- package/dist/x402.js +224 -0
- package/dist/x402.js.map +1 -0
- package/package.json +55 -7
package/dist/x402.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// x402.ts — per-call payment gating for an MCP envelope.
|
|
2
|
+
//
|
|
3
|
+
// THE LEAK THIS CLOSES. Paywalling a bulk HTTP export while the MCP tool that
|
|
4
|
+
// returns the same bytes stays free reroutes a scraper one endpoint over. A
|
|
5
|
+
// price one surface honours and its twin does not is not a price.
|
|
6
|
+
//
|
|
7
|
+
// WHY NOT AN HTTP 402 ON THE MCP ROUTE. One status covers one POST, and an MCP
|
|
8
|
+
// server accepts batches — a batch of [search, get_catalogue, create_checkout]
|
|
9
|
+
// would have to 402 all three or bill none. A blanket 402 would also block the
|
|
10
|
+
// free tools that share the URL. And no MCP client would understand it: a
|
|
11
|
+
// non-2xx from the transport reads as "server error", which is why the x402
|
|
12
|
+
// Foundation's own MCP integration does not use HTTP 402 either.
|
|
13
|
+
//
|
|
14
|
+
// SO PAYMENT TRAVELS IN-BAND, in the JSON-RPC envelope, in the places @x402/mcp
|
|
15
|
+
// puts it:
|
|
16
|
+
//
|
|
17
|
+
// client -> server params._meta["x402/payment"] PaymentPayload
|
|
18
|
+
// unpaid tool -> client tool result, isError + structuredContent
|
|
19
|
+
// unpaid resource -> client JSON-RPC error -32042, data: PaymentRequired
|
|
20
|
+
// paid -> client result._meta["x402/payment-response"] SettleResponse
|
|
21
|
+
//
|
|
22
|
+
// (resources/read has no isError result shape, hence the two forms.)
|
|
23
|
+
//
|
|
24
|
+
// WHY THIS IS ITS OWN SUBPATH, AND WHY IT IMPORTS NOTHING.
|
|
25
|
+
// `wiki-formant` has no runtime dependencies and no framework peer, and x402 is
|
|
26
|
+
// a stack of them — @x402/core, @x402/evm, @x402/extensions and viem behind
|
|
27
|
+
// those. They are declared here as OPTIONAL peers, because a caller genuinely
|
|
28
|
+
// cannot build an `x402ResourceServer` without them, and a wiki that never
|
|
29
|
+
// imports `wiki-formant/x402` never resolves, installs or loads any of it.
|
|
30
|
+
//
|
|
31
|
+
// But this file imports none of them either. The resource server arrives as a
|
|
32
|
+
// PORT, for the same reason the Prisma delegates in `rola.ts` do: the caller
|
|
33
|
+
// already holds a configured one, its construction is deployment policy (which
|
|
34
|
+
// chain, which facilitator, whose gas key, whose money), and typing it
|
|
35
|
+
// structurally is what keeps a viem-sized dependency tree out of a package
|
|
36
|
+
// three other wikis install. `declareDiscoveryExtension` arrives the same way,
|
|
37
|
+
// so the lazy `import()` that keeps it off the free path stays lazy and stays
|
|
38
|
+
// the caller's.
|
|
39
|
+
//
|
|
40
|
+
// WHAT STAYS WITH THE CALLER, deliberately: which surfaces cost what, the
|
|
41
|
+
// prices, the terms text, the service name and the sentence that tells an agent
|
|
42
|
+
// how to pay. Those are policy. What is here is the envelope surgery —
|
|
43
|
+
// verify before dispatch, settle only after a non-error answer, splice the
|
|
44
|
+
// challenges back into the caller's original order — which is the part that is
|
|
45
|
+
// the same wherever it is written and the part that is easy to get subtly
|
|
46
|
+
// wrong.
|
|
47
|
+
/** Structural check only — `verifyPayment` does the real one, as @x402/mcp does. */
|
|
48
|
+
function metaPayment(req) {
|
|
49
|
+
const meta = (req.params ?? {})._meta;
|
|
50
|
+
const payment = meta?.['x402/payment'];
|
|
51
|
+
return payment && typeof payment === 'object' && 'x402Version' in payment && 'payload' in payment
|
|
52
|
+
? payment
|
|
53
|
+
: null;
|
|
54
|
+
}
|
|
55
|
+
const passthrough = (body) => ({
|
|
56
|
+
body: body,
|
|
57
|
+
empty: false,
|
|
58
|
+
finish: async (r) => r,
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Verify payment for every paid entry, withhold the unpaid ones, and return a
|
|
62
|
+
* `finish` that reassembles the response.
|
|
63
|
+
*
|
|
64
|
+
* The ordering mirrors `withX402`: verify BEFORE dispatch, settle only AFTER
|
|
65
|
+
* the handler produced something that is not an error. A tool that raises
|
|
66
|
+
* cancels rather than settles — the caller pays for an answer, not an attempt.
|
|
67
|
+
*/
|
|
68
|
+
export async function gatePaidCalls(raw, options) {
|
|
69
|
+
const { resolve, network, payTo, maxTimeoutSeconds, serviceName, tags, maxBatch } = options;
|
|
70
|
+
if (options.enabled === false)
|
|
71
|
+
return passthrough(raw);
|
|
72
|
+
const isBatch = Array.isArray(raw);
|
|
73
|
+
const entries = (isBatch ? raw : [raw]);
|
|
74
|
+
// Malformed or oversized bodies go straight through: handleMcp owns those
|
|
75
|
+
// errors and says them better. The batch cap especially — it is enforced
|
|
76
|
+
// downstream, after this function would have removed entries, so a 500-entry
|
|
77
|
+
// batch must not be allowed to shrink past it here.
|
|
78
|
+
if (!entries.length || entries.length > maxBatch)
|
|
79
|
+
return passthrough(raw);
|
|
80
|
+
if (entries.some(e => !e || typeof e !== 'object'))
|
|
81
|
+
return passthrough(raw);
|
|
82
|
+
const targets = entries
|
|
83
|
+
.map((entry, index) => ({ entry, index, spec: resolve(entry) }))
|
|
84
|
+
.filter((t) => t.spec !== null);
|
|
85
|
+
// The overwhelmingly common case: nothing paid in this envelope, so the
|
|
86
|
+
// facilitator is never contacted and the free surface pays no latency for
|
|
87
|
+
// the existence of the paid one.
|
|
88
|
+
if (!targets.length)
|
|
89
|
+
return passthrough(raw);
|
|
90
|
+
const blocked = new Map();
|
|
91
|
+
const settlers = new Map();
|
|
92
|
+
/** A withheld entry, in whichever form this method can carry. */
|
|
93
|
+
const refuse = (entry, kind, message, data) => kind === 'tool'
|
|
94
|
+
? {
|
|
95
|
+
jsonrpc: '2.0',
|
|
96
|
+
id: entry.id,
|
|
97
|
+
result: {
|
|
98
|
+
content: [{ type: 'text', text: JSON.stringify(data ?? { error: message }) }],
|
|
99
|
+
...(data ? { structuredContent: data } : {}),
|
|
100
|
+
isError: true,
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
: { jsonrpc: '2.0', id: entry.id, error: { code: -32042, message, data } };
|
|
104
|
+
// An unreachable facilitator THROWS out of initialize() rather than returning
|
|
105
|
+
// anything. Uncaught here it would 500 the entire POST — taking down the free
|
|
106
|
+
// tools in the same batch, which is precisely the blast radius this per-entry
|
|
107
|
+
// design exists to avoid. Withhold only the paid entries and let everything
|
|
108
|
+
// else through.
|
|
109
|
+
let server;
|
|
110
|
+
try {
|
|
111
|
+
server = await options.server();
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
for (const { entry, index, spec } of targets) {
|
|
115
|
+
blocked.set(index, refuse(entry, spec.kind, 'Payment verification is temporarily unavailable. Retry shortly.'));
|
|
116
|
+
}
|
|
117
|
+
return finishWith(entries, isBatch, blocked, new Map());
|
|
118
|
+
}
|
|
119
|
+
for (const { entry, index, spec } of targets) {
|
|
120
|
+
const accepts = await server.buildPaymentRequirements({
|
|
121
|
+
scheme: 'exact',
|
|
122
|
+
network,
|
|
123
|
+
payTo,
|
|
124
|
+
price: spec.price,
|
|
125
|
+
maxTimeoutSeconds,
|
|
126
|
+
});
|
|
127
|
+
// The full PaymentRequired object, in whichever envelope slot this method
|
|
128
|
+
// has: a tool result can carry structuredContent, resources/read cannot.
|
|
129
|
+
const extensions = spec.discovery && options.declareDiscovery
|
|
130
|
+
? await options.declareDiscovery(spec.discovery)
|
|
131
|
+
: undefined;
|
|
132
|
+
const challenge = async (error, payload) => refuse(entry, spec.kind, error, await server.createPaymentRequiredResponse(accepts, {
|
|
133
|
+
url: spec.resource,
|
|
134
|
+
description: spec.description,
|
|
135
|
+
mimeType: spec.mimeType,
|
|
136
|
+
serviceName,
|
|
137
|
+
tags,
|
|
138
|
+
}, error, extensions, spec.context, payload));
|
|
139
|
+
const payload = metaPayment(entry);
|
|
140
|
+
if (!payload) {
|
|
141
|
+
blocked.set(index, await challenge(spec.unpaidMessage));
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const requirements = server.findMatchingRequirements(accepts, payload);
|
|
145
|
+
if (!requirements) {
|
|
146
|
+
blocked.set(index, await challenge('No matching payment requirements found.', payload));
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const verify = await server.verifyPayment(payload, requirements, extensions, spec.context);
|
|
150
|
+
if (!verify.isValid) {
|
|
151
|
+
blocked.set(index, await challenge(verify.invalidReason || 'Payment verification failed.', payload));
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
settlers.set(index, () => server.settlePayment(payload, requirements, extensions, spec.context));
|
|
155
|
+
}
|
|
156
|
+
return finishWith(entries, isBatch, blocked, settlers);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Assemble the Gate: what to dispatch, and how to put the answer back together.
|
|
160
|
+
*
|
|
161
|
+
* Shared by the normal path and the facilitator-unreachable one, which differ
|
|
162
|
+
* only in whether anything is left to settle.
|
|
163
|
+
*/
|
|
164
|
+
function finishWith(entries, isBatch, blocked, settlers) {
|
|
165
|
+
const kept = entries.filter((_, i) => !blocked.has(i));
|
|
166
|
+
const failedResult = (id, message) => ({
|
|
167
|
+
jsonrpc: '2.0',
|
|
168
|
+
id,
|
|
169
|
+
result: { content: [{ type: 'text', text: JSON.stringify({ error: message }) }], isError: true },
|
|
170
|
+
});
|
|
171
|
+
return {
|
|
172
|
+
body: isBatch ? kept : kept[0],
|
|
173
|
+
empty: kept.length === 0,
|
|
174
|
+
async finish(dispatched) {
|
|
175
|
+
// handleMcp returns a bare object for a single request and an array for a
|
|
176
|
+
// batch, and drops notification entries — so positions do not survive it.
|
|
177
|
+
// Rejoin on the JSON-RPC id, the only stable handle either side has.
|
|
178
|
+
//
|
|
179
|
+
// Its one hazard, stated rather than hidden: a batch that repeats an id
|
|
180
|
+
// collapses onto one entry here, so the duplicates lose their answers.
|
|
181
|
+
// That envelope is malformed under JSON-RPC 2.0 and no client sends it,
|
|
182
|
+
// but it is the reason the obvious "pass a per-call context to handlers
|
|
183
|
+
// and rejoin by position" refactor is not the improvement it looks like:
|
|
184
|
+
// McpTool.handler is (args) => Promise<unknown> and widening it cannot
|
|
185
|
+
// carry a settlement receipt back out, so the rejoin would still be here.
|
|
186
|
+
const answers = dispatched == null ? [] : Array.isArray(dispatched) ? dispatched : [dispatched];
|
|
187
|
+
const byId = new Map(answers.map(a => [a.id, a]));
|
|
188
|
+
await Promise.all([...settlers].map(async ([index, settle]) => {
|
|
189
|
+
const id = entries[index].id;
|
|
190
|
+
const answer = byId.get(id);
|
|
191
|
+
// No answer, a JSON-RPC error, or a handler that raised: the caller is
|
|
192
|
+
// not getting the data, so nothing is charged for it.
|
|
193
|
+
const failed = !answer
|
|
194
|
+
|| 'error' in answer
|
|
195
|
+
|| answer.result?.isError === true;
|
|
196
|
+
if (failed)
|
|
197
|
+
return;
|
|
198
|
+
try {
|
|
199
|
+
const receipt = await settle();
|
|
200
|
+
if (receipt.success === false) {
|
|
201
|
+
// Settlement failed after the handler ran. The bytes exist but must
|
|
202
|
+
// not ship — nobody was charged for them.
|
|
203
|
+
byId.set(id, failedResult(id, 'Payment settlement failed.'));
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const result = answer.result;
|
|
207
|
+
result._meta = { ...result._meta, 'x402/payment-response': receipt };
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// Facilitator unreachable at settle time. Fail CLOSED: withholding a
|
|
211
|
+
// bulk export costs a retry, and handing one over uncharged is what a
|
|
212
|
+
// scraper waits for.
|
|
213
|
+
byId.set(id, failedResult(id, 'Payment settlement is temporarily unavailable. Retry shortly.'));
|
|
214
|
+
}
|
|
215
|
+
}));
|
|
216
|
+
// Rebuild in the caller's original order, challenges spliced back in.
|
|
217
|
+
const merged = entries
|
|
218
|
+
.map((e, i) => blocked.get(i) ?? byId.get(e.id))
|
|
219
|
+
.filter(Boolean);
|
|
220
|
+
return isBatch ? merged : (merged[0] ?? null);
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=x402.js.map
|
package/dist/x402.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x402.js","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,kEAAkE;AAClE,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,4EAA4E;AAC5E,iEAAiE;AACjE,EAAE;AACF,gFAAgF;AAChF,WAAW;AACX,EAAE;AACF,mFAAmF;AACnF,yEAAyE;AACzE,6EAA6E;AAC7E,sFAAsF;AACtF,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,2DAA2D;AAC3D,gFAAgF;AAChF,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,2EAA2E;AAC3E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,+EAA+E;AAC/E,uEAAuE;AACvE,2EAA2E;AAC3E,+EAA+E;AAC/E,8EAA8E;AAC9E,gBAAgB;AAChB,EAAE;AACF,0EAA0E;AAC1E,gFAAgF;AAChF,uEAAuE;AACvE,2EAA2E;AAC3E,+EAA+E;AAC/E,0EAA0E;AAC1E,SAAS;AAiHT,oFAAoF;AACpF,SAAS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,CAAC,EAAE,CAAC,CAAC;iBAC/C,MAAM,CAAC,OAAO,CAAa,CAAC;YAE/B,OAAO,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;QAChD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wiki-formant",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "The portable half of a wiki: derived taxonomy with pressable facet controls, a spec-correct MCP transport, markdown twins, block rendering, link normalisation, freshness, rate limiting, a collapsible
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"description": "The portable half of a wiki: derived taxonomy with pressable facet controls, a spec-correct MCP transport, markdown twins, block rendering, link normalisation, freshness, rate limiting, a collapsible rail and a server-rendered facet bar and breadcrumb trail, typeahead and hover-preview hooks, editor nodes, x402 payment gating for an MCP envelope, server-side analytics for both the agent and human lanes, a dead-className check as a bin, and the conditional-GET plumbing agent surfaces need.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"facets-ui",
|
|
25
25
|
"typeahead",
|
|
26
26
|
"search-analytics",
|
|
27
|
-
"tiptap"
|
|
27
|
+
"tiptap",
|
|
28
|
+
"x402",
|
|
29
|
+
"breadcrumbs"
|
|
28
30
|
],
|
|
29
31
|
"sideEffects": false,
|
|
30
32
|
"exports": {
|
|
@@ -128,6 +130,10 @@
|
|
|
128
130
|
"types": "./dist/react.d.ts",
|
|
129
131
|
"import": "./dist/react.js"
|
|
130
132
|
},
|
|
133
|
+
"./react-server": {
|
|
134
|
+
"types": "./dist/react-server.d.ts",
|
|
135
|
+
"import": "./dist/react-server.js"
|
|
136
|
+
},
|
|
131
137
|
"./dom": {
|
|
132
138
|
"types": "./dist/dom.d.ts",
|
|
133
139
|
"import": "./dist/dom.js"
|
|
@@ -135,10 +141,22 @@
|
|
|
135
141
|
"./tiptap": {
|
|
136
142
|
"types": "./dist/tiptap.d.ts",
|
|
137
143
|
"import": "./dist/tiptap.js"
|
|
144
|
+
},
|
|
145
|
+
"./rola": {
|
|
146
|
+
"types": "./dist/rola.d.ts",
|
|
147
|
+
"import": "./dist/rola.js"
|
|
148
|
+
},
|
|
149
|
+
"./x402": {
|
|
150
|
+
"types": "./dist/x402.d.ts",
|
|
151
|
+
"import": "./dist/x402.js"
|
|
138
152
|
}
|
|
139
153
|
},
|
|
154
|
+
"bin": {
|
|
155
|
+
"check-classes": "./bin/check-classes.mjs"
|
|
156
|
+
},
|
|
140
157
|
"files": [
|
|
141
|
-
"dist"
|
|
158
|
+
"dist",
|
|
159
|
+
"bin"
|
|
142
160
|
],
|
|
143
161
|
"engines": {
|
|
144
162
|
"node": ">=20"
|
|
@@ -149,6 +167,7 @@
|
|
|
149
167
|
"prepublishOnly": "npm run build && node --test 'test/*.test.js'"
|
|
150
168
|
},
|
|
151
169
|
"devDependencies": {
|
|
170
|
+
"@radixdlt/rola": "^2.1.0",
|
|
152
171
|
"@tiptap/core": "^2.10.0",
|
|
153
172
|
"@tiptap/extension-code-block": "^2.10.0",
|
|
154
173
|
"@tiptap/extension-youtube": "^2.10.0",
|
|
@@ -156,15 +175,23 @@
|
|
|
156
175
|
"@tiptap/react": "^2.10.0",
|
|
157
176
|
"@types/node": "^22.0.0",
|
|
158
177
|
"@types/react": "^19.0.0",
|
|
178
|
+
"jose": "^6.2.10",
|
|
159
179
|
"react": "^19.2.4",
|
|
160
180
|
"typescript": "^5.9.0"
|
|
161
181
|
},
|
|
162
182
|
"peerDependencies": {
|
|
163
|
-
"react": ">=18",
|
|
164
183
|
"@tiptap/core": ">=2.10",
|
|
165
|
-
"@tiptap/
|
|
184
|
+
"@tiptap/extension-code-block": ">=2.10",
|
|
166
185
|
"@tiptap/extension-youtube": ">=2.10",
|
|
167
|
-
"@tiptap/
|
|
186
|
+
"@tiptap/react": ">=2.10",
|
|
187
|
+
"react": ">=18",
|
|
188
|
+
"jose": ">=5",
|
|
189
|
+
"@radixdlt/rola": ">=2",
|
|
190
|
+
"@x402/core": "*",
|
|
191
|
+
"@x402/evm": "*",
|
|
192
|
+
"@x402/next": "*",
|
|
193
|
+
"@x402/extensions": "*",
|
|
194
|
+
"viem": "*"
|
|
168
195
|
},
|
|
169
196
|
"peerDependenciesMeta": {
|
|
170
197
|
"react": {
|
|
@@ -181,6 +208,27 @@
|
|
|
181
208
|
},
|
|
182
209
|
"@tiptap/extension-code-block": {
|
|
183
210
|
"optional": true
|
|
211
|
+
},
|
|
212
|
+
"jose": {
|
|
213
|
+
"optional": true
|
|
214
|
+
},
|
|
215
|
+
"@radixdlt/rola": {
|
|
216
|
+
"optional": true
|
|
217
|
+
},
|
|
218
|
+
"@x402/core": {
|
|
219
|
+
"optional": true
|
|
220
|
+
},
|
|
221
|
+
"@x402/evm": {
|
|
222
|
+
"optional": true
|
|
223
|
+
},
|
|
224
|
+
"@x402/next": {
|
|
225
|
+
"optional": true
|
|
226
|
+
},
|
|
227
|
+
"@x402/extensions": {
|
|
228
|
+
"optional": true
|
|
229
|
+
},
|
|
230
|
+
"viem": {
|
|
231
|
+
"optional": true
|
|
184
232
|
}
|
|
185
233
|
}
|
|
186
234
|
}
|