@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
@@ -1,4 +1,4 @@
1
1
  export type { AuthoringBackend, Draft, DraftStore, ProveOptions, SecretParams, } from './backend.ts';
2
2
  export { makeDraftStore } from './backend.ts';
3
3
  export { authoringTools } from './tools.ts';
4
- export { defineTool, extendTool, type RegisteredTool, type ToolDefinition, } from '../tools/registry.ts';
4
+ export { defineTool, errorAsToolText, extendTool, type RegisteredTool, type ToolDefinition, } from '../tools/registry.ts';
@@ -3,4 +3,4 @@ export { authoringTools } from "./tools.js";
3
3
  // The shared tool primitive — re-exported so consumers (the cloud loop) get the
4
4
  // RegisteredTool type/`defineTool`/`extendTool` without importing the MCP
5
5
  // subsystem.
6
- export { defineTool, extendTool, } from "../tools/registry.js";
6
+ export { defineTool, errorAsToolText, extendTool, } from "../tools/registry.js";
@@ -1,6 +1,9 @@
1
1
  /** Build an `object` JSON Schema for a tool input — a small literal shortener,
2
2
  * not a tool abstraction. */
3
3
  export function objectSchema(properties, required) {
4
+ // `properties` is an untyped Record here (this is a literal shortener, not a
5
+ // schema validator), so it doesn't structurally match ObjectSchema's strict
6
+ // per-property schema type — assert the shape.
4
7
  return {
5
8
  type: 'object',
6
9
  properties,
@@ -7,6 +7,10 @@ export interface ReclaimAgentConfig {
7
7
  /**
8
8
  * The single on-disk document at `~/.reclaim/config.json`. Each top-level
9
9
  * key is an independent section owned by a different subsystem:
10
+ * - `mode` — persisted backend preference (old-devtools vs builder),
11
+ * set via the `set_devtools_mode` tool. Applied at server
12
+ * start; an explicit `USE_OLD_DEVTOOLS` env var overrides
13
+ * it (see `resolveOldMode` in consts.ts).
10
14
  * - `browser_agent` — Chrome attach mode/port (the agent tools)
11
15
  * - `session` — the auth bearer token (authenticate)
12
16
  * - `old_devtools` — externally-supplied identity for OLD-devtools mode
@@ -21,10 +25,13 @@ export interface ReclaimAgentConfig {
21
25
  */
22
26
  export interface ReclaimConfig {
23
27
  version: 1;
28
+ mode?: DevtoolsMode;
24
29
  browser_agent?: ReclaimAgentConfig;
25
30
  session?: CachedSession;
26
31
  old_devtools?: OldIdentity;
27
32
  }
33
+ /** Which backend the MCP server targets. See `resolveOldMode` in consts.ts. */
34
+ export type DevtoolsMode = 'old' | 'builder';
28
35
  /**
29
36
  * Read/write the unified Reclaim config document. The file holds the
30
37
  * (short-lived) session bearer token, so it is always locked to `0600` and
package/lib/consts.d.ts CHANGED
@@ -36,6 +36,21 @@ export declare function reclaimHome(): string;
36
36
  * `USE_OLD_DEVTOOLS=false`; anything else keeps old mode on.
37
37
  */
38
38
  export declare function useOldDevtools(): boolean;
39
+ /**
40
+ * Effective mode, layering the persisted preference under the env var:
41
+ * explicit `USE_OLD_DEVTOOLS` wins → persisted config `mode` → default (old).
42
+ * The persisted value comes from `~/.reclaim/config.json` (set via the
43
+ * `set_devtools_mode` tool); the caller reads it so this module needn't import
44
+ * `ConfigStore` (which would create an import cycle).
45
+ */
46
+ export declare function resolveOldMode(persisted?: 'old' | 'builder'): boolean;
47
+ /**
48
+ * Where the effective mode came from — the same precedence as
49
+ * `resolveOldMode`: explicit `USE_OLD_DEVTOOLS` env var → persisted config
50
+ * `mode` → default (old). Surfaced by the `get_devtools_mode` tool so the
51
+ * user can tell why the server is in the mode it reports.
52
+ */
53
+ export declare function oldModeSource(persisted?: 'old' | 'builder'): 'env' | 'config' | 'default';
39
54
  /** `%LOCALAPPDATA%` on Windows, used to probe a per-user Chrome install. */
40
55
  export declare function localAppData(): string | undefined;
41
56
  /** Explicit Chrome/Edge/Chromium binary path override. */
package/lib/consts.js CHANGED
@@ -56,6 +56,41 @@ export function reclaimHome() {
56
56
  export function useOldDevtools() {
57
57
  return (process.env.USE_OLD_DEVTOOLS ?? '').trim().toLowerCase() !== 'false';
58
58
  }
59
+ /** True when `USE_OLD_DEVTOOLS` is set to a non-empty value (explicit). */
60
+ function oldDevtoolsEnvSet() {
61
+ return (process.env.USE_OLD_DEVTOOLS ?? '').trim() !== '';
62
+ }
63
+ /**
64
+ * Effective mode, layering the persisted preference under the env var:
65
+ * explicit `USE_OLD_DEVTOOLS` wins → persisted config `mode` → default (old).
66
+ * The persisted value comes from `~/.reclaim/config.json` (set via the
67
+ * `set_devtools_mode` tool); the caller reads it so this module needn't import
68
+ * `ConfigStore` (which would create an import cycle).
69
+ */
70
+ export function resolveOldMode(persisted) {
71
+ if (oldDevtoolsEnvSet()) {
72
+ return useOldDevtools();
73
+ }
74
+ if (persisted) {
75
+ return persisted === 'old';
76
+ }
77
+ return true;
78
+ }
79
+ /**
80
+ * Where the effective mode came from — the same precedence as
81
+ * `resolveOldMode`: explicit `USE_OLD_DEVTOOLS` env var → persisted config
82
+ * `mode` → default (old). Surfaced by the `get_devtools_mode` tool so the
83
+ * user can tell why the server is in the mode it reports.
84
+ */
85
+ export function oldModeSource(persisted) {
86
+ if (oldDevtoolsEnvSet()) {
87
+ return 'env';
88
+ }
89
+ if (persisted) {
90
+ return 'config';
91
+ }
92
+ return 'default';
93
+ }
59
94
  // ---------------------------------------------------------------------------
60
95
  // Chrome / CDP launcher.
61
96
  // ---------------------------------------------------------------------------
package/lib/index.js 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
  // SDK — re-export everything from @reclaimprotocol/client so consumers
4
4
  // only need one package for both the typed HTTP client and the agent tools.
5
5
  export * from '@reclaimprotocol/client';
@@ -23,10 +23,6 @@ export declare const MCP_TOOLS: {
23
23
  description: string;
24
24
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
25
25
  };
26
- CreateAttachSession: {
27
- description: string;
28
- inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
29
- };
30
26
  CreateCallbackSubscription: {
31
27
  description: string;
32
28
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
@@ -83,10 +79,6 @@ export declare const MCP_TOOLS: {
83
79
  description: string;
84
80
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
85
81
  };
86
- GetAttachSession: {
87
- description: string;
88
- inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
89
- };
90
82
  GetMe: {
91
83
  description: string;
92
84
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
@@ -103,10 +95,6 @@ export declare const MCP_TOOLS: {
103
95
  description: string;
104
96
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
105
97
  };
106
- GetOrgToken: {
107
- description: string;
108
- inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
109
- };
110
98
  GetProvider: {
111
99
  description: string;
112
100
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
@@ -143,6 +131,10 @@ export declare const MCP_TOOLS: {
143
131
  description: string;
144
132
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
145
133
  };
134
+ ListOrgTokens: {
135
+ description: string;
136
+ inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
137
+ };
146
138
  ListOrgVerificationSessions: {
147
139
  description: string;
148
140
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
@@ -179,6 +171,10 @@ export declare const MCP_TOOLS: {
179
171
  description: string;
180
172
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
181
173
  };
174
+ RevokeOrgToken: {
175
+ description: string;
176
+ inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
177
+ };
182
178
  SetOrgKeypair: {
183
179
  description: string;
184
180
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
@@ -195,10 +191,6 @@ export declare const MCP_TOOLS: {
195
191
  description: string;
196
192
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
197
193
  };
198
- UpdateOrgBilling: {
199
- description: string;
200
- inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
201
- };
202
194
  UpdateProvider: {
203
195
  description: string;
204
196
  inputSchema: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;