agentbnb 4.0.0 → 4.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 +2 -0
- package/dist/{card-IE5UV5QX.js → card-RSGDCHCV.js} +11 -4
- package/dist/chunk-3MJT4PZG.js +50 -0
- package/dist/{chunk-HEVXCYCY.js → chunk-4P3EMGL4.js} +61 -24
- package/dist/chunk-5AH3CMOX.js +62 -0
- package/dist/{chunk-QO67IGCW.js → chunk-5KFI5X7B.js} +1 -1
- package/dist/chunk-75OC6E4F.js +33 -0
- package/dist/{chunk-CUVIWPQO.js → chunk-7NA43XCG.js} +7 -6
- package/dist/{conduct-IQYAT6ZU.js → chunk-BH6WGYFB.js} +70 -33
- package/dist/{chunk-QVV2P3FN.js → chunk-DNWT5FZQ.js} +22 -2
- package/dist/chunk-FF226TIV.js +148 -0
- package/dist/{chunk-UJWYE7VL.js → chunk-GGYC5U2Z.js} +28 -111
- package/dist/chunk-HH24WMFN.js +373 -0
- package/dist/{websocket-client-5TIQDYQ4.js → chunk-JOY533UH.js} +38 -4
- package/dist/chunk-QITOPASZ.js +96 -0
- package/dist/{chunk-3Y36WQDV.js → chunk-QT7TEVNV.js} +14 -2
- package/dist/{chunk-UOGDK2S2.js → chunk-T7NS2J2B.js} +1 -1
- package/dist/{chunk-XA63SD4T.js → chunk-WGZ5AGOX.js} +37 -0
- package/dist/{chunk-RSX4SCPN.js → chunk-XND2DWTZ.js} +4 -3
- package/dist/cli/index.js +2924 -835
- package/dist/{client-IOTK6GOS.js → client-T5MTY3CS.js} +3 -3
- package/dist/conduct-GZQNFTRP.js +19 -0
- package/dist/conduct-N52JX7RT.js +52 -0
- package/dist/{conductor-mode-XU7ONJWC.js → conductor-mode-XUWGR4ZE.js} +16 -9
- package/dist/execute-PNGQOMYO.js +10 -0
- package/dist/index.d.ts +1148 -915
- package/dist/index.js +589 -127
- package/dist/{peers-G36URZYB.js → peers-K7FSHPN3.js} +2 -1
- package/dist/request-4GQSSM4B.js +196 -0
- package/dist/serve-skill-TPHZH6BS.js +104 -0
- package/dist/server-365V3GYD.js +295 -0
- package/dist/websocket-client-6IIDGXKB.js +7 -0
- package/package.json +3 -6
- package/skills/agentbnb/HEARTBEAT.rules.md +47 -0
- package/skills/agentbnb/SKILL.md +166 -0
- package/skills/agentbnb/auto-request.ts +14 -0
- package/skills/agentbnb/auto-share.ts +10 -0
- package/skills/agentbnb/bootstrap.test.ts +323 -0
- package/skills/agentbnb/bootstrap.ts +126 -0
- package/skills/agentbnb/credit-mgr.ts +11 -0
- package/skills/agentbnb/gateway.ts +12 -0
- package/skills/agentbnb/install.sh +210 -0
- package/dist/chunk-BEI5MTNZ.js +0 -91
- package/dist/execute-GDGBU6DJ.js +0 -10
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# install.sh — Post-install automation script for the AgentBnB OpenClaw skill
|
|
3
|
+
#
|
|
4
|
+
# This script is invoked automatically by OpenClaw after installing the agentbnb skill.
|
|
5
|
+
# It handles the full technical setup so a new agent can join the AgentBnB network
|
|
6
|
+
# without reading any documentation or performing any manual steps.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# bash install.sh
|
|
10
|
+
#
|
|
11
|
+
# What it does:
|
|
12
|
+
# 1. Checks Node.js >= 20 and pnpm are available
|
|
13
|
+
# 2. Installs the agentbnb CLI globally
|
|
14
|
+
# 3. Initializes the ~/.agentbnb/ config directory with defaults
|
|
15
|
+
# 4. Syncs capabilities from SOUL.md if one is found
|
|
16
|
+
# 5. Prints a success summary and next steps
|
|
17
|
+
|
|
18
|
+
set -euo pipefail
|
|
19
|
+
|
|
20
|
+
# ---------------------------------------------------------------------------
|
|
21
|
+
# Color helpers (graceful fallback for non-color terminals)
|
|
22
|
+
# ---------------------------------------------------------------------------
|
|
23
|
+
if [ -t 1 ] && command -v tput &>/dev/null && tput colors &>/dev/null 2>&1; then
|
|
24
|
+
GREEN=$(tput setaf 2)
|
|
25
|
+
YELLOW=$(tput setaf 3)
|
|
26
|
+
RED=$(tput setaf 1)
|
|
27
|
+
BOLD=$(tput bold)
|
|
28
|
+
RESET=$(tput sgr0)
|
|
29
|
+
else
|
|
30
|
+
GREEN=""
|
|
31
|
+
YELLOW=""
|
|
32
|
+
RED=""
|
|
33
|
+
BOLD=""
|
|
34
|
+
RESET=""
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
ok() { echo "${GREEN}✓${RESET} $*"; }
|
|
38
|
+
warn() { echo "${YELLOW}⚠${RESET} $*"; }
|
|
39
|
+
err() { echo "${RED}✗${RESET} $*" >&2; }
|
|
40
|
+
step() { echo ""; echo "${BOLD}$*${RESET}"; }
|
|
41
|
+
|
|
42
|
+
# ---------------------------------------------------------------------------
|
|
43
|
+
# Step 1: Check prerequisites
|
|
44
|
+
# ---------------------------------------------------------------------------
|
|
45
|
+
step "Step 1/5 — Checking prerequisites"
|
|
46
|
+
|
|
47
|
+
# Node.js >= 20
|
|
48
|
+
if ! command -v node &>/dev/null; then
|
|
49
|
+
err "Node.js not found. Please install Node.js 20+ from https://nodejs.org"
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
NODE_VERSION=$(node --version | sed 's/v//' | cut -d. -f1)
|
|
54
|
+
if [ "$NODE_VERSION" -lt 20 ]; then
|
|
55
|
+
err "Node.js >= 20 required (found v${NODE_VERSION}). Please upgrade: https://nodejs.org"
|
|
56
|
+
exit 1
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
ok "Node.js $(node --version) found"
|
|
60
|
+
|
|
61
|
+
# pnpm (attempt install if missing)
|
|
62
|
+
if ! command -v pnpm &>/dev/null; then
|
|
63
|
+
warn "pnpm not found — attempting to install via npm"
|
|
64
|
+
if npm install -g pnpm 2>/dev/null; then
|
|
65
|
+
ok "pnpm installed via npm"
|
|
66
|
+
else
|
|
67
|
+
warn "Could not install pnpm — will fall back to npm for AgentBnB install"
|
|
68
|
+
fi
|
|
69
|
+
else
|
|
70
|
+
ok "pnpm $(pnpm --version) found"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# ---------------------------------------------------------------------------
|
|
74
|
+
# Step 2: Install AgentBnB CLI
|
|
75
|
+
# ---------------------------------------------------------------------------
|
|
76
|
+
step "Step 2/5 — Installing AgentBnB CLI"
|
|
77
|
+
|
|
78
|
+
# Check if already installed (idempotent)
|
|
79
|
+
if command -v agentbnb &>/dev/null; then
|
|
80
|
+
ok "AgentBnB CLI already installed ($(agentbnb --version 2>/dev/null || echo 'version unknown'))"
|
|
81
|
+
else
|
|
82
|
+
INSTALL_OK=false
|
|
83
|
+
|
|
84
|
+
# Try pnpm global install first
|
|
85
|
+
if command -v pnpm &>/dev/null; then
|
|
86
|
+
if pnpm install -g agentbnb 2>/dev/null; then
|
|
87
|
+
INSTALL_OK=true
|
|
88
|
+
ok "AgentBnB CLI installed via pnpm"
|
|
89
|
+
else
|
|
90
|
+
warn "pnpm global install failed — trying npm"
|
|
91
|
+
fi
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# Fall back to npm global install
|
|
95
|
+
if [ "$INSTALL_OK" = false ]; then
|
|
96
|
+
if npm install -g agentbnb 2>/dev/null; then
|
|
97
|
+
INSTALL_OK=true
|
|
98
|
+
ok "AgentBnB CLI installed via npm"
|
|
99
|
+
else
|
|
100
|
+
err "Failed to install AgentBnB CLI via both pnpm and npm."
|
|
101
|
+
err "Please run manually: npm install -g agentbnb"
|
|
102
|
+
exit 1
|
|
103
|
+
fi
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# Verify the CLI is now callable
|
|
107
|
+
if ! command -v agentbnb &>/dev/null; then
|
|
108
|
+
err "agentbnb command not found after install. Check your PATH."
|
|
109
|
+
exit 1
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
ok "Verified: agentbnb $(agentbnb --version 2>/dev/null || echo 'installed') is available"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# ---------------------------------------------------------------------------
|
|
116
|
+
# Step 3: Initialize config + connect to public registry
|
|
117
|
+
# ---------------------------------------------------------------------------
|
|
118
|
+
step "Step 3/5 — Initializing AgentBnB config"
|
|
119
|
+
|
|
120
|
+
# agentbnb init is idempotent — safe to run on existing installs
|
|
121
|
+
if agentbnb init --yes 2>/dev/null; then
|
|
122
|
+
ok "Config initialized at ~/.agentbnb/"
|
|
123
|
+
else
|
|
124
|
+
# May already be initialized — check if directory exists
|
|
125
|
+
if [ -d "$HOME/.agentbnb" ]; then
|
|
126
|
+
ok "Config already exists at ~/.agentbnb/ (skipping re-init)"
|
|
127
|
+
else
|
|
128
|
+
err "Failed to initialize AgentBnB config. Run 'agentbnb init' manually."
|
|
129
|
+
exit 1
|
|
130
|
+
fi
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
# Connect to the public AgentBnB registry (only if not already configured)
|
|
134
|
+
CURRENT_REGISTRY=$(agentbnb config get registry 2>/dev/null || echo "")
|
|
135
|
+
if [ -z "$CURRENT_REGISTRY" ]; then
|
|
136
|
+
if agentbnb config set registry https://hub.agentbnb.dev 2>/dev/null; then
|
|
137
|
+
ok "Connected to public registry: https://hub.agentbnb.dev"
|
|
138
|
+
ok "Registry grants 50 credits to new agents on first sync"
|
|
139
|
+
else
|
|
140
|
+
warn "Could not set registry — run manually: agentbnb config set registry https://hub.agentbnb.dev"
|
|
141
|
+
fi
|
|
142
|
+
else
|
|
143
|
+
ok "Registry already configured: $CURRENT_REGISTRY"
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# ---------------------------------------------------------------------------
|
|
147
|
+
# Step 4: Sync from SOUL.md
|
|
148
|
+
# ---------------------------------------------------------------------------
|
|
149
|
+
step "Step 4/5 — Syncing capabilities from SOUL.md"
|
|
150
|
+
|
|
151
|
+
SOUL_PATH=""
|
|
152
|
+
# Check current directory first, then parent directory
|
|
153
|
+
if [ -f "SOUL.md" ]; then
|
|
154
|
+
SOUL_PATH="SOUL.md"
|
|
155
|
+
elif [ -f "../SOUL.md" ]; then
|
|
156
|
+
SOUL_PATH="../SOUL.md"
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
if [ -n "$SOUL_PATH" ]; then
|
|
160
|
+
ok "Found SOUL.md at: $SOUL_PATH"
|
|
161
|
+
if agentbnb openclaw sync 2>/dev/null; then
|
|
162
|
+
ok "Capability card published to AgentBnB network"
|
|
163
|
+
else
|
|
164
|
+
warn "Sync failed — your agent is not yet visible on the network."
|
|
165
|
+
warn "Retry with: agentbnb openclaw sync"
|
|
166
|
+
fi
|
|
167
|
+
else
|
|
168
|
+
warn "No SOUL.md found in current or parent directory."
|
|
169
|
+
warn "Run 'agentbnb openclaw sync' manually after creating your SOUL.md"
|
|
170
|
+
fi
|
|
171
|
+
|
|
172
|
+
# ---------------------------------------------------------------------------
|
|
173
|
+
# Step 5: Print success summary
|
|
174
|
+
# ---------------------------------------------------------------------------
|
|
175
|
+
step "Step 5/5 — Setup complete"
|
|
176
|
+
|
|
177
|
+
echo ""
|
|
178
|
+
echo "${GREEN}${BOLD}AgentBnB skill installed successfully!${RESET}"
|
|
179
|
+
echo ""
|
|
180
|
+
echo "What was set up:"
|
|
181
|
+
ok "AgentBnB CLI available as 'agentbnb'"
|
|
182
|
+
ok "Config directory: ~/.agentbnb/"
|
|
183
|
+
ok "Registry: https://hub.agentbnb.dev (public network)"
|
|
184
|
+
ok "Default autonomy tier: Tier 3 (ask before all transactions)"
|
|
185
|
+
ok "Default credit reserve: 20 credits"
|
|
186
|
+
|
|
187
|
+
# Verify identity.json was created (v4.0+ feature)
|
|
188
|
+
if [ -f "$HOME/.agentbnb/identity.json" ]; then
|
|
189
|
+
ok "Agent identity: ~/.agentbnb/identity.json"
|
|
190
|
+
else
|
|
191
|
+
warn "identity.json not found — will be created on next agentbnb init"
|
|
192
|
+
fi
|
|
193
|
+
|
|
194
|
+
if [ -n "$SOUL_PATH" ]; then
|
|
195
|
+
ok "Capability card synced from SOUL.md"
|
|
196
|
+
fi
|
|
197
|
+
|
|
198
|
+
echo ""
|
|
199
|
+
echo "Next steps:"
|
|
200
|
+
echo " 1. Run ${BOLD}agentbnb serve${RESET} to start accepting requests"
|
|
201
|
+
echo " 2. Run ${BOLD}agentbnb openclaw status${RESET} to see your sync state"
|
|
202
|
+
echo " 3. Run ${BOLD}agentbnb openclaw rules${RESET} to see your autonomy rules"
|
|
203
|
+
echo " 4. Paste the rules into your HEARTBEAT.md (or copy from HEARTBEAT.rules.md)"
|
|
204
|
+
echo ""
|
|
205
|
+
echo "Configure autonomy thresholds:"
|
|
206
|
+
echo " ${BOLD}agentbnb config set tier1 10${RESET} # auto-execute under 10 credits"
|
|
207
|
+
echo " ${BOLD}agentbnb config set tier2 50${RESET} # notify-after under 50 credits"
|
|
208
|
+
echo " ${BOLD}agentbnb config set reserve 20${RESET} # keep 20 credit reserve"
|
|
209
|
+
echo ""
|
|
210
|
+
ok "Welcome to the AgentBnB network."
|
package/dist/chunk-BEI5MTNZ.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// src/cli/peers.ts
|
|
2
|
-
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
3
|
-
import { join as join2 } from "path";
|
|
4
|
-
|
|
5
|
-
// src/cli/config.ts
|
|
6
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
7
|
-
import { homedir } from "os";
|
|
8
|
-
import { join } from "path";
|
|
9
|
-
function getConfigDir() {
|
|
10
|
-
return process.env["AGENTBNB_DIR"] ?? join(homedir(), ".agentbnb");
|
|
11
|
-
}
|
|
12
|
-
function getConfigPath() {
|
|
13
|
-
return join(getConfigDir(), "config.json");
|
|
14
|
-
}
|
|
15
|
-
function loadConfig() {
|
|
16
|
-
const configPath = getConfigPath();
|
|
17
|
-
if (!existsSync(configPath)) return null;
|
|
18
|
-
try {
|
|
19
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
20
|
-
return JSON.parse(raw);
|
|
21
|
-
} catch {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function saveConfig(config) {
|
|
26
|
-
const dir = getConfigDir();
|
|
27
|
-
if (!existsSync(dir)) {
|
|
28
|
-
mkdirSync(dir, { recursive: true });
|
|
29
|
-
}
|
|
30
|
-
writeFileSync(getConfigPath(), JSON.stringify(config, null, 2), "utf-8");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// src/cli/peers.ts
|
|
34
|
-
function getPeersPath() {
|
|
35
|
-
return join2(getConfigDir(), "peers.json");
|
|
36
|
-
}
|
|
37
|
-
function loadPeers() {
|
|
38
|
-
const peersPath = getPeersPath();
|
|
39
|
-
if (!existsSync2(peersPath)) {
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
const raw = readFileSync2(peersPath, "utf-8");
|
|
44
|
-
return JSON.parse(raw);
|
|
45
|
-
} catch {
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function writePeers(peers) {
|
|
50
|
-
const dir = getConfigDir();
|
|
51
|
-
if (!existsSync2(dir)) {
|
|
52
|
-
mkdirSync2(dir, { recursive: true });
|
|
53
|
-
}
|
|
54
|
-
writeFileSync2(getPeersPath(), JSON.stringify(peers, null, 2), "utf-8");
|
|
55
|
-
}
|
|
56
|
-
function savePeer(peer) {
|
|
57
|
-
const peers = loadPeers();
|
|
58
|
-
const lowerName = peer.name.toLowerCase();
|
|
59
|
-
const existing = peers.findIndex((p) => p.name.toLowerCase() === lowerName);
|
|
60
|
-
if (existing >= 0) {
|
|
61
|
-
peers[existing] = peer;
|
|
62
|
-
} else {
|
|
63
|
-
peers.push(peer);
|
|
64
|
-
}
|
|
65
|
-
writePeers(peers);
|
|
66
|
-
}
|
|
67
|
-
function removePeer(name) {
|
|
68
|
-
const peers = loadPeers();
|
|
69
|
-
const lowerName = name.toLowerCase();
|
|
70
|
-
const filtered = peers.filter((p) => p.name.toLowerCase() !== lowerName);
|
|
71
|
-
if (filtered.length === peers.length) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
writePeers(filtered);
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
function findPeer(name) {
|
|
78
|
-
const peers = loadPeers();
|
|
79
|
-
const lowerName = name.toLowerCase();
|
|
80
|
-
return peers.find((p) => p.name.toLowerCase() === lowerName) ?? null;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export {
|
|
84
|
-
getConfigDir,
|
|
85
|
-
loadConfig,
|
|
86
|
-
saveConfig,
|
|
87
|
-
loadPeers,
|
|
88
|
-
savePeer,
|
|
89
|
-
removePeer,
|
|
90
|
-
findPeer
|
|
91
|
-
};
|
package/dist/execute-GDGBU6DJ.js
DELETED