@reclaimprotocol/agent 0.1.15 → 0.1.17
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/lib/authoring/index.d.ts +1 -1
- package/lib/authoring/index.js +1 -1
- package/lib/authoring/util.js +3 -0
- package/lib/config/store.d.ts +7 -0
- package/lib/consts.d.ts +8 -0
- package/lib/consts.js +20 -0
- package/lib/index.js +1 -1
- package/lib/mcp/api/operations.gen.d.ts +8 -16
- package/lib/mcp/api/operations.gen.js +428 -479
- package/lib/mcp/remap_errors.js +7 -14
- package/lib/mcp/start.js +10 -3
- package/lib/mcp/tools/agent/proof.js +3 -3
- package/lib/mcp/tools/authenticate/authenticate.js +178 -93
- package/lib/mcp/tools/authenticate/eth-key.js +2 -3
- package/lib/mcp/tools/index.d.ts +1 -0
- package/lib/mcp/tools/index.js +1 -0
- package/lib/mcp/tools/mode/index.d.ts +1 -0
- package/lib/mcp/tools/mode/index.js +3 -0
- package/lib/mcp/tools/mode/mode.d.ts +16 -0
- package/lib/mcp/tools/mode/mode.js +49 -0
- package/lib/provider/to-version.js +4 -0
- package/lib/tools/registry.d.ts +6 -13
- package/lib/tools/registry.js +29 -0
- package/package.json +5 -8
- package/scripts/prepend-shebang.js +1 -1
- package/src/authoring/index.ts +1 -0
- package/src/authoring/util.ts +3 -0
- package/src/cdp/launcher.ts +1 -1
- package/src/config/store.ts +8 -0
- package/src/consts.ts +24 -0
- package/src/index.ts +1 -1
- package/src/mcp/api/operations.gen.ts +430 -487
- package/src/mcp/remap_errors.ts +8 -15
- package/src/mcp/start.ts +11 -2
- package/src/mcp/tools/agent/proof.ts +3 -3
- package/src/mcp/tools/authenticate/authenticate.ts +238 -108
- package/src/mcp/tools/authenticate/eth-key.ts +7 -5
- package/src/mcp/tools/index.ts +1 -0
- package/src/mcp/tools/mode/index.ts +3 -0
- package/src/mcp/tools/mode/mode.ts +58 -0
- package/src/proof/debug-response-dump.ts +1 -1
- package/src/proof/proof-core.ts +1 -1
- package/src/proof/zk-files.ts +2 -2
- package/src/provider/dom-xpath.ts +1 -1
- package/src/provider/draft.ts +3 -3
- package/src/provider/to-version.ts +4 -0
- package/src/tools/registry.ts +19 -0
- package/src/cli/args.ts +0 -20
- package/src/cli/commands.ts +0 -27
- package/src/cli.ts +0 -7
package/src/authoring/util.ts
CHANGED
|
@@ -21,6 +21,9 @@ export function objectSchema(
|
|
|
21
21
|
properties: Record<string, unknown>,
|
|
22
22
|
required?: string[],
|
|
23
23
|
): JSONSchema.ObjectSchema {
|
|
24
|
+
// `properties` is an untyped Record here (this is a literal shortener, not a
|
|
25
|
+
// schema validator), so it doesn't structurally match ObjectSchema's strict
|
|
26
|
+
// per-property schema type — assert the shape.
|
|
24
27
|
return {
|
|
25
28
|
type: 'object',
|
|
26
29
|
properties,
|
package/src/cdp/launcher.ts
CHANGED
|
@@ -113,7 +113,7 @@ export function launchChrome(opts: LaunchOptions): ChildProcess {
|
|
|
113
113
|
export async function waitForCdpReady(
|
|
114
114
|
port: number,
|
|
115
115
|
timeoutMs = 10_000,
|
|
116
|
-
)
|
|
116
|
+
) {
|
|
117
117
|
const deadline = Date.now() + timeoutMs
|
|
118
118
|
while(Date.now() < deadline) {
|
|
119
119
|
try {
|
package/src/config/store.ts
CHANGED
|
@@ -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,30 @@ 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
|
+
|
|
75
99
|
// ---------------------------------------------------------------------------
|
|
76
100
|
// Chrome / CDP launcher.
|
|
77
101
|
// ---------------------------------------------------------------------------
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Package entry — SDK re-exports + agent public API.
|
|
2
|
-
// The
|
|
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.
|