@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
package/src/provider/matcher.ts
CHANGED
|
@@ -54,7 +54,7 @@ export function synthesizeMatcher(
|
|
|
54
54
|
'OPRF hashing requires a target with a known-safe character class '
|
|
55
55
|
+ '(digits, slug, or email). '
|
|
56
56
|
+ `Got "${target}" which is free-form. Use a tighter target `
|
|
57
|
-
+ '(
|
|
57
|
+
+ '(for example, just the alphanumeric portion of the value) '
|
|
58
58
|
+ 'or call propose_provider without `hash`.',
|
|
59
59
|
)
|
|
60
60
|
}
|
|
@@ -171,7 +171,7 @@ function jsonMatcher(
|
|
|
171
171
|
return undefined
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
const anchor = jsonKeyPrefix(body, target)
|
|
174
|
+
const anchor = jsonKeyPrefix(body, target, lastPathKey(jsonPath))
|
|
175
175
|
if(!anchor) {
|
|
176
176
|
return undefined
|
|
177
177
|
}
|
|
@@ -182,15 +182,34 @@ function jsonMatcher(
|
|
|
182
182
|
)
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
/** The trailing object-property name of a jsonPath (`$.total_records` →
|
|
186
|
+
* `"total_records"`), or undefined for an array-index/bracket leaf, which
|
|
187
|
+
* has no literal key to anchor a search on. */
|
|
188
|
+
function lastPathKey(jsonPath: string | undefined): string | undefined {
|
|
189
|
+
const m = jsonPath ? /\.([A-Za-z_][A-Za-z0-9_]*)$/.exec(jsonPath) : null
|
|
190
|
+
return m?.[1]
|
|
191
|
+
}
|
|
192
|
+
|
|
185
193
|
/**
|
|
186
194
|
* The literal `"key":"` (or `"key":` for a raw number/bool) immediately before
|
|
187
195
|
* `target` in `text`, plus the closing quote (`"` for a string value, `''`
|
|
188
196
|
* otherwise). Returns undefined when the value isn't preceded by a JSON key.
|
|
197
|
+
*
|
|
198
|
+
* When `key` is given, anchors the search on occurrences of the KEY (not the
|
|
199
|
+
* value) — so a short/common value elsewhere in the body (for example, the
|
|
200
|
+
* digit "5" inside `"investment_amount":354.85`) can't be mistaken for this
|
|
201
|
+
* field. Only falls back to a whole-body value search when there's no
|
|
202
|
+
* resolvable key (for example, `findJsonPath` returned an array-index leaf).
|
|
189
203
|
*/
|
|
190
204
|
function jsonKeyPrefix(
|
|
191
205
|
text: string,
|
|
192
206
|
target: string,
|
|
207
|
+
key?: string,
|
|
193
208
|
): { prefix: string, close: string } | undefined {
|
|
209
|
+
if(key !== undefined) {
|
|
210
|
+
return jsonKeyPrefixByKey(text, target, key)
|
|
211
|
+
}
|
|
212
|
+
|
|
194
213
|
const { idx } = firstIndex(text, target)
|
|
195
214
|
if(idx < 0) {
|
|
196
215
|
return undefined
|
|
@@ -227,6 +246,78 @@ function jsonKeyPrefix(
|
|
|
227
246
|
return { prefix: text.slice(keyStart, idx), close: quoted ? '"' : '' }
|
|
228
247
|
}
|
|
229
248
|
|
|
249
|
+
/** `jsonKeyPrefix`'s key-anchored path: scan occurrences of `"key"`, and for
|
|
250
|
+
* each, check whether the value that follows its `:` matches `target` (or a
|
|
251
|
+
* normalized candidate) before accepting it. */
|
|
252
|
+
function jsonKeyPrefixByKey(
|
|
253
|
+
text: string,
|
|
254
|
+
target: string,
|
|
255
|
+
key: string,
|
|
256
|
+
): { prefix: string, close: string } | undefined {
|
|
257
|
+
const keyToken = `"${key}"`
|
|
258
|
+
let from = 0
|
|
259
|
+
for(;;) {
|
|
260
|
+
const keyIdx = text.indexOf(keyToken, from)
|
|
261
|
+
if(keyIdx < 0) {
|
|
262
|
+
return undefined
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
from = keyIdx + keyToken.length
|
|
266
|
+
let i = from
|
|
267
|
+
while(i < text.length && /\s/.test(text[i] ?? '')) {
|
|
268
|
+
i++
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if(text[i] !== ':') {
|
|
272
|
+
continue
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
i++
|
|
276
|
+
while(i < text.length && /\s/.test(text[i] ?? '')) {
|
|
277
|
+
i++
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const matched = matchJsonValueAt(text, i, target)
|
|
281
|
+
if(matched) {
|
|
282
|
+
return {
|
|
283
|
+
prefix: text.slice(keyIdx, matched.valueStart),
|
|
284
|
+
close: matched.close,
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Whether the JSON value starting at `pos` in `text` — quoted string or a
|
|
291
|
+
* raw number/bool/null token — equals `target` (or a normalized candidate).
|
|
292
|
+
* Returns the position right after any opening quote (matching `firstIndex`'s
|
|
293
|
+
* convention) and the delimiter to close the match template with. */
|
|
294
|
+
function matchJsonValueAt(
|
|
295
|
+
text: string,
|
|
296
|
+
pos: number,
|
|
297
|
+
target: string,
|
|
298
|
+
): { valueStart: number, close: string } | undefined {
|
|
299
|
+
const candidates = [target, ...normalizeCandidates(target)]
|
|
300
|
+
if(text[pos] === '"') {
|
|
301
|
+
let j = pos + 1
|
|
302
|
+
while(j < text.length && text[j] !== '"') {
|
|
303
|
+
j += text[j] === '\\' ? 2 : 1
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const raw = text.slice(pos + 1, j)
|
|
307
|
+
return candidates.includes(raw)
|
|
308
|
+
? { valueStart: pos + 1, close: '"' }
|
|
309
|
+
: undefined
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
let j = pos
|
|
313
|
+
while(j < text.length && !/[,}\]\s]/.test(text[j] ?? '')) {
|
|
314
|
+
j++
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const raw = text.slice(pos, j)
|
|
318
|
+
return candidates.includes(raw) ? { valueStart: pos, close: '' } : undefined
|
|
319
|
+
}
|
|
320
|
+
|
|
230
321
|
function findJsonPath(body: string, target: string): string | undefined {
|
|
231
322
|
let parsed: unknown
|
|
232
323
|
try {
|
|
@@ -320,7 +411,9 @@ function htmlMatcher(
|
|
|
320
411
|
const scriptJson = scriptJsonContent(revealSlice)
|
|
321
412
|
if(scriptJson) {
|
|
322
413
|
const jsonPath = findJsonPath(scriptJson, target)
|
|
323
|
-
const kp = jsonPath
|
|
414
|
+
const kp = jsonPath
|
|
415
|
+
? jsonKeyPrefix(scriptJson, target, lastPathKey(jsonPath))
|
|
416
|
+
: undefined
|
|
324
417
|
if(jsonPath && kp) {
|
|
325
418
|
return keyValueResult(
|
|
326
419
|
kp.prefix, kp.close, target, paramName, valueClass,
|
|
@@ -404,9 +497,9 @@ function portableWindow(
|
|
|
404
497
|
/** Value is element text content. Left anchor: if only punctuation/whitespace
|
|
405
498
|
* sits between the opening tag and the value, fold the stable opening tag in;
|
|
406
499
|
* but if WORDS precede the value in the same text node they may be per-user
|
|
407
|
-
* (
|
|
408
|
-
* alphanumeric and keep only the trailing punctuation as the anchor.
|
|
409
|
-
* include a closing tag, but stop at a sibling. */
|
|
500
|
+
* (for example, `<li>Full Name ( {{id}} )` — the name), so drop through the
|
|
501
|
+
* last alphanumeric and keep only the trailing punctuation as the anchor.
|
|
502
|
+
* Right: include a closing tag, but stop at a sibling. */
|
|
410
503
|
function textWindow(
|
|
411
504
|
markup: string,
|
|
412
505
|
valueIdx: number,
|
|
@@ -550,7 +643,7 @@ function contentMatcher(
|
|
|
550
643
|
return {
|
|
551
644
|
match: {
|
|
552
645
|
type: 'contains',
|
|
553
|
-
value: buildContextualTemplate(body, target, paramName),
|
|
646
|
+
value: buildContextualTemplate(body, target, paramName, valueClass),
|
|
554
647
|
},
|
|
555
648
|
redaction,
|
|
556
649
|
paramValues: { [paramName]: target },
|
|
@@ -577,18 +670,63 @@ function contentMatcher(
|
|
|
577
670
|
* must CONTAIN the match template (buildContextualTemplate), so the trailing
|
|
578
671
|
* delimiter is kept unless it's whitespace (which the template also drops).
|
|
579
672
|
*/
|
|
673
|
+
/** Indices where `cand` occurs in `body` as a WHOLE match of `valueClass` —
|
|
674
|
+
* that is, not a substring inside a longer run of the same class (the digit "5"
|
|
675
|
+
* inside "354.85" is never a whole `\d+` match; "354" and "85" are). Only
|
|
676
|
+
* meaningful for a structural (non-free-form) class. */
|
|
677
|
+
function wholeTokenIndices(
|
|
678
|
+
body: string,
|
|
679
|
+
cand: string,
|
|
680
|
+
valueClass: string,
|
|
681
|
+
): number[] {
|
|
682
|
+
const indices: number[] = []
|
|
683
|
+
let re: RegExp
|
|
684
|
+
try {
|
|
685
|
+
re = new RegExp(valueClass, 'g')
|
|
686
|
+
} catch{
|
|
687
|
+
return indices
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
let m: RegExpExecArray | null
|
|
691
|
+
while((m = re.exec(body))) {
|
|
692
|
+
if(m[0] === cand) {
|
|
693
|
+
indices.push(m.index)
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
if(re.lastIndex === m.index) {
|
|
697
|
+
re.lastIndex++
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return indices
|
|
702
|
+
}
|
|
703
|
+
|
|
580
704
|
function buildContentRegex(
|
|
581
705
|
body: string,
|
|
582
706
|
target: string,
|
|
583
707
|
paramName: string,
|
|
584
708
|
valueClass: string,
|
|
585
709
|
): string | undefined {
|
|
710
|
+
const structural = inferValueClass(target) !== undefined
|
|
586
711
|
for(const cand of normalizeCandidates(target)) {
|
|
587
|
-
const
|
|
712
|
+
const occurrences = structural
|
|
713
|
+
? wholeTokenIndices(body, cand, valueClass)
|
|
714
|
+
: undefined
|
|
715
|
+
const idx = occurrences ? occurrences[0] ?? -1 : body.indexOf(cand)
|
|
588
716
|
if(idx < 0) {
|
|
589
717
|
continue
|
|
590
718
|
}
|
|
591
719
|
|
|
720
|
+
if(occurrences && occurrences.length > 1
|
|
721
|
+
&& cand.replace(/[^A-Za-z0-9]/g, '').length < 4) {
|
|
722
|
+
throw new Error(
|
|
723
|
+
`target value "${target}" occurs ${occurrences.length} times as a `
|
|
724
|
+
+ 'standalone token with no JSON key or HTML anchor to '
|
|
725
|
+
+ "disambiguate — capture a request where it's unique, or use a "
|
|
726
|
+
+ 'longer/more specific target.',
|
|
727
|
+
)
|
|
728
|
+
}
|
|
729
|
+
|
|
592
730
|
const endIdx = idx + cand.length
|
|
593
731
|
const rawRight = findRightContext(body, endIdx)
|
|
594
732
|
const right = /^\s/.test(rawRight) ? '' : escapeRegexFlexWs(rawRight)
|
|
@@ -624,8 +762,10 @@ function buildContextualTemplate(
|
|
|
624
762
|
body: string,
|
|
625
763
|
target: string,
|
|
626
764
|
paramName: string,
|
|
765
|
+
valueClass: string,
|
|
627
766
|
): string {
|
|
628
|
-
const idx = body
|
|
767
|
+
const idx = wholeTokenIndices(body, target, valueClass)[0]
|
|
768
|
+
?? body.indexOf(target)
|
|
629
769
|
if(idx < 0) {
|
|
630
770
|
return `{{${paramName}}}`
|
|
631
771
|
}
|
|
@@ -719,7 +859,8 @@ function inferValueClass(target: string): string | undefined {
|
|
|
719
859
|
return '\\d+'
|
|
720
860
|
}
|
|
721
861
|
|
|
722
|
-
// Numbers with thousands separators / decimals,
|
|
862
|
+
// Numbers with thousands separators / decimals, for example, "1,908" or
|
|
863
|
+
// "12,345.6".
|
|
723
864
|
if(/^[0-9][0-9,.]*[0-9]$/.test(target)) {
|
|
724
865
|
return '[0-9,.]+'
|
|
725
866
|
}
|
package/src/provider/secrets.ts
CHANGED
|
@@ -126,9 +126,9 @@ export function secretUrlCharBudget(
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/** A `paramValues`/context key is secret iff its name contains `SECRET`
|
|
129
|
-
* (case-insensitive) —
|
|
130
|
-
* naming-convention classifier reclaim-inapp-sdk and reclaim-portal use
|
|
131
|
-
* their `witnessParams`/`paramValues` maps (no separate boolean flag). */
|
|
129
|
+
* (case-insensitive) — for example, `SECRET_apiKey`, `context.SECRET_apiKey`.
|
|
130
|
+
* Same naming-convention classifier reclaim-inapp-sdk and reclaim-portal use
|
|
131
|
+
* for their `witnessParams`/`paramValues` maps (no separate boolean flag). */
|
|
132
132
|
export function classifyParamName(name: string): boolean {
|
|
133
133
|
return name.toUpperCase().includes('SECRET')
|
|
134
134
|
}
|
|
@@ -41,14 +41,14 @@ export interface DraftRequest {
|
|
|
41
41
|
* pagination/optionality flags of `RequestSelectionTemplate`. Reuses the
|
|
42
42
|
* shared `DraftRequest` shape — no provider `name`/`paramValues` required. */
|
|
43
43
|
export interface AllowedJsRequest extends DraftRequest {
|
|
44
|
-
/** Allow the template to match many requests (
|
|
45
|
-
* true. */
|
|
44
|
+
/** Allow the template to match many requests (for example, pagination).
|
|
45
|
+
* Default true. */
|
|
46
46
|
multiple?: boolean
|
|
47
47
|
/** Fail validation if no request matches this template. Default true. */
|
|
48
48
|
required?: boolean
|
|
49
49
|
/** Names of `${var}` placeholders in this template's `responseMatches`/
|
|
50
50
|
* `responseRedactions` that get substituted at verify time from the
|
|
51
|
-
* submitted proof's own witness params (
|
|
51
|
+
* submitted proof's own witness params (for example, an index list a
|
|
52
52
|
* `Reclaim.requestClaim` call attached alongside its `{{var}}`
|
|
53
53
|
* extractions). Omit (or leave empty) when the template has no such
|
|
54
54
|
* placeholders — verification then matches it literally as-is. */
|
|
@@ -69,15 +69,18 @@ export interface CreateVersionOptions {
|
|
|
69
69
|
jsUserScripts?: string
|
|
70
70
|
/** Requests the injection script may fire, as `RequestSelectionTemplate`s. */
|
|
71
71
|
allowedJsRequests?: AllowedJsRequest[]
|
|
72
|
-
/** In-app interception options, mapped
|
|
73
|
-
* `webSettings.clientOptions.inapp.interceptorOptions
|
|
74
|
-
* is
|
|
75
|
-
* `
|
|
76
|
-
* `
|
|
72
|
+
/** In-app interception options, mapped to
|
|
73
|
+
* `webSettings.clientOptions.inapp.interceptorOptions` — ONLY when this
|
|
74
|
+
* is explicitly passed (builder's schema has no `NONE` interceptorType;
|
|
75
|
+
* omitting `inapp` entirely IS the "no interception" signal, so omitting
|
|
76
|
+
* this must omit `inapp`, not default it to HAWKEYE). When it IS passed,
|
|
77
|
+
* `isDocumentRequestReplayEnabled` defaults to `false` (disabled) unless
|
|
78
|
+
* explicitly overridden here — see `providerToCreateVersionRequest`. Only
|
|
79
|
+
* meaningful for `HAWKEYE`/`MSWJS`; inert for `CDP`. */
|
|
77
80
|
interceptorOptions?: {
|
|
78
81
|
interceptorType: 'HAWKEYE' | 'MSWJS' | 'CDP'
|
|
79
|
-
isDocumentRequestReplayEnabled?: boolean
|
|
80
82
|
interceptorSettings?: string
|
|
83
|
+
isDocumentRequestReplayEnabled?: boolean
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
@@ -240,14 +243,28 @@ export function providerToCreateVersionRequest(
|
|
|
240
243
|
geoLocation: pickGeoLocation(providers),
|
|
241
244
|
clientOptions: {
|
|
242
245
|
portal: { useProxy: true },
|
|
246
|
+
// Builder's schema has NO "NONE" interceptorType — the real
|
|
247
|
+
// no-interception signal is OMITTING `inapp` entirely (it's not
|
|
248
|
+
// `required` on `InAppClientOptions`). So `inapp` is only built at
|
|
249
|
+
// ALL when the author explicitly opts into a real interceptorType;
|
|
250
|
+
// omitting `interceptorOptions` must omit `inapp` too, or every
|
|
251
|
+
// standard (non-interception) provider would incorrectly publish
|
|
252
|
+
// as HAWKEYE. Within that block, `isDocumentRequestReplayEnabled`
|
|
253
|
+
// defaults to disabled but is author-overridable — see
|
|
254
|
+
// `CreateVersionOptions.interceptorOptions`'s doc comment.
|
|
243
255
|
...(interceptorOptions
|
|
244
256
|
? {
|
|
245
257
|
inapp: {
|
|
246
258
|
interceptorOptions: {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
...interceptorOptions
|
|
259
|
+
interceptorType: interceptorOptions.interceptorType,
|
|
260
|
+
isDocumentRequestReplayEnabled:
|
|
261
|
+
interceptorOptions.isDocumentRequestReplayEnabled ?? false,
|
|
262
|
+
...(interceptorOptions.interceptorSettings
|
|
263
|
+
? {
|
|
264
|
+
interceptorSettings:
|
|
265
|
+
interceptorOptions.interceptorSettings,
|
|
266
|
+
}
|
|
267
|
+
: {}),
|
|
251
268
|
},
|
|
252
269
|
},
|
|
253
270
|
}
|
package/src/tools/registry.ts
CHANGED
|
@@ -70,11 +70,11 @@ export function errorAsToolText(err: unknown): string {
|
|
|
70
70
|
/**
|
|
71
71
|
* Adapt a tool to a host by WIDENING its input schema — add properties, mark
|
|
72
72
|
* some required, optionally override the description — without touching the
|
|
73
|
-
* handler. A host maps whichever shared tools it needs through this (
|
|
74
|
-
* MCP adds its `captureId` session handle + the credential-aware
|
|
75
|
-
* contract). Args parse loosely, so the extra fields flow through
|
|
76
|
-
* handler (its backend resolver reads them); the base tool stays
|
|
77
|
-
* hosts that don't need them.
|
|
73
|
+
* handler. A host maps whichever shared tools it needs through this (for
|
|
74
|
+
* example, the MCP adds its `captureId` session handle + the credential-aware
|
|
75
|
+
* `run_proof` contract). Args parse loosely, so the extra fields flow through
|
|
76
|
+
* to the handler (its backend resolver reads them); the base tool stays
|
|
77
|
+
* untouched for hosts that don't need them.
|
|
78
78
|
*/
|
|
79
79
|
export function extendTool(
|
|
80
80
|
tool: RegisteredTool,
|