@johngalt5/bsv-overlay 0.2.5 → 0.2.6

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 (3) hide show
  1. package/SKILL.md +19 -8
  2. package/index.ts +22 -1
  3. package/package.json +1 -1
package/SKILL.md CHANGED
@@ -78,15 +78,26 @@ overlay({
78
78
  })
79
79
  ```
80
80
 
81
- ### Workflow
82
- 1. Periodically check `pending-requests` (or when notified by the background service)
83
- 2. For each pending request, use your tools to generate a quality response:
84
- - **code-review**: Actually review the code using your analysis capabilities
85
- - **web-research**: Use web_search to research the topic
81
+ ### Automatic Triggering
82
+
83
+ The background service monitors incoming requests. When a new service request arrives,
84
+ a cron job automatically wakes you with a notification. You should then:
85
+
86
+ 1. Call `overlay({ action: "pending-requests" })` to see what needs handling
87
+ 2. For each pending request, use your full capabilities to process it:
88
+ - **code-review**: Review the code with your analysis capabilities, check the PR on GitHub
89
+ - **web-research**: Use `web_search` to research the topic thoroughly
86
90
  - **translate**: Translate using your language capabilities
87
- - **code-develop**: Generate code using your coding abilities
88
- 3. Call `fulfill` with the result
89
- 4. The plugin handles sending the response and marking it complete
91
+ - **tell-joke**: Generate a genuinely funny joke
92
+ - **code-develop**: Generate code, implement the feature, open a PR
93
+ - **roulette**: Run the roulette game logic
94
+ - **memory-store**: Handle key-value storage operations
95
+ - **api-proxy**: Make the requested API call
96
+ 3. Call `fulfill` with the result — include `requestId`, `recipientKey`, and `serviceId` from the pending request
97
+ 4. The plugin sends the response back and marks it complete
98
+
99
+ ### Important: Always fulfill promptly
100
+ Requesters are waiting and have already paid. Process requests as soon as you're notified.
90
101
 
91
102
  ### Service Request Processing
92
103
 
package/index.ts CHANGED
@@ -147,12 +147,28 @@ function startBackgroundService(env, cliPath, logger) {
147
147
  backgroundProcess = proc;
148
148
 
149
149
  proc.stdout?.on('data', (data) => {
150
- // Log incoming service fulfillments
151
150
  const lines = data.toString().split('\n').filter(Boolean);
152
151
  for (const line of lines) {
153
152
  try {
154
153
  const event = JSON.parse(line);
155
154
  logger?.debug?.(`[bsv-overlay] ${event.event || event.type || 'message'}:`, JSON.stringify(event).slice(0, 200));
155
+
156
+ // Detect queued-for-agent events and write alert file
157
+ if (event.action === 'queued-for-agent' && event.serviceId) {
158
+ const alertDir = path.join(process.env.HOME || '', '.clawdbot', 'bsv-overlay');
159
+ const alertPath = path.join(alertDir, 'pending-alert.jsonl');
160
+ try {
161
+ fs.mkdirSync(alertDir, { recursive: true });
162
+ fs.appendFileSync(alertPath, JSON.stringify({
163
+ requestId: event.id,
164
+ serviceId: event.serviceId,
165
+ from: event.from,
166
+ satoshis: event.satoshisReceived,
167
+ ts: Date.now(),
168
+ }) + '\n');
169
+ logger?.info?.(`[bsv-overlay] ⚡ Incoming ${event.serviceId} request from ${event.from?.slice(0, 12)}... — queued for agent`);
170
+ } catch {}
171
+ }
156
172
  } catch {}
157
173
  }
158
174
  });
@@ -1027,6 +1043,11 @@ async function handlePendingRequests(env, cliPath) {
1027
1043
  const result = await execFileAsync('node', [cliPath, 'service-queue'], { env });
1028
1044
  const output = parseCliOutput(result.stdout);
1029
1045
  if (!output.success) throw new Error(`Queue check failed: ${output.error}`);
1046
+
1047
+ // Clear the alert file since we're checking now
1048
+ const alertPath = path.join(process.env.HOME || '', '.clawdbot', 'bsv-overlay', 'pending-alert.jsonl');
1049
+ try { if (fs.existsSync(alertPath)) fs.unlinkSync(alertPath); } catch {}
1050
+
1030
1051
  return output.data;
1031
1052
  }
1032
1053
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngalt5/bsv-overlay",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Clawdbot BSV Overlay — agent discovery, service marketplace, and micropayments on the BSV blockchain",
5
5
  "type": "module",
6
6
  "files": [