@roj-ai/debug 0.0.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 (77) hide show
  1. package/dist/components/debug/DebugContext.d.ts +10 -0
  2. package/dist/components/debug/DebugNavigation.d.ts +29 -0
  3. package/dist/components/debug/DebugShell.d.ts +18 -0
  4. package/dist/components/debug/LLMCallDetail.d.ts +7 -0
  5. package/dist/components/debug/TimelineDetailInspector.d.ts +6 -0
  6. package/dist/components/debug/communication/CommunicationDiagram.d.ts +9 -0
  7. package/dist/components/debug/communication/DiagramHeader.d.ts +7 -0
  8. package/dist/components/debug/communication/ParticipantLane.d.ts +7 -0
  9. package/dist/components/debug/communication/TimeAxis.d.ts +9 -0
  10. package/dist/components/debug/communication/elements/IdleGap.d.ts +9 -0
  11. package/dist/components/debug/communication/elements/LLMBlock.d.ts +9 -0
  12. package/dist/components/debug/communication/elements/MessageArrow.d.ts +10 -0
  13. package/dist/components/debug/communication/elements/ToolBlock.d.ts +9 -0
  14. package/dist/components/debug/communication/hooks/useDiagramData.d.ts +12 -0
  15. package/dist/components/debug/communication/hooks/useTimeCompression.d.ts +7 -0
  16. package/dist/components/debug/communication/hooks/useZoomPan.d.ts +11 -0
  17. package/dist/components/debug/communication/popovers/ElementPopover.d.ts +8 -0
  18. package/dist/components/debug/communication/types.d.ts +136 -0
  19. package/dist/components/debug/index.d.ts +11 -0
  20. package/dist/components/debug/pages/AgentDetailPage.d.ts +3 -0
  21. package/dist/components/debug/pages/AgentsPage.d.ts +1 -0
  22. package/dist/components/debug/pages/CommunicationPage.d.ts +1 -0
  23. package/dist/components/debug/pages/DashboardPage.d.ts +1 -0
  24. package/dist/components/debug/pages/EventsPage.d.ts +1 -0
  25. package/dist/components/debug/pages/FilesPage.d.ts +1 -0
  26. package/dist/components/debug/pages/LLMCallPage.d.ts +1 -0
  27. package/dist/components/debug/pages/LLMCallsPage.d.ts +1 -0
  28. package/dist/components/debug/pages/LogsPage.d.ts +1 -0
  29. package/dist/components/debug/pages/MailboxPage.d.ts +1 -0
  30. package/dist/components/debug/pages/ServicesPage.d.ts +1 -0
  31. package/dist/components/debug/pages/TimelinePage.d.ts +1 -0
  32. package/dist/components/debug/pages/UserChatPage.d.ts +1 -0
  33. package/dist/components/debug/pages/index.d.ts +13 -0
  34. package/dist/index.d.ts +9 -0
  35. package/dist/lib/domain-utils.d.ts +7 -0
  36. package/dist/providers/EventPollingProvider.d.ts +27 -0
  37. package/dist/stores/event-store.d.ts +93 -0
  38. package/dist/utils/format.d.ts +1 -0
  39. package/package.json +43 -0
  40. package/src/components/debug/DebugContext.tsx +18 -0
  41. package/src/components/debug/DebugNavigation.tsx +55 -0
  42. package/src/components/debug/DebugShell.tsx +321 -0
  43. package/src/components/debug/LLMCallDetail.tsx +740 -0
  44. package/src/components/debug/TimelineDetailInspector.tsx +204 -0
  45. package/src/components/debug/communication/CommunicationDiagram.tsx +260 -0
  46. package/src/components/debug/communication/DiagramHeader.tsx +113 -0
  47. package/src/components/debug/communication/ParticipantLane.tsx +60 -0
  48. package/src/components/debug/communication/TimeAxis.tsx +106 -0
  49. package/src/components/debug/communication/elements/IdleGap.tsx +90 -0
  50. package/src/components/debug/communication/elements/LLMBlock.tsx +107 -0
  51. package/src/components/debug/communication/elements/MessageArrow.tsx +119 -0
  52. package/src/components/debug/communication/elements/ToolBlock.tsx +99 -0
  53. package/src/components/debug/communication/hooks/useDiagramData.ts +294 -0
  54. package/src/components/debug/communication/hooks/useTimeCompression.ts +140 -0
  55. package/src/components/debug/communication/hooks/useZoomPan.ts +87 -0
  56. package/src/components/debug/communication/popovers/ElementPopover.tsx +158 -0
  57. package/src/components/debug/communication/types.ts +180 -0
  58. package/src/components/debug/index.ts +37 -0
  59. package/src/components/debug/pages/AgentDetailPage.tsx +1295 -0
  60. package/src/components/debug/pages/AgentsPage.tsx +297 -0
  61. package/src/components/debug/pages/CommunicationPage.tsx +89 -0
  62. package/src/components/debug/pages/DashboardPage.tsx +1504 -0
  63. package/src/components/debug/pages/EventsPage.tsx +276 -0
  64. package/src/components/debug/pages/FilesPage.tsx +366 -0
  65. package/src/components/debug/pages/LLMCallPage.tsx +32 -0
  66. package/src/components/debug/pages/LLMCallsPage.tsx +473 -0
  67. package/src/components/debug/pages/LogsPage.tsx +199 -0
  68. package/src/components/debug/pages/MailboxPage.tsx +232 -0
  69. package/src/components/debug/pages/ServicesPage.tsx +193 -0
  70. package/src/components/debug/pages/TimelinePage.tsx +569 -0
  71. package/src/components/debug/pages/UserChatPage.tsx +250 -0
  72. package/src/components/debug/pages/index.ts +13 -0
  73. package/src/index.ts +55 -0
  74. package/src/lib/domain-utils.ts +12 -0
  75. package/src/providers/EventPollingProvider.tsx +60 -0
  76. package/src/stores/event-store.ts +497 -0
  77. package/src/utils/format.ts +8 -0
@@ -0,0 +1,180 @@
1
+ import type { AgentId, LLMCallId, ToolCallId } from '@roj-ai/sdk'
2
+
3
+ // ============================================================================
4
+ // Participant types
5
+ // ============================================================================
6
+
7
+ export type ParticipantRole = 'user' | 'communicator' | 'orchestrator' | 'worker'
8
+
9
+ export type ParticipantStatus = 'idle' | 'thinking' | 'responding' | 'waiting_for_user' | 'error' | 'paused'
10
+
11
+ export interface DiagramParticipant {
12
+ id: AgentId | 'user'
13
+ name: string
14
+ role: ParticipantRole
15
+ spawnedAt: number
16
+ status: ParticipantStatus
17
+ columnIndex: number
18
+ }
19
+
20
+ // ============================================================================
21
+ // Message types
22
+ // ============================================================================
23
+
24
+ export interface DiagramMessage {
25
+ id: string
26
+ fromId: AgentId | 'user'
27
+ toId: AgentId | 'user'
28
+ timestamp: number
29
+ content: string
30
+ yPosition: number
31
+ }
32
+
33
+ // ============================================================================
34
+ // LLM Block types
35
+ // ============================================================================
36
+
37
+ export type BlockStatus = 'running' | 'success' | 'error'
38
+
39
+ export interface DiagramLLMBlock {
40
+ id: string
41
+ llmCallId?: LLMCallId
42
+ participantId: AgentId
43
+ startTime: number
44
+ endTime?: number
45
+ status: BlockStatus
46
+ model?: string
47
+ tokens?: number
48
+ yStart: number
49
+ yEnd: number
50
+ }
51
+
52
+ // ============================================================================
53
+ // Tool Block types
54
+ // ============================================================================
55
+
56
+ export interface DiagramToolBlock {
57
+ id: string
58
+ toolCallId: ToolCallId
59
+ participantId: AgentId
60
+ toolName: string
61
+ startTime: number
62
+ endTime?: number
63
+ status: BlockStatus
64
+ yStart: number
65
+ yEnd: number
66
+ }
67
+
68
+ // ============================================================================
69
+ // Time compression types
70
+ // ============================================================================
71
+
72
+ export type TimeSegmentType = 'active' | 'idle'
73
+
74
+ export interface TimeSegment {
75
+ startTime: number
76
+ endTime: number
77
+ type: TimeSegmentType
78
+ displayHeight: number
79
+ actualDuration: number
80
+ }
81
+
82
+ export interface TimeCompressionConfig {
83
+ pixelsPerSecond: number
84
+ maxIdleHeight: number
85
+ idleThresholdMs: number
86
+ }
87
+
88
+ // ============================================================================
89
+ // Diagram data types
90
+ // ============================================================================
91
+
92
+ export interface DiagramData {
93
+ participants: DiagramParticipant[]
94
+ messages: DiagramMessage[]
95
+ llmBlocks: DiagramLLMBlock[]
96
+ toolBlocks: DiagramToolBlock[]
97
+ timeSegments: TimeSegment[]
98
+ totalHeight: number
99
+ sessionStartTime: number
100
+ }
101
+
102
+ // ============================================================================
103
+ // Zoom/Pan state
104
+ // ============================================================================
105
+
106
+ export interface ZoomPanState {
107
+ zoom: number
108
+ scrollY: number
109
+ autoScroll: boolean
110
+ }
111
+
112
+ // ============================================================================
113
+ // Popover state
114
+ // ============================================================================
115
+
116
+ export type PopoverElement =
117
+ | { type: 'message'; data: DiagramMessage }
118
+ | { type: 'llm'; data: DiagramLLMBlock }
119
+ | { type: 'tool'; data: DiagramToolBlock }
120
+ | { type: 'idle'; data: TimeSegment }
121
+
122
+ export interface PopoverState {
123
+ element: PopoverElement | null
124
+ x: number
125
+ y: number
126
+ }
127
+
128
+ // ============================================================================
129
+ // Layout constants
130
+ // ============================================================================
131
+
132
+ export const LAYOUT = {
133
+ timeAxisWidth: 60,
134
+ participantWidth: 100,
135
+ participantGap: 40,
136
+ headerHeight: 56,
137
+ laneLineWidth: 1,
138
+ blockWidth: 70,
139
+ blockMinHeight: 24,
140
+ idleGapHeight: 32,
141
+ padding: 20,
142
+ messageArrowOffset: 6, // Vertical offset for arrow to not overlap with blocks
143
+ } as const
144
+
145
+ export const COLORS = {
146
+ message: {
147
+ stroke: 'stroke-blue-400',
148
+ fill: 'fill-blue-50',
149
+ text: 'text-blue-600',
150
+ },
151
+ llm: {
152
+ stroke: 'stroke-violet-300',
153
+ fill: 'fill-violet-50',
154
+ fillRunning: 'fill-violet-100',
155
+ text: 'text-violet-600',
156
+ },
157
+ tool: {
158
+ stroke: 'stroke-teal-300',
159
+ fill: 'fill-teal-50',
160
+ fillRunning: 'fill-teal-100',
161
+ text: 'text-teal-600',
162
+ },
163
+ error: {
164
+ stroke: 'stroke-red-300',
165
+ fill: 'fill-red-50',
166
+ text: 'text-red-600',
167
+ },
168
+ idle: {
169
+ stroke: 'stroke-slate-200',
170
+ fill: 'fill-slate-50',
171
+ text: 'text-slate-400',
172
+ },
173
+ participant: {
174
+ user: 'text-blue-600',
175
+ communicator: 'text-emerald-600',
176
+ orchestrator: 'text-violet-600',
177
+ worker: 'text-slate-600',
178
+ },
179
+ lane: 'stroke-slate-100',
180
+ } as const
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Debug Components Index
3
+ *
4
+ * Re-exports all debug-related components for external use.
5
+ */
6
+
7
+ // Context (host app must provide this)
8
+ export { DebugContext, useDebugContext, type DebugContextValue } from './DebugContext'
9
+
10
+ // Navigation utilities
11
+ export { DebugLink, useDebugNavigate, useDebugParams, useDebugSessionId } from './DebugNavigation'
12
+
13
+ // Shell (layout without router dependency)
14
+ export { BackIcon, DebugShell, getNavItemClassName, navItems, type NavItem } from './DebugShell'
15
+
16
+ // Detail components
17
+ export { LLMCallDetail } from './LLMCallDetail'
18
+
19
+ // Pages
20
+ export {
21
+ AgentDetailPage,
22
+ AgentsPage,
23
+ CommunicationPage,
24
+ DashboardPage,
25
+ EventsPage,
26
+ FilesPage,
27
+ LLMCallPage,
28
+ LLMCallsPage,
29
+ LogsPage,
30
+ MailboxPage,
31
+ ServicesPage,
32
+ TimelinePage,
33
+ UserChatPage,
34
+ } from './pages'
35
+
36
+ // Communication diagram components
37
+ export { CommunicationDiagram } from './communication/CommunicationDiagram'