fix(native): distinguish batch selectors from resolved entries

This commit is contained in:
N0zoM1z0
2026-10-09 19:09:30 +08:00
parent 6cc817e8bd
commit bfaa5a6c2c
9 changed files with 281 additions and 13 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ export const ENHANCED_TOOL_CONTRACTS = [
),
enhanced(
"batch_decompile",
"Decompile each explicit procedure symbol or address concurrently. Returns ordered per-item success or error results and aggregate counts.",
"Decompile each explicit procedure symbol or address concurrently. Preserves each input selector in address and reports the observed canonical entry and entry label in procedure; identity or label failures remain explicit without discarding usable pseudocode. Returns ordered per-item success or error results and aggregate counts.",
enhancedInputSchemas.batch_decompile,
),
enhanced(
+25 -2
View File
@@ -245,6 +245,23 @@ const callPathTraceOutput = resultOf(
}),
);
/** Identity facts attached to one requested batch selector. */
const batchProcedureIdentity = z.discriminatedUnion("status", [
z.object({
status: z.literal("resolved"),
address: z.string().min(1).describe("Observed canonical procedure entry."),
name: z
.string()
.nullable()
.describe("Provider's entry label, or null when unavailable."),
name_error: analysisErrorProjectionSchema.optional(),
}),
z.object({
status: z.literal("unknown"),
error: analysisErrorProjectionSchema,
}),
]);
/** Exact structured-content schemas for composed analysis workflows. */
export const enhancedOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
inspect_native_dispatch_metadata: resultOf(
@@ -259,12 +276,18 @@ export const enhancedOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
items: z.array(
z.discriminatedUnion("status", [
z.object({
address: z.string(),
address: z
.string()
.describe("Original caller-selected symbol or address."),
procedure: batchProcedureIdentity,
status: z.literal("ok"),
pseudocode: z.string().min(1),
}),
z.object({
address: z.string(),
address: z
.string()
.describe("Original caller-selected symbol or address."),
procedure: batchProcedureIdentity,
status: z.literal("error"),
error: analysisErrorProjectionSchema,
}),