@elizaos/client 1.6.0-beta.1 → 1.6.1-alpha.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/assets/{main-eWX6ruOp.js → main-BNtEiK3o.js} +65 -65
- package/dist/assets/main-BNtEiK3o.js.map +1 -0
- package/dist/assets/{main-CkbfKgca.css → main-BOBWcKWW.css} +119 -1
- package/dist/assets/{main-BXR0yfv8.js → main-C4q5_rtN.js} +3 -3
- package/dist/assets/{main-BXR0yfv8.js.map → main-C4q5_rtN.js.map} +1 -1
- package/dist/assets/{react-vendor-D5Td5IIA.js → react-vendor-pe76PXQl.js} +2 -2
- package/dist/assets/{react-vendor-D5Td5IIA.js.map → react-vendor-pe76PXQl.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +6 -4
- package/src/components/agent-runs/AgentRunTimeline.tsx +700 -0
- package/src/components/agent-sidebar.tsx +18 -2
- package/src/hooks/use-query-hooks.ts +58 -0
- package/src/index.css +24 -0
- package/src/routes/agent-detail.tsx +3 -3
- package/dist/assets/main-eWX6ruOp.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
|
2
2
|
import { useAgentPanels, useAgent, type AgentPanel } from '@/hooks/use-query-hooks';
|
|
3
3
|
import type { UUID, Agent } from '@elizaos/core';
|
|
4
|
-
import { Columns3, Database, Eye, Code, InfoIcon, Loader2 } from 'lucide-react';
|
|
4
|
+
import { Columns3, Database, Eye, Code, InfoIcon, Loader2, Activity } from 'lucide-react';
|
|
5
5
|
import { JSX, useMemo } from 'react';
|
|
6
6
|
import { AgentActionViewer } from './agent-action-viewer';
|
|
7
7
|
import { AgentLogViewer } from './agent-log-viewer';
|
|
@@ -9,6 +9,7 @@ import { AgentMemoryViewer } from './agent-memory-viewer';
|
|
|
9
9
|
import { Skeleton } from './ui/skeleton';
|
|
10
10
|
import AgentSettings from '@/components/agent-settings';
|
|
11
11
|
import { useAgentTabState } from '@/hooks/use-agent-tab-state';
|
|
12
|
+
import AgentRunTimeline from '@/components/agent-runs/AgentRunTimeline';
|
|
12
13
|
|
|
13
14
|
type AgentSidebarProps = {
|
|
14
15
|
agentId: UUID | undefined;
|
|
@@ -16,7 +17,7 @@ type AgentSidebarProps = {
|
|
|
16
17
|
channelId?: UUID;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
type FixedTabValue = 'details' | 'actions' | 'logs' | 'memories';
|
|
20
|
+
type FixedTabValue = 'details' | 'timeline' | 'actions' | 'logs' | 'memories';
|
|
20
21
|
type TabValue = FixedTabValue | string;
|
|
21
22
|
|
|
22
23
|
export function AgentSidebar({ agentId, agentName, channelId }: AgentSidebarProps) {
|
|
@@ -40,6 +41,7 @@ export function AgentSidebar({ agentId, agentName, channelId }: AgentSidebarProp
|
|
|
40
41
|
const allTabs: { value: TabValue; label: string; icon: JSX.Element }[] = useMemo(() => {
|
|
41
42
|
const fixedTabs: { value: FixedTabValue; label: string; icon: JSX.Element }[] = [
|
|
42
43
|
{ value: 'details', label: 'Details', icon: <InfoIcon className="h-4 w-4" /> },
|
|
44
|
+
{ value: 'timeline', label: 'Timeline', icon: <Activity className="h-4 w-4" /> },
|
|
43
45
|
{ value: 'actions', label: 'Model Calls', icon: <Eye className="h-4 w-4" /> },
|
|
44
46
|
{ value: 'memories', label: 'Memories', icon: <Database className="h-4 w-4" /> },
|
|
45
47
|
{ value: 'logs', label: 'Logs', icon: <Code className="h-4 w-4" /> },
|
|
@@ -119,6 +121,20 @@ export function AgentSidebar({ agentId, agentName, channelId }: AgentSidebarProp
|
|
|
119
121
|
)}
|
|
120
122
|
</TabsContent>
|
|
121
123
|
|
|
124
|
+
<TabsContent
|
|
125
|
+
value="timeline"
|
|
126
|
+
className="overflow-y-auto overflow-x-hidden flex-1 w-full max-w-full min-h-0"
|
|
127
|
+
>
|
|
128
|
+
{detailsTab === 'timeline' && agentId && (
|
|
129
|
+
<div className="w-full max-w-full p-4">
|
|
130
|
+
<AgentRunTimeline agentId={agentId} />
|
|
131
|
+
</div>
|
|
132
|
+
)}
|
|
133
|
+
{detailsTab === 'timeline' && !agentId && (
|
|
134
|
+
<div className="p-4 text-muted-foreground">Select an agent to see run activity.</div>
|
|
135
|
+
)}
|
|
136
|
+
</TabsContent>
|
|
137
|
+
|
|
122
138
|
<TabsContent
|
|
123
139
|
value="actions"
|
|
124
140
|
className="overflow-y-auto overflow-x-hidden flex-1 w-full max-w-full min-h-0"
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
apiDateToTimestamp,
|
|
44
44
|
type AgentLog,
|
|
45
45
|
} from '@/lib/api-type-mappers';
|
|
46
|
+
import type { ListRunsParams, RunDetail, RunSummary } from '@elizaos/api-client';
|
|
46
47
|
|
|
47
48
|
// Create ElizaClient instance for direct API calls
|
|
48
49
|
const elizaClient = createElizaClient();
|
|
@@ -182,6 +183,63 @@ export function useAgent(agentId: UUID | undefined | null, options = {}) {
|
|
|
182
183
|
});
|
|
183
184
|
}
|
|
184
185
|
|
|
186
|
+
type RunsListResponse = { runs: RunSummary[]; total: number; hasMore: boolean };
|
|
187
|
+
|
|
188
|
+
export function useAgentRuns(
|
|
189
|
+
agentId: UUID | undefined | null,
|
|
190
|
+
params?: ListRunsParams,
|
|
191
|
+
options: Partial<UseQueryOptions<RunsListResponse, Error, RunsListResponse>> = {}
|
|
192
|
+
) {
|
|
193
|
+
const network = useNetworkStatus();
|
|
194
|
+
const sanitizedParams = params
|
|
195
|
+
? Object.fromEntries(Object.entries(params).filter(([_, value]) => value !== undefined))
|
|
196
|
+
: undefined;
|
|
197
|
+
const serializedParams = sanitizedParams ? JSON.stringify(sanitizedParams) : 'default';
|
|
198
|
+
|
|
199
|
+
return useQuery<RunsListResponse>({
|
|
200
|
+
queryKey: ['agent', agentId, 'runs', serializedParams],
|
|
201
|
+
queryFn: async () => {
|
|
202
|
+
if (!agentId) throw new Error('Agent ID is required');
|
|
203
|
+
return elizaClient.runs.listRuns(agentId, sanitizedParams as ListRunsParams | undefined);
|
|
204
|
+
},
|
|
205
|
+
enabled: Boolean(agentId),
|
|
206
|
+
staleTime: STALE_TIMES.FREQUENT,
|
|
207
|
+
refetchInterval: !network.isOffline && Boolean(agentId) ? STALE_TIMES.FREQUENT : false,
|
|
208
|
+
refetchIntervalInBackground: false,
|
|
209
|
+
...(!network.isOffline &&
|
|
210
|
+
network.effectiveType === 'slow-2g' && {
|
|
211
|
+
refetchInterval: STALE_TIMES.STANDARD,
|
|
212
|
+
}),
|
|
213
|
+
...options,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function useAgentRunDetail(
|
|
218
|
+
agentId: UUID | undefined | null,
|
|
219
|
+
runId: UUID | undefined | null,
|
|
220
|
+
roomId?: UUID | null,
|
|
221
|
+
options: Partial<UseQueryOptions<RunDetail, Error, RunDetail>> = {}
|
|
222
|
+
) {
|
|
223
|
+
const network = useNetworkStatus();
|
|
224
|
+
|
|
225
|
+
return useQuery<RunDetail>({
|
|
226
|
+
queryKey: ['agent', agentId, 'runs', 'detail', runId, roomId ?? null],
|
|
227
|
+
queryFn: async () => {
|
|
228
|
+
if (!agentId || !runId) throw new Error('Agent ID and Run ID are required');
|
|
229
|
+
return elizaClient.runs.getRun(agentId, runId, roomId ?? undefined);
|
|
230
|
+
},
|
|
231
|
+
enabled: Boolean(agentId && runId),
|
|
232
|
+
staleTime: STALE_TIMES.FREQUENT,
|
|
233
|
+
refetchInterval: !network.isOffline && Boolean(agentId && runId) ? STALE_TIMES.FREQUENT : false,
|
|
234
|
+
refetchIntervalInBackground: false,
|
|
235
|
+
...(!network.isOffline &&
|
|
236
|
+
network.effectiveType === 'slow-2g' && {
|
|
237
|
+
refetchInterval: STALE_TIMES.STANDARD,
|
|
238
|
+
}),
|
|
239
|
+
...options,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
185
243
|
// Hook for starting an agent with optimistic updates
|
|
186
244
|
/**
|
|
187
245
|
* Custom hook to start an agent by calling the API with the provided agent ID.
|
package/src/index.css
CHANGED
|
@@ -132,6 +132,30 @@
|
|
|
132
132
|
background-color: rgb(107, 114, 128);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
.vis-item.timeline-item-success {
|
|
136
|
+
background-color: rgba(34, 197, 94, 0.2);
|
|
137
|
+
border-color: rgb(34, 197, 94);
|
|
138
|
+
color: rgb(22, 101, 52);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.vis-item.timeline-item-error {
|
|
142
|
+
background-color: rgba(248, 113, 113, 0.2);
|
|
143
|
+
border-color: rgb(220, 38, 38);
|
|
144
|
+
color: rgb(185, 28, 28);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.vis-item.timeline-item-warning {
|
|
148
|
+
background-color: rgba(251, 191, 36, 0.2);
|
|
149
|
+
border-color: rgb(217, 119, 6);
|
|
150
|
+
color: rgb(146, 64, 14);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.vis-item.timeline-item-neutral {
|
|
154
|
+
background-color: rgba(148, 163, 184, 0.2);
|
|
155
|
+
border-color: rgb(148, 163, 184);
|
|
156
|
+
color: rgb(30, 41, 59);
|
|
157
|
+
}
|
|
158
|
+
|
|
135
159
|
@utility container {
|
|
136
160
|
margin-inline: auto;
|
|
137
161
|
}
|
|
@@ -15,12 +15,12 @@ const AgentDetail: React.FC = () => {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<div className="p-4">
|
|
18
|
-
<h1 className="text-2xl font-bold
|
|
18
|
+
<h1 className="mb-4 text-2xl font-bold">{agent.name}</h1>
|
|
19
19
|
<div className="grid gap-4">
|
|
20
|
-
<div className="
|
|
20
|
+
<div className="rounded-lg border p-4 shadow-sm">
|
|
21
21
|
<h2 className="text-xl font-semibold">Agent Details</h2>
|
|
22
22
|
<p className="text-sm text-gray-500">ID: {agent.id}</p>
|
|
23
|
-
{/*
|
|
23
|
+
{/* Additional agent details can be added here */}
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|