@reclaimprotocol/agent 0.1.17 → 0.1.18
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/consts.d.ts +7 -0
- package/lib/consts.js +15 -0
- package/lib/mcp/tools/agent/publish.js +33 -0
- package/lib/mcp/tools/mode/mode.d.ts +3 -2
- package/lib/mcp/tools/mode/mode.js +24 -4
- package/lib/old/to-register.d.ts +16 -8
- package/lib/old/to-register.js +29 -21
- package/lib/old/tools/publish.js +86 -8
- package/lib/provider/injection-doc.js +4 -3
- package/lib/provider/schema.d.ts +26 -1
- package/lib/provider/to-version.d.ts +19 -2
- package/lib/provider/to-version.js +18 -4
- package/package.json +2 -2
- package/skill/builder-mode.md +2 -0
- package/skill/old-mode.md +3 -1
- package/src/consts.ts +20 -0
- package/src/mcp/tools/agent/publish.ts +42 -0
- package/src/mcp/tools/mode/mode.ts +28 -4
- package/src/old/to-register.ts +50 -27
- package/src/old/tools/publish.ts +108 -8
- package/src/provider/injection-doc.ts +4 -3
- package/src/provider/schema.ts +27 -1
- package/src/provider/to-version.ts +41 -6
package/src/provider/schema.ts
CHANGED
|
@@ -15,6 +15,25 @@ export type HttpMethod = HttpParams['method']
|
|
|
15
15
|
*/
|
|
16
16
|
export type ResponseMatch = HttpParams['responseMatches'][number]
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* A response match as drafted for PUBLISH: the attestor's match plus
|
|
20
|
+
* `isOptional` — a backend-side matcher flag (both the old devtools backend
|
|
21
|
+
* and the builder store it; the attestor's own params have no such field, so
|
|
22
|
+
* `propose_provider` drafts never set it — only an explicit publish input
|
|
23
|
+
* does). Default false on both backends.
|
|
24
|
+
*/
|
|
25
|
+
export type DraftResponseMatch = ResponseMatch & { isOptional?: boolean }
|
|
26
|
+
|
|
27
|
+
/** How the verification client supplies cookies/auth when replaying a
|
|
28
|
+
* request. Both backends accept the same enum (old devtools on
|
|
29
|
+
* `requestData`, builder on `RequestSelection`); default `include`. */
|
|
30
|
+
export type WebCredentials = 'omit' | 'same-origin' | 'include'
|
|
31
|
+
|
|
32
|
+
/** Old-devtools `urlType` for a requestData entry. The builder backend has
|
|
33
|
+
* no such field (templating is implicit in the URL's `{{param}}`
|
|
34
|
+
* placeholders), so the builder translator ignores it. */
|
|
35
|
+
export type OldUrlType = 'REGEX' | 'CONSTANT' | 'TEMPLATE'
|
|
36
|
+
|
|
18
37
|
/**
|
|
19
38
|
* Selector telling the prover which portion of the response to reveal:
|
|
20
39
|
* `xPath`/`jsonPath` narrows the slice, `regex` (with named groups) matches
|
|
@@ -67,8 +86,15 @@ export interface ReclaimProvider {
|
|
|
67
86
|
method: HttpMethod
|
|
68
87
|
headers?: Record<string, string>
|
|
69
88
|
body?: string
|
|
70
|
-
responseMatches:
|
|
89
|
+
responseMatches: DraftResponseMatch[]
|
|
71
90
|
responseRedactions?: ResponseRedaction[]
|
|
91
|
+
/** How the verification client supplies cookies/auth on replay. Both
|
|
92
|
+
* backends default to `include` when unset. */
|
|
93
|
+
credentials?: WebCredentials
|
|
94
|
+
/** Old-devtools-only url type override (`REGEX`/`CONSTANT`/`TEMPLATE`).
|
|
95
|
+
* Auto-derived from `{{param}}` placeholders when unset; ignored by the
|
|
96
|
+
* builder backend. */
|
|
97
|
+
urlType?: OldUrlType
|
|
72
98
|
/** Public param refs (templated into URL/body), populated by draft layer. */
|
|
73
99
|
paramValues?: Record<string, string>
|
|
74
100
|
/** Redaction mode for the transcript (attestor default: 'key-update'). */
|
|
@@ -4,10 +4,12 @@ import type {
|
|
|
4
4
|
ProviderVersionRef,
|
|
5
5
|
} from '@reclaimprotocol/client/openapi'
|
|
6
6
|
import type {
|
|
7
|
+
DraftResponseMatch,
|
|
7
8
|
HttpMethod,
|
|
9
|
+
OldUrlType,
|
|
8
10
|
ReclaimProvider,
|
|
9
|
-
ResponseMatch,
|
|
10
11
|
ResponseRedaction,
|
|
12
|
+
WebCredentials,
|
|
11
13
|
} from './schema.ts'
|
|
12
14
|
import { DYNAMIC_GEO, normalizeGeoLocation } from './schema.ts'
|
|
13
15
|
|
|
@@ -24,8 +26,15 @@ export interface DraftRequest {
|
|
|
24
26
|
body?: string
|
|
25
27
|
writeRedactionMode?: ReclaimProvider['writeRedactionMode']
|
|
26
28
|
additionalClientOptions?: ReclaimProvider['additionalClientOptions']
|
|
27
|
-
responseMatches?:
|
|
29
|
+
responseMatches?: DraftResponseMatch[]
|
|
28
30
|
responseRedactions?: ResponseRedaction[]
|
|
31
|
+
/** How the verification client supplies cookies/auth on replay. Default
|
|
32
|
+
* `include` (both backends). */
|
|
33
|
+
credentials?: WebCredentials
|
|
34
|
+
/** Old-devtools `urlType` override. Ignored by THIS translator (the
|
|
35
|
+
* builder backend has no urlType) — read only by the old-devtools
|
|
36
|
+
* translator (`old/to-register.ts`). */
|
|
37
|
+
urlType?: OldUrlType
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
/** A request the page's injection script is allowed to fire, plus the
|
|
@@ -60,6 +69,16 @@ export interface CreateVersionOptions {
|
|
|
60
69
|
jsUserScripts?: string
|
|
61
70
|
/** Requests the injection script may fire, as `RequestSelectionTemplate`s. */
|
|
62
71
|
allowedJsRequests?: AllowedJsRequest[]
|
|
72
|
+
/** In-app interception options, mapped verbatim to
|
|
73
|
+
* `webSettings.clientOptions.inapp.interceptorOptions`. `interceptorType`
|
|
74
|
+
* is required by the backend whenever the object is present.
|
|
75
|
+
* `isDocumentRequestReplayEnabled` is the INVERSE of old-devtools'
|
|
76
|
+
* `disableRequestReplay` (default false). */
|
|
77
|
+
interceptorOptions?: {
|
|
78
|
+
interceptorType: 'HAWKEYE' | 'MSWJS' | 'CDP'
|
|
79
|
+
isDocumentRequestReplayEnabled?: boolean
|
|
80
|
+
interceptorSettings?: string
|
|
81
|
+
}
|
|
63
82
|
}
|
|
64
83
|
|
|
65
84
|
/**
|
|
@@ -139,14 +158,14 @@ export function providerToRequestSelection(
|
|
|
139
158
|
const responseMatches = (provider.responseMatches ?? []).map((match) => ({
|
|
140
159
|
type: match.type,
|
|
141
160
|
value: match.value,
|
|
142
|
-
isOptional: false,
|
|
161
|
+
isOptional: match.isOptional ?? false,
|
|
143
162
|
}))
|
|
144
163
|
const responseRedactions = provider.responseRedactions ?? []
|
|
145
164
|
|
|
146
165
|
return {
|
|
147
166
|
url: provider.url,
|
|
148
167
|
method: provider.method,
|
|
149
|
-
credentials: 'include',
|
|
168
|
+
credentials: provider.credentials ?? 'include',
|
|
150
169
|
...(provider.body ? { requestBodyTemplate: provider.body } : {}),
|
|
151
170
|
...(provider.writeRedactionMode
|
|
152
171
|
? { writeRedactionMode: provider.writeRedactionMode }
|
|
@@ -177,7 +196,9 @@ export function providerToCreateVersionRequest(
|
|
|
177
196
|
initialUrl: string,
|
|
178
197
|
opts: CreateVersionOptions = {},
|
|
179
198
|
): CreateProviderVersionRequest {
|
|
180
|
-
const {
|
|
199
|
+
const {
|
|
200
|
+
notes, version, jsUserScripts, allowedJsRequests, interceptorOptions,
|
|
201
|
+
} = opts
|
|
181
202
|
const requiredContext = deriveRequiredContext(providers, {
|
|
182
203
|
allowedJsRequests,
|
|
183
204
|
jsUserScripts,
|
|
@@ -206,7 +227,21 @@ export function providerToCreateVersionRequest(
|
|
|
206
227
|
// apply schema defaults to request bodies.
|
|
207
228
|
webSettings: {
|
|
208
229
|
geoLocation: pickGeoLocation(providers),
|
|
209
|
-
clientOptions: {
|
|
230
|
+
clientOptions: {
|
|
231
|
+
portal: { useProxy: true },
|
|
232
|
+
...(interceptorOptions
|
|
233
|
+
? {
|
|
234
|
+
inapp: {
|
|
235
|
+
interceptorOptions: {
|
|
236
|
+
// openapi `default: false` — the generated type
|
|
237
|
+
// requires the key even when the author omits it.
|
|
238
|
+
isDocumentRequestReplayEnabled: false,
|
|
239
|
+
...interceptorOptions,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
}
|
|
243
|
+
: {}),
|
|
244
|
+
},
|
|
210
245
|
// Only set when non-empty; an empty string would store a no-op script.
|
|
211
246
|
...(script ? { jsUserScripts: script } : {}),
|
|
212
247
|
},
|