feat(ghidra): implement read-only inventory operations

This commit is contained in:
N0zoM1z0
2026-07-16 02:59:37 +09:00
committed by N0zoM1z0
parent f0e625d7ee
commit b1c07dd9c6
101 changed files with 3825 additions and 377 deletions
+15 -3
View File
@@ -47,6 +47,17 @@ const responseSchema = z
/** Validated response emitted by REA's packaged Ghidra script. */
export type GhidraBridgeResponse = z.infer<typeof responseSchema>;
/** Expected operation failure returned by the authenticated Java bridge. */
export class GhidraRemoteError extends Error {
constructor(
readonly code: string,
message: string,
) {
super(message);
this.name = "GhidraRemoteError";
}
}
/** Parse one complete Java-bridge response without accepting extra fields. */
export const parseGhidraResponseLine = (
line: string,
@@ -67,11 +78,12 @@ export const parseGhidraResponseLine = (
/** Project one validated response into its result or remote failure. */
export const ghidraResponseResult = (
response: GhidraBridgeResponse,
): Result<JsonValue, Error> =>
): Result<JsonValue, GhidraRemoteError> =>
response.ok
? ok(response.result ?? null)
: err(
new Error(
`${response.error?.code ?? "bridge_error"}: ${response.error?.message ?? "Ghidra bridge request failed"}`,
new GhidraRemoteError(
response.error?.code ?? "bridge_error",
response.error?.message ?? "Ghidra bridge request failed",
),
);