@ranker/raxflow 0.2.1 → 0.2.3

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 (214) hide show
  1. package/dist/benchmark.d.ts +10 -0
  2. package/dist/bin.d.ts +3 -0
  3. package/dist/bootstrap.d.ts +8 -0
  4. package/dist/bridge-adapter-templates.d.ts +4 -0
  5. package/dist/bridge-test.d.ts +7 -0
  6. package/dist/dashboard.d.ts +4 -0
  7. package/dist/doctor.d.ts +6 -0
  8. package/dist/evolve.d.ts +7 -0
  9. package/dist/host-init-templates.d.ts +16 -0
  10. package/dist/hub/__tests__/commands.test.d.ts +2 -0
  11. package/dist/hub/__tests__/history.test.d.ts +2 -0
  12. package/dist/hub/__tests__/parser.test.d.ts +2 -0
  13. package/dist/hub/commands/agents.d.ts +3 -0
  14. package/dist/hub/commands/index.d.ts +4 -0
  15. package/dist/hub/commands/logs.d.ts +3 -0
  16. package/dist/hub/commands/memory.d.ts +3 -0
  17. package/dist/hub/commands/metrics.d.ts +3 -0
  18. package/dist/hub/commands/providers.d.ts +3 -0
  19. package/dist/hub/commands/run.d.ts +3 -0
  20. package/dist/hub/commands/status.d.ts +3 -0
  21. package/dist/hub/commands/workflows.d.ts +3 -0
  22. package/dist/hub/config-loader.d.ts +4 -0
  23. package/dist/hub/history.d.ts +13 -0
  24. package/dist/hub/index.d.ts +4 -0
  25. package/dist/hub/parser.d.ts +4 -0
  26. package/dist/hub/styles/borders.d.ts +23 -0
  27. package/dist/hub/styles/colors.d.ts +63 -0
  28. package/dist/hub/styles/typography.d.ts +34 -0
  29. package/dist/hub/types.d.ts +27 -0
  30. package/{src/index.ts → dist/index.d.ts} +1 -0
  31. package/dist/init-host.d.ts +10 -0
  32. package/dist/install.d.ts +8 -0
  33. package/dist/run.d.ts +16 -0
  34. package/dist/setup/components/ProviderSelector.d.ts.map +1 -1
  35. package/dist/setup/components/ProviderSelector.js +8 -7
  36. package/dist/setup/components/ProviderSelector.js.map +1 -1
  37. package/dist/styles.d.ts +12 -0
  38. package/dist/tui/App.d.ts.map +1 -1
  39. package/dist/tui/App.js +7 -2
  40. package/dist/tui/App.js.map +1 -1
  41. package/dist/tui/components/ChatPanel.d.ts +1 -0
  42. package/dist/tui/components/ChatPanel.d.ts.map +1 -1
  43. package/dist/tui/components/ChatPanel.js +4 -3
  44. package/dist/tui/components/ChatPanel.js.map +1 -1
  45. package/dist/tui/components/DAGPanel.d.ts +1 -0
  46. package/dist/tui/components/DAGPanel.d.ts.map +1 -1
  47. package/dist/tui/components/DAGPanel.js +4 -3
  48. package/dist/tui/components/DAGPanel.js.map +1 -1
  49. package/dist/tui/components/Header.d.ts.map +1 -1
  50. package/dist/tui/components/Header.js +1 -1
  51. package/dist/tui/components/Header.js.map +1 -1
  52. package/dist/tui/components/InputBar.d.ts.map +1 -1
  53. package/dist/tui/components/InputBar.js +1 -1
  54. package/dist/tui/components/InputBar.js.map +1 -1
  55. package/dist/tui/components/LogsPanel.d.ts +1 -0
  56. package/dist/tui/components/LogsPanel.d.ts.map +1 -1
  57. package/dist/tui/components/LogsPanel.js +4 -3
  58. package/dist/tui/components/LogsPanel.js.map +1 -1
  59. package/dist/tui/components/MemoryPanel.d.ts +1 -0
  60. package/dist/tui/components/MemoryPanel.d.ts.map +1 -1
  61. package/dist/tui/components/MemoryPanel.js +2 -2
  62. package/dist/tui/components/MemoryPanel.js.map +1 -1
  63. package/dist/tui/components/MetricsPanel.d.ts +1 -0
  64. package/dist/tui/components/MetricsPanel.d.ts.map +1 -1
  65. package/dist/tui/components/MetricsPanel.js +2 -2
  66. package/dist/tui/components/MetricsPanel.js.map +1 -1
  67. package/dist/tui/components/StatusPanel.d.ts +1 -0
  68. package/dist/tui/components/StatusPanel.d.ts.map +1 -1
  69. package/dist/tui/components/StatusPanel.js +4 -3
  70. package/dist/tui/components/StatusPanel.js.map +1 -1
  71. package/dist/vendor-manifests.d.ts +22 -0
  72. package/package.json +5 -1
  73. package/dashboard/index.html +0 -420
  74. package/dist/hub/chat/ChatApp.d.ts +0 -2
  75. package/dist/hub/chat/ChatApp.d.ts.map +0 -1
  76. package/dist/hub/chat/ChatApp.js +0 -146
  77. package/dist/hub/chat/ChatApp.js.map +0 -1
  78. package/dist/hub/chat/components/ChatInput.d.ts +0 -9
  79. package/dist/hub/chat/components/ChatInput.d.ts.map +0 -1
  80. package/dist/hub/chat/components/ChatInput.js +0 -19
  81. package/dist/hub/chat/components/ChatInput.js.map +0 -1
  82. package/dist/hub/chat/components/MessageList.d.ts +0 -7
  83. package/dist/hub/chat/components/MessageList.d.ts.map +0 -1
  84. package/dist/hub/chat/components/MessageList.js +0 -6
  85. package/dist/hub/chat/components/MessageList.js.map +0 -1
  86. package/dist/hub/chat/context.d.ts.map +0 -1
  87. package/dist/hub/chat/context.js +0 -42
  88. package/dist/hub/chat/context.js.map +0 -1
  89. package/dist/hub/chat/hooks/useChatHistory.d.ts +0 -7
  90. package/dist/hub/chat/hooks/useChatHistory.d.ts.map +0 -1
  91. package/dist/hub/chat/hooks/useChatHistory.js +0 -31
  92. package/dist/hub/chat/hooks/useChatHistory.js.map +0 -1
  93. package/dist/hub/chat/index.d.ts.map +0 -1
  94. package/dist/hub/chat/index.js +0 -7
  95. package/dist/hub/chat/index.js.map +0 -1
  96. package/dist/hub/chat/intent-parser.d.ts.map +0 -1
  97. package/dist/hub/chat/intent-parser.js +0 -48
  98. package/dist/hub/chat/intent-parser.js.map +0 -1
  99. package/dist/hub/chat/types.d.ts.map +0 -1
  100. package/dist/hub/chat/types.js +0 -2
  101. package/dist/hub/chat/types.js.map +0 -1
  102. package/dist/hub/tui/App.d.ts +0 -2
  103. package/dist/hub/tui/App.d.ts.map +0 -1
  104. package/dist/hub/tui/App.js +0 -53
  105. package/dist/hub/tui/App.js.map +0 -1
  106. package/dist/hub/tui/components/AgentQueue.d.ts +0 -6
  107. package/dist/hub/tui/components/AgentQueue.d.ts.map +0 -1
  108. package/dist/hub/tui/components/AgentQueue.js +0 -20
  109. package/dist/hub/tui/components/AgentQueue.js.map +0 -1
  110. package/dist/hub/tui/components/DAGPanel.d.ts +0 -16
  111. package/dist/hub/tui/components/DAGPanel.d.ts.map +0 -1
  112. package/dist/hub/tui/components/DAGPanel.js +0 -51
  113. package/dist/hub/tui/components/DAGPanel.js.map +0 -1
  114. package/dist/hub/tui/components/Header.d.ts +0 -7
  115. package/dist/hub/tui/components/Header.d.ts.map +0 -1
  116. package/dist/hub/tui/components/Header.js +0 -17
  117. package/dist/hub/tui/components/Header.js.map +0 -1
  118. package/dist/hub/tui/components/LogsPanel.d.ts +0 -6
  119. package/dist/hub/tui/components/LogsPanel.d.ts.map +0 -1
  120. package/dist/hub/tui/components/LogsPanel.js +0 -26
  121. package/dist/hub/tui/components/LogsPanel.js.map +0 -1
  122. package/dist/hub/tui/components/StatusBar.d.ts +0 -8
  123. package/dist/hub/tui/components/StatusBar.d.ts.map +0 -1
  124. package/dist/hub/tui/components/StatusBar.js +0 -7
  125. package/dist/hub/tui/components/StatusBar.js.map +0 -1
  126. package/dist/hub/tui/hooks/useEvents.d.ts +0 -2
  127. package/dist/hub/tui/hooks/useEvents.d.ts.map +0 -1
  128. package/dist/hub/tui/hooks/useEvents.js +0 -13
  129. package/dist/hub/tui/hooks/useEvents.js.map +0 -1
  130. package/dist/hub/tui/index.d.ts.map +0 -1
  131. package/dist/hub/tui/index.js +0 -7
  132. package/dist/hub/tui/index.js.map +0 -1
  133. package/dist/hub/tui/types.d.ts.map +0 -1
  134. package/dist/hub/tui/types.js +0 -2
  135. package/dist/hub/tui/types.js.map +0 -1
  136. package/src/benchmark.ts +0 -156
  137. package/src/bin.ts +0 -156
  138. package/src/bootstrap.ts +0 -36
  139. package/src/bridge-adapter-templates.ts +0 -181
  140. package/src/bridge-test.ts +0 -107
  141. package/src/dashboard.ts +0 -51
  142. package/src/doctor.ts +0 -92
  143. package/src/evolve.ts +0 -74
  144. package/src/host-init-templates.ts +0 -134
  145. package/src/hub/__tests__/commands.test.ts +0 -84
  146. package/src/hub/__tests__/history.test.ts +0 -137
  147. package/src/hub/__tests__/parser.test.ts +0 -105
  148. package/src/hub/commands/agents.ts +0 -53
  149. package/src/hub/commands/index.ts +0 -140
  150. package/src/hub/commands/logs.ts +0 -70
  151. package/src/hub/commands/memory.ts +0 -47
  152. package/src/hub/commands/metrics.ts +0 -49
  153. package/src/hub/commands/providers.ts +0 -39
  154. package/src/hub/commands/run.ts +0 -37
  155. package/src/hub/commands/status.ts +0 -69
  156. package/src/hub/commands/workflows.ts +0 -64
  157. package/src/hub/config-loader.ts +0 -37
  158. package/src/hub/event-listener.ts +0 -17
  159. package/src/hub/history.ts +0 -66
  160. package/src/hub/index.ts +0 -132
  161. package/src/hub/parser.ts +0 -107
  162. package/src/hub/styles/borders.ts +0 -74
  163. package/src/hub/styles/colors.ts +0 -129
  164. package/src/hub/styles/typography.ts +0 -68
  165. package/src/hub/types.ts +0 -31
  166. package/src/init-host.ts +0 -285
  167. package/src/install.ts +0 -118
  168. package/src/run.ts +0 -317
  169. package/src/setup/components/ApiKeyInput.tsx +0 -158
  170. package/src/setup/components/AsciiBanner.tsx +0 -125
  171. package/src/setup/components/CliDetector.tsx +0 -230
  172. package/src/setup/components/ModeSelector.tsx +0 -137
  173. package/src/setup/components/ProviderSelector.tsx +0 -174
  174. package/src/setup/components/SetupWizard.tsx +0 -368
  175. package/src/setup/components/StepIndicator.tsx +0 -74
  176. package/src/setup/components/SuccessScreen.tsx +0 -229
  177. package/src/setup/index.ts +0 -34
  178. package/src/setup/utils/cli-detection.ts +0 -99
  179. package/src/setup/utils/config-writer.ts +0 -249
  180. package/src/styles.ts +0 -12
  181. package/src/tui/App.tsx +0 -177
  182. package/src/tui/components/AgentStateIcon.tsx +0 -84
  183. package/src/tui/components/AnimatedBranch.tsx +0 -134
  184. package/src/tui/components/ChatPanel.tsx +0 -125
  185. package/src/tui/components/DAGPanel.tsx +0 -208
  186. package/src/tui/components/ExecutionTimeline.tsx +0 -225
  187. package/src/tui/components/Header.tsx +0 -109
  188. package/src/tui/components/HelpOverlay.tsx +0 -140
  189. package/src/tui/components/InputBar.tsx +0 -69
  190. package/src/tui/components/LogsPanel.tsx +0 -129
  191. package/src/tui/components/MemoryPanel.tsx +0 -163
  192. package/src/tui/components/MetricsPanel.tsx +0 -149
  193. package/src/tui/components/StatusPanel.tsx +0 -137
  194. package/src/tui/components/TaskTree.tsx +0 -159
  195. package/src/tui/components/animations/ProgressBar.tsx +0 -160
  196. package/src/tui/components/animations/Pulse.tsx +0 -73
  197. package/src/tui/components/animations/Spinner.tsx +0 -54
  198. package/src/tui/components/animations/StatusAnimator.tsx +0 -153
  199. package/src/tui/components/animations/TypingEffect.tsx +0 -119
  200. package/src/tui/components/animations/index.ts +0 -16
  201. package/src/tui/hooks/useAnimation.ts +0 -290
  202. package/src/tui/hooks/useAppState.ts +0 -403
  203. package/src/tui/index.ts +0 -9
  204. package/src/tui/services/orchestrator.ts +0 -195
  205. package/src/tui/styles/borders.ts +0 -51
  206. package/src/tui/styles/colors.ts +0 -19
  207. package/src/tui/styles/index.ts +0 -20
  208. package/src/tui/styles/indicators.ts +0 -54
  209. package/src/tui/styles/layout.ts +0 -44
  210. package/src/tui/styles/providers.ts +0 -32
  211. package/src/tui/utils/animation.ts +0 -124
  212. package/src/vendor-manifests.ts +0 -113
  213. package/src/ws-relay.ts +0 -156
  214. package/tsconfig.json +0 -28
@@ -1,134 +0,0 @@
1
- import React, { memo, useMemo } from "react";
2
- import { Box, Text } from "ink";
3
- import { tuiColors } from "../styles/index.js";
4
-
5
- const VERTICAL_PULSE_FRAMES = ["│", "┃", "│", "┃"];
6
- const HORIZONTAL_PULSE_FRAMES = ["─", "━", "─", "━"];
7
- const FLOW_FRAMES = ["◀═══▶", "═◀═══▶", "══◀══▶", "═══◀═▶", "════◀▶", "═▶═══◀", "══▶══◀", "═══▶═◀"];
8
-
9
- export type BranchType = 'vertical' | 'horizontal' | 'corner-left' | 'corner-right' | 'branch' | 'last-branch' | 'flow';
10
-
11
- interface AnimatedBranchProps {
12
- type: BranchType;
13
- tick?: number;
14
- animated?: boolean;
15
- length?: number;
16
- color?: string;
17
- }
18
-
19
- export const AnimatedBranch = memo(function AnimatedBranch({
20
- type,
21
- tick = 0,
22
- animated = true,
23
- length = 1,
24
- color
25
- }: AnimatedBranchProps) {
26
- const branchColor = color || tuiColors.textTertiary;
27
-
28
- const getFrame = (frames: string[]): string => {
29
- return frames[tick % frames.length];
30
- };
31
-
32
- const renderBranch = (): string => {
33
- switch (type) {
34
- case 'vertical':
35
- return animated ? getFrame(VERTICAL_PULSE_FRAMES) : "│";
36
- case 'horizontal':
37
- return animated ? getFrame(HORIZONTAL_PULSE_FRAMES).repeat(length) : "─".repeat(length);
38
- case 'corner-left':
39
- return "┌";
40
- case 'corner-right':
41
- return "┐";
42
- case 'branch':
43
- return "├─";
44
- case 'last-branch':
45
- return "└─";
46
- case 'flow':
47
- return animated ? getFrame(FLOW_FRAMES) : "◀═══▶";
48
- default:
49
- return "│";
50
- }
51
- };
52
-
53
- return <Text color={branchColor}>{renderBranch()}</Text>;
54
- });
55
-
56
- interface BranchLineProps {
57
- tick: number;
58
- animated?: boolean;
59
- length?: number;
60
- color?: string;
61
- }
62
-
63
- export const VerticalBranch = memo(function VerticalBranch({ tick, animated = true, length = 1, color }: BranchLineProps) {
64
- return <AnimatedBranch type="vertical" tick={tick} animated={animated} color={color} />;
65
- });
66
-
67
- export const HorizontalBranch = memo(function HorizontalBranch({ tick, animated = true, length = 1, color }: BranchLineProps) {
68
- return <AnimatedBranch type="horizontal" tick={tick} animated={animated} length={length} color={color} />;
69
- });
70
-
71
- export const BranchConnector = memo(function BranchConnector({ tick, animated = true, color }: BranchLineProps) {
72
- return <AnimatedBranch type="branch" tick={tick} animated={animated} color={color} />;
73
- });
74
-
75
- export const LastBranchConnector = memo(function LastBranchConnector({ tick, animated = true, color }: BranchLineProps) {
76
- return <AnimatedBranch type="last-branch" tick={tick} animated={animated} color={color} />;
77
- });
78
-
79
- export const FlowIndicator = memo(function FlowIndicator({ tick, animated = true, color }: BranchLineProps) {
80
- return <AnimatedBranch type="flow" tick={tick} animated={animated} color={color} />;
81
- });
82
-
83
- interface TaskBranchProps {
84
- tick: number;
85
- depth: number;
86
- isLast: boolean;
87
- hasChildren?: boolean;
88
- isExpanded?: boolean;
89
- color?: string;
90
- }
91
-
92
- export const TaskBranch = memo(function TaskBranch({ tick, depth, isLast, hasChildren = false, isExpanded = true, color }: TaskBranchProps) {
93
- const branchColor = color || tuiColors.textTertiary;
94
-
95
- if (depth === 0) {
96
- return null;
97
- }
98
-
99
- const indent = " ".repeat(depth - 1);
100
-
101
- return (
102
- <Box flexDirection="row">
103
- <Text color={branchColor}>{indent}</Text>
104
- <AnimatedBranch type={isLast ? "last-branch" : "branch"} tick={tick} color={branchColor} />
105
- </Box>
106
- );
107
- });
108
-
109
- interface AnimatedConnectorProps {
110
- tick: number;
111
- fromLevel: number;
112
- toLevel: number;
113
- isActive: boolean;
114
- }
115
-
116
- export const AnimatedConnector = memo(function AnimatedConnector({ tick, fromLevel, toLevel, isActive }: AnimatedConnectorProps) {
117
- const color = isActive ? tuiColors.primary : tuiColors.textTertiary;
118
- const rows = toLevel - fromLevel;
119
-
120
- const connectorElements = useMemo(() =>
121
- Array.from({ length: rows }).map((_, idx) => (
122
- <Box key={idx} paddingLeft={2}>
123
- <AnimatedBranch type="vertical" tick={tick} animated={isActive} color={color} />
124
- </Box>
125
- )),
126
- [rows, tick, isActive, color]
127
- );
128
-
129
- return (
130
- <Box flexDirection="column">
131
- {connectorElements}
132
- </Box>
133
- );
134
- });
@@ -1,125 +0,0 @@
1
- import React, { useState, useEffect, useMemo, memo, useCallback } from "react";
2
- import { Box, Text } from "ink";
3
- import { tuiColors, formatTimestamp, getProviderTag } from "../styles/index.js";
4
- import { TypingEffect, ProcessingIndicator } from "./animations/index.js";
5
-
6
- interface Message {
7
- id: string;
8
- type: "user" | "system" | "agent" | "error" | "success";
9
- content: string;
10
- timestamp: Date;
11
- agent?: string;
12
- }
13
-
14
- interface ChatPanelProps {
15
- messages: Message[];
16
- isProcessing: boolean;
17
- isActive: boolean;
18
- }
19
-
20
- const MESSAGE_CONFIG: Record<string, { tag: string; color: string }> = {
21
- user: { tag: "[YOU]", color: tuiColors.textPrimary },
22
- system: { tag: "[SYS]", color: tuiColors.textTertiary },
23
- agent: { tag: "[AGENT]", color: tuiColors.primary },
24
- error: { tag: "[ERROR]", color: tuiColors.error },
25
- success: { tag: "[SUCCESS]", color: tuiColors.success },
26
- };
27
-
28
- const MAX_DISPLAYED_MESSAGES = 12;
29
- const TYPING_SPEED_PER_CHAR = 15;
30
- const TYPING_BUFFER_MS = 500;
31
-
32
- interface MessageItemProps {
33
- message: Message;
34
- animate?: boolean;
35
- }
36
-
37
- const MessageItem = memo(function MessageItem({ message, animate = false }: MessageItemProps) {
38
- const config = MESSAGE_CONFIG[message.type];
39
- const providerInfo = useMemo(() =>
40
- message.agent ? getProviderTag(message.agent) : null,
41
- [message.agent]
42
- );
43
- const tag = message.type === "agent" && message.agent
44
- ? `[${message.agent.toUpperCase().slice(0, 8)}]`
45
- : config.tag;
46
- const formattedTime = useMemo(() => formatTimestamp(message.timestamp), [message.timestamp]);
47
-
48
- return (
49
- <Box flexDirection="column" marginBottom={1}>
50
- <Box flexDirection="row">
51
- <Text color={tuiColors.textTertiary}>[{formattedTime}]</Text>
52
- <Text color={config.color} bold>{tag.padEnd(12)}</Text>
53
- {providerInfo && (
54
- <Text color={tuiColors.textTertiary}>{providerInfo.code}</Text>
55
- )}
56
- </Box>
57
- {animate ? (
58
- <TypingEffect text={message.content} speed={TYPING_SPEED_PER_CHAR} showCursor={false} />
59
- ) : (
60
- <Text color={tuiColors.textPrimary}> {message.content}</Text>
61
- )}
62
- </Box>
63
- );
64
- });
65
-
66
- export const ChatPanel = memo(function ChatPanel({ messages, isProcessing, isActive }: ChatPanelProps) {
67
- const borderColor = isActive ? tuiColors.primary : tuiColors.border;
68
- const [animatingMessageId, setAnimatingMessageId] = useState<string | null>(null);
69
- const timeoutRef = React.useRef<NodeJS.Timeout | null>(null);
70
-
71
- const displayMessages = useMemo(() =>
72
- messages.slice(-MAX_DISPLAYED_MESSAGES),
73
- [messages]
74
- );
75
-
76
- useEffect(() => {
77
- if (messages.length === 0) return;
78
-
79
- const lastMessage = messages[messages.length - 1];
80
- if (lastMessage.type !== "agent" && lastMessage.type !== "system") return;
81
-
82
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
83
-
84
- setAnimatingMessageId(lastMessage.id);
85
- timeoutRef.current = setTimeout(() => {
86
- setAnimatingMessageId(null);
87
- }, lastMessage.content.length * TYPING_SPEED_PER_CHAR + TYPING_BUFFER_MS);
88
-
89
- return () => {
90
- if (timeoutRef.current) clearTimeout(timeoutRef.current);
91
- };
92
- }, [messages]);
93
-
94
- const messageElements = useMemo(() =>
95
- displayMessages.map((msg) => (
96
- <MessageItem
97
- key={msg.id}
98
- message={msg}
99
- animate={msg.id === animatingMessageId}
100
- />
101
- )),
102
- [displayMessages, animatingMessageId]
103
- );
104
-
105
- return (
106
- <Box
107
- flexDirection="column"
108
- flexGrow={2}
109
- borderStyle="single"
110
- borderColor={borderColor}
111
- paddingX={1}
112
- >
113
- <Box marginBottom={1}>
114
- <Text color={tuiColors.primary} bold>┌─</Text>
115
- <Text color={tuiColors.primary} bold> CHAT </Text>
116
- <Text color={tuiColors.textTertiary}>─────────────────────────────────────</Text>
117
- </Box>
118
-
119
- <Box flexDirection="column" flexGrow={1} overflow="hidden">
120
- {messageElements}
121
- {isProcessing && <ProcessingIndicator text="Processing" />}
122
- </Box>
123
- </Box>
124
- );
125
- });
@@ -1,208 +0,0 @@
1
- import React, { useMemo, memo } from "react";
2
- import { Box, Text } from "ink";
3
- import { tuiColors, getStatusIndicator, getSpinnerFrame, treeChars } from "../styles/index.js";
4
- import { AnimatedProgressBar } from "./animations/index.js";
5
- import { AgentStateIcon, AgentState } from "./AgentStateIcon.js";
6
-
7
- interface DAGSubtask {
8
- id: string;
9
- name: string;
10
- state: AgentState;
11
- }
12
-
13
- interface DAGNode {
14
- id: string;
15
- name: string;
16
- status: "pending" | "running" | "done" | "error";
17
- agent?: string;
18
- state?: AgentState;
19
- executionTime?: number;
20
- detail?: string;
21
- subtasks?: DAGSubtask[];
22
- }
23
-
24
- interface DAGLevel {
25
- name: string;
26
- progress: number;
27
- nodes: DAGNode[];
28
- status?: 'done' | 'running' | 'pending';
29
- }
30
-
31
- interface WorkflowState {
32
- levels: DAGLevel[];
33
- currentLevel: number;
34
- totalProgress: number;
35
- }
36
-
37
- interface DAGNodeItemProps {
38
- node: DAGNode;
39
- tick: number;
40
- isLast: boolean;
41
- }
42
-
43
- const STATE_LABELS: Record<AgentState, string> = {
44
- idle: "pending",
45
- thinking: "thinking...",
46
- processing: "processing",
47
- running: "running",
48
- success: "done",
49
- error: "error",
50
- waiting: "waiting",
51
- };
52
-
53
- const DAGNodeItem = memo(function DAGNodeItem({ node, tick, isLast }: DAGNodeItemProps) {
54
- const statusInfo = useMemo(() => getStatusIndicator(node.status), [node.status]);
55
- const agentState = useMemo((): AgentState => {
56
- if (node.state) return node.state;
57
- if (node.status === 'running') return 'running';
58
- if (node.status === 'done') return 'success';
59
- if (node.status === 'error') return 'error';
60
- return 'idle';
61
- }, [node.state, node.status]);
62
-
63
- const icon = node.status === "running"
64
- ? getSpinnerFrame(tick, "dots")
65
- : statusInfo.icon;
66
- const prefix = isLast ? treeChars.lastBranch : treeChars.branch;
67
- const timeStr = node.executionTime ? `${node.executionTime.toFixed(1)}s` : "";
68
-
69
- return (
70
- <Box flexDirection="column">
71
- <Box flexDirection="row">
72
- <Text color={tuiColors.textTertiary}>{prefix} </Text>
73
- <Box flexDirection="row">
74
- <Text color={tuiColors.textSecondary}>[</Text>
75
- <AgentStateIcon state={agentState} tick={tick} />
76
- <Text color={tuiColors.textSecondary}>]</Text>
77
- </Box>
78
- <Text color={tuiColors.textPrimary}> {node.name.padEnd(18)}</Text>
79
- {timeStr && (
80
- <Text color={tuiColors.textTertiary}> ● {timeStr}</Text>
81
- )}
82
- </Box>
83
- {node.detail && (
84
- <Box flexDirection="row">
85
- <Text color={tuiColors.textTertiary}> └── {node.detail}</Text>
86
- </Box>
87
- )}
88
- {node.subtasks && node.subtasks.length > 0 && (
89
- <Box flexDirection="column">
90
- {node.subtasks.map((subtask, idx) => (
91
- <Box key={subtask.id} flexDirection="row">
92
- <Text color={tuiColors.textTertiary}> {idx === node.subtasks!.length - 1 ? '└──' : '├──'} </Text>
93
- <AgentStateIcon state={subtask.state} tick={tick} />
94
- <Text color={tuiColors.textTertiary}> {subtask.name}</Text>
95
- </Box>
96
- ))}
97
- </Box>
98
- )}
99
- </Box>
100
- );
101
- });
102
-
103
- interface DAGLevelViewProps {
104
- level: DAGLevel;
105
- tick: number;
106
- isActive: boolean;
107
- }
108
-
109
- const DAGLevelView = memo(function DAGLevelView({ level, tick, isActive }: DAGLevelViewProps) {
110
- const levelColor = isActive ? tuiColors.primary : tuiColors.textSecondary;
111
- const statusColor = level.status === 'done'
112
- ? tuiColors.success
113
- : level.status === 'running'
114
- ? tuiColors.warning
115
- : tuiColors.textTertiary;
116
-
117
- return (
118
- <Box flexDirection="column" marginBottom={1}>
119
- <Box flexDirection="row">
120
- <Text color={levelColor} bold>{level.name.padEnd(12)}</Text>
121
- <AnimatedProgressBar
122
- progress={level.progress}
123
- width={16}
124
- tick={tick}
125
- animated={isActive}
126
- showMarker={isActive}
127
- glowEffect={isActive}
128
- />
129
- </Box>
130
- <Box flexDirection="row">
131
- <Text color={isActive ? tuiColors.primary : tuiColors.textTertiary}>
132
- {isActive ? "┃" : "│"}
133
- </Text>
134
- </Box>
135
- {level.nodes.map((node, idx) => (
136
- <DAGNodeItem
137
- key={node.id}
138
- node={node}
139
- tick={tick}
140
- isLast={idx === level.nodes.length - 1}
141
- />
142
- ))}
143
- </Box>
144
- );
145
- });
146
-
147
- interface DAGPanelProps {
148
- workflowState: WorkflowState;
149
- tick: number;
150
- isActive: boolean;
151
- }
152
-
153
- export const DAGPanel = memo(function DAGPanel({ workflowState, tick, isActive }: DAGPanelProps) {
154
- const borderColor = isActive ? tuiColors.primary : tuiColors.border;
155
-
156
- const levelViews = useMemo(() =>
157
- workflowState.levels.map((level, index) => (
158
- <DAGLevelView
159
- key={level.name}
160
- level={level}
161
- tick={tick}
162
- isActive={index === workflowState.currentLevel}
163
- />
164
- )),
165
- [workflowState.levels, workflowState.currentLevel, tick]
166
- );
167
-
168
- const isAnimating = useMemo(() =>
169
- workflowState.totalProgress > 0 && workflowState.totalProgress < 100,
170
- [workflowState.totalProgress]
171
- );
172
-
173
- return (
174
- <Box
175
- flexDirection="column"
176
- width={46}
177
- borderStyle="single"
178
- borderColor={borderColor}
179
- paddingX={1}
180
- >
181
- <Box marginBottom={1}>
182
- <Text color={tuiColors.primary} bold>┌─</Text>
183
- <Text color={tuiColors.primary} bold> DAG_EXECUTION </Text>
184
- <Text color={tuiColors.textTertiary}>──────────────────────</Text>
185
- </Box>
186
-
187
- <Box flexDirection="column" flexGrow={1}>
188
- {levelViews}
189
- </Box>
190
-
191
- <Box marginTop={1}>
192
- <Text color={tuiColors.textTertiary}>├─ TOTAL ─────────────────────────</Text>
193
- </Box>
194
- <Box flexDirection="row">
195
- <Text color={tuiColors.textSecondary}>Progress: </Text>
196
- <AnimatedProgressBar
197
- progress={workflowState.totalProgress}
198
- width={16}
199
- tick={tick}
200
- animated={isAnimating}
201
- showMarker
202
- />
203
- </Box>
204
- </Box>
205
- );
206
- });
207
-
208
- export type { DAGNode, DAGLevel, WorkflowState, DAGSubtask };
@@ -1,225 +0,0 @@
1
- import React, { memo, useMemo } from "react";
2
- import { Box, Text } from "ink";
3
- import { tuiColors } from "../styles/index.js";
4
- import { AnimatedBranch } from "./AnimatedBranch.js";
5
-
6
- interface TimelineAgent {
7
- name: string;
8
- startTime: number;
9
- endTime?: number;
10
- isActive: boolean;
11
- color?: string;
12
- }
13
-
14
- interface TimelineLevel {
15
- name: string;
16
- startTime: number;
17
- endTime?: number;
18
- progress: number;
19
- status: 'done' | 'running' | 'pending';
20
- }
21
-
22
- export interface ExecutionTimelineProps {
23
- tick: number;
24
- totalDuration: number;
25
- currentTime: number;
26
- levels: TimelineLevel[];
27
- agents: TimelineAgent[];
28
- isActive?: boolean;
29
- width?: number;
30
- }
31
-
32
- const ACTIVE_MARKER_FRAMES = ["┃", "║", "┃", "║"];
33
-
34
- const BAR_COLORS: Record<string, string> = {
35
- done: tuiColors.success,
36
- running: tuiColors.warning,
37
- pending: tuiColors.textTertiary,
38
- };
39
-
40
- const STATUS_TEXT = {
41
- done: (endTime: number | undefined) => `done at ${endTime?.toFixed(1)}s`,
42
- running: () => "running...",
43
- pending: () => "pending",
44
- };
45
-
46
- function formatTime(s: number): string {
47
- return `${s}s`;
48
- }
49
-
50
- interface TimelineBarProps {
51
- level: TimelineLevel;
52
- timeScale: number;
53
- width: number;
54
- currentTime: number;
55
- }
56
-
57
- const TimelineBar = memo(function TimelineBar({ level, timeScale, width, currentTime }: TimelineBarProps) {
58
- const startCol = Math.floor(level.startTime * timeScale);
59
- const endCol = level.endTime
60
- ? Math.floor(level.endTime * timeScale)
61
- : Math.floor(currentTime * timeScale);
62
- const barWidth = Math.max(0, endCol - startCol);
63
- const beforeBar = "░".repeat(startCol);
64
-
65
- const barChar = level.status === 'done' ? "█" : level.status === 'running' ? "▓" : "░";
66
- const afterBar = "░".repeat(Math.max(0, width - endCol));
67
-
68
- const statusText = STATUS_TEXT[level.status](level.endTime);
69
- const paddedName = useMemo(() => level.name.padEnd(4), [level.name]);
70
-
71
- return (
72
- <Box flexDirection="row">
73
- <Text color={tuiColors.textTertiary}>{paddedName} </Text>
74
- <Text color={BAR_COLORS[level.status]}>{beforeBar}{barChar.repeat(barWidth)}</Text>
75
- <Text color={tuiColors.textTertiary}>{afterBar}</Text>
76
- <Text color={tuiColors.textTertiary}> {statusText}</Text>
77
- </Box>
78
- );
79
- });
80
-
81
- interface AgentTimelineProps {
82
- agent: TimelineAgent;
83
- timeScale: number;
84
- width: number;
85
- currentTime: number;
86
- }
87
-
88
- const AgentTimeline = memo(function AgentTimeline({ agent, timeScale, width, currentTime }: AgentTimelineProps) {
89
- const startCol = Math.floor(agent.startTime * timeScale);
90
- const endCol = agent.endTime
91
- ? Math.floor(agent.endTime * timeScale)
92
- : Math.floor(currentTime * timeScale);
93
- const barWidth = Math.max(0, endCol - startCol);
94
- const indent = " ".repeat(startCol);
95
- const bar = agent.isActive ? "─".repeat(barWidth) + "▶" : "─".repeat(barWidth) + "┘";
96
- const afterBar = " ".repeat(Math.max(0, width - endCol - 1));
97
-
98
- const agentColor = agent.color || (agent.isActive ? tuiColors.primary : tuiColors.textSecondary);
99
- const prefix = agent.isActive ? "▶" : "●";
100
- const paddedName = useMemo(() => agent.name.padEnd(10), [agent.name]);
101
-
102
- return (
103
- <Box flexDirection="row">
104
- <Text color={agentColor}>{prefix} {paddedName} </Text>
105
- <Text color={tuiColors.textTertiary}>{indent}</Text>
106
- <Text color={agentColor}>{bar}</Text>
107
- <Text color={tuiColors.textTertiary}>{afterBar}</Text>
108
- </Box>
109
- );
110
- });
111
-
112
- export const ExecutionTimeline = memo(function ExecutionTimeline({
113
- tick,
114
- totalDuration,
115
- currentTime,
116
- levels,
117
- agents,
118
- isActive = false,
119
- width = 50,
120
- }: ExecutionTimelineProps) {
121
- const borderColor = isActive ? tuiColors.primary : tuiColors.border;
122
- const timeScale = width / totalDuration;
123
- const markerPositions = [0, 5, 10, 15, 20];
124
-
125
- const activeMarker = isActive ? ACTIVE_MARKER_FRAMES[tick % ACTIVE_MARKER_FRAMES.length] : "│";
126
-
127
- const markerElements = useMemo(() =>
128
- markerPositions.map((pos, idx) => (
129
- <Box key={idx} width={10}>
130
- <Text color={tuiColors.textTertiary}>{formatTime(pos).padStart(6)}</Text>
131
- </Box>
132
- )),
133
- []
134
- );
135
-
136
- const separatorElements = useMemo(() =>
137
- Array.from({ length: 5 }).map((_, idx) => (
138
- <Box key={idx} width={10}>
139
- <Text color={tuiColors.textTertiary}>{idx === 0 ? "│" : " │"}</Text>
140
- </Box>
141
- )),
142
- []
143
- );
144
-
145
- const levelElements = useMemo(() =>
146
- levels.map((level, idx) => (
147
- <Box key={idx} marginBottom={1}>
148
- <TimelineBar level={level} timeScale={timeScale} width={width} currentTime={currentTime} />
149
- </Box>
150
- )),
151
- [levels, timeScale, width, currentTime]
152
- );
153
-
154
- const agentElements = useMemo(() =>
155
- agents.map((agent, idx) => (
156
- <Box key={idx}>
157
- <AgentTimeline agent={agent} timeScale={timeScale} width={width} currentTime={currentTime} />
158
- </Box>
159
- )),
160
- [agents, timeScale, width, currentTime]
161
- );
162
-
163
- return (
164
- <Box flexDirection="column" borderStyle="single" borderColor={borderColor} paddingX={1}>
165
- <Box marginBottom={1}>
166
- <Text color={tuiColors.primary} bold>┌─</Text>
167
- <Text color={tuiColors.primary} bold> EXECUTION_TIMELINE </Text>
168
- <Text color={tuiColors.textTertiary}>────────────────</Text>
169
- </Box>
170
-
171
- <Box flexDirection="row" marginBottom={1}>
172
- {markerElements}
173
- </Box>
174
-
175
- <Box flexDirection="row" marginBottom={1}>
176
- {separatorElements}
177
- </Box>
178
-
179
- <Box flexDirection="row" marginBottom={1}>
180
- <Text color={tuiColors.textTertiary}>{"├" + "─".repeat(width - 2) + "┤"}</Text>
181
- </Box>
182
-
183
- <Box flexDirection="column">
184
- {levelElements}
185
- </Box>
186
-
187
- <Box flexDirection="row" marginTop={1} marginBottom={1}>
188
- <AnimatedBranch type="vertical" tick={tick} animated={isActive} />
189
- </Box>
190
-
191
- <Box marginTop={1}>
192
- <Text color={tuiColors.textSecondary}>Agents:</Text>
193
- </Box>
194
-
195
- <Box flexDirection="column" marginTop={1}>
196
- {agentElements}
197
- </Box>
198
- </Box>
199
- );
200
- });
201
-
202
- interface MiniTimelineProps {
203
- progress: number;
204
- tick: number;
205
- isActive: boolean;
206
- width?: number;
207
- }
208
-
209
- export const MiniTimeline = memo(function MiniTimeline({ progress, tick, isActive, width = 30 }: MiniTimelineProps) {
210
- const filled = Math.floor((progress / 100) * width);
211
- const empty = width - filled;
212
- const currentPos = Math.min(filled, width - 1);
213
-
214
- const before = "─".repeat(currentPos);
215
- const marker = isActive ? "●" : "○";
216
- const after = "─".repeat(empty);
217
-
218
- return (
219
- <Box flexDirection="row">
220
- <Text color={tuiColors.textTertiary}>├{before}</Text>
221
- <Text color={isActive ? tuiColors.primary : tuiColors.textSecondary}>{marker}</Text>
222
- <Text color={tuiColors.textTertiary}>{after}┤</Text>
223
- </Box>
224
- );
225
- });