@reclaimprotocol/agent 0.1.15 → 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.
Files changed (64) hide show
  1. package/lib/authoring/index.d.ts +1 -1
  2. package/lib/authoring/index.js +1 -1
  3. package/lib/authoring/util.js +3 -0
  4. package/lib/config/store.d.ts +7 -0
  5. package/lib/consts.d.ts +15 -0
  6. package/lib/consts.js +35 -0
  7. package/lib/index.js +1 -1
  8. package/lib/mcp/api/operations.gen.d.ts +8 -16
  9. package/lib/mcp/api/operations.gen.js +428 -479
  10. package/lib/mcp/remap_errors.js +7 -14
  11. package/lib/mcp/start.js +10 -3
  12. package/lib/mcp/tools/agent/proof.js +3 -3
  13. package/lib/mcp/tools/agent/publish.js +33 -0
  14. package/lib/mcp/tools/authenticate/authenticate.js +178 -93
  15. package/lib/mcp/tools/authenticate/eth-key.js +2 -3
  16. package/lib/mcp/tools/index.d.ts +1 -0
  17. package/lib/mcp/tools/index.js +1 -0
  18. package/lib/mcp/tools/mode/index.d.ts +1 -0
  19. package/lib/mcp/tools/mode/index.js +3 -0
  20. package/lib/mcp/tools/mode/mode.d.ts +17 -0
  21. package/lib/mcp/tools/mode/mode.js +69 -0
  22. package/lib/old/to-register.d.ts +16 -8
  23. package/lib/old/to-register.js +29 -21
  24. package/lib/old/tools/publish.js +86 -8
  25. package/lib/provider/injection-doc.js +4 -3
  26. package/lib/provider/schema.d.ts +26 -1
  27. package/lib/provider/to-version.d.ts +19 -2
  28. package/lib/provider/to-version.js +22 -4
  29. package/lib/tools/registry.d.ts +6 -13
  30. package/lib/tools/registry.js +29 -0
  31. package/package.json +5 -8
  32. package/scripts/prepend-shebang.js +1 -1
  33. package/skill/builder-mode.md +2 -0
  34. package/skill/old-mode.md +3 -1
  35. package/src/authoring/index.ts +1 -0
  36. package/src/authoring/util.ts +3 -0
  37. package/src/cdp/launcher.ts +1 -1
  38. package/src/config/store.ts +8 -0
  39. package/src/consts.ts +44 -0
  40. package/src/index.ts +1 -1
  41. package/src/mcp/api/operations.gen.ts +430 -487
  42. package/src/mcp/remap_errors.ts +8 -15
  43. package/src/mcp/start.ts +11 -2
  44. package/src/mcp/tools/agent/proof.ts +3 -3
  45. package/src/mcp/tools/agent/publish.ts +42 -0
  46. package/src/mcp/tools/authenticate/authenticate.ts +238 -108
  47. package/src/mcp/tools/authenticate/eth-key.ts +7 -5
  48. package/src/mcp/tools/index.ts +1 -0
  49. package/src/mcp/tools/mode/index.ts +3 -0
  50. package/src/mcp/tools/mode/mode.ts +82 -0
  51. package/src/old/to-register.ts +50 -27
  52. package/src/old/tools/publish.ts +108 -8
  53. package/src/proof/debug-response-dump.ts +1 -1
  54. package/src/proof/proof-core.ts +1 -1
  55. package/src/proof/zk-files.ts +2 -2
  56. package/src/provider/dom-xpath.ts +1 -1
  57. package/src/provider/draft.ts +3 -3
  58. package/src/provider/injection-doc.ts +4 -3
  59. package/src/provider/schema.ts +27 -1
  60. package/src/provider/to-version.ts +45 -6
  61. package/src/tools/registry.ts +19 -0
  62. package/src/cli/args.ts +0 -20
  63. package/src/cli/commands.ts +0 -27
  64. package/src/cli.ts +0 -7
@@ -18,6 +18,10 @@ export interface ReclaimAgentConfig {
18
18
  /**
19
19
  * The single on-disk document at `~/.reclaim/config.json`. Each top-level
20
20
  * key is an independent section owned by a different subsystem:
21
+ * - `mode` — persisted backend preference (old-devtools vs builder),
22
+ * set via the `set_devtools_mode` tool. Applied at server
23
+ * start; an explicit `USE_OLD_DEVTOOLS` env var overrides
24
+ * it (see `resolveOldMode` in consts.ts).
21
25
  * - `browser_agent` — Chrome attach mode/port (the agent tools)
22
26
  * - `session` — the auth bearer token (authenticate)
23
27
  * - `old_devtools` — externally-supplied identity for OLD-devtools mode
@@ -32,11 +36,15 @@ export interface ReclaimAgentConfig {
32
36
  */
33
37
  export interface ReclaimConfig {
34
38
  version: 1
39
+ mode?: DevtoolsMode
35
40
  browser_agent?: ReclaimAgentConfig
36
41
  session?: CachedSession
37
42
  old_devtools?: OldIdentity
38
43
  }
39
44
 
45
+ /** Which backend the MCP server targets. See `resolveOldMode` in consts.ts. */
46
+ export type DevtoolsMode = 'old' | 'builder'
47
+
40
48
  /**
41
49
  * Read/write the unified Reclaim config document. The file holds the
42
50
  * (short-lived) session bearer token, so it is always locked to `0600` and
package/src/consts.ts CHANGED
@@ -72,6 +72,50 @@ export function useOldDevtools(): boolean {
72
72
  return (process.env.USE_OLD_DEVTOOLS ?? '').trim().toLowerCase() !== 'false'
73
73
  }
74
74
 
75
+ /** True when `USE_OLD_DEVTOOLS` is set to a non-empty value (explicit). */
76
+ function oldDevtoolsEnvSet(): boolean {
77
+ return (process.env.USE_OLD_DEVTOOLS ?? '').trim() !== ''
78
+ }
79
+
80
+ /**
81
+ * Effective mode, layering the persisted preference under the env var:
82
+ * explicit `USE_OLD_DEVTOOLS` wins → persisted config `mode` → default (old).
83
+ * The persisted value comes from `~/.reclaim/config.json` (set via the
84
+ * `set_devtools_mode` tool); the caller reads it so this module needn't import
85
+ * `ConfigStore` (which would create an import cycle).
86
+ */
87
+ export function resolveOldMode(persisted?: 'old' | 'builder'): boolean {
88
+ if(oldDevtoolsEnvSet()) {
89
+ return useOldDevtools()
90
+ }
91
+
92
+ if(persisted) {
93
+ return persisted === 'old'
94
+ }
95
+
96
+ return true
97
+ }
98
+
99
+ /**
100
+ * Where the effective mode came from — the same precedence as
101
+ * `resolveOldMode`: explicit `USE_OLD_DEVTOOLS` env var → persisted config
102
+ * `mode` → default (old). Surfaced by the `get_devtools_mode` tool so the
103
+ * user can tell why the server is in the mode it reports.
104
+ */
105
+ export function oldModeSource(
106
+ persisted?: 'old' | 'builder',
107
+ ): 'env' | 'config' | 'default' {
108
+ if(oldDevtoolsEnvSet()) {
109
+ return 'env'
110
+ }
111
+
112
+ if(persisted) {
113
+ return 'config'
114
+ }
115
+
116
+ return 'default'
117
+ }
118
+
75
119
  // ---------------------------------------------------------------------------
76
120
  // Chrome / CDP launcher.
77
121
  // ---------------------------------------------------------------------------
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Package entry — SDK re-exports + agent public API.
2
- // The CLI lives at ./cli.ts, the MCP server bin at ./mcp-bin.ts.
2
+ // The MCP server bin lives at ./mcp-bin.ts.
3
3
 
4
4
  // SDK — re-export everything from @reclaimprotocol/client so consumers
5
5
  // only need one package for both the typed HTTP client and the agent tools.