Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
import { z } from 'zod';
/** Matches the existing Desktop ghosts:composer-list public projection. */
export const composerPluginListSchema = z.array(z.object({
manifest: z.object({
id: z.string().min(1),
name: z.string().min(1),
command: z.string().min(1).max(32).regex(/^\S+$/u).optional(),
tools: z.array(z.object({
name: z.string(),
description: z.string(),
parameters: z.record(z.string(), z.unknown()).optional(),
})).optional(),
}),
enabled: z.boolean(),
/** Absent on old peers. null is an explicit root instance. */
namespace: z.string().min(1).nullable().optional(),
/**
* Physical instance key. Absent on old peers; never a filesystem path.
* In-place migrated installs keep their original key, which can differ from manifest.id.
*/
instanceKey: z.string().min(1).max(167).optional(),
iconDataUrl: z.string().optional(),
}));
export type ComposerPlugin = z.infer<typeof composerPluginListSchema>[number];
export function isComposerPluginCatalogUnsupportedError(error: unknown): boolean {
const code = error && typeof error === 'object' ? (error as { code?: unknown }).code : undefined;
if (typeof code === 'string' && code !== 'IPC_ERROR') {
return code === 'CHANNEL_NOT_ALLOWED' || code === 'DEVICE_LINK_CHANNEL_NOT_ALLOWED';
}
const message = (error instanceof Error ? error.message : typeof error === 'string' ? error : '')
.replace(/^Error invoking remote method '[^']+': Error:\s*/, '')
.trim();
return /^(?:\[)?(?:DEVICE_LINK_)?CHANNEL_NOT_ALLOWED(?:\])?(?:\s|$)/.test(message);
}