@reclaimprotocol/agent 0.1.32 → 0.1.34
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/lib/authoring/backend.d.ts +13 -0
- package/lib/authoring/index.d.ts +1 -1
- package/lib/authoring/tools.js +78 -42
- package/lib/config/store.d.ts +10 -0
- package/lib/mcp/api/operations.gen.d.ts +247 -4
- package/lib/mcp/api/operations.gen.js +6519 -337
- package/lib/mcp/api/tools.d.ts +10 -2
- package/lib/mcp/api/tools.js +55 -4
- package/lib/mcp/instructions.js +11 -11
- package/lib/mcp/server.d.ts +1 -1
- package/lib/mcp/server.js +3 -0
- package/lib/mcp/start.js +6 -1
- package/lib/mcp/success-response.js +5 -1
- package/lib/mcp/tools/agent/analyze.js +5 -4
- package/lib/mcp/tools/agent/attach.js +11 -7
- package/lib/mcp/tools/agent/build.js +3 -1
- package/lib/mcp/tools/agent/capture.d.ts +2 -2
- package/lib/mcp/tools/agent/capture.js +15 -11
- package/lib/mcp/tools/agent/eval.js +4 -3
- package/lib/mcp/tools/agent/find.js +9 -10
- package/lib/mcp/tools/agent/how-it-works.js +1 -0
- package/lib/mcp/tools/agent/live-view.js +10 -7
- package/lib/mcp/tools/agent/pod-proof.js +7 -11
- package/lib/mcp/tools/agent/propose.js +4 -3
- package/lib/mcp/tools/agent/publish.d.ts +2 -1
- package/lib/mcp/tools/agent/publish.js +12 -6
- package/lib/mcp/tools/agent/replay.js +10 -7
- package/lib/mcp/tools/agent/session.js +16 -8
- package/lib/mcp/tools/agent/shared.js +3 -2
- package/lib/mcp/tools/agent/start-integration.d.ts +15 -0
- package/lib/mcp/tools/agent/start-integration.js +61 -0
- package/lib/mcp/tools/authenticate/authenticate.js +9 -11
- package/lib/mcp/tools/authenticate/build.js +2 -0
- package/lib/mcp/tools/authenticate/builder-access.js +1 -0
- package/lib/mcp/tools/authenticate/eth-key.d.ts +8 -0
- package/lib/mcp/tools/authenticate/eth-key.js +27 -15
- package/lib/mcp/tools/authenticate/import.js +18 -31
- package/lib/mcp/tools/authenticate/issue-org-token.d.ts +8 -0
- package/lib/mcp/tools/authenticate/issue-org-token.js +60 -0
- package/lib/mcp/tools/authenticate/issue.js +9 -9
- package/lib/mcp/tools/authenticate/org-key-store.d.ts +10 -0
- package/lib/mcp/tools/authenticate/org-key-store.js +23 -0
- package/lib/mcp/tools/authenticate/resolve-owner-key.js +10 -12
- package/lib/mcp/tools/mode/mode.js +2 -0
- package/lib/mcp/tools/verification/result.js +52 -12
- package/lib/tools/registry.d.ts +12 -0
- package/lib/tools/registry.js +1 -0
- package/package.json +2 -2
- package/skill/SKILL.builder.md +77 -73
- package/skill/SKILL.common.md +2 -1
- package/skill/builder-mode.md +135 -120
- package/skill/start-integration.md +49 -0
- package/skill/user-script.md +64 -0
- package/skill/verification-client-integration.md +131 -28
- package/src/authoring/backend.ts +15 -0
- package/src/authoring/index.ts +2 -0
- package/src/authoring/tools.ts +86 -42
- package/src/config/store.ts +11 -0
- package/src/mcp/api/operations.gen.ts +6563 -373
- package/src/mcp/api/tools.ts +70 -5
- package/src/mcp/instructions.ts +11 -11
- package/src/mcp/server.ts +4 -0
- package/src/mcp/start.ts +6 -1
- package/src/mcp/success-response.ts +5 -1
- package/src/mcp/tools/agent/analyze.ts +5 -4
- package/src/mcp/tools/agent/attach.ts +11 -7
- package/src/mcp/tools/agent/build.ts +5 -1
- package/src/mcp/tools/agent/capture.ts +20 -12
- package/src/mcp/tools/agent/eval.ts +4 -3
- package/src/mcp/tools/agent/find.ts +9 -10
- package/src/mcp/tools/agent/how-it-works.ts +1 -0
- package/src/mcp/tools/agent/live-view.ts +10 -7
- package/src/mcp/tools/agent/pod-proof.ts +7 -11
- package/src/mcp/tools/agent/propose.ts +4 -3
- package/src/mcp/tools/agent/publish.ts +12 -4
- package/src/mcp/tools/agent/replay.ts +10 -7
- package/src/mcp/tools/agent/session.ts +16 -8
- package/src/mcp/tools/agent/shared.ts +7 -2
- package/src/mcp/tools/agent/start-integration.ts +83 -0
- package/src/mcp/tools/authenticate/authenticate.ts +9 -11
- package/src/mcp/tools/authenticate/build.ts +2 -0
- package/src/mcp/tools/authenticate/builder-access.ts +1 -0
- package/src/mcp/tools/authenticate/eth-key.ts +48 -18
- package/src/mcp/tools/authenticate/import.ts +21 -36
- package/src/mcp/tools/authenticate/issue-org-token.ts +84 -0
- package/src/mcp/tools/authenticate/issue.ts +9 -9
- package/src/mcp/tools/authenticate/org-key-store.ts +25 -0
- package/src/mcp/tools/authenticate/resolve-owner-key.ts +10 -12
- package/src/mcp/tools/mode/mode.ts +2 -0
- package/src/mcp/tools/verification/result.ts +58 -13
- package/src/tools/registry.ts +14 -0
package/src/authoring/tools.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* draft (recipe + secrets) is held server-side; the model only sees an opaque
|
|
15
15
|
* `draftId` and the secret-free provider.
|
|
16
16
|
*/
|
|
17
|
+
import assert from 'node:assert'
|
|
17
18
|
import { findTool } from '../mcp/tools/agent/find.ts'
|
|
18
19
|
import { proposeTool } from '../mcp/tools/agent/propose.ts'
|
|
19
20
|
import { replayTool } from '../mcp/tools/agent/replay.ts'
|
|
@@ -117,13 +118,15 @@ export function authoringTools(
|
|
|
117
118
|
{
|
|
118
119
|
name: 'navigate',
|
|
119
120
|
description:
|
|
120
|
-
'
|
|
121
|
-
+ 'Returns the URL the tab
|
|
122
|
-
+ '
|
|
121
|
+
'Navigates the captured tab to a URL and waits for its load event. '
|
|
122
|
+
+ 'Returns the URL the tab landed on, to detect a redirect to a '
|
|
123
|
+
+ 'sign-in page. Any navigation script kept by `test_user_script` '
|
|
124
|
+
+ 'runs on the page.',
|
|
123
125
|
inputSchema: objectSchema(
|
|
124
126
|
{ url: { type: 'string' }, timeoutMs: { type: 'number' } },
|
|
125
127
|
['url'],
|
|
126
128
|
),
|
|
129
|
+
annotations: { openWorldHint: true, destructiveHint: false },
|
|
127
130
|
},
|
|
128
131
|
async(args) => {
|
|
129
132
|
const backend = resolveBackend(args)
|
|
@@ -147,13 +150,16 @@ export function authoringTools(
|
|
|
147
150
|
{
|
|
148
151
|
name: 'eval_in_page',
|
|
149
152
|
description:
|
|
150
|
-
'
|
|
151
|
-
+ '
|
|
152
|
-
+ '
|
|
153
|
-
+ '`location.reload()`).'
|
|
153
|
+
'Evaluates a JavaScript expression in the page of the remote '
|
|
154
|
+
+ 'authoring browser, not on this machine, and returns its value. '
|
|
155
|
+
+ 'Use it to read a data point from the DOM, check sign-in state, '
|
|
156
|
+
+ 'or trigger the target request (for example, `location.reload()`). '
|
|
157
|
+
+ 'The page cannot reach files or processes on this machine. Return '
|
|
158
|
+
+ 'only the values you need, never cookies or tokens.',
|
|
154
159
|
inputSchema: objectSchema(
|
|
155
160
|
{ expression: { type: 'string' } }, ['expression'],
|
|
156
161
|
),
|
|
162
|
+
annotations: { openWorldHint: true, destructiveHint: false },
|
|
157
163
|
},
|
|
158
164
|
(args) => evalInPage(resolveBackend(args), String(args.expression)),
|
|
159
165
|
),
|
|
@@ -161,14 +167,16 @@ export function authoringTools(
|
|
|
161
167
|
{
|
|
162
168
|
name: 'wait_for_page',
|
|
163
169
|
description:
|
|
164
|
-
'
|
|
165
|
-
+ '
|
|
166
|
-
+ 'wait for
|
|
167
|
-
+ 'cannot see the
|
|
170
|
+
'Evaluates a JavaScript expression in the remote authoring browser '
|
|
171
|
+
+ 'once a second until it is truthy or the timeout elapses. Returns '
|
|
172
|
+
+ '{ ready }. Use it to wait for content to appear. To wait for a '
|
|
173
|
+
+ 'sign-in, use `wait_for_login`: page JavaScript cannot see the '
|
|
174
|
+
+ 'httpOnly session cookie.',
|
|
168
175
|
inputSchema: objectSchema(
|
|
169
176
|
{ expression: { type: 'string' }, timeoutMs: { type: 'number' } },
|
|
170
177
|
['expression'],
|
|
171
178
|
),
|
|
179
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
172
180
|
},
|
|
173
181
|
async(args) => {
|
|
174
182
|
const backend = resolveBackend(args)
|
|
@@ -190,27 +198,34 @@ export function authoringTools(
|
|
|
190
198
|
{
|
|
191
199
|
name: 'test_user_script',
|
|
192
200
|
description:
|
|
193
|
-
'
|
|
194
|
-
+ '
|
|
195
|
-
+ '
|
|
196
|
-
+ '
|
|
197
|
-
+ 'the
|
|
198
|
-
+ '
|
|
199
|
-
+ '
|
|
200
|
-
+ '
|
|
201
|
-
+ '
|
|
202
|
-
+ '`
|
|
203
|
-
+ '
|
|
204
|
-
+ '
|
|
205
|
-
+ 'Guide: how_it_works({ topic: "user-script" }).',
|
|
201
|
+
'Installs a navigation script (the `jsUserScripts` field) in the '
|
|
202
|
+
+ 'remote authoring browser, not on this machine, so it runs before '
|
|
203
|
+
+ 'each page load, as it does at verification. Reports whether it '
|
|
204
|
+
+ 'ran and what it threw. With `navigateUrl`, navigates there and '
|
|
205
|
+
+ 'removes the script after reading the result, unless `keep` is '
|
|
206
|
+
+ 'true. Without `navigateUrl`, the script stays installed for '
|
|
207
|
+
+ 'later navigations until a call with `navigateUrl` removes it. '
|
|
208
|
+
+ 'With `keep: true`, the script stays installed for every later '
|
|
209
|
+
+ 'navigation in this session, replaces any earlier kept script, and '
|
|
210
|
+
+ '`create_provider_version_from_capture` publishes it as '
|
|
211
|
+
+ '`jsUserScripts` unless that call passes its own. '
|
|
212
|
+
+ 'See how_it_works({ topic: "user-script" }).',
|
|
206
213
|
inputSchema: objectSchema(
|
|
207
214
|
{
|
|
208
215
|
script: { type: 'string' },
|
|
209
216
|
navigateUrl: { type: 'string' },
|
|
210
217
|
timeoutMs: { type: 'number' },
|
|
218
|
+
keep: {
|
|
219
|
+
type: 'boolean',
|
|
220
|
+
description:
|
|
221
|
+
'Keep the script installed for every later navigation in '
|
|
222
|
+
+ 'this session and use it as the published navigation '
|
|
223
|
+
+ 'script.',
|
|
224
|
+
},
|
|
211
225
|
},
|
|
212
226
|
['script'],
|
|
213
227
|
),
|
|
228
|
+
annotations: { openWorldHint: true, destructiveHint: false },
|
|
214
229
|
},
|
|
215
230
|
async(args) => {
|
|
216
231
|
const backend = resolveBackend(args)
|
|
@@ -235,13 +250,37 @@ export function authoringTools(
|
|
|
235
250
|
);
|
|
236
251
|
}
|
|
237
252
|
`
|
|
253
|
+
const keep = args.keep === true
|
|
254
|
+
const kept = keep ? backend.kept : undefined
|
|
255
|
+
assert(
|
|
256
|
+
!keep || kept,
|
|
257
|
+
new Error('This host does not support `keep`.'),
|
|
258
|
+
)
|
|
259
|
+
// Replace, never stack: only one kept script runs.
|
|
260
|
+
const previous = kept?.keptScript?.identifier
|
|
261
|
+
if(previous) {
|
|
262
|
+
await backend.sendCdp(
|
|
263
|
+
'Page.removeScriptToEvaluateOnNewDocument',
|
|
264
|
+
{ identifier: previous },
|
|
265
|
+
).catch(() => {})
|
|
266
|
+
}
|
|
267
|
+
|
|
238
268
|
const installed = (await backend.sendCdp(
|
|
239
269
|
'Page.addScriptToEvaluateOnNewDocument', { source: wrapped },
|
|
240
270
|
)) as { identifier?: string }
|
|
271
|
+
if(kept) {
|
|
272
|
+
kept.keptScript = {
|
|
273
|
+
script,
|
|
274
|
+
...(installed.identifier
|
|
275
|
+
? { identifier: installed.identifier }
|
|
276
|
+
: {}),
|
|
277
|
+
}
|
|
278
|
+
}
|
|
241
279
|
|
|
242
280
|
if(typeof args.navigateUrl !== 'string') {
|
|
243
281
|
return {
|
|
244
282
|
installed: true,
|
|
283
|
+
...(keep ? { kept: true } : {}),
|
|
245
284
|
note:
|
|
246
285
|
'Installed for the NEXT navigation only — it did not run on '
|
|
247
286
|
+ 'the current page, and stays installed (runs on every later '
|
|
@@ -276,6 +315,7 @@ export function authoringTools(
|
|
|
276
315
|
value as { ran?: boolean, errors?: string[] } | undefined
|
|
277
316
|
return {
|
|
278
317
|
installed: true,
|
|
318
|
+
...(keep ? { kept: true } : {}),
|
|
279
319
|
navigated: true,
|
|
280
320
|
ran: result?.ran ?? false,
|
|
281
321
|
errors: result?.errors ?? [],
|
|
@@ -283,7 +323,7 @@ export function authoringTools(
|
|
|
283
323
|
} finally {
|
|
284
324
|
// One-shot test: remove it so it doesn't keep running (and
|
|
285
325
|
// potentially redirecting the tab) on every later navigation.
|
|
286
|
-
if(installed.identifier) {
|
|
326
|
+
if(installed.identifier && !keep) {
|
|
287
327
|
await backend.sendCdp(
|
|
288
328
|
'Page.removeScriptToEvaluateOnNewDocument',
|
|
289
329
|
{ identifier: installed.identifier },
|
|
@@ -296,13 +336,14 @@ export function authoringTools(
|
|
|
296
336
|
{
|
|
297
337
|
name: 'get_cookies',
|
|
298
338
|
description:
|
|
299
|
-
'
|
|
300
|
-
+ '
|
|
301
|
-
+ '
|
|
302
|
-
+ '
|
|
303
|
-
+ '
|
|
304
|
-
+ 'Includes httpOnly cookies
|
|
339
|
+
'Returns the names, domains, and flags of the cookies set in the '
|
|
340
|
+
+ 'remote authoring browser. Values are never returned; they stay '
|
|
341
|
+
+ 'in the browser and on the server. A new auth or session cookie '
|
|
342
|
+
+ '(for example, session, sid, auth, jwt) is a reliable sign-in '
|
|
343
|
+
+ 'signal that does not depend on the page language or DOM. '
|
|
344
|
+
+ 'Includes httpOnly cookies that page JavaScript cannot see.',
|
|
305
345
|
inputSchema: objectSchema({}),
|
|
346
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
306
347
|
},
|
|
307
348
|
async(args) => {
|
|
308
349
|
const backend = resolveBackend(args)
|
|
@@ -337,6 +378,7 @@ export function authoringTools(
|
|
|
337
378
|
+ 'navigating to the login page. Does NOT navigate (never yanks '
|
|
338
379
|
+ 'the user off login/2FA). Returns { loggedIn, newCookies }.',
|
|
339
380
|
inputSchema: objectSchema({ timeoutMs: { type: 'number' } }),
|
|
381
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
340
382
|
},
|
|
341
383
|
async(args) => {
|
|
342
384
|
const backend = resolveBackend(args)
|
|
@@ -402,9 +444,10 @@ export function authoringTools(
|
|
|
402
444
|
{
|
|
403
445
|
name: 'list_requests',
|
|
404
446
|
description:
|
|
405
|
-
'
|
|
406
|
-
+ 'last.
|
|
407
|
-
+ 'contentType
|
|
447
|
+
'Lists captured network requests (method, URL, status, size), '
|
|
448
|
+
+ 'newest last. Filter by method, urlGlob, status range, '
|
|
449
|
+
+ 'contentType, or graphqlOp. Returns metadata only, never '
|
|
450
|
+
+ 'secrets.',
|
|
408
451
|
inputSchema: objectSchema({
|
|
409
452
|
filter: {
|
|
410
453
|
type: 'object',
|
|
@@ -418,6 +461,7 @@ export function authoringTools(
|
|
|
418
461
|
},
|
|
419
462
|
},
|
|
420
463
|
}),
|
|
464
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
421
465
|
},
|
|
422
466
|
async(args) => {
|
|
423
467
|
const backend = resolveBackend(args)
|
|
@@ -434,15 +478,15 @@ export function authoringTools(
|
|
|
434
478
|
{
|
|
435
479
|
name: 'run_proof',
|
|
436
480
|
description:
|
|
437
|
-
'
|
|
438
|
-
+ 'looks right. Returns the proof result.
|
|
439
|
-
+ '
|
|
440
|
-
+ '
|
|
441
|
-
+ '
|
|
442
|
-
+ '
|
|
443
|
-
+ '
|
|
444
|
-
+ 'it\'s a property of the site, not a bug in the draft.',
|
|
481
|
+
'Proves the drafted recipe (zkTLS). Call it after `replay_request` '
|
|
482
|
+
+ 'looks right. Returns the proof result. Unlike `replay_request`, '
|
|
483
|
+
+ 'which re-sends from inside the attached browser tab, the '
|
|
484
|
+
+ 'attestor calls the target from its own network and IP. A request '
|
|
485
|
+
+ 'that replayed can still fail here for geo- or IP-bound content '
|
|
486
|
+
+ '(country-locked pages, IP-allowlisted APIs); that is a property '
|
|
487
|
+
+ 'of the site, not a bug in the draft.',
|
|
445
488
|
inputSchema: objectSchema({ draftId: { type: 'string' } }, ['draftId']),
|
|
489
|
+
annotations: { openWorldHint: true, destructiveHint: false },
|
|
446
490
|
},
|
|
447
491
|
// The backend shapes its own result: the cloud returns a lean,
|
|
448
492
|
// secret-free summary (and records the proven recipe for publish); the
|
package/src/config/store.ts
CHANGED
|
@@ -27,6 +27,8 @@ export interface ReclaimAgentConfig {
|
|
|
27
27
|
* - `old_devtools` — externally-supplied identity for OLD-devtools mode
|
|
28
28
|
* (USE_OLD_DEVTOOLS); independent of `session`'s
|
|
29
29
|
* builder token. Deletable with the rest of `src/old/`.
|
|
30
|
+
* - `org_keys` — organization API keys saved by `issue_org_token`, so
|
|
31
|
+
* the org-key tools work without the key in a transcript
|
|
30
32
|
* Sections are persisted independently via `ConfigStore.write`, which
|
|
31
33
|
* merges rather than replaces, so one subsystem never clobbers another's.
|
|
32
34
|
*
|
|
@@ -40,6 +42,15 @@ export interface ReclaimConfig {
|
|
|
40
42
|
browser_agent?: ReclaimAgentConfig
|
|
41
43
|
session?: CachedSession
|
|
42
44
|
old_devtools?: OldIdentity
|
|
45
|
+
org_keys?: SavedOrgKeys
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Organization API keys (`rorg_…`) saved by `issue_org_token`. */
|
|
49
|
+
export interface SavedOrgKeys {
|
|
50
|
+
/** Key by organization ID. */
|
|
51
|
+
byOrg: Record<string, string>
|
|
52
|
+
/** The organization whose key was saved last. */
|
|
53
|
+
recent?: string
|
|
43
54
|
}
|
|
44
55
|
|
|
45
56
|
/** Which backend the MCP server targets. See `resolveOldMode` in consts.ts. */
|