Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

1.7 KB
Raw Blame
import { defineEval } from "eve/evals";

/**
 * HITL flow: `once()` approval semantics — a denial does not grant, so the
 * follow-up guarded call re-parks. Parking is server-side, so every
 * park/resume here is deterministic.
 */
export default defineEval({
  tags: ["real-model"],
  description: "HITL smoke: a denied once() call does not execute and re-gates the next call.",
  async test(t) {
    const { session } = await t.send('Call the guarded-echo tool with note "denied-call".');
    const request = session.requireInputRequest({ toolName: "guarded-echo" });

    const denied = await session.respondAll("cancel");
    denied.expectOk();
    denied.event("action.result", {
      data: {
        result: {
          kind: "tool-result",
          output: {
            approval: { requestId: request.requestId, status: "denied" },
            code: "TOOL_EXECUTION_DENIED",
            tool: { result: "not_run" },
          },
          toolName: "guarded-echo",
        },
        status: "rejected",
      },
      count: 1,
    });
    // The denial returns to the model as context; real models paraphrase it,
    // so judge the acknowledgment instead of matching literal wording.
    t.judge("The reply acknowledges that the guarded-echo tool call was denied and did not run.", {
      on: denied.message,
    }).atLeast(0.5);

    await session.send('Call the guarded-echo tool once more with note "retry-call".');
    // Denial does not grant: the follow-up call must re-park.
    session.requireInputRequest({ toolName: "guarded-echo" });

    t.parked();
    t.calledTool("guarded-echo", { status: "rejected", count: 1 });
    t.calledTool("guarded-echo", { status: "pending", count: 1 });
  },
});