The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
import { readEnvironmentSyncErrorDiagnostic, JsonRpcCallError, PLUGIN_RPC_ERROR_CODES } from "@paperclipai/plugin-sdk";
import { preserveWorkspaceRestoreErrorDiagnostic } from "@paperclipai/adapter-utils/workspace-restore-diagnostics";
/** Keep the original RPC failure and policy fields; add only private diagnostic evidence. */
export function preserveEnvironmentSyncOutErrorDiagnostic(error: unknown): unknown {
const diagnostic = readEnvironmentSyncErrorDiagnostic(error);
const rpcCode = error instanceof JsonRpcCallError && (Object.values(PLUGIN_RPC_ERROR_CODES) as number[]).includes(error.code)
? error.code : undefined;
if ((diagnostic || rpcCode !== undefined) && error && typeof error === "object") {
preserveWorkspaceRestoreErrorDiagnostic(error, {
code: diagnostic?.errorCode,
status: diagnostic?.httpStatus,
exitCode: diagnostic?.exitCode,
}, { ...diagnostic, rpcCode });
}
return error;
}