helixmind 0.5.25 → 0.5.27

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,CA4kHrE"}
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,CA0lHrE"}
@@ -2246,54 +2246,22 @@ export async function chatCommand(options) {
2246
2246
  }
2247
2247
  // Command suggestions are now handled by InputManager's built-in _interceptTtyWrite.
2248
2248
  // The panel opens/updates/closes automatically as the user types slash commands.
2249
- // === ESC detection ===
2249
+ // === ESC detection (single ESC = stop for normal agents) ===
2250
2250
  // Double-ESC (rewind browser) is handled by the raw data listener below.
2251
2251
  // Skip if a full-screen browser (Rewind/Plan) is open — it handles ESC itself.
2252
2252
  // Skip if ESC was used to close the suggestion panel (panelJustClosed flag)
2253
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.
2254
+ // Special modes (Jarvis, autonomous): ESC is handled ENTIRELY by the raw
2255
+ // data listener below the keypress handler does NOTHING for them.
2256
+ // This prevents conflicts between the two handlers and avoids cursor jumps
2257
+ // from hint messages. See raw data listener for: quick double-ESC → Rewind,
2258
+ // deliberate double-ESC (>1s gap) → stop special mode.
2257
2259
  if (key.name === 'escape' && !fullScreenBrowserOpen && !panelJustClosed) {
2258
2260
  const jarvisRunning = jarvisDaemonSession && jarvisDaemonSession.status === 'running';
2259
2261
  const specialMode = jarvisRunning || autonomousMode;
2260
2262
  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) {
2263
+ // Special modes: skip entirely — raw data handler manages ESC
2264
+ if (!specialMode && normalRunning) {
2297
2265
  // Normal agent work: single ESC = immediate stop (unchanged)
2298
2266
  closeSuggestionPanel();
2299
2267
  activity.stop('Stopped');
@@ -2381,21 +2349,58 @@ export async function chatCommand(options) {
2381
2349
  // Bare ESC = exactly 1 byte: \x1b
2382
2350
  // Double ESC = exactly 2 bytes: \x1b\x1b
2383
2351
  // Anything else starting with \x1b is an ANSI escape sequence → ignore
2352
+ // Detect special mode (Jarvis/autonomous) — ESC handling is done entirely here
2353
+ const isSpecialMode = !!(jarvisDaemonSession && jarvisDaemonSession.status === 'running') || autonomousMode;
2384
2354
  if (bytes.length === 2 && bytes[0] === 0x1b && bytes[1] === 0x1b) {
2385
- // Double-ESC in one chunk → open rewind immediately
2355
+ // Double-ESC in one chunk → open rewind immediately (all modes)
2386
2356
  lastRawEscTime = 0;
2357
+ lastSpecialEscTime = 0;
2387
2358
  await openRewindBrowser();
2388
2359
  return;
2389
2360
  }
2390
2361
  if (bytes.length === 1 && bytes[0] === 0x1b) {
2391
- // Single bare ESC — check timing for double-ESC
2392
2362
  const now = Date.now();
2363
+ // Quick double-ESC detection (<800ms) → Rewind (all modes)
2393
2364
  if (now - lastRawEscTime < RAW_ESC_THRESHOLD && lastRawEscTime > 0) {
2394
2365
  lastRawEscTime = 0;
2366
+ lastSpecialEscTime = 0;
2395
2367
  await openRewindBrowser();
2368
+ return;
2396
2369
  }
2397
- else {
2398
- lastRawEscTime = now;
2370
+ // Special mode: deliberate double-ESC (>1s gap) → stop
2371
+ if (isSpecialMode && lastSpecialEscTime > 0 && (now - lastSpecialEscTime) >= 1000) {
2372
+ lastSpecialEscTime = 0;
2373
+ lastRawEscTime = 0;
2374
+ activity.stop('Stopped');
2375
+ agentController.abort();
2376
+ sessionMgr.abortAll();
2377
+ if (activeSwarm) {
2378
+ activeSwarm.abort();
2379
+ activeSwarm = null;
2380
+ }
2381
+ autonomousMode = false;
2382
+ const jarvisRunning = jarvisDaemonSession && jarvisDaemonSession.status === 'running';
2383
+ if (jarvisRunning) {
2384
+ jarvisDaemonSession.abort();
2385
+ jarvisDaemonSession = null;
2386
+ jarvisQueue.setDaemonState('stopped');
2387
+ jarvisPaused = false;
2388
+ releaseJarvisSlot();
2389
+ }
2390
+ typeAheadBuffer.length = 0;
2391
+ agentRunning = false;
2392
+ renderInfo(chalk.red('\u23F9 STOPPED') + chalk.dim(' \u2014 Special mode exited.'));
2393
+ showPrompt();
2394
+ return;
2395
+ }
2396
+ // Record ESC time for next detection
2397
+ lastRawEscTime = now;
2398
+ if (isSpecialMode) {
2399
+ lastSpecialEscTime = now;
2400
+ // Brief hint via chrome row (no scroll region write = no cursor jump)
2401
+ chrome.setRow(0, chalk.dim('\u23F8 ESC \u2014 double-ESC: Rewind | wait 1s + ESC: stop'));
2402
+ // Auto-restore chrome row 0 after 2 seconds
2403
+ setTimeout(() => { chrome.drawFrameBottom(); }, 2000);
2399
2404
  }
2400
2405
  return;
2401
2406
  }
@@ -4773,7 +4778,14 @@ async function handleSlashCommand(input, messages, agentHistory, config, spiralE
4773
4778
  }
4774
4779
  }
4775
4780
  else {
4776
- showReturningGreeting(identity);
4781
+ // Use chrome.writeOutput for greeting so it renders in scroll region
4782
+ // (direct process.stdout.write gets eaten by stdout hook during screen transition)
4783
+ if (chrome?.isActive) {
4784
+ chrome.writeOutput(showReturningGreeting(identity));
4785
+ }
4786
+ else {
4787
+ process.stdout.write(showReturningGreeting(identity));
4788
+ }
4777
4789
  // Autonomy level selection
4778
4790
  const currentLevel = jarvisCtx.autonomy.getLevel();
4779
4791
  const autonomyItems = [
@@ -5129,7 +5141,7 @@ async function handleSlashCommand(input, messages, agentHistory, config, spiralE
5129
5141
  else {
5130
5142
  renderInfo(`Usage: /jarvis [start|task|tasks|status|stop|pause|resume|clear|delete|local|global|name|telegram|skills|autonomy|learnings]`);
5131
5143
  }
5132
- break;
5144
+ return 'drain'; // Jarvis uses sub-menus (selectMenu) that need drain
5133
5145
  }
5134
5146
  case '/monitor': {
5135
5147
  if (!(await gateCheck('monitor', 'Security Monitor')))