@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
|
@@ -21,6 +21,16 @@ export interface Draft {
|
|
|
21
21
|
* validate each against its own selector. */
|
|
22
22
|
extractions: Extraction[];
|
|
23
23
|
}
|
|
24
|
+
/** A navigation script installed for every later page load of the authoring
|
|
25
|
+
* session. `identifier` is the CDP registration, so it can be removed. */
|
|
26
|
+
export interface KeptScript {
|
|
27
|
+
script: string;
|
|
28
|
+
identifier?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Holds the session's kept script, replaced by each `keep` call. */
|
|
31
|
+
export interface KeptScriptRef {
|
|
32
|
+
keptScript?: KeptScript;
|
|
33
|
+
}
|
|
24
34
|
/** Per-session draft store: `propose` puts, `replay`/`run_proof` get by id. */
|
|
25
35
|
export interface DraftStore {
|
|
26
36
|
put(draft: Draft): string;
|
|
@@ -46,6 +56,9 @@ export interface AuthoringBackend {
|
|
|
46
56
|
* out. Cloud authoring enables this; local MCP keeps its existing
|
|
47
57
|
* behavior. */
|
|
48
58
|
readonly readOnlyPageEval?: boolean;
|
|
59
|
+
/** Where `test_user_script` keeps its script. Absent for hosts that do not
|
|
60
|
+
* publish it (the cloud loop synthesizes its own navigation script). */
|
|
61
|
+
readonly kept?: KeptScriptRef;
|
|
49
62
|
/** Send a raw CDP command scoped to this session's page. */
|
|
50
63
|
sendCdp(method: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
51
64
|
/** Resolve once `method` (a CDP event) fires on this session's page, or
|
package/lib/authoring/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AuthoringBackend, Draft, DraftStore, ProveOptions, SecretParams, } from './backend.ts';
|
|
1
|
+
export type { AuthoringBackend, Draft, DraftStore, KeptScript, KeptScriptRef, ProveOptions, SecretParams, } from './backend.ts';
|
|
2
2
|
export { makeDraftStore } from './backend.ts';
|
|
3
3
|
export { authoringTools } from './tools.ts';
|
|
4
4
|
export { defineTool, errorAsToolText, extendTool, type RegisteredTool, type ToolDefinition, } from '../tools/registry.ts';
|
package/lib/authoring/tools.js
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.js";
|
|
18
19
|
import { proposeTool } from "../mcp/tools/agent/propose.js";
|
|
19
20
|
import { replayTool } from "../mcp/tools/agent/replay.js";
|
|
@@ -80,10 +81,12 @@ export function authoringTools(resolveBackend) {
|
|
|
80
81
|
return [
|
|
81
82
|
defineTool({
|
|
82
83
|
name: 'navigate',
|
|
83
|
-
description: '
|
|
84
|
-
+ 'Returns the URL the tab
|
|
85
|
-
+ '
|
|
84
|
+
description: 'Navigates the captured tab to a URL and waits for its load event. '
|
|
85
|
+
+ 'Returns the URL the tab landed on, to detect a redirect to a '
|
|
86
|
+
+ 'sign-in page. Any navigation script kept by `test_user_script` '
|
|
87
|
+
+ 'runs on the page.',
|
|
86
88
|
inputSchema: objectSchema({ url: { type: 'string' }, timeoutMs: { type: 'number' } }, ['url']),
|
|
89
|
+
annotations: { openWorldHint: true, destructiveHint: false },
|
|
87
90
|
}, async (args) => {
|
|
88
91
|
const backend = resolveBackend(args);
|
|
89
92
|
const timeoutMs = Number(args.timeoutMs) || 30000;
|
|
@@ -100,19 +103,24 @@ export function authoringTools(resolveBackend) {
|
|
|
100
103
|
}),
|
|
101
104
|
defineTool({
|
|
102
105
|
name: 'eval_in_page',
|
|
103
|
-
description: '
|
|
104
|
-
+ '
|
|
105
|
-
+ '
|
|
106
|
-
+ '`location.reload()`).'
|
|
106
|
+
description: 'Evaluates a JavaScript expression in the page of the remote '
|
|
107
|
+
+ 'authoring browser, not on this machine, and returns its value. '
|
|
108
|
+
+ 'Use it to read a data point from the DOM, check sign-in state, '
|
|
109
|
+
+ 'or trigger the target request (for example, `location.reload()`). '
|
|
110
|
+
+ 'The page cannot reach files or processes on this machine. Return '
|
|
111
|
+
+ 'only the values you need, never cookies or tokens.',
|
|
107
112
|
inputSchema: objectSchema({ expression: { type: 'string' } }, ['expression']),
|
|
113
|
+
annotations: { openWorldHint: true, destructiveHint: false },
|
|
108
114
|
}, (args) => evalInPage(resolveBackend(args), String(args.expression))),
|
|
109
115
|
defineTool({
|
|
110
116
|
name: 'wait_for_page',
|
|
111
|
-
description: '
|
|
112
|
-
+ '
|
|
113
|
-
+ 'wait for
|
|
114
|
-
+ 'cannot see the
|
|
117
|
+
description: 'Evaluates a JavaScript expression in the remote authoring browser '
|
|
118
|
+
+ 'once a second until it is truthy or the timeout elapses. Returns '
|
|
119
|
+
+ '{ ready }. Use it to wait for content to appear. To wait for a '
|
|
120
|
+
+ 'sign-in, use `wait_for_login`: page JavaScript cannot see the '
|
|
121
|
+
+ 'httpOnly session cookie.',
|
|
115
122
|
inputSchema: objectSchema({ expression: { type: 'string' }, timeoutMs: { type: 'number' } }, ['expression']),
|
|
123
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
116
124
|
}, async (args) => {
|
|
117
125
|
const backend = resolveBackend(args);
|
|
118
126
|
const expr = String(args.expression);
|
|
@@ -128,24 +136,30 @@ export function authoringTools(resolveBackend) {
|
|
|
128
136
|
}),
|
|
129
137
|
defineTool({
|
|
130
138
|
name: 'test_user_script',
|
|
131
|
-
description: '
|
|
132
|
-
+ '
|
|
133
|
-
+ '
|
|
134
|
-
+ '
|
|
135
|
-
+ 'the
|
|
136
|
-
+ '
|
|
137
|
-
+ '
|
|
138
|
-
+ '
|
|
139
|
-
+ '
|
|
140
|
-
+ '`
|
|
141
|
-
+ '
|
|
142
|
-
+ '
|
|
143
|
-
+ 'Guide: how_it_works({ topic: "user-script" }).',
|
|
139
|
+
description: 'Installs a navigation script (the `jsUserScripts` field) in the '
|
|
140
|
+
+ 'remote authoring browser, not on this machine, so it runs before '
|
|
141
|
+
+ 'each page load, as it does at verification. Reports whether it '
|
|
142
|
+
+ 'ran and what it threw. With `navigateUrl`, navigates there and '
|
|
143
|
+
+ 'removes the script after reading the result, unless `keep` is '
|
|
144
|
+
+ 'true. Without `navigateUrl`, the script stays installed for '
|
|
145
|
+
+ 'later navigations until a call with `navigateUrl` removes it. '
|
|
146
|
+
+ 'With `keep: true`, the script stays installed for every later '
|
|
147
|
+
+ 'navigation in this session, replaces any earlier kept script, and '
|
|
148
|
+
+ '`create_provider_version_from_capture` publishes it as '
|
|
149
|
+
+ '`jsUserScripts` unless that call passes its own. '
|
|
150
|
+
+ 'See how_it_works({ topic: "user-script" }).',
|
|
144
151
|
inputSchema: objectSchema({
|
|
145
152
|
script: { type: 'string' },
|
|
146
153
|
navigateUrl: { type: 'string' },
|
|
147
154
|
timeoutMs: { type: 'number' },
|
|
155
|
+
keep: {
|
|
156
|
+
type: 'boolean',
|
|
157
|
+
description: 'Keep the script installed for every later navigation in '
|
|
158
|
+
+ 'this session and use it as the published navigation '
|
|
159
|
+
+ 'script.',
|
|
160
|
+
},
|
|
148
161
|
}, ['script']),
|
|
162
|
+
annotations: { openWorldHint: true, destructiveHint: false },
|
|
149
163
|
}, async (args) => {
|
|
150
164
|
const backend = resolveBackend(args);
|
|
151
165
|
const script = String(args.script);
|
|
@@ -169,10 +183,27 @@ export function authoringTools(resolveBackend) {
|
|
|
169
183
|
);
|
|
170
184
|
}
|
|
171
185
|
`;
|
|
186
|
+
const keep = args.keep === true;
|
|
187
|
+
const kept = keep ? backend.kept : undefined;
|
|
188
|
+
assert(!keep || kept, new Error('This host does not support `keep`.'));
|
|
189
|
+
// Replace, never stack: only one kept script runs.
|
|
190
|
+
const previous = kept?.keptScript?.identifier;
|
|
191
|
+
if (previous) {
|
|
192
|
+
await backend.sendCdp('Page.removeScriptToEvaluateOnNewDocument', { identifier: previous }).catch(() => { });
|
|
193
|
+
}
|
|
172
194
|
const installed = (await backend.sendCdp('Page.addScriptToEvaluateOnNewDocument', { source: wrapped }));
|
|
195
|
+
if (kept) {
|
|
196
|
+
kept.keptScript = {
|
|
197
|
+
script,
|
|
198
|
+
...(installed.identifier
|
|
199
|
+
? { identifier: installed.identifier }
|
|
200
|
+
: {}),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
173
203
|
if (typeof args.navigateUrl !== 'string') {
|
|
174
204
|
return {
|
|
175
205
|
installed: true,
|
|
206
|
+
...(keep ? { kept: true } : {}),
|
|
176
207
|
note: 'Installed for the NEXT navigation only — it did not run on '
|
|
177
208
|
+ 'the current page, and stays installed (runs on every later '
|
|
178
209
|
+ 'navigation too) until a follow-up call with navigateUrl '
|
|
@@ -198,6 +229,7 @@ export function authoringTools(resolveBackend) {
|
|
|
198
229
|
const result = value;
|
|
199
230
|
return {
|
|
200
231
|
installed: true,
|
|
232
|
+
...(keep ? { kept: true } : {}),
|
|
201
233
|
navigated: true,
|
|
202
234
|
ran: result?.ran ?? false,
|
|
203
235
|
errors: result?.errors ?? [],
|
|
@@ -206,20 +238,21 @@ export function authoringTools(resolveBackend) {
|
|
|
206
238
|
finally {
|
|
207
239
|
// One-shot test: remove it so it doesn't keep running (and
|
|
208
240
|
// potentially redirecting the tab) on every later navigation.
|
|
209
|
-
if (installed.identifier) {
|
|
241
|
+
if (installed.identifier && !keep) {
|
|
210
242
|
await backend.sendCdp('Page.removeScriptToEvaluateOnNewDocument', { identifier: installed.identifier });
|
|
211
243
|
}
|
|
212
244
|
}
|
|
213
245
|
}),
|
|
214
246
|
defineTool({
|
|
215
247
|
name: 'get_cookies',
|
|
216
|
-
description: '
|
|
217
|
-
+ '
|
|
218
|
-
+ '
|
|
219
|
-
+ '
|
|
220
|
-
+ '
|
|
221
|
-
+ 'Includes httpOnly cookies
|
|
248
|
+
description: 'Returns the names, domains, and flags of the cookies set in the '
|
|
249
|
+
+ 'remote authoring browser. Values are never returned; they stay '
|
|
250
|
+
+ 'in the browser and on the server. A new auth or session cookie '
|
|
251
|
+
+ '(for example, session, sid, auth, jwt) is a reliable sign-in '
|
|
252
|
+
+ 'signal that does not depend on the page language or DOM. '
|
|
253
|
+
+ 'Includes httpOnly cookies that page JavaScript cannot see.',
|
|
222
254
|
inputSchema: objectSchema({}),
|
|
255
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
223
256
|
}, async (args) => {
|
|
224
257
|
const backend = resolveBackend(args);
|
|
225
258
|
const res = (await backend.sendCdp('Network.getCookies'));
|
|
@@ -243,6 +276,7 @@ export function authoringTools(resolveBackend) {
|
|
|
243
276
|
+ 'navigating to the login page. Does NOT navigate (never yanks '
|
|
244
277
|
+ 'the user off login/2FA). Returns { loggedIn, newCookies }.',
|
|
245
278
|
inputSchema: objectSchema({ timeoutMs: { type: 'number' } }),
|
|
279
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
246
280
|
}, async (args) => {
|
|
247
281
|
const backend = resolveBackend(args);
|
|
248
282
|
const deadline = Date.now() + (Number(args.timeoutMs) || 180000);
|
|
@@ -299,9 +333,10 @@ export function authoringTools(resolveBackend) {
|
|
|
299
333
|
}),
|
|
300
334
|
defineTool({
|
|
301
335
|
name: 'list_requests',
|
|
302
|
-
description: '
|
|
303
|
-
+ 'last.
|
|
304
|
-
+ 'contentType
|
|
336
|
+
description: 'Lists captured network requests (method, URL, status, size), '
|
|
337
|
+
+ 'newest last. Filter by method, urlGlob, status range, '
|
|
338
|
+
+ 'contentType, or graphqlOp. Returns metadata only, never '
|
|
339
|
+
+ 'secrets.',
|
|
305
340
|
inputSchema: objectSchema({
|
|
306
341
|
filter: {
|
|
307
342
|
type: 'object',
|
|
@@ -315,6 +350,7 @@ export function authoringTools(resolveBackend) {
|
|
|
315
350
|
},
|
|
316
351
|
},
|
|
317
352
|
}),
|
|
353
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
318
354
|
}, async (args) => {
|
|
319
355
|
const backend = resolveBackend(args);
|
|
320
356
|
const filter = (args.filter ?? {});
|
|
@@ -327,15 +363,15 @@ export function authoringTools(resolveBackend) {
|
|
|
327
363
|
replayTool(resolveBackend),
|
|
328
364
|
defineTool({
|
|
329
365
|
name: 'run_proof',
|
|
330
|
-
description: '
|
|
331
|
-
+ 'looks right. Returns the proof result.
|
|
332
|
-
+ '
|
|
333
|
-
+ '
|
|
334
|
-
+ '
|
|
335
|
-
+ '
|
|
336
|
-
+ '
|
|
337
|
-
+ 'it\'s a property of the site, not a bug in the draft.',
|
|
366
|
+
description: 'Proves the drafted recipe (zkTLS). Call it after `replay_request` '
|
|
367
|
+
+ 'looks right. Returns the proof result. Unlike `replay_request`, '
|
|
368
|
+
+ 'which re-sends from inside the attached browser tab, the '
|
|
369
|
+
+ 'attestor calls the target from its own network and IP. A request '
|
|
370
|
+
+ 'that replayed can still fail here for geo- or IP-bound content '
|
|
371
|
+
+ '(country-locked pages, IP-allowlisted APIs); that is a property '
|
|
372
|
+
+ 'of the site, not a bug in the draft.',
|
|
338
373
|
inputSchema: objectSchema({ draftId: { type: 'string' } }, ['draftId']),
|
|
374
|
+
annotations: { openWorldHint: true, destructiveHint: false },
|
|
339
375
|
},
|
|
340
376
|
// The backend shapes its own result: the cloud returns a lean,
|
|
341
377
|
// secret-free summary (and records the proven recipe for publish); the
|
package/lib/config/store.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface ReclaimAgentConfig {
|
|
|
16
16
|
* - `old_devtools` — externally-supplied identity for OLD-devtools mode
|
|
17
17
|
* (USE_OLD_DEVTOOLS); independent of `session`'s
|
|
18
18
|
* builder token. Deletable with the rest of `src/old/`.
|
|
19
|
+
* - `org_keys` — organization API keys saved by `issue_org_token`, so
|
|
20
|
+
* the org-key tools work without the key in a transcript
|
|
19
21
|
* Sections are persisted independently via `ConfigStore.write`, which
|
|
20
22
|
* merges rather than replaces, so one subsystem never clobbers another's.
|
|
21
23
|
*
|
|
@@ -29,6 +31,14 @@ export interface ReclaimConfig {
|
|
|
29
31
|
browser_agent?: ReclaimAgentConfig;
|
|
30
32
|
session?: CachedSession;
|
|
31
33
|
old_devtools?: OldIdentity;
|
|
34
|
+
org_keys?: SavedOrgKeys;
|
|
35
|
+
}
|
|
36
|
+
/** Organization API keys (`rorg_…`) saved by `issue_org_token`. */
|
|
37
|
+
export interface SavedOrgKeys {
|
|
38
|
+
/** Key by organization ID. */
|
|
39
|
+
byOrg: Record<string, string>;
|
|
40
|
+
/** The organization whose key was saved last. */
|
|
41
|
+
recent?: string;
|
|
32
42
|
}
|
|
33
43
|
/** Which backend the MCP server targets. See `resolveOldMode` in consts.ts. */
|
|
34
44
|
export type DevtoolsMode = 'old' | 'builder';
|