Skip to content

armgit / Orkas

Public Imported from GitHub
0

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.

Fix two interruptive UI behaviors in agent editing

claw29de7f2835756
diff --git a/src/renderer/modules/agents.js b/src/renderer/modules/agents.js
index 43052d65..8137d860 100644
--- a/src/renderer/modules/agents.js
+++ b/src/renderer/modules/agents.js
@@ -712,7 +712,9 @@ async function _exitAgentEditMode() {
// streaming-button state into the next agent's edit panel.
try { _agentChatCtrl?.abort(); } catch (_) { /* ignore */ }
// Flush any pending save and then re-render in readonly mode.
- await _flushAgentFieldSave();
+ // The Done button is the explicit commit point — validate name here so
+ // a bad value alerts + reverts rather than silently lingering.
+ await _flushAgentFieldSave({ validate: true });
document.getElementById('agents-chat-col').style.display = 'none';
const aid = _selectedAgent?.id;
if (aid) {
@@ -746,27 +748,28 @@ function _scheduleAgentFieldSave(field, value) {
}
let _pendingAgentField = null;
-async function _flushAgentFieldSave() {
+// `validate` is only true when the user explicitly commits (clicks 完成 →
+// `_exitAgentEditMode`). Typing-debounced and blur-triggered flushes pass
+// false: a bad name silently skips the save (the DOM keeps the user's
+// in-progress text) instead of popping a uiAlert mid-keystroke.
+async function _flushAgentFieldSave({ validate = false } = {}) {
clearTimeout(_agentFieldSaveTimer);
_agentFieldSaveTimer = null;
if (!_pendingAgentField || !_selectedAgent) return;
const { field, value } = _pendingAgentField;
- _pendingAgentField = null;
- // Block reserved names locally — otherwise the PUT silently fails server-
- // side and the renderer DOM keeps the bad value until the next reload.
- if (field === 'name' && _isReservedAgentName(value)) {
- await uiAlert(t('agents.name_reserved'));
- // Revert the inline editor to the last known-good name and refresh list.
- const nameEl = document.getElementById('agents-detail-name');
- if (nameEl && _selectedAgent.name) nameEl.innerText = _selectedAgent.name;
- return;
- }
- if (field === 'name' && !_isValidAgentNameCharset(value)) {
- await uiAlert(t('agents.name_invalid'));
- const nameEl = document.getElementById('agents-detail-name');
- if (nameEl && _selectedAgent.name) nameEl.innerText = _selectedAgent.name;
- return;
+ if (field === 'name') {
+ const reserved = _isReservedAgentName(value);
+ const invalid = !reserved && !_isValidAgentNameCharset(value);
+ if (reserved || invalid) {
+ if (!validate) return;
+ _pendingAgentField = null;
+ await uiAlert(t(reserved ? 'agents.name_reserved' : 'agents.name_invalid'));
+ const nameEl = document.getElementById('agents-detail-name');
+ if (nameEl && _selectedAgent.name) nameEl.innerText = _selectedAgent.name;
+ return;
+ }
}
+ _pendingAgentField = null;
try {
const res = await apiFetch(`/api/agents/${encodeURIComponent(_selectedAgent.id)}/update`, {
method: 'PUT',
diff --git a/src/renderer/modules/user-workspace.js b/src/renderer/modules/user-workspace.js
index d7150cfe..45e7dd85 100644
--- a/src/renderer/modules/user-workspace.js
+++ b/src/renderer/modules/user-workspace.js
@@ -246,12 +246,4 @@ async function initUserWorkspace() {
toolbar.appendChild(_createWorkspaceChip());
}
}
-
- const agentInputArea = document.querySelector('.agents-chat-input-area');
- if (agentInputArea) {
- const toolbar = document.createElement('div');
- toolbar.className = 'chat-input-toolbar agents-chat-workspace-toolbar';
- toolbar.appendChild(_createWorkspaceChip());
- agentInputArea.parentNode.insertBefore(toolbar, agentInputArea);
- }
}
diff --git a/src/renderer/style.css b/src/renderer/style.css
index 85b25d5f..56a5de2d 100644
--- a/src/renderer/style.css
+++ b/src/renderer/style.css
@@ -2989,12 +2989,6 @@ body.model-not-configured .main-content { flex-direction: column; }
margin: 4px 12px;
}
-.agents-chat-workspace-toolbar {
- max-width: 100%;
- margin: 0 0 6px;
- padding: 0 2px;
-}
-
.skill-picker {
position: fixed;
width: 300px;