Update skills UI components for managed skills (#165)

* ralph: ralph-repo-level-skills-dialog-skillseditor-fix completed after 4 iterations

* Remove parent session notification and child session tracking from Ralph loops

Sending promptAsync to parent sessions on loop completion could resume
work in previously inactive sessions. Removed parentSessionId from
RalphState, child session tracking maps, and all related event handling.
Watchdog stall detection still works via the session status API.

* Migrate global skills to workspace path

* Add skill injection to scheduled job prompts

* Refactor schedules UI with MultiSelect and tab menu

* Update skills UI components for managed skills
This commit is contained in:
Chris Scott authored and GitHub committed 2026-03-22 14:52:32 -04:00
1 parent 4bd0940ab9
commit c3cba72b51
22 files changed
+981 -337

No files matched your search

@@ -17,7 +17,7 @@ import { SkillsEditor } from './SkillsEditor'
import { VersionSelectDialog } from './VersionSelectDialog'
import { MemoryPluginConfig } from './MemoryPluginConfig'
import { settingsApi } from '@/api/settings'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { useServerHealth } from '@/hooks/useServerHealth'
import { parseJsonc, hasJsoncComments } from '@/lib/jsonc'
import { showToast } from '@/lib/toast'
@@ -77,6 +77,12 @@ export function OpenCodeConfigManager() {
const skillsRef = useRef<HTMLButtonElement>(null)
const mcpRef = useRef<HTMLButtonElement>(null)
const { data: managedSkills = [] } = useQuery({
queryKey: ['managed-skills'],
queryFn: () => settingsApi.listManagedSkills(),
staleTime: 5 * 60 * 1000,
})
const scrollToSection = (ref: React.RefObject<HTMLButtonElement | null>) => {
if (ref.current) {
ref.current.scrollIntoView({
@@ -563,7 +569,7 @@ export function OpenCodeConfigManager() {
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0 mb-6">
<button
ref={agentsMdRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.agentsMd ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.agentsMd
setExpandedSections(prev => ({ ...prev, agentsMd: isExpanding }))
@@ -620,7 +626,7 @@ export function OpenCodeConfigManager() {
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0">
<button
ref={commandsRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.commands ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.commands
setExpandedSections(prev => ({ ...prev, commands: isExpanding }))
@@ -657,7 +663,7 @@ export function OpenCodeConfigManager() {
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0">
<button
ref={agentsRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.agents ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.agents
setExpandedSections(prev => ({ ...prev, agents: isExpanding }))
@@ -694,7 +700,7 @@ export function OpenCodeConfigManager() {
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0">
<button
ref={skillsRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.skills ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.skills
setExpandedSections(prev => ({ ...prev, skills: isExpanding }))
@@ -706,33 +712,34 @@ export function OpenCodeConfigManager() {
<div className="flex items-center gap-3 min-w-0">
<h4 className="text-sm font-medium truncate">Skills</h4>
<span className="text-xs text-muted-foreground">
{(selectedConfig.content?.skills?.paths?.length ?? 0) + (selectedConfig.content?.skills?.urls?.length ?? 0)} configured
{managedSkills.length + (selectedConfig.content?.skills?.paths?.length ?? 0) + (selectedConfig.content?.skills?.urls?.length ?? 0)} configured
</span>
</div>
<ChevronDown className={`h-4 w-4 transition-transform ${expandedSections.skills ? 'rotate-90' : ''}`} />
</button>
<div className={`${expandedSections.skills ? 'block' : 'hidden'} border-t border-border`}>
<div className="p-4 max-h-[50vh] overflow-y-auto">
<SkillsEditor
skills={selectedConfig.content?.skills}
onChange={(skills) => {
const paths = skills?.paths?.filter(Boolean)
const urls = skills?.urls?.filter(Boolean)
const updatedContent = {
...selectedConfig.content,
skills: (paths?.length || urls?.length) ? { paths: paths?.length ? paths : undefined, urls: urls?.length ? urls : undefined } : undefined
}
updateConfigContent(selectedConfig.name, updatedContent)
}}
/>
<div className={`${expandedSections.skills ? 'block' : 'hidden'} border-t border-border`}>
<div className="p-4 max-h-[50vh] overflow-y-auto">
<SkillsEditor
skills={selectedConfig.content?.skills}
managedSkills={managedSkills}
onChange={(skills) => {
const paths = skills?.paths?.filter(Boolean)
const urls = skills?.urls?.filter(Boolean)
const updatedContent = {
...selectedConfig.content,
skills: (paths?.length || urls?.length) ? { paths: paths?.length ? paths : undefined, urls: urls?.length ? urls : undefined } : undefined
}
updateConfigContent(selectedConfig.name, updatedContent)
}}
/>
</div>
</div>
</div>
</div>
<div className="bg-card border border-border rounded-lg overflow-hidden min-w-0">
<button
ref={mcpRef}
className="w-full px-4 py-3 flex items-center justify-between hover:bg-muted/50 transition-colors min-w-0"
className={cn("w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0", expandedSections.mcp ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50")}
onClick={() => {
const isExpanding = !expandedSections.mcp
setExpandedSections(prev => ({ ...prev, mcp: isExpanding }))
@@ -115,7 +115,7 @@ export function SkillDialog({ open, onOpenChange, onSubmit, editingSkill }: Skil
return (
<Dialog open={open} onOpenChange={handleOpenChange}>
<DialogContent mobileFullscreen className="sm:max-w-2xl sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6">
<DialogContent mobileFullscreen className="sm:max-w-2xl sm:max-h-[85vh] gap-0 flex flex-col p-0 md:p-6 pb-safe">
<DialogHeader className="p-4 sm:p-6 border-b flex flex-row items-center justify-between space-y-0">
<DialogTitle>{editingSkill ? 'Edit Skill' : 'Create Skill'}</DialogTitle>
</DialogHeader>
@@ -270,7 +270,7 @@ export function SkillDialog({ open, onOpenChange, onSubmit, editingSkill }: Skil
</Form>
</div>
<DialogFooter className="p-3 sm:p-4 border-t gap-2 pb-4">
<DialogFooter className="flex flex-row gap-2 pt-2 border-t border-border sm:justify-end pb-4 p-3">
<Button variant="outline" onClick={() => handleOpenChange(false)} className="flex-1 sm:flex-none">
Cancel
</Button>
@@ -1,6 +1,6 @@
import { useState, useEffect } from 'react'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { Plus, Trash2, Loader2, Pencil, ChevronDown, ChevronRight, Save, X } from 'lucide-react'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { Plus, Trash2, Pencil, ChevronDown, ChevronRight, Save, X } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { Input } from '@/components/ui/input'
@@ -14,6 +14,7 @@ import { toast } from 'sonner'
interface SkillsEditorProps {
skills?: OpenCodeConfigInput['skills']
managedSkills?: SkillFileInfo[]
onChange?: (skills: OpenCodeConfigInput['skills']) => void
}
@@ -77,7 +78,7 @@ function SkillPathEditor({ items, onChange, onAddItem, onRemoveItem, label, plac
)
}
export function SkillsEditor({ skills, onChange }: SkillsEditorProps) {
export function SkillsEditor({ skills, managedSkills = [], onChange }: SkillsEditorProps) {
const [dialogOpen, setDialogOpen] = useState(false)
const [editingSkill, setEditingSkill] = useState<SkillFileInfo | null>(null)
const [collapsiblesOpen, setCollapsiblesOpen] = useState({
@@ -98,12 +99,6 @@ export function SkillsEditor({ skills, onChange }: SkillsEditorProps) {
const queryClient = useQueryClient()
const { data: managedSkills = [], isLoading: isLoadingManaged } = useQuery({
queryKey: ['managed-skills'],
queryFn: () => settingsApi.listManagedSkills(),
staleTime: 5 * 60 * 1000,
})
const createMutation = useMutation({
mutationFn: (data: CreateSkillRequest) => settingsApi.createSkill(data),
onSuccess: () => {
@@ -238,11 +233,7 @@ export function SkillsEditor({ skills, onChange }: SkillsEditorProps) {
{collapsiblesOpen.managed && (
<>
{isLoadingManaged ? (
<div className="flex items-center justify-center py-8">
<Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
</div>
) : managedSkills.length === 0 ? (
{managedSkills.length === 0 ? (
<Card>
<CardContent className="p-6">
<div className="flex items-center gap-2 mb-2">