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: chip click pre-checks resource availability before opening detail view

wyt3d2883e27531
diff --git a/src/renderer/modules/conversation.js b/src/renderer/modules/conversation.js
index 539c7932..ed3f63ff 100644
--- a/src/renderer/modules/conversation.js
+++ b/src/renderer/modules/conversation.js
@@ -1006,14 +1006,22 @@ function _renderMessageCreatedAgentHtml(list) {
}
function _hydrateMessageCreatedAgentChip(msgDiv) {
- const chips = msgDiv.querySelectorAll('.chat-msg-created-agent-chip');
+ const chips = msgDiv.querySelectorAll('.chat-msg-created-agent-chip[data-agent-id]');
for (const chip of chips) {
if (chip.dataset.bound === '1') continue;
chip.dataset.bound = '1';
- chip.addEventListener('click', () => {
+ chip.addEventListener('click', async () => {
const aid = chip.dataset.agentId;
if (!aid) return;
setView('agents');
+ // Pre-check the agent is still loadable; if it was deleted (or its
+ // record is broken) the detail view would render an empty shell —
+ // bail to the grid instead.
+ try {
+ const res = await apiFetch(`/api/agents/${encodeURIComponent(aid)}`);
+ const data = await res.json();
+ if (!data?.ok || !data?.agent) return;
+ } catch { return; }
if (typeof _showAgentsDetailView === 'function') _showAgentsDetailView(aid);
else if (typeof selectAgent === 'function') selectAgent(aid);
});
@@ -1042,10 +1050,18 @@ function _hydrateMessageCreatedSkillChip(msgDiv) {
for (const chip of chips) {
if (chip.dataset.bound === '1') continue;
chip.dataset.bound = '1';
- chip.addEventListener('click', () => {
+ chip.addEventListener('click', async () => {
const sid = chip.dataset.skillId;
if (!sid) return;
setView('skills');
+ // Pre-check SKILL.md is readable; covers both "skill was deleted" and
+ // "skill row exists but its files are missing" (entering the detail
+ // would render a 'file not found' shell otherwise).
+ try {
+ const res = await apiFetch(`/api/skills/read?source=custom&id=${encodeURIComponent(sid)}&file=SKILL.md`);
+ const data = await res.json();
+ if (!data?.ok) return;
+ } catch { return; }
if (typeof _showSkillsDetailView === 'function') _showSkillsDetailView('custom', sid);
});
}