position ui and owliver update

This commit is contained in:
2026-08-14 01:18:59 +05:30
parent 1c653264b5
commit cccada9bd2
29 changed files with 3718 additions and 1313 deletions

View File

@@ -2,7 +2,8 @@ import React from 'react';
import { Sparkles, Upload } from 'lucide-react';
import { Button, Field, Input, Modal, Textarea, toast } from '@/components/ds';
import { usePreferences, useUpdatePreferences } from '@/lib/krowHooks';
import { PAGE_KEYS, parseSkill, validateSkillSource } from '@/lib/skills/registry';
import { PAGE_KEYS, validateSkillSource } from '@/lib/skills/registry';
import { skillTemplate, upsertCustomSkill } from '@/lib/skills/customSkills';
/**
* Add an Owliver skill.
@@ -20,29 +21,6 @@ import { PAGE_KEYS, parseSkill, validateSkillSource } from '@/lib/skills/registr
* then edit directly. The Markdown is always what gets saved.
*/
const TEMPLATE = ({ id, name, description, pages }) => `---
id: ${id || 'my-skill'}
name: ${name || 'My Skill'}
description: ${description || 'What this skill helps Owliver do.'}
pages:
${(pages || ['positions']).map((p) => ` - ${p}`).join('\n')}
status: active
triggers:
- ${(name || 'my skill').toLowerCase()}
---
# ${name || 'My Skill'}
## Purpose
Describe what Owliver should help with on these pages.
## Capabilities
- Describe one thing the skill can do.
- Add more as needed.
`;
export function AddSkillDialog({ open, onOpenChange }) {
const preferences = usePreferences();
const updatePreferences = useUpdatePreferences();
@@ -68,7 +46,7 @@ export function AddSkillDialog({ open, onOpenChange }) {
const syncFromMeta = (next) => {
setMeta(next);
if (touched) return;
setSource(TEMPLATE({
setSource(skillTemplate({
id: next.id,
name: next.name,
description: next.description,
@@ -96,12 +74,7 @@ export function AddSkillDialog({ open, onOpenChange }) {
return;
}
const skill = parseSkill(source, { custom: true });
const existing = preferences.customSkills || [];
const next = [
...existing.filter((entry) => parseSkill(entry.raw, { custom: true }).id !== skill.id),
{ path: `custom/${skill.id}.md`, raw: source },
];
const { skill, next } = upsertCustomSkill(preferences.customSkills || [], source);
updatePreferences.mutate({ customSkills: next });
toast.success(`${skill.name} added`);