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
Reduce startup marketplace catalog scans
wyt05bd3de31dff
diff --git a/src/main/features/marketplace_reconcile.ts b/src/main/features/marketplace_reconcile.tsindex defbc845..d548c098 100644--- a/src/main/features/marketplace_reconcile.ts+++ b/src/main/features/marketplace_reconcile.ts@@ -188,9 +188,11 @@ export async function checkServerUpdatesForInstalls(let agentMap: Map<string, _CatalogRow>;let skillMap: Map<string, _CatalogRow>;try {+ const agentIds = manifest.agents.map((a) => a.id).filter(Boolean);+ const skillIds = manifest.skills.map((s) => s.id).filter(Boolean);[agentMap, skillMap] = await Promise.all([- _fetchServerCatalogMap('agents'),- _fetchServerCatalogMap('skills'),+ agentIds.length ? _fetchServerCatalogMap('agents', agentIds) : Promise.resolve(new Map()),+ skillIds.length ? _fetchServerCatalogMap('skills', skillIds) : Promise.resolve(new Map()),]);} catch (err) {log.warn(`server-check fetch failed (offline?): ${(err as Error).message}`);@@ -321,33 +323,35 @@ function _markServerCheckSuccess(uid: string): void {interface _CatalogRow { version: string; published_at: number; updated_at?: number; default_install?: boolean; status?: string }/** Paginate the public `/marketplace/{kind}/list` endpoint and collapse to (id → version + ts).- * Page-size 100 × 20 pages = 2000 row cap (well above current catalog scale). */-async function _fetchServerCatalogMap(kind: 'agents' | 'skills'): Promise<Map<string, _CatalogRow>> {+ * The optional `ids` filter is supported by newer Servers. Older Servers ignore the extra body+ * field, so we still page defensively; the client-side id set prevents unrelated rows from+ * entering the update map. Page-size 100 × 20 pages = 2000 row cap. */+async function _fetchServerCatalogMap(kind: 'agents' | 'skills', ids: string[]): Promise<Map<string, _CatalogRow>> {const out = new Map<string, _CatalogRow>();const PAGE_SIZE = 100;- for (const status of ['unreviewed', 'reviewing', 'approved', 'rejected', 'archived']) {- for (let page = 1; page <= 20; page++) {- const r = await postJson<{ list: Array<{ id?: string; version?: string; published_at?: number; updated_at?: number; default_install?: boolean | number; status?: string; state?: string }>; total?: number }>(- `/marketplace/${kind}/list`, { page, size: PAGE_SIZE, status },- );- const list = r.list || [];- for (const row of list) {- if (typeof row.id === 'string' && typeof row.version === 'string' && typeof row.published_at === 'number') {- out.set(row.id, {- version: row.version,- published_at: row.published_at,- ...(typeof row.updated_at === 'number' ? { updated_at: row.updated_at } : {}),- ...(typeof row.default_install === 'boolean' || typeof row.default_install === 'number'- ? { default_install: row.default_install === true || row.default_install === 1 }- : {}),- ...(typeof row.status === 'string' ? { status: row.status } : (- typeof row.state === 'string' ? { status: row.state } : {}- )),- });- }+ const wanted = new Set(ids.filter(Boolean));+ for (let page = 1; page <= 20; page++) {+ const r = await postJson<{ list: Array<{ id?: string; version?: string; published_at?: number; updated_at?: number; default_install?: boolean | number; status?: string; state?: string }>; total?: number }>(+ `/marketplace/${kind}/list`, { page, size: PAGE_SIZE, ids: [...wanted] },+ );+ const list = r.list || [];+ for (const row of list) {+ if (typeof row.id !== 'string' || !wanted.has(row.id)) continue;+ if (typeof row.version === 'string' && typeof row.published_at === 'number') {+ out.set(row.id, {+ version: row.version,+ published_at: row.published_at,+ ...(typeof row.updated_at === 'number' ? { updated_at: row.updated_at } : {}),+ ...(typeof row.default_install === 'boolean' || typeof row.default_install === 'number'+ ? { default_install: row.default_install === true || row.default_install === 1 }+ : {}),+ ...(typeof row.status === 'string' ? { status: row.status } : (+ typeof row.state === 'string' ? { status: row.state } : {}+ )),+ });}- if (list.length < PAGE_SIZE) break;}+ if (out.size >= wanted.size || list.length < PAGE_SIZE) break;}return out;}diff --git a/test/main/features/marketplace_reconcile.test.ts b/test/main/features/marketplace_reconcile.test.tsindex 4c18182b..959175f0 100644--- a/test/main/features/marketplace_reconcile.test.ts+++ b/test/main/features/marketplace_reconcile.test.ts@@ -89,6 +89,12 @@ describe('marketplace reconcile', () => {const result = await reconcile.checkServerUpdatesForInstalls('u1');expect(result).toEqual({ updated_agents: 1, updated_skills: 0 });+ expect(postJsonMock).toHaveBeenCalledTimes(1);+ expect(postJsonMock).toHaveBeenCalledWith('/marketplace/agents/list', {+ page: 1,+ size: 100,+ ids: ['agent1'],+ });const manifest = await installs.readInstalls('u1');expect(manifest.agents[0]).toMatchObject({id: 'agent1',@@ -121,6 +127,71 @@ describe('marketplace reconcile', () => {expect(postJsonMock).not.toHaveBeenCalled();});+ it('checks server updates with installed ids instead of scanning every review status', async () => {+ postJsonMock.mockImplementation(async (p: string) => {+ if (p === '/marketplace/agents/list') {+ return {+ list: [{+ id: 'agent-a',+ version: '1.0.0',+ published_at: 100,+ updated_at: 100,+ status: 'approved',+ }],+ total: 1,+ };+ }+ if (p === '/marketplace/skills/list') {+ return {+ list: [{+ id: 'skill-a',+ version: '1.0.0',+ published_at: 200,+ updated_at: 200,+ status: 'approved',+ }],+ total: 1,+ };+ }+ throw new Error(`unexpected path ${p}`);+ });+ const installs = await import('../../../src/main/features/marketplace_installs');+ await installs.addAgentInstall('u1', {+ id: 'agent-a',+ version: '1.0.0',+ published_at: 100,+ updated_at: 100,+ agent_json_url: 'https://example.test/agent-a.json',+ create_uid: '0',+ status: 'approved',+ });+ await installs.addSkillInstall('u1', {+ id: 'skill-a',+ version: '1.0.0',+ published_at: 200,+ updated_at: 200,+ bundle_url: 'https://example.test/skill-a.zip',+ create_uid: '0',+ status: 'approved',+ });++ const reconcile = await import('../../../src/main/features/marketplace_reconcile');+ const result = await reconcile.checkServerUpdatesForInstalls('u1');++ expect(result).toEqual({ updated_agents: 0, updated_skills: 0 });+ expect(postJsonMock).toHaveBeenCalledTimes(2);+ expect(postJsonMock).toHaveBeenNthCalledWith(1, '/marketplace/agents/list', {+ page: 1,+ size: 100,+ ids: ['agent-a'],+ });+ expect(postJsonMock).toHaveBeenNthCalledWith(2, '/marketplace/skills/list', {+ page: 1,+ size: 100,+ ids: ['skill-a'],+ });+ });+it('restores a local-only new skill install into the cloud manifest', async () => {writeLocalSkill('skill-local', {version: '1.0.0',