fix(hopper)!: bind analysis to the active target and correct boundary contracts
Preserve native document identity, nullable bookmark labels, address diagnostics, segment-end byte prefixes, and verified file mappings. Validate batch rename addresses before mutation. BREAKING CHANGE: remove set_current_document. Use open_binary to switch targets; document arguments are scoped to the active target.
This commit is contained in:
@@ -6,6 +6,7 @@ import type {
|
||||
import { AnalysisOutputError } from "../domain/analysisErrorCore.js";
|
||||
import { type AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import { analysisBookmarkSchema } from "../domain/hopperValues.js";
|
||||
import { resolveAnalysisDocument } from "./AnalysisDocument.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
|
||||
@@ -188,25 +189,17 @@ const matchingBookmarks = (value: JsonValue, address: string): Facet => {
|
||||
remediation:
|
||||
"Retry list_bookmarks directly and report the provider output shape if it remains malformed.",
|
||||
};
|
||||
if (!value.every(isBookmark))
|
||||
const parsed = analysisBookmarkSchema.array().safeParse(value);
|
||||
if (!parsed.success)
|
||||
return {
|
||||
state: "unavailable",
|
||||
reason:
|
||||
"list_bookmarks returned malformed entries; expected address and name strings.",
|
||||
"list_bookmarks returned malformed entries; expected an address string and a string or null name.",
|
||||
remediation:
|
||||
"Retry list_bookmarks directly and report the provider output shape if it remains malformed.",
|
||||
};
|
||||
return {
|
||||
state: "available",
|
||||
value: value.filter((bookmark) => bookmark.address === address),
|
||||
value: parsed.data.filter((bookmark) => bookmark.address === address),
|
||||
};
|
||||
};
|
||||
|
||||
const isBookmark = (
|
||||
value: JsonValue,
|
||||
): value is { readonly address: string; readonly name: string } =>
|
||||
typeof value === "object" &&
|
||||
value !== null &&
|
||||
!Array.isArray(value) &&
|
||||
typeof value.address === "string" &&
|
||||
typeof value.name === "string";
|
||||
|
||||
Reference in New Issue
Block a user