@reclaimprotocol/agent 0.1.23 → 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.
Files changed (152) hide show
  1. package/README.md +55 -20
  2. package/lib/authoring/backend.d.ts +5 -4
  3. package/lib/authoring/tools.js +30 -30
  4. package/lib/cdp/browser-proxy.d.ts +78 -0
  5. package/lib/cdp/browser-proxy.js +186 -0
  6. package/lib/cdp/capture-engine.js +8 -7
  7. package/lib/cdp/client.d.ts +10 -0
  8. package/lib/cdp/geo.d.ts +10 -0
  9. package/lib/cdp/geo.js +36 -0
  10. package/lib/cdp/index.d.ts +1 -0
  11. package/lib/cdp/index.js +1 -0
  12. package/lib/live/cloudflared.d.ts +15 -0
  13. package/lib/live/cloudflared.js +268 -0
  14. package/lib/live/page.d.ts +20 -0
  15. package/lib/live/page.js +134 -0
  16. package/lib/live/tunnel.d.ts +23 -0
  17. package/lib/live/tunnel.js +120 -0
  18. package/lib/live/viewer.d.ts +28 -0
  19. package/lib/live/viewer.js +232 -0
  20. package/lib/mcp/api/operations.gen.js +34 -26
  21. package/lib/mcp/api/to-zod.d.ts +1 -1
  22. package/lib/mcp/api/to-zod.js +1 -1
  23. package/lib/mcp/api/tools.js +1 -1
  24. package/lib/mcp/instructions.d.ts +15 -2
  25. package/lib/mcp/instructions.js +101 -38
  26. package/lib/mcp/start.js +4 -3
  27. package/lib/mcp/tools/agent/analyze.js +5 -1
  28. package/lib/mcp/tools/agent/attach.d.ts +8 -1
  29. package/lib/mcp/tools/agent/attach.js +166 -22
  30. package/lib/mcp/tools/agent/build.d.ts +13 -8
  31. package/lib/mcp/tools/agent/build.js +22 -11
  32. package/lib/mcp/tools/agent/capture.js +5 -1
  33. package/lib/mcp/tools/agent/eval.js +3 -1
  34. package/lib/mcp/tools/agent/find.js +6 -5
  35. package/lib/mcp/tools/agent/how-it-works.d.ts +15 -7
  36. package/lib/mcp/tools/agent/how-it-works.js +57 -17
  37. package/lib/mcp/tools/agent/live-view.d.ts +21 -0
  38. package/lib/mcp/tools/agent/live-view.js +153 -0
  39. package/lib/mcp/tools/agent/pod-proof.d.ts +8 -0
  40. package/lib/mcp/tools/agent/pod-proof.js +64 -0
  41. package/lib/mcp/tools/agent/propose.js +4 -2
  42. package/lib/mcp/tools/agent/proxy.d.ts +3 -0
  43. package/lib/mcp/tools/agent/proxy.js +199 -0
  44. package/lib/mcp/tools/agent/publish.js +47 -77
  45. package/lib/mcp/tools/agent/session.d.ts +2 -1
  46. package/lib/mcp/tools/agent/session.js +26 -7
  47. package/lib/mcp/tools/authenticate/authenticate.js +26 -13
  48. package/lib/mcp/tools/mode/mode.d.ts +1 -1
  49. package/lib/mcp/tools/mode/mode.js +10 -22
  50. package/lib/old/client.d.ts +1 -1
  51. package/lib/old/client.js +1 -1
  52. package/lib/old/instructions.d.ts +9 -1
  53. package/lib/old/instructions.js +4 -6
  54. package/lib/old/login-cdp.d.ts +2 -2
  55. package/lib/old/login-cdp.js +46 -6
  56. package/lib/old/to-register.d.ts +3 -2
  57. package/lib/old/to-register.js +1 -1
  58. package/lib/old/tools/authenticate.js +9 -1
  59. package/lib/old/tools/get-provider-info.js +6 -5
  60. package/lib/old/tools/issue-app-credentials.js +3 -2
  61. package/lib/old/tools/publish.d.ts +1 -1
  62. package/lib/old/tools/publish.js +90 -131
  63. package/lib/old/tools/update-provider-metadata.d.ts +1 -1
  64. package/lib/old/tools/update-provider-metadata.js +1 -1
  65. package/lib/old/tools/verify-sdk-setup.js +1 -1
  66. package/lib/proof/attestor.d.ts +3 -3
  67. package/lib/proof/debug-response-dump.js +4 -4
  68. package/lib/proof/index.d.ts +1 -0
  69. package/lib/proof/index.js +1 -0
  70. package/lib/proof/page-replay.d.ts +1 -1
  71. package/lib/proof/page-replay.js +1 -1
  72. package/lib/proof/pod-prover.d.ts +47 -0
  73. package/lib/proof/pod-prover.js +155 -0
  74. package/lib/provider/dom-xpath.js +11 -9
  75. package/lib/provider/draft.d.ts +10 -7
  76. package/lib/provider/draft.js +11 -9
  77. package/lib/provider/injection-doc.d.ts +23 -1
  78. package/lib/provider/injection-doc.js +34 -21
  79. package/lib/provider/match-redaction-warning.d.ts +2 -2
  80. package/lib/provider/match-redaction-warning.js +3 -3
  81. package/lib/provider/matcher.js +13 -12
  82. package/lib/provider/secrets.d.ts +3 -3
  83. package/lib/provider/secrets.js +3 -3
  84. package/lib/provider/to-version.d.ts +7 -6
  85. package/lib/provider/to-version.js +3 -3
  86. package/lib/tools/registry.d.ts +5 -5
  87. package/lib/tools/registry.js +5 -5
  88. package/package.json +3 -3
  89. package/samples/demo-server/README.md +7 -6
  90. package/skill/SKILL.builder.md +356 -189
  91. package/skill/SKILL.common.md +323 -97
  92. package/skill/SKILL.old.md +340 -155
  93. package/skill/builder-mode.md +58 -17
  94. package/skill/hash-validation.md +170 -0
  95. package/skill/interception.md +235 -0
  96. package/skill/js-sdk-integration.md +13 -7
  97. package/skill/old-mode.md +60 -21
  98. package/skill/user-script.md +61 -0
  99. package/src/authoring/backend.ts +5 -4
  100. package/src/authoring/tools.ts +31 -30
  101. package/src/cdp/capture-engine.ts +8 -7
  102. package/src/cdp/client.ts +8 -0
  103. package/src/cdp/geo.ts +52 -0
  104. package/src/cdp/index.ts +1 -0
  105. package/src/consts.ts +1 -0
  106. package/src/live/cloudflared.ts +348 -0
  107. package/src/live/page.ts +145 -0
  108. package/src/live/tunnel.ts +157 -0
  109. package/src/live/viewer.ts +293 -0
  110. package/src/mcp/api/operations.gen.ts +34 -26
  111. package/src/mcp/api/to-zod.ts +1 -1
  112. package/src/mcp/api/tools.ts +1 -1
  113. package/src/mcp/instructions.ts +121 -48
  114. package/src/mcp/start.ts +4 -3
  115. package/src/mcp/tools/agent/analyze.ts +5 -1
  116. package/src/mcp/tools/agent/attach.ts +194 -22
  117. package/src/mcp/tools/agent/build.ts +26 -15
  118. package/src/mcp/tools/agent/capture.ts +5 -1
  119. package/src/mcp/tools/agent/eval.ts +4 -1
  120. package/src/mcp/tools/agent/find.ts +6 -5
  121. package/src/mcp/tools/agent/how-it-works.ts +62 -21
  122. package/src/mcp/tools/agent/live-view.ts +198 -0
  123. package/src/mcp/tools/agent/pod-proof.ts +90 -0
  124. package/src/mcp/tools/agent/propose.ts +4 -2
  125. package/src/mcp/tools/agent/publish.ts +52 -77
  126. package/src/mcp/tools/agent/session.ts +26 -5
  127. package/src/mcp/tools/authenticate/authenticate.ts +28 -13
  128. package/src/mcp/tools/mode/mode.ts +10 -22
  129. package/src/old/client.ts +2 -2
  130. package/src/old/instructions.ts +4 -10
  131. package/src/old/login-cdp.ts +50 -6
  132. package/src/old/to-register.ts +3 -2
  133. package/src/old/tools/authenticate.ts +9 -1
  134. package/src/old/tools/get-provider-info.ts +6 -5
  135. package/src/old/tools/issue-app-credentials.ts +3 -2
  136. package/src/old/tools/publish.ts +95 -131
  137. package/src/old/tools/update-provider-metadata.ts +1 -1
  138. package/src/old/tools/verify-sdk-setup.ts +1 -1
  139. package/src/proof/attestor.ts +3 -3
  140. package/src/proof/debug-response-dump.ts +4 -4
  141. package/src/proof/index.ts +8 -0
  142. package/src/proof/page-replay.ts +1 -1
  143. package/src/proof/pod-prover.ts +231 -0
  144. package/src/provider/dom-xpath.ts +11 -9
  145. package/src/provider/draft.ts +13 -10
  146. package/src/provider/injection-doc.ts +37 -24
  147. package/src/provider/match-redaction-warning.ts +3 -3
  148. package/src/provider/matcher.ts +13 -12
  149. package/src/provider/secrets.ts +3 -3
  150. package/src/provider/to-version.ts +11 -9
  151. package/src/tools/registry.ts +5 -5
  152. package/skill/injection-api.md +0 -364
@@ -466,7 +466,7 @@ export const MCP_TOOLS = {
466
466
  }),
467
467
  },
468
468
  "CreateProvider": {
469
- description: "Create a provider\n\nCreate a new Reclaim provider. Use this only after `providers` returned nothing useful for the domain. The caller must be an active member of the target organization.\nCreates a new provider in the specified organization. `visibility` is coerced to `PRIVATE` at creation regardless of what's sent; the author may toggle to `PUBLIC` later via `PATCH /providers/{id}`. While `PRIVATE`, versions go to the go live freely; once `PUBLIC`, non-admin versions need admin review. See `Provider.visibility`.\nThe server also seeds an initial `0.1.0` version on the `draft` branch in the same transaction so the provider is immediately editable. Its `initialUrl` defaults to `https://<domain>`; all other version fields fall back to their schema-declared defaults (a `structured` verificationType, empty requests, empty web settings). `Provider.latestVersion` stays `null` until the draft is promoted to the live channel.",
469
+ description: "Create a provider\n\nCreate a new Reclaim provider. Use this only after `providers` returned nothing useful for the domain. The caller must be an active member of the target organization.\nCreates a new provider in the specified organization. `visibility` is coerced to `PRIVATE` at creation regardless of what's sent; the author may toggle to `PUBLIC` later via `PATCH /providers/{id}`. While `PRIVATE`, versions go live freely; once `PUBLIC`, non-admin versions need admin review. See `Provider.visibility`.\nThe server also seeds an initial `0.1.0` version on the `draft` branch in the same transaction so the provider is immediately editable. Its `initialUrl` defaults to `https://<domain>`; all other version fields fall back to their schema-declared defaults (a `structured` verificationType, empty requests, empty web settings). `Provider.latestVersion` stays `null` until the draft is promoted to the live channel.",
470
470
  inputSchema: toZod({
471
471
  "type": "object",
472
472
  "properties": {
@@ -497,7 +497,7 @@ export const MCP_TOOLS = {
497
497
  "format": "uuid"
498
498
  },
499
499
  "domain": {
500
- "description": "Canonical root domain (e.g. `github.com`). No scheme, no port, no path.",
500
+ "description": "Canonical root domain (for example, `github.com`). No scheme, no port, no path.",
501
501
  "type": "string",
502
502
  "format": "hostname",
503
503
  "minLength": 1,
@@ -558,12 +558,12 @@ export const MCP_TOOLS = {
558
558
  "brandUrl": {
559
559
  "type": "string",
560
560
  "format": "uri",
561
- "description": "Canonical homepage of the brand (e.g. `https://google.com`). Used in brand-link cards and JSON-LD.",
561
+ "description": "Canonical homepage of the brand (for example, `https://google.com`). Used in brand-link cards and JSON-LD.",
562
562
  "maxLength": 2000
563
563
  },
564
564
  "primaryDataPoint": {
565
565
  "type": "string",
566
- "description": "Headline data point — the single most-important variable this provider can verify (e.g. `subscriber count`). Used in the provider's SEO title.",
566
+ "description": "Headline data point — the single most-important variable this provider can verify (for example, `subscriber count`). Used in the provider's SEO title.",
567
567
  "maxLength": 200
568
568
  },
569
569
  "dataPoints": {
@@ -670,10 +670,11 @@ export const MCP_TOOLS = {
670
670
  },
671
671
  "branch": {
672
672
  "type": "string",
673
- "description": "Branch (lifecycle stage) of this provider version.\n\n- `ai`: changes authored by the AI assistant live on this branch.\n\n- `draft`: a human is actively editing the version.\n\n- `in_review`: the author has submitted the version to be made\n public and it is awaiting review. On approval the branch tag\n is cleared (the version is promoted to the live channel and becomes\n public).\n\n- `rejected`: review concluded with a rejection. When the author\n addresses the feedback the branch transitions back to\n `in_review`.",
673
+ "description": "Branch (lifecycle stage) of this provider version.\n\n- `ai`: changes authored by the AI assistant live on this branch.\n\n- `draft`: a human is actively editing the version.\n\n- `fixed`: a proven AI repair. It remains pinned to its explicit\n version and does not replace the live trunk version.\n\n- `in_review`: the author has submitted the version to be made\n public and it is awaiting review. On approval the branch tag\n is cleared (the version is promoted to the live channel and becomes\n public).\n\n- `rejected`: review concluded with a rejection. When the author\n addresses the feedback the branch transitions back to\n `in_review`.",
674
674
  "enum": [
675
675
  "ai",
676
676
  "draft",
677
+ "fixed",
677
678
  "in_review",
678
679
  "rejected"
679
680
  ]
@@ -811,7 +812,7 @@ export const MCP_TOOLS = {
811
812
  "items": {
812
813
  "type": "object",
813
814
  "additionalProperties": false,
814
- "description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (i.e. \"HTTP/1.1 200 OK\")",
815
+ "description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (that is, \"HTTP/1.1 200 OK\")",
815
816
  "properties": {
816
817
  "xPath": {
817
818
  "type": "string",
@@ -819,7 +820,7 @@ export const MCP_TOOLS = {
819
820
  },
820
821
  "jsonPath": {
821
822
  "type": "string",
822
- "description": "expect a JSON response, retrieve the item at this path using dot notation for e.g. 'email.addresses.0'"
823
+ "description": "expect a JSON response, retrieve the item at this path using dot notation, for example 'email.addresses.0'."
823
824
  },
824
825
  "regex": {
825
826
  "type": "string",
@@ -964,7 +965,7 @@ export const MCP_TOOLS = {
964
965
  "items": {
965
966
  "type": "object",
966
967
  "additionalProperties": false,
967
- "description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (i.e. \"HTTP/1.1 200 OK\")",
968
+ "description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (that is, \"HTTP/1.1 200 OK\")",
968
969
  "properties": {
969
970
  "xPath": {
970
971
  "type": "string",
@@ -972,7 +973,7 @@ export const MCP_TOOLS = {
972
973
  },
973
974
  "jsonPath": {
974
975
  "type": "string",
975
- "description": "expect a JSON response, retrieve the item at this path using dot notation for e.g. 'email.addresses.0'"
976
+ "description": "expect a JSON response, retrieve the item at this path using dot notation, for example 'email.addresses.0'."
976
977
  },
977
978
  "regex": {
978
979
  "type": "string",
@@ -1029,8 +1030,8 @@ export const MCP_TOOLS = {
1029
1030
  "properties": {
1030
1031
  "geoLocation": {
1031
1032
  "type": "string",
1032
- "description": "Geographic location (e.g. ISO country code or {{DYNAMIC_GEO}} to use user's geo location) the verification should appear to originate from.",
1033
- "maxLength": 15,
1033
+ "description": "Geographic location the verification should appear to originate from: a 2-letter ISO country code, or a parameter the attestor resolves at proof time. `{{DYNAMIC_GEO}}` and `{{DYNAMIC_GEO_SECRET}}` are the Verification Client's standard names for the end-user's own country — the `_SECRET` one is delivered as a secret param, so the attestor never learns which country the proof egressed from.",
1034
+ "maxLength": 64,
1034
1035
  "default": "{{DYNAMIC_GEO}}"
1035
1036
  },
1036
1037
  "clientOptions": {
@@ -1438,7 +1439,7 @@ export const MCP_TOOLS = {
1438
1439
  }),
1439
1440
  },
1440
1441
  "DeleteProviderVersion": {
1441
- description: "Delete a provider version\n\nSoft-archives a version on the `draft`, `ai`, or `rejected` branch — sets `status` to `ARCHIVED` so history is preserved. Trunk (live) and `in_review` versions cannot be archived this way; archive the parent provider instead. Supports optimistic concurrency via `If-Match`.",
1442
+ description: "Delete a provider version\n\nSoft-archives a version on the `draft`, `ai`, or `rejected` branch — sets `status` to `ARCHIVED` so history is preserved. `fixed`, trunk (live), and `in_review` versions cannot be archived this way; archive the parent provider instead. Supports optimistic concurrency via `If-Match`.",
1442
1443
  inputSchema: toZod({
1443
1444
  "type": "object",
1444
1445
  "properties": {
@@ -1774,7 +1775,7 @@ export const MCP_TOOLS = {
1774
1775
  }),
1775
1776
  },
1776
1777
  "GetProviderVersion": {
1777
- description: "Get a specific provider version",
1778
+ description: "Get a specific provider version\n\nFetches one exact canonical version. Trunk is public when the provider is public. Non-trunk versions are visible to admins and members of the provider's organization. A member of the organization that paid for a successful AI repair may also read only the exact `fixed` version created by that repair.",
1778
1779
  inputSchema: toZod({
1779
1780
  "type": "object",
1780
1781
  "properties": {
@@ -2151,7 +2152,7 @@ export const MCP_TOOLS = {
2151
2152
  }),
2152
2153
  },
2153
2154
  "ListProviderVersions": {
2154
- description: "List a provider's versions\n\nLists versions visible to the caller. Non-public branches (`ai`, `draft`, `in_review`, `rejected`) are only visible to members of the provider's owning organization.",
2155
+ description: "List a provider's versions\n\nLists versions visible to the caller. Non-public branches (`ai`, `draft`, `fixed`, `in_review`, `rejected`) are only visible to members of the provider's owning organization.",
2155
2156
  inputSchema: toZod({
2156
2157
  "type": "object",
2157
2158
  "properties": {
@@ -2306,7 +2307,7 @@ export const MCP_TOOLS = {
2306
2307
  }),
2307
2308
  },
2308
2309
  "Providers": {
2309
- description: "Search providers\n\nSearch published Reclaim providers by domain or data point. A provider is the recipe an end-user follows to prove something about themselves (e.g. \"I have N followers on Twitter\"). Returns a list of matches. Call this BEFORE `create_provider` — most popular domains already have a public provider you can reuse.\nCatalog page listing all providers. Returns a paginated list of providers the caller can see. Public providers are visible to everyone; private providers are only visible to org members.",
2310
+ description: "Search providers\n\nSearch Reclaim providers by domain or data point. A provider is the recipe an end-user follows to prove something about themselves, such as \"I have N followers on Twitter\".\nCall this BEFORE `create_provider` — most popular domains already have a public provider you can reuse, and creating another one just stacks duplicates.\nReturns a paginated list of the providers the caller can see: public providers to everyone, private providers only to members of the owning organization.",
2310
2311
  inputSchema: toZod({
2311
2312
  "type": "object",
2312
2313
  "properties": {
@@ -2677,7 +2678,7 @@ export const MCP_TOOLS = {
2677
2678
  "properties": {
2678
2679
  "notes": {
2679
2680
  "type": "string",
2680
- "description": "Optional note from the author to reviewers (changelog, areas to focus on, etc.).",
2681
+ "description": "Optional note from the author to reviewers (changelog, areas to focus on, and so on).",
2681
2682
  "maxLength": 10000
2682
2683
  }
2683
2684
  }
@@ -2840,6 +2841,13 @@ export const MCP_TOOLS = {
2840
2841
  "minLength": 1,
2841
2842
  "maxLength": 200
2842
2843
  },
2844
+ "region": {
2845
+ "type": "string",
2846
+ "nullable": true,
2847
+ "description": "Confirm or override the provider's region. Send `null` to clear it so the provider applies to every region. See `Provider.region`.",
2848
+ "pattern": "^[a-z]{2}(-[a-z]{2})?$",
2849
+ "maxLength": 5
2850
+ },
2843
2851
  "title": {
2844
2852
  "type": "string",
2845
2853
  "minLength": 1,
@@ -2892,12 +2900,12 @@ export const MCP_TOOLS = {
2892
2900
  "brandUrl": {
2893
2901
  "type": "string",
2894
2902
  "format": "uri",
2895
- "description": "Canonical homepage of the brand (e.g. `https://google.com`). Used in brand-link cards and JSON-LD.",
2903
+ "description": "Canonical homepage of the brand (for example, `https://google.com`). Used in brand-link cards and JSON-LD.",
2896
2904
  "maxLength": 2000
2897
2905
  },
2898
2906
  "primaryDataPoint": {
2899
2907
  "type": "string",
2900
- "description": "Headline data point — the single most-important variable this provider can verify (e.g. `subscriber count`). Used in the provider's SEO title.",
2908
+ "description": "Headline data point — the single most-important variable this provider can verify (for example, `subscriber count`). Used in the provider's SEO title.",
2901
2909
  "maxLength": 200
2902
2910
  },
2903
2911
  "dataPoints": {
@@ -2933,7 +2941,7 @@ export const MCP_TOOLS = {
2933
2941
  }),
2934
2942
  },
2935
2943
  "UpdateProviderVersion": {
2936
- description: "Update a provider version\n\nMutable only while the version is on the `draft` or `rejected` branch. Versions on `in_review` or the live channel reject all writes here. Caller must be a member of the provider's owning organization. Supports optimistic concurrency via `If-Match`.",
2944
+ description: "Update a provider version\n\nMutable only while the version is on the `draft` or `rejected` branch. Versions on `fixed`, `in_review`, or the live channel reject all writes here. Caller must be a member of the provider's owning organization. Supports optimistic concurrency via `If-Match`.",
2937
2945
  inputSchema: toZod({
2938
2946
  "type": "object",
2939
2947
  "properties": {
@@ -2975,7 +2983,7 @@ export const MCP_TOOLS = {
2975
2983
  "body": {
2976
2984
  "type": "object",
2977
2985
  "additionalProperties": false,
2978
- "description": "Partial update of a provider version. Mutable only while the version is on the `draft` or `rejected` branch; versions on `in_review` or the live channel reject all writes here. The semver does not change on update — `build_number` increments instead, giving callers a monotonic revision counter without touching the (major, minor, patch) PK. `verificationType` and `prompt` may be updated; omit either to carry the prior build's value forward.",
2986
+ "description": "Partial update of a provider version. Mutable only while the version is on the `draft` or `rejected` branch; versions on `fixed`, `in_review`, or the live channel reject all writes here. The semver does not change on update — `build_number` increments instead, giving callers a monotonic revision counter without touching the (major, minor, patch) PK. `verificationType` and `prompt` may be updated; omit either to carry the prior build's value forward.",
2979
2987
  "properties": {
2980
2988
  "initialUrl": {
2981
2989
  "type": "string",
@@ -3114,7 +3122,7 @@ export const MCP_TOOLS = {
3114
3122
  "items": {
3115
3123
  "type": "object",
3116
3124
  "additionalProperties": false,
3117
- "description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (i.e. \"HTTP/1.1 200 OK\")",
3125
+ "description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (that is, \"HTTP/1.1 200 OK\")",
3118
3126
  "properties": {
3119
3127
  "xPath": {
3120
3128
  "type": "string",
@@ -3122,7 +3130,7 @@ export const MCP_TOOLS = {
3122
3130
  },
3123
3131
  "jsonPath": {
3124
3132
  "type": "string",
3125
- "description": "expect a JSON response, retrieve the item at this path using dot notation for e.g. 'email.addresses.0'"
3133
+ "description": "expect a JSON response, retrieve the item at this path using dot notation, for example 'email.addresses.0'."
3126
3134
  },
3127
3135
  "regex": {
3128
3136
  "type": "string",
@@ -3264,7 +3272,7 @@ export const MCP_TOOLS = {
3264
3272
  "items": {
3265
3273
  "type": "object",
3266
3274
  "additionalProperties": false,
3267
- "description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (i.e. \"HTTP/1.1 200 OK\")",
3275
+ "description": "Which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (that is, \"HTTP/1.1 200 OK\")",
3268
3276
  "properties": {
3269
3277
  "xPath": {
3270
3278
  "type": "string",
@@ -3272,7 +3280,7 @@ export const MCP_TOOLS = {
3272
3280
  },
3273
3281
  "jsonPath": {
3274
3282
  "type": "string",
3275
- "description": "expect a JSON response, retrieve the item at this path using dot notation for e.g. 'email.addresses.0'"
3283
+ "description": "expect a JSON response, retrieve the item at this path using dot notation, for example 'email.addresses.0'."
3276
3284
  },
3277
3285
  "regex": {
3278
3286
  "type": "string",
@@ -3329,8 +3337,8 @@ export const MCP_TOOLS = {
3329
3337
  "properties": {
3330
3338
  "geoLocation": {
3331
3339
  "type": "string",
3332
- "description": "Geographic location (e.g. ISO country code or {{DYNAMIC_GEO}} to use user's geo location) the verification should appear to originate from.",
3333
- "maxLength": 15,
3340
+ "description": "Geographic location the verification should appear to originate from: a 2-letter ISO country code, or a parameter the attestor resolves at proof time. `{{DYNAMIC_GEO}}` and `{{DYNAMIC_GEO_SECRET}}` are the Verification Client's standard names for the end-user's own country — the `_SECRET` one is delivered as a secret param, so the attestor never learns which country the proof egressed from.",
3341
+ "maxLength": 64,
3334
3342
  "default": "{{DYNAMIC_GEO}}"
3335
3343
  },
3336
3344
  "clientOptions": {
@@ -6,7 +6,7 @@ import type { JSONSchema } from 'zod/v4/core'
6
6
  *
7
7
  * The generator (`packages/app/scripts/mcp-tools-gen.ts`) inlines `$ref`s it
8
8
  * walks through `properties`/`items`, but it does NOT recurse into `allOf` /
9
- * `anyOf` / `oneOf`. So a schema composed with `allOf` (e.g.
9
+ * `anyOf` / `oneOf`. So a schema composed with `allOf` (for example,
10
10
  * `RequestSelectionTemplate =
11
11
  * allOf[ RequestSelection, { multiple, required } ]`,
12
12
  * surfaced by the proof tools' `allowedJsRequests`) can carry a dangling
@@ -9,7 +9,7 @@ import { MCP_TOOLS } from './operations.gen.ts'
9
9
 
10
10
  /**
11
11
  * The generated `MCP_TOOLS` are keyed by OpenAPI `operationId` (PascalCase,
12
- * e.g. `GetMe`). MCP tools are conventionally snake_case, matching the
12
+ * For example, `GetMe`). MCP tools are conventionally snake_case, matching the
13
13
  * hand-written tools in this server. Convert the public tool name here while
14
14
  * still dispatching to the API with the original operationId — doing this in
15
15
  * the (non-generated) registration keeps it from being reverted on regen.
@@ -1,66 +1,139 @@
1
1
  /**
2
- * MCP server instructions shown to the LLM when running in BUILDER mode
3
- * (`USE_OLD_DEVTOOLS=false`). The prose lives in `skill/builder-mode.md`
4
- * (published via the `files` array) so it can be edited as markdown without
5
- * touching code. The path resolves identically from `src/mcp` (dev) and
6
- * `lib/mcp` (published) — both are two levels below the package root.
7
- * Old-devtools mode has its own reduced set in `../old/instructions.ts`.
2
+ * The authoring documentation, assembled from `skill/*.md` at module load.
3
+ *
4
+ * Two things are served from here:
5
+ * - the always-on MCP server `instructions` (one file per backend mode) —
6
+ * deliberately small, since every client pays for them on every turn;
7
+ * - the deep authoring guide, split into TOPICS and served on demand by the
8
+ * `how_it_works` tool. Nothing here is inlined into a tool schema: a doc
9
+ * embedded in an input-schema description is paid for on every request
10
+ * whether or not it's ever relevant.
11
+ *
12
+ * The prose lives in markdown (published via package.json's `files`) so it
13
+ * can be edited without touching code. Paths resolve identically from
14
+ * `src/mcp` (dev) and `lib/mcp` (published) — both are two levels below the
15
+ * package root.
16
+ *
17
+ * Assembly has three steps:
18
+ * 1. `<!-- common: name -->` splices a shared block out of `SKILL.common.md`
19
+ * (delimited there by `<!-- section: name -->`), so the two mode guides
20
+ * don't drift on the ~60% of prose that is identical.
21
+ * 2. `%CTX%` expands to the mode's consumer-param namespace — `context.` on
22
+ * the builder, `context_` on old-devtools. That is the only textual
23
+ * difference across most shared blocks, so tokenizing it keeps them
24
+ * shared.
25
+ * 3. `<!-- topic: name -->` splits the result into the units `how_it_works`
26
+ * serves. Backend-independent topics come from their own files instead.
8
27
  */
9
28
  import assert from 'node:assert'
10
29
  import { readFileSync } from 'node:fs'
11
30
  import { fileURLToPath } from 'node:url'
12
31
 
13
- export const BUILDER_MODE_INSTRUCTIONS = readFileSync(
14
- fileURLToPath(new URL('../../skill/builder-mode.md', import.meta.url)),
15
- 'utf8',
16
- ).trim()
32
+ function readSkill(file: string): string {
33
+ const url = new URL(`../../skill/${file}`, import.meta.url)
34
+ return readFileSync(fileURLToPath(url), 'utf8')
35
+ // Strip any leading frontmatter defensively.
36
+ .replace(/^---\n[\s\S]*?\n---\n/, '')
37
+ .trim()
38
+ }
17
39
 
18
- /**
19
- * `SKILL.builder.md` and `SKILL.old.md` share a lot of prose (steps that are
20
- * identical regardless of backend, "never do" rules, common troubleshooting).
21
- * That shared text lives once in `skill/SKILL.common.md`, split into named
22
- * `<!-- section: name -->`-delimited blocks; each mode file splices a block
23
- * back in at `<!-- common: name -->`. Parsed once at module load.
24
- */
25
- const COMMON_SECTIONS = parseCommonSections(
26
- readFileSync(
27
- fileURLToPath(new URL('../../skill/SKILL.common.md', import.meta.url)),
28
- 'utf8',
29
- ),
30
- )
40
+ export const BUILDER_MODE_INSTRUCTIONS = readSkill('builder-mode.md')
41
+ export const OLD_MODE_INSTRUCTIONS = readSkill('old-mode.md')
31
42
 
32
- function parseCommonSections(text: string): Record<string, string> {
33
- const sections: Record<string, string> = {}
34
- const re = /<!-- section: (\S+) -->\n([\s\S]*?)(?=\n<!-- section: |$)/g
43
+ /** Split `<!-- marker: name -->`-delimited blocks, keeping document order. */
44
+ function splitBlocks(text: string, marker: string): Map<string, string> {
45
+ const blocks = new Map<string, string>()
46
+ const re = new RegExp(
47
+ `<!-- ${marker}: (\\S+) -->\\n([\\s\\S]*?)(?=\\n<!-- ${marker}: |$)`,
48
+ 'g',
49
+ )
35
50
  for(const match of text.matchAll(re)) {
36
- // Trim blank LINES only, not inline indentation — some sections are
51
+ // Trim blank LINES only, not inline indentation — some blocks are
37
52
  // list-continuation text that's intentionally indented on its first line.
38
- sections[match[1]] = match[2].replace(/^\n+/, '').replace(/\n+$/, '')
53
+ blocks.set(match[1], match[2].replace(/^\n+/, '').replace(/\n+$/, ''))
39
54
  }
40
55
 
41
- return sections
56
+ return blocks
42
57
  }
43
58
 
44
- /**
45
- * The full provider-authoring guide — the deep capture→prove→publish workflow,
46
- * decision frameworks, and troubleshooting. Served on demand by the
47
- * `how_it_works` MCP tool so every client (not just Claude Code, which
48
- * auto-loads skills) can pull it. There's a guide PER MODE so an agent is never
49
- * shown auth/publish tools that don't exist in its backend: the server picks
50
- * one by `oldMode` (see `mcp/start.ts`). Same `../../skill/` path resolution as
51
- * the instructions above; any leading frontmatter is stripped defensively.
52
- */
53
- function readGuide(file: string): string {
54
- const url = new URL(file, import.meta.url)
55
- const raw = readFileSync(fileURLToPath(url), 'utf8')
56
- const stripped = raw.replace(/^---\n[\s\S]*?\n---\n/, '').trim()
59
+ const COMMON_SECTIONS = splitBlocks(readSkill('SKILL.common.md'), 'section')
60
+
61
+ /** Topics that read the same on both backends, each its own file. */
62
+ const SHARED_TOPIC_FILES: Record<string, string> = {
63
+ 'user-script': 'user-script.md',
64
+ 'interception': 'interception.md',
65
+ 'hash-validation': 'hash-validation.md',
66
+ }
67
+
68
+ /** One line per topic, shown in the `how_it_works` index so a caller can pick
69
+ * the right one without fetching several. Keyed across both modes; only the
70
+ * topics a mode actually has are listed back to it. */
71
+ const TOPIC_SUMMARIES: Record<string, string> = {
72
+ 'overview': 'Terminology, your stance, and the whole loop at a glance.',
73
+ 'auth': 'Signing in to the backend, and which token authorizes what.',
74
+ 'browser': 'Choosing a browser source (local / remote / custom CDP), '
75
+ + 'geolocation, live view, and launch troubleshooting.',
76
+ 'capture': 'Tabs, login detection, driving the page, and picking an '
77
+ + 'authenticated request to prove.',
78
+ 'draft': 'The OPRF/privacy decision, propose_provider, and the canonical '
79
+ + 'drafted shape.',
80
+ 'params': 'Extracted vs consumer-supplied vs secret params, the URL '
81
+ + 'character budget, and runtime resolution.',
82
+ 'prove': 'replay_request, the mandatory auth-bound check, run_proof, and '
83
+ + 'diagnosing failures.',
84
+ 'publish': 'Creating/reusing a provider, versions, multi-request providers, '
85
+ + 'and going live.',
86
+ 'discover': 'Finding the right providers for a dev\'s app and creating a '
87
+ + 'verification session.',
88
+ 'user-script': 'Authoring jsUserScripts / customInjection to drive '
89
+ + 'login-gated pages.',
90
+ 'interception': 'injectionType / interceptorType, live interception, the '
91
+ + 'document-replay flag, and what to do when a site won\'t load or '
92
+ + 'won\'t let the user sign in.',
93
+ 'hash-validation': 'bodySniff, and how verifyProof({ providerId }) gates on '
94
+ + 'the declared spec hash.',
95
+ 'credentials': 'The eth proof-owner key run_proof signs with.',
96
+ 'never-do': 'The short list of things that always break a provider.',
97
+ 'troubleshooting': 'Expired drafts, browser problems, and where to look '
98
+ + 'next.',
99
+ }
57
100
 
58
- return stripped.replace(/<!-- common: (\S+) -->/g, (whole, name: string) => {
59
- const section = COMMON_SECTIONS[name]
60
- assert(section, `${file}: no SKILL.common.md section named "${name}"`)
61
- return section
101
+ export interface Guide {
102
+ /** Topic name → its markdown, in document order. */
103
+ topics: Map<string, string>
104
+ /** `{ topic, summary }` for every topic this mode has. */
105
+ index: Array<{ topic: string, summary: string }>
106
+ /** Every topic concatenated — the whole guide, as it used to be served. */
107
+ full: string
108
+ }
109
+
110
+ function buildGuide(file: string, ctxPrefix: string): Guide {
111
+ const raw = readSkill(file)
112
+ .replace(/<!-- common: (\S+) -->/g, (_whole, name: string) => {
113
+ const section = COMMON_SECTIONS.get(name)
114
+ assert(section, `${file}: no SKILL.common.md section named "${name}"`)
115
+ return section
116
+ })
117
+ .replaceAll('%CTX%', ctxPrefix)
118
+
119
+ const topics = splitBlocks(raw, 'topic')
120
+ assert(topics.size, `${file}: no <!-- topic: … --> sections found`)
121
+ for(const [name, path] of Object.entries(SHARED_TOPIC_FILES)) {
122
+ topics.set(name, readSkill(path))
123
+ }
124
+
125
+ const index = [...topics.keys()].map((topic) => {
126
+ const summary = TOPIC_SUMMARIES[topic]
127
+ assert(summary, `${file}: no TOPIC_SUMMARIES entry for "${topic}"`)
128
+ return { topic, summary }
62
129
  })
130
+
131
+ return { topics, index, full: [...topics.values()].join('\n\n') }
63
132
  }
64
133
 
65
- export const PROVIDER_GUIDE_BUILDER = readGuide('../../skill/SKILL.builder.md')
66
- export const PROVIDER_GUIDE_OLD = readGuide('../../skill/SKILL.old.md')
134
+ export const GUIDE_BUILDER = buildGuide('SKILL.builder.md', 'context.')
135
+ export const GUIDE_OLD = buildGuide('SKILL.old.md', 'context_')
136
+
137
+ export function guideFor(oldMode: boolean): Guide {
138
+ return oldMode ? GUIDE_OLD : GUIDE_BUILDER
139
+ }
package/src/mcp/start.ts CHANGED
@@ -75,7 +75,8 @@ export async function startMcpServer() {
75
75
  })
76
76
  const sdkClient = new ReclaimSdkClient({ baseUrl: sdkApiUrl() })
77
77
  // Shared with buildAgentTools below so the old-mode publish tool can see
78
- // the live attach state (e.g. to flag a still-open browser session).
78
+ // the live attach state (for example, to flag a still-open browser
79
+ // session).
79
80
  const agentState = buildAgentState()
80
81
 
81
82
  registerToolList(server, buildBuilderAuthenticationTools(builderClient))
@@ -105,8 +106,8 @@ export async function startMcpServer() {
105
106
  // Register credential tools for ETH credential management.
106
107
  registerToolList(server, buildCredentialTools(client))
107
108
 
108
- // Higher-level verification orchestrations (e.g. fetch + decrypt result).
109
- // Authenticates with RECLAIM_ORG_SECRET, not the session client.
109
+ // Higher-level verification orchestrations (for example, fetch + decrypt
110
+ // result). Authenticates with RECLAIM_ORG_SECRET, not the session client.
110
111
  registerToolList(server, buildVerificationTools())
111
112
 
112
113
  // Add auto-generated tools with snake_case wrappers
@@ -7,7 +7,11 @@ export function analyzeTool(captures: CaptureStore): RegisteredTool {
7
7
  {
8
8
  name: 'analyze_request_constraints',
9
9
  description:
10
- 'Flag potential provider-authoring concerns for a captured request.',
10
+ 'Flag provider-authoring concerns for one captured request — signed '
11
+ + 'request, CSRF dependency, bot challenge, short-lived token, '
12
+ + 'GraphQL. Call it on each top candidate from '
13
+ + 'find_requests_containing before drafting, and relay the returned '
14
+ + '`concerns` to the developer verbatim.',
11
15
  inputSchema: {
12
16
  type: 'object',
13
17
  properties: {