@reclaimprotocol/agent 0.1.18 → 0.1.21
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 +6 -2
- package/lib/authoring/backend.d.ts +4 -0
- package/lib/authoring/tools.js +4 -1
- package/lib/cdp/capture.d.ts +2 -2
- package/lib/cdp/capture.js +25 -21
- package/lib/cdp/client.d.ts +39 -1
- package/lib/cdp/client.js +125 -1
- package/lib/mcp/api/operations.gen.js +33 -9
- package/lib/mcp/instructions.js +27 -3
- package/lib/mcp/remap_errors.js +2 -1
- package/lib/mcp/start.js +16 -9
- package/lib/mcp/tools/agent/attach.d.ts +18 -4
- package/lib/mcp/tools/agent/attach.js +142 -52
- package/lib/mcp/tools/agent/build.d.ts +9 -2
- package/lib/mcp/tools/agent/build.js +15 -7
- package/lib/mcp/tools/agent/capture.d.ts +1 -0
- package/lib/mcp/tools/agent/capture.js +8 -1
- package/lib/mcp/tools/agent/eval.js +2 -3
- package/lib/mcp/tools/agent/how-it-works.d.ts +1 -1
- package/lib/mcp/tools/agent/how-it-works.js +1 -1
- package/lib/mcp/tools/agent/index.d.ts +1 -1
- package/lib/mcp/tools/agent/index.js +1 -1
- package/lib/mcp/tools/agent/publish.d.ts +4 -1
- package/lib/mcp/tools/agent/publish.js +42 -3
- package/lib/mcp/tools/agent/session.d.ts +2 -2
- package/lib/mcp/tools/agent/session.js +21 -5
- package/lib/mcp/tools/agent/shared.js +4 -6
- package/lib/mcp/tools/authenticate/authenticate.d.ts +1 -1
- package/lib/mcp/tools/authenticate/authenticate.js +13 -6
- package/lib/mcp/tools/authenticate/builder-access.d.ts +8 -0
- package/lib/mcp/tools/authenticate/builder-access.js +31 -0
- package/lib/mcp/tools/authenticate/index.d.ts +1 -0
- package/lib/mcp/tools/authenticate/index.js +1 -0
- package/lib/old/login-cdp.js +11 -3
- package/lib/old/tools/build.d.ts +8 -1
- package/lib/old/tools/build.js +6 -2
- package/lib/old/tools/publish.d.ts +10 -1
- package/lib/old/tools/publish.js +49 -3
- package/lib/provider/draft.d.ts +20 -0
- package/lib/provider/draft.js +75 -51
- package/lib/provider/index.d.ts +1 -1
- package/lib/provider/index.js +1 -1
- package/lib/provider/secrets.d.ts +37 -0
- package/lib/provider/secrets.js +147 -6
- package/lib/provider/to-version.d.ts +7 -0
- package/lib/provider/to-version.js +11 -1
- package/package.json +2 -2
- package/skill/SKILL.builder.md +44 -94
- package/skill/SKILL.common.md +102 -0
- package/skill/SKILL.old.md +21 -73
- package/skill/builder-mode.md +2 -2
- package/skill/injection-api.md +95 -10
- package/skill/old-mode.md +2 -2
- package/src/authoring/backend.ts +4 -0
- package/src/authoring/tools.ts +4 -1
- package/src/cdp/capture.ts +24 -24
- package/src/cdp/client.ts +197 -2
- package/src/mcp/api/operations.gen.ts +33 -9
- package/src/mcp/instructions.ts +36 -3
- package/src/mcp/remap_errors.ts +2 -1
- package/src/mcp/start.ts +24 -9
- package/src/mcp/tools/agent/attach.ts +198 -57
- package/src/mcp/tools/agent/build.ts +20 -6
- package/src/mcp/tools/agent/capture.ts +10 -1
- package/src/mcp/tools/agent/eval.ts +2 -3
- package/src/mcp/tools/agent/how-it-works.ts +1 -1
- package/src/mcp/tools/agent/index.ts +1 -1
- package/src/mcp/tools/agent/publish.ts +46 -2
- package/src/mcp/tools/agent/session.ts +29 -8
- package/src/mcp/tools/agent/shared.ts +5 -10
- package/src/mcp/tools/authenticate/authenticate.ts +17 -9
- package/src/mcp/tools/authenticate/builder-access.ts +42 -0
- package/src/mcp/tools/authenticate/index.ts +4 -0
- package/src/old/login-cdp.ts +13 -3
- package/src/old/tools/build.ts +7 -1
- package/src/old/tools/publish.ts +55 -4
- package/src/provider/draft.ts +98 -56
- package/src/provider/index.ts +9 -1
- package/src/provider/secrets.ts +171 -6
- package/src/provider/to-version.ts +12 -1
- package/lib/authoring/find.d.ts +0 -3
- package/lib/authoring/find.js +0 -54
- package/lib/authoring/propose.d.ts +0 -3
- package/lib/authoring/propose.js +0 -109
- package/lib/authoring/replay.d.ts +0 -10
- package/lib/authoring/replay.js +0 -34
- package/lib/cli/args.d.ts +0 -14
- package/lib/cli/args.js +0 -19
- package/lib/cli/commands.d.ts +0 -1
- package/lib/cli/commands.js +0 -19
- package/lib/cli.d.ts +0 -1
- package/lib/cli.js +0 -7
- package/lib/mcp/credentials/authenticate.d.ts +0 -3
- package/lib/mcp/credentials/authenticate.js +0 -108
- package/lib/mcp/credentials/build.d.ts +0 -5
- package/lib/mcp/credentials/build.js +0 -18
- package/lib/mcp/credentials/cache.d.ts +0 -70
- package/lib/mcp/credentials/cache.js +0 -131
- package/lib/mcp/credentials/env-file.d.ts +0 -25
- package/lib/mcp/credentials/env-file.js +0 -71
- package/lib/mcp/credentials/import.d.ts +0 -2
- package/lib/mcp/credentials/import.js +0 -52
- package/lib/mcp/credentials/issue.d.ts +0 -2
- package/lib/mcp/credentials/issue.js +0 -84
- package/lib/mcp/credentials/keypair.d.ts +0 -17
- package/lib/mcp/credentials/keypair.js +0 -48
- package/lib/mcp/credentials/link.d.ts +0 -3
- package/lib/mcp/credentials/link.js +0 -107
- package/lib/mcp/credentials/list-cached.d.ts +0 -2
- package/lib/mcp/credentials/list-cached.js +0 -55
- package/lib/mcp/credentials/owner-key.d.ts +0 -23
- package/lib/mcp/credentials/owner-key.js +0 -58
- package/lib/mcp/credentials/paths.d.ts +0 -12
- package/lib/mcp/credentials/paths.js +0 -35
- package/lib/mcp/credentials/poll.d.ts +0 -27
- package/lib/mcp/credentials/poll.js +0 -61
- package/lib/mcp/credentials/register.d.ts +0 -18
- package/lib/mcp/credentials/register.js +0 -30
- package/lib/mcp/credentials/resolve-owner-key.d.ts +0 -12
- package/lib/mcp/credentials/resolve-owner-key.js +0 -68
- package/lib/mcp/credentials/session-cache.d.ts +0 -14
- package/lib/mcp/credentials/session-cache.js +0 -42
- package/lib/mcp/credentials/status.d.ts +0 -3
- package/lib/mcp/credentials/status.js +0 -76
- package/lib/mcp/register.d.ts +0 -38
- package/lib/mcp/register.js +0 -80
- package/lib/mcp/tools/analyze.d.ts +0 -3
- package/lib/mcp/tools/analyze.js +0 -26
- package/lib/mcp/tools/attach.d.ts +0 -11
- package/lib/mcp/tools/attach.js +0 -72
- package/lib/mcp/tools/capture.d.ts +0 -10
- package/lib/mcp/tools/capture.js +0 -142
- package/lib/mcp/tools/eval.d.ts +0 -5
- package/lib/mcp/tools/eval.js +0 -127
- package/lib/mcp/tools/find.d.ts +0 -3
- package/lib/mcp/tools/find.js +0 -60
- package/lib/mcp/tools/owner-key.d.ts +0 -2
- package/lib/mcp/tools/owner-key.js +0 -63
- package/lib/mcp/tools/proof.d.ts +0 -3
- package/lib/mcp/tools/proof.js +0 -214
- package/lib/mcp/tools/propose.d.ts +0 -9
- package/lib/mcp/tools/propose.js +0 -75
- package/lib/mcp/tools/publish.d.ts +0 -3
- package/lib/mcp/tools/publish.js +0 -59
- package/lib/mcp/tools/replay.d.ts +0 -3
- package/lib/mcp/tools/replay.js +0 -46
- package/lib/mcp/tools/session.d.ts +0 -10
- package/lib/mcp/tools/session.js +0 -29
- package/lib/mcp/tools/verification/diagnose.d.ts +0 -11
- package/lib/mcp/tools/verification/diagnose.js +0 -132
- package/lib/mcp/verifications/build.d.ts +0 -5
- package/lib/mcp/verifications/build.js +0 -14
- package/lib/mcp/verifications/create.d.ts +0 -3
- package/lib/mcp/verifications/create.js +0 -57
- package/lib/mcp/verifications/find.d.ts +0 -3
- package/lib/mcp/verifications/find.js +0 -37
- package/lib/mcp/verifications/get.d.ts +0 -3
- package/lib/mcp/verifications/get.js +0 -26
- package/lib/mcp/verifications/update.d.ts +0 -3
- package/lib/mcp/verifications/update.js +0 -78
- package/lib/old/tools/get-version-config.d.ts +0 -17
- package/lib/old/tools/get-version-config.js +0 -47
- package/lib/routes.gen.d.ts +0 -271
- package/lib/routes.gen.js +0 -73
- package/lib/types/openapi.d.ts +0 -4
- package/lib/types/openapi.gen.d.ts +0 -3967
- package/lib/types/openapi.gen.js +0 -5
- package/lib/types/openapi.js +0 -1
package/lib/mcp/tools/propose.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { draftProvider } from "../../provider/draft.js";
|
|
3
|
-
import { OPRF_MAX_BYTES } from "../../provider/matcher.js";
|
|
4
|
-
import { defineTool } from "../server.js";
|
|
5
|
-
export function makeSecretStore() {
|
|
6
|
-
const map = new Map();
|
|
7
|
-
return {
|
|
8
|
-
put: (values) => {
|
|
9
|
-
const id = `sref_${randomUUID()}`;
|
|
10
|
-
map.set(id, values);
|
|
11
|
-
return id;
|
|
12
|
-
},
|
|
13
|
-
resolve: (ref) => map.get(ref),
|
|
14
|
-
clear: () => map.clear(),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export function proposeTool(captures, secrets) {
|
|
18
|
-
return defineTool({
|
|
19
|
-
name: 'propose_provider',
|
|
20
|
-
description: 'Draft a Reclaim provider JSON from a captured request + ' +
|
|
21
|
-
'a target value. ' +
|
|
22
|
-
'Secret header values are stored server-side and replaced with an ' +
|
|
23
|
-
'opaque secretParamsRef ' +
|
|
24
|
-
'in the response — raw secret values never appear in tool output. ' +
|
|
25
|
-
"`hash` is opt-in: when set, the captured value is OPRF'd so " +
|
|
26
|
-
'the attestor never sees ' +
|
|
27
|
-
'cleartext. Skill should ask the dev first. `oprf-raw` ' +
|
|
28
|
-
'is the only variant that runs ' +
|
|
29
|
-
'without external deps; `oprf` needs gnark (Linux/macOS), ' +
|
|
30
|
-
'`oprf-mpc` needs a TEE attestor.',
|
|
31
|
-
inputSchema: {
|
|
32
|
-
type: 'object',
|
|
33
|
-
properties: {
|
|
34
|
-
captureId: { type: 'string' },
|
|
35
|
-
requestId: { type: 'string' },
|
|
36
|
-
target: { type: 'string' },
|
|
37
|
-
name: { type: 'string' },
|
|
38
|
-
hash: { type: 'string', enum: ['oprf-raw', 'oprf', 'oprf-mpc'] },
|
|
39
|
-
},
|
|
40
|
-
required: ['captureId', 'requestId', 'target', 'name'],
|
|
41
|
-
},
|
|
42
|
-
}, async ({ captureId, requestId, target, name, hash }) => {
|
|
43
|
-
if (hash !== undefined && target.length > OPRF_MAX_BYTES) {
|
|
44
|
-
throw new Error(`OPRF caps hashed values at ${OPRF_MAX_BYTES} bytes; ` +
|
|
45
|
-
`got ${target.length}-byte target ` +
|
|
46
|
-
`"${target}". Try a tighter target ` +
|
|
47
|
-
'(e.g. just the relevant substring) or call ' +
|
|
48
|
-
'propose_provider without `hash`.');
|
|
49
|
-
}
|
|
50
|
-
const session = captures.sessions.get(captureId);
|
|
51
|
-
if (!session) {
|
|
52
|
-
throw new Error(`no capture ${captureId}`);
|
|
53
|
-
}
|
|
54
|
-
const r = session.requests.get(requestId);
|
|
55
|
-
if (!r) {
|
|
56
|
-
throw new Error(`no request ${requestId}`);
|
|
57
|
-
}
|
|
58
|
-
const body = session.bodies.get(requestId);
|
|
59
|
-
if (!body.available) {
|
|
60
|
-
throw new Error(`request body unavailable: ${body.reason}`);
|
|
61
|
-
}
|
|
62
|
-
const reqWithBody = { ...r, responseBody: body.body };
|
|
63
|
-
const { provider, secretRefs } = draftProvider(reqWithBody, target, name, hash);
|
|
64
|
-
// Stash real secret values for later replay/proof.
|
|
65
|
-
const realSecrets = {};
|
|
66
|
-
for (const ref of secretRefs) {
|
|
67
|
-
const real = r.requestHeaders[ref.name];
|
|
68
|
-
if (real !== undefined) {
|
|
69
|
-
realSecrets[ref.name] = real;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const secretParamsRef = secrets.put(realSecrets);
|
|
73
|
-
return { provider, secretRefs, secretParamsRef };
|
|
74
|
-
});
|
|
75
|
-
}
|
package/lib/mcp/tools/publish.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { nextVersion, providerToCreateVersionRequest, } from "../../provider/to-version.js";
|
|
2
|
-
import { defineTool } from "../server.js";
|
|
3
|
-
export function createVersionFromCaptureTool(client) {
|
|
4
|
-
return defineTool({
|
|
5
|
-
name: 'create_provider_version_from_capture',
|
|
6
|
-
description: 'Translate a drafted ReclaimProvider (from propose_provider) into a ' +
|
|
7
|
-
'verification version and persist it via create_provider_version. ' +
|
|
8
|
-
'Call this after run_proof succeeds. ' +
|
|
9
|
-
'Omit `version` to have the tool auto-select the next available ' +
|
|
10
|
-
'version (it lists existing versions and bumps past the highest). ' +
|
|
11
|
-
'For PRIVATE verifications the version goes live immediately; ' +
|
|
12
|
-
'for PUBLIC ones call submit_provider_version_for_review afterwards.',
|
|
13
|
-
inputSchema: {
|
|
14
|
-
type: 'object',
|
|
15
|
-
properties: {
|
|
16
|
-
providerId: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
description: 'UUID of the verification to publish the version on.',
|
|
19
|
-
},
|
|
20
|
-
provider: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
description: 'The ReclaimProvider JSON from propose_provider ' +
|
|
23
|
-
'(with URL parameterisation applied).',
|
|
24
|
-
},
|
|
25
|
-
initialUrl: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
description: 'The website URL the user landed on to trigger the request ' +
|
|
28
|
-
'(e.g. https://github.com/Syed). The URL the verification ' +
|
|
29
|
-
'flow opens for end-users — NOT the API URL inside the provider.',
|
|
30
|
-
},
|
|
31
|
-
notes: {
|
|
32
|
-
type: 'string',
|
|
33
|
-
description: 'Short change note (e.g. "Initial draft from browser capture").',
|
|
34
|
-
},
|
|
35
|
-
version: {
|
|
36
|
-
type: 'object',
|
|
37
|
-
description: 'Semver to publish as. Omit to auto-pick the next ' +
|
|
38
|
-
'version above the highest existing one.',
|
|
39
|
-
properties: {
|
|
40
|
-
major: { type: 'number', minimum: 0 },
|
|
41
|
-
minor: { type: 'number', minimum: 0 },
|
|
42
|
-
patch: { type: 'number', minimum: 0 },
|
|
43
|
-
},
|
|
44
|
-
required: ['major', 'minor', 'patch'],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
required: ['providerId', 'provider', 'initialUrl'],
|
|
48
|
-
},
|
|
49
|
-
}, async (args) => {
|
|
50
|
-
// Auto-pick the next version if not explicit
|
|
51
|
-
const ver = args.version ?? (await nextVersion(client, args.providerId));
|
|
52
|
-
const body = providerToCreateVersionRequest(args.provider, args.initialUrl, args.notes, ver);
|
|
53
|
-
const result = (await client.call('CreateProviderVersion', {
|
|
54
|
-
params: { providerId: args.providerId },
|
|
55
|
-
body,
|
|
56
|
-
}));
|
|
57
|
-
return result.data;
|
|
58
|
-
});
|
|
59
|
-
}
|
package/lib/mcp/tools/replay.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { replayProvider } from "../../proof/replay.js";
|
|
2
|
-
import { defineTool } from "../server.js";
|
|
3
|
-
export function replayTool(secrets) {
|
|
4
|
-
return defineTool({
|
|
5
|
-
name: 'replay_request',
|
|
6
|
-
description: 'Replay a drafted provider against the live endpoint ' +
|
|
7
|
-
'using Node fetch (no attestor). ' +
|
|
8
|
-
'Pre-flight gate before run_proof — ' +
|
|
9
|
-
'diagnoses CSRF / token-rotation / matcher-too-tight ' +
|
|
10
|
-
'issues with richer hints than the attestor would produce.',
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
// `type: 'object'` is required so MCP clients (the LLM)
|
|
15
|
-
// serialize the value as an object, not a JSON-stringified
|
|
16
|
-
// string. `properties: {}` is required so zod-from-json-schema
|
|
17
|
-
// compiles to a passthrough instead of strict-strip — leaving
|
|
18
|
-
// it off makes the server receive `{}`.
|
|
19
|
-
provider: { type: 'object', properties: {} },
|
|
20
|
-
secretParamsRef: { type: 'string' },
|
|
21
|
-
},
|
|
22
|
-
required: ['provider'],
|
|
23
|
-
},
|
|
24
|
-
}, async ({ provider, secretParamsRef }) => {
|
|
25
|
-
let resolved = {};
|
|
26
|
-
if (secretParamsRef !== undefined) {
|
|
27
|
-
const r = secrets.resolve(secretParamsRef);
|
|
28
|
-
if (!r) {
|
|
29
|
-
throw new Error(`unknown secretParamsRef "${secretParamsRef}" — ` +
|
|
30
|
-
'the MCP server has restarted or reset_session was called. ' +
|
|
31
|
-
'Re-run propose_provider to mint a fresh ref.');
|
|
32
|
-
}
|
|
33
|
-
resolved = r;
|
|
34
|
-
}
|
|
35
|
-
const result = await replayProvider(provider, resolved);
|
|
36
|
-
const out = {
|
|
37
|
-
status: result.status,
|
|
38
|
-
matchesOriginal: result.matchesOriginal,
|
|
39
|
-
bodySnippet: result.body.slice(0, 256),
|
|
40
|
-
};
|
|
41
|
-
if (result.hints !== undefined) {
|
|
42
|
-
out.hints = result.hints;
|
|
43
|
-
}
|
|
44
|
-
return out;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ConfigStore } from '../../config/store.ts';
|
|
2
|
-
import { type RegisteredTool } from '../server.ts';
|
|
3
|
-
import type { AttachState } from './attach.ts';
|
|
4
|
-
import type { CaptureStore } from './capture.ts';
|
|
5
|
-
export declare function sessionTools(attachRef: {
|
|
6
|
-
current?: AttachState;
|
|
7
|
-
config: ConfigStore;
|
|
8
|
-
}, captures: CaptureStore, secrets: {
|
|
9
|
-
clear: () => void;
|
|
10
|
-
}): RegisteredTool[];
|
package/lib/mcp/tools/session.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { defineTool } from "../server.js";
|
|
2
|
-
export function sessionTools(attachRef, captures, secrets) {
|
|
3
|
-
return [
|
|
4
|
-
defineTool({
|
|
5
|
-
name: 'get_session',
|
|
6
|
-
description: 'Return current attach state, active captures, and persisted config.',
|
|
7
|
-
inputSchema: { type: 'object', properties: {} },
|
|
8
|
-
}, async () => ({
|
|
9
|
-
config: attachRef.config.read(),
|
|
10
|
-
attached: Boolean(attachRef.current),
|
|
11
|
-
port: attachRef.current?.port,
|
|
12
|
-
captures: [...captures.sessions.keys()],
|
|
13
|
-
activeTab: captures.activeTab,
|
|
14
|
-
})),
|
|
15
|
-
defineTool({
|
|
16
|
-
name: 'reset_session',
|
|
17
|
-
description: 'Stop all captures, drop in-memory secrets, and clear capture state.',
|
|
18
|
-
inputSchema: { type: 'object', properties: {} },
|
|
19
|
-
}, async () => {
|
|
20
|
-
for (const s of captures.sessions.values()) {
|
|
21
|
-
await s.stop().catch(() => { });
|
|
22
|
-
}
|
|
23
|
-
captures.sessions.clear();
|
|
24
|
-
delete captures.activeTab;
|
|
25
|
-
secrets.clear();
|
|
26
|
-
return { reset: true };
|
|
27
|
-
}),
|
|
28
|
-
];
|
|
29
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type ReclaimClient } from '@reclaimprotocol/client';
|
|
2
|
-
import { type RegisteredTool } from '../../server.ts';
|
|
3
|
-
/**
|
|
4
|
-
* `diagnose_verification_session` — one call that answers "what's wrong
|
|
5
|
-
* with this session?". Pulls the session, its full event log, and its
|
|
6
|
-
* callback-delivery diagnostics, then derives findings (where the flow
|
|
7
|
-
* stalled or failed) and concrete suggestions (what to check or do next).
|
|
8
|
-
* Read-only; authenticates with the active eth credential like
|
|
9
|
-
* `get_verification_result`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function verificationDiagnoseTool(client: ReclaimClient): RegisteredTool;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { buildAuthHeaders } from '@reclaimprotocol/client';
|
|
2
|
-
import { defineTool } from "../../server.js";
|
|
3
|
-
import { resolveActivePrivateKey } from "./result.js";
|
|
4
|
-
const TERMINAL = new Set(['success', 'rejected', 'error']);
|
|
5
|
-
/**
|
|
6
|
-
* `diagnose_verification_session` — one call that answers "what's wrong
|
|
7
|
-
* with this session?". Pulls the session, its full event log, and its
|
|
8
|
-
* callback-delivery diagnostics, then derives findings (where the flow
|
|
9
|
-
* stalled or failed) and concrete suggestions (what to check or do next).
|
|
10
|
-
* Read-only; authenticates with the active eth credential like
|
|
11
|
-
* `get_verification_result`.
|
|
12
|
-
*/
|
|
13
|
-
export function verificationDiagnoseTool(client) {
|
|
14
|
-
return defineTool({
|
|
15
|
-
name: 'diagnose_verification_session',
|
|
16
|
-
description: 'Diagnose a verification session: fetches its status, event ' +
|
|
17
|
-
'timeline, and callback-delivery state, then reports findings ' +
|
|
18
|
-
'(where the flow stalled or failed — link never opened, proof ' +
|
|
19
|
-
'failed, callback endpoint erroring, dead-lettered delivery, ' +
|
|
20
|
-
'expiry) and suggested next steps. Read-only. Use ' +
|
|
21
|
-
'get_verification_result to fetch and decrypt the actual result.',
|
|
22
|
-
inputSchema: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
required: ['sessionId'],
|
|
25
|
-
properties: {
|
|
26
|
-
sessionId: {
|
|
27
|
-
type: 'string',
|
|
28
|
-
description: 'The verification session id to diagnose.',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
}, async (args) => {
|
|
33
|
-
const privateKey = resolveActivePrivateKey();
|
|
34
|
-
const auth = () => buildAuthHeaders(privateKey, 'VerificationAuth');
|
|
35
|
-
const params = { sessionId: args.sessionId };
|
|
36
|
-
const [session, events, deliveries] = await Promise.all([
|
|
37
|
-
client.call('GetVerificationSession', { params, headers: auth() })
|
|
38
|
-
.then((r) => r.data),
|
|
39
|
-
client.call('ListVerificationEvents', { params, headers: auth() })
|
|
40
|
-
.then((r) => r.data.items),
|
|
41
|
-
client.call('ListVerificationDeliveries', { params, headers: auth() })
|
|
42
|
-
.then((r) => r.data.items),
|
|
43
|
-
]);
|
|
44
|
-
const seen = new Set(events.map((e) => e.event));
|
|
45
|
-
const last = events[events.length - 1];
|
|
46
|
-
const findings = [];
|
|
47
|
-
const suggestions = [];
|
|
48
|
-
// Where did the flow get to?
|
|
49
|
-
if (session.status === 'pending') {
|
|
50
|
-
if (new Date(session.expiresAt).getTime() < Date.now()) {
|
|
51
|
-
findings.push('Session is past expiresAt — it will flip to expired on the ' +
|
|
52
|
-
'next sweep; the end-user can no longer complete it.');
|
|
53
|
-
suggestions.push('Create a new session and share a fresh link.');
|
|
54
|
-
}
|
|
55
|
-
else if (!seen.has('verification_client_opened')) {
|
|
56
|
-
findings.push('The end-user has not opened the verification link yet.');
|
|
57
|
-
suggestions.push(`Re-share the link (${session.verificationUrl}) before ` +
|
|
58
|
-
`it expires at ${session.expiresAt}.`);
|
|
59
|
-
}
|
|
60
|
-
else if (!seen.has('request_matched')) {
|
|
61
|
-
findings.push('The page was opened but the target request was never ' +
|
|
62
|
-
'captured — the end-user likely has not completed the ' +
|
|
63
|
-
'login/journey on the provider site.');
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
findings.push('Proof flow is in progress — the target request was ' +
|
|
67
|
-
'captured and the run has not reached a terminal event.');
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (session.status === 'expired') {
|
|
71
|
-
findings.push(seen.has('verification_client_opened')
|
|
72
|
-
? 'Session expired mid-flow — the end-user started but did ' +
|
|
73
|
-
'not finish before expiresAt.'
|
|
74
|
-
: 'Session expired without the link ever being opened.');
|
|
75
|
-
suggestions.push('Create a new session and share a fresh link.');
|
|
76
|
-
}
|
|
77
|
-
// Surface failure detail from the event log.
|
|
78
|
-
for (const e of events) {
|
|
79
|
-
if (e.event === 'request_claim_failed' ||
|
|
80
|
-
e.event === 'request_claim_rejected' ||
|
|
81
|
-
e.event === 'verification_error' ||
|
|
82
|
-
e.event === 'verification_rejected') {
|
|
83
|
-
findings.push(`${e.event} at ${e.createdAt}` +
|
|
84
|
-
(e.eventData ? `: ${JSON.stringify(e.eventData)}` : ''));
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
// Callback delivery health (only meaningful after a terminal event).
|
|
88
|
-
for (const d of deliveries) {
|
|
89
|
-
if (d.deliveryStatus === 'delivered') {
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
findings.push(`Callback to ${d.callbackUrl} is ${d.deliveryStatus} after ` +
|
|
93
|
-
`${d.attempts} attempt(s)` +
|
|
94
|
-
(d.lastError ? ` — last error: ${d.lastError}` : '') +
|
|
95
|
-
(d.deadLettered ? ' (dead-lettered; retries exhausted)' : ''));
|
|
96
|
-
suggestions.push(`Check that ${d.callbackUrl} is reachable and answers 2xx.`);
|
|
97
|
-
if (d.deadLettered) {
|
|
98
|
-
suggestions.push('Once the endpoint is fixed, re-deliver via ' +
|
|
99
|
-
'POST /verifications/sessions/{sessionId}/retry-callback ' +
|
|
100
|
-
'(or ask an admin to retry it from the Callback DLQ).');
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (TERMINAL.has(session.status) &&
|
|
104
|
-
deliveries.every((d) => d.deliveryStatus === 'delivered')) {
|
|
105
|
-
suggestions.push('Result delivered. Use get_verification_result to fetch and ' +
|
|
106
|
-
'decrypt it locally.');
|
|
107
|
-
}
|
|
108
|
-
if (!findings.length) {
|
|
109
|
-
findings.push('No problems detected.');
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
sessionId: session.id,
|
|
113
|
-
status: session.status,
|
|
114
|
-
callbackDeliveryStatus: session.callbackDeliveryStatus,
|
|
115
|
-
mode: session.mode,
|
|
116
|
-
createdAt: session.createdAt,
|
|
117
|
-
expiresAt: session.expiresAt,
|
|
118
|
-
completedAt: session.completedAt,
|
|
119
|
-
lastEvent: last
|
|
120
|
-
? { event: last.event, at: last.createdAt }
|
|
121
|
-
: undefined,
|
|
122
|
-
events: events.map((e) => ({
|
|
123
|
-
event: e.event,
|
|
124
|
-
at: e.createdAt,
|
|
125
|
-
...(e.eventData ? { data: e.eventData } : {}),
|
|
126
|
-
})),
|
|
127
|
-
deliveries,
|
|
128
|
-
findings,
|
|
129
|
-
suggestions,
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ReclaimClient } from '@reclaimprotocol/client';
|
|
2
|
-
import type { RegisteredTool } from '../server.ts';
|
|
3
|
-
/** Verification CRUD tools — build the flat list of RegisteredTool
|
|
4
|
-
* entries. Mirrors buildAgentTools() in mcp/register.ts. */
|
|
5
|
-
export declare function buildVerificationTools(client: ReclaimClient): RegisteredTool[];
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createTool } from "./create.js";
|
|
2
|
-
import { findTool } from "./find.js";
|
|
3
|
-
import { getTool } from "./get.js";
|
|
4
|
-
import { updateTool } from "./update.js";
|
|
5
|
-
/** Verification CRUD tools — build the flat list of RegisteredTool
|
|
6
|
-
* entries. Mirrors buildAgentTools() in mcp/register.ts. */
|
|
7
|
-
export function buildVerificationTools(client) {
|
|
8
|
-
return [
|
|
9
|
-
findTool(client),
|
|
10
|
-
getTool(client),
|
|
11
|
-
createTool(client),
|
|
12
|
-
updateTool(client),
|
|
13
|
-
];
|
|
14
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { defineTool } from "../server.js";
|
|
2
|
-
export function createTool(client) {
|
|
3
|
-
return defineTool({
|
|
4
|
-
name: 'create_verification',
|
|
5
|
-
description: 'Create a new Reclaim verification. Use this only ' +
|
|
6
|
-
'after `find_verification` returned nothing useful ' +
|
|
7
|
-
'for the domain. The caller must be an active ' +
|
|
8
|
-
'member of the target organization.',
|
|
9
|
-
inputSchema: {
|
|
10
|
-
type: 'object',
|
|
11
|
-
properties: {
|
|
12
|
-
orgId: {
|
|
13
|
-
type: 'string',
|
|
14
|
-
description: 'uuid identifier of the organization ' +
|
|
15
|
-
'that will own the verification.'
|
|
16
|
-
},
|
|
17
|
-
domain: {
|
|
18
|
-
type: 'string',
|
|
19
|
-
minLength: 1,
|
|
20
|
-
maxLength: 200,
|
|
21
|
-
description: 'Canonical root domain (e.g. `github.com`). ' +
|
|
22
|
-
'No scheme, no port, no path.',
|
|
23
|
-
},
|
|
24
|
-
slug: {
|
|
25
|
-
type: 'string',
|
|
26
|
-
pattern: '^[a-z0-9]+(?:-[a-z0-9]+)*$',
|
|
27
|
-
minLength: 1,
|
|
28
|
-
maxLength: 100,
|
|
29
|
-
description: 'URL-safe identifier. Globally unique — pick ' +
|
|
30
|
-
'something domain-specific like `github-followers`.',
|
|
31
|
-
},
|
|
32
|
-
title: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
minLength: 1,
|
|
35
|
-
maxLength: 100,
|
|
36
|
-
description: 'Short headline shown to end-users. Defaults ' +
|
|
37
|
-
'to a domain-derived brand name.',
|
|
38
|
-
},
|
|
39
|
-
description: { type: 'string', minLength: 1, maxLength: 2000 },
|
|
40
|
-
iconUrl: { type: 'string', description: 'uri of the icon' },
|
|
41
|
-
tags: { type: 'array', items: { type: 'string' }, maxItems: 50 },
|
|
42
|
-
},
|
|
43
|
-
required: ['orgId', 'domain', 'slug'],
|
|
44
|
-
},
|
|
45
|
-
}, async (args) => client.call('CreateProvider', {
|
|
46
|
-
body: {
|
|
47
|
-
orgId: args.orgId,
|
|
48
|
-
domain: args.domain,
|
|
49
|
-
slug: args.slug,
|
|
50
|
-
title: args.title,
|
|
51
|
-
description: args.description,
|
|
52
|
-
iconUrl: args.iconUrl,
|
|
53
|
-
tags: args.tags ?? [],
|
|
54
|
-
visibility: 'PRIVATE'
|
|
55
|
-
},
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { defineTool } from "../server.js";
|
|
2
|
-
export function findTool(client) {
|
|
3
|
-
return defineTool({
|
|
4
|
-
name: 'find_verification',
|
|
5
|
-
description: 'Search published Reclaim verifications by domain or ' +
|
|
6
|
-
'data point. A verification is the recipe an end-user ' +
|
|
7
|
-
'follows to prove something about themselves (e.g. ' +
|
|
8
|
-
'"I have N followers on Twitter"). Returns a list of ' +
|
|
9
|
-
'matches. Call this BEFORE `create_verification` — ' +
|
|
10
|
-
'most popular domains already have a public ' +
|
|
11
|
-
'verification you can reuse.',
|
|
12
|
-
inputSchema: {
|
|
13
|
-
type: 'object',
|
|
14
|
-
properties: {
|
|
15
|
-
query: {
|
|
16
|
-
type: 'string',
|
|
17
|
-
minLength: 1,
|
|
18
|
-
maxLength: 200,
|
|
19
|
-
description: 'Free-text query. Matches domain (e.g. ' +
|
|
20
|
-
'"github.com"), title, description, and the ' +
|
|
21
|
-
'data points a verification can prove.',
|
|
22
|
-
},
|
|
23
|
-
tags: {
|
|
24
|
-
type: 'array',
|
|
25
|
-
items: { type: 'string' },
|
|
26
|
-
description: 'Restrict to verifications carrying every tag.',
|
|
27
|
-
},
|
|
28
|
-
limit: { type: 'number', minimum: 1, maximum: 100 },
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
}, async (args) => client.call('Providers', {
|
|
32
|
-
query: {
|
|
33
|
-
q: args.query,
|
|
34
|
-
tag: args.tags ?? [],
|
|
35
|
-
},
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { defineTool } from "../server.js";
|
|
2
|
-
export function getTool(client) {
|
|
3
|
-
return defineTool({
|
|
4
|
-
name: 'get_verification',
|
|
5
|
-
description: 'Fetch a single Reclaim verification by id. Returns ' +
|
|
6
|
-
'every field needed to integrate it into a flow: ' +
|
|
7
|
-
'domain, the live version (initialUrl + requests), ' +
|
|
8
|
-
'and the data points it can prove. Use ' +
|
|
9
|
-
'`find_verification` first if you only have a query ' +
|
|
10
|
-
'string.',
|
|
11
|
-
inputSchema: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {
|
|
14
|
-
providerId: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
description: 'UUID of the verification. (Internally stored ' +
|
|
17
|
-
'as `providerId` — the field name reflects ' +
|
|
18
|
-
'the openapi schema.)',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
required: ['providerId'],
|
|
22
|
-
},
|
|
23
|
-
}, async (args) => client.call('GetProvider', {
|
|
24
|
-
params: { providerId: args.providerId },
|
|
25
|
-
}));
|
|
26
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { defineTool } from "../server.js";
|
|
2
|
-
export function updateTool(client) {
|
|
3
|
-
return defineTool({
|
|
4
|
-
name: 'update_verification',
|
|
5
|
-
description: "Update a Reclaim verification's metadata. Partial " +
|
|
6
|
-
'PATCH — pass only fields you want to change. The ' +
|
|
7
|
-
'caller must be an active member of the owning ' +
|
|
8
|
-
"organization. To change the verification's " +
|
|
9
|
-
'recipe (initialUrl, requests, …) cut a new ' +
|
|
10
|
-
'version via the dashboard. Use `seo` to control how ' +
|
|
11
|
-
'the verification appears in search results and social ' +
|
|
12
|
-
'shares; omit a subfield to keep the server default.',
|
|
13
|
-
inputSchema: {
|
|
14
|
-
type: 'object',
|
|
15
|
-
properties: {
|
|
16
|
-
providerId: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
description: 'UUID of the verification. (Internally stored ' +
|
|
19
|
-
'as `providerId` — the field name reflects ' +
|
|
20
|
-
'the openapi schema.)',
|
|
21
|
-
},
|
|
22
|
-
title: { type: 'string', minLength: 1, maxLength: 100 },
|
|
23
|
-
description: { type: 'string', minLength: 1, maxLength: 2000 },
|
|
24
|
-
iconUrl: { type: 'string', description: 'uri of icon' },
|
|
25
|
-
clearIcon: {
|
|
26
|
-
type: 'boolean',
|
|
27
|
-
description: 'Set true to wipe the icon explicitly.',
|
|
28
|
-
},
|
|
29
|
-
visibility: { type: 'string', enum: ['PRIVATE', 'PUBLIC'] },
|
|
30
|
-
status: { type: 'string', enum: ['ACTIVE', 'ARCHIVED'] },
|
|
31
|
-
tags: { type: 'array', items: { type: 'string' }, maxItems: 50 },
|
|
32
|
-
seo: {
|
|
33
|
-
type: 'object',
|
|
34
|
-
additionalProperties: false,
|
|
35
|
-
description: 'Author SEO overrides. Each field falls back to a ' +
|
|
36
|
-
'server-derived suggestion when unset.',
|
|
37
|
-
properties: {
|
|
38
|
-
brandUrl: {
|
|
39
|
-
type: 'string',
|
|
40
|
-
maxLength: 2000,
|
|
41
|
-
description: 'Canonical homepage url of the brand.',
|
|
42
|
-
},
|
|
43
|
-
primaryDataPoint: {
|
|
44
|
-
type: 'string',
|
|
45
|
-
maxLength: 200,
|
|
46
|
-
description: 'Headline data point (e.g. "subscriber ' +
|
|
47
|
-
'count"); used in the SEO title.',
|
|
48
|
-
},
|
|
49
|
-
dataPoints: {
|
|
50
|
-
type: 'array',
|
|
51
|
-
items: { type: 'string', maxLength: 200 },
|
|
52
|
-
maxItems: 50,
|
|
53
|
-
description: 'Full list of verifiable data points.',
|
|
54
|
-
},
|
|
55
|
-
titleOverride: {
|
|
56
|
-
type: 'string',
|
|
57
|
-
maxLength: 200,
|
|
58
|
-
description: 'Replaces the composed page title.',
|
|
59
|
-
},
|
|
60
|
-
descriptionOverride: {
|
|
61
|
-
type: 'string',
|
|
62
|
-
maxLength: 320,
|
|
63
|
-
description: 'Replaces the composed meta description.',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
required: ['providerId'],
|
|
69
|
-
},
|
|
70
|
-
}, async (args) => {
|
|
71
|
-
const { providerId, ...rest } = args;
|
|
72
|
-
return client.call('UpdateProvider', {
|
|
73
|
-
params: { providerId },
|
|
74
|
-
headers: {},
|
|
75
|
-
body: rest,
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type RegisteredTool } from '../../mcp/server.ts';
|
|
2
|
-
import type { ReclaimOldClient } from '../client.ts';
|
|
3
|
-
/**
|
|
4
|
-
* Read the full `providerConfig` (loginUrl, customInjection, requestData,
|
|
5
|
-
* geoLocation, ...) of one provider version on the old devtools backend —
|
|
6
|
-
* the latest version when `version` is omitted.
|
|
7
|
-
*
|
|
8
|
-
* Exists so a dev/agent can see what's CURRENTLY published before adding a
|
|
9
|
-
* new version with `create_provider_version_from_capture`. That tool always
|
|
10
|
-
* takes a FULL replacement `providerConfig` (no partial-patch endpoint on
|
|
11
|
-
* this backend), so a version added without knowing the current
|
|
12
|
-
* `customInjection` would silently publish it blank — wiping a working
|
|
13
|
-
* login script instead of preserving it. Read it here first, then pass it
|
|
14
|
-
* straight through (or omit `customInjection` on publish to have it carried
|
|
15
|
-
* forward automatically).
|
|
16
|
-
*/
|
|
17
|
-
export declare function getProviderVersionConfigTool(client: ReclaimOldClient): RegisteredTool;
|