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.

Fallback quick-start scenarios to commander

wyt188db46d56f3
diff --git a/src/renderer/modules/conversation.js b/src/renderer/modules/conversation.js
index 807c0965..78566381 100644
--- a/src/renderer/modules/conversation.js
+++ b/src/renderer/modules/conversation.js
@@ -706,12 +706,6 @@ function _scenarioFindAgent(config) {
return list.find((a) => a && a.enabled !== false && names.includes(a.name || '')) || null;
}
-function _scenarioExpectedAgentName(config) {
- if (!config) return '';
- const names = Array.isArray(config.agentNames) ? config.agentNames : [];
- return names[0] || config.agentId || '';
-}
-
async function _scenarioApplyAgent(config) {
if (!config || typeof setChatRecipient !== 'function') return null;
let agent = _scenarioFindAgent(config);
@@ -727,37 +721,22 @@ async function _scenarioApplyAgent(config) {
}
if (!agent) {
setChatRecipient('new-chat', { kind: 'commander' });
- const input = document.getElementById('new-chat-input');
- if (input) {
- input.value = '';
- if (typeof autoGrow === 'function') autoGrow(input, 260);
- try { input.dispatchEvent(new Event('input', { bubbles: true })); } catch (_) {}
- }
- if (typeof uiToast === 'function') {
- const name = _scenarioExpectedAgentName(config);
- const msg = t('new_chat.quick.agent_required', { name });
- uiToast(
- msg && msg !== 'new_chat.quick.agent_required'
- ? msg
- : `Install or enable ${name || 'this agent'} before using this shortcut.`,
- { variant: 'warning', timeoutMs: 5200 },
- );
- }
- return null;
+ return { kind: 'commander' };
}
setChatRecipient('new-chat', {
kind: 'agent',
id: agent.agent_id,
name: agent.name || agent.agent_id,
});
- return agent;
+ return { kind: 'agent', agent };
}
// Scenario chips — bound once in init() (state.js calls into here via
// _initEmptyStateScenarios). Click pre-fills the textarea with the per-chip
-// template, switches the new-chat recipient to the matching installed agent,
-// and moves the caret to the first `[...]` placeholder so the user keeps
-// typing the specific question, not editing scaffolding.
+// template, switches the new-chat recipient to the matching installed agent
+// when available (otherwise commander handles it), and moves the caret to
+// the first `[...]` placeholder so the user keeps typing the specific
+// question, not editing scaffolding.
function _initEmptyStateScenarios() {
const row = document.getElementById('new-chat-scenarios');
if (!row || row.dataset.bound === '1') return;
@@ -770,8 +749,8 @@ function _initEmptyStateScenarios() {
const raw = key ? t(key) : '';
const tmpl = (raw && raw !== key) ? raw : (_SCENARIO_TEMPLATES_FALLBACK_EN[id] || '');
if (!tmpl) return;
- const agent = await _scenarioApplyAgent(config);
- if (!agent) return;
+ const applied = await _scenarioApplyAgent(config);
+ if (!applied) return;
const input = document.getElementById('new-chat-input');
if (!input) return;
input.value = tmpl;
diff --git a/src/renderer/modules/icons.js b/src/renderer/modules/icons.js
index ca9d007f..97c91f1f 100644
--- a/src/renderer/modules/icons.js
+++ b/src/renderer/modules/icons.js
@@ -37,6 +37,7 @@
sparkles: '<path d="M12 3l1.4 3.6L17 8l-3.6 1.4L12 13l-1.4-3.6L7 8l3.6-1.4z"></path><path d="M19 13l.9 2.1L22 16l-2.1.9L19 19l-.9-2.1L16 16l2.1-.9z"></path><path d="M5 14l.8 1.7L7.5 16.5l-1.7.8L5 19l-.8-1.7-1.7-.8 1.7-.8z"></path>',
plug: '<path d="M12 22v-5"></path><path d="M9 8V2"></path><path d="M15 8V2"></path><path d="M6 8h12v4a6 6 0 0 1-12 0z"></path>',
'book-open': '<path d="M12 7v14"></path><path d="M3 5.5A3.5 3.5 0 0 1 6.5 2H12v19H6.5A3.5 3.5 0 0 1 3 17.5z"></path><path d="M21 5.5A3.5 3.5 0 0 0 17.5 2H12v19h5.5a3.5 3.5 0 0 0 3.5-3.5z"></path>',
+ globe: '<circle cx="12" cy="12" r="9"></circle><path d="M3 12h18"></path><path d="M12 3a14 14 0 0 1 0 18"></path><path d="M12 3a14 14 0 0 0 0 18"></path>',
database: '<ellipse cx="12" cy="5" rx="8" ry="3"></ellipse><path d="M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"></path><path d="M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"></path>',
'layout-grid': '<rect x="3" y="3" width="7" height="7" rx="1.5"></rect><rect x="14" y="3" width="7" height="7" rx="1.5"></rect><rect x="3" y="14" width="7" height="7" rx="1.5"></rect><rect x="14" y="14" width="7" height="7" rx="1.5"></rect>',
settings: '<circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3 1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8 1.7 1.7 0 0 0 1.5 1h.1a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"></path>',
diff --git a/test/renderer/conversation-sidebar.test.ts b/test/renderer/conversation-sidebar.test.ts
index 70965970..79b3703e 100644
--- a/test/renderer/conversation-sidebar.test.ts
+++ b/test/renderer/conversation-sidebar.test.ts
@@ -766,3 +766,51 @@ describe('conversation auto recipient', () => {
expect(context._pickInteractiveAgent(null, members, [])).toBeNull();
});
});
+
+describe('new chat quick-start scenarios', () => {
+ it('falls back to commander without toast when the scenario agent is missing', async () => {
+ const context = loadConversationRenderer();
+ const toasts: any[] = [];
+ let clickHandler: Function | null = null;
+ const input = {
+ value: '',
+ focused: false,
+ selection: [0, 0],
+ focus() { this.focused = true; },
+ setSelectionRange(start: number, end: number) { this.selection = [start, end]; },
+ dispatchEvent() {},
+ };
+ const chip = {
+ dataset: { scenario: 'education' },
+ addEventListener(type: string, fn: Function) {
+ if (type === 'click') clickHandler = fn;
+ },
+ };
+ const row = {
+ dataset: {},
+ querySelectorAll: () => [chip],
+ };
+
+ context._agentsCache = [];
+ context.uiToast = (...args: any[]) => toasts.push(args);
+ context.autoGrow = () => {};
+ context.Event = class {
+ type: string;
+ constructor(type: string) { this.type = type; }
+ };
+ context.document.getElementById = (id: string) => {
+ if (id === 'new-chat-scenarios') return row;
+ if (id === 'new-chat-input') return input;
+ return null;
+ };
+
+ context._initEmptyStateScenarios();
+ expect(clickHandler).toBeTruthy();
+ await clickHandler!();
+
+ expect(context.getChatRecipient('new-chat')).toMatchObject({ kind: 'commander' });
+ expect(input.value).toContain('Tutor me step by step');
+ expect(input.focused).toBe(true);
+ expect(toasts).toHaveLength(0);
+ });
+});