mirror of
https://github.com/morluto/rea.git
synced 2026-11-14 18:52:48 +00:00
fix(providers): preserve reply bytes and structured JSON ownership
Share strict UTF-8 JSON admission across bounded worker reports. Preserve IDA/JEB structured dictionaries through negotiated SDK validation and adapter decoding, retaining inherited tool validation and protocol handling. Validated 240 tests, including real SDK/HTTP exchanges and firmware file reads; 83 host-specific cases skipped. Typecheck, lint, and discovery passed. Real-provider execution and modern MCP protocol behavior remain unverified.
This commit is contained in:
1 parent
721dd3d1aa
commit
da526fc014
18 files changed
+508
-95
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { safeParseUtf8Json } from "../domain/safeJson.js";
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import { access, readFile, stat, writeFile } from "node:fs/promises";
|
||||
import { constants } from "node:fs";
|
||||
@@ -42,8 +43,8 @@ import { evmInterfaceEvidence } from "../domain/evm/evmInterfaceEvidence.js";
|
||||
import {
|
||||
DEFAULT_EVM_TIMEOUT_MS,
|
||||
type InspectEvmInterfaceInput,
|
||||
evmInterfaceSchema,
|
||||
} from "../domain/evm/evmInterface.js";
|
||||
import { evmInterfaceSchema } from "../domain/evm/evmInterface.js";
|
||||
import { solidityMetadataSchema } from "../domain/evm/solidityMetadata.js";
|
||||
import { ProviderAdapterError } from "../domain/providerAdapterError.js";
|
||||
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
|
||||
@@ -569,7 +570,9 @@ export class EvmoleInterfaceProvider implements EvmInterfacePort {
|
||||
undefined,
|
||||
this.#resources,
|
||||
);
|
||||
reply = replySchema.parse(JSON.parse(file.bytes.toString("utf8")));
|
||||
const decoded = safeParseUtf8Json(file.bytes);
|
||||
if (!decoded.ok) throw decoded.cause;
|
||||
reply = replySchema.parse(decoded.value);
|
||||
} catch (cause: unknown) {
|
||||
const cleanup =
|
||||
cause instanceof ArtifactReaderFailure ? cause.cleanup : undefined;
|
||||
|
||||
Reference in new issue
Block a user