ronin-buyer 0.1.0
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/LICENSE +21 -0
- package/NOTICE +14 -0
- package/README.md +129 -0
- package/dist/agentkit.d.ts +10 -0
- package/dist/agentkit.js +23 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +21 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +13 -0
- package/dist/contract.d.ts +932 -0
- package/dist/contract.js +46 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +175 -0
- package/dist/langchain.d.ts +148 -0
- package/dist/langchain.js +6 -0
- package/dist/mcp.d.ts +70 -0
- package/dist/mcp.js +26 -0
- package/dist/openai.d.ts +42 -0
- package/dist/openai.js +11 -0
- package/dist/openclaw.d.ts +17 -0
- package/dist/openclaw.js +22 -0
- package/examples/buyer-module.mjs +9 -0
- package/openclaw.plugin.json +13 -0
- package/package.json +47 -0
- package/server.json +16 -0
- package/skills/ronin-web-research/SKILL.md +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RONIN ZERO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
RONIN buyer integration is a clean implementation of public protocol and framework contracts.
|
|
2
|
+
No Agent402 server, adapter source, identity, wallet, credentials or private state is included.
|
|
3
|
+
Agent402 is a trademark of its owner and is used only when identifying the external index.
|
|
4
|
+
The MIT license in this directory applies only to this integration package, not the RONIN seller repository.
|
|
5
|
+
Third-party dependencies retain their own licenses. @x402/core and @x402/evm implement the x402 protocol;
|
|
6
|
+
@modelcontextprotocol/sdk implements the MCP transport. Framework adapters use the public framework APIs.
|
|
7
|
+
|
|
8
|
+
Architecture references (accessed 2026-09-12):
|
|
9
|
+
https://github.com/MikeyPetrillo/Agent402
|
|
10
|
+
https://agent402.tools/docs/x402-Index-and-Router
|
|
11
|
+
https://github.com/coinbase/agentkit
|
|
12
|
+
https://modelcontextprotocol.io/docs/develop/build-server
|
|
13
|
+
https://docs.openclaw.ai/plugins/building-plugins
|
|
14
|
+
https://developers.openai.com/api/docs/guides/function-calling
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# RONIN Web Research — native buyer tool
|
|
2
|
+
|
|
3
|
+
Install `ronin_web_research` in a buyer agent to search the web, retrieve sources and verify research claims. The tool knows its production URL, handles x402 `402 → authorization → one retry`, and returns the full RONIN result plus receipt. **0.010000 USDC per call, on Base.** Installing this package is free; research calls are paid.
|
|
4
|
+
|
|
5
|
+
Production resource: `https://seller.agratys.website/machine-services/search-router`.
|
|
6
|
+
Network `eip155:8453`; canonical USDC `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`;
|
|
7
|
+
recipient `0xaD1dedD19cC97C54509F63B3ad03259de3Fb7D26`; atomic amount `10000`.
|
|
8
|
+
EIP-712 token domain: `USD Coin`, version `2`. A challenge advertising the ticker `USDC` as the domain name is rejected before signing; the actual Base token uses `USD Coin`.
|
|
9
|
+
|
|
10
|
+
## Install the versioned release
|
|
11
|
+
|
|
12
|
+
Node 20.18+ (use your OpenClaw host's required Node version for OpenClaw).
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install https://seller.agratys.website/integrations/ronin-buyer/ronin-buyer-0.1.0.tgz
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The same package supports SDK, MCP, AgentKit and the thin adapters below. A registry install (`npm install ronin-buyer`) is available only after npm publication; the versioned RONIN-hosted tarball is the direct distribution path. SHA-256: [sha256.txt](https://seller.agratys.website/integrations/ronin-buyer/sha256.txt).
|
|
19
|
+
|
|
20
|
+
## Buyer SDK: find / use / call
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { Ronin } from 'ronin-buyer';
|
|
24
|
+
import { signer } from './your-existing-wallet.js';
|
|
25
|
+
|
|
26
|
+
const ronin = new Ronin({ signer, maxTotalAtomicAmount: '10000' });
|
|
27
|
+
const matches = ronin.find('source verification'); // Local capability lookup, free.
|
|
28
|
+
const tool = ronin.use(matches[0].tool);
|
|
29
|
+
const result = await tool.call({ query: 'Find primary sources for this research question' });
|
|
30
|
+
console.log(result.data, result.receipt, result.paymentResponse);
|
|
31
|
+
// Equivalent: ronin.search({ task: '...' }) or ronin.call('ronin_web_research', { query: '...' }).
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Pass your existing `@x402/core` client as `{ x402Client }` instead of `{ signer }` if payment is already configured. The package does not load, persist, request or log private keys. The optional `fetch` setting is a **plain** HTTP transport for applications/tests, not an auto-paying fetch wrapper.
|
|
35
|
+
|
|
36
|
+
Input accepts `query`, `topic`, `task`, `claim`, `q`, `prompt`, `question`, `subject`, `text`, `keywords`, `search`; result-count aliases are `numResults`, `num_results`, `max_results`, `limit`, `count` (1–50). Production handles the search logic and supported metadata; the SDK validates and supplies a canonical query plus request ID. It never accepts an endpoint or payment recipient from a model.
|
|
37
|
+
|
|
38
|
+
The maximum per-call payment is fixed at `10000` atomic units. `maxPaymentAtomicAmount` can lower that ceiling, never raise it. The default total budget is one call; operators may set `maxTotalAtomicAmount` for a longer session. Budget reservations and request-ID deduplication last for this client process; use your wallet's durable policy for budgets across restarts or hosts. Paid timeouts/5xx keep their reservation. Do not blindly retry an ambiguous payment with a new ID.
|
|
39
|
+
|
|
40
|
+
## MCP-compatible agents
|
|
41
|
+
|
|
42
|
+
Configure your buyer's existing wallet in a trusted local module exporting `createRoninOptions()`; see [examples/buyer-module.mjs](examples/buyer-module.mjs). Set the **absolute local path**, not a private key, in `RONIN_BUYER_MODULE`.
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"mcpServers": {
|
|
47
|
+
"ronin": {
|
|
48
|
+
"command": "npx",
|
|
49
|
+
"args": ["--yes", "--package=https://seller.agratys.website/integrations/ronin-buyer/ronin-buyer-0.1.0.tgz", "ronin-mcp"],
|
|
50
|
+
"env": { "RONIN_BUYER_MODULE": "/absolute/path/to/buyer-module.mjs" }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use `npx.cmd` for Windows clients that require an executable command. CLI equivalent: `ronin-mcp --buyer-module /absolute/path/to/buyer-module.mjs`. The MCP tool is `ronin_web_research`; its description explains research and source-retrieval selection. `tools/list` works without a signer; paid calls then return `BUYER_SIGNER_REQUIRED`. Transport is local stdio; the public `tools.json` is metadata, not a remote MCP endpoint. The buyer retains wallet authority.
|
|
57
|
+
|
|
58
|
+
## Coinbase AgentKit
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
npm install @coinbase/agentkit@0.10.4
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
import { AgentKit } from '@coinbase/agentkit';
|
|
66
|
+
import { roninActionProvider } from 'ronin-buyer/agentkit';
|
|
67
|
+
import { walletProvider, signer } from './your-existing-wallet.js';
|
|
68
|
+
|
|
69
|
+
const kit = await AgentKit.from({
|
|
70
|
+
walletProvider,
|
|
71
|
+
actionProviders: [roninActionProvider({ signer, maxTotalAtomicAmount: '10000' })],
|
|
72
|
+
});
|
|
73
|
+
const actions = kit.getActions(); // ronin_search and ronin_about
|
|
74
|
+
// Supply these through your usual AgentKit framework binding.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Supports Base mainnet. The signer/x402 client comes from the buyer application; this provider does not mint a new wallet or request broad wallet permissions. No dynamic service registration is required. `ronin_about` is free.
|
|
78
|
+
|
|
79
|
+
## OpenClaw
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
curl -fSL -o ronin-buyer-0.1.0.tgz https://seller.agratys.website/integrations/ronin-buyer/ronin-buyer-0.1.0.tgz
|
|
83
|
+
openclaw plugins install npm-pack:./ronin-buyer-0.1.0.tgz
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Configure the enabled plugin and allow its optional paid tool in your existing OpenClaw configuration:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"plugins": { "entries": { "ronin-buyer": { "enabled": true, "config": { "buyerModule": "/absolute/path/to/buyer-module.mjs" } } } },
|
|
91
|
+
"tools": { "alsoAllow": ["ronin_web_research"] }
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The plugin bundles [ronin-web-research/SKILL.md](skills/ronin-web-research/SKILL.md): intent → installed tool → bounded payment → sources and receipt. Merge these fields with existing configuration. Restart/reload the gateway as required by your OpenClaw version, then inspect with `openclaw plugins inspect ronin-buyer --runtime --json`. Plugin registration is tested against the public registration contract; a full OpenClaw gateway is not installed in the build environment. Alternatively install the RONIN MCP server and use the same skill with that tool.
|
|
96
|
+
|
|
97
|
+
## OpenAI and LangChain
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import { roninOpenAITools } from 'ronin-buyer/openai';
|
|
101
|
+
const { tools, chatTools, execute } = roninOpenAITools(ronin);
|
|
102
|
+
// Responses API: tools. Chat Completions: chatTools.
|
|
103
|
+
// On function_call: await execute(call.name, JSON.parse(call.arguments));
|
|
104
|
+
// Return JSON.stringify(result) as function_call_output with the original call_id.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
npm install @langchain/core@1.2.11
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
import { roninLangChainTools } from 'ronin-buyer/langchain';
|
|
113
|
+
const tools = roninLangChainTools(ronin); // DynamicStructuredTool[]
|
|
114
|
+
// Pass tools to your LangChain agent/tool router.
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
No LLM calls, API keys or paid model dependencies are added by these adapters.
|
|
118
|
+
|
|
119
|
+
## Evidence and errors
|
|
120
|
+
|
|
121
|
+
Independent local tests exercise the real MCP client/stdio transport, AgentKit `getActions`, LangChain invocation, a deterministic intent router, an unfunded ephemeral signer and a loopback mock payment gate. They cryptographically verify the authorization. A separate Python test feeds the same SDK envelope through the unmodified production `resource + roninQuote` validator and stops at a mock facilitator. These tests are **not paid sales or live model-selection evidence**.
|
|
122
|
+
|
|
123
|
+
`BUYER_SIGNER_REQUIRED`, `BUYER_BUDGET_EXHAUSTED`, `PAYMENT_POLICY_REJECTED` and `RONIN_QUOTE_EXPIRED` stop before payment. `PAID_RESPONSE_UNKNOWN`, `PAID_REQUEST_FAILED` and `RECEIPT_MISSING_OR_UNCONFIRMED` retain the request ID; reconcile any `mayHavePaid` outcome before authorizing another call. HTTP receipt contents are returned as seller evidence; this SDK does not independently recognize seller revenue or perform blockchain reconciliation.
|
|
124
|
+
|
|
125
|
+
## Discovery and license
|
|
126
|
+
|
|
127
|
+
[x402 contract](https://seller.agratys.website/.well-known/x402), [OpenAPI](https://seller.agratys.website/openapi.json), [agents.json](https://seller.agratys.website/agents.json), [tool metadata](https://seller.agratys.website/integrations/ronin-buyer/tools.json). The production 402 also carries Bazaar metadata. `server.json` is the prepared official MCP Registry submission; it is not proof of registry publication.
|
|
128
|
+
|
|
129
|
+
MIT for this package. Clean implementation using the official x402 and MCP libraries; no Agent402 code or private state is included. See NOTICE for architecture references and third-party license boundaries.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionProvider, type Action, type Network, type WalletProvider } from '@coinbase/agentkit';
|
|
2
|
+
import { Ronin, type RoninOptions } from './index.js';
|
|
3
|
+
/** Native AgentKit provider; the caller supplies its existing scoped payment signer/client. */
|
|
4
|
+
export declare class RoninActionProvider extends ActionProvider {
|
|
5
|
+
readonly buyer: Ronin;
|
|
6
|
+
constructor(options?: RoninOptions | Ronin);
|
|
7
|
+
supportsNetwork(network: Network): boolean;
|
|
8
|
+
getActions(_walletProvider: WalletProvider): Action[];
|
|
9
|
+
}
|
|
10
|
+
export declare const roninActionProvider: (options?: RoninOptions | Ronin) => RoninActionProvider;
|
package/dist/agentkit.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ActionProvider } from '@coinbase/agentkit';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Ronin, DESCRIPTION, searchSchema } from './index.js';
|
|
4
|
+
/** Native AgentKit provider; the caller supplies its existing scoped payment signer/client. */
|
|
5
|
+
export class RoninActionProvider extends ActionProvider {
|
|
6
|
+
buyer;
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
super('ronin', []);
|
|
9
|
+
this.buyer = options instanceof Ronin ? options : new Ronin(options);
|
|
10
|
+
}
|
|
11
|
+
supportsNetwork(network) {
|
|
12
|
+
return network.protocolFamily === 'evm' && (network.chainId === '8453' || network.networkId === 'base-mainnet');
|
|
13
|
+
}
|
|
14
|
+
getActions(_walletProvider) {
|
|
15
|
+
return [
|
|
16
|
+
{ name: 'ronin_search', description: DESCRIPTION, schema: searchSchema,
|
|
17
|
+
invoke: async (args) => JSON.stringify(await this.buyer.search(args)) },
|
|
18
|
+
{ name: 'ronin_about', description: 'Get the installed RONIN search resource, exact Base USDC price and payment ceiling. Free; no network or payment.', schema: z.object({}).strict(),
|
|
19
|
+
invoke: async () => JSON.stringify(this.buyer.about()) },
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const roninActionProvider = (options = {}) => new RoninActionProvider(options);
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Ronin } from './index.js';
|
|
3
|
+
import { loadBuyerOptions } from './config.js';
|
|
4
|
+
import { serveStdio } from './mcp.js';
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
if (args.includes('--help')) {
|
|
7
|
+
console.log('ronin-mcp [--buyer-module /absolute/operator-owned/buyer.mjs]\nExports ronin_web_research over MCP stdio. The module exports createRoninOptions() returning an existing signer or x402Client and a bounded budget. Without it, discovery works and paid calls fail closed. No private key environment variable is supported.');
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
try {
|
|
11
|
+
if (args.length && (args.length !== 2 || args[0] !== '--buyer-module'))
|
|
12
|
+
throw new Error('INVALID_ARGUMENTS');
|
|
13
|
+
const options = await loadBuyerOptions(args[1] ?? process.env.RONIN_BUYER_MODULE);
|
|
14
|
+
await serveStdio(new Ronin(options));
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Never echo imported wallet configuration, raw signer errors or key material.
|
|
18
|
+
console.error('RONIN_MCP_START_FAILED: check the trusted buyer module; use --help.');
|
|
19
|
+
process.exitCode = 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/config.d.ts
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isAbsolute } from 'node:path';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
/** Operator-owned executable configuration; never populated from model tool arguments. */
|
|
4
|
+
export async function loadBuyerOptions(modulePath) {
|
|
5
|
+
if (!modulePath)
|
|
6
|
+
return {};
|
|
7
|
+
if (!isAbsolute(modulePath) || !/\.m?js$/i.test(modulePath))
|
|
8
|
+
throw new Error('BUYER_MODULE_MUST_BE_ABSOLUTE_LOCAL_JS');
|
|
9
|
+
const module = await import(pathToFileURL(modulePath).href);
|
|
10
|
+
if (typeof module.createRoninOptions !== 'function')
|
|
11
|
+
throw new Error('BUYER_MODULE_MUST_EXPORT_createRoninOptions');
|
|
12
|
+
return await module.createRoninOptions();
|
|
13
|
+
}
|