Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
Align skill detail page chrome with agent detail (source tag, inline name edit, summary hide, Done validation)
wyt15a74cb21864
diff --git a/src/main/features/skills.ts b/src/main/features/skills.tsindex 6d9ecdcd..00e39ad7 100644--- a/src/main/features/skills.ts+++ b/src/main/features/skills.ts@@ -543,6 +543,7 @@ export async function createCustomSkill(name: string, description: string): Promexport async function updateCustomSkill(skillId: string,updates: { name?: string; description?: string; description_zh?: string; description_en?: string },+ options: { skipRename?: boolean } = {},): Promise<CustomSkill | null> {let d = customSkillDir(skillId);if (!fs.existsSync(d) || !fs.statSync(d).isDirectory()) return null;@@ -570,7 +571,14 @@ export async function updateCustomSkill(}let currentId = skillId;- if (newName !== skillId) {+ // `skipRename` is the in-progress-edit hook used by the skill detail name+ // editor: while the user is typing, write the new `name:` into SKILL.md+ // frontmatter but DO NOT rename the directory yet. The Done click fires a+ // second update with `skipRename: false` to commit the rename. Same write+ // path takes care of both passes — no separate IPC. Auto-heal on next+ // listSkills (`_renameSkillByFrontmatterIfNeeded`) is the safety net for+ // the edge case where the user crashes mid-edit before clicking Done.+ if (newName !== skillId && !options.skipRename) {const err = validateSkillName(newName);if (err) throw new Error(err);const target = customSkillDir(newName);diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.tsindex fa92c88d..6dd380e5 100644--- a/src/main/ipc/index.ts+++ b/src/main/ipc/index.ts@@ -303,9 +303,9 @@ const invokeHandlers: Record<string, InvokeHandler> = {return { skill: r.skill, seedMessage: r.seedMessage };},- 'skills.update': async ({ id, updates }) => {+ 'skills.update': async ({ id, updates, skipRename }) => {if (!skills.isValidSkillId(id)) throw new Error('invalid skill id');- const data = await skills.updateCustomSkill(id, updates || {});+ const data = await skills.updateCustomSkill(id, updates || {}, { skipRename: !!skipRename });if (!data) throw new Error('skill not found');return { skill: data };},diff --git a/src/renderer/locales/en.json b/src/renderer/locales/en.jsonindex 4d6c8311..0d4d9ee3 100644--- a/src/renderer/locales/en.json+++ b/src/renderer/locales/en.json@@ -183,8 +183,9 @@"skills.chat_input_placeholder": "Describe what to change...","skills.use_prefix": "Use {skill} skill: {content}","skills.rename_title": "Click to rename",- "skills.source_custom": "Custom skill",- "skills.source_builtin": "Built-in skill",+ "skills.source_custom": "Custom",+ "skills.source_builtin": "Built-in",+ "skills.name_invalid": "Name must start with a letter; allowed: letters, digits, underscore, hyphen, single internal spaces","skills.desc_unset": "(no description)","skills.loading": "Loading...","skills.load_failed": "Load failed",diff --git a/src/renderer/locales/zh.json b/src/renderer/locales/zh.jsonindex de0b1738..c1a2d821 100644--- a/src/renderer/locales/zh.json+++ b/src/renderer/locales/zh.json@@ -183,8 +183,9 @@"skills.chat_input_placeholder": "描述需要修改的内容...","skills.use_prefix": "使用 {skill} skill:{content}","skills.rename_title": "点击重命名",- "skills.source_custom": "自定义技能",- "skills.source_builtin": "内置技能",+ "skills.source_custom": "自定义",+ "skills.source_builtin": "内置",+ "skills.name_invalid": "名称需以字母开头,可含字母 / 数字 / 下划线 / 横线,词之间允许单个空格","skills.desc_unset": "(未设置描述)","skills.loading": "加载中...","skills.load_failed": "加载失败",diff --git a/src/renderer/modules/skills.js b/src/renderer/modules/skills.jsindex 62fe0a16..11f30ff5 100644--- a/src/renderer/modules/skills.js+++ b/src/renderer/modules/skills.js@@ -526,22 +526,16 @@ async function selectSkillFile(source, id, filepath, nodeEl) {nameEl.textContent = skill?.name || id;nameEl.dataset.skillId = id;nameEl.dataset.source = source;- // Click-to-rename stays custom-only — built-in renames in dev would need- // a dual-tree dir rename + per-user chat dir migration; out of scope for- // dev edit. (LLM-driven SKILL.md edits to the `name:` field are also- // ignored for built-ins; see features/skills.ts auto-rename guard.)- if (source === 'custom') {- nameEl.classList.add('editable');- nameEl.setAttribute('title', t('skills.rename_title'));- } else {- nameEl.classList.remove('editable');- nameEl.removeAttribute('title');- }+ // Name is editable ONLY in edit mode (req: "non-edit state must not allow rename").+ // Editability is wired below alongside the description-section toggle —+ // both depend on `editingThis` which is computed a few lines down.+ nameEl.classList.remove('editable');+ nameEl.removeAttribute('title');- // Source label: just the source kind. File path is already conveyed by- // the active highlight inside the source tree below.- const sourceLabel = source === 'custom' ? t('skills.source_custom') : t('skills.source_builtin');- document.getElementById('skills-detail-source').textContent = sourceLabel;+ // Source label + colored tag — mirrors `.agents-detail-source.is-builtin/.is-custom`.+ const sourceEl = document.getElementById('skills-detail-source');+ sourceEl.textContent = source === 'custom' ? t('skills.source_custom') : t('skills.source_builtin');+ sourceEl.className = 'skills-doc-source ' + (source === 'builtin' ? 'is-builtin' : 'is-custom');// Doc sections (description / external dependencies / dependent// skills / other attributes) — seed with the cached description so@@ -555,8 +549,9 @@ async function selectSkillFile(source, id, filepath, nodeEl) {// (custom + dev) / delete.// In edit mode only the "done" button (the relabeled "edit") is// shown; everything else hides.- const actions = document.getElementById('skills-detail-actions');const canEditThisSkill = source === 'custom' || (source === 'builtin' && isDevMode());+ const editingThis = _skillEditMode && _skillEditSkillId === id && canEditThisSkill;+ const actions = document.getElementById('skills-detail-actions');if (actions) {actions.classList.remove('is-hidden');const useBtn = document.getElementById('skill-use-btn');@@ -564,7 +559,6 @@ async function selectSkillFile(source, id, filepath, nodeEl) {const enableBtn = document.getElementById('skill-enabled-btn');const promoteBtn = document.getElementById('skill-promote-btn');const delBtn = document.getElementById('skill-delete-btn');- const editingThis = _skillEditMode && _skillEditSkillId === id && canEditThisSkill;if (useBtn) useBtn.style.display = editingThis ? 'none' : '';if (editBtn) editBtn.style.display = canEditThisSkill ? '' : 'none';if (enableBtn) enableBtn.style.display = editingThis ? 'none' : '';@@ -572,6 +566,17 @@ async function selectSkillFile(source, id, filepath, nodeEl) {if (delBtn) delBtn.style.display = (canEditThisSkill && !editingThis) ? '' : 'none';}+ // Wire name editability (edit mode + custom only) and hide the+ // description section while editing (req #3: edit description by editing+ // the `description_*:` frontmatter in SKILL.md, not via a separate UI+ // block). Built-in skills' name is **never** directly editable here even+ // under dev mode — direct rename would skip the dual-tree dir rename ++ // per-user chat dir migration that LLM-driven SKILL.md edits go through.+ const nameEditable = editingThis && source === 'custom';+ _toggleSkillNameEditable(nameEl, nameEditable);+ const summarySection = document.getElementById('skills-section-summary');+ if (summarySection) summarySection.style.display = editingThis ? 'none' : '';+// Refresh the per-skill enable/disable button label + click handler._renderSkillEnabledButton({ id, enabled: skill?.enabled !== false });@@ -844,38 +849,120 @@ function _renderSkillFileEditor(body, content, _ext) {ta.addEventListener('input', scheduleSave);}-// Click the skill name in detail header to rename (custom skills only).-async function _handleSkillNameClick(e) {- const el = e.currentTarget;- if (!el.classList.contains('editable')) return;+// ─── Skill name inline edit (mirrors agents.js's name editor) ───+//+// Replaces the older click-to-prompt rename path. The name field is now+// only editable inside Skill detail's edit mode (req: non-edit state must+// not allow rename). Wire-up:+// - Enter edit → contenteditable + bind input/blur (one-time per element)+// - Type → debounce 800ms → save SKILL.md frontmatter `name:`+// via `skipRename:true` (no dir rename mid-typing)+// - Blur → flush pending save+// - Done click → flush + validate; if invalid alert + revert DOM;+// if valid AND name actually changed, fire one final+// `skipRename:false` to commit the directory rename.++const SKILL_NAME_RE = /^[A-Za-z][A-Za-z0-9_-]*(?: [A-Za-z0-9_-]+)*$/;+function _isValidSkillNameCharset(name) {+ return typeof name === 'string' && name.length > 0 && name.length <= 64 && SKILL_NAME_RE.test(name);+}- const currentId = el.dataset.skillId;- const currentName = el.textContent.trim();- const input = await uiPrompt(t('skills.rename_prompt'), currentName);- if (input === null) return;- const newName = input.trim();- if (!newName || newName === currentName) return;+function _toggleSkillNameEditable(nameEl, on) {+ if (!nameEl) return;+ nameEl.setAttribute('contenteditable', on ? 'plaintext-only' : 'false');+ nameEl.classList.toggle('is-editing', !!on);+ if (on) _bindSkillNameSave(nameEl);+}++function _bindSkillNameSave(nameEl) {+ if (nameEl.dataset.bound === '1') return;+ nameEl.dataset.bound = '1';+ nameEl.addEventListener('input', () => _scheduleSkillFieldSave('name', nameEl.innerText));+ nameEl.addEventListener('blur', () => _flushSkillFieldSave());+}++let _pendingSkillField = null;+let _skillFieldSaveTimer = null;+function _scheduleSkillFieldSave(field, value) {+ if (!_selectedSkill || _selectedSkill.source !== 'custom') return;+ _pendingSkillField = { field, value };+ clearTimeout(_skillFieldSaveTimer);+ _skillFieldSaveTimer = setTimeout(_flushSkillFieldSave, 800);+}+// `validate` is true ONLY when the user explicitly commits (clicks Done);+// typing-debounced and blur-triggered flushes pass false — bad names+// silently skip the save (DOM keeps the in-progress text) instead of+// popping a uiAlert mid-keystroke. Mirrors agents.js::_flushAgentFieldSave.+//+// During typing we use `skipRename:true` so the directory id stays as the+// original until Done; that keeps the URL / cache keyed by the same id and+// avoids a flurry of dir renames per keystroke. The Done branch fires a+// final `skipRename:false` update to commit the directory rename when the+// new name passed validation and actually differs from the original id.+async function _flushSkillFieldSave({ validate = false } = {}) {+ clearTimeout(_skillFieldSaveTimer);+ _skillFieldSaveTimer = null;+ if (!_pendingSkillField || !_selectedSkill) return;+ const { field, value } = _pendingSkillField;+ if (field === 'name') {+ const name = String(value || '').trim();+ const invalid = !_isValidSkillNameCharset(name);+ if (invalid) {+ if (!validate) return;+ _pendingSkillField = null;+ await uiAlert(t('skills.name_invalid'));+ const nameEl = document.getElementById('skills-detail-name');+ if (nameEl) nameEl.innerText = _selectedSkill.id;+ // Roll the SKILL.md frontmatter back to the original id too — the+ // skipRename:true writes during typing left a possibly-invalid name+ // on disk; revert so the next listSkills auto-heal doesn't misfire.+ try {+ await apiFetch(`/api/skills/${encodeURIComponent(_selectedSkill.id)}/update?skipRename=1`, {+ method: 'PUT',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({ name: _selectedSkill.id }),+ });+ } catch (_) { /* best-effort revert */ }+ return;+ }+ }+ _pendingSkillField = null;+ const currentId = _selectedSkill.id;+ const newName = String(value || '').trim();+ const skipRename = !validate || newName === currentId;+ // ipc-shim's `wrapAsUpdates` wraps the body under `updates`, so the+ // request body holds only field values; `skipRename` rides on the URL+ // query string so it lands as a sibling of `updates` in the IPC payload.+ const url = `/api/skills/${encodeURIComponent(currentId)}/update${skipRename ? '?skipRename=1' : ''}`;try {- const res = await apiFetch(`/api/skills/${encodeURIComponent(currentId)}/update`, {+ const res = await apiFetch(url, {method: 'PUT',headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({ name: newName }),+ body: JSON.stringify({ [field]: value }),});const data = await res.json();if (!data.ok) {- await uiAlert(t('skills.rename_failed', { reason: data.error || '' }));- return;+ throw new Error(data.error || 'save failed');+ }+ if (validate && field === 'name' && !skipRename) {+ // Directory was renamed — refresh caches + update _selectedSkill.id+ // so subsequent calls (selectSkillFile / chat dir lookup) hit the+ // new id, not the stale one.+ const resultId = data.skill?.id || newName;+ _skillsCache = null;+ _skillTreeCache.clear();+ _expandedDirs.delete(`custom:${currentId}`);+ await loadSkills();+ _selectedSkill = { ..._selectedSkill, id: resultId };+ _skillEditSkillId = resultId;}- const resultId = data.skill?.id || newName;- _skillsCache = null;- _skillTreeCache.clear();- _expandedDirs.delete(`custom:${currentId}`);- await loadSkills();- _selectedSkill = { source: 'custom', id: resultId, filepath: 'SKILL.md' };- await selectSkillFile('custom', resultId, 'SKILL.md', null);} catch (e) {- await uiAlert(t('skills.network_error', { reason: e.message || e }));+ if (validate && field === 'name') {+ await uiAlert(t('skills.rename_failed', { reason: e.message || e }));+ const nameEl = document.getElementById('skills-detail-name');+ if (nameEl) nameEl.innerText = _selectedSkill.id;+ }}}@@ -909,6 +996,13 @@ async function toggleSkillEditMode(opts = {}) {// the next skill's edit panel when the user clicks "edit"// elsewhere.try { _skillChatCtrl?.abort(); } catch (_) { /* ignore */ }+ // Done click is the explicit commit point: flush any pending name+ // edit + validate. Invalid name → alert + revert DOM (and roll the+ // SKILL.md frontmatter back to the original id, see the validate+ // branch in `_flushSkillFieldSave`). Valid + actually-changed name+ // → fires a `skipRename:false` update which commits the directory+ // rename + refreshes caches before we re-render readonly view.+ await _flushSkillFieldSave({ validate: true });_skillEditMode = false;_skillEditSkillId = null;document.getElementById('skills-chat-col').style.display = 'none';diff --git a/src/renderer/modules/state.js b/src/renderer/modules/state.jsindex 277aa5d9..e30de12e 100644--- a/src/renderer/modules/state.js+++ b/src/renderer/modules/state.js@@ -240,7 +240,9 @@ function bindStaticHandlers() {document.getElementById('skill-promote-btn')?.addEventListener('click', () => {if (_selectedSkill?.source === 'custom') promoteCustomSkill(_selectedSkill.id);});- document.getElementById('skills-detail-name')?.addEventListener('click', _handleSkillNameClick);+ // Skill name editing is now wired inline by `_toggleSkillNameEditable`+ // (input + blur listeners attached on first edit-mode entry, gated by+ // `_skillEditMode`) — no top-level click handler.document.getElementById('skill-chat-clear-btn')?.addEventListener('click', clearSkillChat);// Detail-view chrome: "← Back to skill library" + collapsible-sectiondiff --git a/src/renderer/style.css b/src/renderer/style.cssindex 1acb6797..fa8434cf 100644--- a/src/renderer/style.css+++ b/src/renderer/style.css@@ -727,6 +727,8 @@ body.model-not-configured .main-content { flex-direction: column; }color: var(--primary);}+/* Source tag in the skill detail header — matches `.agents-detail-source`+ palette so the two detail pages read as one chrome family. */.skills-doc-source {font-size: 11px;font-weight: 600;@@ -736,6 +738,19 @@ body.model-not-configured .main-content { flex-direction: column; }background: rgba(148, 163, 184, 0.15);color: #475569;}+.skills-doc-source.is-builtin { background: rgba(148, 163, 184, 0.15); color: #475569; }+.skills-doc-source.is-custom { background: rgba(37, 99, 235, 0.12); color: var(--primary); }+/* Editing-state chrome on the title — mirrors `.agents-detail-name.is-editing`+ so both detail pages read as one chrome family. */+.skills-doc-title.is-editing {+ outline: none;+ background: #fff;+ box-shadow: 0 0 0 1px var(--border-strong) inset;+ cursor: text;+}+.skills-doc-title.is-editing:focus {+ box-shadow: 0 0 0 2px var(--primary) inset;+}.skills-doc-actions {margin-left: auto;