fix(analysis): preserve producer identity and partial evidence
Reconcile Mach-O UUID observations without hiding malformed or conflicting sources. Require source-map identity digests to be supported by consistent observations. Keep truncated Android manifests as partial raw evidence, validate WABT section framing, and reject missing JEB inventories or error-marked success replies. Consolidate native UUID parsing and simplify capacity and malformed-input fixtures. Focused source and public workflow checks pass, including native arm64e inspection and real WABT framing probes; a successful real JEB GUI project opening remains unverified.
This commit is contained in:
+23
-14
@@ -38,26 +38,35 @@ export const decodeJebToolResult = (input: unknown): JsonValue => {
|
||||
const blocks = result.content.flatMap((block) =>
|
||||
block.type === "text" && block.text !== undefined ? [block.text] : [],
|
||||
);
|
||||
let decoded: JsonValue;
|
||||
if (result.structuredContent !== undefined) {
|
||||
// isError envelopes carry JEB's {success:false, message} refusal semantics;
|
||||
// decode them so the provider can preserve the engine's own reason.
|
||||
return jsonValueSchema.parse(result.structuredContent);
|
||||
}
|
||||
if (blocks.length !== 1)
|
||||
throw new AnalysisProtocolError(
|
||||
"JEB MCP omitted a single structured or text result; unsupported content cannot establish an empty observation.",
|
||||
);
|
||||
try {
|
||||
return jsonValueSchema.parse(JSON.parse(blocks[0] ?? "null"));
|
||||
} catch {
|
||||
if (result.isError === true)
|
||||
decoded = jsonValueSchema.parse(result.structuredContent);
|
||||
} else {
|
||||
if (blocks.length !== 1)
|
||||
throw new AnalysisProtocolError(
|
||||
`JEB MCP tool failed: ${blocks[0] ?? "unexplained engine failure"}`,
|
||||
"JEB MCP omitted a single structured or text result; unsupported content cannot establish an empty observation.",
|
||||
);
|
||||
return blocks[0] ?? null;
|
||||
const text = blocks[0] ?? "null";
|
||||
try {
|
||||
decoded = jsonValueSchema.parse(JSON.parse(text));
|
||||
} catch {
|
||||
decoded = text;
|
||||
}
|
||||
}
|
||||
if (result.isError === true && !isJebFailureEnvelope(decoded))
|
||||
throw new AnalysisProtocolError(
|
||||
`JEB MCP tool failed: ${blocks[0] ?? "error-marked result without a JEB failure envelope"}`,
|
||||
{ cause: decoded },
|
||||
);
|
||||
return decoded;
|
||||
};
|
||||
|
||||
const isJebFailureEnvelope = (value: JsonValue): boolean =>
|
||||
typeof value === "object" &&
|
||||
value !== null &&
|
||||
!Array.isArray(value) &&
|
||||
value.success === false;
|
||||
|
||||
export type JebMcpConnectionFactory = (endpoint: URL) => JebMcpConnection;
|
||||
|
||||
/** Serve JEB requests from a running engine client over streamable HTTP. */
|
||||
|
||||
Reference in New Issue
Block a user