@kabmo-labs/kabmo 0.16.0 → 0.17.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/README.md +2 -2
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +417 -417
- package/dist/client/static/js/index-3ve31rzx.css +1 -0
- package/dist/client/static/js/{index-cpydmygd.js → index-rerjq5th.js} +839 -837
- package/package.json +1 -1
- package/src/client/components/common/code-surface/bracket-guide.test.ts +2 -2
- package/src/client/components/common/code-surface/bracket-guide.ts +2 -2
- package/src/client/components/common/code-surface/conflict-markers.ts +5 -5
- package/src/client/components/common/code-surface/extensions.ts +7 -4
- package/src/client/components/common/code-surface/theme.ts +34 -9
- package/src/client/components/common/code-surface/whitespace.test.ts +223 -0
- package/src/client/components/common/code-surface/whitespace.ts +140 -0
- package/src/client/components/common/{server-switcher/index.tsx → server-control/Panel.tsx} +73 -35
- package/src/client/components/common/{server-switcher → server-control}/index.test.tsx +98 -37
- package/src/client/components/common/server-control/index.tsx +118 -0
- package/src/client/components/layout/desktop-layout/TopNavbar.tsx +8 -50
- package/src/client/components/mobile/mobile-main-view/Header.tsx +6 -12
- package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +41 -13
- package/src/client/components/settings/Modal.tsx +9 -3
- package/src/client/components/settings/ProjectSelectorDropdown.tsx +19 -9
- package/src/client/components/settings/categories/AgentSettings.tsx +27 -6
- package/src/client/components/settings/categories/ProjectSettings.tsx +122 -156
- package/src/client/components/settings/categories/SkillCatalogSettings.tsx +220 -260
- package/src/client/components/settings/categories/SkillSettings.tsx +6 -3
- package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +5 -0
- package/src/client/components/settings/categories/project-settings/AccentPalette.test.tsx +189 -0
- package/src/client/components/settings/categories/project-settings/AccentPalette.tsx +156 -24
- package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +175 -0
- package/src/client/components/settings/categories/project-settings/DeleteProjectModal.tsx +107 -0
- package/src/client/components/settings/categories/project-settings/DetailsForm.tsx +40 -24
- package/src/client/components/settings/categories/project-settings/DetailsHeader.tsx +17 -7
- package/src/client/components/settings/categories/project-settings/IconGrid.tsx +164 -69
- package/src/client/components/settings/categories/project-settings/ModelDropdown.test.tsx +122 -0
- package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +124 -53
- package/src/client/components/settings/categories/project-settings/NameInput.tsx +57 -11
- package/src/client/components/settings/categories/project-settings/PathField.tsx +122 -0
- package/src/client/components/settings/categories/project-settings/SidebarList.tsx +100 -59
- package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +253 -0
- package/src/client/components/settings/categories/skill-catalog/SkillCard.tsx +89 -0
- package/src/client/components/settings/categories/skill-catalog/SourceRail.tsx +122 -0
- package/src/client/components/settings/categories/skill-catalog/catalog-ui.test.tsx +179 -0
- package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +208 -0
- package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +137 -232
- package/src/client/components/settings/categories/skill-settings/InstructionsEditor.tsx +84 -0
- package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +123 -87
- package/src/client/components/settings/categories/skill-settings/pane.test.tsx +179 -0
- package/src/client/components/settings/categories/skill-settings/row-meta.ts +58 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +6 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.test.ts +46 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -6
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.test.ts +29 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +11 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.test.ts +24 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +6 -2
- package/src/client/components/workspace/editor/viewers/SvgPreview.tsx +18 -2
- package/src/client/components/workspace/editor/viewers/viewers.test.ts +39 -0
- package/src/client/components/workspace/file-explorer/ContextMenu.tsx +18 -5
- package/src/client/components/workspace/file-explorer/Modals.tsx +15 -1
- package/src/client/components/workspace/file-explorer/RowLabel.tsx +68 -0
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +47 -57
- package/src/client/components/workspace/file-explorer/collapsed-chain.test.ts +167 -0
- package/src/client/components/workspace/file-explorer/drag-props.ts +42 -0
- package/src/client/components/workspace/file-explorer/drag.test.ts +43 -0
- package/src/client/components/workspace/file-explorer/index.tsx +21 -20
- package/src/client/data/settings/omp-schema.json +91 -4
- package/src/client/data/settings/project.ts +9 -28
- package/src/client/data/settings/skill.ts +6 -32
- package/src/client/hooks/chat/timeline/pending-model.ts +28 -0
- package/src/client/hooks/settings/projects/index.ts +294 -0
- package/src/client/hooks/settings/projects.test.ts +237 -0
- package/src/client/hooks/settings/skill-catalog.ts +101 -9
- package/src/client/hooks/settings/skill-git-import.ts +153 -0
- package/src/client/hooks/shell/servers.test.ts +166 -0
- package/src/client/hooks/{desktop → shell}/servers.ts +17 -14
- package/src/client/hooks/ui/updates/shell-download.ts +1 -1
- package/src/client/hooks/ui/updates/shell-update.ts +2 -6
- package/src/client/hooks/workspace/file-row-drag.ts +41 -0
- package/src/client/hooks/workspace/file-tree-actions.ts +25 -1
- package/src/client/hooks/workspace/file-tree-edits.ts +23 -6
- package/src/client/hooks/workspace/root-drop-target.ts +77 -0
- package/src/client/hooks/workspace/unfolded-chains.ts +165 -0
- package/src/client/lib/desktop/dropped-paths.ts +1 -1
- package/src/client/lib/desktop/titlebar.test.ts +12 -3
- package/src/client/lib/desktop/titlebar.ts +1 -1
- package/src/client/lib/shell/desktop.ts +117 -0
- package/src/client/lib/shell/servers.ts +75 -0
- package/src/client/lib/shell/transport.ts +216 -0
- package/src/client/main.tsx +9 -0
- package/src/server/lib/fs/git-merge-conflict.test.ts +14 -1
- package/src/server/lib/omp/config/skill-sources.ts +49 -0
- package/src/server/lib/omp/config/skills-git-install.ts +155 -0
- package/src/server/lib/omp/config/skills-git-repo.ts +288 -0
- package/src/server/lib/omp/config/skills-git.test.ts +220 -0
- package/src/server/lib/workspace/project-model.server.test.ts +102 -0
- package/src/server/lib/workspace/project-model.server.ts +47 -0
- package/src/server/lib/workspace/project-patch.server.ts +156 -0
- package/src/server/routes/agent/new.ts +8 -1
- package/src/server/routes/settings/agents.ts +19 -7
- package/src/server/routes/settings/projects.ts +53 -19
- package/src/server/routes/settings/settings-projects-routes.test.ts +214 -0
- package/src/server/routes/settings/settings-store-routes.test.ts +5 -2
- package/src/server/routes/settings/skills-catalog-actions.ts +195 -0
- package/src/server/routes/settings/skills.test.ts +225 -0
- package/src/server/routes/settings/skills.ts +18 -15
- package/src/shared/lib/fs/folder-chain.test.ts +81 -1
- package/src/shared/lib/fs/folder-chain.ts +84 -0
- package/src/shared/lib/omp/config/schema.test.ts +35 -0
- package/src/shared/lib/omp/session/job-progress.test.ts +37 -1
- package/src/shared/lib/omp/session/job-progress.ts +31 -0
- package/src/shared/lib/omp/session/proc.ts +5 -0
- package/src/shared/lib/omp/session/wait.ts +5 -0
- package/src/shared/lib/ui/mobile-overlay.ts +61 -0
- package/src/shared/lib/ui/svg-scope.test.ts +97 -0
- package/src/shared/lib/ui/svg-scope.ts +134 -0
- package/src/shared/lib/workspace/project-accent.test.ts +69 -0
- package/src/shared/lib/workspace/project-accent.ts +63 -0
- package/src/shared/lib/workspace/project-icon.ts +40 -0
- package/src/shared/lib/workspace/project-model.test.ts +79 -0
- package/src/shared/lib/workspace/project-model.ts +64 -0
- package/src/shared/types/settings/skill.ts +53 -3
- package/src/test-support/file-explorer-disk.test-util.ts +25 -1
- package/src/test-support/file-explorer-drag.test-util.ts +88 -0
- package/src/test-support/file-explorer.test-util.ts +47 -47
- package/dist/client/static/js/index-fjnq2z2d.css +0 -1
- package/src/client/components/common/code-surface/indent-guide.ts +0 -104
- package/src/client/components/settings/categories/skill-catalog/AddSourceModal.tsx +0 -133
- package/src/client/hooks/desktop/servers.test.ts +0 -73
- package/src/client/lib/desktop/bridge.ts +0 -203
- package/src/shared/lib/code/editor/indent-guide-rule.test.ts +0 -65
- package/src/shared/lib/code/editor/indent-guide-rule.ts +0 -47
|
@@ -1,289 +1,249 @@
|
|
|
1
|
-
import { useState } from 'preact/hooks';
|
|
2
|
-
import { Check,
|
|
3
|
-
import type { CatalogSkillItem
|
|
4
|
-
import { AddSourceModal } from '@/client/components/settings/categories/skill-catalog/AddSourceModal';
|
|
1
|
+
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
2
|
+
import { Check, Loader2, RefreshCw, Search, X } from 'lucide-preact';
|
|
3
|
+
import type { CatalogSkillItem } from '@/shared/types';
|
|
5
4
|
import { invalidateComposerCache } from '@/shared/lib/chat/composer/client';
|
|
6
5
|
import { useSkillCatalog } from '@/client/hooks/settings/skill-catalog';
|
|
6
|
+
import { useSkillGitImport } from '@/client/hooks/settings/skill-git-import';
|
|
7
|
+
import { SkillCard } from '@/client/components/settings/categories/skill-catalog/SkillCard';
|
|
8
|
+
import { SourceRail } from '@/client/components/settings/categories/skill-catalog/SourceRail';
|
|
9
|
+
import { GitImportPanel } from '@/client/components/settings/categories/skill-catalog/GitImportPanel';
|
|
10
|
+
|
|
11
|
+
export type CatalogTab = 'browse' | 'git' | 'sources';
|
|
12
|
+
|
|
13
|
+
const TABS: Array<{ id: CatalogTab; label: string }> = [
|
|
14
|
+
{ id: 'browse', label: 'Browse' },
|
|
15
|
+
{ id: 'git', label: 'From Git' },
|
|
16
|
+
{ id: 'sources', label: 'Sources' },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const SEARCH_DEBOUNCE_MS = 300;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Skills Catalog screen: three surfaces over the same two sources of truth.
|
|
23
|
+
*
|
|
24
|
+
* Browse is skills.sh, From Git is an arbitrary repository, Sources is the list of
|
|
25
|
+
* repositories either one can offer. They share `useSkillCatalog` so an install in
|
|
26
|
+
* one tab is visible in the others without a second fetch, and the tab strip is
|
|
27
|
+
* the only place the three are named.
|
|
28
|
+
*
|
|
29
|
+
* Search is SERVER-side now. The box used to filter the ~26 rows the loader had
|
|
30
|
+
* pre-fetched, so a query the catalog really held answered "no skills found" —
|
|
31
|
+
* a false negative the user could not distinguish from an empty registry.
|
|
32
|
+
*/
|
|
33
|
+
export function SkillCatalogSettings({ initialTab = 'browse' }: { initialTab?: CatalogTab } = {}) {
|
|
34
|
+
const catalog = useSkillCatalog();
|
|
35
|
+
const git = useSkillGitImport();
|
|
36
|
+
const [tab, setTab] = useState<CatalogTab>(initialTab);
|
|
37
|
+
const [query, setQuery] = useState('');
|
|
38
|
+
const [searching, setSearching] = useState(false);
|
|
39
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
40
|
+
const [toast, setToast] = useState<string | null>(null);
|
|
41
|
+
const [busySkill, setBusySkill] = useState<string | null>(null);
|
|
42
|
+
const [scanningSource, setScanningSource] = useState<string | null>(null);
|
|
43
|
+
const [sourceBusy, setSourceBusy] = useState(false);
|
|
44
|
+
const debounce = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
45
|
+
|
|
46
|
+
const installed = new Set(catalog.userSkills.map((skill) => skill.name));
|
|
47
|
+
|
|
48
|
+
const showToast = (message: string) => {
|
|
49
|
+
setToast(message);
|
|
50
|
+
setTimeout(() => setToast(null), 3000);
|
|
51
|
+
};
|
|
7
52
|
|
|
8
|
-
|
|
9
|
-
const { sources, catalogSkills, userSkills, setSources, setUserSkills, reload } = useSkillCatalog();
|
|
10
|
-
const [selectedSourceId, setSelectedSourceId] = useState<string>('anthropic');
|
|
11
|
-
const [searchQuery, setSearchQuery] = useState('');
|
|
12
|
-
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
13
|
-
const [isAddSourceModalOpen, setIsAddSourceModalOpen] = useState(false);
|
|
14
|
-
const [toastMessage, setToastMessage] = useState<string | null>(null);
|
|
15
|
-
|
|
16
|
-
const installedSkillIds = new Set(userSkills.map((s) => s?.name).filter(Boolean));
|
|
53
|
+
useEffect(() => () => clearTimeout(debounce.current), []);
|
|
17
54
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
55
|
+
const runSearch = (value: string) => {
|
|
56
|
+
setQuery(value);
|
|
57
|
+
clearTimeout(debounce.current);
|
|
58
|
+
if (!value.trim()) {
|
|
59
|
+
void catalog.search('').catch(console.error);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
debounce.current = setTimeout(() => {
|
|
63
|
+
setSearching(true);
|
|
64
|
+
catalog
|
|
65
|
+
.search(value)
|
|
66
|
+
.catch((error) => showToast(error instanceof Error ? error.message : String(error)))
|
|
67
|
+
.finally(() => setSearching(false));
|
|
68
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
21
69
|
};
|
|
22
70
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
71
|
+
const handleInstallToggle = async (skill: CatalogSkillItem) => {
|
|
72
|
+
const isInstalled = installed.has(skill.name);
|
|
73
|
+
setBusySkill(skill.id);
|
|
74
|
+
try {
|
|
75
|
+
const response = await fetch('/api/settings/skills', {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
headers: { 'Content-Type': 'application/json' },
|
|
78
|
+
body: JSON.stringify({ type: 'install_toggle', skill, install: !isInstalled }),
|
|
79
|
+
});
|
|
80
|
+
const data = await response.json();
|
|
81
|
+
if (!response.ok || data?.error) throw new Error(data?.error || `Request failed (${response.status})`);
|
|
82
|
+
if (Array.isArray(data?.skills)) catalog.setUserSkills(data.skills);
|
|
83
|
+
invalidateComposerCache('command');
|
|
84
|
+
showToast(isInstalled ? `Uninstalled "${skill.name}"` : `Installed "${skill.name}"`);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
showToast(error instanceof Error ? error.message : String(error));
|
|
87
|
+
} finally {
|
|
88
|
+
setBusySkill(null);
|
|
89
|
+
}
|
|
29
90
|
};
|
|
30
91
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
fetch('/api/settings/skills', {
|
|
39
|
-
method: 'POST',
|
|
40
|
-
headers: { 'Content-Type': 'application/json' },
|
|
41
|
-
body: JSON.stringify({ type: 'install_toggle', skill, install: !existing }),
|
|
42
|
-
})
|
|
43
|
-
.then((res) => res.json())
|
|
44
|
-
.then((data) => {
|
|
45
|
-
if (data?.error) {
|
|
46
|
-
showToast(`Failed: ${data.error}`);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (Array.isArray(data?.skills)) setUserSkills(data.skills);
|
|
50
|
-
invalidateComposerCache('command');
|
|
51
|
-
showToast(existing ? `Uninstalled skill "${skill.name}"` : `Installed skill "${skill.name}"`);
|
|
52
|
-
})
|
|
53
|
-
.catch((error) => {
|
|
54
|
-
console.error(error);
|
|
55
|
-
showToast(`Failed to ${existing ? 'uninstall' : 'install'} "${skill.name}"`);
|
|
56
|
-
});
|
|
92
|
+
const refresh = () => {
|
|
93
|
+
setRefreshing(true);
|
|
94
|
+
catalog
|
|
95
|
+
.reload()
|
|
96
|
+
.then(() => showToast('Catalog refreshed'))
|
|
97
|
+
.catch((error) => showToast(error instanceof Error ? error.message : String(error)))
|
|
98
|
+
.finally(() => setRefreshing(false));
|
|
57
99
|
};
|
|
58
100
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
body: JSON.stringify({ catalogSources: nextSources }),
|
|
67
|
-
}).catch(console.error);
|
|
68
|
-
showToast(`Added source "${newSource.name}"`);
|
|
101
|
+
const scanSource = (id: string) => {
|
|
102
|
+
setScanningSource(id);
|
|
103
|
+
catalog
|
|
104
|
+
.scanSource(id)
|
|
105
|
+
.then(({ skills }) => showToast(`Found ${skills.filter((skill) => skill.loadable).length} loadable skill(s)`))
|
|
106
|
+
.catch((error) => showToast(error instanceof Error ? error.message : String(error)))
|
|
107
|
+
.finally(() => setScanningSource(null));
|
|
69
108
|
};
|
|
70
109
|
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
item.description.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
|
76
|
-
item.repoTag.toLowerCase().includes(searchQuery.toLowerCase());
|
|
110
|
+
const addSource = () => {
|
|
111
|
+
setTab('git');
|
|
112
|
+
git.reset();
|
|
113
|
+
};
|
|
77
114
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
115
|
+
const removeSource = (id: string) => {
|
|
116
|
+
setSourceBusy(true);
|
|
117
|
+
catalog
|
|
118
|
+
.removeSource(id)
|
|
119
|
+
.then(() => showToast('Source removed'))
|
|
120
|
+
.catch((error) => showToast(error instanceof Error ? error.message : String(error)))
|
|
121
|
+
.finally(() => setSourceBusy(false));
|
|
122
|
+
};
|
|
83
123
|
|
|
84
|
-
const
|
|
124
|
+
const importFrom = (repo: string) => {
|
|
125
|
+
setTab('git');
|
|
126
|
+
void git.inspect(repo);
|
|
127
|
+
};
|
|
85
128
|
|
|
86
129
|
return (
|
|
87
|
-
<div className="flex-1 flex flex-col h-full w-full
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
/>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
{/* Sources Grid */}
|
|
108
|
-
<div className="space-y-3">
|
|
109
|
-
<h3 className="text-xs font-bold uppercase tracking-wider text-ink">
|
|
110
|
-
Sources
|
|
111
|
-
</h3>
|
|
112
|
-
|
|
113
|
-
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
|
114
|
-
{sources.map((source) => {
|
|
115
|
-
const isSelected = selectedSourceId === source.id && !searchQuery.trim();
|
|
116
|
-
return (
|
|
117
|
-
<div
|
|
118
|
-
key={source.id}
|
|
119
|
-
onClick={() => {
|
|
120
|
-
setSelectedSourceId(source.id);
|
|
121
|
-
setSearchQuery('');
|
|
122
|
-
}}
|
|
123
|
-
className={`p-3.5 rounded-xl border transition-all cursor-pointer select-none relative ${
|
|
124
|
-
isSelected
|
|
125
|
-
? 'border-ink bg-ink/5 shadow-xs'
|
|
126
|
-
: 'border-ink/20 hover:border-ink/40 bg-paper'
|
|
127
|
-
}`}
|
|
128
|
-
>
|
|
129
|
-
<div className="flex items-center justify-between">
|
|
130
|
-
<div className="flex items-center gap-2">
|
|
131
|
-
<span className="text-xs font-bold text-ink">{source.name}</span>
|
|
132
|
-
<span className="text-[10px] text-ink/50 font-mono">
|
|
133
|
-
{source.skillCount} skills
|
|
134
|
-
</span>
|
|
135
|
-
</div>
|
|
136
|
-
<RefreshCw
|
|
137
|
-
size={13}
|
|
138
|
-
className={`text-ink/40 hover:text-ink transition-colors ${
|
|
139
|
-
isRefreshing && isSelected ? 'animate-spin' : ''
|
|
140
|
-
}`}
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<div className="mt-1 font-mono text-[11px] text-ink/60 truncate">
|
|
145
|
-
{source.repo}
|
|
146
|
-
</div>
|
|
147
|
-
|
|
148
|
-
<div className="mt-2.5 flex items-center gap-3 text-[10px] text-ink/50">
|
|
149
|
-
<span className="flex items-center gap-1">
|
|
150
|
-
<Star size={11} className="text-ink/50" />
|
|
151
|
-
<span>{source.stars}</span>
|
|
152
|
-
</span>
|
|
153
|
-
<span>{source.updatedAt}</span>
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
);
|
|
157
|
-
})}
|
|
158
|
-
|
|
159
|
-
{/* Add Your Own Source Card */}
|
|
160
|
-
<div
|
|
161
|
-
onClick={() => setIsAddSourceModalOpen(true)}
|
|
162
|
-
className="p-3.5 rounded-xl border border-dashed border-ink/25 hover:border-ink/50 bg-paper hover:bg-ink/[0.02] transition-all cursor-pointer flex items-center gap-3 select-none"
|
|
163
|
-
>
|
|
164
|
-
<div className="w-8 h-8 rounded-lg border border-ink/20 flex items-center justify-center text-ink/60 flex-shrink-0">
|
|
165
|
-
<Plus size={16} />
|
|
166
|
-
</div>
|
|
167
|
-
<div>
|
|
168
|
-
<div className="text-xs font-bold text-ink">Add your own source</div>
|
|
169
|
-
<div className="text-[11px] text-ink/60">Any Git repository with skills</div>
|
|
170
|
-
</div>
|
|
171
|
-
</div>
|
|
130
|
+
<div className="flex-1 flex flex-col h-full w-full overflow-hidden bg-paper text-ink">
|
|
131
|
+
<div className="flex-shrink-0 px-6 md:px-8 pt-5">
|
|
132
|
+
<div className="flex items-center gap-1 border-b border-ink/10">
|
|
133
|
+
{TABS.map((entry) => (
|
|
134
|
+
<button
|
|
135
|
+
key={entry.id}
|
|
136
|
+
type="button"
|
|
137
|
+
onClick={() => setTab(entry.id)}
|
|
138
|
+
className={`px-3 py-2 -mb-px text-xs font-semibold border-b-2 transition-colors cursor-pointer ${
|
|
139
|
+
tab === entry.id
|
|
140
|
+
? 'border-ink text-ink'
|
|
141
|
+
: 'border-transparent text-ink/55 hover:text-ink hover:border-ink/25'
|
|
142
|
+
}`}
|
|
143
|
+
>
|
|
144
|
+
{entry.label}
|
|
145
|
+
</button>
|
|
146
|
+
))}
|
|
172
147
|
</div>
|
|
173
148
|
</div>
|
|
174
149
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
</button>
|
|
198
|
-
</div>
|
|
199
|
-
|
|
200
|
-
{/* Skills List */}
|
|
201
|
-
<div className="space-y-3">
|
|
202
|
-
{filteredSkills.length === 0 ? (
|
|
203
|
-
<div className="text-center py-10 border border-dashed border-ink/15 rounded-xl">
|
|
204
|
-
<p className="text-xs text-ink/60">No skills found matching your query.</p>
|
|
205
|
-
</div>
|
|
206
|
-
) : (
|
|
207
|
-
filteredSkills.map((skill) => {
|
|
208
|
-
const isInstalled = installedSkillIds.has(skill.name);
|
|
209
|
-
return (
|
|
210
|
-
<div
|
|
211
|
-
key={skill.id}
|
|
212
|
-
className="p-4 rounded-xl border border-ink/15 hover:border-ink/30 bg-paper transition-all flex flex-col sm:flex-row sm:items-start justify-between gap-3"
|
|
150
|
+
<div className="flex-1 min-h-0 overflow-auto scrollbar-overlay-container px-6 md:px-8 py-5 space-y-5">
|
|
151
|
+
{tab === 'browse' ? (
|
|
152
|
+
<>
|
|
153
|
+
<div className="relative">
|
|
154
|
+
{searching ? (
|
|
155
|
+
<Loader2 size={15} className="absolute left-3 top-2.5 text-ink/40 animate-spin" />
|
|
156
|
+
) : (
|
|
157
|
+
<Search size={15} className="absolute left-3 top-2.5 text-ink/40 pointer-events-none" />
|
|
158
|
+
)}
|
|
159
|
+
<input
|
|
160
|
+
type="text"
|
|
161
|
+
value={query}
|
|
162
|
+
onInput={(event) => runSearch(event.currentTarget.value)}
|
|
163
|
+
placeholder="Search skills.sh…"
|
|
164
|
+
className="w-full pl-9 pr-9 py-2 rounded-lg border border-ink/20 hover:border-ink/40 bg-paper focus:outline-none focus:border-ink text-xs text-ink transition-colors"
|
|
165
|
+
/>
|
|
166
|
+
{query ? (
|
|
167
|
+
<button
|
|
168
|
+
type="button"
|
|
169
|
+
onClick={() => runSearch('')}
|
|
170
|
+
aria-label="Clear the search"
|
|
171
|
+
className="absolute right-2 top-1.5 p-1 rounded-md text-ink/40 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer"
|
|
213
172
|
>
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</span>
|
|
219
|
-
</div>
|
|
220
|
-
|
|
221
|
-
<p className="text-xs text-ink/75 leading-relaxed line-clamp-2">
|
|
222
|
-
{skill.description}
|
|
223
|
-
</p>
|
|
224
|
-
|
|
225
|
-
<div className="flex items-center gap-1.5 text-[11px] text-ink/50 font-mono pt-1">
|
|
226
|
-
<GitBranch size={12} className="flex-shrink-0" />
|
|
227
|
-
<span className="truncate">{skill.repoTag}</span>
|
|
228
|
-
</div>
|
|
229
|
-
</div>
|
|
173
|
+
<X size={13} />
|
|
174
|
+
</button>
|
|
175
|
+
) : null}
|
|
176
|
+
</div>
|
|
230
177
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
178
|
+
<div className="flex items-center justify-between">
|
|
179
|
+
<span className="text-[11px] text-ink/55">
|
|
180
|
+
{catalog.catalogSkills.length} skill(s){query.trim() ? ` for “${query.trim()}”` : ' · popular'}
|
|
181
|
+
</span>
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
onClick={refresh}
|
|
185
|
+
disabled={refreshing}
|
|
186
|
+
title="Re-read the catalog"
|
|
187
|
+
className="flex items-center gap-1 p-1 rounded-md text-ink/50 hover:text-ink hover:bg-ink/5 disabled:opacity-50 transition-colors cursor-pointer"
|
|
188
|
+
>
|
|
189
|
+
<RefreshCw size={13} className={refreshing ? 'animate-spin' : ''} />
|
|
190
|
+
<span className="text-[11px]">Refresh</span>
|
|
191
|
+
</button>
|
|
192
|
+
</div>
|
|
243
193
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}`}
|
|
252
|
-
>
|
|
253
|
-
{isInstalled ? (
|
|
254
|
-
<>
|
|
255
|
-
<Check size={12} />
|
|
256
|
-
<span>Installed</span>
|
|
257
|
-
</>
|
|
258
|
-
) : (
|
|
259
|
-
<>
|
|
260
|
-
<Download size={12} />
|
|
261
|
-
<span>install</span>
|
|
262
|
-
</>
|
|
263
|
-
)}
|
|
264
|
-
</button>
|
|
265
|
-
</div>
|
|
194
|
+
<div className="space-y-3">
|
|
195
|
+
{catalog.catalogSkills.length === 0 ? (
|
|
196
|
+
<div className="text-center py-10 border border-dashed border-ink/15 rounded-xl space-y-1">
|
|
197
|
+
<p className="text-xs text-ink/60">No skills found.</p>
|
|
198
|
+
<p className="text-[11px] text-ink/45">
|
|
199
|
+
Try another query, or install straight from a repository in <span className="font-semibold">From Git</span>.
|
|
200
|
+
</p>
|
|
266
201
|
</div>
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
202
|
+
) : (
|
|
203
|
+
catalog.catalogSkills.map((skill) => (
|
|
204
|
+
<SkillCard
|
|
205
|
+
key={skill.id}
|
|
206
|
+
skill={skill}
|
|
207
|
+
installed={installed.has(skill.name)}
|
|
208
|
+
busy={busySkill === skill.id}
|
|
209
|
+
onInstallToggle={handleInstallToggle}
|
|
210
|
+
/>
|
|
211
|
+
))
|
|
212
|
+
)}
|
|
213
|
+
</div>
|
|
214
|
+
</>
|
|
215
|
+
) : null}
|
|
216
|
+
|
|
217
|
+
{tab === 'git' ? (
|
|
218
|
+
<GitImportPanel
|
|
219
|
+
controller={git}
|
|
220
|
+
onInstalled={() => {
|
|
221
|
+
catalog.reload().catch(console.error);
|
|
222
|
+
invalidateComposerCache('command');
|
|
223
|
+
showToast('Skills installed — omp sessions were reloaded');
|
|
224
|
+
}}
|
|
225
|
+
/>
|
|
226
|
+
) : null}
|
|
227
|
+
|
|
228
|
+
{tab === 'sources' ? (
|
|
229
|
+
<SourceRail
|
|
230
|
+
sources={catalog.sources}
|
|
231
|
+
onScan={scanSource}
|
|
232
|
+
onImportFrom={importFrom}
|
|
233
|
+
onRemove={removeSource}
|
|
234
|
+
onAdd={addSource}
|
|
235
|
+
scanningId={scanningSource}
|
|
236
|
+
busy={sourceBusy || scanningSource !== null}
|
|
237
|
+
/>
|
|
238
|
+
) : null}
|
|
271
239
|
</div>
|
|
272
240
|
|
|
273
|
-
{
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
onAddSource={handleAddSource}
|
|
278
|
-
/>
|
|
279
|
-
|
|
280
|
-
{/* Floating Toast */}
|
|
281
|
-
{toastMessage && (
|
|
282
|
-
<div className="fixed bottom-6 right-6 z-50 bg-ink text-paper text-xs font-medium px-4 py-2.5 rounded-lg shadow-lg animate-in fade-in slide-in-from-bottom-2 duration-150 flex items-center gap-2">
|
|
283
|
-
<Check size={14} />
|
|
284
|
-
<span>{toastMessage}</span>
|
|
241
|
+
{toast ? (
|
|
242
|
+
<div className="fixed bottom-6 right-6 z-50 bg-ink text-paper text-xs font-medium px-4 py-2.5 rounded-lg shadow-lg flex items-center gap-2 max-w-[calc(100vw-3rem)]">
|
|
243
|
+
<Check size={14} className="flex-shrink-0" />
|
|
244
|
+
<span className="leading-relaxed">{toast}</span>
|
|
285
245
|
</div>
|
|
286
|
-
)}
|
|
246
|
+
) : null}
|
|
287
247
|
</div>
|
|
288
248
|
);
|
|
289
249
|
}
|
|
@@ -11,7 +11,8 @@ import { GLOBAL_SCOPE_ID, useWorkspaceRoots } from '@/client/hooks/settings/work
|
|
|
11
11
|
interface SkillSettingsProps {
|
|
12
12
|
settings?: SettingsState;
|
|
13
13
|
onUpdate?: (updater: Partial<SettingsState> | ((prev: SettingsState) => SettingsState)) => void;
|
|
14
|
-
|
|
14
|
+
/** Opens the catalog, on the tab the click came from. */
|
|
15
|
+
onNavigateToCatalog?: (tab?: 'browse' | 'git' | 'sources') => void;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -79,7 +80,7 @@ export function SkillSettings({ onNavigateToCatalog }: SkillSettingsProps) {
|
|
|
79
80
|
headers: { 'Content-Type': 'application/json' },
|
|
80
81
|
body: JSON.stringify({ type: 'reload', ...roots.scopeBodyFor(selectedRootId) }),
|
|
81
82
|
})
|
|
82
|
-
.catch((error) => console.error('Failed to reload
|
|
83
|
+
.catch((error) => console.error('Failed to reload skills:', error))
|
|
83
84
|
.finally(() => setIsReloading(false));
|
|
84
85
|
};
|
|
85
86
|
|
|
@@ -106,6 +107,8 @@ export function SkillSettings({ onNavigateToCatalog }: SkillSettingsProps) {
|
|
|
106
107
|
startCreate();
|
|
107
108
|
masterDetail.openDetail();
|
|
108
109
|
}}
|
|
110
|
+
onImportFromGit={() => onNavigateToCatalog?.('git')}
|
|
111
|
+
onOpenCatalog={() => onNavigateToCatalog?.('browse')}
|
|
109
112
|
selectedProject={selectedRootId}
|
|
110
113
|
onSelectProject={setSelectedRootId}
|
|
111
114
|
projectOptions={roots.options}
|
|
@@ -117,7 +120,7 @@ export function SkillSettings({ onNavigateToCatalog }: SkillSettingsProps) {
|
|
|
117
120
|
isCreatingNew={isCreatingNew}
|
|
118
121
|
onSave={save}
|
|
119
122
|
onDelete={remove}
|
|
120
|
-
onOpenCatalog={onNavigateToCatalog}
|
|
123
|
+
onOpenCatalog={() => onNavigateToCatalog?.('browse')}
|
|
121
124
|
onReload={reload}
|
|
122
125
|
isReloading={isReloading}
|
|
123
126
|
projectScopeDisabled={!isWorkspaceScope}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FunctionComponent } from 'preact/compat';
|
|
2
2
|
import { Bot } from 'lucide-preact';
|
|
3
3
|
import type { AgentItem } from '@/shared/types';
|
|
4
|
+
import type { ProjectOption } from '@/client/components/settings/ProjectSelectorDropdown';
|
|
4
5
|
import { SettingsSidebarList } from '@/client/components/settings/SettingsSidebarList';
|
|
5
6
|
|
|
6
7
|
interface AgentSidebarListProps {
|
|
@@ -10,6 +11,8 @@ interface AgentSidebarListProps {
|
|
|
10
11
|
onAddNewAgent: () => void;
|
|
11
12
|
selectedProject: string;
|
|
12
13
|
onChangeProject: (project: string) => void;
|
|
14
|
+
/** Real workspace folders; defaults to the shared placeholder list. */
|
|
15
|
+
projectOptions?: ProjectOption[];
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
export const AgentSidebarList: FunctionComponent<AgentSidebarListProps> = ({
|
|
@@ -19,6 +22,7 @@ export const AgentSidebarList: FunctionComponent<AgentSidebarListProps> = ({
|
|
|
19
22
|
onAddNewAgent,
|
|
20
23
|
selectedProject,
|
|
21
24
|
onChangeProject,
|
|
25
|
+
projectOptions,
|
|
22
26
|
}) => (
|
|
23
27
|
<SettingsSidebarList
|
|
24
28
|
items={agents}
|
|
@@ -32,6 +36,7 @@ export const AgentSidebarList: FunctionComponent<AgentSidebarListProps> = ({
|
|
|
32
36
|
nameClassName="font-semibold text-xs text-ink truncate"
|
|
33
37
|
selectedProject={selectedProject}
|
|
34
38
|
onChangeProject={onChangeProject}
|
|
39
|
+
{...(projectOptions ? { projectOptions } : {})}
|
|
35
40
|
renderIcon={(isBuiltIn) => (
|
|
36
41
|
<div className="relative">
|
|
37
42
|
<Bot className={`w-3.5 h-3.5 ${isBuiltIn ? 'text-ink/80' : 'text-ink/60'} flex-shrink-0`} />
|