2020117-agent 0.4.6 → 0.4.7

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/dist/agent.js +27 -5
  2. package/package.json +1 -1
package/dist/agent.js CHANGED
@@ -285,15 +285,17 @@ async function setupSovereign(label) {
285
285
  state.relayPool = new RelayPool(relayUrls);
286
286
  await state.relayPool.connect();
287
287
  console.log(`[${label}] Connected to ${state.relayPool.connectedCount} relay(s)`);
288
- // 4. Publish ai.info (Kind 31340) — NIP-XX capability advertisement
288
+ // 4. Publish profile (Kind 0) — name, about, lud16
289
+ await publishProfile(label);
290
+ // 5. Publish ai.info (Kind 31340) — NIP-XX capability advertisement
289
291
  await publishAiInfo(label);
290
- // 5. Publish handler info (Kind 31990) — NIP-89 DVM capability
292
+ // 6. Publish handler info (Kind 31990) — NIP-89 DVM capability
291
293
  await publishHandlerInfo(label);
292
- // 6. Subscribe to NIP-XX prompts (Kind 25802)
294
+ // 7. Subscribe to NIP-XX prompts (Kind 25802)
293
295
  subscribeNipXX(label);
294
- // 7. Subscribe to DVM requests (Kind 5xxx) directly from relay
296
+ // 8. Subscribe to DVM requests (Kind 5xxx) directly from relay
295
297
  subscribeDvmRequests(label);
296
- // 8. Start sovereign heartbeat (Kind 30333 to relay)
298
+ // 9. Start sovereign heartbeat (Kind 30333 to relay)
297
299
  startSovereignHeartbeat(label);
298
300
  }
299
301
  async function publishAiInfo(label) {
@@ -324,6 +326,26 @@ async function publishAiInfo(label) {
324
326
  const ok = await state.relayPool.publish(event);
325
327
  console.log(`[${label}] Published ai.info (Kind 31340): ${ok ? 'ok' : 'failed'}`);
326
328
  }
329
+ async function publishProfile(label) {
330
+ if (!state.sovereignKeys || !state.relayPool)
331
+ return;
332
+ const agentName = state.agentName || 'sovereign-agent';
333
+ const content = {
334
+ name: agentName,
335
+ about: state.skill?.description || `DVM agent (kind ${KIND})`,
336
+ picture: `https://robohash.org/${encodeURIComponent(agentName)}`,
337
+ };
338
+ if (LIGHTNING_ADDRESS) {
339
+ content.lud16 = LIGHTNING_ADDRESS;
340
+ }
341
+ const event = signEvent({
342
+ kind: 0,
343
+ tags: [],
344
+ content: JSON.stringify(content),
345
+ }, state.sovereignKeys.privkey);
346
+ const ok = await state.relayPool.publish(event);
347
+ console.log(`[${label}] Published profile (Kind 0): ${ok ? 'ok' : 'failed'}`);
348
+ }
327
349
  async function publishHandlerInfo(label) {
328
350
  if (!state.sovereignKeys || !state.relayPool)
329
351
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "2020117-agent",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "2020117 agent runtime — API polling + Hyperswarm P2P + Sovereign Nostr mode + Cashu/Lightning payments",
5
5
  "type": "module",
6
6
  "bin": {