decharge-scout 2.3.0 → 2.5.0

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.js +18 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -175,15 +175,28 @@ async function main(options) {
175
175
  console.log(chalk.gray('You have 30 seconds to respond...'));
176
176
 
177
177
  try {
178
+ let timeoutId;
179
+ let hasResolved = false;
180
+
178
181
  // Create a promise that auto-resolves after 30 seconds
179
182
  const timeoutPromise = new Promise((resolve) => {
180
- setTimeout(() => {
181
- console.log(chalk.yellow('\n⏱️ Timeout - using detected location...'));
182
- resolve('__TIMEOUT__');
183
+ timeoutId = setTimeout(() => {
184
+ if (!hasResolved) {
185
+ hasResolved = true;
186
+ console.log(chalk.yellow('\n⏱️ Timeout - using detected location...'));
187
+ resolve('__TIMEOUT__');
188
+ }
183
189
  }, 30000);
184
190
  });
185
191
 
186
- const questionPromise = question('Enter custom location (or press Enter): ');
192
+ const questionPromise = question('Enter custom location (or press Enter): ').then(answer => {
193
+ if (!hasResolved) {
194
+ hasResolved = true;
195
+ clearTimeout(timeoutId);
196
+ return answer;
197
+ }
198
+ return '__TIMEOUT__'; // If timeout already occurred, ignore this answer
199
+ });
187
200
 
188
201
  const customLocation = await Promise.race([questionPromise, timeoutPromise]);
189
202
 
@@ -246,7 +259,7 @@ async function main(options) {
246
259
  });
247
260
 
248
261
  // Main query cycle
249
- await runQueryCycle(wallet, agentName, location, options);
262
+ await runQueryCycle(walletAddress, agentName, location, options);
250
263
 
251
264
  } catch (error) {
252
265
  console.error(chalk.red(`\n❌ Error: ${error.message}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decharge-scout",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "AI-powered energy grid data scout with Solana integration",
5
5
  "main": "index.js",
6
6
  "type": "module",