@johngalt5/bsv-overlay 0.2.9 → 0.2.11
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/SKILL.md +13 -2
- package/clawdbot.plugin.json +8 -0
- package/index.ts +22 -24
- package/openclaw.plugin.json +8 -0
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -47,8 +47,19 @@ If unfunded, it returns the address to fund. Once funded, run `onboard` again to
|
|
|
47
47
|
1. **Plugin loads** → wallet created automatically if missing
|
|
48
48
|
2. **User funds wallet** → UTXOs auto-imported via address watching
|
|
49
49
|
3. **Sufficient balance detected** → auto-registers on the overlay network
|
|
50
|
-
4. **Agent
|
|
51
|
-
5. **
|
|
50
|
+
4. **Agent asks for agent name** → user chooses their display name on the network
|
|
51
|
+
5. **Agent presents services** → user picks which to advertise
|
|
52
|
+
6. **Background service starts** → incoming requests auto-queued for agent processing
|
|
53
|
+
|
|
54
|
+
### Agent Name
|
|
55
|
+
|
|
56
|
+
On first registration, ask the user: **"What name do you want for your agent on the overlay network?"**
|
|
57
|
+
|
|
58
|
+
The default is the system hostname. If they want a custom name, set it in the plugin config:
|
|
59
|
+
- Config key: `agentName`
|
|
60
|
+
- Env var: `AGENT_NAME`
|
|
61
|
+
|
|
62
|
+
A re-registration (`overlay({ action: "register" })`) will use the new name.
|
|
52
63
|
|
|
53
64
|
## Handling Incoming Service Requests
|
|
54
65
|
|
package/clawdbot.plugin.json
CHANGED
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"default": "http://localhost:8080",
|
|
13
13
|
"description": "Overlay server URL - configure actual production URL via environment variables"
|
|
14
14
|
},
|
|
15
|
+
"agentName": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Display name for this agent on the overlay network"
|
|
18
|
+
},
|
|
19
|
+
"agentDescription": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Description of this agent shown to other agents on the network"
|
|
22
|
+
},
|
|
15
23
|
"walletDir": {
|
|
16
24
|
"type": "string"
|
|
17
25
|
},
|
package/index.ts
CHANGED
|
@@ -157,28 +157,19 @@ function startBackgroundService(env, cliPath, logger) {
|
|
|
157
157
|
if (event.action === 'queued-for-agent' && event.serviceId) {
|
|
158
158
|
logger?.info?.(`[bsv-overlay] ⚡ Incoming ${event.serviceId} request from ${event.from?.slice(0, 12)}... — waking agent`);
|
|
159
159
|
|
|
160
|
-
//
|
|
161
|
-
const
|
|
162
|
-
(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}),
|
|
174
|
-
});
|
|
175
|
-
if (wakeResp.ok) {
|
|
176
|
-
logger?.info?.('[bsv-overlay] Agent woken for service fulfillment');
|
|
177
|
-
}
|
|
178
|
-
} catch (wakeErr: any) {
|
|
179
|
-
logger?.warn?.('[bsv-overlay] Failed to wake agent:', wakeErr.message);
|
|
180
|
-
}
|
|
181
|
-
})();
|
|
160
|
+
// Write alert file for the cron-based fulfillment checker to pick up
|
|
161
|
+
const alertDir = path.join(process.env.HOME || '', '.clawdbot', 'bsv-overlay');
|
|
162
|
+
const alertPath = path.join(alertDir, 'pending-alert.jsonl');
|
|
163
|
+
try {
|
|
164
|
+
fs.mkdirSync(alertDir, { recursive: true });
|
|
165
|
+
fs.appendFileSync(alertPath, JSON.stringify({
|
|
166
|
+
requestId: event.id,
|
|
167
|
+
serviceId: event.serviceId,
|
|
168
|
+
from: event.from,
|
|
169
|
+
satoshis: event.satoshisReceived,
|
|
170
|
+
ts: Date.now(),
|
|
171
|
+
}) + '\n');
|
|
172
|
+
} catch {}
|
|
182
173
|
}
|
|
183
174
|
} catch {}
|
|
184
175
|
}
|
|
@@ -529,7 +520,7 @@ export default function register(api) {
|
|
|
529
520
|
api.log?.info?.('[bsv-overlay] Auto-registered on overlay network! Waking agent for service selection...');
|
|
530
521
|
// Wake the agent to present service selection to the user
|
|
531
522
|
try {
|
|
532
|
-
const wakeText = `🎉 BSV Overlay: Auto-registered on the network!
|
|
523
|
+
const wakeText = `🎉 BSV Overlay: Auto-registered on the network! Two things to set up:\n\n1. **Agent name**: Ask the user what name they want for their agent on the network. The current default is "${env.AGENT_NAME}". If they want a different name, they need to set it in the plugin config (agentName) and re-register.\n\n2. **Services**: Ask the user which services they want to advertise. Call overlay({ action: "register" }) to get the full list of available services with descriptions and suggested prices, then present them to the user. Let them choose which ones to enable. For each selected service, call overlay({ action: "advertise", serviceId: "...", name: "...", description: "...", priceSats: N }).`;
|
|
533
524
|
await fetch('http://127.0.0.1:18789', {
|
|
534
525
|
method: 'POST',
|
|
535
526
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -1102,7 +1093,14 @@ function buildEnvironment(config) {
|
|
|
1102
1093
|
|
|
1103
1094
|
// Set defaults
|
|
1104
1095
|
env.BSV_NETWORK = env.BSV_NETWORK || 'mainnet';
|
|
1105
|
-
|
|
1096
|
+
if (config.agentName) {
|
|
1097
|
+
env.AGENT_NAME = config.agentName;
|
|
1098
|
+
} else if (!env.AGENT_NAME) {
|
|
1099
|
+
env.AGENT_NAME = 'clawdbot-agent';
|
|
1100
|
+
}
|
|
1101
|
+
if (config.agentDescription) {
|
|
1102
|
+
env.AGENT_DESCRIPTION = config.agentDescription;
|
|
1103
|
+
}
|
|
1106
1104
|
env.AGENT_ROUTED = 'true'; // Route service requests through the agent
|
|
1107
1105
|
|
|
1108
1106
|
return env;
|
package/openclaw.plugin.json
CHANGED
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"default": "http://localhost:8080",
|
|
13
13
|
"description": "Overlay server URL - configure actual production URL via environment variables"
|
|
14
14
|
},
|
|
15
|
+
"agentName": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Display name for this agent on the overlay network"
|
|
18
|
+
},
|
|
19
|
+
"agentDescription": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Description of this agent shown to other agents on the network"
|
|
22
|
+
},
|
|
15
23
|
"walletDir": {
|
|
16
24
|
"type": "string"
|
|
17
25
|
},
|