Open History to see the last commit
1import { assert, describe, it } from "@effect/vitest";
2import type * as EffectAcpSchema from "effect-acp/compat";
3
4import { ProviderAdapterV2RuntimePolicy } from "@t3tools/provider-core/server/ProviderAdapter";
5
6import { fxPermissionDisposition } from "./acpSupport.ts";
7
8const editRequest = {
9 sessionId: "fx-session-01",
10 toolCall: { toolCallId: "tool-1", kind: "edit", title: "Write notes.md" },
11 options: [
12 { optionId: "allow", name: "Allow", kind: "allow_once" },
13 { optionId: "reject", name: "Reject", kind: "reject_once" },
14 ],
15} satisfies EffectAcpSchema.RequestPermissionRequest;
16
17describe("fx permission prompts", () => {
18 // In Auto, fx's own review asks only about what it refused itself; T3
19 // answering those by its Auto policy would approve exactly what fx escalated.
20 it("sends every Auto prompt to the user", () => {
21 assert.equal(
22 fxPermissionDisposition(
23 ProviderAdapterV2RuntimePolicy.make({
24 runtimeMode: "auto",
25 interactionMode: "default",
26 cwd: "/work",
27 }),
28 editRequest,
29 ),
30 "ask",
31 );
32 });
33});