@yaag/tui 0.6.0 → 0.6.2

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 (50) hide show
  1. package/package.json +2 -2
  2. package/src/{drill-controller.ts → drill/drill-controller.ts} +15 -10
  3. package/src/{drill-keys.ts → drill/drill-keys.ts} +1 -1
  4. package/src/{drill-state.ts → drill/drill-state.ts} +3 -2
  5. package/src/drill/index.ts +25 -0
  6. package/src/index.ts +90 -86
  7. package/src/node/index.ts +13 -0
  8. package/src/{node-actions.ts → node/node-actions.ts} +1 -1
  9. package/src/{node-table.ts → node/node-table.ts} +1 -1
  10. package/src/overlay/index.ts +28 -0
  11. package/src/{overlay-frame.ts → overlay/overlay-frame.ts} +1 -1
  12. package/src/{system-prompt-overlay.ts → overlay/system-prompt-overlay.ts} +1 -1
  13. package/src/text/index.ts +9 -0
  14. package/src/transcript/index.ts +13 -0
  15. package/src/{session-keys.ts → transcript/session-keys.ts} +1 -1
  16. package/src/{ask-ledger.ts → tree/ask-ledger.ts} +1 -1
  17. package/src/{details-pane.ts → tree/details-pane.ts} +1 -1
  18. package/src/tree/index.ts +27 -0
  19. package/src/{tree-keys.ts → tree/tree-keys.ts} +2 -2
  20. package/src/{tree-model.ts → tree/tree-model.ts} +7 -4
  21. package/src/{tree-nested.ts → tree/tree-nested.ts} +2 -4
  22. package/src/{tree-render.ts → tree/tree-render.ts} +2 -4
  23. package/src/{tree-rows.ts → tree/tree-rows.ts} +1 -1
  24. package/src/{tree-state.ts → tree/tree-state.ts} +1 -1
  25. package/src/{compact-render.ts → view/compact-render.ts} +3 -7
  26. package/src/view/index.ts +23 -0
  27. package/src/{inline-render.ts → view/inline-render.ts} +4 -4
  28. package/src/{run-tree-view.ts → view/run-tree-view.ts} +6 -9
  29. package/src/{run-view-result.ts → view/run-view-result.ts} +1 -1
  30. package/src/{run-view-state.ts → view/run-view-state.ts} +1 -1
  31. package/src/{snapshot-render.ts → view/snapshot-render.ts} +4 -4
  32. /package/src/{node-path-parse.ts → node/node-path-parse.ts} +0 -0
  33. /package/src/{overlay-geometry.ts → overlay/overlay-geometry.ts} +0 -0
  34. /package/src/{overlay-scroll.ts → overlay/overlay-scroll.ts} +0 -0
  35. /package/src/{stop-prompt.ts → overlay/stop-prompt.ts} +0 -0
  36. /package/src/{transcript-overlay.ts → overlay/transcript-overlay.ts} +0 -0
  37. /package/src/{accounting-text.ts → text/accounting-text.ts} +0 -0
  38. /package/src/{activity-text.ts → text/activity-text.ts} +0 -0
  39. /package/src/{duration-text.ts → text/duration-text.ts} +0 -0
  40. /package/src/{terminal-text.ts → text/terminal-text.ts} +0 -0
  41. /package/src/{wrap-text.ts → text/wrap-text.ts} +0 -0
  42. /package/src/{session-transcript.ts → transcript/session-transcript.ts} +0 -0
  43. /package/src/{transcript-content.ts → transcript/transcript-content.ts} +0 -0
  44. /package/src/{transcript-render.ts → transcript/transcript-render.ts} +0 -0
  45. /package/src/{tree-cursor.ts → tree/tree-cursor.ts} +0 -0
  46. /package/src/{tree-fold.ts → tree/tree-fold.ts} +0 -0
  47. /package/src/{tree-glyphs.ts → tree/tree-glyphs.ts} +0 -0
  48. /package/src/{tree-navigation.ts → tree/tree-navigation.ts} +0 -0
  49. /package/src/{tree-navigator.ts → tree/tree-navigator.ts} +0 -0
  50. /package/src/{tree-node.ts → tree/tree-node.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaag/tui",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -19,6 +19,6 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@earendil-works/pi-tui": "^0.84.0",
22
- "@yaag/runtime": "0.6.0"
22
+ "@yaag/runtime": "0.6.2"
23
23
  }
24
24
  }
@@ -10,6 +10,21 @@
10
10
  * cadence.
11
11
  */
12
12
  import type { AgentInfo } from "@yaag/runtime";
13
+ import type { NamedKeybindings } from "../key-router.ts";
14
+ import { agentOfPath, renderActionsMenu } from "../node/index.ts";
15
+ import {
16
+ overlayContentRows,
17
+ overlayPanelRows,
18
+ renderSystemPromptOverlay,
19
+ renderTranscriptOverlay,
20
+ systemPromptLines,
21
+ } from "../overlay/index.ts";
22
+ import {
23
+ extractSystemPrompt,
24
+ NO_TRANSCRIPT_STUB,
25
+ nodeTranscriptLines,
26
+ } from "../transcript/index.ts";
27
+ import type { TreeNavigator } from "../tree/index.ts";
13
28
  import { routeDrillKey, routeMenuKey, routeOverlayKey } from "./drill-keys.ts";
14
29
  import {
15
30
  type AnyDrillAction,
@@ -18,16 +33,6 @@ import {
18
33
  type DrillState,
19
34
  emptyDrill,
20
35
  } from "./drill-state.ts";
21
- import type { NamedKeybindings } from "./key-router.ts";
22
- import { renderActionsMenu } from "./node-actions.ts";
23
- import { agentOfPath } from "./node-path-parse.ts";
24
- import { overlayContentRows, overlayPanelRows } from "./overlay-geometry.ts";
25
- import { extractSystemPrompt } from "./session-transcript.ts";
26
- import { renderSystemPromptOverlay, systemPromptLines } from "./system-prompt-overlay.ts";
27
- import { nodeTranscriptLines } from "./transcript-content.ts";
28
- import { renderTranscriptOverlay } from "./transcript-overlay.ts";
29
- import { NO_TRANSCRIPT_STUB } from "./transcript-render.ts";
30
- import type { TreeNavigator } from "./tree-navigator.ts";
31
36
 
32
37
  /** Shown when a session file records no system prompt (spec §5). */
33
38
  const NO_SYSTEM_PROMPT = "(no system prompt recorded in this session file)";
@@ -8,7 +8,7 @@
8
8
  * the bare `escape` literal, and both sit after the arrow entries, so an
9
9
  * ESC-prefixed arrow sequence scrolls rather than closing the layer.
10
10
  */
11
- import { type KeyBinding, type NamedKeybindings, routeKey } from "./key-router.ts";
11
+ import { type KeyBinding, type NamedKeybindings, routeKey } from "../key-router.ts";
12
12
 
13
13
  /** A drill gesture the tree layer consumes. */
14
14
  export type DrillAction = "openMenu" | "openTranscript" | "back";
@@ -9,9 +9,10 @@
9
9
  * non-overlay `ctx.ui.custom()` view removes the view and stops pi's input
10
10
  * loop, so the system prompt is a layer of this machine (ADR-0034).
11
11
  */
12
+
13
+ import { moveMenuCursor, NODE_ACTIONS } from "../node/index.ts";
14
+ import { initialScroll, type Scroll, scrollBy, topScroll } from "../overlay/index.ts";
12
15
  import type { DrillAction, MenuAction, OverlayAction } from "./drill-keys.ts";
13
- import { moveMenuCursor, NODE_ACTIONS } from "./node-actions.ts";
14
- import { initialScroll, type Scroll, scrollBy, topScroll } from "./overlay-scroll.ts";
15
16
 
16
17
  /** Which layer holds input focus. */
17
18
  export type DrillState =
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Public surface of the `drill/` module: the drill-in controller, state, and keys.
3
+ * Files inside this directory import each other directly.
4
+ */
5
+ export { DrillController, type DrillHost } from "./drill-controller.ts";
6
+ export {
7
+ DRILL_KEY_TABLE,
8
+ type DrillAction,
9
+ MENU_KEY_TABLE,
10
+ type MenuAction,
11
+ OVERLAY_KEY_TABLE,
12
+ type OverlayAction,
13
+ routeDrillKey,
14
+ routeMenuKey,
15
+ routeOverlayKey,
16
+ } from "./drill-keys.ts";
17
+ export {
18
+ type AnyDrillAction,
19
+ applyDrillAction,
20
+ type DrillContext,
21
+ type DrillEffect,
22
+ type DrillState,
23
+ type DrillTransition,
24
+ emptyDrill,
25
+ } from "./drill-state.ts";
package/src/index.ts CHANGED
@@ -1,15 +1,15 @@
1
- export { costText, tokensText } from "./accounting-text.ts";
2
- export { activityText } from "./activity-text.ts";
3
- export { AGENT_ASK_LEDGER_MAX, type AskLedger, type AskRow } from "./ask-ledger.ts";
4
- export {
5
- type CompactRenderOptions,
6
- compactAgentLine,
7
- renderCompact,
8
- } from "./compact-render.ts";
9
- export { DrillController, type DrillHost } from "./drill-controller.ts";
10
1
  export {
2
+ type AnyDrillAction,
3
+ applyDrillAction,
11
4
  DRILL_KEY_TABLE,
12
5
  type DrillAction,
6
+ type DrillContext,
7
+ DrillController,
8
+ type DrillEffect,
9
+ type DrillHost,
10
+ type DrillState,
11
+ type DrillTransition,
12
+ emptyDrill,
13
13
  MENU_KEY_TABLE,
14
14
  type MenuAction,
15
15
  OVERLAY_KEY_TABLE,
@@ -17,113 +17,117 @@ export {
17
17
  routeDrillKey,
18
18
  routeMenuKey,
19
19
  routeOverlayKey,
20
- } from "./drill-keys.ts";
21
- export {
22
- type AnyDrillAction,
23
- applyDrillAction,
24
- type DrillContext,
25
- type DrillEffect,
26
- type DrillState,
27
- type DrillTransition,
28
- emptyDrill,
29
- } from "./drill-state.ts";
30
- export { durationText } from "./duration-text.ts";
31
- export { type InlineRenderOptions, renderInlineRun } from "./inline-render.ts";
20
+ } from "./drill/index.ts";
32
21
  export { type KeyBinding, type NamedKeybindings, routeKey } from "./key-router.ts";
33
22
  export {
23
+ agentOfPath,
34
24
  moveMenuCursor,
35
25
  NODE_ACTIONS,
36
26
  type NodeAction,
37
27
  type NodeActionRow,
28
+ type NodePathSegment,
29
+ parseNodePath,
38
30
  renderActionsMenu,
39
- } from "./node-actions.ts";
40
- export { agentOfPath, type NodePathSegment, parseNodePath } from "./node-path-parse.ts";
41
- export { renderNodeTable } from "./node-table.ts";
42
- export { type FramedBoxOptions, renderFramedBox } from "./overlay-frame.ts";
31
+ renderNodeTable,
32
+ } from "./node/index.ts";
43
33
  export {
34
+ type FramedBoxOptions,
35
+ initialScroll,
36
+ maxOffset,
37
+ moveStopCursor,
44
38
  OVERLAY_CHROME_ROWS,
45
39
  overlayContentRows,
46
40
  overlayPanelRows,
47
- } from "./overlay-geometry.ts";
48
- export {
49
- initialScroll,
50
- maxOffset,
41
+ renderFramedBox,
42
+ renderStopPrompt,
43
+ renderSystemPromptOverlay,
44
+ renderTranscriptOverlay,
51
45
  resolveOffset,
52
46
  type Scroll,
53
- scrollBy,
54
- } from "./overlay-scroll.ts";
55
- export {
56
- createRunTreeView,
57
- type RunTreeView,
58
- type RunTreeViewHost,
59
- type RunTreeViewOptions,
60
- } from "./run-tree-view.ts";
61
- export { type RunViewResult, resultText, STDERR_TAIL_LINES } from "./run-view-result.ts";
62
- export {
63
- applyRunViewAction,
64
- livePhase,
65
- type RunPhase,
66
- type RunViewAction,
67
- type RunViewEffect,
68
- type RunViewOutcome,
69
- type RunViewTransition,
70
- } from "./run-view-state.ts";
71
- export { routeSessionKey, SESSION_KEY_TABLE, type SessionAction } from "./session-keys.ts";
72
- export {
73
- extractSystemPrompt,
74
- parseTranscript,
75
- type TranscriptItem,
76
- } from "./session-transcript.ts";
77
- export { renderSnapshot, type SnapshotRenderOptions } from "./snapshot-render.ts";
78
- export {
79
- moveStopCursor,
80
- renderStopPrompt,
81
47
  STOP_PROMPT_CHOICES,
82
48
  type StopChoice,
83
49
  type StopChoiceRow,
84
50
  type StopPromptOptions,
85
- } from "./stop-prompt.ts";
86
- export {
87
- renderSystemPromptOverlay,
88
51
  type SystemPromptOverlayOptions,
89
- } from "./system-prompt-overlay.ts";
90
- export { clampToWidth, sanitizeTerminalLine, sanitizeTerminalText } from "./terminal-text.ts";
91
- export { type NodeTranscriptOptions, nodeTranscriptLines } from "./transcript-content.ts";
92
- export {
93
- renderTranscriptOverlay,
52
+ scrollBy,
94
53
  type TranscriptOverlayOptions,
95
- } from "./transcript-overlay.ts";
54
+ } from "./overlay/index.ts";
55
+ export {
56
+ activityText,
57
+ clampToWidth,
58
+ costText,
59
+ durationText,
60
+ sanitizeTerminalLine,
61
+ sanitizeTerminalText,
62
+ tokensText,
63
+ } from "./text/index.ts";
96
64
  export {
65
+ extractSystemPrompt,
97
66
  NO_TRANSCRIPT_STUB,
67
+ type NodeTranscriptOptions,
68
+ nodeTranscriptLines,
69
+ parseTranscript,
98
70
  renderTranscript,
71
+ routeSessionKey,
72
+ SESSION_KEY_TABLE,
73
+ type SessionAction,
74
+ type TranscriptItem,
99
75
  type TranscriptViewOptions,
100
76
  transcriptHeader,
101
- } from "./transcript-render.ts";
102
- export {
77
+ } from "./transcript/index.ts";
78
+ export type { TreeNode, TreeNodeKind, TreeNodeState } from "./tree/index.ts";
79
+ export {
80
+ AGENT_ASK_LEDGER_MAX,
81
+ type AskLedger,
82
+ type AskRow,
83
+ applyTreeAction,
84
+ buildTree,
85
+ cliKeybindings,
86
+ emptyFold,
87
+ emptyView,
88
+ type FoldState,
89
+ GLYPHS,
90
+ isExpanded,
103
91
  moveSelection,
104
92
  nodeAt,
105
93
  nodeChain,
106
94
  parentOf,
95
+ renderTree,
107
96
  resolveSelection,
108
- } from "./tree-cursor.ts";
109
- export {
110
- emptyFold,
111
- type FoldState,
112
- isExpanded,
113
- type VisibleRow,
114
- visibleRows,
115
- } from "./tree-fold.ts";
116
- export { GLYPHS } from "./tree-glyphs.ts";
117
- export {
118
- cliKeybindings,
119
97
  routeTreeKey,
120
98
  TREE_KEY_TABLE,
121
99
  type TreeAction,
122
100
  type TreeKeyBinding,
123
- } from "./tree-keys.ts";
124
- export { buildTree, type TreeModelOptions } from "./tree-model.ts";
125
- export { applyTreeAction, emptyView, type TreeView } from "./tree-navigation.ts";
126
- export { TreeNavigator, type TreeNavigatorOptions } from "./tree-navigator.ts";
127
- export type { TreeNode, TreeNodeKind, TreeNodeState } from "./tree-node.ts";
128
- export { renderTree, type TreeRenderOptions } from "./tree-render.ts";
129
- export { TreeState, type TreeUpdate } from "./tree-state.ts";
101
+ type TreeModelOptions,
102
+ TreeNavigator,
103
+ type TreeNavigatorOptions,
104
+ type TreeRenderOptions,
105
+ TreeState,
106
+ type TreeUpdate,
107
+ type TreeView,
108
+ type VisibleRow,
109
+ visibleRows,
110
+ } from "./tree/index.ts";
111
+ export {
112
+ applyRunViewAction,
113
+ type CompactRenderOptions,
114
+ compactAgentLine,
115
+ createRunTreeView,
116
+ type InlineRenderOptions,
117
+ livePhase,
118
+ type RunPhase,
119
+ type RunTreeView,
120
+ type RunTreeViewHost,
121
+ type RunTreeViewOptions,
122
+ type RunViewAction,
123
+ type RunViewEffect,
124
+ type RunViewOutcome,
125
+ type RunViewResult,
126
+ type RunViewTransition,
127
+ renderCompact,
128
+ renderInlineRun,
129
+ renderSnapshot,
130
+ resultText,
131
+ type SnapshotRenderOptions,
132
+ STDERR_TAIL_LINES,
133
+ } from "./view/index.ts";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Public surface of the `node/` module: Node actions, path parsing, and the Node table.
3
+ * Files inside this directory import each other directly.
4
+ */
5
+ export {
6
+ moveMenuCursor,
7
+ NODE_ACTIONS,
8
+ type NodeAction,
9
+ type NodeActionRow,
10
+ renderActionsMenu,
11
+ } from "./node-actions.ts";
12
+ export { agentOfPath, type NodePathSegment, parseNodePath } from "./node-path-parse.ts";
13
+ export { renderNodeTable } from "./node-table.ts";
@@ -3,7 +3,7 @@
3
3
  * action set of spec §5. A Peek observes and never sends, so no action here can
4
4
  * prompt an Agent or stop a Run (ADR — Peek).
5
5
  */
6
- import { renderFramedBox } from "./overlay-frame.ts";
6
+ import { renderFramedBox } from "../overlay/index.ts";
7
7
 
8
8
  /** One thing a reader may do with the selected node. */
9
9
  export type NodeAction = "viewTranscript" | "copySessionPath" | "viewSystemPrompt";
@@ -1,5 +1,5 @@
1
1
  import type { AgentInfo, NodeInfo } from "@yaag/runtime";
2
- import { clampToWidth, sanitizeTerminalLine } from "./terminal-text.ts";
2
+ import { clampToWidth, sanitizeTerminalLine } from "../text/index.ts";
3
3
 
4
4
  /** Running Nested Nodes drawn for one Agent before the roll-up line. */
5
5
  const RUNNING_NODE_LINES = 8;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Public surface of the `overlay/` module: overlay frames, geometry, scroll, and prompts.
3
+ * Files inside this directory import each other directly.
4
+ */
5
+ export { type FramedBoxOptions, renderFramedBox } from "./overlay-frame.ts";
6
+ export { OVERLAY_CHROME_ROWS, overlayContentRows, overlayPanelRows } from "./overlay-geometry.ts";
7
+ export {
8
+ initialScroll,
9
+ maxOffset,
10
+ resolveOffset,
11
+ type Scroll,
12
+ scrollBy,
13
+ topScroll,
14
+ } from "./overlay-scroll.ts";
15
+ export {
16
+ moveStopCursor,
17
+ renderStopPrompt,
18
+ STOP_PROMPT_CHOICES,
19
+ type StopChoice,
20
+ type StopChoiceRow,
21
+ type StopPromptOptions,
22
+ } from "./stop-prompt.ts";
23
+ export {
24
+ renderSystemPromptOverlay,
25
+ type SystemPromptOverlayOptions,
26
+ systemPromptLines,
27
+ } from "./system-prompt-overlay.ts";
28
+ export { renderTranscriptOverlay, type TranscriptOverlayOptions } from "./transcript-overlay.ts";
@@ -1,5 +1,5 @@
1
1
  import { visibleWidth } from "@earendil-works/pi-tui";
2
- import { clampToWidth, sanitizeTerminalLine } from "./terminal-text.ts";
2
+ import { clampToWidth, sanitizeTerminalLine } from "../text/index.ts";
3
3
 
4
4
  /** The box-drawing glyphs the normative overlay mockup uses. */
5
5
  const FRAME = {
@@ -11,10 +11,10 @@
11
11
  * arrays. It holds no clock and no I/O.
12
12
  */
13
13
 
14
+ import { wrapLines } from "../text/index.ts";
14
15
  import { renderFramedBox } from "./overlay-frame.ts";
15
16
  import { overlayContentRows } from "./overlay-geometry.ts";
16
17
  import { resolveOffset, type Scroll } from "./overlay-scroll.ts";
17
- import { wrapLines } from "./wrap-text.ts";
18
18
 
19
19
  const FOOTER = " ↑↓ scroll c copy path esc back";
20
20
 
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Public surface of the `text/` module: plain text formatters.
3
+ * Files inside this directory import each other directly.
4
+ */
5
+ export { costText, tokensText } from "./accounting-text.ts";
6
+ export { activityText } from "./activity-text.ts";
7
+ export { durationText } from "./duration-text.ts";
8
+ export { clampToWidth, sanitizeTerminalLine, sanitizeTerminalText } from "./terminal-text.ts";
9
+ export { wrapLines } from "./wrap-text.ts";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Public surface of the `transcript/` module: the session transcript and its rendering.
3
+ * Files inside this directory import each other directly.
4
+ */
5
+ export { routeSessionKey, SESSION_KEY_TABLE, type SessionAction } from "./session-keys.ts";
6
+ export { extractSystemPrompt, parseTranscript, type TranscriptItem } from "./session-transcript.ts";
7
+ export { type NodeTranscriptOptions, nodeTranscriptLines } from "./transcript-content.ts";
8
+ export {
9
+ NO_TRANSCRIPT_STUB,
10
+ renderTranscript,
11
+ type TranscriptViewOptions,
12
+ transcriptHeader,
13
+ } from "./transcript-render.ts";
@@ -12,7 +12,7 @@
12
12
  * the byte before this component sees it. Plain `q` is bound to nothing, so a
13
13
  * reader who types `q` in the tree changes nothing (ADR-0008).
14
14
  */
15
- import { type KeyBinding, type NamedKeybindings, routeKey } from "./key-router.ts";
15
+ import { type KeyBinding, type NamedKeybindings, routeKey } from "../key-router.ts";
16
16
 
17
17
  /** The one gesture the session layer consumes. */
18
18
  export type SessionAction = "quit";
@@ -1,5 +1,5 @@
1
1
  import type { LifecycleEvent } from "@yaag/runtime";
2
- import { sanitizeTerminalLine } from "./terminal-text.ts";
2
+ import { sanitizeTerminalLine } from "../text/index.ts";
3
3
 
4
4
  /** Maximum Ask rows one Agent's renderer-only ledger retains (mirrors the node table cap). */
5
5
  export const AGENT_ASK_LEDGER_MAX = 64;
@@ -1,4 +1,4 @@
1
- import { clampToWidth, sanitizeTerminalLine } from "./terminal-text.ts";
1
+ import { clampToWidth, sanitizeTerminalLine } from "../text/index.ts";
2
2
  import { stateGlyph } from "./tree-glyphs.ts";
3
3
  import type { TreeNode } from "./tree-node.ts";
4
4
 
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Public surface of the `tree/` module: the Run tree model, state, render, and navigation.
3
+ * Files inside this directory import each other directly.
4
+ */
5
+ export { AGENT_ASK_LEDGER_MAX, type AskLedger, type AskRow } from "./ask-ledger.ts";
6
+ export { moveSelection, nodeAt, nodeChain, parentOf, resolveSelection } from "./tree-cursor.ts";
7
+ export {
8
+ emptyFold,
9
+ type FoldState,
10
+ isExpanded,
11
+ type VisibleRow,
12
+ visibleRows,
13
+ } from "./tree-fold.ts";
14
+ export { GLYPHS, stateGlyph } from "./tree-glyphs.ts";
15
+ export {
16
+ cliKeybindings,
17
+ routeTreeKey,
18
+ TREE_KEY_TABLE,
19
+ type TreeAction,
20
+ type TreeKeyBinding,
21
+ } from "./tree-keys.ts";
22
+ export { buildTree, type TreeModelOptions } from "./tree-model.ts";
23
+ export { applyTreeAction, emptyView, type TreeView } from "./tree-navigation.ts";
24
+ export { TreeNavigator, type TreeNavigatorOptions } from "./tree-navigator.ts";
25
+ export type { TreeNode, TreeNodeKind, TreeNodeState } from "./tree-node.ts";
26
+ export { renderTree, type TreeRenderOptions } from "./tree-render.ts";
27
+ export { TreeState, type TreeUpdate } from "./tree-state.ts";
@@ -1,5 +1,5 @@
1
1
  import { getKeybindings } from "@earendil-works/pi-tui";
2
- import { type KeyBinding, type NamedKeybindings, routeKey } from "./key-router.ts";
2
+ import { type KeyBinding, type NamedKeybindings, routeKey } from "../key-router.ts";
3
3
 
4
4
  /** One navigation gesture the tree consumes (spec §2). */
5
5
  export type TreeAction = "selectUp" | "selectDown" | "collapse" | "expand";
@@ -42,4 +42,4 @@ export function cliKeybindings(): NamedKeybindings {
42
42
  return getKeybindings();
43
43
  }
44
44
 
45
- export type { NamedKeybindings } from "./key-router.ts";
45
+ export type { NamedKeybindings } from "../key-router.ts";
@@ -1,9 +1,12 @@
1
1
  import type { AgentInfo } from "@yaag/runtime";
2
- import { costText, tokensText } from "./accounting-text.ts";
3
- import { activityText } from "./activity-text.ts";
2
+ import {
3
+ activityText,
4
+ costText,
5
+ durationText,
6
+ sanitizeTerminalLine,
7
+ tokensText,
8
+ } from "../text/index.ts";
4
9
  import type { AskRow } from "./ask-ledger.ts";
5
- import { durationText } from "./duration-text.ts";
6
- import { sanitizeTerminalLine } from "./terminal-text.ts";
7
10
  import { graftNestedNodes } from "./tree-nested.ts";
8
11
  import type { TreeNode } from "./tree-node.ts";
9
12
  import type { TreeState } from "./tree-state.ts";
@@ -1,8 +1,6 @@
1
1
  import { type NodeInfo, sanitizeNodeName } from "@yaag/runtime";
2
- import { costText, tokensText } from "./accounting-text.ts";
3
- import { durationText } from "./duration-text.ts";
4
- import { parseNodePath } from "./node-path-parse.ts";
5
- import { sanitizeTerminalLine } from "./terminal-text.ts";
2
+ import { parseNodePath } from "../node/index.ts";
3
+ import { costText, durationText, sanitizeTerminalLine, tokensText } from "../text/index.ts";
6
4
  import type { TreeNode, TreeNodeKind, TreeNodeState } from "./tree-node.ts";
7
5
 
8
6
  interface Draft {
@@ -1,8 +1,6 @@
1
- import { costText } from "./accounting-text.ts";
1
+ import { agentOfPath } from "../node/index.ts";
2
+ import { clampToWidth, costText, durationText, sanitizeTerminalLine } from "../text/index.ts";
2
3
  import { renderDetailsPane } from "./details-pane.ts";
3
- import { durationText } from "./duration-text.ts";
4
- import { agentOfPath } from "./node-path-parse.ts";
5
- import { clampToWidth, sanitizeTerminalLine } from "./terminal-text.ts";
6
4
  import { emptyFold, type FoldState, type VisibleRow, visibleRows } from "./tree-fold.ts";
7
5
  import { buildTree } from "./tree-model.ts";
8
6
  import type { TreeNode } from "./tree-node.ts";
@@ -1,4 +1,4 @@
1
- import { clampToWidth, sanitizeTerminalLine } from "./terminal-text.ts";
1
+ import { clampToWidth, sanitizeTerminalLine } from "../text/index.ts";
2
2
  import type { VisibleRow } from "./tree-fold.ts";
3
3
  import { foldGlyph, GLYPHS, stateGlyph } from "./tree-glyphs.ts";
4
4
 
@@ -1,6 +1,6 @@
1
1
  import { applyEvent, initialSummary, type LifecycleEvent, type RunSummary } from "@yaag/runtime";
2
+ import { sanitizeTerminalText } from "../text/index.ts";
2
3
  import { type AskLedger, applyAskEnd, applyAskStart, emptyLedger } from "./ask-ledger.ts";
3
- import { sanitizeTerminalText } from "./terminal-text.ts";
4
4
 
5
5
  const MAX_TAIL_CHARS = 2_048;
6
6
  const TAIL_LINES = 2;
@@ -1,10 +1,6 @@
1
- import { costText } from "./accounting-text.ts";
2
- import { durationText } from "./duration-text.ts";
3
- import { clampToWidth, sanitizeTerminalLine } from "./terminal-text.ts";
4
- import { GLYPHS, stateGlyph } from "./tree-glyphs.ts";
5
- import { buildTree } from "./tree-model.ts";
6
- import type { TreeNode } from "./tree-node.ts";
7
- import type { TreeState } from "./tree-state.ts";
1
+ import { clampToWidth, costText, durationText, sanitizeTerminalLine } from "../text/index.ts";
2
+ import type { TreeNode, TreeState } from "../tree/index.ts";
3
+ import { buildTree, GLYPHS, stateGlyph } from "../tree/index.ts";
8
4
 
9
5
  /** Everything the compact background view needs; `now` keeps it clock-free. */
10
6
  export interface CompactRenderOptions {
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Public surface of the `view/` module: the tree, snapshot, compact, and inline Run views.
3
+ * Files inside this directory import each other directly.
4
+ */
5
+ export { type CompactRenderOptions, compactAgentLine, renderCompact } from "./compact-render.ts";
6
+ export { type InlineRenderOptions, renderInlineRun } from "./inline-render.ts";
7
+ export {
8
+ createRunTreeView,
9
+ type RunTreeView,
10
+ type RunTreeViewHost,
11
+ type RunTreeViewOptions,
12
+ } from "./run-tree-view.ts";
13
+ export { type RunViewResult, resultText, STDERR_TAIL_LINES } from "./run-view-result.ts";
14
+ export {
15
+ applyRunViewAction,
16
+ livePhase,
17
+ type RunPhase,
18
+ type RunViewAction,
19
+ type RunViewEffect,
20
+ type RunViewOutcome,
21
+ type RunViewTransition,
22
+ } from "./run-view-state.ts";
23
+ export { renderSnapshot, type SnapshotRenderOptions } from "./snapshot-render.ts";
@@ -9,11 +9,11 @@
9
9
  * call blocks — the running ones first, then the latest to change state — and
10
10
  * rolls the rest into one `… +N more` line.
11
11
  */
12
+
13
+ import { clampToWidth } from "../text/index.ts";
14
+ import type { TreeNode, TreeState } from "../tree/index.ts";
15
+ import { buildTree } from "../tree/index.ts";
12
16
  import { compactAgentLine, compactHeaderLine } from "./compact-render.ts";
13
- import { clampToWidth } from "./terminal-text.ts";
14
- import { buildTree } from "./tree-model.ts";
15
- import type { TreeNode } from "./tree-node.ts";
16
- import type { TreeState } from "./tree-state.ts";
17
17
 
18
18
  /** Default line budget; pi truncates a widget past 10 lines. */
19
19
  const DEFAULT_MAX_LINES = 10;
@@ -18,8 +18,12 @@
18
18
  * The view owns no clock and no I/O of its own: every capability, including the
19
19
  * reap-ladder stop, arrives through `RunTreeViewHost`.
20
20
  */
21
- import { DrillController, type DrillHost } from "./drill-controller.ts";
22
- import { routeDrillKey, routeMenuKey } from "./drill-keys.ts";
21
+ import { DrillController, type DrillHost, routeDrillKey, routeMenuKey } from "../drill/index.ts";
22
+ import { renderStopPrompt, STOP_PROMPT_CHOICES } from "../overlay/index.ts";
23
+ import { clampToWidth } from "../text/index.ts";
24
+ import { routeSessionKey } from "../transcript/index.ts";
25
+ import type { TreeState } from "../tree/index.ts";
26
+ import { buildTree, renderTree, TreeNavigator } from "../tree/index.ts";
23
27
  import { type RunViewResult, resultText } from "./run-view-result.ts";
24
28
  import {
25
29
  applyRunViewAction,
@@ -27,13 +31,6 @@ import {
27
31
  type RunPhase,
28
32
  type RunViewEffect,
29
33
  } from "./run-view-state.ts";
30
- import { routeSessionKey } from "./session-keys.ts";
31
- import { renderStopPrompt, STOP_PROMPT_CHOICES } from "./stop-prompt.ts";
32
- import { clampToWidth } from "./terminal-text.ts";
33
- import { buildTree } from "./tree-model.ts";
34
- import { TreeNavigator } from "./tree-navigator.ts";
35
- import { renderTree } from "./tree-render.ts";
36
- import type { TreeState } from "./tree-state.ts";
37
34
 
38
35
  // At tree level `esc` closes the view, live or settled, so the view replaces
39
36
  // the renderer's own footer on every phase; `tree-render.ts` writes `esc back`,
@@ -5,7 +5,7 @@
5
5
  * Pure, and the only place that policy lives, so the component and the CLI show
6
6
  * the same end state.
7
7
  */
8
- import { sanitizeTerminalText } from "./terminal-text.ts";
8
+ import { sanitizeTerminalText } from "../text/index.ts";
9
9
 
10
10
  /** How many trailing stderr lines a failed Run shows below its error. */
11
11
  export const STDERR_TAIL_LINES = 12;
@@ -7,7 +7,7 @@
7
7
  * never stop a Run. Closing the view is the view's own tree-level `esc`, which
8
8
  * never reaches this reducer.
9
9
  */
10
- import { moveStopCursor, type StopChoice } from "./stop-prompt.ts";
10
+ import { moveStopCursor, type StopChoice } from "../overlay/index.ts";
11
11
 
12
12
  /** How the Run ended, as the view shows it. */
13
13
  export type RunViewOutcome = "fulfilled" | "failed";
@@ -1,9 +1,9 @@
1
1
  import type { RunSummary } from "@yaag/runtime";
2
+ import { renderNodeTable } from "../node/index.ts";
3
+ import { clampToWidth, sanitizeTerminalLine } from "../text/index.ts";
4
+ import type { TreeState } from "../tree/index.ts";
5
+ import { buildTree } from "../tree/index.ts";
2
6
  import { compactAgentLine, compactHeaderLine } from "./compact-render.ts";
3
- import { renderNodeTable } from "./node-table.ts";
4
- import { clampToWidth, sanitizeTerminalLine } from "./terminal-text.ts";
5
- import { buildTree } from "./tree-model.ts";
6
- import type { TreeState } from "./tree-state.ts";
7
7
 
8
8
  /** Everything the model-facing snapshot needs; `now` keeps it clock-free. */
9
9
  export interface SnapshotRenderOptions {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes