2020117-agent 0.5.2 → 0.5.3
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/dist/agent.js +8 -11
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -81,7 +81,7 @@ for (const arg of process.argv.slice(2)) {
|
|
|
81
81
|
import { randomBytes } from 'crypto';
|
|
82
82
|
import { SwarmNode, topicFromKind } from './swarm.js';
|
|
83
83
|
import { createProcessor } from './processor.js';
|
|
84
|
-
import {
|
|
84
|
+
import { loadAgentName, } from './api.js';
|
|
85
85
|
import { generateInvoice } from './clink.js';
|
|
86
86
|
import { receiveCashuToken } from './cashu.js';
|
|
87
87
|
import { generateKeypair, loadSovereignKeys, saveSovereignKeys, signEvent, nip44Encrypt, nip44Decrypt, pubkeyFromPrivkey, RelayPool, } from './nostr.js';
|
|
@@ -173,12 +173,12 @@ async function main() {
|
|
|
173
173
|
if (state.skill) {
|
|
174
174
|
console.log(`[${label}] Skill: ${state.skill.name} v${state.skill.version} (${state.skill.features.join(', ')})`);
|
|
175
175
|
}
|
|
176
|
-
// 2. Auto-
|
|
177
|
-
if (!LIGHTNING_ADDRESS
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
LIGHTNING_ADDRESS =
|
|
181
|
-
console.log(`[${label}] Lightning Address loaded from
|
|
176
|
+
// 2. Auto-load Lightning Address from .2020117_keys if not set via CLI/env
|
|
177
|
+
if (!LIGHTNING_ADDRESS) {
|
|
178
|
+
const keys = loadSovereignKeys(loadAgentName() || 'agent');
|
|
179
|
+
if (keys?.lightning_address) {
|
|
180
|
+
LIGHTNING_ADDRESS = keys.lightning_address;
|
|
181
|
+
console.log(`[${label}] Lightning Address loaded from keys: ${LIGHTNING_ADDRESS}`);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
// 3. Nostr identity + relay + subscriptions (all agents are Nostr-native)
|
|
@@ -1093,10 +1093,7 @@ function endSession(node, session, label) {
|
|
|
1093
1093
|
// Update P2P lifetime counters
|
|
1094
1094
|
state.p2pSessionsCompleted++;
|
|
1095
1095
|
state.p2pTotalEarnedSats += session.totalEarned;
|
|
1096
|
-
//
|
|
1097
|
-
if (hasApiKey()) {
|
|
1098
|
-
reportSession({ kind: KIND, durationS, totalSats: session.totalEarned });
|
|
1099
|
-
}
|
|
1096
|
+
// Session stats are included in the next Kind 30333 heartbeat automatically
|
|
1100
1097
|
activeSessions.delete(session.sessionId);
|
|
1101
1098
|
}
|
|
1102
1099
|
// --- 5. Graceful shutdown ---
|