import type { InstructionRecord, InstructionCategory } from "../parser/instructions.js"; /** A lightweight row returned by list / search (no signature/anchors). */ export interface InstructionSummary { mnemonic: string; opcodes: number[]; category: InstructionCategory; version: string; /** Whether this instruction can trap at runtime (see instruction_get for conditions). */ can_trap: boolean; } export declare function toSummary(r: InstructionRecord): InstructionSummary; /** Format a byte array as the conventional space-separated hex string, * e.g. `[0xFD, 0x89, 0x02]` → `"0xfd 0x89 0x02"`. */ export declare function formatOpcode(opcodes: number[]): string; /** Parse a user-supplied opcode string into a byte array. Accepts * `"0x6a"`, `"6a"`, `"0xFD 0x89 0x02"`, `"fd 89 02"`, `"fd,89,02"`. * Returns null if any token isn't a 0–255 hex byte. */ export declare function parseOpcodeQuery(input: string): number[] | null; /** * Look up one instruction by mnemonic (exact, case-insensitive) or * by binary opcode. Mnemonic is tried first; if the query parses as * a byte sequence, an exact opcode match is tried too. Returns the * matched record or null. */ export declare function getInstruction(records: InstructionRecord[], query: { mnemonic?: string; opcode?: string; }): InstructionRecord | null; export interface ListFilter { category?: InstructionCategory; version?: string; /** Substring matched against the mnemonic prefix, case-insensitive. */ prefix?: string; /** When set, keep only instructions that can (true) / cannot (false) trap. */ can_trap?: boolean; } /** Enumerate instructions, optionally filtered, sorted by opcode. */ export declare function listInstructions(records: InstructionRecord[], filter?: ListFilter): InstructionSummary[]; export interface InstructionSearchHit extends InstructionSummary { /** Which field produced the strongest match. */ matched_on: "mnemonic-exact" | "mnemonic-substring" | "category" | "opcode"; /** Relevance score (0–100). Higher = stronger. */ score: number; } /** * Search instructions by free-text query. Matches the mnemonic * (exact > substring), the category name, and the formatted opcode. * Ranked highest-first; ties broken by opcode order. */ export declare function searchInstructions(records: InstructionRecord[], query: string, limit?: number): InstructionSearchHit[];