fix(hopper): preserve typed string values and verify real searches
This commit is contained in:
@@ -126,7 +126,7 @@ export const OFFICIAL_TOOL_CONTRACTS = [
|
||||
),
|
||||
official(
|
||||
"list_strings",
|
||||
"List every provider-defined string, or filter to one address, as address/value pairs. Ghidra also reports encoding, terminator status, and byte length.",
|
||||
"List every provider-defined string object, or filter to one address, as address/value pairs with encoding, terminator status, and byte length when available. Hopper reads complete typed objects and retains its original display text as provider_value; long literals may span adjacent unterminated objects.",
|
||||
z.object({ document, address: optionalAddress }),
|
||||
),
|
||||
official(
|
||||
@@ -198,7 +198,7 @@ export const OFFICIAL_TOOL_CONTRACTS = [
|
||||
),
|
||||
official(
|
||||
"search_strings",
|
||||
"Search every analyzed string using literal matching by default or regex when requested. Results are deterministic and complete.",
|
||||
"Search every analyzed string object using literal matching by default or regex when requested. Results are deterministic and complete over the native inventory. Hopper searches complete typed bytes rather than shortened displays; adjacent fragments of a long literal are matched independently, with their termination and original display retained.",
|
||||
z.object(analysisSearchInput),
|
||||
),
|
||||
official(
|
||||
|
||||
@@ -97,9 +97,21 @@ const bookmarkFacetSchema = z.discriminatedUnion("state", [
|
||||
const addressedString = z.object({
|
||||
address: z.string(),
|
||||
value: z.string(),
|
||||
provider_value: z
|
||||
.string()
|
||||
.exactOptional()
|
||||
.describe(
|
||||
"Original provider display text, which may shorten the typed object.",
|
||||
),
|
||||
string: z
|
||||
.object({
|
||||
encoding: z.string().min(1),
|
||||
encoding_status: z
|
||||
.enum(["observed", "inferred"])
|
||||
.exactOptional()
|
||||
.describe(
|
||||
"Whether the provider declares the encoding or REA infers it from the typed bytes and native display. This does not establish the original source's intended encoding.",
|
||||
),
|
||||
termination: z.enum(["missing", "present_or_not_required"]),
|
||||
byte_length: z.number().int().min(0),
|
||||
})
|
||||
@@ -197,9 +209,7 @@ export const officialOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
|
||||
search_procedures: resultOf(
|
||||
z.array(z.object({ address: z.string(), value: z.string() })),
|
||||
),
|
||||
search_strings: resultOf(
|
||||
z.array(z.object({ address: z.string(), value: z.string() })),
|
||||
),
|
||||
search_strings: resultOf(z.array(addressedString)),
|
||||
set_address_name: resultOf(z.boolean()),
|
||||
set_addresses_names: resultOf(z.record(z.string(), z.boolean())),
|
||||
set_bookmark: resultOf(z.boolean()),
|
||||
|
||||
@@ -79,6 +79,12 @@ export const CAPABILITIES: readonly CapabilityDescriptor[] = Object.freeze(
|
||||
}),
|
||||
limitations: Object.freeze([
|
||||
"Results depend on Hopper's completed static analysis.",
|
||||
...(operation === "list_strings" || operation === "search_strings"
|
||||
? [
|
||||
"String values cover native typed objects. Hopper may split long literals into adjacent unterminated fragments; string searches match each object independently.",
|
||||
"Reported string encodings are inferred from typed bytes and native display; the original source's intended encoding is unknown.",
|
||||
]
|
||||
: []),
|
||||
]),
|
||||
}),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user