@johngalt5/bsv-overlay 0.2.10 → 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.
Files changed (2) hide show
  1. package/index.ts +13 -22
  2. package/package.json +1 -1
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
- // Wake the agent via gateway cron.wake RPC (fire-and-forget)
161
- const wakeText = `⚡ Incoming overlay service request: ${event.serviceId} from ${event.from?.slice(0, 16)}... (${event.satoshisReceived || '?'} sats paid). Check overlay({ action: "pending-requests" }) for details, fulfill it using your capabilities, then call overlay({ action: "fulfill", requestId: "...", recipientKey: "...", serviceId: "...", result: {...} }).`;
162
- (async () => {
163
- try {
164
- const gatewayUrl = 'http://127.0.0.1:18789';
165
- const wakeResp = await fetch(gatewayUrl, {
166
- method: 'POST',
167
- headers: { 'Content-Type': 'application/json' },
168
- body: JSON.stringify({
169
- jsonrpc: '2.0',
170
- id: `overlay-wake-${Date.now()}`,
171
- method: 'cron.wake',
172
- params: { mode: 'now', text: wakeText },
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngalt5/bsv-overlay",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "Clawdbot BSV Overlay — agent discovery, service marketplace, and micropayments on the BSV blockchain",
5
5
  "type": "module",
6
6
  "files": [