Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

572 B
Raw Blame
import { CommandExecutionError } from '@jackwener/opencli/errors';

export function unwrapEvaluateResult(payload) {
  if (payload && !Array.isArray(payload) && typeof payload === 'object' && 'session' in payload && 'data' in payload) {
    return payload.data;
  }
  return payload;
}

export function requireObjectEvaluateResult(payload, context) {
  const result = unwrapEvaluateResult(payload);
  if (!result || Array.isArray(result) || typeof result !== 'object') {
    throw new CommandExecutionError(`${context}: malformed evaluate payload`);
  }
  return result;
}