@reclaimprotocol/agent 0.1.22 → 0.1.24
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 +55 -20
- package/lib/authoring/backend.d.ts +13 -10
- package/lib/authoring/tools.js +106 -9
- package/lib/cdp/browser-proxy.d.ts +78 -0
- package/lib/cdp/browser-proxy.js +186 -0
- package/lib/cdp/capture-engine.js +8 -7
- package/lib/cdp/client.d.ts +10 -0
- package/lib/cdp/geo.d.ts +10 -0
- package/lib/cdp/geo.js +36 -0
- package/lib/cdp/index.d.ts +1 -0
- package/lib/cdp/index.js +1 -0
- package/lib/live/cloudflared.d.ts +15 -0
- package/lib/live/cloudflared.js +268 -0
- package/lib/live/page.d.ts +20 -0
- package/lib/live/page.js +134 -0
- package/lib/live/tunnel.d.ts +23 -0
- package/lib/live/tunnel.js +120 -0
- package/lib/live/viewer.d.ts +28 -0
- package/lib/live/viewer.js +232 -0
- package/lib/mcp/api/operations.gen.js +34 -26
- package/lib/mcp/api/to-zod.d.ts +1 -1
- package/lib/mcp/api/to-zod.js +1 -1
- package/lib/mcp/api/tools.js +1 -1
- package/lib/mcp/instructions.d.ts +15 -2
- package/lib/mcp/instructions.js +101 -38
- package/lib/mcp/start.js +4 -3
- package/lib/mcp/tools/agent/analyze.js +5 -1
- package/lib/mcp/tools/agent/attach.d.ts +8 -1
- package/lib/mcp/tools/agent/attach.js +166 -22
- package/lib/mcp/tools/agent/build.d.ts +13 -8
- package/lib/mcp/tools/agent/build.js +22 -11
- package/lib/mcp/tools/agent/capture.js +5 -1
- package/lib/mcp/tools/agent/eval.js +3 -1
- package/lib/mcp/tools/agent/find.js +6 -5
- package/lib/mcp/tools/agent/how-it-works.d.ts +15 -7
- package/lib/mcp/tools/agent/how-it-works.js +57 -17
- package/lib/mcp/tools/agent/live-view.d.ts +21 -0
- package/lib/mcp/tools/agent/live-view.js +153 -0
- package/lib/mcp/tools/agent/pod-proof.d.ts +8 -0
- package/lib/mcp/tools/agent/pod-proof.js +64 -0
- package/lib/mcp/tools/agent/propose.js +29 -3
- package/lib/mcp/tools/agent/proxy.d.ts +3 -0
- package/lib/mcp/tools/agent/proxy.js +199 -0
- package/lib/mcp/tools/agent/publish.js +49 -77
- package/lib/mcp/tools/agent/session.d.ts +2 -1
- package/lib/mcp/tools/agent/session.js +26 -7
- package/lib/mcp/tools/agent/shared.js +17 -8
- package/lib/mcp/tools/authenticate/authenticate.d.ts +11 -0
- package/lib/mcp/tools/authenticate/authenticate.js +143 -121
- package/lib/mcp/tools/authenticate/builder-access.d.ts +8 -3
- package/lib/mcp/tools/authenticate/builder-access.js +8 -3
- package/lib/mcp/tools/mode/mode.d.ts +1 -1
- package/lib/mcp/tools/mode/mode.js +26 -7
- package/lib/old/client.d.ts +9 -0
- package/lib/old/client.js +19 -1
- package/lib/old/instructions.d.ts +9 -1
- package/lib/old/instructions.js +4 -6
- package/lib/old/login-cdp.d.ts +2 -2
- package/lib/old/login-cdp.js +46 -6
- package/lib/old/to-register.d.ts +20 -8
- package/lib/old/to-register.js +7 -1
- package/lib/old/tools/authenticate.js +9 -1
- package/lib/old/tools/get-provider-info.js +6 -5
- package/lib/old/tools/issue-app-credentials.js +3 -2
- package/lib/old/tools/me-providers.js +3 -1
- package/lib/old/tools/publish.d.ts +1 -1
- package/lib/old/tools/publish.js +132 -129
- package/lib/old/tools/update-provider-metadata.d.ts +1 -1
- package/lib/old/tools/update-provider-metadata.js +1 -1
- package/lib/old/tools/verify-sdk-setup.js +1 -1
- package/lib/proof/attestor.d.ts +3 -3
- package/lib/proof/debug-response-dump.js +4 -4
- package/lib/proof/index.d.ts +1 -0
- package/lib/proof/index.js +1 -0
- package/lib/proof/page-replay.d.ts +36 -0
- package/lib/proof/page-replay.js +76 -0
- package/lib/proof/pod-prover.d.ts +47 -0
- package/lib/proof/pod-prover.js +155 -0
- package/lib/proof/replay.d.ts +28 -0
- package/lib/proof/replay.js +39 -18
- package/lib/provider/dom-xpath.js +11 -9
- package/lib/provider/draft.d.ts +13 -8
- package/lib/provider/draft.js +47 -13
- package/lib/provider/injection-doc.d.ts +23 -1
- package/lib/provider/injection-doc.js +34 -21
- package/lib/provider/match-redaction-warning.d.ts +2 -2
- package/lib/provider/match-redaction-warning.js +3 -3
- package/lib/provider/matcher.js +122 -12
- package/lib/provider/secrets.d.ts +3 -3
- package/lib/provider/secrets.js +3 -3
- package/lib/provider/to-version.d.ts +12 -9
- package/lib/provider/to-version.js +16 -4
- package/lib/tools/registry.d.ts +5 -5
- package/lib/tools/registry.js +5 -5
- package/package.json +4 -3
- package/samples/demo-server/README.md +7 -6
- package/skill/SKILL.builder.md +356 -189
- package/skill/SKILL.common.md +314 -79
- package/skill/SKILL.old.md +340 -155
- package/skill/builder-mode.md +58 -17
- package/skill/hash-validation.md +170 -0
- package/skill/interception.md +235 -0
- package/skill/js-sdk-integration.md +13 -7
- package/skill/old-mode.md +53 -12
- package/skill/user-script.md +61 -0
- package/src/authoring/backend.ts +13 -10
- package/src/authoring/tools.ts +128 -9
- package/src/cdp/capture-engine.ts +8 -7
- package/src/cdp/client.ts +8 -0
- package/src/cdp/geo.ts +52 -0
- package/src/cdp/index.ts +1 -0
- package/src/consts.ts +1 -0
- package/src/live/cloudflared.ts +348 -0
- package/src/live/page.ts +145 -0
- package/src/live/tunnel.ts +157 -0
- package/src/live/viewer.ts +293 -0
- package/src/mcp/api/operations.gen.ts +34 -26
- package/src/mcp/api/to-zod.ts +1 -1
- package/src/mcp/api/tools.ts +1 -1
- package/src/mcp/instructions.ts +121 -48
- package/src/mcp/start.ts +4 -3
- package/src/mcp/tools/agent/analyze.ts +5 -1
- package/src/mcp/tools/agent/attach.ts +194 -22
- package/src/mcp/tools/agent/build.ts +26 -15
- package/src/mcp/tools/agent/capture.ts +5 -1
- package/src/mcp/tools/agent/eval.ts +4 -1
- package/src/mcp/tools/agent/find.ts +6 -5
- package/src/mcp/tools/agent/how-it-works.ts +62 -21
- package/src/mcp/tools/agent/live-view.ts +198 -0
- package/src/mcp/tools/agent/pod-proof.ts +90 -0
- package/src/mcp/tools/agent/propose.ts +31 -3
- package/src/mcp/tools/agent/publish.ts +54 -78
- package/src/mcp/tools/agent/session.ts +26 -5
- package/src/mcp/tools/agent/shared.ts +19 -8
- package/src/mcp/tools/authenticate/authenticate.ts +167 -165
- package/src/mcp/tools/authenticate/builder-access.ts +8 -3
- package/src/mcp/tools/mode/mode.ts +28 -7
- package/src/old/client.ts +30 -1
- package/src/old/instructions.ts +4 -10
- package/src/old/login-cdp.ts +50 -6
- package/src/old/to-register.ts +28 -8
- package/src/old/tools/authenticate.ts +9 -1
- package/src/old/tools/get-provider-info.ts +6 -5
- package/src/old/tools/issue-app-credentials.ts +3 -2
- package/src/old/tools/me-providers.ts +3 -1
- package/src/old/tools/publish.ts +140 -130
- package/src/old/tools/update-provider-metadata.ts +1 -1
- package/src/old/tools/verify-sdk-setup.ts +1 -1
- package/src/proof/attestor.ts +3 -3
- package/src/proof/debug-response-dump.ts +4 -4
- package/src/proof/index.ts +8 -0
- package/src/proof/page-replay.ts +131 -0
- package/src/proof/pod-prover.ts +231 -0
- package/src/proof/replay.ts +60 -19
- package/src/provider/dom-xpath.ts +11 -9
- package/src/provider/draft.ts +56 -13
- package/src/provider/injection-doc.ts +37 -24
- package/src/provider/match-redaction-warning.ts +3 -3
- package/src/provider/matcher.ts +151 -10
- package/src/provider/secrets.ts +3 -3
- package/src/provider/to-version.ts +30 -13
- package/src/tools/registry.ts +5 -5
- package/skill/injection-api.md +0 -335
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive live view of one attached tab, over a public URL.
|
|
3
|
+
*
|
|
4
|
+
* Two halves:
|
|
5
|
+
* - OUT: CDP `Page.startScreencast` pushes JPEG frames; each is forwarded to
|
|
6
|
+
* every connected browser as a Server-Sent Event and acked back to CDP.
|
|
7
|
+
* - IN: the viewer POSTs pointer and key events, which are replayed into the
|
|
8
|
+
* page with `Input.dispatch*`.
|
|
9
|
+
*
|
|
10
|
+
* Only ever bound to 127.0.0.1. Reaching it from outside is the tunnel's job
|
|
11
|
+
* (see `tunnel.ts`), and because a quick tunnel is unauthenticated, EVERY
|
|
12
|
+
* route sits behind an unguessable token in the path. A request without it
|
|
13
|
+
* gets a flat 404 — not a 401, which would confirm the server exists.
|
|
14
|
+
*
|
|
15
|
+
* Interactivity is the caller's choice. `interactive: false` still streams,
|
|
16
|
+
* but the input route refuses, which is the right setting for showing someone
|
|
17
|
+
* a run rather than handing them the wheel.
|
|
18
|
+
*/
|
|
19
|
+
import { randomBytes } from 'node:crypto'
|
|
20
|
+
import {
|
|
21
|
+
createServer,
|
|
22
|
+
type IncomingMessage,
|
|
23
|
+
type Server,
|
|
24
|
+
type ServerResponse,
|
|
25
|
+
} from 'node:http'
|
|
26
|
+
import type { AddressInfo } from 'node:net'
|
|
27
|
+
import type { CdpTabClient } from '../cdp/client.ts'
|
|
28
|
+
import { LOGGER } from '../logger.ts'
|
|
29
|
+
import { renderViewerPage } from './page.ts'
|
|
30
|
+
|
|
31
|
+
/** JPEG quality for streamed frames. 60 keeps a text-heavy page readable
|
|
32
|
+
* while staying small enough for a tunnel's uplink. */
|
|
33
|
+
const FRAME_QUALITY = 60
|
|
34
|
+
/** Cap the streamed frame size. Screencast scales to fit, so this bounds
|
|
35
|
+
* bandwidth without changing the page's own layout viewport. */
|
|
36
|
+
const MAX_FRAME_WIDTH = 1280
|
|
37
|
+
const MAX_FRAME_HEIGHT = 800
|
|
38
|
+
/** Bytes accepted on an input POST. Events are tiny; anything larger is
|
|
39
|
+
* either a bug or someone probing. */
|
|
40
|
+
const MAX_INPUT_BYTES = 4096
|
|
41
|
+
|
|
42
|
+
export interface LiveViewOptions {
|
|
43
|
+
/** The tab to stream. */
|
|
44
|
+
tab: CdpTabClient
|
|
45
|
+
/** Forward viewer input into the page. */
|
|
46
|
+
interactive: boolean
|
|
47
|
+
/** Shown in the viewer's header. */
|
|
48
|
+
title?: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface LiveView {
|
|
52
|
+
/** Loopback origin the tunnel should point at. */
|
|
53
|
+
localUrl: string
|
|
54
|
+
/** Port the server bound to. */
|
|
55
|
+
port: number
|
|
56
|
+
/** Unguessable path segment guarding every route. */
|
|
57
|
+
token: string
|
|
58
|
+
/** Path prefix, `/v/<token>`. Append this to the public origin. */
|
|
59
|
+
path: string
|
|
60
|
+
/** Number of viewers currently streaming. */
|
|
61
|
+
viewers: () => number
|
|
62
|
+
stop: () => Promise<void>
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Start the loopback live-view server for `tab`. Resolves once it is
|
|
67
|
+
* listening; the screencast starts with the first viewer and stops with the
|
|
68
|
+
* last, so an idle share costs the page nothing.
|
|
69
|
+
*/
|
|
70
|
+
export async function startLiveView(
|
|
71
|
+
opts: LiveViewOptions,
|
|
72
|
+
): Promise<LiveView> {
|
|
73
|
+
const token = randomBytes(24).toString('base64url')
|
|
74
|
+
const path = `/v/${token}`
|
|
75
|
+
const clients = new Set<ServerResponse>()
|
|
76
|
+
let streaming = false
|
|
77
|
+
let unsubscribe: (() => void) | undefined
|
|
78
|
+
|
|
79
|
+
const startScreencast = async() => {
|
|
80
|
+
if(streaming) {
|
|
81
|
+
return
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
streaming = true
|
|
85
|
+
unsubscribe = opts.tab.subscribe('Page.screencastFrame', (frame) => {
|
|
86
|
+
// Ack first: CDP sends at most one un-acked frame, so a slow or failed
|
|
87
|
+
// write must not stall the stream.
|
|
88
|
+
void opts.tab
|
|
89
|
+
.send('Page.screencastFrameAck', { sessionId: frame.sessionId })
|
|
90
|
+
.catch(() => {})
|
|
91
|
+
const payload = JSON.stringify({ data: frame.data })
|
|
92
|
+
for(const res of clients) {
|
|
93
|
+
res.write(`event: frame\ndata: ${payload}\n\n`)
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
await opts.tab.send('Page.enable')
|
|
97
|
+
await opts.tab.send('Page.startScreencast', {
|
|
98
|
+
format: 'jpeg',
|
|
99
|
+
quality: FRAME_QUALITY,
|
|
100
|
+
maxWidth: MAX_FRAME_WIDTH,
|
|
101
|
+
maxHeight: MAX_FRAME_HEIGHT,
|
|
102
|
+
everyNthFrame: 1,
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const stopScreencast = async() => {
|
|
107
|
+
if(!streaming) {
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
streaming = false
|
|
112
|
+
unsubscribe?.()
|
|
113
|
+
unsubscribe = undefined
|
|
114
|
+
await opts.tab.send('Page.stopScreencast').catch(() => {})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const server = createServer((req, res) => {
|
|
118
|
+
const url = req.url ?? '/'
|
|
119
|
+
// Constant prefix check: everything is scoped under the token, so an
|
|
120
|
+
// unmatched path is indistinguishable from a server that isn't there.
|
|
121
|
+
if(!url.startsWith(path)) {
|
|
122
|
+
res.writeHead(404).end('not found')
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const route = url.slice(path.length) || '/'
|
|
127
|
+
if(req.method === 'GET' && (route === '/' || route.startsWith('/?'))) {
|
|
128
|
+
const body = renderViewerPage({
|
|
129
|
+
base: path,
|
|
130
|
+
interactive: opts.interactive,
|
|
131
|
+
title: opts.title ?? 'Attached tab',
|
|
132
|
+
})
|
|
133
|
+
res.writeHead(200, {
|
|
134
|
+
'content-type': 'text/html; charset=utf-8',
|
|
135
|
+
// A share URL must never be cached or indexed by anything between
|
|
136
|
+
// the viewer and here.
|
|
137
|
+
'cache-control': 'no-store',
|
|
138
|
+
'referrer-policy': 'no-referrer',
|
|
139
|
+
}).end(body)
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if(req.method === 'GET' && route === '/stream') {
|
|
144
|
+
res.writeHead(200, {
|
|
145
|
+
'content-type': 'text/event-stream',
|
|
146
|
+
'cache-control': 'no-store',
|
|
147
|
+
connection: 'keep-alive',
|
|
148
|
+
// Defeat proxy buffering, which would otherwise hold frames back.
|
|
149
|
+
'x-accel-buffering': 'no',
|
|
150
|
+
})
|
|
151
|
+
res.write(': connected\n\n')
|
|
152
|
+
clients.add(res)
|
|
153
|
+
void startScreencast().catch((err) => {
|
|
154
|
+
LOGGER.warn({ err }, 'live view: screencast failed to start')
|
|
155
|
+
})
|
|
156
|
+
req.on('close', () => {
|
|
157
|
+
clients.delete(res)
|
|
158
|
+
if(!clients.size) {
|
|
159
|
+
void stopScreencast()
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if(req.method === 'POST' && route === '/input') {
|
|
166
|
+
if(!opts.interactive) {
|
|
167
|
+
res.writeHead(403).end('view only')
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
readJson(req, MAX_INPUT_BYTES)
|
|
172
|
+
.then((body) => dispatchInput(opts.tab, body))
|
|
173
|
+
.then(() => res.writeHead(204).end())
|
|
174
|
+
.catch((err) => {
|
|
175
|
+
LOGGER.debug({ err }, 'live view: input rejected')
|
|
176
|
+
res.writeHead(400).end('bad input')
|
|
177
|
+
})
|
|
178
|
+
return
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
res.writeHead(404).end('not found')
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
await new Promise<void>((resolve) => {
|
|
185
|
+
server.listen(0, '127.0.0.1', resolve)
|
|
186
|
+
})
|
|
187
|
+
const port = (server.address() as AddressInfo).port
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
localUrl: `http://127.0.0.1:${port}`,
|
|
191
|
+
port,
|
|
192
|
+
token,
|
|
193
|
+
path,
|
|
194
|
+
viewers: () => clients.size,
|
|
195
|
+
stop: async() => {
|
|
196
|
+
await stopScreencast()
|
|
197
|
+
for(const res of clients) {
|
|
198
|
+
res.end()
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
clients.clear()
|
|
202
|
+
await closeServer(server)
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function closeServer(server: Server): Promise<void> {
|
|
208
|
+
return new Promise((resolve) => {
|
|
209
|
+
server.close(() => resolve())
|
|
210
|
+
// A held-open SSE response would otherwise keep the server alive.
|
|
211
|
+
server.closeAllConnections?.()
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function readJson(
|
|
216
|
+
req: IncomingMessage,
|
|
217
|
+
limit: number,
|
|
218
|
+
): Promise<Record<string, unknown>> {
|
|
219
|
+
return new Promise((resolve, reject) => {
|
|
220
|
+
let size = 0
|
|
221
|
+
const chunks: Buffer[] = []
|
|
222
|
+
req.on('data', (chunk: Buffer) => {
|
|
223
|
+
size += chunk.length
|
|
224
|
+
if(size > limit) {
|
|
225
|
+
reject(new Error('input too large'))
|
|
226
|
+
req.destroy()
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
chunks.push(chunk)
|
|
231
|
+
})
|
|
232
|
+
req.on('end', () => {
|
|
233
|
+
try {
|
|
234
|
+
resolve(JSON.parse(Buffer.concat(chunks).toString('utf8')))
|
|
235
|
+
} catch(err) {
|
|
236
|
+
reject(err instanceof Error ? err : new Error('bad json'))
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
req.on('error', reject)
|
|
240
|
+
})
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** Replay one viewer event into the page. Unknown shapes throw, so the route
|
|
244
|
+
* answers 400 rather than forwarding something arbitrary to CDP. */
|
|
245
|
+
async function dispatchInput(
|
|
246
|
+
tab: CdpTabClient,
|
|
247
|
+
body: Record<string, unknown>,
|
|
248
|
+
): Promise<void> {
|
|
249
|
+
const num = (v: unknown) => (typeof v === 'number' && Number.isFinite(v)
|
|
250
|
+
? v
|
|
251
|
+
: 0)
|
|
252
|
+
|
|
253
|
+
if(body.kind === 'mouse') {
|
|
254
|
+
const type = String(body.type)
|
|
255
|
+
if(!['mousePressed', 'mouseReleased', 'mouseMoved', 'mouseWheel']
|
|
256
|
+
.includes(type)) {
|
|
257
|
+
throw new Error(`unsupported mouse type ${type}`)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
await tab.send('Input.dispatchMouseEvent', {
|
|
261
|
+
type,
|
|
262
|
+
x: num(body.x),
|
|
263
|
+
y: num(body.y),
|
|
264
|
+
button: type === 'mouseWheel' ? 'none' : 'left',
|
|
265
|
+
clickCount: type === 'mouseWheel' ? 0 : 1,
|
|
266
|
+
...(type === 'mouseWheel'
|
|
267
|
+
? { deltaX: num(body.deltaX), deltaY: num(body.deltaY) }
|
|
268
|
+
: {}),
|
|
269
|
+
})
|
|
270
|
+
return
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if(body.kind === 'key') {
|
|
274
|
+
const type = String(body.type)
|
|
275
|
+
if(type !== 'keyDown' && type !== 'keyUp') {
|
|
276
|
+
throw new Error(`unsupported key type ${type}`)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const key = String(body.key ?? '')
|
|
280
|
+
// A single printable character needs `text` as well, or the page sees the
|
|
281
|
+
// keypress but no character is inserted.
|
|
282
|
+
const text = key.length === 1 ? key : undefined
|
|
283
|
+
await tab.send('Input.dispatchKeyEvent', {
|
|
284
|
+
type,
|
|
285
|
+
key,
|
|
286
|
+
code: String(body.code ?? ''),
|
|
287
|
+
...(text && type === 'keyDown' ? { text } : {}),
|
|
288
|
+
})
|
|
289
|
+
return
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
throw new Error('unknown event kind')
|
|
293
|
+
}
|
|
@@ -466,7 +466,7 @@ export const MCP_TOOLS = {
|
|
|
466
466
|
}),
|
|
467
467
|
},
|
|
468
468
|
"CreateProvider": {
|
|
469
|
-
description: "Create a provider\n\nCreate a new Reclaim provider. Use this only after `providers` returned nothing useful for the domain. The caller must be an active member of the target organization.\nCreates a new provider in the specified organization. `visibility` is coerced to `PRIVATE` at creation regardless of what's sent; the author may toggle to `PUBLIC` later via `PATCH /providers/{id}`. While `PRIVATE`, versions go
|
|
469
|
+
description: "Create a provider\n\nCreate a new Reclaim provider. Use this only after `providers` returned nothing useful for the domain. The caller must be an active member of the target organization.\nCreates a new provider in the specified organization. `visibility` is coerced to `PRIVATE` at creation regardless of what's sent; the author may toggle to `PUBLIC` later via `PATCH /providers/{id}`. While `PRIVATE`, versions go live freely; once `PUBLIC`, non-admin versions need admin review. See `Provider.visibility`.\nThe server also seeds an initial `0.1.0` version on the `draft` branch in the same transaction so the provider is immediately editable. Its `initialUrl` defaults to `https://<domain>`; all other version fields fall back to their schema-declared defaults (a `structured` verificationType, empty requests, empty web settings). `Provider.latestVersion` stays `null` until the draft is promoted to the live channel.",
|
|
470
470
|
inputSchema: toZod({
|
|
471
471
|
"type": "object",
|
|
472
472
|
"properties": {
|
|
@@ -497,7 +497,7 @@ export const MCP_TOOLS = {
|
|
|
497
497
|
"format": "uuid"
|
|
498
498
|
},
|
|
499
499
|
"domain": {
|
|
500
|
-
"description": "Canonical root domain (
|
|
500
|
+
"description": "Canonical root domain (for example, `github.com`). No scheme, no port, no path.",
|
|
501
501
|
"type": "string",
|
|
502
502
|
"format": "hostname",
|
|
503
503
|
"minLength": 1,
|
|
@@ -558,12 +558,12 @@ export const MCP_TOOLS = {
|
|
|
558
558
|
"brandUrl": {
|
|
559
559
|
"type": "string",
|
|
560
560
|
"format": "uri",
|
|
561
|
-
"description": "Canonical homepage of the brand (
|
|
561
|
+
"description": "Canonical homepage of the brand (for example, `https://google.com`). Used in brand-link cards and JSON-LD.",
|
|
562
562
|
"maxLength": 2000
|
|
563
563
|
},
|
|
564
564
|
"primaryDataPoint": {
|
|
565
565
|
"type": "string",
|
|
566
|
-
"description": "Headline data point — the single most-important variable this provider can verify (
|
|
566
|
+
"description": "Headline data point — the single most-important variable this provider can verify (for example, `subscriber count`). Used in the provider's SEO title.",
|
|
567
567
|
"maxLength": 200
|
|
568
568
|
},
|
|
569
569
|
"dataPoints": {
|
|
@@ -670,10 +670,11 @@ export const MCP_TOOLS = {
|
|
|
670
670
|
},
|
|
671
671
|
"branch": {
|
|
672
672
|
"type": "string",
|
|
673
|
-
"description": "Branch (lifecycle stage) of this provider version.\n\n- `ai`: changes authored by the AI assistant live on this branch.\n\n- `draft`: a human is actively editing the version.\n\n- `in_review`: the author has submitted the version to be made\n public and it is awaiting review. On approval the branch tag\n is cleared (the version is promoted to the live channel and becomes\n public).\n\n- `rejected`: review concluded with a rejection. When the author\n addresses the feedback the branch transitions back to\n `in_review`.",
|
|
673
|
+
"description": "Branch (lifecycle stage) of this provider version.\n\n- `ai`: changes authored by the AI assistant live on this branch.\n\n- `draft`: a human is actively editing the version.\n\n- `fixed`: a proven AI repair. It remains pinned to its explicit\n version and does not replace the live trunk version.\n\n- `in_review`: the author has submitted the version to be made\n public and it is awaiting review. On approval the branch tag\n is cleared (the version is promoted to the live channel and becomes\n public).\n\n- `rejected`: review concluded with a rejection. When the author\n addresses the feedback the branch transitions back to\n `in_review`.",
|
|
674
674
|
"enum": [
|
|
675
675
|
"ai",
|
|
676
676
|
"draft",
|
|
677
|
+
"fixed",
|
|
677
678
|
"in_review",
|
|
678
679
|
"rejected"
|
|
679
680
|
]
|
|
@@ -811,7 +812,7 @@ export const MCP_TOOLS = {
|
|
|
811
812
|
"items": {
|
|
812
813
|
"type": "object",
|
|
813
814
|
"additionalProperties": false,
|
|
814
|
-
"description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (
|
|
815
|
+
"description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (that is, \"HTTP/1.1 200 OK\")",
|
|
815
816
|
"properties": {
|
|
816
817
|
"xPath": {
|
|
817
818
|
"type": "string",
|
|
@@ -819,7 +820,7 @@ export const MCP_TOOLS = {
|
|
|
819
820
|
},
|
|
820
821
|
"jsonPath": {
|
|
821
822
|
"type": "string",
|
|
822
|
-
"description": "expect a JSON response, retrieve the item at this path using dot notation for
|
|
823
|
+
"description": "expect a JSON response, retrieve the item at this path using dot notation, for example 'email.addresses.0'."
|
|
823
824
|
},
|
|
824
825
|
"regex": {
|
|
825
826
|
"type": "string",
|
|
@@ -964,7 +965,7 @@ export const MCP_TOOLS = {
|
|
|
964
965
|
"items": {
|
|
965
966
|
"type": "object",
|
|
966
967
|
"additionalProperties": false,
|
|
967
|
-
"description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (
|
|
968
|
+
"description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (that is, \"HTTP/1.1 200 OK\")",
|
|
968
969
|
"properties": {
|
|
969
970
|
"xPath": {
|
|
970
971
|
"type": "string",
|
|
@@ -972,7 +973,7 @@ export const MCP_TOOLS = {
|
|
|
972
973
|
},
|
|
973
974
|
"jsonPath": {
|
|
974
975
|
"type": "string",
|
|
975
|
-
"description": "expect a JSON response, retrieve the item at this path using dot notation for
|
|
976
|
+
"description": "expect a JSON response, retrieve the item at this path using dot notation, for example 'email.addresses.0'."
|
|
976
977
|
},
|
|
977
978
|
"regex": {
|
|
978
979
|
"type": "string",
|
|
@@ -1029,8 +1030,8 @@ export const MCP_TOOLS = {
|
|
|
1029
1030
|
"properties": {
|
|
1030
1031
|
"geoLocation": {
|
|
1031
1032
|
"type": "string",
|
|
1032
|
-
"description": "Geographic location
|
|
1033
|
-
"maxLength":
|
|
1033
|
+
"description": "Geographic location the verification should appear to originate from: a 2-letter ISO country code, or a parameter the attestor resolves at proof time. `{{DYNAMIC_GEO}}` and `{{DYNAMIC_GEO_SECRET}}` are the Verification Client's standard names for the end-user's own country — the `_SECRET` one is delivered as a secret param, so the attestor never learns which country the proof egressed from.",
|
|
1034
|
+
"maxLength": 64,
|
|
1034
1035
|
"default": "{{DYNAMIC_GEO}}"
|
|
1035
1036
|
},
|
|
1036
1037
|
"clientOptions": {
|
|
@@ -1438,7 +1439,7 @@ export const MCP_TOOLS = {
|
|
|
1438
1439
|
}),
|
|
1439
1440
|
},
|
|
1440
1441
|
"DeleteProviderVersion": {
|
|
1441
|
-
description: "Delete a provider version\n\nSoft-archives a version on the `draft`, `ai`, or `rejected` branch — sets `status` to `ARCHIVED` so history is preserved.
|
|
1442
|
+
description: "Delete a provider version\n\nSoft-archives a version on the `draft`, `ai`, or `rejected` branch — sets `status` to `ARCHIVED` so history is preserved. `fixed`, trunk (live), and `in_review` versions cannot be archived this way; archive the parent provider instead. Supports optimistic concurrency via `If-Match`.",
|
|
1442
1443
|
inputSchema: toZod({
|
|
1443
1444
|
"type": "object",
|
|
1444
1445
|
"properties": {
|
|
@@ -1774,7 +1775,7 @@ export const MCP_TOOLS = {
|
|
|
1774
1775
|
}),
|
|
1775
1776
|
},
|
|
1776
1777
|
"GetProviderVersion": {
|
|
1777
|
-
description: "Get a specific provider version",
|
|
1778
|
+
description: "Get a specific provider version\n\nFetches one exact canonical version. Trunk is public when the provider is public. Non-trunk versions are visible to admins and members of the provider's organization. A member of the organization that paid for a successful AI repair may also read only the exact `fixed` version created by that repair.",
|
|
1778
1779
|
inputSchema: toZod({
|
|
1779
1780
|
"type": "object",
|
|
1780
1781
|
"properties": {
|
|
@@ -2151,7 +2152,7 @@ export const MCP_TOOLS = {
|
|
|
2151
2152
|
}),
|
|
2152
2153
|
},
|
|
2153
2154
|
"ListProviderVersions": {
|
|
2154
|
-
description: "List a provider's versions\n\nLists versions visible to the caller. Non-public branches (`ai`, `draft`, `in_review`, `rejected`) are only visible to members of the provider's owning organization.",
|
|
2155
|
+
description: "List a provider's versions\n\nLists versions visible to the caller. Non-public branches (`ai`, `draft`, `fixed`, `in_review`, `rejected`) are only visible to members of the provider's owning organization.",
|
|
2155
2156
|
inputSchema: toZod({
|
|
2156
2157
|
"type": "object",
|
|
2157
2158
|
"properties": {
|
|
@@ -2306,7 +2307,7 @@ export const MCP_TOOLS = {
|
|
|
2306
2307
|
}),
|
|
2307
2308
|
},
|
|
2308
2309
|
"Providers": {
|
|
2309
|
-
description: "Search providers\n\nSearch
|
|
2310
|
+
description: "Search providers\n\nSearch Reclaim providers by domain or data point. A provider is the recipe an end-user follows to prove something about themselves, such as \"I have N followers on Twitter\".\nCall this BEFORE `create_provider` — most popular domains already have a public provider you can reuse, and creating another one just stacks duplicates.\nReturns a paginated list of the providers the caller can see: public providers to everyone, private providers only to members of the owning organization.",
|
|
2310
2311
|
inputSchema: toZod({
|
|
2311
2312
|
"type": "object",
|
|
2312
2313
|
"properties": {
|
|
@@ -2677,7 +2678,7 @@ export const MCP_TOOLS = {
|
|
|
2677
2678
|
"properties": {
|
|
2678
2679
|
"notes": {
|
|
2679
2680
|
"type": "string",
|
|
2680
|
-
"description": "Optional note from the author to reviewers (changelog, areas to focus on,
|
|
2681
|
+
"description": "Optional note from the author to reviewers (changelog, areas to focus on, and so on).",
|
|
2681
2682
|
"maxLength": 10000
|
|
2682
2683
|
}
|
|
2683
2684
|
}
|
|
@@ -2840,6 +2841,13 @@ export const MCP_TOOLS = {
|
|
|
2840
2841
|
"minLength": 1,
|
|
2841
2842
|
"maxLength": 200
|
|
2842
2843
|
},
|
|
2844
|
+
"region": {
|
|
2845
|
+
"type": "string",
|
|
2846
|
+
"nullable": true,
|
|
2847
|
+
"description": "Confirm or override the provider's region. Send `null` to clear it so the provider applies to every region. See `Provider.region`.",
|
|
2848
|
+
"pattern": "^[a-z]{2}(-[a-z]{2})?$",
|
|
2849
|
+
"maxLength": 5
|
|
2850
|
+
},
|
|
2843
2851
|
"title": {
|
|
2844
2852
|
"type": "string",
|
|
2845
2853
|
"minLength": 1,
|
|
@@ -2892,12 +2900,12 @@ export const MCP_TOOLS = {
|
|
|
2892
2900
|
"brandUrl": {
|
|
2893
2901
|
"type": "string",
|
|
2894
2902
|
"format": "uri",
|
|
2895
|
-
"description": "Canonical homepage of the brand (
|
|
2903
|
+
"description": "Canonical homepage of the brand (for example, `https://google.com`). Used in brand-link cards and JSON-LD.",
|
|
2896
2904
|
"maxLength": 2000
|
|
2897
2905
|
},
|
|
2898
2906
|
"primaryDataPoint": {
|
|
2899
2907
|
"type": "string",
|
|
2900
|
-
"description": "Headline data point — the single most-important variable this provider can verify (
|
|
2908
|
+
"description": "Headline data point — the single most-important variable this provider can verify (for example, `subscriber count`). Used in the provider's SEO title.",
|
|
2901
2909
|
"maxLength": 200
|
|
2902
2910
|
},
|
|
2903
2911
|
"dataPoints": {
|
|
@@ -2933,7 +2941,7 @@ export const MCP_TOOLS = {
|
|
|
2933
2941
|
}),
|
|
2934
2942
|
},
|
|
2935
2943
|
"UpdateProviderVersion": {
|
|
2936
|
-
description: "Update a provider version\n\nMutable only while the version is on the `draft` or `rejected` branch. Versions on `in_review
|
|
2944
|
+
description: "Update a provider version\n\nMutable only while the version is on the `draft` or `rejected` branch. Versions on `fixed`, `in_review`, or the live channel reject all writes here. Caller must be a member of the provider's owning organization. Supports optimistic concurrency via `If-Match`.",
|
|
2937
2945
|
inputSchema: toZod({
|
|
2938
2946
|
"type": "object",
|
|
2939
2947
|
"properties": {
|
|
@@ -2975,7 +2983,7 @@ export const MCP_TOOLS = {
|
|
|
2975
2983
|
"body": {
|
|
2976
2984
|
"type": "object",
|
|
2977
2985
|
"additionalProperties": false,
|
|
2978
|
-
"description": "Partial update of a provider version. Mutable only while the version is on the `draft` or `rejected` branch; versions on `in_review
|
|
2986
|
+
"description": "Partial update of a provider version. Mutable only while the version is on the `draft` or `rejected` branch; versions on `fixed`, `in_review`, or the live channel reject all writes here. The semver does not change on update — `build_number` increments instead, giving callers a monotonic revision counter without touching the (major, minor, patch) PK. `verificationType` and `prompt` may be updated; omit either to carry the prior build's value forward.",
|
|
2979
2987
|
"properties": {
|
|
2980
2988
|
"initialUrl": {
|
|
2981
2989
|
"type": "string",
|
|
@@ -3114,7 +3122,7 @@ export const MCP_TOOLS = {
|
|
|
3114
3122
|
"items": {
|
|
3115
3123
|
"type": "object",
|
|
3116
3124
|
"additionalProperties": false,
|
|
3117
|
-
"description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (
|
|
3125
|
+
"description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (that is, \"HTTP/1.1 200 OK\")",
|
|
3118
3126
|
"properties": {
|
|
3119
3127
|
"xPath": {
|
|
3120
3128
|
"type": "string",
|
|
@@ -3122,7 +3130,7 @@ export const MCP_TOOLS = {
|
|
|
3122
3130
|
},
|
|
3123
3131
|
"jsonPath": {
|
|
3124
3132
|
"type": "string",
|
|
3125
|
-
"description": "expect a JSON response, retrieve the item at this path using dot notation for
|
|
3133
|
+
"description": "expect a JSON response, retrieve the item at this path using dot notation, for example 'email.addresses.0'."
|
|
3126
3134
|
},
|
|
3127
3135
|
"regex": {
|
|
3128
3136
|
"type": "string",
|
|
@@ -3264,7 +3272,7 @@ export const MCP_TOOLS = {
|
|
|
3264
3272
|
"items": {
|
|
3265
3273
|
"type": "object",
|
|
3266
3274
|
"additionalProperties": false,
|
|
3267
|
-
"description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (
|
|
3275
|
+
"description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (that is, \"HTTP/1.1 200 OK\")",
|
|
3268
3276
|
"properties": {
|
|
3269
3277
|
"xPath": {
|
|
3270
3278
|
"type": "string",
|
|
@@ -3272,7 +3280,7 @@ export const MCP_TOOLS = {
|
|
|
3272
3280
|
},
|
|
3273
3281
|
"jsonPath": {
|
|
3274
3282
|
"type": "string",
|
|
3275
|
-
"description": "expect a JSON response, retrieve the item at this path using dot notation for
|
|
3283
|
+
"description": "expect a JSON response, retrieve the item at this path using dot notation, for example 'email.addresses.0'."
|
|
3276
3284
|
},
|
|
3277
3285
|
"regex": {
|
|
3278
3286
|
"type": "string",
|
|
@@ -3329,8 +3337,8 @@ export const MCP_TOOLS = {
|
|
|
3329
3337
|
"properties": {
|
|
3330
3338
|
"geoLocation": {
|
|
3331
3339
|
"type": "string",
|
|
3332
|
-
"description": "Geographic location
|
|
3333
|
-
"maxLength":
|
|
3340
|
+
"description": "Geographic location the verification should appear to originate from: a 2-letter ISO country code, or a parameter the attestor resolves at proof time. `{{DYNAMIC_GEO}}` and `{{DYNAMIC_GEO_SECRET}}` are the Verification Client's standard names for the end-user's own country — the `_SECRET` one is delivered as a secret param, so the attestor never learns which country the proof egressed from.",
|
|
3341
|
+
"maxLength": 64,
|
|
3334
3342
|
"default": "{{DYNAMIC_GEO}}"
|
|
3335
3343
|
},
|
|
3336
3344
|
"clientOptions": {
|
package/src/mcp/api/to-zod.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { JSONSchema } from 'zod/v4/core'
|
|
|
6
6
|
*
|
|
7
7
|
* The generator (`packages/app/scripts/mcp-tools-gen.ts`) inlines `$ref`s it
|
|
8
8
|
* walks through `properties`/`items`, but it does NOT recurse into `allOf` /
|
|
9
|
-
* `anyOf` / `oneOf`. So a schema composed with `allOf` (
|
|
9
|
+
* `anyOf` / `oneOf`. So a schema composed with `allOf` (for example,
|
|
10
10
|
* `RequestSelectionTemplate =
|
|
11
11
|
* allOf[ RequestSelection, { multiple, required } ]`,
|
|
12
12
|
* surfaced by the proof tools' `allowedJsRequests`) can carry a dangling
|
package/src/mcp/api/tools.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { MCP_TOOLS } from './operations.gen.ts'
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The generated `MCP_TOOLS` are keyed by OpenAPI `operationId` (PascalCase,
|
|
12
|
-
*
|
|
12
|
+
* For example, `GetMe`). MCP tools are conventionally snake_case, matching the
|
|
13
13
|
* hand-written tools in this server. Convert the public tool name here while
|
|
14
14
|
* still dispatching to the API with the original operationId — doing this in
|
|
15
15
|
* the (non-generated) registration keeps it from being reverted on regen.
|