@reclaimprotocol/agent 0.1.6 → 0.1.7

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.
@@ -44,6 +44,10 @@ export interface RegisterProviderBody {
44
44
  };
45
45
  /** Accepted at register too. */
46
46
  pageTitle?: string;
47
+ /** Accepted at register too — verified straight from the register
48
+ * controller's destructure + its `providerConfig` write, both of which
49
+ * include it alongside `pageTitle`/`userAgent`. */
50
+ stepsToFollow?: string;
47
51
  }
48
52
  export interface UpdateProviderConfigBody {
49
53
  providerConfig: Record<string, unknown>;
@@ -41,8 +41,8 @@ export interface OldProviderOpts {
41
41
  * fresh entries with {@link injectedRequestDataFrom}; a carried-forward
42
42
  * value (read back from an existing version) passes through unchanged. */
43
43
  allowedInjectedRequestData?: OldInjectedRequestData[];
44
- /** Config (add-version) ONLY — the register endpoint never reads this
45
- * field from the request body. */
44
+ /** Accepted at register too (verified from the register controller's
45
+ * destructure + providerConfig write — same as `userAgent`/`pageTitle`). */
46
46
  stepsToFollow?: string;
47
47
  /** Config (add-version) ONLY — the register endpoint never reads this
48
48
  * field from the request body. */
@@ -114,15 +114,18 @@ export function providerToRegisterBody(providers, opts) {
114
114
  if (opts.customInjection !== undefined) {
115
115
  body.customInjection = opts.customInjection;
116
116
  }
117
- // Register also accepts these two (unlike allowedInjectedRequestData /
118
- // stepsToFollow / useIncognitoWebview / extensionConfig, which the
119
- // register controller never reads from the body at all).
117
+ // Register also accepts these three (unlike allowedInjectedRequestData /
118
+ // useIncognitoWebview / extensionConfig, which the register controller
119
+ // never reads from the body at all).
120
120
  if (opts.userAgent !== undefined) {
121
121
  body.userAgent = opts.userAgent;
122
122
  }
123
123
  if (opts.pageTitle !== undefined) {
124
124
  body.pageTitle = opts.pageTitle;
125
125
  }
126
+ if (opts.stepsToFollow !== undefined) {
127
+ body.stepsToFollow = opts.stepsToFollow;
128
+ }
126
129
  return body;
127
130
  }
128
131
  /** Body for `POST /api/providers/:providerId/config` — adds a new version to
@@ -7,9 +7,9 @@ const DEFAULT_VERSION_INFO = 'Updated from MCP browser capture';
7
7
  /** Fields with no partial-patch equivalent on this backend: a version always
8
8
  * replaces the WHOLE `providerConfig`, so omitting one of these on
9
9
  * add-version must carry forward the current value rather than publish it
10
- * blank. `allowedInjectedRequestData` is handled alongside these (see
11
- * `resolveInjectedRequests`) since it needs translation when freshly
12
- * authored, unlike these — which pass through unchanged either way. */
10
+ * blank. `allowedInjectedRequestData` is handled alongside these (further
11
+ * down, inline) since it needs translation when freshly authored, unlike
12
+ * these — which pass through unchanged either way. */
13
13
  const PRESERVABLE_KEYS = [
14
14
  'customInjection',
15
15
  'userAgent',
@@ -30,12 +30,22 @@ function extractProviderConfig(resp) {
30
30
  return undefined;
31
31
  }
32
32
  /** Prefer the caller's explicit value; otherwise fall back to `current`'s
33
- * value (if any) and record `fieldName` as carried forward. */
33
+ * value (if any) and record `fieldName` as carried forward.
34
+ *
35
+ * `current === null` is treated the SAME as `undefined` (nothing to carry),
36
+ * not as a real value to preserve. These are all optional fields with no
37
+ * Prisma default — a version where one was never set reads back as
38
+ * `null`, not a missing key, because Prisma normalizes an absent optional
39
+ * field to `null` on read. Carrying that `null` "forward" would falsely
40
+ * claim the field was preserved when really nothing was ever there — it
41
+ * most likely means an EARLIER version already lost it (e.g. published
42
+ * before this field had carry-forward support at all), not that this call
43
+ * is doing anything wrong. */
34
44
  function resolveField(explicit, current, fieldName, carried) {
35
45
  if (explicit !== undefined) {
36
46
  return explicit;
37
47
  }
38
- if (current !== undefined) {
48
+ if (current !== undefined && current !== null) {
39
49
  carried.push(fieldName);
40
50
  return current;
41
51
  }
@@ -108,10 +118,16 @@ export function createVersionFromCaptureTool(client) {
108
118
  '`useIncognitoWebview`, `extensionConfig` that you OMIT is carried ' +
109
119
  'forward unchanged from the currently-published version (so ' +
110
120
  're-publishing requestData never wipes a working login script or ' +
111
- 'other config someone set via the dashboard). Pass an explicit ' +
112
- 'value (`""`, `[]`, `false`, ...) to intentionally clear one of ' +
113
- 'them instead, or call get_provider_version_config first to see ' +
114
- 'exactly what is live today before deciding what to change. ' +
121
+ 'other config someone set via the dashboard). This can only carry ' +
122
+ 'forward what the CURRENT version actually has — if an earlier ' +
123
+ 'version already lost a field (e.g. published before this tool ' +
124
+ 'carried it forward at all), there is nothing left to preserve and ' +
125
+ 'the result legitimately comes back empty/null for that field; ' +
126
+ 'that is not this call failing to carry it forward. Pass an ' +
127
+ 'explicit value (`""`, `[]`, `false`, ...) to intentionally clear ' +
128
+ 'one of them instead, or call get_provider_version_config FIRST ' +
129
+ 'to see exactly what is live today, rather than assuming this ' +
130
+ 'call recovered something that may already be gone. ' +
115
131
  '`allowedInjectedRequestData`/`useIncognitoWebview`/' +
116
132
  '`extensionConfig` only take effect on add-version — the register ' +
117
133
  'endpoint (no `providerId`) ignores them. \n\n' +
@@ -241,7 +257,7 @@ export function createVersionFromCaptureTool(client) {
241
257
  stepsToFollow: {
242
258
  type: 'string',
243
259
  description: 'Free-text setup/manual-verification steps shown to the ' +
244
- 'dev/verifier. Add-version ONLY.',
260
+ 'dev/verifier. Accepted on register too.',
245
261
  },
246
262
  useIncognitoWebview: {
247
263
  type: 'boolean',
@@ -320,6 +336,9 @@ export function createVersionFromCaptureTool(client) {
320
336
  if (args.pageTitle !== undefined) {
321
337
  opts.pageTitle = args.pageTitle;
322
338
  }
339
+ if (args.stepsToFollow !== undefined) {
340
+ opts.stepsToFollow = args.stepsToFollow;
341
+ }
323
342
  const body = providerToRegisterBody(providers, opts);
324
343
  return withNotes(await client.registerProvider(body));
325
344
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reclaimprotocol/agent",
3
3
  "title": "Reclaim Agent",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "description": "Reclaim Protocol agent — SDK, CLI, and MCP server in one package. SDK + CLI talk to the builder backend; MCP server adds Chrome CDP capture, provider synthesis, replay, and zkTLS proof.",
6
6
  "type": "module",
7
7
  "main": "./lib/index.js",
package/src/old/client.ts CHANGED
@@ -43,6 +43,10 @@ export interface RegisterProviderBody {
43
43
  userAgent?: { ios?: string, android?: string }
44
44
  /** Accepted at register too. */
45
45
  pageTitle?: string
46
+ /** Accepted at register too — verified straight from the register
47
+ * controller's destructure + its `providerConfig` write, both of which
48
+ * include it alongside `pageTitle`/`userAgent`. */
49
+ stepsToFollow?: string
46
50
  }
47
51
 
48
52
  export interface UpdateProviderConfigBody {
@@ -50,8 +50,8 @@ export interface OldProviderOpts {
50
50
  * fresh entries with {@link injectedRequestDataFrom}; a carried-forward
51
51
  * value (read back from an existing version) passes through unchanged. */
52
52
  allowedInjectedRequestData?: OldInjectedRequestData[]
53
- /** Config (add-version) ONLY — the register endpoint never reads this
54
- * field from the request body. */
53
+ /** Accepted at register too (verified from the register controller's
54
+ * destructure + providerConfig write — same as `userAgent`/`pageTitle`). */
55
55
  stepsToFollow?: string
56
56
  /** Config (add-version) ONLY — the register endpoint never reads this
57
57
  * field from the request body. */
@@ -231,9 +231,9 @@ export function providerToRegisterBody(
231
231
  body.customInjection = opts.customInjection
232
232
  }
233
233
 
234
- // Register also accepts these two (unlike allowedInjectedRequestData /
235
- // stepsToFollow / useIncognitoWebview / extensionConfig, which the
236
- // register controller never reads from the body at all).
234
+ // Register also accepts these three (unlike allowedInjectedRequestData /
235
+ // useIncognitoWebview / extensionConfig, which the register controller
236
+ // never reads from the body at all).
237
237
  if(opts.userAgent !== undefined) {
238
238
  body.userAgent = opts.userAgent
239
239
  }
@@ -242,6 +242,10 @@ export function providerToRegisterBody(
242
242
  body.pageTitle = opts.pageTitle
243
243
  }
244
244
 
245
+ if(opts.stepsToFollow !== undefined) {
246
+ body.stepsToFollow = opts.stepsToFollow
247
+ }
248
+
245
249
  return body
246
250
  }
247
251
 
@@ -23,9 +23,9 @@ const DEFAULT_VERSION_INFO = 'Updated from MCP browser capture'
23
23
  /** Fields with no partial-patch equivalent on this backend: a version always
24
24
  * replaces the WHOLE `providerConfig`, so omitting one of these on
25
25
  * add-version must carry forward the current value rather than publish it
26
- * blank. `allowedInjectedRequestData` is handled alongside these (see
27
- * `resolveInjectedRequests`) since it needs translation when freshly
28
- * authored, unlike these — which pass through unchanged either way. */
26
+ * blank. `allowedInjectedRequestData` is handled alongside these (further
27
+ * down, inline) since it needs translation when freshly authored, unlike
28
+ * these — which pass through unchanged either way. */
29
29
  const PRESERVABLE_KEYS = [
30
30
  'customInjection',
31
31
  'userAgent',
@@ -51,7 +51,17 @@ function extractProviderConfig(
51
51
  }
52
52
 
53
53
  /** Prefer the caller's explicit value; otherwise fall back to `current`'s
54
- * value (if any) and record `fieldName` as carried forward. */
54
+ * value (if any) and record `fieldName` as carried forward.
55
+ *
56
+ * `current === null` is treated the SAME as `undefined` (nothing to carry),
57
+ * not as a real value to preserve. These are all optional fields with no
58
+ * Prisma default — a version where one was never set reads back as
59
+ * `null`, not a missing key, because Prisma normalizes an absent optional
60
+ * field to `null` on read. Carrying that `null` "forward" would falsely
61
+ * claim the field was preserved when really nothing was ever there — it
62
+ * most likely means an EARLIER version already lost it (e.g. published
63
+ * before this field had carry-forward support at all), not that this call
64
+ * is doing anything wrong. */
55
65
  function resolveField<T>(
56
66
  explicit: T | undefined,
57
67
  current: unknown,
@@ -62,7 +72,7 @@ function resolveField<T>(
62
72
  return explicit
63
73
  }
64
74
 
65
- if(current !== undefined) {
75
+ if(current !== undefined && current !== null) {
66
76
  carried.push(fieldName)
67
77
  return current as T
68
78
  }
@@ -163,10 +173,16 @@ export function createVersionFromCaptureTool(
163
173
  '`useIncognitoWebview`, `extensionConfig` that you OMIT is carried ' +
164
174
  'forward unchanged from the currently-published version (so ' +
165
175
  're-publishing requestData never wipes a working login script or ' +
166
- 'other config someone set via the dashboard). Pass an explicit ' +
167
- 'value (`""`, `[]`, `false`, ...) to intentionally clear one of ' +
168
- 'them instead, or call get_provider_version_config first to see ' +
169
- 'exactly what is live today before deciding what to change. ' +
176
+ 'other config someone set via the dashboard). This can only carry ' +
177
+ 'forward what the CURRENT version actually has — if an earlier ' +
178
+ 'version already lost a field (e.g. published before this tool ' +
179
+ 'carried it forward at all), there is nothing left to preserve and ' +
180
+ 'the result legitimately comes back empty/null for that field; ' +
181
+ 'that is not this call failing to carry it forward. Pass an ' +
182
+ 'explicit value (`""`, `[]`, `false`, ...) to intentionally clear ' +
183
+ 'one of them instead, or call get_provider_version_config FIRST ' +
184
+ 'to see exactly what is live today, rather than assuming this ' +
185
+ 'call recovered something that may already be gone. ' +
170
186
  '`allowedInjectedRequestData`/`useIncognitoWebview`/' +
171
187
  '`extensionConfig` only take effect on add-version — the register ' +
172
188
  'endpoint (no `providerId`) ignores them. \n\n' +
@@ -308,7 +324,7 @@ export function createVersionFromCaptureTool(
308
324
  type: 'string',
309
325
  description:
310
326
  'Free-text setup/manual-verification steps shown to the ' +
311
- 'dev/verifier. Add-version ONLY.',
327
+ 'dev/verifier. Accepted on register too.',
312
328
  },
313
329
  useIncognitoWebview: {
314
330
  type: 'boolean',
@@ -415,6 +431,10 @@ export function createVersionFromCaptureTool(
415
431
  opts.pageTitle = args.pageTitle
416
432
  }
417
433
 
434
+ if(args.stepsToFollow !== undefined) {
435
+ opts.stepsToFollow = args.stepsToFollow
436
+ }
437
+
418
438
  const body = providerToRegisterBody(providers, opts)
419
439
  return withNotes(await client.registerProvider(body))
420
440
  }