stuntman 0.2.3 → 0.2.5
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/README.md +37 -3
- package/dist/agentkit.js +67 -0
- package/dist/attesta.js +604 -0
- package/dist/bull.js +98 -0
- package/dist/cli.js +97 -11
- package/dist/engine.js +29 -6
- package/dist/langchain.js +23 -0
- package/dist/openai.js +24 -0
- package/dist/peer.js +23 -0
- package/dist/practice.js +55 -0
- package/dist/proxy.js +41 -1
- package/dist/record-page.js +215 -0
- package/dist/record-template.js +2 -0
- package/dist/version.js +3 -1
- package/dist/witness.js +73 -1
- package/package.json +27 -4
- package/skills/stuntman/SKILL.md +67 -0
package/README.md
CHANGED
|
@@ -95,6 +95,8 @@ npx stuntman fund 0xTokenAddress 500
|
|
|
95
95
|
|
|
96
96
|
## Agent frameworks
|
|
97
97
|
|
|
98
|
+
Clone-and-run examples for each framework, plus plain Python, are in [`examples/`](examples).
|
|
99
|
+
|
|
98
100
|
### Virtuals GAME
|
|
99
101
|
|
|
100
102
|
Virtuals GAME agents practice two ways. Agents whose plugins send their own transactions: sign the agent wallet up with `stuntman witness --key-env WALLET_PRIVATE_KEY` and point the plugin's `RPC_PROVIDER_URL` at the endpoint it prints. TypeScript GAME agents can also add Stuntman as a worker:
|
|
@@ -113,17 +115,49 @@ import { stuntmanPlugin } from 'stuntman/eliza'; // npm install stuntman
|
|
|
113
115
|
// character: plugins: [stuntmanPlugin], settings: { secrets: { STUNTMAN_ENDPOINT: '...' } }
|
|
114
116
|
```
|
|
115
117
|
|
|
118
|
+
### Coinbase AgentKit
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import { stuntmanWalletProvider, stuntmanActionProvider } from 'stuntman/agentkit'; // npm install stuntman @coinbase/agentkit
|
|
122
|
+
const agentkit = await AgentKit.from({
|
|
123
|
+
walletProvider: await stuntmanWalletProvider({ privateKey: process.env.AGENT_KEY, endpoint }),
|
|
124
|
+
actionProviders: [await stuntmanActionProvider({ endpoint }), walletActionProvider(), erc20ActionProvider()],
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The wallet provider is AgentKit's viem wallet on Robinhood Chain, pointed at a Stuntman endpoint: AgentKit transactions are practiced, never broadcast. `stuntman connect agentkit` prints the setup.
|
|
129
|
+
|
|
130
|
+
### OpenAI Agents SDK
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { stuntmanTools, PRACTICE_INSTRUCTIONS } from 'stuntman/openai'; // npm install stuntman @openai/agents zod
|
|
134
|
+
const agent = new Agent({ name: 'Trader', instructions: PRACTICE_INSTRUCTIONS, tools: await stuntmanTools({ endpoint }) });
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### LangChain and LangGraph
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import { stuntmanTools, PRACTICE_INSTRUCTIONS } from 'stuntman/langchain'; // npm install stuntman langchain @langchain/core
|
|
141
|
+
const agent = createAgent({ model: 'openai:gpt-5', systemPrompt: PRACTICE_INSTRUCTIONS, tools: await stuntmanTools({ endpoint }) });
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Standard LangChain tools, so they also work in LangGraph's `ToolNode`.
|
|
145
|
+
|
|
116
146
|
### Priors
|
|
117
147
|
|
|
118
148
|
Point Priors' MCP server at a Stuntman endpoint and its on-chain transactions (borrows, stock trades) are practiced, never broadcast. Keep `PRIORS_MAX_SPEND_USD=0` while practicing: `pay_url` pays over HTTPS, outside any RPC. Repaying a practice loan isn't carried forward yet. `stuntman connect priors` prints the setup, and every Stuntman record also shows the agent's Priors credit record.
|
|
119
149
|
|
|
120
150
|
### OpenClaw
|
|
121
151
|
|
|
122
|
-
|
|
152
|
+
`npx stuntman connect openclaw --install` copies the Stuntman skill into `~/.openclaw/skills/stuntman` (pass `--dir` for another skills folder). The skill's source is in `skills/stuntman`.
|
|
153
|
+
|
|
154
|
+
## Attesta GPU rentals
|
|
155
|
+
|
|
156
|
+
Attesta rents GPUs to agents, paid in USDG through Bull streams. Point the agent's Attesta base URL at `http://127.0.0.1:8545/attesta` (or `<witness endpoint>/attesta`) and its RPC at Stuntman. Catalog and quotes come from Attesta; sign-in, previews, launches and the Bull payments are practiced, and nothing reaches Attesta or the chain. Sending the same stream twice is refused, and closing early returns unvested practice USDG. `stuntman connect attesta` prints the setup.
|
|
123
157
|
|
|
124
158
|
## Witnessed practice
|
|
125
159
|
|
|
126
|
-
Practice on your own machine is private, so nobody else can trust it. `stuntman witness` moves your agent's takes to Stuntman's server: each one is simulated at the latest block, signed by the witness and added to a public record at `stuntmanhq.xyz/a/<address>`. Takes are only ever added, never removed.
|
|
160
|
+
Every agent's first 25 witnessed takes are free. Practice on your own machine is private, so nobody else can trust it. `stuntman witness` moves your agent's takes to Stuntman's server: each one is simulated at the latest block, signed by the witness and added to a public record at `stuntmanhq.xyz/a/<address>`. Takes are only ever added, never removed.
|
|
127
161
|
|
|
128
162
|
```bash
|
|
129
163
|
stuntman witness # sign up the practice account; the MCP tools switch over
|
|
@@ -139,7 +173,7 @@ Agents that send their own transactions use the printed endpoint as their RPC ad
|
|
|
139
173
|
stuntman init --address <wallet> | --new [--rpc <url>] [--eth <amount>]
|
|
140
174
|
stuntman mcp MCP server over stdio
|
|
141
175
|
stuntman rpc [--port 8545] Practice RPC
|
|
142
|
-
stuntman connect [claude|codex|json|raxol|virtuals|eliza|openclaw|priors]
|
|
176
|
+
stuntman connect [claude|codex|json|raxol|virtuals|eliza|agentkit|openai|langchain|attesta|openclaw|priors]
|
|
143
177
|
stuntman takes [--limit 20] [--json]
|
|
144
178
|
stuntman take <id> [--json]
|
|
145
179
|
stuntman balances [token ...]
|
package/dist/agentkit.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Stuntman for Coinbase AgentKit.
|
|
2
|
+
//
|
|
3
|
+
// import { AgentKit } from '@coinbase/agentkit';
|
|
4
|
+
// import { stuntmanWalletProvider, stuntmanActionProvider } from 'stuntman/agentkit';
|
|
5
|
+
//
|
|
6
|
+
// const agentkit = await AgentKit.from({
|
|
7
|
+
// walletProvider: await stuntmanWalletProvider({ privateKey: process.env.AGENT_KEY, endpoint: process.env.STUNTMAN_ENDPOINT }),
|
|
8
|
+
// actionProviders: [await stuntmanActionProvider({ endpoint: process.env.STUNTMAN_ENDPOINT }), ...yourOtherProviders],
|
|
9
|
+
// });
|
|
10
|
+
//
|
|
11
|
+
// The wallet provider is AgentKit's own viem wallet on Robinhood Chain, pointed
|
|
12
|
+
// at a Stuntman endpoint: every action that sends a transaction is played out
|
|
13
|
+
// at the latest block with practice money and never broadcast. The action
|
|
14
|
+
// provider adds practice balances, takes, status and practice money. With a
|
|
15
|
+
// witness endpoint, every take is also kept on the agent's public record.
|
|
16
|
+
import { createRequire } from 'node:module';
|
|
17
|
+
import { createWalletClient, defineChain, http } from 'viem';
|
|
18
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
19
|
+
import { DEFAULT_CHAIN_ID } from './config.js';
|
|
20
|
+
import { practiceTools } from './practice.js';
|
|
21
|
+
const requireHere = createRequire(import.meta.url);
|
|
22
|
+
async function loadAgentKit() {
|
|
23
|
+
let path;
|
|
24
|
+
try {
|
|
25
|
+
path = requireHere.resolve('@coinbase/agentkit');
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
throw new Error('stuntman/agentkit needs Coinbase AgentKit. Install it with: npm install @coinbase/agentkit');
|
|
29
|
+
}
|
|
30
|
+
const ak = requireHere(path);
|
|
31
|
+
// AgentKit turns action schemas into tool definitions with its own zod, so
|
|
32
|
+
// the schemas must come from that same copy.
|
|
33
|
+
const z = createRequire(path)('zod');
|
|
34
|
+
return { ak, z };
|
|
35
|
+
}
|
|
36
|
+
const DEFAULT_ENDPOINT = 'http://127.0.0.1:8545';
|
|
37
|
+
function robinhoodChain(endpoint) {
|
|
38
|
+
return defineChain({
|
|
39
|
+
id: DEFAULT_CHAIN_ID,
|
|
40
|
+
name: 'Robinhood Chain',
|
|
41
|
+
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
|
|
42
|
+
rpcUrls: { default: { http: [endpoint] } },
|
|
43
|
+
blockExplorers: { default: { name: 'Blockscout', url: 'https://robinhoodchain.blockscout.com' } },
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** AgentKit's viem wallet on Robinhood Chain, practicing through Stuntman. */
|
|
47
|
+
export async function stuntmanWalletProvider(options) {
|
|
48
|
+
const endpoint = options.endpoint ?? process.env.STUNTMAN_ENDPOINT ?? DEFAULT_ENDPOINT;
|
|
49
|
+
const key = String(options.privateKey ?? '').trim();
|
|
50
|
+
if (!/^(0x)?[0-9a-fA-F]{64}$/.test(key))
|
|
51
|
+
throw new Error('stuntmanWalletProvider needs the agent wallet private key (64 hex characters).');
|
|
52
|
+
const { ak } = await loadAgentKit();
|
|
53
|
+
const walletClient = createWalletClient({
|
|
54
|
+
account: privateKeyToAccount((key.startsWith('0x') ? key : `0x${key}`)),
|
|
55
|
+
chain: robinhoodChain(endpoint),
|
|
56
|
+
transport: http(endpoint),
|
|
57
|
+
});
|
|
58
|
+
// rpcUrl points AgentKit's receipt and balance reads at Stuntman too, so it
|
|
59
|
+
// sees practice transactions and practice balances.
|
|
60
|
+
return new ak.ViemWalletProvider(walletClient, { rpcUrl: endpoint });
|
|
61
|
+
}
|
|
62
|
+
/** Practice actions for an AgentKit agent. */
|
|
63
|
+
export async function stuntmanActionProvider(options = {}) {
|
|
64
|
+
const endpoint = options.endpoint ?? process.env.STUNTMAN_ENDPOINT ?? DEFAULT_ENDPOINT;
|
|
65
|
+
const { ak, z } = await loadAgentKit();
|
|
66
|
+
return ak.customActionProvider(practiceTools(endpoint, z).map((t) => ({ name: t.name, description: t.description, schema: t.schema, invoke: t.run })));
|
|
67
|
+
}
|