cornerstone-autonomous-agent 1.2.0 → 2.0.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/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # Autonomous Agent – x402 MCP + LangChain.js
2
2
 
3
- Autonomous AI agent for **x402-paid MCP tools**: predict tickers, backtest strategies, open bank accounts. Pays with **Aptos** or **EVM** via the x402 facilitator—no OpenAI key; uses **Hugging Face** for the LLM. Built for Cursor, OpenClaw/Moltbot, and headless runs.
3
+ **Published as [cornerstone-autonomous-agent](https://www.npmjs.com/package/cornerstone-autonomous-agent)** on npm; **source: [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent)**.
4
+
5
+ Autonomous AI agent for **x402-paid MCP tools**: predict tickers, backtest strategies, link bank accounts, and query agent/borrower scores. Pays with **Aptos** or **EVM** via the x402 facilitator—no OpenAI key; uses **Hugging Face** for the LLM. Built for Cursor, OpenClaw/Moltbot, and headless runs.
4
6
 
5
7
  ## Why?
6
8
 
7
- Most agent demos need a full backend and separate API keys. This agent talks to an **x402 MCP server**, pays with its own Aptos and EVM wallets (verify → settle), and uses an OpenAI-compatible LLM (e.g. Hugging Face). You get **run_prediction**, **run_backtest**, **link_bank_account**, and score tools with minimal setup—whitelist your agent, fund wallets, run.
9
+ Most agent demos need a full backend and separate API keys. This agent talks to an **x402 MCP server**, pays with its own Aptos and EVM wallets (verify → settle), and uses an OpenAI-compatible LLM (e.g. Hugging Face). You get **run_prediction**, **run_backtest**, **link_bank_account**, and **score tools** (get_agent_reputation_score, get_borrower_score, by-email variants) with minimal setup—whitelist your agent, fund wallets, run. The server offers both Aptos and EVM payment options; the agent pays with whichever you prefer or have funded.
8
10
 
9
11
  ## Install
10
12
 
@@ -23,108 +25,110 @@ git clone https://github.com/FinTechTonic/autonomous-agent.git && cd autonomous-
23
25
  npm install
24
26
  ```
25
27
 
26
- **OpenClaw / MoltBook / Moltbot:** Load the skill from `skills/autonomous-agent/` or [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md). See [MoltBook / OpenClaw](#moltbook--openclaw) below. Then point `MCP_SERVER_URL` at your MCP server.
28
+ **OpenClaw / Moltbot:** See [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md) or use your platform’s skill install (e.g. ClawHub). Then point `MCP_SERVER_URL` at your MCP server.
27
29
 
28
30
  ## Quick Start
29
31
 
30
- From the repo root (or with the package installed):
32
+ **Important:** Another npm package is named [autonomous](https://www.npmjs.com/package/autonomous). To run **this** package without installing, always use the full name: **`npx cornerstone-autonomous-agent`**. After you `npm install cornerstone-autonomous-agent`, the short binary `autonomous` in that project runs this CLI.
31
33
 
32
34
  ```bash
33
- # Generate Aptos wallet (for prediction/backtest)
34
- npm run setup:aptos
35
-
36
- # Generate EVM wallet (for link_bank_account)
37
- npm run setup
38
-
39
- # Show addresses for whitelisting at the onboarding flow (e.g. https://borrower.replit.app/flow.html)
40
- npm run addresses
35
+ # Run without installing (use full package name so the other "autonomous" package isn’t used)
36
+ npx cornerstone-autonomous-agent setup:aptos
37
+ npx cornerstone-autonomous-agent setup
38
+ npx cornerstone-autonomous-agent addresses
39
+ npx cornerstone-autonomous-agent attest:aptos
40
+ npx cornerstone-autonomous-agent "Run a 30-day prediction for AAPL"
41
+
42
+ # Or install first, then you can use the short command in that project
43
+ npm install cornerstone-autonomous-agent
44
+ npx autonomous setup:aptos
45
+ npx autonomous attest:aptos
41
46
 
42
- # (Optional) Sign wallet attestations for onboarding (POST /attest/aptos, /attest/evm)
43
- npx cornerstone-agent-attest-aptos
44
- npx cornerstone-agent-attest-evm
45
- # or from repo: npm run attest:aptos && npm run attest:evm
47
+ # Or install globally for the short command everywhere
48
+ npm i -g cornerstone-autonomous-agent
49
+ autonomous setup:aptos
50
+ autonomous "Run a 30-day prediction for AAPL"
46
51
 
47
- # Run the agent (demo: balance + AAPL prediction)
48
- npx cornerstone-agent "Run a 30-day prediction for AAPL"
49
- # or from repo: npm run agent -- "Run a 30-day prediction for AAPL"
52
+ # From source:
53
+ node src/setup-aptos.js
54
+ node src/run-agent.js "Run a 30-day prediction for AAPL"
50
55
  ```
51
56
 
57
+ **CLI:** This package registers the **`autonomous`** binary (short name) and **`cornerstone-autonomous-agent`** (matches package name). Use **`npx cornerstone-autonomous-agent <command>`** when you haven’t installed the package; use **`npx autonomous <command>`** only inside a project that has `cornerstone-autonomous-agent` installed, or **`autonomous <command>`** after a global install.
58
+
52
59
  ## Config
53
60
 
54
61
  Copy `.env.example` to `.env` and set:
55
62
 
56
63
  | Variable | Description |
57
64
  |----------|-------------|
58
- | `MCP_SERVER_URL` | x402 MCP server base URL (e.g. https://borrower.replit.app or http://localhost:4023) |
59
- | `X402_FACILITATOR_URL` | Facilitator base URL for Aptos (verify/settle). Use public (e.g. https://x402-navy.vercel.app/facilitator) for link_bank_account. |
60
- | `X402_EVM_FACILITATOR_URL` | Optional. EVM facilitator; defaults to X402_FACILITATOR_URL. Set to public when using local Aptos facilitator. |
65
+ | `MCP_SERVER_URL` | x402 MCP server base URL (e.g. http://localhost:4023 or https://3001-borrower.replit.app) |
66
+ | `X402_FACILITATOR_URL` | Facilitator base URL (Aptos + EVM verify/settle). Use public (e.g. https://x402-navy.vercel.app/facilitator) for full demo. |
67
+ | `X402_EVM_FACILITATOR_URL` | Optional. EVM facilitator; defaults to X402_FACILITATOR_URL. |
68
+ | `PREFERRED_PAYMENT_ORDER` | Optional. Comma-separated `network|asset` (e.g. `aptos:2|usdc,eip155:84532|usdc`) to choose payment option when server returns multiple. |
61
69
  | `LLM_BASE_URL` | OpenAI-compatible base URL (default https://router.huggingface.co/v1) |
62
70
  | `HUGGINGFACE_API_KEY` or `HF_TOKEN` | Hugging Face API key |
63
71
  | `LLM_MODEL` | Model ID (e.g. meta-llama/Llama-3.2-3B-Instruct) |
64
72
  | `APTOS_WALLET_PATH` | Aptos wallet JSON path. Multi-wallet: ~/.aptos-agent-wallets.json. |
65
73
  | `EVM_WALLET_PATH` | EVM wallet path. Multi-wallet: ~/.evm-wallets.json. Or set EVM_PRIVATE_KEY. |
66
- | `BASE_SEPOLIA_RPC` | Optional; Base Sepolia RPC for link_bank_account |
74
+ | `BASE_SEPOLIA_RPC` | Optional; Base Sepolia RPC. Agent supports all EVM chains in lib/chains.js (Base, Ethereum, Polygon, etc.). |
67
75
 
68
76
  ## Commands
69
77
 
70
- Prefer **npx** when the package is installed; from repo root use **npm run** or **node src/...**.
78
+ Use **`npx cornerstone-autonomous-agent <command>`** (or, in a project that has this package installed, **`npx autonomous <command>`**). From source: `node src/<script>.js` or `npm run <script>`.
71
79
 
72
80
  | Command | Description |
73
81
  |---------|-------------|
74
- | `npm run setup` | Generate EVM wallet (single; for multi use agent tool `create_evm_wallet`) |
75
- | `npm run setup:aptos` | Generate Aptos wallet (single; for multi use `create_aptos_wallet`) |
76
- | `npm run addresses` | Print all Aptos and EVM addresses for whitelisting at flow.html |
82
+ | `autonomous setup` | Generate EVM wallet (single; for multi use agent tool create_evm_wallet) |
83
+ | `autonomous setup:aptos` | Generate Aptos wallet (single; for multi use create_aptos_wallet) |
84
+ | `autonomous setup:evm:multichain` | Generate EVM multi-chain wallet |
85
+ | `autonomous addresses` | Print all Aptos and EVM addresses for whitelisting at flow.html |
86
+ | `autonomous attest:aptos` | Sign attestation for Aptos wallet (set `APTOS_PRIVATE_KEY` or `APTOS_TESTNET_*`); submit to POST /attest/aptos |
87
+ | `autonomous attest:evm` | Sign attestation for EVM wallet; submit to POST /attest/evm |
88
+ | `autonomous balance [chain]` | EVM balance |
89
+ | `autonomous transfer` | Transfer (see script for args) |
90
+ | `autonomous contract` | Contract interaction helper |
91
+ | `autonomous swap` | Swap helper |
92
+ | `autonomous` or `autonomous agent` or `autonomous start [message]` | Run agent (default: demo balance + prediction) |
77
93
  | `npm run credit:aptos` | Credit Aptos agent (devnet: programmatic; testnet: instructions) |
78
- | `npm run balance -- <chain>` | EVM balance (e.g. `baseSepolia`) |
79
- | **`npx cornerstone-agent [message]`** | Run agent (or `npm run agent -- [message]` from repo) |
80
- | `npm run attest:aptos` | Sign Aptos wallet attestation for onboarding POST /attest/aptos |
81
- | `npm run attest:evm` | Sign EVM wallet attestation for onboarding POST /attest/evm |
82
- | `npx cornerstone-agent-attest-aptos` | Same as attest:aptos (when package installed) |
83
- | `npx cornerstone-agent-attest-evm` | Same as attest:evm (when package installed) |
94
+ | `npx cornerstone-agent [message]` | Run agent (legacy bin name) |
84
95
 
85
96
  **Crediting Aptos:** Testnet has no programmatic faucet—use [Aptos testnet faucet](https://aptos.dev/network/faucet). Devnet: `APTOS_FAUCET_NETWORK=devnet npm run credit:aptos`. See [Canteen – Aptos x402](https://canteenapp-aptos-x402.notion.site/).
86
97
 
87
98
  ## MCP Tools
88
99
 
89
- All tools are exposed at the MCP server path `/mcp`. Paid tools follow the x402 flow: call without `payment_payload` → 402 + `paymentRequirements` → sign payment → call again with `payment_payload` → facilitator verify/settle → result + `paymentReceipt`. See [MCP_INTEGRATION_REFERENCE.md](MCP_INTEGRATION_REFERENCE.md).
90
-
91
- | Tool | Resource | Description | Cost (USD) |
92
- |------|----------|-------------|-----------|
93
- | `run_prediction` | `/mcp/prediction/{symbol}` | Stock prediction (symbol, horizon) | ~0.06 (Aptos/EVM) |
94
- | `run_backtest` | `/mcp/backtest/{symbol}` | Backtest trading strategy (symbol, start/end, strategy) | ~0.06 |
95
- | `link_bank_account` | `/mcp/banking/link` | CornerStone/Plaid bank link token | ~0.05 (configurable) |
96
- | `get_agent_reputation_score` | `/mcp/scores/reputation` | Agent reputation (100 when allowlisted); x402 or lender credits | ~0.06 |
97
- | `get_borrower_score` | `/mcp/scores/borrower` | Borrower score (100 or 100+Plaid when bank linked); x402 or lender credits | ~0.06 |
98
- | `get_agent_reputation_score_by_email` | `/mcp/scores/reputation-by-email` | Reputation by email (requires `SCORE_BY_EMAIL_ENABLED=1`) | base + extra |
99
- | `get_borrower_score_by_email` | `/mcp/scores/borrower-by-email` | Borrower score by email (requires `SCORE_BY_EMAIL_ENABLED=1`) | base + extra |
100
-
101
- ## Wallet attestation (signing)
100
+ | Tool | Description | Payment |
101
+ |------|-------------|---------|
102
+ | `run_prediction` | Stock prediction (symbol, horizon) | x402: Aptos or EVM |
103
+ | `run_backtest` | Backtest trading strategy | x402: Aptos or EVM |
104
+ | `link_bank_account` | CornerStone bank link (Plaid) | x402: Aptos or EVM |
105
+ | `get_agent_reputation_score` | Agent reputation score (allowlisted wallet) | x402 or lender credits |
106
+ | `get_borrower_score` | Borrower score (100 or 100+X when bank linked) | x402 or lender credits |
107
+ | `get_agent_reputation_score_by_email` | Reputation score by email (resolves to agent) | x402 or lender credits |
108
+ | `get_borrower_score_by_email` | Borrower score by email | x402 or lender credits |
102
109
 
103
- To prove ownership of agent wallets during onboarding, use the **attestation** scripts. They sign an off-chain message; submit the JSON output to the onboarding server (`POST /attest/aptos`, `POST /attest/evm`).
104
-
105
- - **Aptos:** `npm run attest:aptos` or `npx cornerstone-agent-attest-aptos` — outputs `address`, `message`, `signature` (hex), `public_key_hex`.
106
- - **EVM:** `npm run attest:evm` or `npx cornerstone-agent-attest-evm` — outputs `address`, `message`, `signature`.
107
-
108
- Options: `--address 0x...` to attest a specific address, `--message "Custom message"` for a custom payload.
110
+ All paid tools accept **both Aptos and EVM**; the server returns 402 with multiple options. Use `PREFERRED_PAYMENT_ORDER` to prefer one chain/asset.
109
111
 
110
112
  ## Supported Networks
111
113
 
112
- | Network | Use | Cost |
113
- |---------|-----|------|
114
- | Aptos testnet | run_prediction, run_backtest | ~6¢ USDC |
115
- | Base Sepolia | link_bank_account (testnet) | ~$3.65 |
116
- | Base (mainnet) | link_bank_account (production) | ~$3.65 |
114
+ | Network | Use |
115
+ |---------|-----|
116
+ | Aptos testnet (aptos:2) / mainnet (aptos:1) | run_prediction, run_backtest, score tools |
117
+ | Base Sepolia (eip155:84532), Base (eip155:8453), Ethereum, Polygon, Arbitrum, Optimism | link_bank_account, score tools (when server offers them) |
117
118
 
118
119
  ## x402 Flow
119
120
 
120
121
  ```
121
- Agent calls MCP tool (no payment_payload)
122
- → Server returns 402 + paymentRequirements (network, amount, asset, payTo, ...)
123
- → Agent signs payment, calls facilitator /verify then /settle
124
- → Agent retries tool call with payment_payload
125
- Server returns result + paymentReceipt
122
+ Agent calls MCP tool
123
+ → Server returns 402 + payment requirements (single or array of options: USDC, APT, native ETH)
124
+ → Agent picks one option (by preferredPaymentOrder or first), builds payload (Aptos or EVM)
125
+ → Agent calls facilitator /verify then /settle
126
+ Agent retries request with payment_payload
127
+ → Server returns result + payment_receipt
126
128
  ```
127
129
 
130
+ **Multi-asset:** The server may return multiple `paymentRequirements` (e.g. USDC on Aptos, USDC on EVM, APT on Aptos, native ETH on EVM). The client uses `preferredPaymentOrder` (e.g. `["aptos:2|usdc", "eip155:84532|native"]`) to choose, or the first option. Native ETH: client submits the ETH transfer, then sends the `txHash` in the payload; facilitator verifies on-chain.
131
+
128
132
  ## Architecture
129
133
 
130
134
  ```
@@ -136,15 +140,12 @@ autonomous/
136
140
  │ │ ├── aptos/ # Aptos wallet, balance, signPayment
137
141
  │ │ ├── evm/ # EVM wallet, signPayment (Base)
138
142
  │ │ └── x402/ # Payment types, verify/settle flow
139
- │ ├── run-agent.js # Entrypoint (npx cornerstone-agent)
143
+ │ ├── cli.js # CLI router (autonomous / cornerstone-autonomous-agent)
144
+ │ ├── run-agent.js # Agent entrypoint
140
145
  │ ├── setup.js # EVM wallet generation
141
146
  │ ├── setup-aptos.js # Aptos wallet generation
142
- │ ├── show-agent-addresses.js
143
- ├── attest-aptos-wallet.js # Sign attestation for POST /attest/aptos
144
- │ └── attest-evm-wallet.js # Sign attestation for POST /attest/evm
145
- ├── skills/ # MoltBook/OpenClaw (AgentSkills layout)
146
- │ └── autonomous-agent/
147
- │ └── SKILL.md
147
+ │ ├── attest-aptos-wallet.js / attest-evm-wallet.js
148
+ └── show-agent-addresses.js
148
149
  ├── adapters/ # OpenClaw, OpenAI, Anthropic, local
149
150
  ├── .env.example
150
151
  └── package.json
@@ -169,51 +170,25 @@ autonomous/
169
170
  ## Capability + adapters
170
171
 
171
172
  - **Capability:** Core (`src/`) — MCP client, x402 flow, local tools. No OpenAI/Claw/Anthropic logic in code.
172
- - **Adapters:** How each platform uses the capability:
173
- - **MoltBook / OpenClaw / Moltbot:** `skills/autonomous-agent/SKILL.md` (AgentSkills-compatible; [see below](#moltbook--openclaw)) or [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md)
174
- - **OpenAI:** [adapters/openai/openapi.yaml](adapters/openai/openapi.yaml) — Custom GPTs / Assistants
175
- - **Claude / Anthropic:** [adapters/anthropic/tools.json](adapters/anthropic/tools.json) — Claude tools
176
- - **Local / OSS:** [adapters/local/README.md](adapters/local/README.md) — LM Studio, AutoGen, CrewAI
177
-
178
- ## MoltBook / OpenClaw
179
-
180
- This repo is optimized for **easy skill loading** in MoltBook and OpenClaw (Claude, Anthropic, OpenAI, and other providers work via the same agent; the skill tells the assistant how to run it).
181
-
182
- - **Skill layout:** The skill lives in `skills/autonomous-agent/SKILL.md` (AgentSkills-compatible, single-line frontmatter, `metadata.openclaw` gating). OpenClaw/MoltBook loads skills from `skills/` subfolders.
183
- - **Load options:**
184
- 1. **extraDirs:** Add this repo path to `~/.openclaw/openclaw.json` under `skills.load.extraDirs`. OpenClaw will scan `skills/` and load `autonomous-agent`.
185
- 2. **Workspace:** Clone the repo and use it as your OpenClaw workspace; workspace skills are loaded from `<workspace>/skills`.
186
- 3. **Managed skills:** Copy `skills/autonomous-agent` to `~/.openclaw/skills/` for all agents on the machine.
187
- 4. **ClawHub:** When published, install with `clawhub install autonomous-agent` (installs into `./skills` by default).
188
- - **Config:** In `skills.entries["autonomous-agent"]` you can set `enabled`, `env`, or `apiKey` (maps to `primaryEnv`). Ensure `MCP_SERVER_URL`, x402 facilitator URLs, and LLM/env are set for the agent run.
189
- - **Run:** From the **repository root** (parent of `skills/`), run `npx cornerstone-agent "your message"` or `npm run agent -- "your message"`.
190
-
191
- Example `~/.openclaw/openclaw.json` to load this repo’s skills:
192
-
193
- ```json
194
- {
195
- "skills": {
196
- "load": {
197
- "extraDirs": ["/path/to/autonomous-agent"]
198
- },
199
- "entries": {
200
- "autonomous-agent": {
201
- "enabled": true,
202
- "env": { "MCP_SERVER_URL": "https://borrower.replit.app" }
203
- }
204
- }
205
- }
206
- }
207
- ```
173
+ - **Adapters:** `adapters/` — how each platform uses the capability:
174
+ - [adapters/openclaw/SKILL.md](adapters/openclaw/SKILL.md) — OpenClaw / Moltbot
175
+ - [adapters/openai/openapi.yaml](adapters/openai/openapi.yaml) — Custom GPTs / Assistants
176
+ - [adapters/anthropic/tools.json](adapters/anthropic/tools.json) — Claude tools
177
+ - [adapters/local/README.md](adapters/local/README.md) — LM Studio, AutoGen, CrewAI
178
+
179
+ ## Deployment order
208
180
 
181
+ 1. **x402 facilitator** — Use public (e.g. https://x402-navy.vercel.app/facilitator) for full demo; or run local and set X402_EVM_FACILITATOR_URL to public for link_bank_account.
182
+ 2. **MCP server** — x402-enabled (run locally or use Replit MCP URL).
183
+ 3. **Agent** — `node src/run-agent.js` or PM2 (`pm2 start ecosystem.config.cjs --only agent-autonomous` from repo root).
209
184
 
210
185
  ## References
211
186
 
212
- - **Source:** [FinTechTonic/autonomous-agent](https://github.com/FinTechTonic/autonomous-agent)
213
- - **MCP integration:** [MCP_INTEGRATION_REFERENCE.md](MCP_INTEGRATION_REFERENCE.md) — endpoints, tools, resources, x402 flow, facilitator
214
187
  - [Canteen App – Aptos x402](https://canteenapp-aptos-x402.notion.site/) — wallet hydration and crediting
215
188
  - [LangChain.js MCP](https://js.langchain.com/docs/integrations/toolkits/mcp_toolbox)
216
189
  - [Hugging Face Inference – OpenAI-compatible](https://huggingface.co/docs/api-inference/en/index)
190
+ - [evm-wallet-skill](https://github.com/surfer77/evm-wallet-skill) — self-sovereign EVM wallet pattern for agents
191
+
217
192
  ## License
218
193
 
219
- GPL-2.0-only. Use of this software is also subject to the [Responsible AI License (RAIL)](https://www.licenses.ai/). See [LICENSE.md](LICENSE.md) (GPL-2) and [RAIL](https://www.licenses.ai/).
194
+ GPL-2.0-only. Use of this software is also subject to the [Responsible AI License (RAIL)](https://www.licenses.ai/). See [LICENSE.md](../LICENSE.md) (GPL-2) and [RAIL](https://www.licenses.ai/).
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "cornerstone-autonomous-agent",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "CornerStone Agentic Score: autonomous agent that uses an x402-enabled MCP server to predict tickers, backtest trading strategies, and open bank accounts. Handles 402 Payment Required (pay via Aptos/Ethereum facilitator and retry). LangChain.js ReAct agent with Hugging Face inference (OpenAI-compatible endpoint).",
5
5
  "type": "module",
6
6
  "main": "src/run-agent.js",
7
7
  "bin": {
8
- "cornerstone-agent": "src/run-agent.js",
9
- "cornerstone-agent-attest-aptos": "src/attest-aptos-wallet.js",
10
- "cornerstone-agent-attest-evm": "src/attest-evm-wallet.js"
8
+ "autonomous": "src/cli.js",
9
+ "cornerstone-autonomous-agent": "src/cli.js",
10
+ "cornerstone-agent": "src/run-agent.js"
11
11
  },
12
12
  "files": [
13
13
  "src",
package/src/cli.js ADDED
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI router for cornerstone-autonomous-agent.
4
+ * Enables: npx cornerstone-autonomous-agent <command> [args...]
5
+ * Commands: attest:aptos, attest:evm, and fallback to run-agent (default).
6
+ */
7
+
8
+ import { spawn } from 'child_process';
9
+ import { fileURLToPath } from 'url';
10
+ import { dirname, join } from 'path';
11
+
12
+ const __dirname = dirname(fileURLToPath(import.meta.url));
13
+ const root = join(__dirname, '..');
14
+
15
+ const COMMANDS = {
16
+ 'attest:aptos': 'src/attest-aptos-wallet.js',
17
+ 'attest:evm': 'src/attest-evm-wallet.js',
18
+ 'setup': 'src/setup.js',
19
+ 'setup:aptos': 'src/setup-aptos.js',
20
+ 'setup:evm:multichain': 'src/setup-evm-multichain.js',
21
+ 'addresses': 'src/show-agent-addresses.js',
22
+ 'balance': 'src/balance.js',
23
+ 'transfer': 'src/transfer.js',
24
+ 'contract': 'src/contract.js',
25
+ 'swap': 'src/swap.js',
26
+ 'agent': 'src/run-agent.js',
27
+ 'start': 'src/run-agent.js',
28
+ };
29
+
30
+ function main() {
31
+ const args = process.argv.slice(2);
32
+ const sub = args[0];
33
+ const script = sub && COMMANDS[sub];
34
+
35
+ if (script) {
36
+ const scriptPath = join(root, script);
37
+ const rest = args.slice(1);
38
+ const child = spawn(process.execPath, [scriptPath, ...rest], {
39
+ stdio: 'inherit',
40
+ cwd: root,
41
+ env: process.env,
42
+ });
43
+ child.on('exit', (code) => process.exit(code ?? 0));
44
+ return;
45
+ }
46
+
47
+ // Default: run the agent (backward compatibility: npx cornerstone-autonomous-agent "some message")
48
+ const runAgentPath = join(root, 'src/run-agent.js');
49
+ const child = spawn(process.execPath, [runAgentPath, ...args], {
50
+ stdio: 'inherit',
51
+ cwd: root,
52
+ env: process.env,
53
+ });
54
+ child.on('exit', (code) => process.exit(code ?? 0));
55
+ }
56
+
57
+ main();
@@ -52,11 +52,11 @@ async function main() {
52
52
  const evmMainnetPk = generatePrivateKey();
53
53
  result.evm_testnet = {
54
54
  privateKey: toHex(evmTestnetPk),
55
- address: privateKeyToAccount(evmTestnetPk).address,
55
+ address: privateKeyToAccount(evmTestnetPk).address.toLowerCase(),
56
56
  };
57
57
  result.evm_mainnet = {
58
58
  privateKey: toHex(evmMainnetPk),
59
- address: privateKeyToAccount(evmMainnetPk).address,
59
+ address: privateKeyToAccount(evmMainnetPk).address.toLowerCase(),
60
60
  };
61
61
  } catch (e) {
62
62
  if (jsonOut) console.log(JSON.stringify({ error: e.message }));