fix(mcp): declare binary session prerequisite process effects

Recover the isolated effect metadata correction identified in #1669. Keep the generic annotation-algebra fixture independent of operation-specific effects.

Co-authored-by: Pompilio Donato <238757198+pompiliodonatoapp@users.noreply.github.com>
This commit is contained in:
morluto 2026-10-13 22:58:28 +08:00
parent 4758ba30b6
commit 579ecbd032
2 changed files with 19 additions and 4 deletions

View File

@ -1,7 +1,11 @@
import { describe, expect, it } from "vitest";
import { TOOL_CONTRACTS } from "./toolContracts.js";
import { TOOL_EFFECTS, annotationsFromEffects } from "./toolEffects.js";
import {
TOOL_EFFECTS,
annotationsFromEffects,
type ToolEffects,
} from "./toolEffects.js";
/**
* Descriptions that name running, launching, executing, starting, installing,
@ -148,8 +152,19 @@ describe("tool effects", () => {
});
it("derives destructiveHint from each destructive effect alone", () => {
const base = TOOL_EFFECTS["binary_session"];
if (base === undefined) throw new Error("binary_session is unaudited");
// Keep annotation algebra independent of any operation's audited effects.
const base: ToolEffects = {
mutatesTarget: false,
mutatesSession: false,
writesFilesystem: false,
launchesProcess: false,
accessesNetwork: false,
changesUiState: false,
mayDiscardData: false,
executesForeignCode: false,
mutatesDevice: false,
idempotent: true,
};
expect(annotationsFromEffects(base)).toEqual({
readOnlyHint: true,
destructiveHint: false,

View File

@ -605,7 +605,7 @@ export const TOOL_EFFECTS: Readonly<Record<string, ToolEffects>> = {
mayDiscardData: true,
idempotent: false,
}),
binary_session: effects(),
binary_session: effects({ launchesProcess: true }),
export_evidence_bundle: effects({
writesFilesystem: true,
mayDiscardData: true,