Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

1.3 KB
Raw Blame
import { defineEval } from "eve/evals";
import { includes } from "eve/evals/expect";

const PARENT_TOKEN = "sandbox-parent-write-ok-N4K";
const PARENT_PATH = "/workspace/parent-write.txt";
const CHILD_TOKEN = "sandbox-child-write-ok-V8C";
const CHILD_PATH = "/workspace/child-write.txt";

export default defineEval({
  description: "Sandbox: a declared child can share the parent's live workspace.",
  async test(t) {
    const parentWrite = await t.send(
      `Run the bash command \`printf %s ${PARENT_TOKEN} > ${PARENT_PATH}\`. ` +
        "Reply with the single word: done.",
    );
    const conversation = parentWrite.session;
    parentWrite.expectOk();

    const childTurn = await conversation.send(
      `Ask the \`parent-sandbox\` subagent with message: ` +
        `Run the bash command \`cat ${PARENT_PATH} && printf %s ${CHILD_TOKEN} > ${CHILD_PATH}\` ` +
        "and reply with the command output verbatim.",
    );
    childTurn.expectOk();
    await t.require(childTurn.message, includes(PARENT_TOKEN));

    const parentRead = await conversation.send(
      `Run the bash command \`cat ${CHILD_PATH}\` and reply with the file contents verbatim.`,
    );

    t.succeeded();
    t.calledSubagent("parent-sandbox", { status: "completed", count: 1 });
    t.check(parentRead.message, includes(CHILD_TOKEN));
  },
});