@flame0510/project-aether 1.1.9
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/README.md +150 -0
- package/agent-templates/README.md +37 -0
- package/agent-templates/argus/AGENTS.md +52 -0
- package/agent-templates/argus/IDENTITY.md +7 -0
- package/agent-templates/argus/MEMORY.md +9 -0
- package/agent-templates/argus/SOUL.md +24 -0
- package/agent-templates/argus/TOOLS.md +8 -0
- package/agent-templates/atlas/AGENTS.md +47 -0
- package/agent-templates/atlas/HEARTBEAT.md +10 -0
- package/agent-templates/atlas/IDENTITY.md +6 -0
- package/agent-templates/atlas/MEMORY.md +9 -0
- package/agent-templates/atlas/SOUL.md +21 -0
- package/agent-templates/atlas/TOOLS.md +4 -0
- package/agent-templates/base-image/.trigger +0 -0
- package/agent-templates/base-image/Dockerfile +90 -0
- package/agent-templates/base-image/entrypoint.sh +37 -0
- package/agent-templates/custom/AGENTS.md +29 -0
- package/agent-templates/custom/BOOTSTRAP.md +56 -0
- package/agent-templates/custom/MEMORY.md +8 -0
- package/agent-templates/prometheus/AGENTS.md +37 -0
- package/agent-templates/prometheus/IDENTITY.md +6 -0
- package/agent-templates/prometheus/MEMORY.md +9 -0
- package/agent-templates/prometheus/SOUL.md +21 -0
- package/agent-templates/prometheus/TOOLS.md +4 -0
- package/app/agents/ChannelManager.tsx +465 -0
- package/app/agents/ImageDownloadBanner.tsx +159 -0
- package/app/agents/PageClient.tsx +1285 -0
- package/app/agents/create/PageClient.tsx +437 -0
- package/app/agents/create/page.tsx +126 -0
- package/app/agents/loading.tsx +14 -0
- package/app/agents/page.tsx +5 -0
- package/app/api/agents/[id]/backup/route.ts +169 -0
- package/app/api/agents/[id]/channels/pairing/route.ts +69 -0
- package/app/api/agents/[id]/channels/route.ts +14 -0
- package/app/api/agents/[id]/channels/telegram/route.ts +50 -0
- package/app/api/agents/[id]/lifecycle/route.ts +94 -0
- package/app/api/agents/[id]/recreate/route.ts +199 -0
- package/app/api/agents/[id]/restart/route.ts +33 -0
- package/app/api/agents/[id]/restore/route.ts +81 -0
- package/app/api/agents/[id]/route.ts +280 -0
- package/app/api/agents/channels-summary/route.ts +39 -0
- package/app/api/agents/config-json/route.ts +58 -0
- package/app/api/agents/create/route.ts +488 -0
- package/app/api/agents/download-image/route.ts +32 -0
- package/app/api/agents/image-status/route.ts +126 -0
- package/app/api/agents/route.ts +213 -0
- package/app/api/agents/token/route.ts +94 -0
- package/app/api/agents-active/route.ts +190 -0
- package/app/api/agents-config/route.ts +629 -0
- package/app/api/alerts/smoke/route.ts +26 -0
- package/app/api/aliases/add/route.ts +28 -0
- package/app/api/aliases/remove/route.ts +27 -0
- package/app/api/assistant/route.ts +204 -0
- package/app/api/auth/check/route.ts +38 -0
- package/app/api/auth/login/route.ts +85 -0
- package/app/api/auth/logout/route.ts +7 -0
- package/app/api/auth/status/route.ts +33 -0
- package/app/api/config/env/route.ts +132 -0
- package/app/api/config/restart/route.ts +26 -0
- package/app/api/containers/route.ts +75 -0
- package/app/api/cost-override/route.ts +46 -0
- package/app/api/costs/route.ts +84 -0
- package/app/api/credentials/[id]/reveal/route.ts +21 -0
- package/app/api/credentials/[id]/route.ts +52 -0
- package/app/api/credentials/[id]/sync/route.ts +58 -0
- package/app/api/credentials/detect/route.ts +246 -0
- package/app/api/credentials/route.ts +33 -0
- package/app/api/crons/[id]/route.ts +69 -0
- package/app/api/crons/route.ts +12 -0
- package/app/api/crons/runs/route.ts +31 -0
- package/app/api/debug/route.ts +11 -0
- package/app/api/envcheck/route.ts +18 -0
- package/app/api/events/route.ts +24 -0
- package/app/api/gateway/agent/route.ts +154 -0
- package/app/api/gateway/provider/balance/route.ts +38 -0
- package/app/api/gateway/provider/keys.ts +38 -0
- package/app/api/gateway/provider/oauth/route.ts +304 -0
- package/app/api/gateway/provider/route.ts +209 -0
- package/app/api/gateway/route.ts +223 -0
- package/app/api/gateway/sync.ts +189 -0
- package/app/api/lineage/route.ts +54 -0
- package/app/api/memory-context/route.ts +15 -0
- package/app/api/metrics/route.ts +35 -0
- package/app/api/models/route.ts +77 -0
- package/app/api/plugins/route.js +37 -0
- package/app/api/provider/upstream.ts +142 -0
- package/app/api/provider/v1/chat/completions/route.ts +146 -0
- package/app/api/provider/v1/models/route.ts +167 -0
- package/app/api/provider-usage/route.ts +629 -0
- package/app/api/session/route.ts +39 -0
- package/app/api/sessions/[id]/route.ts +38 -0
- package/app/api/sessions/route.ts +23 -0
- package/app/api/setup/agent-image/route.ts +102 -0
- package/app/api/setup/password/route.ts +111 -0
- package/app/api/setup/restart/route.ts +76 -0
- package/app/api/skills/delete/route.js +105 -0
- package/app/api/skills/promote/route.js +129 -0
- package/app/api/skills/route.js +203 -0
- package/app/api/skills/save/route.js +142 -0
- package/app/api/stats/route.ts +34 -0
- package/app/api/stats-since/route.ts +20 -0
- package/app/api/stream/route.ts +70 -0
- package/app/api/system-health/route.ts +233 -0
- package/app/api/tool-calls/route.ts +24 -0
- package/app/api/tools-config/route.ts +163 -0
- package/app/api/update-check/route.ts +127 -0
- package/app/api/version/route.ts +25 -0
- package/app/api/wizard/complete/route.ts +32 -0
- package/app/api/wizard/reset/route.ts +28 -0
- package/app/api/wizard/status/route.ts +28 -0
- package/app/api/workspace/route.ts +392 -0
- package/app/api/workspace/stream/route.ts +136 -0
- package/app/components/AppShell.tsx +33 -0
- package/app/components/AuthGuard.tsx +91 -0
- package/app/components/CostBreakdown.tsx +37 -0
- package/app/components/DashboardHeader.tsx +73 -0
- package/app/components/DashboardLayout.tsx +76 -0
- package/app/components/DashboardToolbar.tsx +61 -0
- package/app/components/FloatingActions.tsx +33 -0
- package/app/components/Icons.tsx +78 -0
- package/app/components/LineageGraphPage.tsx +142 -0
- package/app/components/LiveFeed.tsx +48 -0
- package/app/components/MobileBottomNav.tsx +84 -0
- package/app/components/ModelPickerModal.tsx +94 -0
- package/app/components/PasswordInput.tsx +86 -0
- package/app/components/PulseChat.tsx +362 -0
- package/app/components/Rev4aLoader.tsx +48 -0
- package/app/components/SessionDrawer.tsx +263 -0
- package/app/components/SessionTopology.tsx +289 -0
- package/app/components/Sidebar.tsx +294 -0
- package/app/components/Skeleton.tsx +133 -0
- package/app/components/SystemCockpit.tsx +169 -0
- package/app/components/VersionBanner.tsx +105 -0
- package/app/components/WizardButton.tsx +30 -0
- package/app/components/ui/Badge.tsx +30 -0
- package/app/components/ui/Button.tsx +59 -0
- package/app/components/ui/ConfirmModal.tsx +46 -0
- package/app/components/ui/FilterBar.tsx +33 -0
- package/app/components/ui/Input.tsx +25 -0
- package/app/components/ui/ItemList.tsx +83 -0
- package/app/components/ui/LoadingSpinner.tsx +30 -0
- package/app/components/ui/Metric.tsx +22 -0
- package/app/components/ui/Modal.tsx +42 -0
- package/app/components/ui/Page.tsx +18 -0
- package/app/components/ui/Pill.tsx +6 -0
- package/app/components/ui/PropertyList.tsx +24 -0
- package/app/components/ui/Select.tsx +26 -0
- package/app/components/ui/StatusCard.tsx +32 -0
- package/app/components/ui/Surface.tsx +14 -0
- package/app/components/ui/Tabs.tsx +55 -0
- package/app/components/ui/TemplateOption.tsx +59 -0
- package/app/components/ui/Toast.tsx +44 -0
- package/app/components/ui/index.ts +19 -0
- package/app/components/ui/tokens.ts +18 -0
- package/app/config/PageClient.tsx +293 -0
- package/app/config/loading.tsx +10 -0
- package/app/config/page.tsx +7 -0
- package/app/containers/ContainersClient.tsx +129 -0
- package/app/containers/loading.tsx +21 -0
- package/app/containers/page.tsx +5 -0
- package/app/containers/terminal/[id]/TerminalClient.tsx +313 -0
- package/app/containers/terminal/[id]/page.tsx +6 -0
- package/app/credentials/PageClient.tsx +598 -0
- package/app/credentials/loading.tsx +10 -0
- package/app/credentials/page.tsx +7 -0
- package/app/crons/PageClient.tsx +538 -0
- package/app/crons/loading.tsx +10 -0
- package/app/crons/page.tsx +5 -0
- package/app/design-system.ts +57 -0
- package/app/gateway/PageClient.tsx +1048 -0
- package/app/gateway/loading.tsx +24 -0
- package/app/gateway/page.tsx +5 -0
- package/app/globals.css +1474 -0
- package/app/layout.tsx +45 -0
- package/app/lib/models-context.tsx +41 -0
- package/app/lineage/loading.tsx +10 -0
- package/app/lineage/page.tsx +13 -0
- package/app/loading.tsx +16 -0
- package/app/login/page.tsx +160 -0
- package/app/memory/MemoryContextPageClient.tsx +196 -0
- package/app/memory/loading.tsx +10 -0
- package/app/memory/page.tsx +8 -0
- package/app/page.tsx +31 -0
- package/app/plugins/PageClient.tsx +296 -0
- package/app/plugins/loading.tsx +10 -0
- package/app/plugins/page.tsx +5 -0
- package/app/setup/PageClient.tsx +227 -0
- package/app/setup/loading.tsx +21 -0
- package/app/setup/page.tsx +7 -0
- package/app/skills/PageClient.tsx +499 -0
- package/app/skills/loading.tsx +10 -0
- package/app/skills/page.tsx +5 -0
- package/app/tools/ToolsPageClient.tsx +308 -0
- package/app/tools/loading.tsx +10 -0
- package/app/tools/page.tsx +62 -0
- package/app/tools/tools-catalog.ts +141 -0
- package/app/wizard/PageClient.tsx +485 -0
- package/app/wizard/icons.tsx +89 -0
- package/app/wizard/loading.tsx +24 -0
- package/app/wizard/page.tsx +7 -0
- package/app/wizard/storage.ts +33 -0
- package/app/wizard/useWizard.ts +101 -0
- package/app/workspace/WorkspaceClient.tsx +633 -0
- package/app/workspace/loading.tsx +36 -0
- package/app/workspace/page.tsx +8 -0
- package/bin/docker-entrypoint.sh +21 -0
- package/bin/postinstall.js +20 -0
- package/bin/rev4a.js +696 -0
- package/daemon.js +783 -0
- package/docs/ARCHITECTURE.md +557 -0
- package/docs/CONTAINER-TERMINAL.md +280 -0
- package/docs/DESIGN-SYSTEM.md +99 -0
- package/docs/FRONTEND-ARCHITECTURE.md +119 -0
- package/docs/REV4A.md +504 -0
- package/docs/dev/API-REFERENCE.md +1835 -0
- package/docs/dev/DATABASE.md +224 -0
- package/docs/dev/GATEWAY.md +300 -0
- package/docs/dev/PROVIDERS.md +229 -0
- package/docs/dev/SESSION-MAINTENANCE-PLAN.md +607 -0
- package/docs/dev/WORKSPACE.md +199 -0
- package/docs/rag/DATA-FRESHNESS.md +109 -0
- package/docs/rag/GLOSSARY.md +125 -0
- package/docs/rag/REV4A-OVERVIEW.md +135 -0
- package/docs/rag/WHAT-I-CAN-ANSWER.md +124 -0
- package/lib/agent-setup.ts +130 -0
- package/lib/alerts.ts +115 -0
- package/lib/apiFetch.ts +7 -0
- package/lib/auth.ts +28 -0
- package/lib/billing.ts +100 -0
- package/lib/buildAgentImage.ts +346 -0
- package/lib/channelManager.ts +386 -0
- package/lib/container.ts +60 -0
- package/lib/credentials/db.ts +86 -0
- package/lib/credentials/delivery.ts +448 -0
- package/lib/credentials/detect.ts +149 -0
- package/lib/credentials/hash.ts +9 -0
- package/lib/credentials/providers.ts +110 -0
- package/lib/credentials/vault.ts +195 -0
- package/lib/db-bootstrap.d.ts +3 -0
- package/lib/db-bootstrap.mjs +144 -0
- package/lib/db.ts +25 -0
- package/lib/docker-utils.ts +60 -0
- package/lib/hooks/useDashboard.ts +264 -0
- package/lib/hooks/useRev4aTimezone.ts +28 -0
- package/lib/hooks/useScreenshot.ts +30 -0
- package/lib/memory-context.ts +385 -0
- package/lib/model-catalogue.ts +131 -0
- package/lib/model-pricing.ts +63 -0
- package/lib/openclaw-cron.ts +350 -0
- package/lib/patterns/ApiAdapter.ts +73 -0
- package/lib/patterns/ApiClient.ts +65 -0
- package/lib/patterns/EventBus.ts +113 -0
- package/lib/patterns/FilterStrategy.ts +79 -0
- package/lib/patterns/SessionFactory.ts +117 -0
- package/lib/patterns/sessionPresentation.ts +117 -0
- package/lib/provider-balance.ts +163 -0
- package/lib/requireAuth.tsx +38 -0
- package/lib/rev4a-auth.d.ts +3 -0
- package/lib/rev4a-auth.js +36 -0
- package/lib/rev4a-paths.ts +145 -0
- package/lib/timezone.ts +46 -0
- package/lib/types/index.ts +96 -0
- package/lib/utils/format.ts +82 -0
- package/lineage.js +56 -0
- package/model-pricing.json +482 -0
- package/models.config.json +844 -0
- package/next-env.d.ts +6 -0
- package/next.config.mjs +7 -0
- package/package.json +82 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-64.png +0 -0
- package/public/favicon.svg +58 -0
- package/public/icon-192-maskable.png +0 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512-maskable.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/manifest.json +38 -0
- package/public/rev4a-logo.png +0 -0
- package/public/rev4a-logo.svg +58 -0
- package/rev4a-rules/AGENTS.md +37 -0
- package/scripts/add-auth.cjs +185 -0
- package/scripts/backup.sh +66 -0
- package/scripts/check-providers.mjs +143 -0
- package/scripts/docker/traefik/docker-compose.yml +32 -0
- package/scripts/docker/traefik/dynamic/.gitkeep +18 -0
- package/scripts/docker/traefik/traefik.yml +37 -0
- package/scripts/remove-auth-profile.js +56 -0
- package/scripts/restore.sh +82 -0
- package/terminal-ws-server.js +139 -0
- package/tsconfig.json +42 -0
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState, useEffect, useCallback, useRef } from 'react';
|
|
4
|
+
import { useResponsive } from '../design-system';
|
|
5
|
+
import { Button, Pill, LoadingSpinner, ListContainer, ListItem, ConfirmModal } from '../components/ui';
|
|
6
|
+
|
|
7
|
+
type BadgeColor = 'green' | 'red' | 'gray' | 'violet' | 'blue';
|
|
8
|
+
|
|
9
|
+
function Badge({ children, color }: { children: React.ReactNode; color: BadgeColor }) {
|
|
10
|
+
const toneMap: Record<BadgeColor, 'success' | 'danger' | 'neutral' | 'accent' | 'info'> = {
|
|
11
|
+
green: 'success', red: 'danger', gray: 'neutral', violet: 'accent', blue: 'info',
|
|
12
|
+
};
|
|
13
|
+
return <Pill tone={toneMap[color]}>{children}</Pill>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function PanelTitle({ children }: { children: React.ReactNode }) {
|
|
17
|
+
return (
|
|
18
|
+
<div style={{
|
|
19
|
+
padding: '10px 20px',
|
|
20
|
+
fontSize: 10,
|
|
21
|
+
letterSpacing: 2,
|
|
22
|
+
color: 'var(--violet)',
|
|
23
|
+
borderBottom: '1px solid var(--border)',
|
|
24
|
+
background: 'var(--bg2)',
|
|
25
|
+
textTransform: 'uppercase',
|
|
26
|
+
flexShrink: 0,
|
|
27
|
+
fontFamily: 'var(--font-mono-stack)',
|
|
28
|
+
}}>
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function EmptyState({ message }: { message: string }) {
|
|
35
|
+
return <div className="empty-state">{message}</div>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ErrorState({ message }: { message: string }) {
|
|
39
|
+
return <div className="error-state">⚠ {message}</div>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function LoadingState() {
|
|
43
|
+
return <LoadingSpinner label="LOADING" compact />;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ─── Skill type ──────────────────────────────────────────────────────────────
|
|
47
|
+
|
|
48
|
+
interface Skill {
|
|
49
|
+
name: string;
|
|
50
|
+
type: 'shared' | 'workspace' | 'bundled';
|
|
51
|
+
description?: string;
|
|
52
|
+
version?: string;
|
|
53
|
+
path?: string;
|
|
54
|
+
skillMdPath?: string;
|
|
55
|
+
agentId?: string;
|
|
56
|
+
containerName?: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default function SkillsPage() {
|
|
60
|
+
const [skills, setSkills] = useState<Skill[]>([]);
|
|
61
|
+
const [loading, setLoading] = useState(true);
|
|
62
|
+
const [error, setError] = useState<string | null>(null);
|
|
63
|
+
const [selected, setSelected] = useState<Skill | null>(null);
|
|
64
|
+
const [filter, setFilter] = useState('all');
|
|
65
|
+
const [search, setSearch] = useState('');
|
|
66
|
+
const [skillContent, setSkillContent] = useState<string | null>(null);
|
|
67
|
+
const [editMode, setEditMode] = useState(false);
|
|
68
|
+
const [editText, setEditText] = useState('');
|
|
69
|
+
const [saving, setSaving] = useState(false);
|
|
70
|
+
const [toastMsg, setToastMsg] = useState<string | null>(null);
|
|
71
|
+
const isMobile = useResponsive('lg');
|
|
72
|
+
const [mobileStep, setMobileStep] = useState(1);
|
|
73
|
+
const [loadingContent, setLoadingContent] = useState(false);
|
|
74
|
+
const [promoting, setPromoting] = useState<string | null>(null);
|
|
75
|
+
const [deleteModalSkill, setDeleteModalSkill] = useState<Skill | null>(null);
|
|
76
|
+
const [deleting, setDeleting] = useState(false);
|
|
77
|
+
const abortRef = useRef<AbortController | null>(null);
|
|
78
|
+
const contentAbortRef = useRef<AbortController | null>(null);
|
|
79
|
+
|
|
80
|
+
const load = useCallback(async (signal?: AbortSignal) => {
|
|
81
|
+
setLoading(true);
|
|
82
|
+
setError(null);
|
|
83
|
+
abortRef.current?.abort();
|
|
84
|
+
const controller = new AbortController();
|
|
85
|
+
abortRef.current = controller;
|
|
86
|
+
const mergedSignal = signal || controller.signal;
|
|
87
|
+
try {
|
|
88
|
+
const res = await fetch('/api/skills', { credentials: 'same-origin', signal: mergedSignal });
|
|
89
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
90
|
+
const data = await res.json();
|
|
91
|
+
if (!mergedSignal.aborted) setSkills(data.skills || []);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
if ((e as Error).name !== 'AbortError') setError((e as Error).message);
|
|
94
|
+
} finally {
|
|
95
|
+
if (!mergedSignal.aborted) setLoading(false);
|
|
96
|
+
}
|
|
97
|
+
}, []);
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
const controller = new AbortController();
|
|
101
|
+
load(controller.signal);
|
|
102
|
+
return () => controller.abort();
|
|
103
|
+
}, [load]);
|
|
104
|
+
|
|
105
|
+
const searchLower = search.toLowerCase();
|
|
106
|
+
const filtered = skills.filter(s => {
|
|
107
|
+
const typeMatch = filter === 'all' || s.type === filter;
|
|
108
|
+
if (!typeMatch) return false;
|
|
109
|
+
if (!searchLower) return true;
|
|
110
|
+
return s.name.toLowerCase().includes(searchLower) ||
|
|
111
|
+
(s.description && s.description.toLowerCase().includes(searchLower));
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const showToast = (msg: string) => {
|
|
115
|
+
setToastMsg(msg);
|
|
116
|
+
setTimeout(() => setToastMsg(null), 3500);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const handleSelect = async (skill: Skill) => {
|
|
120
|
+
setSelected(skill);
|
|
121
|
+
setEditMode(false);
|
|
122
|
+
setSkillContent(null);
|
|
123
|
+
if (isMobile) setMobileStep(2);
|
|
124
|
+
contentAbortRef.current?.abort();
|
|
125
|
+
if (skill.skillMdPath) {
|
|
126
|
+
setLoadingContent(true);
|
|
127
|
+
const controller = new AbortController();
|
|
128
|
+
contentAbortRef.current = controller;
|
|
129
|
+
try {
|
|
130
|
+
const params = new URLSearchParams({ path: skill.skillMdPath });
|
|
131
|
+
if (skill.containerName) params.set('containerName', skill.containerName);
|
|
132
|
+
const res = await fetch(`/api/skills/save?${params.toString()}`, {
|
|
133
|
+
credentials: 'same-origin',
|
|
134
|
+
signal: controller.signal,
|
|
135
|
+
});
|
|
136
|
+
const data = await res.json();
|
|
137
|
+
setSkillContent(data.content || null);
|
|
138
|
+
} catch {
|
|
139
|
+
setSkillContent(null);
|
|
140
|
+
} finally {
|
|
141
|
+
setLoadingContent(false);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const handleSave = async () => {
|
|
147
|
+
if (!selected?.skillMdPath) return;
|
|
148
|
+
if (selected.type === 'bundled') {
|
|
149
|
+
showToast('Read-only: bundled skills cannot be edited');
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
setSaving(true);
|
|
153
|
+
try {
|
|
154
|
+
const body: { skillPath: string; content: string; containerName?: string } = { skillPath: selected.skillMdPath, content: editText };
|
|
155
|
+
if (selected.containerName) body.containerName = selected.containerName;
|
|
156
|
+
const res = await fetch('/api/skills/save', {
|
|
157
|
+
method: 'POST',
|
|
158
|
+
headers: { 'Content-Type': 'application/json' },
|
|
159
|
+
credentials: 'same-origin',
|
|
160
|
+
body: JSON.stringify(body),
|
|
161
|
+
});
|
|
162
|
+
const data = await res.json();
|
|
163
|
+
if (data.ok) {
|
|
164
|
+
setSkillContent(editText);
|
|
165
|
+
setEditMode(false);
|
|
166
|
+
showToast('SKILL.md saved');
|
|
167
|
+
} else {
|
|
168
|
+
showToast(`Error: ${data.error}`);
|
|
169
|
+
}
|
|
170
|
+
} catch (e) {
|
|
171
|
+
showToast(`Error: ${(e as Error).message}`);
|
|
172
|
+
} finally {
|
|
173
|
+
setSaving(false);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const handleDelete = async () => {
|
|
178
|
+
if (!deleteModalSkill) return;
|
|
179
|
+
setDeleting(true);
|
|
180
|
+
try {
|
|
181
|
+
const body: { skillName: string; containerName?: string } = { skillName: deleteModalSkill.name };
|
|
182
|
+
if (deleteModalSkill.type === 'workspace' && deleteModalSkill.containerName) {
|
|
183
|
+
body.containerName = deleteModalSkill.containerName;
|
|
184
|
+
}
|
|
185
|
+
const res = await fetch('/api/skills/delete', {
|
|
186
|
+
method: 'DELETE',
|
|
187
|
+
headers: { 'Content-Type': 'application/json' },
|
|
188
|
+
credentials: 'same-origin',
|
|
189
|
+
body: JSON.stringify(body),
|
|
190
|
+
});
|
|
191
|
+
const data = await res.json();
|
|
192
|
+
if (data.ok) {
|
|
193
|
+
const label = deleteModalSkill.type === 'workspace' ? 'agent workspace' : 'shared skills';
|
|
194
|
+
showToast(`Deleted "${deleteModalSkill.name}" from ${label}`);
|
|
195
|
+
if (selected?.name === deleteModalSkill.name) setSelected(null);
|
|
196
|
+
await load();
|
|
197
|
+
} else {
|
|
198
|
+
showToast(`Error: ${data.error}`);
|
|
199
|
+
}
|
|
200
|
+
} catch (e) {
|
|
201
|
+
showToast(`Error: ${(e as Error).message}`);
|
|
202
|
+
} finally {
|
|
203
|
+
setDeleting(false);
|
|
204
|
+
setDeleteModalSkill(null);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const handlePromote = async (skill: Skill) => {
|
|
209
|
+
if (!skill.containerName) {
|
|
210
|
+
showToast('Only agent workspace skills can be promoted');
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
setPromoting(skill.name);
|
|
214
|
+
try {
|
|
215
|
+
const res = await fetch('/api/skills/promote', {
|
|
216
|
+
method: 'POST',
|
|
217
|
+
headers: { 'Content-Type': 'application/json' },
|
|
218
|
+
credentials: 'same-origin',
|
|
219
|
+
body: JSON.stringify({ containerName: skill.containerName, skillName: skill.name }),
|
|
220
|
+
});
|
|
221
|
+
const data = await res.json();
|
|
222
|
+
if (data.ok) {
|
|
223
|
+
showToast(`Promoted "${skill.name}" to shared skills${data.overwritten ? ' (overwritten)' : ''}`);
|
|
224
|
+
await load();
|
|
225
|
+
} else {
|
|
226
|
+
showToast(`Error: ${data.error}`);
|
|
227
|
+
}
|
|
228
|
+
} catch (e) {
|
|
229
|
+
showToast(`Error: ${(e as Error).message}`);
|
|
230
|
+
} finally {
|
|
231
|
+
setPromoting(null);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const typeColor: Record<string, BadgeColor> = { shared: 'violet', workspace: 'green', bundled: 'blue' };
|
|
236
|
+
|
|
237
|
+
const typeLabel = (s: Skill) => {
|
|
238
|
+
if (s.agentId) return `agent:${s.agentId}`;
|
|
239
|
+
return s.type;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const filters = ['all', 'shared', 'workspace', 'bundled'] as const;
|
|
243
|
+
|
|
244
|
+
const filterCounts: Record<string, number> = {
|
|
245
|
+
all: skills.length,
|
|
246
|
+
shared: skills.filter(s => s.type === 'shared').length,
|
|
247
|
+
workspace: skills.filter(s => s.type === 'workspace').length,
|
|
248
|
+
bundled: skills.filter(s => s.type === 'bundled').length,
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<div style={{
|
|
253
|
+
display: 'flex',
|
|
254
|
+
flexDirection: 'column',
|
|
255
|
+
flex: 1,
|
|
256
|
+
background: 'var(--bg)',
|
|
257
|
+
color: 'var(--text)',
|
|
258
|
+
overflow: 'hidden',
|
|
259
|
+
}}>
|
|
260
|
+
<div style={{
|
|
261
|
+
display: 'flex',
|
|
262
|
+
alignItems: 'center',
|
|
263
|
+
padding: '0 14px',
|
|
264
|
+
height: 48,
|
|
265
|
+
borderBottom: '1px solid var(--border)',
|
|
266
|
+
background: 'var(--bg)',
|
|
267
|
+
flexShrink: 0,
|
|
268
|
+
boxSizing: 'border-box',
|
|
269
|
+
}}>
|
|
270
|
+
<span style={{ fontFamily: 'var(--font-serif-stack)', fontSize: '20px', letterSpacing: '4px', color: 'var(--violet)' }}>SKILLS</span>
|
|
271
|
+
</div>
|
|
272
|
+
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', overflow: 'hidden' }}>
|
|
273
|
+
{isMobile && (
|
|
274
|
+
<div style={{ display: 'flex', gap: 8, padding: '8px 10px', borderBottom: '1px solid var(--border)', background: 'var(--bg2)' }}>
|
|
275
|
+
<Button variant={mobileStep === 1 ? 'primary' : 'ghost'} size="sm" onClick={() => setMobileStep(1)}>LIST</Button>
|
|
276
|
+
<Button variant={mobileStep === 2 ? 'primary' : 'ghost'} size="sm" disabled={!selected} onClick={() => setMobileStep(2)}>EDITOR</Button>
|
|
277
|
+
</div>
|
|
278
|
+
)}
|
|
279
|
+
|
|
280
|
+
<div style={{ display: 'flex', flexDirection: isMobile ? 'column' : 'row', flex: 1, overflow: 'hidden' }}>
|
|
281
|
+
{/* Side panel */}
|
|
282
|
+
<ListContainer style={{
|
|
283
|
+
width: isMobile ? '100%' : 320,
|
|
284
|
+
borderRight: isMobile ? 'none' : '1px solid var(--border)',
|
|
285
|
+
borderBottom: isMobile ? '1px solid var(--border)' : 'none',
|
|
286
|
+
display: isMobile && mobileStep !== 1 ? 'none' : 'flex',
|
|
287
|
+
flexDirection: 'column',
|
|
288
|
+
flexShrink: 0,
|
|
289
|
+
}}>
|
|
290
|
+
<div className="ui-filter-bar" style={{ borderBottom: '1px solid var(--border)', padding: '8px 12px' }}>
|
|
291
|
+
{filters.map(f => (
|
|
292
|
+
<Button
|
|
293
|
+
key={f}
|
|
294
|
+
variant={filter === f ? 'primary' : 'ghost'}
|
|
295
|
+
size="sm"
|
|
296
|
+
onClick={() => setFilter(f)}
|
|
297
|
+
>
|
|
298
|
+
{f.toUpperCase()} ({filterCounts[f] ?? 0})
|
|
299
|
+
</Button>
|
|
300
|
+
))}
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
<div style={{ padding: '8px 12px', borderBottom: '1px solid var(--border)' }}>
|
|
304
|
+
<input
|
|
305
|
+
type="text"
|
|
306
|
+
placeholder="Search skills…"
|
|
307
|
+
value={search}
|
|
308
|
+
onChange={e => setSearch(e.target.value)}
|
|
309
|
+
style={{
|
|
310
|
+
width: '100%',
|
|
311
|
+
padding: '6px 10px',
|
|
312
|
+
background: 'var(--bg)',
|
|
313
|
+
border: '1px solid var(--border)',
|
|
314
|
+
borderRadius: 0,
|
|
315
|
+
color: 'var(--text)',
|
|
316
|
+
fontFamily: 'var(--font-mono-stack)',
|
|
317
|
+
fontSize: 11,
|
|
318
|
+
outline: 'none',
|
|
319
|
+
boxSizing: 'border-box',
|
|
320
|
+
}}
|
|
321
|
+
/>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
<div style={{ flex: 1, overflowY: 'auto' }}>
|
|
325
|
+
{loading && <LoadingState />}
|
|
326
|
+
{!loading && error && <ErrorState message={error} />}
|
|
327
|
+
{!loading && !error && filtered.length === 0 && (
|
|
328
|
+
<EmptyState message={search ? 'no skills match your search' : 'no skills found'} />
|
|
329
|
+
)}
|
|
330
|
+
{!loading && !error && filtered.map(s => (
|
|
331
|
+
<ListItem
|
|
332
|
+
key={`${s.type}:${s.name}`}
|
|
333
|
+
active={selected?.name === s.name && selected?.type === s.type}
|
|
334
|
+
onClick={() => handleSelect(s)}
|
|
335
|
+
>
|
|
336
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
|
337
|
+
<span style={{ flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
|
338
|
+
{s.name}
|
|
339
|
+
</span>
|
|
340
|
+
<Badge color={typeColor[s.type] ?? 'gray'}>{typeLabel(s)}</Badge>
|
|
341
|
+
</div>
|
|
342
|
+
{s.description && (
|
|
343
|
+
<div style={{ fontSize: 10, color: 'var(--text-dim)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', marginTop: 2 }}>
|
|
344
|
+
{s.description}
|
|
345
|
+
</div>
|
|
346
|
+
)}
|
|
347
|
+
</ListItem>
|
|
348
|
+
))}
|
|
349
|
+
</div>
|
|
350
|
+
</ListContainer>
|
|
351
|
+
|
|
352
|
+
{/* Detail / Editor */}
|
|
353
|
+
<div style={{ flex: 1, display: isMobile && mobileStep !== 2 ? 'none' : 'flex', flexDirection: 'column', overflow: 'hidden' }}>
|
|
354
|
+
{!selected ? (
|
|
355
|
+
<div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', color: 'var(--text-dim)', fontFamily: 'var(--font-mono-stack)', fontSize: 12, padding: '24px 16px' }}>
|
|
356
|
+
← select a skill
|
|
357
|
+
</div>
|
|
358
|
+
) : (
|
|
359
|
+
<>
|
|
360
|
+
<PanelTitle>SKILL — {selected.name}</PanelTitle>
|
|
361
|
+
<div style={{ padding: '16px 20px', borderBottom: '1px solid var(--border)', background: 'var(--bg)' }}>
|
|
362
|
+
{selected.version && <div style={{ marginBottom: 8 }}><Badge color="gray">v{selected.version}</Badge></div>}
|
|
363
|
+
{selected.description && (
|
|
364
|
+
<div style={{ fontFamily: 'var(--font-mono-stack)', fontSize: 11, color: 'var(--text-dim)', marginBottom: 8, lineHeight: 1.5 }}>
|
|
365
|
+
{selected.description}
|
|
366
|
+
</div>
|
|
367
|
+
)}
|
|
368
|
+
{(selected.agentId || selected.containerName) && (
|
|
369
|
+
<div style={{ marginBottom: 4, display: 'flex', alignItems: 'center', gap: 6 }}>
|
|
370
|
+
{selected.agentId && <Badge color="green">agent:{selected.agentId}</Badge>}
|
|
371
|
+
{selected.containerName && (
|
|
372
|
+
<span style={{ fontFamily: 'var(--font-mono-stack)', fontSize: 10, color: 'var(--text-dim)' }}>
|
|
373
|
+
{selected.containerName}
|
|
374
|
+
</span>
|
|
375
|
+
)}
|
|
376
|
+
</div>
|
|
377
|
+
)}
|
|
378
|
+
{selected.path && (
|
|
379
|
+
<div style={{ fontFamily: 'var(--font-mono-stack)', fontSize: 10, color: 'var(--text-dim)', marginBottom: 10 }}>
|
|
380
|
+
{selected.path}
|
|
381
|
+
</div>
|
|
382
|
+
)}
|
|
383
|
+
|
|
384
|
+
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
|
|
385
|
+
{!editMode && selected.skillMdPath && selected.type !== 'bundled' && (
|
|
386
|
+
<Button variant="secondary" size="sm" onClick={() => { setEditText(skillContent || ''); setEditMode(true); }}>
|
|
387
|
+
EDIT SKILL.MD
|
|
388
|
+
</Button>
|
|
389
|
+
)}
|
|
390
|
+
{editMode && (
|
|
391
|
+
<>
|
|
392
|
+
<Button variant="primary" size="sm" loading={saving} onClick={handleSave}>
|
|
393
|
+
{saving ? 'SAVING…' : 'SAVE'}
|
|
394
|
+
</Button>
|
|
395
|
+
<Button variant="secondary" size="sm" onClick={() => setEditMode(false)}>
|
|
396
|
+
CANCEL
|
|
397
|
+
</Button>
|
|
398
|
+
</>
|
|
399
|
+
)}
|
|
400
|
+
{selected.type === 'bundled' && selected.skillMdPath && (
|
|
401
|
+
<Badge color="gray">read-only (bundled)</Badge>
|
|
402
|
+
)}
|
|
403
|
+
{(selected.type === 'shared' || (selected.type === 'workspace' && selected.containerName)) && !editMode && (
|
|
404
|
+
<Button
|
|
405
|
+
variant="danger"
|
|
406
|
+
size="sm"
|
|
407
|
+
onClick={() => setDeleteModalSkill(selected)}
|
|
408
|
+
>
|
|
409
|
+
DELETE
|
|
410
|
+
</Button>
|
|
411
|
+
)}
|
|
412
|
+
{selected.type === 'workspace' && selected.containerName && !editMode && (
|
|
413
|
+
<Button
|
|
414
|
+
variant="primary"
|
|
415
|
+
size="sm"
|
|
416
|
+
loading={promoting === selected.name}
|
|
417
|
+
onClick={() => handlePromote(selected)}
|
|
418
|
+
>
|
|
419
|
+
{promoting === selected.name ? 'PROMOTING…' : 'PROMOTE TO SHARED'}
|
|
420
|
+
</Button>
|
|
421
|
+
)}
|
|
422
|
+
</div>
|
|
423
|
+
</div>
|
|
424
|
+
|
|
425
|
+
<ConfirmModal
|
|
426
|
+
open={deleteModalSkill !== null}
|
|
427
|
+
onClose={() => setDeleteModalSkill(null)}
|
|
428
|
+
onConfirm={handleDelete}
|
|
429
|
+
title={`Delete ${deleteModalSkill?.type === 'workspace' ? 'workspace' : 'shared'} skill`}
|
|
430
|
+
message={`Are you sure you want to delete "${deleteModalSkill?.name ?? ''}"?\n\n` + (deleteModalSkill?.type === 'workspace' ? 'This will remove the skill from the agent\'s workspace.' : 'This will remove the skill from shared skills.') + `\n\nThis action cannot be undone.`}
|
|
431
|
+
confirmLabel={deleting ? 'DELETING…' : 'DELETE'}
|
|
432
|
+
cancelLabel="Cancel"
|
|
433
|
+
tone="danger"
|
|
434
|
+
/>
|
|
435
|
+
|
|
436
|
+
<div style={{ flex: 1, overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
|
|
437
|
+
{loadingContent && <LoadingState />}
|
|
438
|
+
{!loadingContent && editMode && (
|
|
439
|
+
<textarea
|
|
440
|
+
value={editText}
|
|
441
|
+
onChange={e => setEditText(e.target.value)}
|
|
442
|
+
spellCheck={false}
|
|
443
|
+
style={{
|
|
444
|
+
flex: 1,
|
|
445
|
+
background: 'var(--bg)',
|
|
446
|
+
color: 'var(--text)',
|
|
447
|
+
fontFamily: 'var(--font-mono-stack)',
|
|
448
|
+
fontSize: 12,
|
|
449
|
+
border: 'none',
|
|
450
|
+
outline: 'none',
|
|
451
|
+
padding: 16,
|
|
452
|
+
resize: 'none',
|
|
453
|
+
lineHeight: 1.6,
|
|
454
|
+
}}
|
|
455
|
+
/>
|
|
456
|
+
)}
|
|
457
|
+
{!loadingContent && !editMode && skillContent && (
|
|
458
|
+
<pre style={{
|
|
459
|
+
flex: 1,
|
|
460
|
+
overflowY: 'auto',
|
|
461
|
+
margin: 0,
|
|
462
|
+
padding: 16,
|
|
463
|
+
fontFamily: 'var(--font-mono-stack)',
|
|
464
|
+
fontSize: 11,
|
|
465
|
+
color: 'var(--text-dim)',
|
|
466
|
+
lineHeight: 1.6,
|
|
467
|
+
whiteSpace: 'pre-wrap',
|
|
468
|
+
wordBreak: 'break-word',
|
|
469
|
+
}}>
|
|
470
|
+
{skillContent}
|
|
471
|
+
</pre>
|
|
472
|
+
)}
|
|
473
|
+
{!loadingContent && !editMode && !skillContent && selected.skillMdPath && (
|
|
474
|
+
<EmptyState message="could not load SKILL.md" />
|
|
475
|
+
)}
|
|
476
|
+
{!loadingContent && !editMode && !selected.skillMdPath && (
|
|
477
|
+
<EmptyState message="no SKILL.md found for this skill" />
|
|
478
|
+
)}
|
|
479
|
+
</div>
|
|
480
|
+
</>
|
|
481
|
+
)}
|
|
482
|
+
</div>
|
|
483
|
+
</div>
|
|
484
|
+
|
|
485
|
+
{toastMsg && (
|
|
486
|
+
<div style={{
|
|
487
|
+
position: 'fixed', bottom: 24, right: 24,
|
|
488
|
+
background: 'var(--bg2)', border: '1px solid var(--violet)',
|
|
489
|
+
color: 'var(--text)', fontFamily: 'var(--font-mono-stack)',
|
|
490
|
+
fontSize: 12, padding: '10px 18px', borderRadius: 0,
|
|
491
|
+
zIndex: 1000,
|
|
492
|
+
}}>
|
|
493
|
+
{toastMsg}
|
|
494
|
+
</div>
|
|
495
|
+
)}
|
|
496
|
+
</div>
|
|
497
|
+
</div>
|
|
498
|
+
);
|
|
499
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Skeleton, CardRowSkeleton } from '../components/Skeleton';
|
|
2
|
+
|
|
3
|
+
const PageSkeleton = () => (
|
|
4
|
+
<div style={{ padding: '24px 20px', maxWidth: 1080, margin: '0 auto' }}>
|
|
5
|
+
<Skeleton width={120} height={20} accent style={{ marginBottom: 20 }} />
|
|
6
|
+
<CardRowSkeleton count={5} height={48} />
|
|
7
|
+
</div>
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export default PageSkeleton;
|