aether-react 0.1.0 → 1.0.0
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/index.d.ts +346 -9
- package/dist/index.js +4135 -1249
- package/dist/index.js.map +1 -1
- package/dist/studio/assets/icon-BfbUHDfA.png +0 -0
- package/dist/studio/assets/index-pfWyyaa5.js +119 -0
- package/dist/studio/assets/index-r14phtju.css +1 -0
- package/dist/studio/index.html +44 -0
- package/package.json +14 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,134 @@
|
|
|
1
|
+
import { MemoryEvent, MemoryEventInput, RetrievalOptions, MemoryStats, Aether, Prediction, SimulationResult, Anomaly, AnomalySeverity, RetrievalType, Trajectory, Pattern, TransitionMatrix } from 'aether-core';
|
|
1
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for RemoteAether client.
|
|
7
|
+
*/
|
|
8
|
+
interface RemoteAetherConfig {
|
|
9
|
+
/** Base URL of the Aether server (e.g., 'http://localhost:3000') */
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
/** Optional API key for authentication */
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
/** WebSocket URL (defaults to ws(s)://baseUrl/ws) */
|
|
14
|
+
wsUrl?: string;
|
|
15
|
+
/** Auto-reconnect WebSocket on disconnect */
|
|
16
|
+
autoReconnect?: boolean;
|
|
17
|
+
/** Reconnect delay in ms */
|
|
18
|
+
reconnectDelay?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Unsubscribe function type.
|
|
22
|
+
*/
|
|
23
|
+
type Unsubscribe = () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Event listener callback type.
|
|
26
|
+
*/
|
|
27
|
+
type EventListener = (event: MemoryEvent) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Connection state listener type.
|
|
30
|
+
*/
|
|
31
|
+
type ConnectionListener = (connected: boolean) => void;
|
|
32
|
+
/**
|
|
33
|
+
* RemoteAether - A client that implements the Aether interface over REST/WebSocket.
|
|
34
|
+
*
|
|
35
|
+
* Use this to connect a React app to a remote Aether server.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { RemoteAether, Dashboard } from 'aether-react';
|
|
40
|
+
*
|
|
41
|
+
* const client = new RemoteAether({ baseUrl: 'http://localhost:3000' });
|
|
42
|
+
* await client.initialize();
|
|
43
|
+
*
|
|
44
|
+
* // Use with Dashboard
|
|
45
|
+
* <Dashboard aether={client} />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare class RemoteAether {
|
|
49
|
+
private readonly config;
|
|
50
|
+
private ws;
|
|
51
|
+
private listeners;
|
|
52
|
+
private connectionListeners;
|
|
53
|
+
private connected;
|
|
54
|
+
private initialized;
|
|
55
|
+
private reconnectTimer;
|
|
56
|
+
constructor(config: RemoteAetherConfig | string);
|
|
57
|
+
/**
|
|
58
|
+
* Initialize the client and establish WebSocket connection.
|
|
59
|
+
* Verifies server connectivity before establishing WebSocket.
|
|
60
|
+
*/
|
|
61
|
+
initialize(): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Add a memory event.
|
|
64
|
+
*/
|
|
65
|
+
add(content: string, context?: Record<string, unknown>): Promise<MemoryEvent>;
|
|
66
|
+
add(event: MemoryEventInput): Promise<MemoryEvent>;
|
|
67
|
+
/**
|
|
68
|
+
* Add multiple memory events in a batch.
|
|
69
|
+
*/
|
|
70
|
+
addBatch(events: MemoryEventInput[]): Promise<MemoryEvent[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Retrieve relevant memories based on a query.
|
|
73
|
+
*/
|
|
74
|
+
retrieve(query: string, options?: RetrievalOptions): Promise<MemoryEvent[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Get all events.
|
|
77
|
+
*/
|
|
78
|
+
getAll(limit?: number): Promise<MemoryEvent[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Get the history of events for a specific actor.
|
|
81
|
+
*/
|
|
82
|
+
getHistory(actor: string, limit?: number): Promise<MemoryEvent[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Get a specific event by ID.
|
|
85
|
+
*/
|
|
86
|
+
get(id: string): Promise<MemoryEvent | null>;
|
|
87
|
+
/**
|
|
88
|
+
* Delete a specific event by ID.
|
|
89
|
+
*/
|
|
90
|
+
delete(id: string): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Get statistics about the memory store.
|
|
93
|
+
*/
|
|
94
|
+
stats(): Promise<MemoryStats>;
|
|
95
|
+
/**
|
|
96
|
+
* Subscribe to new memory events.
|
|
97
|
+
*/
|
|
98
|
+
subscribe(callback: EventListener): Unsubscribe;
|
|
99
|
+
/**
|
|
100
|
+
* Subscribe to connection state changes.
|
|
101
|
+
*/
|
|
102
|
+
onConnectionChange(callback: ConnectionListener): Unsubscribe;
|
|
103
|
+
/**
|
|
104
|
+
* Check if WebSocket is connected.
|
|
105
|
+
*/
|
|
106
|
+
isConnected(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Close the client and disconnect WebSocket.
|
|
109
|
+
*/
|
|
110
|
+
close(): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Make an authenticated fetch request.
|
|
113
|
+
*/
|
|
114
|
+
private fetch;
|
|
115
|
+
/**
|
|
116
|
+
* Establish WebSocket connection.
|
|
117
|
+
*/
|
|
118
|
+
private connectWebSocket;
|
|
119
|
+
/**
|
|
120
|
+
* Schedule a WebSocket reconnection attempt.
|
|
121
|
+
*/
|
|
122
|
+
private scheduleReconnect;
|
|
123
|
+
/**
|
|
124
|
+
* Notify all event listeners.
|
|
125
|
+
*/
|
|
126
|
+
private notifyListeners;
|
|
127
|
+
/**
|
|
128
|
+
* Notify all connection listeners.
|
|
129
|
+
*/
|
|
130
|
+
private notifyConnectionListeners;
|
|
131
|
+
}
|
|
4
132
|
|
|
5
133
|
interface AetherContextValue {
|
|
6
134
|
aether: Aether | null;
|
|
@@ -48,16 +176,41 @@ interface UseMemoryStreamReturn {
|
|
|
48
176
|
}
|
|
49
177
|
declare function useMemoryStream(serverUrl: string, options?: UseMemoryStreamOptions): UseMemoryStreamReturn;
|
|
50
178
|
|
|
179
|
+
type SelectionType = 'event' | 'actor' | 'link';
|
|
180
|
+
interface GraphSelection {
|
|
181
|
+
type: SelectionType;
|
|
182
|
+
data: MemoryEvent | string | GraphLink;
|
|
183
|
+
}
|
|
51
184
|
interface MemoryGraphViewProps {
|
|
52
185
|
events: MemoryEvent[];
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
186
|
+
onNodeClick?: (event: MemoryEvent | null) => void;
|
|
187
|
+
onSelectionChange?: (selection: GraphSelection | null) => void;
|
|
188
|
+
selectedEvent?: MemoryEvent | null;
|
|
189
|
+
selection?: GraphSelection | null;
|
|
56
190
|
highlightActor?: string;
|
|
57
191
|
showRelations?: boolean;
|
|
192
|
+
showLegend?: boolean;
|
|
58
193
|
className?: string;
|
|
59
194
|
}
|
|
60
|
-
|
|
195
|
+
interface GraphNode {
|
|
196
|
+
id: string;
|
|
197
|
+
type: 'event' | 'actor';
|
|
198
|
+
label: string;
|
|
199
|
+
event?: MemoryEvent;
|
|
200
|
+
x?: number;
|
|
201
|
+
y?: number;
|
|
202
|
+
fx?: number | null;
|
|
203
|
+
fy?: number | null;
|
|
204
|
+
}
|
|
205
|
+
interface GraphLink {
|
|
206
|
+
id: string;
|
|
207
|
+
source: string | GraphNode;
|
|
208
|
+
target: string | GraphNode;
|
|
209
|
+
type: 'actor' | 'temporal' | 'relation';
|
|
210
|
+
sourceLabel?: string;
|
|
211
|
+
targetLabel?: string;
|
|
212
|
+
}
|
|
213
|
+
declare function MemoryGraphView({ events, onNodeClick, onSelectionChange, selectedEvent, selection: controlledSelection, highlightActor, showRelations, showLegend, className, }: MemoryGraphViewProps): react_jsx_runtime.JSX.Element;
|
|
61
214
|
|
|
62
215
|
interface TimelineViewProps {
|
|
63
216
|
events: MemoryEvent[];
|
|
@@ -103,6 +256,155 @@ interface MemoryCardProps {
|
|
|
103
256
|
}
|
|
104
257
|
declare function MemoryCard({ event, onClick, selected, showContext, className, }: MemoryCardProps): react_jsx_runtime.JSX.Element;
|
|
105
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Trajectory data for display.
|
|
261
|
+
* Aligned with core Trajectory type for consistency.
|
|
262
|
+
*/
|
|
263
|
+
interface TrajectoryData {
|
|
264
|
+
id: string;
|
|
265
|
+
actor: string;
|
|
266
|
+
status: 'active' | 'completed' | 'abandoned';
|
|
267
|
+
outcome?: 'success' | 'failure' | 'partial';
|
|
268
|
+
/** Event IDs in chronological order */
|
|
269
|
+
events: string[];
|
|
270
|
+
/** ISO 8601 timestamp when trajectory started */
|
|
271
|
+
startTime: string;
|
|
272
|
+
/** ISO 8601 timestamp when trajectory ended */
|
|
273
|
+
endTime?: string;
|
|
274
|
+
metadata?: Record<string, unknown>;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Props for TrajectoryView component.
|
|
278
|
+
*/
|
|
279
|
+
interface TrajectoryViewProps {
|
|
280
|
+
/** Memory events to display */
|
|
281
|
+
events: MemoryEvent[];
|
|
282
|
+
/** Optional trajectories data */
|
|
283
|
+
trajectories?: TrajectoryData[];
|
|
284
|
+
/** Callback when an event is clicked */
|
|
285
|
+
onEventClick?: (event: MemoryEvent) => void;
|
|
286
|
+
/** Callback when a trajectory is clicked */
|
|
287
|
+
onTrajectoryClick?: (trajectory: TrajectoryData) => void;
|
|
288
|
+
/** Currently selected event ID */
|
|
289
|
+
selectedEventId?: string;
|
|
290
|
+
/** Currently selected trajectory ID */
|
|
291
|
+
selectedTrajectoryId?: string;
|
|
292
|
+
/** Show trajectory boundaries */
|
|
293
|
+
showBoundaries?: boolean;
|
|
294
|
+
/** Maximum height */
|
|
295
|
+
maxHeight?: string;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* TrajectoryView - Shows events grouped by trajectories with boundaries.
|
|
299
|
+
*/
|
|
300
|
+
declare function TrajectoryView({ events, trajectories, onEventClick, onTrajectoryClick, selectedEventId, selectedTrajectoryId, showBoundaries, maxHeight, }: TrajectoryViewProps): react_jsx_runtime.JSX.Element;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Pattern data for display.
|
|
304
|
+
*/
|
|
305
|
+
interface PatternData {
|
|
306
|
+
id: string;
|
|
307
|
+
sequence: string[];
|
|
308
|
+
frequency: number;
|
|
309
|
+
confidence: number;
|
|
310
|
+
support: number;
|
|
311
|
+
examples: string[];
|
|
312
|
+
avgDurationMs?: number;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Anomaly data for display.
|
|
316
|
+
*/
|
|
317
|
+
interface AnomalyData {
|
|
318
|
+
eventId: string;
|
|
319
|
+
reason: string;
|
|
320
|
+
severity: 'low' | 'medium' | 'high';
|
|
321
|
+
deviationScore: number;
|
|
322
|
+
detectedAt: string;
|
|
323
|
+
expectedAction?: string;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Transition matrix data.
|
|
327
|
+
*/
|
|
328
|
+
interface TransitionMatrixData {
|
|
329
|
+
actions: string[];
|
|
330
|
+
probabilities: number[][];
|
|
331
|
+
counts: number[][];
|
|
332
|
+
totalTransitions: number;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Props for PatternDashboard component.
|
|
336
|
+
*/
|
|
337
|
+
interface PatternDashboardProps {
|
|
338
|
+
/** Detected patterns */
|
|
339
|
+
patterns?: PatternData[];
|
|
340
|
+
/** Detected anomalies */
|
|
341
|
+
anomalies?: AnomalyData[];
|
|
342
|
+
/** Transition matrix */
|
|
343
|
+
transitionMatrix?: TransitionMatrixData;
|
|
344
|
+
/** Loading state */
|
|
345
|
+
loading?: boolean;
|
|
346
|
+
/** Callback when a pattern is clicked */
|
|
347
|
+
onPatternClick?: (pattern: PatternData) => void;
|
|
348
|
+
/** Callback when an anomaly is clicked */
|
|
349
|
+
onAnomalyClick?: (anomaly: AnomalyData) => void;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* PatternDashboard - Shows patterns, anomalies, and transition matrix.
|
|
353
|
+
*/
|
|
354
|
+
declare function PatternDashboard({ patterns, anomalies, transitionMatrix, loading, onPatternClick, onAnomalyClick, }: PatternDashboardProps): react_jsx_runtime.JSX.Element;
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Props for PredictionPanel component.
|
|
358
|
+
*/
|
|
359
|
+
interface PredictionPanelProps {
|
|
360
|
+
/** Current predictions */
|
|
361
|
+
predictions: Prediction[];
|
|
362
|
+
/** Loading state */
|
|
363
|
+
loading?: boolean;
|
|
364
|
+
/** Error message */
|
|
365
|
+
error?: string;
|
|
366
|
+
/** Callback to run simulation */
|
|
367
|
+
onSimulate?: (action: string, context?: Record<string, unknown>) => Promise<SimulationResult>;
|
|
368
|
+
/** Callback when a prediction is clicked */
|
|
369
|
+
onPredictionClick?: (prediction: Prediction) => void;
|
|
370
|
+
/** Whether simulation is available */
|
|
371
|
+
simulationEnabled?: boolean;
|
|
372
|
+
/** Maximum height */
|
|
373
|
+
maxHeight?: string;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* PredictionPanel - Shows predictions and simulation sandbox.
|
|
377
|
+
*/
|
|
378
|
+
declare function PredictionPanel({ predictions, loading, error, onSimulate, onPredictionClick, simulationEnabled, maxHeight, }: PredictionPanelProps): react_jsx_runtime.JSX.Element;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Props for AnomalyAlerts component.
|
|
382
|
+
*/
|
|
383
|
+
interface AnomalyAlertsProps {
|
|
384
|
+
/** List of anomalies */
|
|
385
|
+
anomalies: Anomaly[];
|
|
386
|
+
/** Loading state */
|
|
387
|
+
loading?: boolean;
|
|
388
|
+
/** Error message */
|
|
389
|
+
error?: string;
|
|
390
|
+
/** Callback when an anomaly is clicked */
|
|
391
|
+
onAnomalyClick?: (anomaly: Anomaly) => void;
|
|
392
|
+
/** Callback to dismiss an anomaly */
|
|
393
|
+
onDismiss?: (anomalyId: string) => void;
|
|
394
|
+
/** Whether to show dismissed anomalies */
|
|
395
|
+
showDismissed?: boolean;
|
|
396
|
+
/** Minimum severity to display */
|
|
397
|
+
minSeverity?: AnomalySeverity;
|
|
398
|
+
/** Maximum height */
|
|
399
|
+
maxHeight?: string;
|
|
400
|
+
/** Show as compact notification list */
|
|
401
|
+
compact?: boolean;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* AnomalyAlerts - Real-time anomaly notification panel.
|
|
405
|
+
*/
|
|
406
|
+
declare function AnomalyAlerts({ anomalies, loading, error, onAnomalyClick, onDismiss, minSeverity, maxHeight, compact, }: AnomalyAlertsProps): react_jsx_runtime.JSX.Element;
|
|
407
|
+
|
|
106
408
|
interface AddMemoryFormProps {
|
|
107
409
|
onAdd: (content: string, actor: string, context?: Record<string, unknown>) => Promise<void>;
|
|
108
410
|
loading?: boolean;
|
|
@@ -143,17 +445,52 @@ declare function ActorSelector({ actors, selectedActor, onSelect, loading, class
|
|
|
143
445
|
|
|
144
446
|
interface ConnectionStatusProps {
|
|
145
447
|
connected: boolean;
|
|
146
|
-
error?:
|
|
448
|
+
error?: string | null;
|
|
147
449
|
onReconnect?: () => void;
|
|
148
450
|
className?: string;
|
|
149
451
|
}
|
|
150
452
|
declare function ConnectionStatus({ connected, error, onReconnect, className, }: ConnectionStatusProps): react_jsx_runtime.JSX.Element;
|
|
151
453
|
|
|
454
|
+
interface ConnectionScreenProps {
|
|
455
|
+
onConnect: (url: string, apiKey?: string) => void;
|
|
456
|
+
defaultUrl?: string;
|
|
457
|
+
isConnecting?: boolean;
|
|
458
|
+
error?: string | null;
|
|
459
|
+
}
|
|
460
|
+
declare function ConnectionScreen({ onConnect, defaultUrl, isConnecting, error, }: ConnectionScreenProps): react_jsx_runtime.JSX.Element;
|
|
461
|
+
|
|
462
|
+
interface AetherClient {
|
|
463
|
+
add(content: string, context?: Record<string, unknown>): Promise<MemoryEvent>;
|
|
464
|
+
add(event: MemoryEventInput): Promise<MemoryEvent>;
|
|
465
|
+
retrieve(query: string, options?: RetrievalOptions): Promise<MemoryEvent[]>;
|
|
466
|
+
getAll?(limit?: number): Promise<MemoryEvent[]>;
|
|
467
|
+
getHistory(actor: string, limit?: number): Promise<MemoryEvent[]>;
|
|
468
|
+
stats(): Promise<MemoryStats>;
|
|
469
|
+
subscribe(callback: (event: MemoryEvent) => void): () => void;
|
|
470
|
+
getTrajectories?(actor: string): Promise<Trajectory[]>;
|
|
471
|
+
getTrajectory?(id: string): Promise<Trajectory | null>;
|
|
472
|
+
detectPatterns?(actor: string): Promise<Pattern[]>;
|
|
473
|
+
findAnomalies?(actor: string): Promise<Anomaly[]>;
|
|
474
|
+
getTransitionProbabilities?(actor: string): Promise<TransitionMatrix>;
|
|
475
|
+
predictNext?(eventId: string): Promise<Prediction[]>;
|
|
476
|
+
simulate?(actor: string, action: string, context?: Record<string, unknown>): Promise<SimulationResult>;
|
|
477
|
+
}
|
|
478
|
+
interface ConnectionState {
|
|
479
|
+
connected: boolean;
|
|
480
|
+
error?: string | null;
|
|
481
|
+
onReconnect?: () => void;
|
|
482
|
+
}
|
|
152
483
|
interface DashboardProps {
|
|
153
|
-
aether:
|
|
484
|
+
aether: AetherClient;
|
|
154
485
|
title?: string;
|
|
486
|
+
subtitle?: string;
|
|
155
487
|
className?: string;
|
|
488
|
+
connection?: ConnectionState;
|
|
489
|
+
previewMode?: boolean;
|
|
490
|
+
previewMemories?: MemoryEvent[];
|
|
491
|
+
onPreviewToggle?: (enabled: boolean) => void;
|
|
492
|
+
onDisconnect?: () => void;
|
|
156
493
|
}
|
|
157
|
-
declare function Dashboard({ aether, title, className }: DashboardProps): react_jsx_runtime.JSX.Element;
|
|
494
|
+
declare function Dashboard({ aether, title, subtitle, className, connection, previewMode, previewMemories, onPreviewToggle, onDisconnect, }: DashboardProps): react_jsx_runtime.JSX.Element;
|
|
158
495
|
|
|
159
|
-
export { ActorSelector, type ActorSelectorProps, AddMemoryForm, type AddMemoryFormProps, AetherProvider, ClusterMap, type ClusterMapProps, ConnectionStatus, type ConnectionStatusProps, Dashboard, type DashboardProps, MemoryCard, type MemoryCardProps, MemoryExplorer, type MemoryExplorerProps, MemoryGraphView, type MemoryGraphViewProps, SearchBar, type SearchBarProps, type SearchOptions, StatsPanel, type StatsPanelProps, TimelineView, type TimelineViewProps, useAether, useMemoryStream };
|
|
496
|
+
export { ActorSelector, type ActorSelectorProps, AddMemoryForm, type AddMemoryFormProps, type AetherClient, AetherProvider, AnomalyAlerts, type AnomalyAlertsProps, ClusterMap, type ClusterMapProps, type ConnectionListener, ConnectionScreen, type ConnectionScreenProps, type ConnectionState, ConnectionStatus, type ConnectionStatusProps, Dashboard, type DashboardProps, type EventListener, type GraphSelection, MemoryCard, type MemoryCardProps, MemoryExplorer, type MemoryExplorerProps, MemoryGraphView, type MemoryGraphViewProps, PatternDashboard, type PatternDashboardProps, PredictionPanel, type PredictionPanelProps, RemoteAether, type RemoteAetherConfig, SearchBar, type SearchBarProps, type SearchOptions, type SelectionType, StatsPanel, type StatsPanelProps, TimelineView, type TimelineViewProps, type TrajectoryData, TrajectoryView, type TrajectoryViewProps, type Unsubscribe, useAether, useMemoryStream };
|