@ape-church/skill 1.0.0 → 1.0.2

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 ADDED
@@ -0,0 +1,107 @@
1
+ # @ape-church/skill
2
+
3
+ Autonomous gambling agent skill for [Ape Church](https://ape.church) on ApeChain.
4
+
5
+ Let your AI agent play casino games, manage its bankroll, and gamble autonomously.
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ # Install globally
11
+ npm install -g @ape-church/skill
12
+
13
+ # Setup (generates wallet, registers username)
14
+ apechurch install
15
+
16
+ # Fund the printed address with APE on ApeChain
17
+ # Bridge: https://relay.link/bridge/apechain
18
+
19
+ # Check status
20
+ apechurch status
21
+
22
+ # Start autonomous play
23
+ apechurch heartbeat --strategy balanced
24
+ ```
25
+
26
+ ## Games
27
+
28
+ | Game | Type | Controls |
29
+ |------|------|----------|
30
+ | Jungle Plinko | Plinko | `--mode 0-4` `--balls 1-100` |
31
+ | Dino Dough | Slots | `--spins 1-15` |
32
+ | Bubblegum Heist | Slots | `--spins 1-15` |
33
+
34
+ ## Commands
35
+
36
+ ```bash
37
+ apechurch install [--username NAME] [--persona TYPE] # Setup
38
+ apechurch status [--json] # Check balance
39
+ apechurch heartbeat [--strategy TYPE] # Autonomous play
40
+ apechurch bet --game NAME --amount APE [options] # Manual bet
41
+ apechurch pause # Stop autonomous play
42
+ apechurch resume # Resume autonomous play
43
+ apechurch register --username NAME # Change username
44
+ apechurch profile show # View profile
45
+ apechurch profile set --persona TYPE # Set strategy
46
+ ```
47
+
48
+ ## Strategies
49
+
50
+ | Profile | Bet Size | Cooldown | Risk |
51
+ |---------|----------|----------|------|
52
+ | `conservative` | 5% | 60s | Low |
53
+ | `balanced` | 8% | 30s | Medium |
54
+ | `aggressive` | 12% | 15s | High |
55
+ | `degen` | 20% | 10s | Extreme |
56
+
57
+ ## How It Works
58
+
59
+ 1. **Install** creates a self-sovereign wallet at `~/.apechurch-wallet.json`
60
+ 2. **Human funds** the wallet with APE on ApeChain
61
+ 3. **Heartbeat** runs on a schedule (cron), placing bets autonomously
62
+ 4. Agent tracks wins/losses in `~/.apechurch/state.json`
63
+ 5. **Pause/Resume** to control when the agent plays
64
+
65
+ ## Safety
66
+
67
+ - Always keeps 1 APE reserved for gas
68
+ - Never bets more than strategy's max percentage
69
+ - Stops automatically when balance is too low
70
+ - Dynamic cooldowns: slower after losses, faster on win streaks
71
+
72
+ ## For Agent Frameworks
73
+
74
+ This skill is designed for autonomous AI agents. Add to your agent's cron:
75
+
76
+ ```yaml
77
+ cron:
78
+ - schedule: "* * * * *"
79
+ task: "apechurch heartbeat --strategy balanced --json"
80
+ ```
81
+
82
+ The agent will:
83
+ - Check balance and respect cooldowns
84
+ - Choose a game based on strategy
85
+ - Place one bet per heartbeat
86
+ - Report results in JSON
87
+
88
+ ## Docs
89
+
90
+ - [SKILL.md](https://ape.church/skill.md) — Full documentation
91
+ - [HEARTBEAT.md](https://ape.church/heartbeat.md) — Autonomous play rules
92
+ - [STRATEGY.md](https://ape.church/strategy.md) — Bankroll management
93
+
94
+ ## Requirements
95
+
96
+ - Node.js >= 18
97
+ - APE on ApeChain (for gas + wagers)
98
+
99
+ ## Links
100
+
101
+ - Website: https://ape.church
102
+ - Games: https://ape.church/games
103
+ - Bridge APE: https://relay.link/bridge/apechain
104
+
105
+ ## License
106
+
107
+ ISC
package/SKILL.md CHANGED
@@ -162,10 +162,6 @@ Run `apechurch status --json` to fetch:
162
162
  - `https://www.ape.church/games/dino-dough?id=<gameId>`
163
163
  - `https://www.ape.church/games/bubblegum-heist?id=<gameId>`
164
164
 
165
- ## Required Env (Optional)
166
- - `APECHAIN_RPC_URL` for HTTP RPC (recommended).
167
- - `APECHAIN_WSS_URL` for WebSocket event streaming (preferred for fast events).
168
-
169
165
  ## Hosted Docs (Reference)
170
166
  - `https://ape.church/skill.md`
171
167
  - `https://ape.church/heartbeat.md`
package/agent_nodes.md CHANGED
@@ -97,7 +97,7 @@ WHAT'S LEFT BEFORE GO-LIVE
97
97
  HIGH PRIORITY
98
98
  - Refactor game definitions into a registry so adding games is data-only. (DONE - registry.js)
99
99
  - Registry updates are shipped inside package (Option A). New games require package update.
100
- - Confirm ApeChain RPC defaults and recommended env variables.
100
+ - ApeChain RPC uses viem defaults (no env vars needed).
101
101
  - Ensure package install + register flow works end-to-end with API.
102
102
 
103
103
  MEDIUM PRIORITY (POST-LAUNCH)
package/assets/SKILL.md CHANGED
@@ -162,10 +162,6 @@ Run `apechurch status --json` to fetch:
162
162
  - `https://www.ape.church/games/dino-dough?id=<gameId>`
163
163
  - `https://www.ape.church/games/bubblegum-heist?id=<gameId>`
164
164
 
165
- ## Required Env (Optional)
166
- - `APECHAIN_RPC_URL` for HTTP RPC (recommended).
167
- - `APECHAIN_WSS_URL` for WebSocket event streaming (preferred for fast events).
168
-
169
165
  ## Hosted Docs (Reference)
170
166
  - `https://ape.church/skill.md`
171
167
  - `https://ape.church/heartbeat.md`
package/bin/cli.js CHANGED
@@ -11,7 +11,6 @@ import {
11
11
  formatEther,
12
12
  http,
13
13
  parseEther,
14
- webSocket,
15
14
  } from 'viem';
16
15
  import { privateKeyToAccount, generatePrivateKey } from 'viem/accounts';
17
16
  import { apechain } from 'viem/chains';
@@ -103,23 +102,10 @@ function getWallet() {
103
102
  return privateKeyToAccount(data.privateKey);
104
103
  }
105
104
 
106
- function getRpcUrl() {
107
- if (process.env.APECHAIN_RPC_URL) return process.env.APECHAIN_RPC_URL;
108
- if (apechain?.rpcUrls?.default?.http?.[0]) return apechain.rpcUrls.default.http[0];
109
- if (apechain?.rpcUrls?.public?.http?.[0]) return apechain.rpcUrls.public.http[0];
110
- return null;
111
- }
112
-
113
105
  function getTransport() {
114
- if (process.env.APECHAIN_WSS_URL) {
115
- return webSocket(process.env.APECHAIN_WSS_URL);
116
- }
117
- const rpcUrl = getRpcUrl();
118
- if (!rpcUrl) {
119
- console.error(JSON.stringify({ error: 'Missing APECHAIN_RPC_URL for HTTP transport.' }));
120
- process.exit(1);
121
- }
122
- return http(rpcUrl);
106
+ // Use viem's built-in ApeChain RPC (https://rpc.apechain.com/http)
107
+ // HTTP transport works for everything including event polling
108
+ return http();
123
109
  }
124
110
 
125
111
  function createClients(account) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ape-church/skill",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Autonomous agent skill for Ape Church on ApeChain.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,7 +13,15 @@
13
13
  "engines": {
14
14
  "node": ">=18"
15
15
  },
16
- "keywords": ["openclaw", "agent", "casino", "apechain", "ape", "church", "apechurch"],
16
+ "keywords": [
17
+ "openclaw",
18
+ "agent",
19
+ "casino",
20
+ "apechain",
21
+ "ape",
22
+ "church",
23
+ "apechurch"
24
+ ],
17
25
  "author": "",
18
26
  "license": "ISC",
19
27
  "dependencies": {