mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 08:17:02 +00:00
fix(mcp): return complete inline Evidence records (#585)
Return complete canonical Evidence records inline, including normalized_result, and preserve direct comparison and retained bundle identity. Verified full deterministic gate, real Linux Ghidra CLI/MCP and independently installed artifact, generic package acceptance, private local samples, and targeted updates after syncing main. Closes #551 Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
This commit is contained in:
1 parent
205a977777
commit
ea9c3dab6b
12 files changed
+253
-31
No files matched your search
@@ -6,7 +6,7 @@ import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import type { Result } from "../domain/result.js";
|
||||
|
||||
/**
|
||||
* Translate an application result into MCP text content.
|
||||
* Serialize an application result as MCP text and structured content.
|
||||
* Error tags and safe messages remain visible while underlying causes, process
|
||||
* output, and other potentially sensitive details stay private.
|
||||
*/
|
||||
@@ -36,7 +36,7 @@ const successResult = (
|
||||
contract: ToolContract,
|
||||
): CallToolResult => {
|
||||
const candidate =
|
||||
compactEvidence(value) ??
|
||||
projectEvidence(value) ??
|
||||
(contract.kind === "session" ? { result: value } : value);
|
||||
return {
|
||||
content: [
|
||||
@@ -49,7 +49,7 @@ const successResult = (
|
||||
};
|
||||
};
|
||||
|
||||
const compactEvidence = (value: JsonValue): JsonValue | undefined => {
|
||||
const projectEvidence = (value: JsonValue): JsonValue | undefined => {
|
||||
if (
|
||||
typeof value !== "object" ||
|
||||
value === null ||
|
||||
@@ -59,17 +59,13 @@ const compactEvidence = (value: JsonValue): JsonValue | undefined => {
|
||||
!("normalized_result" in value)
|
||||
)
|
||||
return undefined;
|
||||
const evidence = value as Record<string, JsonValue>;
|
||||
const normalizedResult = evidence.normalized_result;
|
||||
const evidenceId = evidence.evidence_id;
|
||||
const normalizedResult = value.normalized_result;
|
||||
const evidenceId = value.evidence_id;
|
||||
if (normalizedResult === undefined || typeof evidenceId !== "string")
|
||||
return undefined;
|
||||
const inlineEvidence = Object.fromEntries(
|
||||
Object.entries(evidence).filter(([key]) => key !== "normalized_result"),
|
||||
);
|
||||
return {
|
||||
result: normalizedResult,
|
||||
evidence_id: evidenceId,
|
||||
evidence: inlineEvidence,
|
||||
evidence: value,
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user