Files
reverse-engineering-anything/src/contracts/sessionStatusContract.ts
T
Kaoru0822andClaude Opus 5.5 5a22ae6bc8 fix(mcp)!: return a compact binary_session status by default (#7127)
* fix(mcp)!: return a compact binary_session status by default

binary_session {} with no target open returned about 66 KB, most of it
provider rejection diagnostics and candidate capability sets that the
skill's recovery flow re-reads on every retry. 6.8.0 grew it by 21%
because the shared regex capability limitation began repeating setting
bounds and step-by-step recovery for every search operation of every
provider (#6099, #6267, #6301, #7049) and IDA gained that limitation for
its two search operations (#4862).

The regex limitation now states the effective deadline and heap, their
sources and where to change them; the deadline and heap errors keep the
full recovery. binary_session gains detail: summary (default) or
complete. The summary keeps open state, target identity, the binding,
route capabilities, run, activity and health status, each candidate's
availability and target-support status, code and reason, and every
tool's availability, reason, remediation and modes, and lists the
fields it leaves out in omitted_fields. Complete detail returns the
previous shape. The CLI capabilities and providers commands keep
complete provider facts through the same application projection.

BREAKING CHANGE: binary_session {} no longer returns
analysis_provider_candidates[].availability.diagnostics,
target_support.diagnostics or capabilities, or tool_availability group
surface, effects and annotations. Pass {"detail": "complete"} to get
them.

Fixes #7109

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): key binary_session output fields by detail

The output schema accepted detail: "complete" with summary candidates or
tool groups, and a summary without omitted_fields, so detail did not
tell callers which fields existed. Each session kind is now crossed
with a detail-specific shape: a summary requires omitted_fields and
summary-only candidates and tool groups; complete requires diagnostics,
candidate capabilities and static tool flags and forbids omitted_fields.
Both the canonical schema and the SDK-validated advertised schema reject
mismatched shapes.

The verifier helper accepts summary candidates only for a validated MCP
summary; CLI provider output still requires candidate capabilities.
Regex limitation tests check values, sources and setting names instead
of whole sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 05:29:03 -07:00

40 lines
1.7 KiB
TypeScript

import { z } from "zod";
import { absoluteLocalPathStringSchema } from "../domain/localPath.js";
/** Caller-selected binary_session projections. */
export const BINARY_SESSION_DETAILS = ["summary", "complete"] as const;
export type BinarySessionDetail = (typeof BINARY_SESSION_DETAILS)[number];
/**
* Fields a summary leaves out, as dotted paths through arrays. Each stays
* available from the same session with detail: "complete".
*/
export const BINARY_SESSION_SUMMARY_OMITTED_FIELDS = [
"analysis_provider_candidates.availability.diagnostics",
"analysis_provider_candidates.target_support.diagnostics",
"analysis_provider_candidates.capabilities",
"tool_availability.groups.surface",
"tool_availability.groups.effects",
"tool_availability.groups.annotations",
] as const;
/** Optional expectations used to compare the live session with its caller. */
export const binarySessionInputSchema = z.strictObject({
detail: z
.enum(BINARY_SESSION_DETAILS)
.default("summary")
.describe(
"summary (default) keeps open state, the binding, current-route capabilities, each provider candidate's availability and target-support status, code and reason, and every tool's availability, reason and remediation; omitted_fields lists what it leaves out. complete adds provider diagnostics, candidate capabilities and static tool surface, effect and annotation flags.",
),
expected_package_version: z.string().min(1).optional(),
expected_catalog_digest: z
.string()
.regex(/^[a-f0-9]{64}$/u)
.optional(),
expected_server_path: absoluteLocalPathStringSchema
.describe(
"Absolute local filesystem path expected for the running server; relative paths are rejected.",
)
.optional(),
});