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
A batch of UX / rule fixes: KB name length cap, default archive name budget, agent name follows UI language, produced chip icons, IME guard
claw2546c06dd21d7
diff --git a/CLAUDE.md b/CLAUDE.mdindex 5d376235..cf21c937 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -248,6 +248,7 @@ Vanilla HTML/CSS/JS, classic `<script>` multi-file (no ESM, no build). Cross-fil- `src/renderer/` **does not participate in typecheck** (vanilla + DOM gives too many checkJs false positives); main/ stays at `checkJs: true`.- Process-info-row icons use only Unicode Geometric Shapes (`▶ ● ◆ ◇ ■ ▣ ▷ ◐ ◉ ○ ◯ ▪`); **no colored emoji**.- The UI shares one set of classes (`.btn / .btn-sm / .btn-primary / .btn-danger / .detail-actions / .empty / .muted`); differences are expressed via `.is-*` modifiers; **don't open near-duplicate classes**.+- **IME composition guard on Enter / Arrow shortcuts**: every keydown handler on an `<input>` / `<textarea>` that triggers an action (Enter→submit / search-jump / form-confirm; Arrow→list selection) **must early-return when `e.isComposing || e.keyCode === 229`**. **Why:** Chinese / Japanese / Korean IMEs use Enter to commit a composition candidate; without this guard, "Enter to confirm an English candidate when the primary suggestion is already English" silently fires the action and the user navigates away mid-typing. We've already hit this on the global search overlay; the chat input (`modules/conversation.js`) and the new-chat input (`modules/state.js`) had it from the start, the search input was missing it. Pattern to copy: `if (e.isComposing || e.keyCode === 229) return;` at the top of the handler. The `keyCode === 229` arm covers older Electron / Safari builds where `isComposing` is occasionally inaccurate.### i18n (zh / en)diff --git a/src/main/features/contexts.ts b/src/main/features/contexts.tsindex 4c24412c..2f3cb7f6 100644--- a/src/main/features/contexts.ts+++ b/src/main/features/contexts.ts@@ -64,6 +64,32 @@ const BINARY_EXTS: ReadonlySet<string> = new Set([const ALLOWED_EXTS: ReadonlySet<string> = new Set([...TEXT_EXTS, ...BINARY_EXTS]);const MAX_FILE_BYTES = 200 * 1024 * 1024; // 200MB — defensive cap per plan §3.3+/** Max basename / dirname length in **weighted code points**: CJK / Hangul /+ * Kana count as 2, everything else (ASCII, Latin-extended, Cyrillic, emoji…)+ * counts as 1. The split prevents a single uniform cap from either+ * squashing English to a few words OR letting Chinese filenames balloon+ * past readable. Budget 100:+ * - pure Chinese: ~50 chars (a long sentence)+ * - pure English: ~100 chars (descriptive long filename)+ * - mixed: weights add up+ * Real FS basename limits (HFS+ / NTFS = 255 UTF-16 units) are far higher;+ * this is a UX bound, not a FS bound. Applied to every path segment in+ * `resolvePath`, so it covers writes / uploads / mkdir / rename through+ * one chokepoint. */+const MAX_BASENAME_WEIGHT = 100;++/** Char-class regex for the "double-width" group: CJK Unified Ideographs+ * (incl. extension A), Hangul, Hiragana, Katakana. Tested per code point. */+const DOUBLE_WIDTH_CHAR = /[㐀-鿿가--ゟ゠-ヿ]/;++function _filenameWeight(s: string): number {+ let w = 0;+ for (const ch of s) {+ w += DOUBLE_WIDTH_CHAR.test(ch) ? 2 : 1;+ }+ return w;+}+export type Result<T = Record<string, unknown>> = ({ ok: true } & T) | { ok: false; error: string };export interface ContextNode {@@ -106,6 +132,14 @@ function resolvePath(relpath: string, { mustExist = false }: ResolveOpts = {}):// Reject any segment starting with '.' — keeps `.kb/` (vector db) and other// hidden dirs off-limits to user mutations.if (parts.some((p) => p.startsWith('.'))) throw new Error('hidden entries are reserved');+ // Length cap (per-segment, weighted — see MAX_BASENAME_WEIGHT).+ // The first offending segment is surfaced verbatim so the user knows which+ // part of the path is too long (file basename vs. some parent dir).+ for (const p of parts) {+ if (_filenameWeight(p) > MAX_BASENAME_WEIGHT) {+ throw new Error(t('errors.kb_name_too_long', { name: p }));+ }+ }const root = path.resolve(contextsRoot());const target = path.resolve(root, s);const rel = path.relative(root, target);diff --git a/src/main/locales/en.json b/src/main/locales/en.jsonindex 0f40e65c..83119020 100644--- a/src/main/locales/en.json+++ b/src/main/locales/en.json@@ -7,6 +7,7 @@"errors.cant_delete_index": "Cannot delete the system index","errors.file_already_exists": "A file with this name already exists","errors.kb_duplicate_sha1": "A file with identical content already exists in the knowledge base: {existingPath}",+ "errors.kb_name_too_long": "Filename too long: \"{name}\". Keep it within ~100 ASCII chars or ~50 CJK chars.","errors.builtin_agent_not_editable": "Built-in agents cannot be edited through chat","errors.agent_disabled": "The agent bound to this conversation is disabled — re-enable it or switch conversation.","errors.no_files_to_organize": "No files to organize",diff --git a/src/main/locales/zh.json b/src/main/locales/zh.jsonindex 7115a508..30a1e6a3 100644--- a/src/main/locales/zh.json+++ b/src/main/locales/zh.json@@ -7,6 +7,7 @@"errors.cant_delete_index": "不能删除系统索引","errors.file_already_exists": "同名文件已存在","errors.kb_duplicate_sha1": "相同内容的文件已存在于知识库:{existingPath}",+ "errors.kb_name_too_long": "文件名太长:「{name}」。请缩短到中文 50 字 / 英文 100 字符以内。","errors.builtin_agent_not_editable": "内置智能体不可通过对话编辑","errors.agent_disabled": "本对话绑定的智能体已被禁用,请重新启用或换一个对话","errors.no_files_to_organize": "无可整理的文件",diff --git a/src/main/prompts/chat_commander.md b/src/main/prompts/chat_commander.mdindex 4cc34ffe..d31315bf 100644--- a/src/main/prompts/chat_commander.md+++ b/src/main/prompts/chat_commander.md@@ -258,6 +258,7 @@ skill_id_b```- Missing `<name>` / `<workflow>` causes the server to treat it as a failure; all other sub-tags are recommended.+- **`<name>` must be written in the user's current UI language** — short, descriptive, no quotes. Chinese UI → Chinese name (e.g. `需求挖掘者`); English UI → English name (e.g. `requirements-miner`). The name is rendered as `@<name>` chips in the conversation and shown in dropdowns / lists, so a name in the wrong language looks alien to the user. The system prompt's trailing language directive carries the active UI language; pick accordingly. **Don't** auto-romanize Chinese into pinyin or auto-translate Chinese to English — match the user's actual locale.- **Both `<description_zh>` and `<description_en>` must be provided** — the commander injects the description in the user's current UI language when dispatching; providing only one means users in the other UI language see an empty description in their list (likely missed in selection). Write the two independently in the three-part form, **don't direct-translate**; each one should appeal to the real phrasings of users in that language. **Do not** use a single `<description>` tag.- `<skills>`: one `skill_id` per line, listing only those that the workflow actually invokes + hard dependencies; the closure is expanded server-side. The `skill_id` must come from the "Available skills (skills)" section; built-in tool names (`read_file` / `bash` / etc.) are NOT `skill_id`s.- `<inputs>` is a JSON array; if no parameters, `[]`; on parse failure the server drops `inputs` but other fields still take effect.diff --git a/src/renderer/locales/en.json b/src/renderer/locales/en.jsonindex b803dec2..d5450544 100644--- a/src/renderer/locales/en.json+++ b/src/renderer/locales/en.json@@ -293,6 +293,7 @@"kb_picker.name_hint": "Missing extension will be auto-filled as .md","kb_picker.name_needed": "Filename is required","kb_picker.name_bad_chars": "Filename cannot contain / \\ or ..",+ "kb_picker.name_too_long": "Filename too long: \"{name}\". Keep it within ~100 ASCII chars or ~50 CJK chars.","kb_picker.folder": "Choose folder","kb_picker.target": "Saving to: {rel}","chat.archive_picker_title": "Archive message to knowledge base",diff --git a/src/renderer/locales/zh.json b/src/renderer/locales/zh.jsonindex 4dbb4edf..f9e52f1d 100644--- a/src/renderer/locales/zh.json+++ b/src/renderer/locales/zh.json@@ -293,6 +293,7 @@"kb_picker.name_hint": "不含扩展名将自动补 .md","kb_picker.name_needed": "请填写文件名","kb_picker.name_bad_chars": "文件名不能包含 / \\ 或 ..",+ "kb_picker.name_too_long": "文件名太长:「{name}」。请缩短到中文 50 字 / 英文 100 字符以内。","kb_picker.folder": "选择目录","kb_picker.target": "保存到:{rel}","chat.archive_picker_title": "存档对话到知识库",diff --git a/src/renderer/modules/conversation.js b/src/renderer/modules/conversation.jsindex e042cd10..d25ebe83 100644--- a/src/renderer/modules/conversation.js+++ b/src/renderer/modules/conversation.js@@ -884,10 +884,25 @@ function _iconForProduced(name) {const ext = (name.split('.').pop() || '').toLowerCase();if (ext === 'pdf') return '📄';if (ext === 'docx' || ext === 'doc') return '📝';- if (['png', 'jpg', 'jpeg', 'webp', 'gif'].includes(ext)) return '🖼';- if (['md', 'markdown', 'txt', 'log'].includes(ext)) return '📃';- if (['json', 'yaml', 'yml', 'csv', 'tsv'].includes(ext)) return '📊';- return '📁';+ if (['png', 'jpg', 'jpeg', 'webp', 'gif', 'svg', 'bmp', 'ico'].includes(ext)) return '🖼';+ if (['mp4', 'webm', 'mov', 'm4v', 'ogv', 'avi', 'mkv'].includes(ext)) return '🎬';+ if (['mp3', 'wav', 'ogg', 'flac', 'm4a', 'aac'].includes(ext)) return '🎵';+ if (['md', 'markdown', 'txt', 'log', 'rst', 'tex'].includes(ext)) return '📃';+ if (['json', 'yaml', 'yml', 'toml', 'csv', 'tsv', 'xlsx', 'xls', 'xml', 'ini', 'conf'].includes(ext)) return '📊';+ if (['zip', 'tar', 'gz', 'tgz', 'bz2', 'xz', '7z', 'rar'].includes(ext)) return '📦';+ // Source code / scripts — covers .py / .ts / web / shell / mainstream langs.+ // Anything else falls through to the generic "file" icon below.+ if ([+ 'py', 'pyi', 'ipynb',+ 'ts', 'tsx', 'js', 'jsx', 'mjs', 'cjs',+ 'html', 'htm', 'css', 'scss', 'sass', 'less',+ 'sh', 'bash', 'zsh', 'fish', 'ps1', 'bat', 'cmd',+ 'rb', 'go', 'rs', 'java', 'kt', 'kts', 'scala',+ 'c', 'cpp', 'cc', 'cxx', 'h', 'hpp', 'hxx',+ 'php', 'swift', 'lua', 'pl', 'pm', 'r', 'dart',+ 'sql', 'graphql', 'gql', 'proto',+ ].includes(ext)) return '📜';+ return '📄';}function _renderMessageProducedHtml(absPaths) {diff --git a/src/renderer/modules/kb-picker.js b/src/renderer/modules/kb-picker.jsindex d8edbff2..2a64191a 100644--- a/src/renderer/modules/kb-picker.js+++ b/src/renderer/modules/kb-picker.js@@ -157,6 +157,21 @@ function closeKbPicker() {}window.closeKbPicker = closeKbPicker;+// Mirror of `features/contexts.ts::MAX_BASENAME_WEIGHT` + `_filenameWeight`.+// Re-implemented in JS because main and renderer don't share modules; the+// values must stay in lockstep — bump together. CJK / Hangul / Kana are+// double-weight so a single budget gives ~50 chars to Chinese filenames and+// ~100 chars to English filenames.+const _KB_NAME_MAX_WEIGHT = 100;+const _KB_NAME_DOUBLE_WIDTH_RE = /[㐀-鿿가--ゟ゠-ヿ]/;+function _kbNameWeight(s) {+ let w = 0;+ for (const ch of s) {+ w += _KB_NAME_DOUBLE_WIDTH_RE.test(ch) ? 2 : 1;+ }+ return w;+}+async function confirmKbPicker() {const rawName = (document.getElementById('kb-picker-name').value || '').trim();const msg = document.getElementById('kb-picker-msg');@@ -173,6 +188,14 @@ async function confirmKbPicker() {}let name = rawName;if (!/\.[a-z0-9]+$/i.test(name)) name += '.md';+ // Length cap (post-extension). Server enforces the same rule via+ // resolvePath; this branch is the early-feedback for the user so we+ // don't burn a network round-trip on a guaranteed-fail case.+ if (_kbNameWeight(name) > _KB_NAME_MAX_WEIGHT) {+ msg.textContent = t('kb_picker.name_too_long', { name });+ msg.className = 'form-msg err';+ return;+ }const fullPath = _kbPickerCurrentDir ? `${_kbPickerCurrentDir}/${name}` : name;try {@@ -189,10 +212,18 @@ async function confirmKbPicker() {window.confirmKbPicker = confirmKbPicker;/**- * Derive a ≤20-char filename stem from message content. Strips markdown- * decorations + path-hostile characters so the result is filesystem-safe.- * Used by conversation.js to seed the picker input when archiving.+ * Derive a default filename stem from message content. Strips markdown+ * decorations + path-hostile characters so the result is filesystem-safe,+ * then truncates by **weight** (CJK = 2, others = 1) so Chinese gets ~30+ * chars and English gets ~60 chars from the same budget. Without the+ * weight split, "first N code points" gives English a useless prefix+ * like "This is the way to" (20 chars ≈ 3-4 words). Caller seeds the+ * picker input; the user can edit before confirm. Final length is+ * server-validated against `MAX_BASENAME_WEIGHT` (=100), so the seed+ * always fits with headroom for edits.*/+const _KB_DEFAULT_NAME_WEIGHT = 60;+function deriveKbArchiveName(text) {const cleaned = String(text || '').replace(/```[\s\S]*?```/g, ' ')@@ -203,8 +234,26 @@ function deriveKbArchiveName(text) {.replace(/[\\\/:*?"<>|]/g, ' ').replace(/\s+/g, ' ').trim();- const first = Array.from(cleaned).slice(0, 20).join('').trim();- if (first) return first;+ // Walk by code point so emoji / surrogate pairs aren't split mid-glyph.+ let w = 0;+ let out = '';+ for (const ch of cleaned) {+ const cw = _KB_NAME_DOUBLE_WIDTH_RE.test(ch) ? 2 : 1;+ if (w + cw > _KB_DEFAULT_NAME_WEIGHT) break;+ w += cw;+ out += ch;+ }+ // For ASCII text we likely cut mid-word; round back to the last space if+ // it's within 12 chars (= one short word's worth) so the seed reads+ // naturally instead of "the meet" → "the". CJK has no word boundaries,+ // so skip the rounding (the last space might be 30+ chars back).+ const lastSpace = out.lastIndexOf(' ');+ const tailHasNoCjk = lastSpace > 0 && !_KB_NAME_DOUBLE_WIDTH_RE.test(out);+ if (tailHasNoCjk && out.length - lastSpace <= 12 && out.length - lastSpace > 0) {+ out = out.slice(0, lastSpace);+ }+ out = out.trim();+ if (out) return out;const n = new Date();const p = (x) => String(x).padStart(2, '0');return `archive-${n.getFullYear()}${p(n.getMonth() + 1)}${p(n.getDate())}-${p(n.getHours())}${p(n.getMinutes())}`;diff --git a/src/renderer/modules/search.js b/src/renderer/modules/search.jsindex 82d0a038..5eb70062 100644--- a/src/renderer/modules/search.js+++ b/src/renderer/modules/search.js@@ -306,6 +306,16 @@ function _renderSearchResults(query) {}function _onSearchKey(e) {+ // Skip every shortcut while an IME composition is active (pinyin / kana /+ // hangul input). Without this guard, pressing Enter to commit an English+ // candidate from the IME panel — common when the primary suggestion is+ // already an English word — is interpreted as "submit the active result"+ // and navigates away mid-typing. Arrow keys are also IME-owned during+ // composition (they move the candidate cursor), so the same guard+ // prevents them from moving our selection. Mirrors `conversation.js` /+ // `state.js` chat input handlers (`!e.isComposing` + keyCode 229 belt-+ // and-suspenders for older Electron / Safari).+ if (e.isComposing || e.keyCode === 229) return;if (e.key === 'ArrowDown') {e.preventDefault();_moveSearchSelection(1);