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.

Filter agent connector ids on write

wytbed325fafdb1
diff --git a/src/main/features/agents.ts b/src/main/features/agents.ts
index 68822fbd..fda76860 100644
--- a/src/main/features/agents.ts
+++ b/src/main/features/agents.ts
@@ -1736,7 +1736,10 @@ async function _applyAgentUpdates(
if (v === null) {
delete (data as { enabled_connectors?: unknown }).enabled_connectors;
} else if (Array.isArray(v)) {
- const ids = v.filter((s): s is string => typeof s === 'string' && s.length > 0);
+ const ids = v
+ .filter((s): s is string => typeof s === 'string')
+ .map((s) => s.trim())
+ .filter((s) => s.length > 0 && safeId(s));
(data as { enabled_connectors?: string[] }).enabled_connectors = ids;
}
}
diff --git a/test/main/features/agents.test.ts b/test/main/features/agents.test.ts
index 69657cd7..dc2d10fb 100644
--- a/test/main/features/agents.test.ts
+++ b/test/main/features/agents.test.ts
@@ -1273,6 +1273,17 @@ describe('agents › updateCustomAgent', () => {
expect(updated?.skill_list).toEqual(['ok-1', 'ok_2']);
});
+ it('filters invalid enabled connector ids on write', async () => {
+ writeCustomAgent('abc', { name: 'N' });
+ const a = await loadAgents();
+ const updated = await a.updateCustomAgent('abc', {
+ enabled_connectors: [' github ', '../bad', 42 as any, 'notion'],
+ });
+ expect(updated?.enabled_connectors).toEqual(['github', 'notion']);
+ const raw = JSON.parse(fs.readFileSync(path.join(customAgentsDir(), 'abc', 'agent.json'), 'utf8'));
+ expect(raw.enabled_connectors).toEqual(['github', 'notion']);
+ });
+
it('writes skill_list = [] as explicit zero (kept, not dropped)', async () => {
writeSkillOnDisk('a');
writeCustomAgent('abc', { name: 'N', skill_list: ['a'] });