pyre-cli 9.0.0 → 9.1.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.
package/src/live/state.ts CHANGED
@@ -19,6 +19,8 @@ import { type SplashColorScheme, type SplashAnimation } from '../splash.js';
19
19
 
20
20
  export { type SplashColorScheme, type SplashAnimation };
21
21
 
22
+ export const MENU_OPTIONS = ['Resume Dashboard', 'Settings (Customizer)', 'Readme', 'Credits', 'Quit pyre'] as const;
23
+
22
24
  const config = readConfig();
23
25
 
24
26
  const state = {
@@ -60,6 +62,10 @@ const state = {
60
62
  termHeight: process.stdout.rows || 24,
61
63
  sortMode: config.sortMode as SortMode,
62
64
  processFilter: '',
65
+ processSelectionIndex: 0,
66
+ processScrollOffset: 0,
67
+ trackedPid: null as number | null,
68
+ inspectingProcess: null as any | null,
63
69
  inputMode: null as InputMode,
64
70
  inputBuffer: '',
65
71
  targetPid: '',
@@ -126,6 +132,7 @@ const state = {
126
132
  splashEnabled: config.splashEnabled,
127
133
  splashColorScheme: config.splashColorScheme as SplashColorScheme,
128
134
  splashAnimation: config.splashAnimation as SplashAnimation,
135
+ readmeScrollOffset: 0,
129
136
  };
130
137
 
131
138
  function setStatus(msg: string, ms = 3000) {
package/src/live/types.ts CHANGED
@@ -20,7 +20,7 @@ export interface LiveOptions {
20
20
 
21
21
  export type ExportFormat = 'json' | 'csv' | 'tsv' | 'html' | 'md';
22
22
 
23
- type InputMode = null | 'filter' | 'kill' | 'signal' | 'customizer' | 'p2p';
23
+ type InputMode = null | 'filter' | 'kill' | 'signal' | 'customizer' | 'p2p' | 'menu' | 'readme' | 'credits';
24
24
 
25
25
  type SortMode = 'cpu' | 'mem' | 'pid' | 'user' | 'command' | 'state' | 'threads' | 'runtime';
26
26
 
@@ -401,6 +401,17 @@ export async function collectCpu(): Promise<CpuData> {
401
401
  }
402
402
  }
403
403
 
404
+ if (frequency === 0) {
405
+ try {
406
+ const cpus = os.cpus();
407
+ if (cpus && cpus.length > 0 && cpus[0].speed) {
408
+ frequency = cpus[0].speed;
409
+ }
410
+ } catch {
411
+ // ignore
412
+ }
413
+ }
414
+
404
415
  // Use os.cpus() delta instead of the very slow `top -l 1 -n 0` which
405
416
  // blocks for ~1-2s waiting for a sampling window. os.cpus() is instant.
406
417
  let usage = 0;