apow-cli 0.3.1 → 0.3.3
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/dist/config.js +4 -2
- package/dist/dashboard-html.js +1 -0
- package/dist/index.js +3 -3
- package/dist/smhl.js +40 -0
- package/package.json +1 -1
- package/skill.md +15 -11
package/dist/config.js
CHANGED
|
@@ -21,7 +21,7 @@ const DEFAULT_AGENT_COIN_ADDRESS = "0x12577CF0D8a07363224D6909c54C056A183e13b3";
|
|
|
21
21
|
const EXPENSIVE_MODELS = ["gpt-4o", "gpt-4", "claude-3-opus", "claude-3-5-sonnet"];
|
|
22
22
|
const CHEAP_OVERRIDES = ["gpt-4o-mini", "gpt-4-mini"];
|
|
23
23
|
function normalizeProvider(value) {
|
|
24
|
-
if (value === "anthropic" || value === "ollama" || value === "openai" || value === "gemini" || value === "claude-code" || value === "codex") {
|
|
24
|
+
if (value === "anthropic" || value === "ollama" || value === "openai" || value === "gemini" || value === "claude-code" || value === "codex" || value === "deepseek" || value === "qwen") {
|
|
25
25
|
return value;
|
|
26
26
|
}
|
|
27
27
|
return DEFAULT_LLM_PROVIDER;
|
|
@@ -66,6 +66,8 @@ function resolveLlmApiKey(provider) {
|
|
|
66
66
|
case "openai": return process.env.OPENAI_API_KEY;
|
|
67
67
|
case "anthropic": return process.env.ANTHROPIC_API_KEY;
|
|
68
68
|
case "gemini": return process.env.GEMINI_API_KEY;
|
|
69
|
+
case "deepseek": return process.env.DEEPSEEK_API_KEY;
|
|
70
|
+
case "qwen": return process.env.DASHSCOPE_API_KEY;
|
|
69
71
|
default: return undefined;
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -93,7 +95,7 @@ function requireLlmApiKey() {
|
|
|
93
95
|
return "";
|
|
94
96
|
}
|
|
95
97
|
if (!exports.config.llmApiKey) {
|
|
96
|
-
const keyNames = { openai: "OPENAI_API_KEY", anthropic: "ANTHROPIC_API_KEY", gemini: "GEMINI_API_KEY" };
|
|
98
|
+
const keyNames = { openai: "OPENAI_API_KEY", anthropic: "ANTHROPIC_API_KEY", gemini: "GEMINI_API_KEY", deepseek: "DEEPSEEK_API_KEY", qwen: "DASHSCOPE_API_KEY" };
|
|
97
99
|
const alt = keyNames[exports.config.llmProvider] ?? "";
|
|
98
100
|
throw new Error(`LLM_API_KEY${alt ? ` (or ${alt})` : ""} is required for ${exports.config.llmProvider}.`);
|
|
99
101
|
}
|
package/dist/dashboard-html.js
CHANGED
|
@@ -8,6 +8,7 @@ function getDashboardHtml() {
|
|
|
8
8
|
<meta charset="utf-8">
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
10
10
|
<title>APoW Dashboard</title>
|
|
11
|
+
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAFNUExURQAAAABS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBS/wBR/xNf/32n/3ql/yFp/9zo/9rm/x9n/3ym/////3mk/wBQ/yFo/9fk//r8/6fD/6jE/wBP/+3z/zZ3/zh4/+7z/wRV/yds/yxw/0F+/73S/zJ0/77T/9jl/0B9/0yF/+Xt//D1//f5/0yG/wtZ/6G//+Tt/+vx/+zy/+Dq/+Lr/+rx/6LA/wNU/xpk/xxl/5K1/+3y/0uF/xpj/5G0/xtl/yNq/zl5/9jk/7nP/ypu/yRq/7rQ/yVr/8rb/+nw//7///P3/+fv/+jv/8vb/3um//H1/wJT/5i5/1OK/yht/1SL/+/0/5e5/x1l/9Xj/6PB/z17/z58//H2/wlY/3ai/5y8/3Ge/wZW/3Sg/569/+rqE9AAAAATdFJOUwAAAitvsNz0/jma4fwbjOw3xUOydetBAAAAAWJLR0Qd6wNxkQAAAAd0SU1FB+oDERUwG5vARuoAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjYtMDMtMTdUMjE6NDg6MjIrMDA6MDDtKLHnAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDI2LTAzLTE3VDIxOjQ4OjIyKzAwOjAwnHUJWwAAACh0RVh0ZGF0ZTp0aW1lc3RhbXAAMjAyNi0wMy0xN1QyMTo0ODoyNyswMDowMJlYByMAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAABwklEQVQ4y4VTWVvCMBAM5T5FKKjAUkGpICoeXHKIgIrigQhe4AleKPr/H22btKT4fTgv3WYnk2R3FiERGgGMVqc3GE0mo0Gv0zLiClIgps0Wq81NYLNazAzFEEK7Y8qtwpTDrjCEwDnt/oNpJ2EIH5dBWWZZJTS4JIa4n8p7PBRD0hDOp/RZ7wxLnWIXCYyDys/O+fwUw8EIBDN1fzYAEOSot5g1iLFQ+XkfQIiWsDBIa1UJhMMqCasW6WwqgYVFlYRNh/RyzHGRAPBL0RgEI5wiokdyDZbjK6s+WEsk1mFjcyW+LNcCGcn+rSSfAkjzfBogxSczRMOITDjIbufyAIXizk6xAFDK7WbxukkmlCvVPdg/qFWrtQwPh0eVskwgR1TqxydwelZvNOpn5xCK1ivyEdIl2eZFq9CGy6trAVeX0C60bpocviR+5m2+A9BplSS0xDgfIM+UCtX1x+8gdt98kNB8fILnuL+LC4VLHen1YbfMEZRfoN+LkFLjZrFeSL0q5ePe3sHLkmbhdn8MPr+Gox4Nv38GH6TdsmEoM47+JMOoLDdmbMlyKtOqgE07Zns67xoNxsTB+X/0/h/eieP/CwWOXVaTpQ0oAAAAAElFTkSuQmCC">
|
|
11
12
|
<style>
|
|
12
13
|
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
|
13
14
|
:root{
|
package/dist/index.js
CHANGED
|
@@ -194,8 +194,8 @@ async function setupWizard() {
|
|
|
194
194
|
console.log("");
|
|
195
195
|
// Step 3: LLM
|
|
196
196
|
console.log(` ${ui.bold("Step 3/3: LLM Provider")}`);
|
|
197
|
-
const providerInput = await ui.prompt("Provider (openai/anthropic/gemini/ollama/claude-code/codex)", "openai");
|
|
198
|
-
const provider = (["openai", "anthropic", "gemini", "ollama", "claude-code", "codex"].includes(providerInput) ? providerInput : "openai");
|
|
197
|
+
const providerInput = await ui.prompt("Provider (openai/anthropic/gemini/ollama/deepseek/qwen/claude-code/codex)", "openai");
|
|
198
|
+
const provider = (["openai", "anthropic", "gemini", "ollama", "deepseek", "qwen", "claude-code", "codex"].includes(providerInput) ? providerInput : "openai");
|
|
199
199
|
values.LLM_PROVIDER = provider;
|
|
200
200
|
if (provider === "ollama") {
|
|
201
201
|
const ollamaUrl = await ui.prompt("Ollama URL", "http://127.0.0.1:11434");
|
|
@@ -216,7 +216,7 @@ async function setupWizard() {
|
|
|
216
216
|
ui.hint(`Set LLM_API_KEY in .env later`);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
const defaultModel = provider === "gemini" ? "gemini-2.5-flash" : provider === "anthropic" ? "claude-sonnet-4-5-20250929" : provider === "claude-code" || provider === "codex" ? "default" : "gpt-4o-mini";
|
|
219
|
+
const defaultModel = provider === "gemini" ? "gemini-2.5-flash" : provider === "anthropic" ? "claude-sonnet-4-5-20250929" : provider === "deepseek" ? "deepseek-chat" : provider === "qwen" ? "qwen-plus" : provider === "claude-code" || provider === "codex" ? "default" : "gpt-4o-mini";
|
|
220
220
|
const model = await ui.prompt("Model", defaultModel);
|
|
221
221
|
values.LLM_MODEL = model;
|
|
222
222
|
if ((0, config_1.isExpensiveModel)(model)) {
|
package/dist/smhl.js
CHANGED
|
@@ -249,6 +249,42 @@ async function requestGeminiSolution(prompt) {
|
|
|
249
249
|
const data = (await response.json());
|
|
250
250
|
return data.candidates?.[0]?.content?.parts?.[0]?.text ?? "";
|
|
251
251
|
}
|
|
252
|
+
async function requestDeepSeekSolution(prompt) {
|
|
253
|
+
const client = new openai_1.default({
|
|
254
|
+
apiKey: (0, config_1.requireLlmApiKey)(),
|
|
255
|
+
baseURL: "https://api.deepseek.com",
|
|
256
|
+
});
|
|
257
|
+
const response = await client.chat.completions.create({
|
|
258
|
+
model: config_1.config.llmModel || "deepseek-chat",
|
|
259
|
+
temperature: 0.7,
|
|
260
|
+
messages: [
|
|
261
|
+
{
|
|
262
|
+
role: "system",
|
|
263
|
+
content: "You generate short lowercase word sequences that match exact constraints. Return only the words separated by spaces. Nothing else.",
|
|
264
|
+
},
|
|
265
|
+
{ role: "user", content: prompt },
|
|
266
|
+
],
|
|
267
|
+
}, { timeout: 15_000 });
|
|
268
|
+
return response.choices[0]?.message.content ?? "";
|
|
269
|
+
}
|
|
270
|
+
async function requestQwenSolution(prompt) {
|
|
271
|
+
const client = new openai_1.default({
|
|
272
|
+
apiKey: (0, config_1.requireLlmApiKey)(),
|
|
273
|
+
baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
274
|
+
});
|
|
275
|
+
const response = await client.chat.completions.create({
|
|
276
|
+
model: config_1.config.llmModel || "qwen-plus",
|
|
277
|
+
temperature: 0.7,
|
|
278
|
+
messages: [
|
|
279
|
+
{
|
|
280
|
+
role: "system",
|
|
281
|
+
content: "You generate short lowercase word sequences that match exact constraints. Return only the words separated by spaces. Nothing else.",
|
|
282
|
+
},
|
|
283
|
+
{ role: "user", content: prompt },
|
|
284
|
+
],
|
|
285
|
+
}, { timeout: 15_000 });
|
|
286
|
+
return response.choices[0]?.message.content ?? "";
|
|
287
|
+
}
|
|
252
288
|
async function requestClaudeCodeSolution(prompt) {
|
|
253
289
|
return new Promise((resolve, reject) => {
|
|
254
290
|
const escaped = prompt.replace(/'/g, "'\\''");
|
|
@@ -284,6 +320,10 @@ async function requestProviderSolution(prompt) {
|
|
|
284
320
|
return requestClaudeCodeSolution(prompt);
|
|
285
321
|
case "codex":
|
|
286
322
|
return requestCodexSolution(prompt);
|
|
323
|
+
case "deepseek":
|
|
324
|
+
return requestDeepSeekSolution(prompt);
|
|
325
|
+
case "qwen":
|
|
326
|
+
return requestQwenSolution(prompt);
|
|
287
327
|
case "openai":
|
|
288
328
|
default:
|
|
289
329
|
return requestOpenAiSolution(prompt);
|
package/package.json
CHANGED
package/skill.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: apow-
|
|
3
|
-
description:
|
|
2
|
+
name: apow-mine
|
|
3
|
+
description: Set up and start mining AGENT tokens on Base L2 using apow-cli. Handles wallet creation, RPC setup, LLM config, minting a rig, and starting the mining loop.
|
|
4
|
+
allowed-tools: Bash(npx:*), Bash(node:*), Bash(curl:*)
|
|
5
|
+
argument-hint: [setup|mint|mine|stats]
|
|
4
6
|
metadata:
|
|
5
7
|
openclaw:
|
|
6
8
|
requires:
|
|
@@ -63,7 +65,7 @@ npx apow-cli wallet new
|
|
|
63
65
|
# Captures address + private key from output (also saved to wallet-<address>.txt)
|
|
64
66
|
|
|
65
67
|
# 2. Write .env directly (no interactive prompts needed)
|
|
66
|
-
# IMPORTANT: Use an API-based provider (openai/anthropic/gemini), NOT claude-code/codex.
|
|
68
|
+
# IMPORTANT: Use an API-based provider (openai/anthropic/gemini/deepseek/qwen), NOT claude-code/codex.
|
|
67
69
|
# Session-based providers are too slow for the 20-second mint challenge window.
|
|
68
70
|
# IMPORTANT: The public Base RPC is unreliable — get a free Alchemy URL (see RPC Recommendations).
|
|
69
71
|
cat > .env << 'EOF'
|
|
@@ -112,7 +114,7 @@ The miner client validates locally before submitting. If validation fails, it re
|
|
|
112
114
|
|---|---|
|
|
113
115
|
| **Node.js** | v18 or higher |
|
|
114
116
|
| **Base wallet** | A private key with ETH on Base (for gas + mint fee) |
|
|
115
|
-
| **LLM access** | API key (OpenAI, Anthropic, Gemini), local Ollama, or Claude Code / Codex CLI |
|
|
117
|
+
| **LLM access** | API key (OpenAI, Anthropic, Gemini, DeepSeek, Qwen), local Ollama, or Claude Code / Codex CLI |
|
|
116
118
|
| **git** | Only if installing from source (not needed for npm) |
|
|
117
119
|
|
|
118
120
|
---
|
|
@@ -242,7 +244,7 @@ AGENT_COIN_ADDRESS=0x12577CF0D8a07363224D6909c54C056A183e13b3
|
|
|
242
244
|
|
|
243
245
|
# === LLM Configuration ===
|
|
244
246
|
|
|
245
|
-
# Provider: "openai" | "anthropic" | "ollama" | "gemini" | "claude-code" | "codex"
|
|
247
|
+
# Provider: "openai" | "anthropic" | "ollama" | "gemini" | "deepseek" | "qwen" | "claude-code" | "codex"
|
|
246
248
|
LLM_PROVIDER=openai
|
|
247
249
|
|
|
248
250
|
# API key (not required if LLM_PROVIDER=ollama)
|
|
@@ -268,8 +270,8 @@ CHAIN=base
|
|
|
268
270
|
| `PRIVATE_KEY` | Yes | -- | Wallet private key (0x + 64 hex chars) |
|
|
269
271
|
| `MINING_AGENT_ADDRESS` | Yes | -- | Deployed MiningAgent contract address |
|
|
270
272
|
| `AGENT_COIN_ADDRESS` | Yes | -- | Deployed AgentCoin contract address |
|
|
271
|
-
| `LLM_PROVIDER` | No | `openai` | LLM provider: `openai`, `anthropic`, `ollama`, `gemini`, `claude-code`, or `codex` |
|
|
272
|
-
| `LLM_API_KEY` | Conditional | -- | API key. Falls back to `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `GEMINI_API_KEY` per provider. Not needed for `ollama`, `claude-code`, or `codex` |
|
|
273
|
+
| `LLM_PROVIDER` | No | `openai` | LLM provider: `openai`, `anthropic`, `ollama`, `gemini`, `deepseek`, `qwen`, `claude-code`, or `codex` |
|
|
274
|
+
| `LLM_API_KEY` | Conditional | -- | API key. Falls back to `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `GEMINI_API_KEY` / `DEEPSEEK_API_KEY` / `DASHSCOPE_API_KEY` per provider. Not needed for `ollama`, `claude-code`, or `codex` |
|
|
273
275
|
| `LLM_MODEL` | No | `gpt-4o-mini` | Model identifier passed to the provider |
|
|
274
276
|
| `RPC_URL` | **Strongly recommended** | `https://mainnet.base.org` | Base JSON-RPC endpoint. **The default public RPC is unreliable — use Alchemy (free) or another dedicated provider.** |
|
|
275
277
|
| `CHAIN` | No | `base` | Network selector; auto-detects `baseSepolia` if RPC URL contains "sepolia" |
|
|
@@ -278,7 +280,7 @@ CHAIN=base
|
|
|
278
280
|
|
|
279
281
|
### LLM Provider Recommendations
|
|
280
282
|
|
|
281
|
-
> **For AI agents:** Always use an API-based provider (OpenAI, Anthropic, or
|
|
283
|
+
> **For AI agents:** Always use an API-based provider (OpenAI, Anthropic, Gemini, DeepSeek, or Qwen). Session-based providers (`claude-code`, `codex`) spawn a CLI subprocess to solve challenges and are too slow to reliably complete the 20-second mint window. They may work for mining (which has no time limit) but will frequently fail during minting.
|
|
282
284
|
|
|
283
285
|
| Provider | Model | Cost per call | Notes |
|
|
284
286
|
|---|---|---|---|
|
|
@@ -286,6 +288,8 @@ CHAIN=base
|
|
|
286
288
|
| Gemini | `gemini-2.5-flash` | ~$0.001 | Fast, good accuracy |
|
|
287
289
|
| Anthropic | `claude-sonnet-4-5-20250929` | ~$0.005 | High accuracy on constrained generation |
|
|
288
290
|
| OpenAI | `gpt-4o` | ~$0.005 | Higher quality, slightly slower |
|
|
291
|
+
| DeepSeek | `deepseek-chat` | ~$0.001 | Fast, accessible in China |
|
|
292
|
+
| Qwen | `qwen-plus` | ~$0.002 | Alibaba Cloud, accessible in China |
|
|
289
293
|
| Ollama | `llama3.1` | Free (local) | Requires local GPU; variable accuracy |
|
|
290
294
|
| Claude Code | `default` | Subscription | **Not recommended for minting** — CLI startup too slow for 20s window |
|
|
291
295
|
| Codex | `default` | Subscription | **Not recommended for minting** — CLI startup too slow for 20s window |
|
|
@@ -359,7 +363,7 @@ npx apow-cli mint
|
|
|
359
363
|
5. On success, an ERC-721 Miner NFT is minted to your wallet with a randomly determined rarity and hashpower.
|
|
360
364
|
6. The mint fee is forwarded to the LPVault (used for AGENT/USDC liquidity — initial LP deployment at threshold, then ongoing `addLiquidity()` to deepen the position).
|
|
361
365
|
|
|
362
|
-
**Challenge expiry:** 20 seconds from `getChallenge` to `mint`. The LLM must solve quickly. Use an API-based provider (openai/anthropic/gemini) — session-based providers (claude-code/codex) are too slow and will fail.
|
|
366
|
+
**Challenge expiry:** 20 seconds from `getChallenge` to `mint`. The LLM must solve quickly. Use an API-based provider (openai/anthropic/gemini/deepseek/qwen) — session-based providers (claude-code/codex) are too slow and will fail.
|
|
363
367
|
|
|
364
368
|
### Mint Price
|
|
365
369
|
|
|
@@ -566,7 +570,7 @@ LLM_PROVIDER=codex
|
|
|
566
570
|
- The CLI must be available in your PATH
|
|
567
571
|
- Your subscription must be active
|
|
568
572
|
|
|
569
|
-
**Warning:** Session-based providers (`claude-code`, `codex`) spawn a CLI subprocess for each SMHL challenge. The startup overhead frequently exceeds the 20-second mint challenge window, causing mints to fail with `Expired`. **For minting, always use an API-based provider** (openai, anthropic, or
|
|
573
|
+
**Warning:** Session-based providers (`claude-code`, `codex`) spawn a CLI subprocess for each SMHL challenge. The startup overhead frequently exceeds the 20-second mint challenge window, causing mints to fail with `Expired`. **For minting, always use an API-based provider** (openai, anthropic, gemini, deepseek, or qwen). Session providers may work for the mining loop (which has no time limit per challenge) but are unreliable and not recommended for autonomous operation.
|
|
570
574
|
|
|
571
575
|
### Custom RPC Endpoints
|
|
572
576
|
|
|
@@ -609,7 +613,7 @@ Use the corresponding testnet contract addresses.
|
|
|
609
613
|
| `LLM_API_KEY is required for openai.` | Missing API key for cloud provider | Set `LLM_API_KEY` (or provider-specific key like `OPENAI_API_KEY`) in `.env`, or switch to `ollama` |
|
|
610
614
|
| `Insufficient fee` | Not enough ETH sent with mint | Check `getMintPrice()` and ensure wallet has enough ETH |
|
|
611
615
|
| `Sold out` | All 10,000 Miner NFTs minted | No more rigs available; buy one on secondary market |
|
|
612
|
-
| `Expired` | SMHL challenge expired (>20s) | Switch to an API-based provider (openai/gemini/anthropic). Session providers (claude-code/codex) are too slow for the 20s mint window |
|
|
616
|
+
| `Expired` | SMHL challenge expired (>20s) | Switch to an API-based provider (openai/gemini/anthropic/deepseek/qwen). Session providers (claude-code/codex) are too slow for the 20s mint window |
|
|
613
617
|
| `Invalid SMHL` | LLM produced an incorrect solution | Retry; if persistent, switch to a more capable model |
|
|
614
618
|
| `Not your miner` | Token ID not owned by your wallet | Verify `PRIVATE_KEY` matches the NFT owner; check token ID |
|
|
615
619
|
| `Supply exhausted` | All 18.9M mineable AGENT has been minted | Mining is complete; no more rewards available |
|