@auxiora/dashboard 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/LICENSE +191 -0
- package/dist/auth.d.ts +13 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +69 -0
- package/dist/auth.js.map +1 -0
- package/dist/cloud-types.d.ts +71 -0
- package/dist/cloud-types.d.ts.map +1 -0
- package/dist/cloud-types.js +2 -0
- package/dist/cloud-types.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/router.d.ts +13 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +2250 -0
- package/dist/router.js.map +1 -0
- package/dist/types.d.ts +314 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist-ui/assets/index-BfY0i5jw.css +1 -0
- package/dist-ui/assets/index-CXpk9mvw.js +60 -0
- package/dist-ui/icon.svg +59 -0
- package/dist-ui/index.html +20 -0
- package/package.json +32 -0
- package/src/auth.ts +83 -0
- package/src/cloud-types.ts +63 -0
- package/src/index.ts +5 -0
- package/src/router.ts +2494 -0
- package/src/types.ts +269 -0
- package/tests/auth.test.ts +51 -0
- package/tests/cloud-router.test.ts +249 -0
- package/tests/desktop-router.test.ts +151 -0
- package/tests/router.test.ts +388 -0
- package/tests/trust-router.test.ts +170 -0
- package/tsconfig.json +12 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/ui/index.html +19 -0
- package/ui/node_modules/.bin/browserslist +17 -0
- package/ui/node_modules/.bin/tsc +17 -0
- package/ui/node_modules/.bin/tsserver +17 -0
- package/ui/node_modules/.bin/vite +17 -0
- package/ui/package.json +23 -0
- package/ui/public/icon.svg +59 -0
- package/ui/src/App.tsx +63 -0
- package/ui/src/api.ts +238 -0
- package/ui/src/components/ActivityFeed.tsx +123 -0
- package/ui/src/components/BehaviorHealth.tsx +105 -0
- package/ui/src/components/DataTable.tsx +39 -0
- package/ui/src/components/Layout.tsx +160 -0
- package/ui/src/components/PasswordStrength.tsx +31 -0
- package/ui/src/components/SetupProgress.tsx +26 -0
- package/ui/src/components/StatusBadge.tsx +12 -0
- package/ui/src/components/ThemeSelector.tsx +39 -0
- package/ui/src/contexts/ThemeContext.tsx +58 -0
- package/ui/src/hooks/useApi.ts +19 -0
- package/ui/src/hooks/usePolling.ts +8 -0
- package/ui/src/main.tsx +16 -0
- package/ui/src/pages/AuditLog.tsx +36 -0
- package/ui/src/pages/Behaviors.tsx +426 -0
- package/ui/src/pages/Chat.tsx +688 -0
- package/ui/src/pages/Login.tsx +64 -0
- package/ui/src/pages/Overview.tsx +56 -0
- package/ui/src/pages/Sessions.tsx +26 -0
- package/ui/src/pages/SettingsAmbient.tsx +185 -0
- package/ui/src/pages/SettingsConnections.tsx +201 -0
- package/ui/src/pages/SettingsNotifications.tsx +241 -0
- package/ui/src/pages/SetupAppearance.tsx +45 -0
- package/ui/src/pages/SetupChannels.tsx +143 -0
- package/ui/src/pages/SetupComplete.tsx +31 -0
- package/ui/src/pages/SetupConnections.tsx +80 -0
- package/ui/src/pages/SetupDashboardPassword.tsx +50 -0
- package/ui/src/pages/SetupIdentity.tsx +68 -0
- package/ui/src/pages/SetupPersonality.tsx +78 -0
- package/ui/src/pages/SetupProvider.tsx +65 -0
- package/ui/src/pages/SetupVault.tsx +50 -0
- package/ui/src/pages/SetupWelcome.tsx +19 -0
- package/ui/src/pages/UnlockVault.tsx +56 -0
- package/ui/src/pages/Webhooks.tsx +158 -0
- package/ui/src/pages/settings/Appearance.tsx +63 -0
- package/ui/src/pages/settings/Channels.tsx +138 -0
- package/ui/src/pages/settings/Identity.tsx +61 -0
- package/ui/src/pages/settings/Personality.tsx +54 -0
- package/ui/src/pages/settings/PersonalityEditor.tsx +577 -0
- package/ui/src/pages/settings/Provider.tsx +537 -0
- package/ui/src/pages/settings/Security.tsx +111 -0
- package/ui/src/styles/global.css +2308 -0
- package/ui/src/styles/themes/index.css +7 -0
- package/ui/src/styles/themes/monolith.css +125 -0
- package/ui/src/styles/themes/nebula.css +90 -0
- package/ui/src/styles/themes/neon.css +149 -0
- package/ui/src/styles/themes/polar.css +151 -0
- package/ui/src/styles/themes/signal.css +163 -0
- package/ui/src/styles/themes/terra.css +146 -0
- package/ui/tsconfig.json +14 -0
- package/ui/vite.config.ts +20 -0
package/dist-ui/icon.svg
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
|
|
2
|
+
<!-- Background -->
|
|
3
|
+
<circle cx="64" cy="64" r="62" fill="#0f0f1a"/>
|
|
4
|
+
|
|
5
|
+
<!-- Shield outline -->
|
|
6
|
+
<path d="M64 12 L104 32 L104 62 C104 90 84 110 64 118 C44 110 24 90 24 62 L24 32 Z"
|
|
7
|
+
fill="none" stroke="#6366f1" stroke-width="4" stroke-linejoin="round"/>
|
|
8
|
+
|
|
9
|
+
<!-- Shield fill with gradient -->
|
|
10
|
+
<defs>
|
|
11
|
+
<linearGradient id="sg" x1="0" y1="0" x2="0" y2="1">
|
|
12
|
+
<stop offset="0%" stop-color="#6366f1" stop-opacity="0.25"/>
|
|
13
|
+
<stop offset="100%" stop-color="#6366f1" stop-opacity="0.05"/>
|
|
14
|
+
</linearGradient>
|
|
15
|
+
</defs>
|
|
16
|
+
<path d="M64 16 L100 34 L100 62 C100 88 82 106 64 114 C46 106 28 88 28 62 L28 34 Z"
|
|
17
|
+
fill="url(#sg)"/>
|
|
18
|
+
|
|
19
|
+
<!-- Neural network nodes -->
|
|
20
|
+
<!-- Center node (brain core) -->
|
|
21
|
+
<circle cx="64" cy="58" r="6" fill="#818cf8"/>
|
|
22
|
+
<!-- Top nodes -->
|
|
23
|
+
<circle cx="50" cy="40" r="4" fill="#22c55e"/>
|
|
24
|
+
<circle cx="78" cy="40" r="4" fill="#22c55e"/>
|
|
25
|
+
<!-- Mid nodes -->
|
|
26
|
+
<circle cx="42" cy="62" r="3.5" fill="#818cf8" opacity="0.8"/>
|
|
27
|
+
<circle cx="86" cy="62" r="3.5" fill="#818cf8" opacity="0.8"/>
|
|
28
|
+
<!-- Bottom nodes -->
|
|
29
|
+
<circle cx="52" cy="82" r="3.5" fill="#22c55e" opacity="0.8"/>
|
|
30
|
+
<circle cx="76" cy="82" r="3.5" fill="#22c55e" opacity="0.8"/>
|
|
31
|
+
<!-- Bottom center -->
|
|
32
|
+
<circle cx="64" cy="94" r="3" fill="#818cf8" opacity="0.6"/>
|
|
33
|
+
|
|
34
|
+
<!-- Neural connections -->
|
|
35
|
+
<g stroke="#818cf8" stroke-width="1.5" opacity="0.5">
|
|
36
|
+
<!-- Center to top -->
|
|
37
|
+
<line x1="64" y1="58" x2="50" y2="40"/>
|
|
38
|
+
<line x1="64" y1="58" x2="78" y2="40"/>
|
|
39
|
+
<!-- Center to mid -->
|
|
40
|
+
<line x1="64" y1="58" x2="42" y2="62"/>
|
|
41
|
+
<line x1="64" y1="58" x2="86" y2="62"/>
|
|
42
|
+
<!-- Center to bottom -->
|
|
43
|
+
<line x1="64" y1="58" x2="52" y2="82"/>
|
|
44
|
+
<line x1="64" y1="58" x2="76" y2="82"/>
|
|
45
|
+
<!-- Cross connections -->
|
|
46
|
+
<line x1="50" y1="40" x2="42" y2="62"/>
|
|
47
|
+
<line x1="78" y1="40" x2="86" y2="62"/>
|
|
48
|
+
<line x1="42" y1="62" x2="52" y2="82"/>
|
|
49
|
+
<line x1="86" y1="62" x2="76" y2="82"/>
|
|
50
|
+
<!-- Top cross -->
|
|
51
|
+
<line x1="50" y1="40" x2="78" y2="40"/>
|
|
52
|
+
<!-- Bottom to center bottom -->
|
|
53
|
+
<line x1="52" y1="82" x2="64" y2="94"/>
|
|
54
|
+
<line x1="76" y1="82" x2="64" y2="94"/>
|
|
55
|
+
</g>
|
|
56
|
+
|
|
57
|
+
<!-- Glow on center node -->
|
|
58
|
+
<circle cx="64" cy="58" r="10" fill="#6366f1" opacity="0.15"/>
|
|
59
|
+
</svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Auxiora Dashboard</title>
|
|
7
|
+
<link rel="icon" href="/dashboard/icon.svg" type="image/svg+xml">
|
|
8
|
+
<script type="module" crossorigin src="/dashboard/assets/index-CXpk9mvw.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/dashboard/assets/index-BfY0i5jw.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script>
|
|
14
|
+
(function() {
|
|
15
|
+
var t = localStorage.getItem('auxiora-theme');
|
|
16
|
+
if (t) document.documentElement.setAttribute('data-theme', t);
|
|
17
|
+
})();
|
|
18
|
+
</script>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@auxiora/dashboard",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"express": "^5.1.0",
|
|
18
|
+
"@auxiora/audit": "1.0.0",
|
|
19
|
+
"@auxiora/providers": "1.0.0",
|
|
20
|
+
"@auxiora/logger": "1.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/express": "^5.0.0",
|
|
24
|
+
"@types/supertest": "^6.0.0",
|
|
25
|
+
"supertest": "^7.1.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"typecheck": "tsc --noEmit"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/auth.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as crypto from 'node:crypto';
|
|
2
|
+
import { getLogger } from '@auxiora/logger';
|
|
3
|
+
import type { DashboardSession } from './types.js';
|
|
4
|
+
import { MAX_LOGIN_ATTEMPTS, LOGIN_WINDOW_MS } from './types.js';
|
|
5
|
+
|
|
6
|
+
const logger = getLogger('dashboard:auth');
|
|
7
|
+
|
|
8
|
+
export class DashboardAuth {
|
|
9
|
+
private sessions = new Map<string, DashboardSession>();
|
|
10
|
+
private sessionTtlMs: number;
|
|
11
|
+
private loginAttempts = new Map<string, { count: number; windowStart: number }>();
|
|
12
|
+
|
|
13
|
+
constructor(sessionTtlMs: number) {
|
|
14
|
+
this.sessionTtlMs = sessionTtlMs;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
isRateLimited(ip: string): boolean {
|
|
18
|
+
const now = Date.now();
|
|
19
|
+
const entry = this.loginAttempts.get(ip);
|
|
20
|
+
|
|
21
|
+
if (!entry) return false;
|
|
22
|
+
|
|
23
|
+
if (now - entry.windowStart > LOGIN_WINDOW_MS) {
|
|
24
|
+
this.loginAttempts.delete(ip);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return entry.count >= MAX_LOGIN_ATTEMPTS;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
recordAttempt(ip: string): void {
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
const entry = this.loginAttempts.get(ip);
|
|
34
|
+
|
|
35
|
+
if (!entry || now - entry.windowStart > LOGIN_WINDOW_MS) {
|
|
36
|
+
this.loginAttempts.set(ip, { count: 1, windowStart: now });
|
|
37
|
+
} else {
|
|
38
|
+
entry.count++;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
createSession(ip: string): string {
|
|
43
|
+
const id = crypto.randomUUID();
|
|
44
|
+
const now = Date.now();
|
|
45
|
+
|
|
46
|
+
this.sessions.set(id, {
|
|
47
|
+
id,
|
|
48
|
+
createdAt: now,
|
|
49
|
+
lastActive: now,
|
|
50
|
+
ip,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
logger.info('Dashboard session created', { sessionId: id });
|
|
54
|
+
return id;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
validateSession(sessionId: string): boolean {
|
|
58
|
+
const session = this.sessions.get(sessionId);
|
|
59
|
+
if (!session) return false;
|
|
60
|
+
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
if (now - session.lastActive > this.sessionTtlMs) {
|
|
63
|
+
this.sessions.delete(sessionId);
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
session.lastActive = now;
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
destroySession(sessionId: string): boolean {
|
|
72
|
+
return this.sessions.delete(sessionId);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
cleanup(): void {
|
|
76
|
+
const now = Date.now();
|
|
77
|
+
for (const [id, session] of this.sessions) {
|
|
78
|
+
if (now - session.lastActive > this.sessionTtlMs) {
|
|
79
|
+
this.sessions.delete(id);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Cloud signup request body */
|
|
2
|
+
export interface CloudSignupRequest {
|
|
3
|
+
email: string;
|
|
4
|
+
name: string;
|
|
5
|
+
password: string;
|
|
6
|
+
plan?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Cloud login request body */
|
|
10
|
+
export interface CloudLoginRequest {
|
|
11
|
+
email: string;
|
|
12
|
+
password: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Cloud tenant plan change request */
|
|
16
|
+
export interface CloudPlanChangeRequest {
|
|
17
|
+
plan: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Cloud payment method request */
|
|
21
|
+
export interface CloudPaymentMethodRequest {
|
|
22
|
+
token: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Cloud tenant response */
|
|
26
|
+
export interface CloudTenantResponse {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
email: string;
|
|
30
|
+
plan: string;
|
|
31
|
+
status: string;
|
|
32
|
+
createdAt: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Cloud usage response */
|
|
36
|
+
export interface CloudUsageResponse {
|
|
37
|
+
usage: Record<string, number>;
|
|
38
|
+
quotas: Record<string, number>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Cloud billing response */
|
|
42
|
+
export interface CloudBillingResponse {
|
|
43
|
+
plan: string;
|
|
44
|
+
invoices: Array<{
|
|
45
|
+
id: string;
|
|
46
|
+
amount: number;
|
|
47
|
+
status: string;
|
|
48
|
+
created: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Cloud dependency interface for the dashboard router */
|
|
53
|
+
export interface CloudDeps {
|
|
54
|
+
signup(email: string, name: string, password: string, plan?: string): Promise<{ tenantId: string; token: string }>;
|
|
55
|
+
login(email: string, password: string): Promise<{ tenantId: string; token: string } | null>;
|
|
56
|
+
getTenant(tenantId: string): Promise<CloudTenantResponse | null>;
|
|
57
|
+
changePlan(tenantId: string, plan: string): Promise<{ success: boolean }>;
|
|
58
|
+
getUsage(tenantId: string): Promise<CloudUsageResponse>;
|
|
59
|
+
getBilling(tenantId: string): Promise<CloudBillingResponse>;
|
|
60
|
+
addPaymentMethod(tenantId: string, token: string): Promise<{ success: boolean }>;
|
|
61
|
+
exportData(tenantId: string): Promise<{ downloadUrl: string }>;
|
|
62
|
+
deleteTenant(tenantId: string): Promise<{ success: boolean }>;
|
|
63
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { DashboardConfig, DashboardSession, DashboardDeps, SetupDeps, PersonalityTemplateSummary } from './types.js';
|
|
2
|
+
export { DEFAULT_DASHBOARD_CONFIG } from './types.js';
|
|
3
|
+
export { DashboardAuth } from './auth.js';
|
|
4
|
+
export { createDashboardRouter, type DashboardRouterOptions } from './router.js';
|
|
5
|
+
export type { CloudDeps, CloudSignupRequest, CloudLoginRequest, CloudTenantResponse, CloudUsageResponse, CloudBillingResponse } from './cloud-types.js';
|