mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
* fix: retain address context cleanup failures * fix!: preserve address context input errors BREAKING CHANGE: Strict clients that cached the previous full inspect_address_context output schema must refresh tools/list and accept the typed error field on unavailable facets. * test: use session contract for address context * fix!: preserve address context resource recovery BREAKING CHANGE: Clients validating unavailable context facets against a cached strict full output schema must refresh tools/list to accept resource_constraint errors. * fix: expose authenticated records refused by the evidence ledger (#8426) * fix: preserve completed evidence on retention refusal * fix: preserve context when unretained evidence exceeds delivery limits * fix(mcp): recover oversized context from session evidence * fix(evidence): preserve completed atomic write results * fix: retain completed results when source publication fails * test: cover bounded recovery with unknown retention * fix(evidence): preserve recovery identity and finalization facts * fix(evidence): clarify retention of omitted observations * test(evidence): compare omission guidance with its owner * fix(evidence): preserve completed composed workflows * fix(evidence): clarify unretained recovery export * test(evidence): cover mixed recovery guidance * fix(evidence): preserve caller scope in secondary failures * refactor(evidence): remove superseded cleanup projection * test(evidence): align recovery checks with owners * fix: preserve cleanup on partial recovery limits * test: use owners for diagnostic wording * fix: admit completed analysis before evidence construction * fix: preserve selected paths when reusing evidence * fix(cli): preserve caller path in unretained evidence * fix(evidence): preserve recovery metadata and admission bounds * refactor: consolidate evidence closure imports * style(test): format CLI help default annotations (#9280) * test(mcp): keep recovery checks focused on contract facts * fix(evidence): preserve feature trace replay revision * test: align evidence recovery checks with ownership * test: align partial recovery and cleanup diagnostics * fix(evidence): preserve nested partials during cleanup * fix(evidence): respect outer recovery ownership * fix(capture): discard rejected nested observations * test(frida): assert inline evidence recovery --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
101 lines
3.9 KiB
TypeScript
101 lines
3.9 KiB
TypeScript
import { workflowUnknownInput } from "../../application/investigation/WorkflowUnknown.js";
|
|
import type { EvidenceMcpServer } from "../EvidenceMcpServer.js";
|
|
import { runAdmittedToolOperation } from "../admittedToolOperation.js";
|
|
import { recordEvidenceSources } from "../../application/investigation/recordEvidenceSources.js";
|
|
|
|
import { executeManagedNativeBoundaries } from "../../application/managed/ManagedNativeVerificationService.js";
|
|
import { logToolExecution } from "../toolLogging.js";
|
|
import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
import { toolContract } from "../../contracts/toolContracts.js";
|
|
import type { ManagedWorkflowToolRegistration } from "./types.js";
|
|
|
|
const nativeVerificationContract = toolContract(
|
|
"verify_managed_native_boundaries",
|
|
);
|
|
|
|
/** Register the managed/native boundary verification workflow tool. */
|
|
export const registerVerifyManagedNativeBoundaries = (
|
|
server: EvidenceMcpServer,
|
|
options: ManagedWorkflowToolRegistration,
|
|
): void => {
|
|
server.registerTool(
|
|
nativeVerificationContract.name,
|
|
toolRegistrationOptions(nativeVerificationContract),
|
|
async (input, context) =>
|
|
runAdmittedToolOperation(
|
|
server,
|
|
options.withAdmittedAnalysis,
|
|
nativeVerificationContract.name,
|
|
context.mcpReq.signal,
|
|
async () => {
|
|
const result = await logToolExecution(
|
|
options.logger,
|
|
nativeVerificationContract.name,
|
|
() =>
|
|
Promise.resolve(
|
|
executeManagedNativeBoundaries(
|
|
input,
|
|
options.session.evidenceForAnalysis.bind(options.session),
|
|
{ signal: context.mcpReq.signal },
|
|
),
|
|
),
|
|
);
|
|
if (!result.ok)
|
|
return server.delivery.toCallToolResult(
|
|
result,
|
|
nativeVerificationContract,
|
|
);
|
|
const execution = result.value;
|
|
const recordedSources = recordEvidenceSources(
|
|
options.recordEvidence,
|
|
execution.sourceEvidence,
|
|
{ evidence: execution.evidence },
|
|
);
|
|
if (!recordedSources.ok)
|
|
return server.delivery.toCallToolResult(
|
|
recordedSources,
|
|
nativeVerificationContract,
|
|
);
|
|
const unknownInput = execution.hasUnknowns
|
|
? workflowUnknownInput(execution.evidence.evidence_id, {
|
|
question:
|
|
"Which managed/native boundaries remain unresolved or contradicted by the supplied native Evidence?",
|
|
severity: "medium",
|
|
domain: "managed-native-verification",
|
|
required_authority: "shipped-artifact",
|
|
required_confidence: "observed",
|
|
required_environment: null,
|
|
recommended_probes: [
|
|
{
|
|
operation: "inspect_managed_native_boundaries",
|
|
rationale:
|
|
"Review the inspection Evidence coverage and limit diagnostics; this operation has no page override, so unresolved declarations must remain unknown.",
|
|
},
|
|
{
|
|
operation: "analyze_function",
|
|
rationale:
|
|
"Analyze the provider-resolved native function candidate for the declared export.",
|
|
},
|
|
],
|
|
relationships: [],
|
|
})
|
|
: undefined;
|
|
const output =
|
|
unknownInput === undefined
|
|
? options.recordEvidence?.(execution.evidence)
|
|
: unknownInput.ok
|
|
? options.recordEvidenceWithUnknown?.(
|
|
execution.evidence,
|
|
unknownInput.value,
|
|
)
|
|
: unknownInput;
|
|
return server.delivery.toEvidenceToolResult(
|
|
execution.evidence,
|
|
nativeVerificationContract,
|
|
output,
|
|
);
|
|
},
|
|
),
|
|
);
|
|
};
|