@wrongstack/tui 0.300.0 → 0.301.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 (53) hide show
  1. package/dist/app-action-type.d.ts +12 -1
  2. package/dist/app-key-handler.d.ts +17 -14
  3. package/dist/app-settings-type.d.ts +2 -0
  4. package/dist/app-state.d.ts +11 -0
  5. package/dist/app-status-region.d.ts +2 -3
  6. package/dist/app-ui-state.d.ts +33 -40
  7. package/dist/app-view-contract.d.ts +3 -1
  8. package/dist/app-view-state.d.ts +9 -0
  9. package/dist/app.d.ts +2 -2
  10. package/dist/brain-panel-model.d.ts +13 -1
  11. package/dist/components/connections-panel.d.ts +1 -1
  12. package/dist/components/coordinator-panel.d.ts +1 -0
  13. package/dist/components/cron-jobs.d.ts +12 -0
  14. package/dist/components/history/assistant.d.ts +0 -22
  15. package/dist/components/history/index.d.ts +1 -1
  16. package/dist/components/history.d.ts +1 -1
  17. package/dist/components/monitor-shell.d.ts +3 -0
  18. package/dist/components/powerline-rail.d.ts +21 -0
  19. package/dist/components/settings-picker-model.d.ts +1 -1
  20. package/dist/components/settings-picker.d.ts +3 -1
  21. package/dist/components/sidebar-content.d.ts +33 -3
  22. package/dist/components/sidebar-panels.d.ts +4 -6
  23. package/dist/components/status-bar-chips.d.ts +1 -4
  24. package/dist/components/status-bar-format.d.ts +15 -26
  25. package/dist/components/status-bar-types.d.ts +18 -7
  26. package/dist/components/status-bar.d.ts +2 -2
  27. package/dist/components/statusline-detail-panel.d.ts +1 -1
  28. package/dist/components/statusline-picker.d.ts +8 -2
  29. package/dist/components/topic-check-panel.d.ts +7 -0
  30. package/dist/esc-close-panels.d.ts +11 -1
  31. package/dist/f-key-panels.d.ts +1 -1
  32. package/dist/hooks/use-app-picker-keys.d.ts +2 -2
  33. package/dist/hooks/use-git-session-status.d.ts +9 -1
  34. package/dist/hooks/use-next-steps-auto-submit.d.ts +2 -2
  35. package/dist/hooks/use-statusbar-view-model.d.ts +9 -1
  36. package/dist/hooks/use-subagent-events.d.ts +11 -0
  37. package/dist/hooks/use-terminal-size.d.ts +57 -0
  38. package/dist/hooks/use-tui-activity.d.ts +5 -2
  39. package/dist/index.js +34384 -33861
  40. package/dist/input-validation/action-types.d.ts +1 -1
  41. package/dist/input-validation.d.ts +1 -1
  42. package/dist/markdown-table.d.ts +5 -20
  43. package/dist/overlay-key-router.d.ts +27 -6
  44. package/dist/reducers/dialogs.d.ts +1 -1
  45. package/dist/settings-contracts.d.ts +7 -0
  46. package/dist/sidebar-sizing.d.ts +34 -0
  47. package/dist/submit-controller.d.ts +2 -2
  48. package/dist/submit-prompt-refinement.d.ts +1 -1
  49. package/dist/terminal-width.d.ts +18 -6
  50. package/dist/topic-shift-advisor.d.ts +2 -0
  51. package/dist/ui-contracts.d.ts +15 -4
  52. package/package.json +8 -7
  53. package/dist/hooks/use-terminal-render-lifecycle.d.ts +0 -4
@@ -1,11 +1,10 @@
1
- import type { AutonomyStage, TokenCounter, TokenSavingTier } from '@wrongstack/core/types';
2
1
  import type { EventBus } from '@wrongstack/core/kernel';
2
+ import type { AutonomyStage, TokenCounter, TokenSavingTier } from '@wrongstack/core/types';
3
3
  import type { GitInfo } from '../git-info.js';
4
- import type { HeapSample } from '../heap-watchdog.js';
4
+ import type { MemoryContextMonitorState } from '../memory-context-monitor.js';
5
5
  import type { AnimationStyle } from './animation-style.js';
6
6
  import type { StatuslineMode } from './settings-picker.js';
7
7
  import type { ChipMeta, StatuslineItem } from './statusline-picker.js';
8
- import type { MemoryContextMonitorState } from '../memory-context-monitor.js';
9
8
  export interface TodoCounts {
10
9
  pending: number;
11
10
  inProgress: number;
@@ -228,10 +227,6 @@ export interface StatusBarProps {
228
227
  droppedTools?: number | undefined;
229
228
  /** Number of tracked bash/exec processes from the process registry. Currently unused on the rail. */
230
229
  processCount?: number | undefined;
231
- /** Current RSS/heap sample for this CLI process. */
232
- processMemory?: HeapSample | undefined;
233
- /** CPU usage percentage (0-100). Derived from process.cpuUsage delta. Currently unused on the rail. */
234
- cpuPercent?: number | undefined;
235
230
  /** Items to hide from the status bar. Canonical set: {@link StatuslineItem}. */
236
231
  hiddenItems?: StatuslineItem[] | undefined;
237
232
  /**
@@ -379,5 +374,21 @@ export interface StatusBarProps {
379
374
  * the full terminal (e.g. beside a sidebar).
380
375
  */
381
376
  maxWidth?: number | undefined;
377
+ /**
378
+ * When provided, the bar publishes a fresh {@link StatusBarClickMap} on
379
+ * every render: the 0-based content-line index and column spans of each
380
+ * clickable chip, derived from the SAME segment nodes PowerlineRail
381
+ * draws. The app-level mouse handler resolves clicks against this map —
382
+ * it must never dead-reckon chip columns itself.
383
+ */
384
+ clickMapRef?: import('react').MutableRefObject<StatusBarClickMap | null> | undefined;
385
+ }
386
+ /** Column spans of clickable status-bar chips, per rendered content line. */
387
+ export interface StatusBarClickMap {
388
+ lines: Array<{
389
+ /** 0-based content-line index within the status-bar box (line 1 = 0). */
390
+ line: number;
391
+ spans: Array<import('./powerline-rail.js').RailSpan>;
392
+ }>;
382
393
  }
383
394
  //# sourceMappingURL=status-bar-types.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import type React from 'react';
2
2
  import type { StatusBarProps } from './status-bar-types.js';
3
- export { contextBarColor, fmtElapsed, fmtMemory, hasTokenDisplay, nodeText, planChipFit, renderMeter, renderProgress, stateChip, statusBarAutonomySpan, statusBarModelSpan, statusBarTodosSpan, type TokenDisplayTotals, tokenDisplayTotals, truncateChip, } from './status-bar-format.js';
3
+ export { contextBarColor, fmtElapsed, hasTokenDisplay, nodeText, planChipFit, renderMeter, renderProgress, stateChip, type TokenDisplayTotals, tokenDisplayTotals, truncateChip, } from './status-bar-format.js';
4
4
  export type { BrainStatusChip, ContextWindow, FleetAgentDetail, FleetCounts, MailboxStatus, PlanCounts, StatusBarProps, TaskCounts, TodoCounts, } from './status-bar-types.js';
5
5
  /** Minimum terminal width before we switch to ultra-compact mode. */
6
6
  export declare const COMPACT_THRESHOLD = 50;
@@ -11,5 +11,5 @@ export declare const COMPACT_THRESHOLD = 50;
11
11
  * to show — git branch, elapsed time, todo counts, YOLO marker — so a
12
12
  * vanilla session keeps the original single-line footprint.
13
13
  */
14
- export declare function StatusBar({ model, provider, version, latestVersion, updateAvailable, state, thinkingWord, thinkingAnimationStyle, tokenCounter, hint, queueCount, yolo, autonomy, fleetWorkingTime, todos, plan, tasks, fleet, fleetAgents, git, subagentCount, brain, projectName, workingDir, processCount, processMemory, cpuPercent, context, estimatedContextTokens, Sage, memoryContextMonitor, contextStrategy, hiddenItems, mode, events, sessionId, eternalStage, goalSummary, droppedTools, indexState, breakerCountdown, modeLabel, debugStreamStats, enhanceCountdown, nextStepsAutoSubmitCountdown, nextStepsAutoSubmitLabel, autoProceedCountdown, sessionCount, mailbox, tokenSavingMode, toolCount, visibleChips, sideEffectCount, maxWidth, }: StatusBarProps): React.ReactElement;
14
+ export declare function StatusBar({ model, provider, version, latestVersion, updateAvailable, state, thinkingWord, thinkingAnimationStyle, tokenCounter, hint, queueCount, yolo, autonomy, fleetWorkingTime, todos, plan, tasks, fleet, fleetAgents, git, subagentCount, brain, projectName, workingDir, processCount, context, estimatedContextTokens, Sage, memoryContextMonitor, contextStrategy, hiddenItems, mode, events, sessionId, eternalStage, goalSummary, droppedTools, indexState, breakerCountdown, modeLabel, debugStreamStats, enhanceCountdown, nextStepsAutoSubmitCountdown, nextStepsAutoSubmitLabel, autoProceedCountdown, sessionCount, mailbox, tokenSavingMode, toolCount, visibleChips, sideEffectCount, maxWidth, clickMapRef, }: StatusBarProps): React.ReactElement;
15
15
  //# sourceMappingURL=status-bar.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import { type StatusBarProps } from './status-bar.js';
2
+ import type { StatusBarProps } from './status-bar-types.js';
3
3
  /**
4
4
  * Detailed status panel showing all status line information in a structured
5
5
  * read-only view. Toggle via F12 picker's detail option or Esc to close.
@@ -1,6 +1,12 @@
1
1
  import type React from 'react';
2
- /** All possible statusline chip keys. */
3
- export type StatuslineItem = 'state' | 'model' | 'tokens' | 'cache' | 'queue' | 'hint' | 'index' | 'memory' | 'breaker' | 'todos' | 'plan' | 'tasks' | 'fleet' | 'fleet_agents' | 'git' | 'elapsed' | 'context' | 'cost' | 'cpu' | 'processes' | 'working_dir' | 'project' | 'yolo' | 'autonomy' | 'eternal_stage' | 'goal' | 'mode' | 'auto_proceed' | 'sessions' | 'tools' | 'token_saving' | 'brain' | 'mailbox' | 'enhance' | 'debug_stream' | 'next_steps' | 'memory_context' | 'side_effects';
2
+ /** All possible statusline chip keys.
3
+
4
+ * NOTE: `'cpu'` and `'memory'` were removed — CPU/RAM/heap metrics now live
5
+ * in the right sidebar's SYSTEM card (sidebar-content.tsx). Any stale entries
6
+ * in a saved statusline profile are silently ignored by `showChip` since no
7
+ * chip renders them anymore, mirroring how removed phantom items ('version',
8
+ * 'time', 'sage') are handled. */
9
+ export type StatuslineItem = 'state' | 'model' | 'tokens' | 'cache' | 'queue' | 'hint' | 'index' | 'breaker' | 'todos' | 'plan' | 'tasks' | 'fleet' | 'fleet_agents' | 'git' | 'elapsed' | 'context' | 'cost' | 'processes' | 'working_dir' | 'project' | 'yolo' | 'autonomy' | 'eternal_stage' | 'goal' | 'mode' | 'auto_proceed' | 'sessions' | 'tools' | 'token_saving' | 'brain' | 'mailbox' | 'enhance' | 'debug_stream' | 'next_steps' | 'memory_context' | 'side_effects';
4
10
  /**
5
11
  * Metadata for a temporarily-visible chip (one that appeared due to data,
6
12
  * not user toggle). Tracked so the chip can auto-expire.
@@ -0,0 +1,7 @@
1
+ import type React from 'react';
2
+ export interface TopicCheckPanelProps {
3
+ prompt: string;
4
+ }
5
+ /** Short-lived submit gate shown only when local continuity checks are ambiguous. */
6
+ export declare function TopicCheckPanel({ prompt }: TopicCheckPanelProps): React.ReactElement;
7
+ //# sourceMappingURL=topic-check-panel.d.ts.map
@@ -36,7 +36,17 @@ export declare const ESC_CLOSE_PANELS: readonly EscCloseEntry[];
36
36
  * Find the first open panel in the Esc-close table and return its close action.
37
37
  * Returns `null` when no panel is open. Called from the app-level `handleKey`
38
38
  * when Esc is pressed and no earlier handler (tryPickerKey, helpOverlay block,
39
- * F-key toggles, busy-interrupt) has consumed the key.
39
+ * F-key toggles) has consumed the key — BEFORE the busy-interrupt ladder, so
40
+ * Esc with a panel open means "close this panel", never "abort the run".
40
41
  */
41
42
  export declare function escCloseAction(state: State): Action | null;
43
+ /**
44
+ * Panels excluded from ESC_CLOSE_PANELS because their own `useInput` owns Esc
45
+ * (they need local state to interpret it — e.g. the kanban panel's inline
46
+ * prompt cancels on Esc instead of closing the panel). While one of these is
47
+ * open the central handler must still CONSUME Esc — otherwise the broadcast
48
+ * `useInput` model means the panel closes AND the busy-interrupt ladder aborts
49
+ * the run on the same keypress.
50
+ */
51
+ export declare function escSelfOwnedPanelOpen(state: State): boolean;
42
52
  //# sourceMappingURL=esc-close-panels.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { Action } from './app-reducer.js';
1
+ import type { Action } from './app-action-type.js';
2
2
  import type { StatuslineItem } from './components/statusline-picker.js';
3
3
  export type FKeyPanelAction = 'projectPickerOpen' | 'toggleMonitor' | 'toggleAgentsMonitor' | 'toggleWorktreeMonitor' | 'togglePlanPanel' | 'toggleTodosMonitor' | 'toggleQueuePanel' | 'toggleProcessList' | 'toggleKanbanPanel' | 'toggleGoalPanel' | 'toggleSessionsPanel' | 'toggleCoordinatorMonitor' | 'toggleCronMonitor' | 'toggleConnectionsPanel' | 'statuslineOpen';
4
4
  /** Host-side action keys that require work beyond a reducer dispatch. */
@@ -1,15 +1,15 @@
1
1
  import type { PromptUsageStore } from '@wrongstack/core/storage';
2
2
  import type { Dispatch, MutableRefObject } from 'react';
3
- import type { AppProps } from '../app-props.js';
4
3
  import type { Action } from '../app-action-type.js';
4
+ import type { AppProps } from '../app-props.js';
5
5
  import type { State } from '../app-state.js';
6
+ import type { StatuslineItem } from '../components/statusline-picker.js';
6
7
  import type { useAuthPanel } from './use-auth-panel.js';
7
8
  import type { useBrainPanel } from './use-brain-panel.js';
8
9
  import type { ModelPickRequestController } from './use-model-pick.js';
9
10
  import type { usePanelControllers } from './use-panel-controllers.js';
10
11
  import type { useStatusbarViewModel } from './use-statusbar-view-model.js';
11
12
  import type { useTuiEnvironmentState } from './use-tui-environment-state.js';
12
- import type { StatuslineItem } from '../components/statusline-picker.js';
13
13
  interface UseAppPickerKeysOptions {
14
14
  host: AppProps;
15
15
  state: State;
@@ -1,11 +1,19 @@
1
1
  import type { AppProps } from '../app-props.js';
2
+ import type { StatuslineItem } from '../components/statusline-picker.js';
2
3
  import { type GitInfo } from '../git-info.js';
3
4
  interface GitSessionStatusOptions {
4
5
  agent: AppProps['agent'];
5
6
  getLiveSessions: AppProps['getLiveSessions'];
6
7
  setSessionCount: (count: number) => void;
8
+ /**
9
+ * Statusline hidden items. The 10s git poll is the only consumer of
10
+ * `readGitInfo`, which spawns three `git` child processes per tick —
11
+ * when the `git` chip is user-hidden, skip the poll entirely until it
12
+ * is visible again.
13
+ */
14
+ hiddenItems?: readonly StatuslineItem[] | undefined;
7
15
  }
8
16
  /** Polls repository identity and the live-session count for status surfaces. */
9
- export declare function useGitSessionStatus({ agent, getLiveSessions, setSessionCount, }: GitSessionStatusOptions): GitInfo | null;
17
+ export declare function useGitSessionStatus({ agent, getLiveSessions, setSessionCount, hiddenItems, }: GitSessionStatusOptions): GitInfo | null;
10
18
  export {};
11
19
  //# sourceMappingURL=use-git-session-status.d.ts.map
@@ -1,9 +1,9 @@
1
- import type { ContentBlock } from '@wrongstack/core/types';
2
1
  import { type TodoItem } from '@wrongstack/core/agent';
2
+ import type { ContentBlock } from '@wrongstack/core/types';
3
3
  import { createAutoProceedLoopGuard } from '@wrongstack/tools/auto-proceed-loop-guard';
4
4
  import { type Dispatch, type MutableRefObject, type SetStateAction } from 'react';
5
- import type { AppProps } from '../app-props.js';
6
5
  import type { Action } from '../app-action-type.js';
6
+ import type { AppProps } from '../app-props.js';
7
7
  import type { State } from '../app-state.js';
8
8
  interface NextStepsAutoSubmitOptions {
9
9
  state: State;
@@ -1,6 +1,7 @@
1
1
  import { type ContextBreakdown } from '@wrongstack/core/utils';
2
2
  import type { AppProps } from '../app-props.js';
3
3
  import type { FleetEntry, State } from '../app-state.js';
4
+ import type { StatuslineItem } from '../components/statusline-picker.js';
4
5
  interface StatusbarViewModelOptions {
5
6
  agent: AppProps['agent'];
6
7
  tokenCounter: AppProps['tokenCounter'];
@@ -11,7 +12,14 @@ interface StatusbarViewModelOptions {
11
12
  liveTodos: readonly {
12
13
  status: string;
13
14
  }[];
15
+ sidebarVisible?: boolean | undefined;
14
16
  state: State;
17
+ /**
18
+ * Statusline hidden items. The plan/task chips are the only consumers of
19
+ * the 3s `fs.stat` polls in this hook — when the corresponding chip is
20
+ * user-hidden, skip the poll entirely until it is visible again.
21
+ */
22
+ hiddenItems?: readonly StatuslineItem[] | undefined;
15
23
  }
16
24
  interface PlanCounts {
17
25
  open: number;
@@ -26,7 +34,7 @@ interface TaskCounts {
26
34
  failed: number;
27
35
  }
28
36
  /** Builds status-bar projections without coupling them to the root App render. */
29
- export declare function useStatusbarViewModel({ agent, tokenCounter, activeMaxContext, effectiveMaxContext, liveProvider, liveModel, liveTodos, state, }: StatusbarViewModelOptions): {
37
+ export declare function useStatusbarViewModel({ agent, tokenCounter, activeMaxContext, effectiveMaxContext, liveProvider, liveModel, liveTodos, sidebarVisible, state, hiddenItems, }: StatusbarViewModelOptions): {
30
38
  contextBreakdown: ContextBreakdown | undefined;
31
39
  currentContextTokens: number;
32
40
  contextWindow: {
@@ -11,6 +11,17 @@ interface CompactionHistoryEvent {
11
11
  fullRequestTokensAfter?: number | undefined;
12
12
  };
13
13
  }
14
+ export declare function providerContextLimitHistoryEntry(event: {
15
+ providerId: string;
16
+ modelId: string;
17
+ maxContext: number;
18
+ previousMaxContext?: number | undefined;
19
+ source?: 'configured' | 'provider' | 'provider_overflow' | undefined;
20
+ decreased?: boolean | undefined;
21
+ }): {
22
+ kind: 'warn';
23
+ text: string;
24
+ } | null;
14
25
  export declare function compactionHistoryEntry(event: CompactionHistoryEvent, currentSessionId?: string | undefined): {
15
26
  kind: 'info' | 'warn';
16
27
  text: string;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * One subscription point for terminal size.
3
+ *
4
+ * Eleven components and hooks each did this by hand:
5
+ *
6
+ * ```ts
7
+ * const { stdout } = useStdout();
8
+ * const [w, setW] = useState(stdout?.columns ?? 90);
9
+ * useEffect(() => {
10
+ * const handleResize = () => setW(stdout?.columns ?? 90);
11
+ * handleResize();
12
+ * process.stdout.on('resize', handleResize);
13
+ * return () => process.stdout.off('resize', handleResize);
14
+ * }, [stdout]);
15
+ * ```
16
+ *
17
+ * Three problems, all of them invisible until they aren't:
18
+ *
19
+ * - **Listener budget.** Every copy attaches its own listener to
20
+ * `process.stdout`, and nothing raises the limit. Seven of these are
21
+ * mounted for the whole session (status bar, history, input,
22
+ * monitor-shell, sidebar frame, viewport sync, render lifecycle); open the
23
+ * fleet, mailbox and enhance panels and Node prints
24
+ * `MaxListenersExceededWarning` to stderr — straight through the middle of
25
+ * a rendered frame.
26
+ * - **Two different streams.** They SUBSCRIBE to `process.stdout` but READ
27
+ * from Ink's `useStdout()`. Those are the same object in a normal run and
28
+ * different objects under Ink's test renderer, where the listener then
29
+ * fires for a stream nobody reads.
30
+ * - **Three defaults.** `?? 90`, `?? 80` and `?? 24` all appear, so the same
31
+ * non-TTY produces different layouts in different panels.
32
+ *
33
+ * Core already exports `onResize(cb, stream)` for this and had no callers.
34
+ * This hook is the React shape of it: subscribe to the stream you read, with
35
+ * the fallback stated once per call site rather than remembered.
36
+ */
37
+ export interface TerminalSize {
38
+ readonly columns: number;
39
+ readonly rows: number;
40
+ }
41
+ export interface UseTerminalSizeOptions {
42
+ /**
43
+ * Upper bound applied to `columns`. Panels use this to stay inside a pinned
44
+ * content width — see the bordered-box overflow rule.
45
+ */
46
+ readonly maxWidth?: number | undefined;
47
+ /**
48
+ * Column count when the stream reports none (a pipe, a test renderer).
49
+ * Deliberately explicit: the call sites this replaced disagreed (90 vs 80),
50
+ * and quietly picking one would have moved layouts in non-TTY runs.
51
+ */
52
+ readonly fallbackColumns?: number | undefined;
53
+ /** Row count when the stream reports none. */
54
+ readonly fallbackRows?: number | undefined;
55
+ }
56
+ export declare function useTerminalSize(options?: UseTerminalSizeOptions): TerminalSize;
57
+ //# sourceMappingURL=use-terminal-size.d.ts.map
@@ -1,6 +1,5 @@
1
- import type { Agent } from '@wrongstack/core/agent';
1
+ import type { Agent, InputBuilder } from '@wrongstack/core/agent';
2
2
  import type { AttachmentStore } from '@wrongstack/core/types';
3
- import type { InputBuilder } from '@wrongstack/core/agent';
4
3
  import type { Action, State } from '../app-reducer.js';
5
4
  import { type HeapSample } from '../heap-watchdog.js';
6
5
  export interface UseTuiActivityOptions {
@@ -31,6 +30,10 @@ export declare function useTuiActivity({ status, fleet, enhanceBusy, thinkingWor
31
30
  fleetWorkingTimeMs: number;
32
31
  processMemory: HeapSample;
33
32
  cpuPercent: number | undefined;
33
+ cpuHistory: number[];
34
+ rssHistory: number[];
35
+ heapHistory: number[];
36
+ totalMem: number;
34
37
  enhanceDots: number;
35
38
  refreshGoalSummary: () => void;
36
39
  };