@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.
- package/dist/components/debug/DebugContext.d.ts +10 -0
- package/dist/components/debug/DebugNavigation.d.ts +29 -0
- package/dist/components/debug/DebugShell.d.ts +18 -0
- package/dist/components/debug/LLMCallDetail.d.ts +7 -0
- package/dist/components/debug/TimelineDetailInspector.d.ts +6 -0
- package/dist/components/debug/communication/CommunicationDiagram.d.ts +9 -0
- package/dist/components/debug/communication/DiagramHeader.d.ts +7 -0
- package/dist/components/debug/communication/ParticipantLane.d.ts +7 -0
- package/dist/components/debug/communication/TimeAxis.d.ts +9 -0
- package/dist/components/debug/communication/elements/IdleGap.d.ts +9 -0
- package/dist/components/debug/communication/elements/LLMBlock.d.ts +9 -0
- package/dist/components/debug/communication/elements/MessageArrow.d.ts +10 -0
- package/dist/components/debug/communication/elements/ToolBlock.d.ts +9 -0
- package/dist/components/debug/communication/hooks/useDiagramData.d.ts +12 -0
- package/dist/components/debug/communication/hooks/useTimeCompression.d.ts +7 -0
- package/dist/components/debug/communication/hooks/useZoomPan.d.ts +11 -0
- package/dist/components/debug/communication/popovers/ElementPopover.d.ts +8 -0
- package/dist/components/debug/communication/types.d.ts +136 -0
- package/dist/components/debug/index.d.ts +11 -0
- package/dist/components/debug/pages/AgentDetailPage.d.ts +3 -0
- package/dist/components/debug/pages/AgentsPage.d.ts +1 -0
- package/dist/components/debug/pages/CommunicationPage.d.ts +1 -0
- package/dist/components/debug/pages/DashboardPage.d.ts +1 -0
- package/dist/components/debug/pages/EventsPage.d.ts +1 -0
- package/dist/components/debug/pages/FilesPage.d.ts +1 -0
- package/dist/components/debug/pages/LLMCallPage.d.ts +1 -0
- package/dist/components/debug/pages/LLMCallsPage.d.ts +1 -0
- package/dist/components/debug/pages/LogsPage.d.ts +1 -0
- package/dist/components/debug/pages/MailboxPage.d.ts +1 -0
- package/dist/components/debug/pages/ServicesPage.d.ts +1 -0
- package/dist/components/debug/pages/TimelinePage.d.ts +1 -0
- package/dist/components/debug/pages/UserChatPage.d.ts +1 -0
- package/dist/components/debug/pages/index.d.ts +13 -0
- package/dist/index.d.ts +9 -0
- package/dist/lib/domain-utils.d.ts +7 -0
- package/dist/providers/EventPollingProvider.d.ts +27 -0
- package/dist/stores/event-store.d.ts +93 -0
- package/dist/utils/format.d.ts +1 -0
- package/package.json +43 -0
- package/src/components/debug/DebugContext.tsx +18 -0
- package/src/components/debug/DebugNavigation.tsx +55 -0
- package/src/components/debug/DebugShell.tsx +321 -0
- package/src/components/debug/LLMCallDetail.tsx +740 -0
- package/src/components/debug/TimelineDetailInspector.tsx +204 -0
- package/src/components/debug/communication/CommunicationDiagram.tsx +260 -0
- package/src/components/debug/communication/DiagramHeader.tsx +113 -0
- package/src/components/debug/communication/ParticipantLane.tsx +60 -0
- package/src/components/debug/communication/TimeAxis.tsx +106 -0
- package/src/components/debug/communication/elements/IdleGap.tsx +90 -0
- package/src/components/debug/communication/elements/LLMBlock.tsx +107 -0
- package/src/components/debug/communication/elements/MessageArrow.tsx +119 -0
- package/src/components/debug/communication/elements/ToolBlock.tsx +99 -0
- package/src/components/debug/communication/hooks/useDiagramData.ts +294 -0
- package/src/components/debug/communication/hooks/useTimeCompression.ts +140 -0
- package/src/components/debug/communication/hooks/useZoomPan.ts +87 -0
- package/src/components/debug/communication/popovers/ElementPopover.tsx +158 -0
- package/src/components/debug/communication/types.ts +180 -0
- package/src/components/debug/index.ts +37 -0
- package/src/components/debug/pages/AgentDetailPage.tsx +1295 -0
- package/src/components/debug/pages/AgentsPage.tsx +297 -0
- package/src/components/debug/pages/CommunicationPage.tsx +89 -0
- package/src/components/debug/pages/DashboardPage.tsx +1504 -0
- package/src/components/debug/pages/EventsPage.tsx +276 -0
- package/src/components/debug/pages/FilesPage.tsx +366 -0
- package/src/components/debug/pages/LLMCallPage.tsx +32 -0
- package/src/components/debug/pages/LLMCallsPage.tsx +473 -0
- package/src/components/debug/pages/LogsPage.tsx +199 -0
- package/src/components/debug/pages/MailboxPage.tsx +232 -0
- package/src/components/debug/pages/ServicesPage.tsx +193 -0
- package/src/components/debug/pages/TimelinePage.tsx +569 -0
- package/src/components/debug/pages/UserChatPage.tsx +250 -0
- package/src/components/debug/pages/index.ts +13 -0
- package/src/index.ts +55 -0
- package/src/lib/domain-utils.ts +12 -0
- package/src/providers/EventPollingProvider.tsx +60 -0
- package/src/stores/event-store.ts +497 -0
- package/src/utils/format.ts +8 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SessionId } from '@roj-ai/shared';
|
|
2
|
+
export interface DebugContextValue {
|
|
3
|
+
sessionId: SessionId;
|
|
4
|
+
params: Record<string, string | undefined>;
|
|
5
|
+
navigate: (subpath: string) => void;
|
|
6
|
+
createHref: (subpath: string) => string;
|
|
7
|
+
isActive: (subpath: string) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const DebugContext: import("react").Context<DebugContextValue | null>;
|
|
10
|
+
export declare function useDebugContext(): DebugContextValue;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified navigation utilities for debug UI.
|
|
3
|
+
*
|
|
4
|
+
* All navigation goes through DebugContext, which is provided by the host app
|
|
5
|
+
* (admin via buzola, worker SPA via react-router, etc.).
|
|
6
|
+
*/
|
|
7
|
+
import type { SessionId } from '@roj-ai/shared';
|
|
8
|
+
import type { ReactNode } from 'react';
|
|
9
|
+
/**
|
|
10
|
+
* Get the session ID from the debug context.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useDebugSessionId(): SessionId;
|
|
13
|
+
/**
|
|
14
|
+
* Get route params from the debug context.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useDebugParams<T extends Record<string, string | undefined>>(): T;
|
|
17
|
+
/**
|
|
18
|
+
* Navigate to a debug subpath (e.g., "agents/abc123", "llm-calls/xyz").
|
|
19
|
+
*/
|
|
20
|
+
export declare function useDebugNavigate(): (subpath: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Link component for debug navigation.
|
|
23
|
+
* Renders an <a> tag with proper href for right-click/open-in-new-tab support.
|
|
24
|
+
*/
|
|
25
|
+
export declare function DebugLink({ to, className, children }: {
|
|
26
|
+
to: string;
|
|
27
|
+
className?: string;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface NavItem {
|
|
3
|
+
to: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon: React.FC;
|
|
6
|
+
}
|
|
7
|
+
export declare const navItems: NavItem[];
|
|
8
|
+
interface DebugShellProps {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
className?: string;
|
|
12
|
+
renderNavItem: (item: NavItem) => ReactNode;
|
|
13
|
+
sidebarFooter?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function DebugShell({ sessionId, children, className, renderNavItem, sidebarFooter }: DebugShellProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function getNavItemClassName(isActive: boolean): string;
|
|
17
|
+
export declare function BackIcon(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DiagramData } from './types';
|
|
2
|
+
interface CommunicationDiagramProps {
|
|
3
|
+
data: DiagramData & {
|
|
4
|
+
timestampToY: (timestamp: number) => number;
|
|
5
|
+
formatIdleDuration: (ms: number) => string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare function CommunicationDiagram({ data }: CommunicationDiagramProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DiagramParticipant } from './types';
|
|
2
|
+
interface DiagramHeaderProps {
|
|
3
|
+
participants: DiagramParticipant[];
|
|
4
|
+
zoom: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function DiagramHeader({ participants, zoom }: DiagramHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DiagramParticipant } from './types';
|
|
2
|
+
interface ParticipantLaneProps {
|
|
3
|
+
participant: DiagramParticipant;
|
|
4
|
+
totalHeight: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function ParticipantLane({ participant, totalHeight }: ParticipantLaneProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TimeSegment } from './types';
|
|
2
|
+
interface TimeAxisProps {
|
|
3
|
+
segments: TimeSegment[];
|
|
4
|
+
sessionStartTime: number;
|
|
5
|
+
timestampToY: (timestamp: number) => number;
|
|
6
|
+
totalHeight: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function TimeAxis({ segments, sessionStartTime, timestampToY, totalHeight }: TimeAxisProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DiagramParticipant, TimeSegment } from '../types';
|
|
2
|
+
interface IdleGapProps {
|
|
3
|
+
segment: TimeSegment;
|
|
4
|
+
participants: DiagramParticipant[];
|
|
5
|
+
yPosition: number;
|
|
6
|
+
formatDuration: (ms: number) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare function IdleGap({ segment, participants, yPosition, formatDuration }: IdleGapProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DiagramLLMBlock, DiagramParticipant } from '../types';
|
|
2
|
+
interface LLMBlockProps {
|
|
3
|
+
block: DiagramLLMBlock;
|
|
4
|
+
participants: DiagramParticipant[];
|
|
5
|
+
onHover?: (block: DiagramLLMBlock | null, x: number, y: number) => void;
|
|
6
|
+
onClick?: (block: DiagramLLMBlock) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function LLMBlock({ block, participants, onHover, onClick }: LLMBlockProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DiagramMessage, DiagramParticipant } from '../types';
|
|
2
|
+
interface MessageArrowProps {
|
|
3
|
+
message: DiagramMessage;
|
|
4
|
+
participants: DiagramParticipant[];
|
|
5
|
+
showLabel?: boolean;
|
|
6
|
+
onHover?: (message: DiagramMessage | null, x: number, y: number) => void;
|
|
7
|
+
onClick?: (message: DiagramMessage) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function MessageArrow({ message, participants, showLabel, onHover, onClick }: MessageArrowProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DiagramParticipant, DiagramToolBlock } from '../types';
|
|
2
|
+
interface ToolBlockProps {
|
|
3
|
+
block: DiagramToolBlock;
|
|
4
|
+
participants: DiagramParticipant[];
|
|
5
|
+
onHover?: (block: DiagramToolBlock | null, x: number, y: number) => void;
|
|
6
|
+
onClick?: (block: DiagramToolBlock) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ToolBlock({ block, participants, onHover, onClick }: ToolBlockProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentTreeNode } from '@roj-ai/shared';
|
|
2
|
+
import type { DomainEvent } from '@roj-ai/sdk';
|
|
3
|
+
import type { DiagramData } from '../types';
|
|
4
|
+
interface UseDiagramDataProps {
|
|
5
|
+
events: DomainEvent[];
|
|
6
|
+
agents: AgentTreeNode[];
|
|
7
|
+
}
|
|
8
|
+
export declare function useDiagramData({ events, agents }: UseDiagramDataProps): DiagramData & {
|
|
9
|
+
timestampToY: (timestamp: number) => number;
|
|
10
|
+
formatIdleDuration: (ms: number) => string;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { TimeCompressionConfig, TimeSegment } from '../types';
|
|
2
|
+
export declare function useTimeCompression(timestamps: number[], config?: Partial<TimeCompressionConfig>): {
|
|
3
|
+
segments: TimeSegment[];
|
|
4
|
+
totalHeight: number;
|
|
5
|
+
timestampToY: (timestamp: number) => number;
|
|
6
|
+
formatIdleDuration: (ms: number) => string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ZoomPanState } from '../types';
|
|
2
|
+
export declare function useZoomPan(totalHeight: number): {
|
|
3
|
+
state: ZoomPanState;
|
|
4
|
+
containerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
5
|
+
zoomIn: () => void;
|
|
6
|
+
zoomOut: () => void;
|
|
7
|
+
resetZoom: () => void;
|
|
8
|
+
toggleAutoScroll: () => void;
|
|
9
|
+
handleScroll: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
10
|
+
handleWheel: (e: React.WheelEvent<HTMLDivElement>) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PopoverElement } from '../types';
|
|
2
|
+
interface ElementPopoverProps {
|
|
3
|
+
element: PopoverElement;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function ElementPopover({ element, x, y }: ElementPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { AgentId, LLMCallId, ToolCallId } from '@roj-ai/sdk';
|
|
2
|
+
export type ParticipantRole = 'user' | 'communicator' | 'orchestrator' | 'worker';
|
|
3
|
+
export type ParticipantStatus = 'idle' | 'thinking' | 'responding' | 'waiting_for_user' | 'error' | 'paused';
|
|
4
|
+
export interface DiagramParticipant {
|
|
5
|
+
id: AgentId | 'user';
|
|
6
|
+
name: string;
|
|
7
|
+
role: ParticipantRole;
|
|
8
|
+
spawnedAt: number;
|
|
9
|
+
status: ParticipantStatus;
|
|
10
|
+
columnIndex: number;
|
|
11
|
+
}
|
|
12
|
+
export interface DiagramMessage {
|
|
13
|
+
id: string;
|
|
14
|
+
fromId: AgentId | 'user';
|
|
15
|
+
toId: AgentId | 'user';
|
|
16
|
+
timestamp: number;
|
|
17
|
+
content: string;
|
|
18
|
+
yPosition: number;
|
|
19
|
+
}
|
|
20
|
+
export type BlockStatus = 'running' | 'success' | 'error';
|
|
21
|
+
export interface DiagramLLMBlock {
|
|
22
|
+
id: string;
|
|
23
|
+
llmCallId?: LLMCallId;
|
|
24
|
+
participantId: AgentId;
|
|
25
|
+
startTime: number;
|
|
26
|
+
endTime?: number;
|
|
27
|
+
status: BlockStatus;
|
|
28
|
+
model?: string;
|
|
29
|
+
tokens?: number;
|
|
30
|
+
yStart: number;
|
|
31
|
+
yEnd: number;
|
|
32
|
+
}
|
|
33
|
+
export interface DiagramToolBlock {
|
|
34
|
+
id: string;
|
|
35
|
+
toolCallId: ToolCallId;
|
|
36
|
+
participantId: AgentId;
|
|
37
|
+
toolName: string;
|
|
38
|
+
startTime: number;
|
|
39
|
+
endTime?: number;
|
|
40
|
+
status: BlockStatus;
|
|
41
|
+
yStart: number;
|
|
42
|
+
yEnd: number;
|
|
43
|
+
}
|
|
44
|
+
export type TimeSegmentType = 'active' | 'idle';
|
|
45
|
+
export interface TimeSegment {
|
|
46
|
+
startTime: number;
|
|
47
|
+
endTime: number;
|
|
48
|
+
type: TimeSegmentType;
|
|
49
|
+
displayHeight: number;
|
|
50
|
+
actualDuration: number;
|
|
51
|
+
}
|
|
52
|
+
export interface TimeCompressionConfig {
|
|
53
|
+
pixelsPerSecond: number;
|
|
54
|
+
maxIdleHeight: number;
|
|
55
|
+
idleThresholdMs: number;
|
|
56
|
+
}
|
|
57
|
+
export interface DiagramData {
|
|
58
|
+
participants: DiagramParticipant[];
|
|
59
|
+
messages: DiagramMessage[];
|
|
60
|
+
llmBlocks: DiagramLLMBlock[];
|
|
61
|
+
toolBlocks: DiagramToolBlock[];
|
|
62
|
+
timeSegments: TimeSegment[];
|
|
63
|
+
totalHeight: number;
|
|
64
|
+
sessionStartTime: number;
|
|
65
|
+
}
|
|
66
|
+
export interface ZoomPanState {
|
|
67
|
+
zoom: number;
|
|
68
|
+
scrollY: number;
|
|
69
|
+
autoScroll: boolean;
|
|
70
|
+
}
|
|
71
|
+
export type PopoverElement = {
|
|
72
|
+
type: 'message';
|
|
73
|
+
data: DiagramMessage;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'llm';
|
|
76
|
+
data: DiagramLLMBlock;
|
|
77
|
+
} | {
|
|
78
|
+
type: 'tool';
|
|
79
|
+
data: DiagramToolBlock;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'idle';
|
|
82
|
+
data: TimeSegment;
|
|
83
|
+
};
|
|
84
|
+
export interface PopoverState {
|
|
85
|
+
element: PopoverElement | null;
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
}
|
|
89
|
+
export declare const LAYOUT: {
|
|
90
|
+
readonly timeAxisWidth: 60;
|
|
91
|
+
readonly participantWidth: 100;
|
|
92
|
+
readonly participantGap: 40;
|
|
93
|
+
readonly headerHeight: 56;
|
|
94
|
+
readonly laneLineWidth: 1;
|
|
95
|
+
readonly blockWidth: 70;
|
|
96
|
+
readonly blockMinHeight: 24;
|
|
97
|
+
readonly idleGapHeight: 32;
|
|
98
|
+
readonly padding: 20;
|
|
99
|
+
readonly messageArrowOffset: 6;
|
|
100
|
+
};
|
|
101
|
+
export declare const COLORS: {
|
|
102
|
+
readonly message: {
|
|
103
|
+
readonly stroke: "stroke-blue-400";
|
|
104
|
+
readonly fill: "fill-blue-50";
|
|
105
|
+
readonly text: "text-blue-600";
|
|
106
|
+
};
|
|
107
|
+
readonly llm: {
|
|
108
|
+
readonly stroke: "stroke-violet-300";
|
|
109
|
+
readonly fill: "fill-violet-50";
|
|
110
|
+
readonly fillRunning: "fill-violet-100";
|
|
111
|
+
readonly text: "text-violet-600";
|
|
112
|
+
};
|
|
113
|
+
readonly tool: {
|
|
114
|
+
readonly stroke: "stroke-teal-300";
|
|
115
|
+
readonly fill: "fill-teal-50";
|
|
116
|
+
readonly fillRunning: "fill-teal-100";
|
|
117
|
+
readonly text: "text-teal-600";
|
|
118
|
+
};
|
|
119
|
+
readonly error: {
|
|
120
|
+
readonly stroke: "stroke-red-300";
|
|
121
|
+
readonly fill: "fill-red-50";
|
|
122
|
+
readonly text: "text-red-600";
|
|
123
|
+
};
|
|
124
|
+
readonly idle: {
|
|
125
|
+
readonly stroke: "stroke-slate-200";
|
|
126
|
+
readonly fill: "fill-slate-50";
|
|
127
|
+
readonly text: "text-slate-400";
|
|
128
|
+
};
|
|
129
|
+
readonly participant: {
|
|
130
|
+
readonly user: "text-blue-600";
|
|
131
|
+
readonly communicator: "text-emerald-600";
|
|
132
|
+
readonly orchestrator: "text-violet-600";
|
|
133
|
+
readonly worker: "text-slate-600";
|
|
134
|
+
};
|
|
135
|
+
readonly lane: "stroke-slate-100";
|
|
136
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug Components Index
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all debug-related components for external use.
|
|
5
|
+
*/
|
|
6
|
+
export { DebugContext, useDebugContext, type DebugContextValue } from './DebugContext';
|
|
7
|
+
export { DebugLink, useDebugNavigate, useDebugParams, useDebugSessionId } from './DebugNavigation';
|
|
8
|
+
export { BackIcon, DebugShell, getNavItemClassName, navItems, type NavItem } from './DebugShell';
|
|
9
|
+
export { LLMCallDetail } from './LLMCallDetail';
|
|
10
|
+
export { AgentDetailPage, AgentsPage, CommunicationPage, DashboardPage, EventsPage, FilesPage, LLMCallPage, LLMCallsPage, LogsPage, MailboxPage, ServicesPage, TimelinePage, UserChatPage, } from './pages';
|
|
11
|
+
export { CommunicationDiagram } from './communication/CommunicationDiagram';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AgentsPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CommunicationPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DashboardPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function EventsPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FilesPage(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LLMCallPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LLMCallsPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LogsPage(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MailboxPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ServicesPage(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TimelinePage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function UserChatPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { AgentDetailPage } from './AgentDetailPage';
|
|
2
|
+
export { DashboardPage } from './DashboardPage';
|
|
3
|
+
export { AgentsPage } from './AgentsPage';
|
|
4
|
+
export { CommunicationPage } from './CommunicationPage';
|
|
5
|
+
export { EventsPage } from './EventsPage';
|
|
6
|
+
export { LLMCallPage } from './LLMCallPage';
|
|
7
|
+
export { LLMCallsPage } from './LLMCallsPage';
|
|
8
|
+
export { MailboxPage } from './MailboxPage';
|
|
9
|
+
export { TimelinePage } from './TimelinePage';
|
|
10
|
+
export { UserChatPage } from './UserChatPage';
|
|
11
|
+
export { FilesPage } from './FilesPage';
|
|
12
|
+
export { LogsPage } from './LogsPage';
|
|
13
|
+
export { ServicesPage } from './ServicesPage';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @roj-ai/debug
|
|
3
|
+
*
|
|
4
|
+
* React debug UI for session event inspection — extracted from @roj-ai/client.
|
|
5
|
+
*/
|
|
6
|
+
export { selectAgentTree, selectGlobalMailbox, selectMetrics, selectTimeline, useAgentDetail, useAgentTree, useChatDebug, useEvents, useEventStore, useGlobalMailbox, useMetrics, useSessionInfo, useTimeline, } from './stores/event-store';
|
|
7
|
+
export { EventPollingProvider, useEventPolling } from './providers/EventPollingProvider';
|
|
8
|
+
export { AgentDetailPage, AgentsPage, BackIcon, CommunicationDiagram, CommunicationPage, DashboardPage, DebugContext, DebugLink, DebugShell, EventsPage, FilesPage, getNavItemClassName, LLMCallDetail, LLMCallPage, LLMCallsPage, LogsPage, MailboxPage, navItems, ServicesPage, TimelinePage, useDebugContext, useDebugNavigate, useDebugParams, useDebugSessionId, UserChatPage, } from './components/debug';
|
|
9
|
+
export type { DebugContextValue, NavItem } from './components/debug';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface EventPollingProviderProps {
|
|
2
|
+
sessionId: string;
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Provider component that manages event polling for a session.
|
|
7
|
+
*
|
|
8
|
+
* When mounted, it loads the session's events and starts polling for new events.
|
|
9
|
+
* When unmounted (e.g., navigating away), it stops polling and resets the store.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <EventPollingProvider sessionId={sessionId}>
|
|
14
|
+
* <DebugViews />
|
|
15
|
+
* </EventPollingProvider>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function EventPollingProvider({ sessionId, children }: EventPollingProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* Hook to initialize event polling for a session.
|
|
21
|
+
* Use this instead of EventPollingProvider if you want more control.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useEventPolling(sessionId: string | undefined): {
|
|
24
|
+
isLoading: boolean;
|
|
25
|
+
error: string | null;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { AgentId } from '@roj-ai/shared';
|
|
2
|
+
import type { DomainEvent } from '@roj-ai/sdk';
|
|
3
|
+
import { type AgentDetailProjectionState, type AgentRegistryState, type AgentTreeNode, type AgentTreeProjectionState, type ChatDebugState, type DebugChatMessage, type GetAgentDetailResponse, type GetMetricsResponse, type GlobalMailboxMessage, type MailboxState, type MetricsState, type ServicesProjectionState, type SessionInfoState, type TimelineItem, type TimelineState } from '@roj-ai/shared';
|
|
4
|
+
/**
|
|
5
|
+
* Event store for managing session events and derived state.
|
|
6
|
+
*
|
|
7
|
+
* This store:
|
|
8
|
+
* - Loads and polls for events from the server
|
|
9
|
+
* - Applies events incrementally to projection states (no SessionState needed)
|
|
10
|
+
* - Provides selectors for derived data (agent tree, timeline, mailbox, metrics)
|
|
11
|
+
*
|
|
12
|
+
* All projections are computed incrementally - adding a new event only updates
|
|
13
|
+
* the affected projection state, not rebuilds from scratch.
|
|
14
|
+
*/
|
|
15
|
+
interface EventStoreState {
|
|
16
|
+
sessionId: string | null;
|
|
17
|
+
events: DomainEvent[];
|
|
18
|
+
lastIndex: number;
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
error: string | null;
|
|
21
|
+
sessionInfoState: SessionInfoState;
|
|
22
|
+
agentRegistryState: AgentRegistryState;
|
|
23
|
+
agentTreeProjectionState: AgentTreeProjectionState;
|
|
24
|
+
agentDetailProjectionState: AgentDetailProjectionState;
|
|
25
|
+
servicesProjectionState: ServicesProjectionState;
|
|
26
|
+
metricsState: MetricsState;
|
|
27
|
+
timelineState: TimelineState;
|
|
28
|
+
mailboxState: MailboxState;
|
|
29
|
+
chatDebugState: ChatDebugState;
|
|
30
|
+
metrics: GetMetricsResponse;
|
|
31
|
+
timeline: TimelineItem[];
|
|
32
|
+
agentTree: AgentTreeNode[];
|
|
33
|
+
globalMailbox: GlobalMailboxMessage[];
|
|
34
|
+
chatDebugMessages: DebugChatMessage[];
|
|
35
|
+
isPolling: boolean;
|
|
36
|
+
pollIntervalMs: number;
|
|
37
|
+
loadSession: (sessionId: string) => Promise<void>;
|
|
38
|
+
fetchNewEvents: () => Promise<void>;
|
|
39
|
+
reset: () => void;
|
|
40
|
+
startPolling: () => void;
|
|
41
|
+
stopPolling: () => void;
|
|
42
|
+
}
|
|
43
|
+
export declare const useEventStore: import("zustand").UseBoundStore<import("zustand").StoreApi<EventStoreState>>;
|
|
44
|
+
/**
|
|
45
|
+
* Get agent tree (cached in store).
|
|
46
|
+
*/
|
|
47
|
+
export declare function selectAgentTree(state: EventStoreState): AgentTreeNode[];
|
|
48
|
+
/**
|
|
49
|
+
* Get timeline items (cached in store).
|
|
50
|
+
*/
|
|
51
|
+
export declare function selectTimeline(state: EventStoreState): TimelineItem[];
|
|
52
|
+
/**
|
|
53
|
+
* Get global mailbox messages (cached in store).
|
|
54
|
+
*/
|
|
55
|
+
export declare function selectGlobalMailbox(state: EventStoreState): GlobalMailboxMessage[];
|
|
56
|
+
/**
|
|
57
|
+
* Get metrics (cached in store).
|
|
58
|
+
*/
|
|
59
|
+
export declare function selectMetrics(state: EventStoreState): GetMetricsResponse;
|
|
60
|
+
/**
|
|
61
|
+
* Hook to get agent tree (cached in store).
|
|
62
|
+
*/
|
|
63
|
+
export declare function useAgentTree(): AgentTreeNode[];
|
|
64
|
+
/**
|
|
65
|
+
* Hook to get timeline items (cached in store).
|
|
66
|
+
*/
|
|
67
|
+
export declare function useTimeline(): TimelineItem[];
|
|
68
|
+
/**
|
|
69
|
+
* Hook to get global mailbox messages (cached in store).
|
|
70
|
+
*/
|
|
71
|
+
export declare function useGlobalMailbox(): GlobalMailboxMessage[];
|
|
72
|
+
/**
|
|
73
|
+
* Hook to get metrics (cached in store).
|
|
74
|
+
*/
|
|
75
|
+
export declare function useMetrics(): GetMetricsResponse;
|
|
76
|
+
/**
|
|
77
|
+
* Hook to get raw events.
|
|
78
|
+
*/
|
|
79
|
+
export declare function useEvents(): DomainEvent[];
|
|
80
|
+
/**
|
|
81
|
+
* Hook to get chat debug messages (cached in store).
|
|
82
|
+
*/
|
|
83
|
+
export declare function useChatDebug(): DebugChatMessage[];
|
|
84
|
+
/**
|
|
85
|
+
* Hook to get session info (metadata from session lifecycle events).
|
|
86
|
+
*/
|
|
87
|
+
export declare function useSessionInfo(): SessionInfoState;
|
|
88
|
+
/**
|
|
89
|
+
* Hook to get agent detail by ID.
|
|
90
|
+
* Uses useMemo to avoid creating new objects on every render.
|
|
91
|
+
*/
|
|
92
|
+
export declare function useAgentDetail(agentId: AgentId): GetAgentDetailResponse | null;
|
|
93
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatDuration(ms: number): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@roj-ai/debug",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./src/index.ts",
|
|
10
|
+
"default": "./src/index.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"src",
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"type-check": "tsc --noEmit"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@roj-ai/client": "^0.0.2",
|
|
25
|
+
"@roj-ai/shared": "^0.0.2",
|
|
26
|
+
"tokenx": "1.3.0",
|
|
27
|
+
"zustand": "5.0.11"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@roj-ai/sdk": "^0.0.2",
|
|
31
|
+
"@types/react": "19.2.14",
|
|
32
|
+
"@types/react-dom": "19.2.3",
|
|
33
|
+
"react": "19.2.4",
|
|
34
|
+
"react-dom": "19.2.4",
|
|
35
|
+
"typescript": "5.9.3"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"lucide-react": "*",
|
|
39
|
+
"react": "19.2.4",
|
|
40
|
+
"react-dom": "19.2.4"
|
|
41
|
+
},
|
|
42
|
+
"types": "./dist/index.d.ts"
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SessionId } from '@roj-ai/shared'
|
|
2
|
+
import { createContext, useContext } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface DebugContextValue {
|
|
5
|
+
sessionId: SessionId
|
|
6
|
+
params: Record<string, string | undefined>
|
|
7
|
+
navigate: (subpath: string) => void
|
|
8
|
+
createHref: (subpath: string) => string
|
|
9
|
+
isActive: (subpath: string) => boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const DebugContext = createContext<DebugContextValue | null>(null)
|
|
13
|
+
|
|
14
|
+
export function useDebugContext(): DebugContextValue {
|
|
15
|
+
const ctx = useContext(DebugContext)
|
|
16
|
+
if (!ctx) throw new Error('useDebugContext must be used within a DebugContext.Provider')
|
|
17
|
+
return ctx
|
|
18
|
+
}
|