helixmind 0.5.24 → 0.5.26

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.
@@ -1 +1 @@
1
- {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/chat.ts"],"names":[],"mappings":"AAsFA,UAAU,WAAW;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAqND,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAsjHrE"}
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/chat.ts"],"names":[],"mappings":"AAsFA,UAAU,WAAW;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAqND,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA4kHrE"}
@@ -407,6 +407,7 @@ export async function chatCommand(options) {
407
407
  let agentRunning = false;
408
408
  let autonomousMode = false;
409
409
  let fullScreenBrowserOpen = false; // Guards ESC/stop events while Rewind or Plan browser is active
410
+ let lastSpecialEscTime = 0; // Timestamp of last ESC in special mode (Jarvis/autonomous)
410
411
  // Forward-declared findings handler (reassigned by control protocol if active)
411
412
  let pushFindingsToBrainFn = null;
412
413
  // Forward-declared browser screenshot handler (reassigned when brain server is active)
@@ -2245,17 +2246,56 @@ export async function chatCommand(options) {
2245
2246
  }
2246
2247
  // Command suggestions are now handled by InputManager's built-in _interceptTtyWrite.
2247
2248
  // The panel opens/updates/closes automatically as the user types slash commands.
2248
- // === ESC detection (single ESC = stop) ===
2249
+ // === ESC detection ===
2249
2250
  // Double-ESC (rewind browser) is handled by the raw data listener below.
2250
2251
  // Skip if a full-screen browser (Rewind/Plan) is open — it handles ESC itself.
2251
2252
  // Skip if ESC was used to close the suggestion panel (panelJustClosed flag)
2253
+ //
2254
+ // Special modes (Jarvis daemon, autonomous) require DELIBERATE double-ESC
2255
+ // with >1s gap to stop — prevents accidental kills. Quick double-ESC (<800ms)
2256
+ // opens Rewind instead. Single ESC is ignored for special modes.
2252
2257
  if (key.name === 'escape' && !fullScreenBrowserOpen && !panelJustClosed) {
2253
2258
  const jarvisRunning = jarvisDaemonSession && jarvisDaemonSession.status === 'running';
2254
- const anythingRunning = agentRunning || sessionMgr.hasBackgroundTasks || autonomousMode || jarvisRunning;
2255
- if (anythingRunning) {
2256
- // Close suggestion panel if open
2259
+ const specialMode = jarvisRunning || autonomousMode;
2260
+ const normalRunning = agentRunning || sessionMgr.hasBackgroundTasks;
2261
+ if (specialMode) {
2262
+ // Special modes: single ESC is ignored.
2263
+ // Stopping requires deliberate double-ESC (>1s gap) — handled below.
2264
+ const now = Date.now();
2265
+ if (lastSpecialEscTime > 0 && (now - lastSpecialEscTime) >= 1000) {
2266
+ // Deliberate double-ESC (>1s gap) → STOP special mode
2267
+ lastSpecialEscTime = 0;
2268
+ closeSuggestionPanel();
2269
+ activity.stop('Stopped');
2270
+ agentController.abort();
2271
+ sessionMgr.abortAll();
2272
+ if (activeSwarm) {
2273
+ activeSwarm.abort();
2274
+ activeSwarm = null;
2275
+ }
2276
+ autonomousMode = false;
2277
+ if (jarvisRunning) {
2278
+ jarvisDaemonSession.abort();
2279
+ jarvisDaemonSession = null;
2280
+ jarvisQueue.setDaemonState('stopped');
2281
+ jarvisPaused = false;
2282
+ releaseJarvisSlot();
2283
+ }
2284
+ typeAheadBuffer.length = 0;
2285
+ agentRunning = false;
2286
+ process.stdout.write('\n');
2287
+ renderInfo(chalk.red('\u23F9 STOPPED') + chalk.dim(' \u2014 Special mode exited (deliberate double-ESC).'));
2288
+ showPrompt();
2289
+ }
2290
+ else {
2291
+ // First ESC or too fast — record time, show hint
2292
+ lastSpecialEscTime = now;
2293
+ screen.writeOutput(chalk.dim(' \u23F8 ESC registered \u2014 press ESC again after 1s to stop, or quick double-ESC for Rewind\n'));
2294
+ }
2295
+ }
2296
+ else if (normalRunning) {
2297
+ // Normal agent work: single ESC = immediate stop (unchanged)
2257
2298
  closeSuggestionPanel();
2258
- // IMMEDIATE STOP — single ESC press
2259
2299
  activity.stop('Stopped');
2260
2300
  agentController.abort();
2261
2301
  sessionMgr.abortAll();
@@ -2263,22 +2303,10 @@ export async function chatCommand(options) {
2263
2303
  activeSwarm.abort();
2264
2304
  activeSwarm = null;
2265
2305
  }
2266
- autonomousMode = false;
2267
- // Stop Jarvis daemon if running
2268
- if (jarvisRunning) {
2269
- jarvisDaemonSession.abort();
2270
- jarvisDaemonSession = null;
2271
- jarvisQueue.setDaemonState('stopped');
2272
- jarvisPaused = false;
2273
- releaseJarvisSlot();
2274
- }
2275
- // Clear type-ahead buffer to prevent agent restarting after abort
2276
2306
  typeAheadBuffer.length = 0;
2277
- // Reset agent state immediately (don't wait for async propagation)
2278
2307
  agentRunning = false;
2279
2308
  process.stdout.write('\n');
2280
2309
  renderInfo(chalk.red('\u23F9 STOPPED') + chalk.dim(' \u2014 All agents interrupted.'));
2281
- // Restore prompt so user can type again
2282
2310
  showPrompt();
2283
2311
  }
2284
2312
  }
@@ -4745,7 +4773,14 @@ async function handleSlashCommand(input, messages, agentHistory, config, spiralE
4745
4773
  }
4746
4774
  }
4747
4775
  else {
4748
- showReturningGreeting(identity);
4776
+ // Use chrome.writeOutput for greeting so it renders in scroll region
4777
+ // (direct process.stdout.write gets eaten by stdout hook during screen transition)
4778
+ if (chrome?.isActive) {
4779
+ chrome.writeOutput(showReturningGreeting(identity));
4780
+ }
4781
+ else {
4782
+ process.stdout.write(showReturningGreeting(identity));
4783
+ }
4749
4784
  // Autonomy level selection
4750
4785
  const currentLevel = jarvisCtx.autonomy.getLevel();
4751
4786
  const autonomyItems = [
@@ -5101,7 +5136,7 @@ async function handleSlashCommand(input, messages, agentHistory, config, spiralE
5101
5136
  else {
5102
5137
  renderInfo(`Usage: /jarvis [start|task|tasks|status|stop|pause|resume|clear|delete|local|global|name|telegram|skills|autonomy|learnings]`);
5103
5138
  }
5104
- break;
5139
+ return 'drain'; // Jarvis uses sub-menus (selectMenu) that need drain
5105
5140
  }
5106
5141
  case '/monitor': {
5107
5142
  if (!(await gateCheck('monitor', 'Security Monitor')))