@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.
Files changed (50) 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 +8 -0
  6. package/lib/consts.js +20 -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/authenticate/authenticate.js +178 -93
  14. package/lib/mcp/tools/authenticate/eth-key.js +2 -3
  15. package/lib/mcp/tools/index.d.ts +1 -0
  16. package/lib/mcp/tools/index.js +1 -0
  17. package/lib/mcp/tools/mode/index.d.ts +1 -0
  18. package/lib/mcp/tools/mode/index.js +3 -0
  19. package/lib/mcp/tools/mode/mode.d.ts +16 -0
  20. package/lib/mcp/tools/mode/mode.js +49 -0
  21. package/lib/provider/to-version.js +4 -0
  22. package/lib/tools/registry.d.ts +6 -13
  23. package/lib/tools/registry.js +29 -0
  24. package/package.json +5 -8
  25. package/scripts/prepend-shebang.js +1 -1
  26. package/src/authoring/index.ts +1 -0
  27. package/src/authoring/util.ts +3 -0
  28. package/src/cdp/launcher.ts +1 -1
  29. package/src/config/store.ts +8 -0
  30. package/src/consts.ts +24 -0
  31. package/src/index.ts +1 -1
  32. package/src/mcp/api/operations.gen.ts +430 -487
  33. package/src/mcp/remap_errors.ts +8 -15
  34. package/src/mcp/start.ts +11 -2
  35. package/src/mcp/tools/agent/proof.ts +3 -3
  36. package/src/mcp/tools/authenticate/authenticate.ts +238 -108
  37. package/src/mcp/tools/authenticate/eth-key.ts +7 -5
  38. package/src/mcp/tools/index.ts +1 -0
  39. package/src/mcp/tools/mode/index.ts +3 -0
  40. package/src/mcp/tools/mode/mode.ts +58 -0
  41. package/src/proof/debug-response-dump.ts +1 -1
  42. package/src/proof/proof-core.ts +1 -1
  43. package/src/proof/zk-files.ts +2 -2
  44. package/src/provider/dom-xpath.ts +1 -1
  45. package/src/provider/draft.ts +3 -3
  46. package/src/provider/to-version.ts +4 -0
  47. package/src/tools/registry.ts +19 -0
  48. package/src/cli/args.ts +0 -20
  49. package/src/cli/commands.ts +0 -27
  50. package/src/cli.ts +0 -7
@@ -189,6 +189,10 @@ export function providerToCreateVersionRequest(
189
189
  ...providerToRequestSelection(req),
190
190
  multiple: req.multiple ?? true,
191
191
  required: req.required ?? true,
192
+ templateParamsMode: req.templateParamsMode ?? 'separate',
193
+ ...(req.templateParams?.length
194
+ ? { templateParams: req.templateParams }
195
+ : {}),
192
196
  }))
193
197
  const script = jsUserScripts?.trim()
194
198
 
@@ -11,6 +11,8 @@
11
11
  * glue (`registerToolList` onto an `McpServer`) stays in `mcp/server.ts`, which
12
12
  * re-exports this primitive for the MCP-side tool files.
13
13
  */
14
+ import { type Boom, isBoom } from '@hapi/boom'
15
+ import type { ProblemDetails } from '@reclaimprotocol/client'
14
16
  import type { JSONSchema } from 'zod/v4/core'
15
17
  import { toZod } from '../mcp/api/to-zod.ts'
16
18
 
@@ -51,6 +53,20 @@ export function defineTool<TArgs>(
51
53
  }
52
54
  }
53
55
 
56
+ /**
57
+ * Render a tool-handler error as the text every host shows the LLM.
58
+ * Boom errors carrying an RFC 9457 problem include its `detail`; anything
59
+ * else falls back to the plain message.
60
+ */
61
+ export function errorAsToolText(err: unknown): string {
62
+ if(isBoom(err) && err.output?.statusCode) {
63
+ const detail = (err as Boom<ProblemDetails>).data?.detail
64
+ return detail ? `${err.message}: ${detail}` : err.message
65
+ }
66
+
67
+ return err instanceof Error ? err.message : String(err)
68
+ }
69
+
54
70
  /**
55
71
  * Adapt a tool to a host by WIDENING its input schema — add properties, mark
56
72
  * some required, optionally override the description — without touching the
@@ -73,6 +89,9 @@ export function extendTool(
73
89
  ...(base.inputSchema.required ?? []),
74
90
  ...(extra.required ?? []),
75
91
  ]
92
+ // The merged `properties` spread carries the base's untyped property values,
93
+ // which don't structurally match ObjectSchema's strict per-property schema
94
+ // type — assert the merged shape.
76
95
  const inputSchema = {
77
96
  ...base.inputSchema,
78
97
  properties: {
package/src/cli/args.ts DELETED
@@ -1,20 +0,0 @@
1
- import { parseArgs as nodeParseArgs } from 'node:util'
2
-
3
- // Placeholder. Final shape decided once the backend openapi stabilises and
4
- // the CLI surface is fleshed out (see AGENTS.md → "CLI").
5
- export function parseCliArgs(argv: string[]) {
6
- return nodeParseArgs({
7
- args: argv,
8
- options: {
9
- 'base-url': { type: 'string' },
10
- token: { type: 'string' },
11
- param: { type: 'string', multiple: true },
12
- query: { type: 'string', multiple: true },
13
- body: { type: 'string' },
14
- help: { type: 'boolean', short: 'h' },
15
- version: { type: 'boolean', short: 'v' },
16
- },
17
- allowPositionals: true,
18
- strict: false,
19
- })
20
- }
@@ -1,27 +0,0 @@
1
- import { notImplemented } from '@hapi/boom'
2
- import { DESCRIPTION, NAME, VERSION } from '../pkg.ts'
3
- import { parseCliArgs } from './args.ts'
4
-
5
- // Entry point for the `reclaim` bin. Placeholder until backend openapi
6
- // finalises — `--version` and `--help` work; everything else throws.
7
- export async function run(argv: string[]) {
8
- const parsed = parseCliArgs(argv)
9
-
10
- if(parsed.values['version']) {
11
- process.stdout.write(`${NAME} ${VERSION}\n`)
12
- return
13
- }
14
-
15
- if(parsed.values['help']) {
16
- process.stdout.write(
17
- `${NAME} ${VERSION}\n${DESCRIPTION}\n\n` +
18
- 'Usage: reclaim call <OperationId> ' +
19
- '[--param k=v] [--query k=v] [--body <json>]\n',
20
- )
21
- return
22
- }
23
-
24
- throw notImplemented(
25
- 'reclaim CLI: pending @reclaimprotocol/app spec finalisation',
26
- )
27
- }
package/src/cli.ts DELETED
@@ -1,7 +0,0 @@
1
- import { run } from './cli/commands.ts'
2
- import { LOGGER } from './logger.ts'
3
-
4
- run(process.argv.slice(2)).catch((err) => {
5
- LOGGER.error({ err }, 'cli failed')
6
- process.exitCode = 1
7
- })