@elizaos/client 1.5.5-alpha.10
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/LICENSE +21 -0
- package/README.md +350 -0
- package/dist/assets/empty-module-CLMscLYw.js +1 -0
- package/dist/assets/main-BBZ_3lkn.css +5999 -0
- package/dist/assets/main-C5zNUkXH.js +7 -0
- package/dist/assets/main-Dz64ENQg.js +614 -0
- package/dist/assets/react-vendor-DM5m98rr.js +545 -0
- package/dist/assets/ui-vendor-BQCqNqg0.js +1 -0
- package/dist/elizaos-avatar.png +0 -0
- package/dist/elizaos-icon.png +0 -0
- package/dist/elizaos-logo-light.png +0 -0
- package/dist/elizaos.webp +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/images/agents/agent1.png +0 -0
- package/dist/images/agents/agent2.png +0 -0
- package/dist/images/agents/agent3.png +0 -0
- package/dist/images/agents/agent4.png +0 -0
- package/dist/images/agents/agent5.png +0 -0
- package/dist/index.html +14 -0
- package/index.html +24 -0
- package/package.json +159 -0
- package/postcss.config.js +3 -0
- package/public/elizaos-avatar.png +0 -0
- package/public/elizaos-icon.png +0 -0
- package/public/elizaos-logo-light.png +0 -0
- package/public/elizaos.webp +0 -0
- package/public/favicon.ico +0 -0
- package/public/images/agents/agent1.png +0 -0
- package/public/images/agents/agent2.png +0 -0
- package/public/images/agents/agent3.png +0 -0
- package/public/images/agents/agent4.png +0 -0
- package/public/images/agents/agent5.png +0 -0
- package/src/App.tsx +222 -0
- package/src/components/AgentDetailsPanel.tsx +147 -0
- package/src/components/ChatInputArea.tsx +196 -0
- package/src/components/ChatMessageListComponent.tsx +139 -0
- package/src/components/actionTool.tsx +186 -0
- package/src/components/add-agent-card.tsx +77 -0
- package/src/components/agent-action-viewer.tsx +816 -0
- package/src/components/agent-avatar-stack.tsx +121 -0
- package/src/components/agent-card.cy.tsx +259 -0
- package/src/components/agent-card.tsx +177 -0
- package/src/components/agent-creator.tsx +142 -0
- package/src/components/agent-log-viewer.tsx +645 -0
- package/src/components/agent-memory-edit-overlay.tsx +461 -0
- package/src/components/agent-memory-viewer.tsx +504 -0
- package/src/components/agent-settings.tsx +270 -0
- package/src/components/agent-sidebar.tsx +178 -0
- package/src/components/api-key-dialog.tsx +113 -0
- package/src/components/app-sidebar.tsx +685 -0
- package/src/components/array-input.tsx +116 -0
- package/src/components/audio-recorder.tsx +292 -0
- package/src/components/avatar-panel.tsx +141 -0
- package/src/components/character-form.tsx +1138 -0
- package/src/components/chat.tsx +1813 -0
- package/src/components/combobox.tsx +187 -0
- package/src/components/confirmation-dialog.tsx +59 -0
- package/src/components/connection-error-banner.tsx +101 -0
- package/src/components/connection-status.cy.tsx +73 -0
- package/src/components/connection-status.tsx +155 -0
- package/src/components/copy-button.tsx +35 -0
- package/src/components/delete-button.tsx +24 -0
- package/src/components/env-settings.tsx +261 -0
- package/src/components/group-card.tsx +160 -0
- package/src/components/group-panel.tsx +543 -0
- package/src/components/input-copy.tsx +21 -0
- package/src/components/logs-page.tsx +41 -0
- package/src/components/media-content.tsx +385 -0
- package/src/components/memory-graph.tsx +170 -0
- package/src/components/missing-secrets-dialog.tsx +72 -0
- package/src/components/onboarding-tour.tsx +247 -0
- package/src/components/page-title.tsx +8 -0
- package/src/components/plugins-panel.tsx +383 -0
- package/src/components/profile-card.tsx +66 -0
- package/src/components/profile-overlay.tsx +283 -0
- package/src/components/retry-button.tsx +28 -0
- package/src/components/secret-panel.tsx +1505 -0
- package/src/components/server-management.tsx +264 -0
- package/src/components/split-button.tsx +148 -0
- package/src/components/stop-agent-button.tsx +99 -0
- package/src/components/ui/alert-dialog.cy.tsx +333 -0
- package/src/components/ui/alert-dialog.tsx +115 -0
- package/src/components/ui/alert.tsx +49 -0
- package/src/components/ui/avatar.cy.tsx +180 -0
- package/src/components/ui/avatar.tsx +57 -0
- package/src/components/ui/badge.cy.tsx +146 -0
- package/src/components/ui/badge.tsx +43 -0
- package/src/components/ui/button.cy.tsx +177 -0
- package/src/components/ui/button.tsx +56 -0
- package/src/components/ui/card.cy.tsx +160 -0
- package/src/components/ui/card.tsx +73 -0
- package/src/components/ui/chat/animated-markdown.tsx +59 -0
- package/src/components/ui/chat/chat-bubble.tsx +178 -0
- package/src/components/ui/chat/chat-container.tsx +51 -0
- package/src/components/ui/chat/chat-input.cy.tsx +169 -0
- package/src/components/ui/chat/chat-input.tsx +47 -0
- package/src/components/ui/chat/chat-message-list.tsx +61 -0
- package/src/components/ui/chat/chat-tts-button.tsx +199 -0
- package/src/components/ui/chat/code-block.tsx +79 -0
- package/src/components/ui/chat/expandable-chat.tsx +131 -0
- package/src/components/ui/chat/hooks/useAutoScroll.ts +86 -0
- package/src/components/ui/chat/markdown.tsx +209 -0
- package/src/components/ui/chat/message-loading.tsx +48 -0
- package/src/components/ui/checkbox.cy.tsx +170 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/collapsible.cy.tsx +283 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/command.cy.tsx +313 -0
- package/src/components/ui/command.tsx +143 -0
- package/src/components/ui/dialog.cy.tsx +279 -0
- package/src/components/ui/dialog.tsx +104 -0
- package/src/components/ui/dropdown-menu.cy.tsx +273 -0
- package/src/components/ui/dropdown-menu.tsx +281 -0
- package/src/components/ui/input.cy.tsx +82 -0
- package/src/components/ui/input.tsx +27 -0
- package/src/components/ui/label.cy.tsx +157 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/resizable.tsx +42 -0
- package/src/components/ui/scroll-area.cy.tsx +242 -0
- package/src/components/ui/scroll-area.tsx +46 -0
- package/src/components/ui/select.cy.tsx +277 -0
- package/src/components/ui/select.tsx +155 -0
- package/src/components/ui/separator.cy.tsx +145 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/sheet.cy.tsx +324 -0
- package/src/components/ui/sheet.tsx +119 -0
- package/src/components/ui/sidebar.tsx +734 -0
- package/src/components/ui/skeleton.cy.tsx +149 -0
- package/src/components/ui/skeleton.tsx +17 -0
- package/src/components/ui/split-button.cy.tsx +274 -0
- package/src/components/ui/split-button.tsx +112 -0
- package/src/components/ui/switch.tsx +28 -0
- package/src/components/ui/tabs.cy.tsx +271 -0
- package/src/components/ui/tabs.tsx +53 -0
- package/src/components/ui/textarea.cy.tsx +136 -0
- package/src/components/ui/textarea.tsx +26 -0
- package/src/components/ui/toast.cy.tsx +209 -0
- package/src/components/ui/toast.tsx +126 -0
- package/src/components/ui/toaster.tsx +29 -0
- package/src/components/ui/tooltip.cy.tsx +244 -0
- package/src/components/ui/tooltip.tsx +30 -0
- package/src/config/agent-templates.ts +349 -0
- package/src/config/voice-models.ts +181 -0
- package/src/constants.ts +23 -0
- package/src/context/AuthContext.tsx +44 -0
- package/src/context/ConnectionContext.tsx +194 -0
- package/src/entry.tsx +9 -0
- package/src/hooks/__tests__/use-agent-tab-state.test.ts +137 -0
- package/src/hooks/__tests__/use-agent-update.test.tsx +250 -0
- package/src/hooks/__tests__/use-character-convert.test.ts +102 -0
- package/src/hooks/__tests__/use-panel-width-state.test.ts +243 -0
- package/src/hooks/__tests__/use-sidebar-state.test.ts +117 -0
- package/src/hooks/use-agent-management.ts +130 -0
- package/src/hooks/use-agent-tab-state.ts +74 -0
- package/src/hooks/use-agent-update.ts +469 -0
- package/src/hooks/use-character-convert.ts +138 -0
- package/src/hooks/use-confirmation.ts +55 -0
- package/src/hooks/use-delete-agent.ts +123 -0
- package/src/hooks/use-dm-channels.ts +198 -0
- package/src/hooks/use-elevenlabs-voices.ts +83 -0
- package/src/hooks/use-file-upload.ts +224 -0
- package/src/hooks/use-mobile.tsx +19 -0
- package/src/hooks/use-onboarding.tsx +49 -0
- package/src/hooks/use-panel-width-state.ts +147 -0
- package/src/hooks/use-partial-update.ts +288 -0
- package/src/hooks/use-plugin-details.ts +462 -0
- package/src/hooks/use-plugins.ts +119 -0
- package/src/hooks/use-query-hooks.ts +1263 -0
- package/src/hooks/use-server-agents.ts +62 -0
- package/src/hooks/use-server-version.tsx +47 -0
- package/src/hooks/use-sidebar-state.ts +50 -0
- package/src/hooks/use-socket-chat.ts +264 -0
- package/src/hooks/use-toast.ts +260 -0
- package/src/hooks/use-version.tsx +64 -0
- package/src/index.css +146 -0
- package/src/lib/api-client-config.ts +53 -0
- package/src/lib/api-type-mappers.ts +196 -0
- package/src/lib/export-utils.ts +123 -0
- package/src/lib/logger.ts +19 -0
- package/src/lib/media-utils.ts +170 -0
- package/src/lib/pca.test.ts +17 -0
- package/src/lib/pca.ts +52 -0
- package/src/lib/socketio-manager.ts +664 -0
- package/src/lib/utils.ts +168 -0
- package/src/main.tsx +16 -0
- package/src/mocks/empty-module.ts +12 -0
- package/src/mocks/node-module.ts +57 -0
- package/src/polyfills.ts +37 -0
- package/src/routes/agent-detail.tsx +30 -0
- package/src/routes/agent-list.tsx +27 -0
- package/src/routes/agent-settings.tsx +48 -0
- package/src/routes/character-detail.tsx +52 -0
- package/src/routes/character-form.tsx +79 -0
- package/src/routes/character-list.tsx +38 -0
- package/src/routes/chat.tsx +128 -0
- package/src/routes/createAgent.tsx +13 -0
- package/src/routes/group-new.tsx +50 -0
- package/src/routes/group.tsx +29 -0
- package/src/routes/home.tsx +218 -0
- package/src/routes/not-found.tsx +71 -0
- package/src/test/setup.ts +154 -0
- package/src/types/crypto-browserify.d.ts +4 -0
- package/src/types/index.ts +13 -0
- package/src/types/rooms.ts +8 -0
- package/src/types.ts +84 -0
- package/src/vite-env.d.ts +40 -0
- package/tailwind.config.ts +90 -0
- package/tsconfig.json +10 -0
- package/vite.config.ts +102 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for parsing and handling media URLs in chat messages
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface MediaInfo {
|
|
6
|
+
url: string;
|
|
7
|
+
type: 'image' | 'video' | 'unknown';
|
|
8
|
+
isEmbed: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Common image extensions
|
|
12
|
+
const IMAGE_EXTENSIONS = new Set([
|
|
13
|
+
'jpg',
|
|
14
|
+
'jpeg',
|
|
15
|
+
'png',
|
|
16
|
+
'gif',
|
|
17
|
+
'webp',
|
|
18
|
+
'svg',
|
|
19
|
+
'bmp',
|
|
20
|
+
'ico',
|
|
21
|
+
'tiff',
|
|
22
|
+
'avif',
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
// Common video extensions
|
|
26
|
+
const VIDEO_EXTENSIONS = new Set(['mp4', 'webm', 'mov', 'avi', 'mkv', 'flv', 'wmv', 'm4v', 'ogv']);
|
|
27
|
+
|
|
28
|
+
// Video platforms that support embedding
|
|
29
|
+
const VIDEO_PLATFORMS = {
|
|
30
|
+
youtube: {
|
|
31
|
+
patterns: [
|
|
32
|
+
/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/,
|
|
33
|
+
/(?:https?:\/\/)?(?:www\.)?youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/,
|
|
34
|
+
],
|
|
35
|
+
getEmbedUrl: (id: string) => `https://www.youtube.com/embed/${id}`,
|
|
36
|
+
},
|
|
37
|
+
vimeo: {
|
|
38
|
+
patterns: [/(?:https?:\/\/)?(?:www\.)?vimeo\.com\/(\d+)/],
|
|
39
|
+
getEmbedUrl: (id: string) => `https://player.vimeo.com/video/${id}`,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Extracts the file extension from a URL
|
|
45
|
+
*/
|
|
46
|
+
function getFileExtension(url: string): string {
|
|
47
|
+
try {
|
|
48
|
+
const urlObj = new URL(url);
|
|
49
|
+
const pathname = urlObj.pathname;
|
|
50
|
+
const extension = pathname.split('.').pop()?.toLowerCase();
|
|
51
|
+
return extension || '';
|
|
52
|
+
} catch {
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a URL points to an image
|
|
59
|
+
*/
|
|
60
|
+
export function isImageUrl(url: string): boolean {
|
|
61
|
+
const extension = getFileExtension(url);
|
|
62
|
+
return IMAGE_EXTENSIONS.has(extension);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Checks if a URL points to a video file
|
|
67
|
+
*/
|
|
68
|
+
export function isVideoFileUrl(url: string): boolean {
|
|
69
|
+
const extension = getFileExtension(url);
|
|
70
|
+
return VIDEO_EXTENSIONS.has(extension);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Checks if a URL is from a supported video platform
|
|
75
|
+
*/
|
|
76
|
+
export function getVideoPlatformInfo(
|
|
77
|
+
url: string
|
|
78
|
+
): { platform: string; id: string; embedUrl: string } | null {
|
|
79
|
+
for (const [platform, config] of Object.entries(VIDEO_PLATFORMS)) {
|
|
80
|
+
for (const pattern of config.patterns) {
|
|
81
|
+
const match = url.match(pattern);
|
|
82
|
+
if (match && match[1]) {
|
|
83
|
+
return {
|
|
84
|
+
platform,
|
|
85
|
+
id: match[1],
|
|
86
|
+
embedUrl: config.getEmbedUrl(match[1]),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Parses URLs from text and identifies media types
|
|
96
|
+
*/
|
|
97
|
+
export function parseMediaFromText(text: string): MediaInfo[] {
|
|
98
|
+
if (!text) return [];
|
|
99
|
+
|
|
100
|
+
// Regular expression to find URLs
|
|
101
|
+
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
|
102
|
+
const urls = text.match(urlRegex) || [];
|
|
103
|
+
|
|
104
|
+
return urls
|
|
105
|
+
.map((url) => {
|
|
106
|
+
// Remove trailing punctuation that might be captured
|
|
107
|
+
const cleanUrl = url.replace(/[.,!?;)]*$/, '');
|
|
108
|
+
|
|
109
|
+
if (isImageUrl(cleanUrl)) {
|
|
110
|
+
return {
|
|
111
|
+
url: cleanUrl,
|
|
112
|
+
type: 'image' as const,
|
|
113
|
+
isEmbed: false,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (isVideoFileUrl(cleanUrl)) {
|
|
118
|
+
return {
|
|
119
|
+
url: cleanUrl,
|
|
120
|
+
type: 'video' as const,
|
|
121
|
+
isEmbed: false,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const platformInfo = getVideoPlatformInfo(cleanUrl);
|
|
126
|
+
if (platformInfo) {
|
|
127
|
+
return {
|
|
128
|
+
url: platformInfo.embedUrl,
|
|
129
|
+
type: 'video' as const,
|
|
130
|
+
isEmbed: true,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
url: cleanUrl,
|
|
136
|
+
type: 'unknown' as const,
|
|
137
|
+
isEmbed: false,
|
|
138
|
+
};
|
|
139
|
+
})
|
|
140
|
+
.filter((media) => media.type !== 'unknown');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Removes media URLs from text to avoid duplication in display
|
|
145
|
+
*/
|
|
146
|
+
export function removeMediaUrlsFromText(text: string, mediaInfos: MediaInfo[]): string {
|
|
147
|
+
let cleanText = text;
|
|
148
|
+
|
|
149
|
+
mediaInfos.forEach((media) => {
|
|
150
|
+
// For embedded videos, remove the original URL, not the embed URL
|
|
151
|
+
if (media.isEmbed) {
|
|
152
|
+
// Find the original URL that matches this embed
|
|
153
|
+
const urlRegex = /(https?:\/\/[^\s]+)/g;
|
|
154
|
+
const urls = text.match(urlRegex) || [];
|
|
155
|
+
|
|
156
|
+
for (const url of urls) {
|
|
157
|
+
const cleanUrl = url.replace(/[.,!?;)]*$/, '');
|
|
158
|
+
const platformInfo = getVideoPlatformInfo(cleanUrl);
|
|
159
|
+
if (platformInfo && platformInfo.embedUrl === media.url) {
|
|
160
|
+
cleanText = cleanText.replace(url, '').trim();
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} else {
|
|
165
|
+
cleanText = cleanText.replace(media.url, '').trim();
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
return cleanText;
|
|
170
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, it, expect } from 'bun:test';
|
|
2
|
+
import { computePca } from './pca';
|
|
3
|
+
|
|
4
|
+
describe('computePca', () => {
|
|
5
|
+
it('projects 3D vectors to 2D deterministically', () => {
|
|
6
|
+
const data = [
|
|
7
|
+
[1, 0, 0],
|
|
8
|
+
[0, 1, 0],
|
|
9
|
+
[0, 0, 1],
|
|
10
|
+
];
|
|
11
|
+
const result = computePca(data, 2);
|
|
12
|
+
expect(result.length).toBe(3);
|
|
13
|
+
// first vector should have positive coordinates
|
|
14
|
+
expect(result[0][0]).toBeGreaterThan(0);
|
|
15
|
+
expect(result[0][1]).toBeDefined();
|
|
16
|
+
});
|
|
17
|
+
});
|
package/src/lib/pca.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export function computePca(data: number[][], dims = 2): number[][] {
|
|
2
|
+
if (data.length === 0) return [];
|
|
3
|
+
const dim = data[0].length;
|
|
4
|
+
const mean = Array(dim).fill(0);
|
|
5
|
+
for (const vec of data) {
|
|
6
|
+
for (let i = 0; i < dim; i++) mean[i] += vec[i];
|
|
7
|
+
}
|
|
8
|
+
for (let i = 0; i < dim; i++) mean[i] /= data.length;
|
|
9
|
+
const centered = data.map((v) => v.map((val, idx) => val - mean[idx]));
|
|
10
|
+
// covariance matrix
|
|
11
|
+
const cov = Array.from({ length: dim }, () => Array(dim).fill(0));
|
|
12
|
+
for (const vec of centered) {
|
|
13
|
+
for (let i = 0; i < dim; i++) {
|
|
14
|
+
for (let j = 0; j < dim; j++) {
|
|
15
|
+
cov[i][j] += vec[i] * vec[j];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
for (let i = 0; i < dim; i++) {
|
|
20
|
+
for (let j = 0; j < dim; j++) {
|
|
21
|
+
cov[i][j] /= data.length - 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const eigenvectors: number[][] = [];
|
|
25
|
+
let matrix = cov.map((row) => row.slice());
|
|
26
|
+
for (let k = 0; k < dims; k++) {
|
|
27
|
+
// start with a deterministic unit vector for stability
|
|
28
|
+
let vec = Array(dim).fill(1 / Math.sqrt(dim));
|
|
29
|
+
for (let iter = 0; iter < 50; iter++) {
|
|
30
|
+
const next = multiplyMatrixVector(matrix, vec);
|
|
31
|
+
const norm = Math.sqrt(next.reduce((a, b) => a + b * b, 0));
|
|
32
|
+
if (norm === 0) break;
|
|
33
|
+
vec = next.map((v) => v / norm);
|
|
34
|
+
}
|
|
35
|
+
eigenvectors.push(vec.slice());
|
|
36
|
+
const lambda = dot(vec, multiplyMatrixVector(matrix, vec));
|
|
37
|
+
for (let i = 0; i < dim; i++) {
|
|
38
|
+
for (let j = 0; j < dim; j++) {
|
|
39
|
+
matrix[i][j] -= lambda * vec[i] * vec[j];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return centered.map((vec) => eigenvectors.map((ev) => dot(vec, ev)));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function multiplyMatrixVector(mat: number[][], vec: number[]): number[] {
|
|
47
|
+
return mat.map((row) => row.reduce((sum, val, i) => sum + val * vec[i], 0));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function dot(a: number[], b: number[]): number {
|
|
51
|
+
return a.reduce((sum, val, i) => sum + val * b[i], 0);
|
|
52
|
+
}
|