Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
export const PI_IMAGE_INPUT_UNSUPPORTED_CODE = 'PI_IMAGE_INPUT_UNSUPPORTED';
export const PI_IMAGE_INPUT_UNSUPPORTED_MARKER = `[${PI_IMAGE_INPUT_UNSUPPORTED_CODE}]`;
/** Stable Desktop main -> renderer/device-link marker; presentation localizes at display time. */
export function isPiImageInputUnsupportedError(value: unknown): boolean {
const message = value instanceof Error ? value.message : String(value ?? '');
const code =
value && typeof value === 'object' && !Array.isArray(value)
? (value as { code?: unknown }).code
: null;
return (
code === PI_IMAGE_INPUT_UNSUPPORTED_CODE || message.includes(PI_IMAGE_INPUT_UNSUPPORTED_MARKER)
);
}
/** The existing Pi prompt RPC expiry signal, shared by native recovery and group settlement. */
export function isPiPromptRpcTimeoutError(data: unknown): boolean {
if (!data || typeof data !== 'object') return false;
const rec = data as { message?: unknown; sdkError?: unknown };
return [rec.message, rec.sdkError].some(
value => typeof value === 'string' && /pi rpc timeout after \d+ms: prompt\b/i.test(value),
);
}