/** * Caller-controlled field selection on any result. * * Some reads on this surface are large by nature. `level(get_component_tree)` * on a character dumps every component with transforms, collision, materials * and tags; `asset(bulk_read_properties)` answers a library-wide question * across hundreds of assets. An agent that wanted one number out of either has * to pay for all of it, and the cost lands in a context window rather than on * a wire, so it is not recoverable later in the conversation. * * Every category therefore accepts two routing parameters: * * select keep only these paths * omit drop these paths * * Both are dotted paths, and both traverse arrays transparently: on a result * shaped `{components: [{name, transform: {...}}]}`, `components.name` keeps * the name of every component. That is the spelling an agent reaches for, and * requiring `components[].name` would mostly produce a silent empty result. * * A path that matches nothing is reported back rather than ignored, because * the failure it causes otherwise is a caller concluding a field is absent * from the data when it only misspelled the path. * * These are routing parameters, like `timeoutMs`: dispatch reads them and * strips them, so they can never reach a bridge method as an argument. */ export interface FieldSelection { select?: string[]; omit?: string[]; } export interface ProjectionResult { result: T; /** Requested paths that matched nothing, so a typo is visible. */ notFound: string[]; /** Whether anything was actually filtered. */ applied: boolean; } /** Read the selection out of a parameter bag, accepting a bare string for one path. */ export declare function takeFieldSelection(params: Record): { selection: FieldSelection; rest: Record; }; /** * Apply a selection to a result. * * `select` runs before `omit`, so asking to keep a subtree and drop one field * inside it does what it reads like. A selection that would empty the result * entirely is NOT applied: handing back `{}` with no explanation is worse than * handing back the data, and the unmatched paths say what went wrong. */ export declare function projectResult(result: T, selection: FieldSelection): ProjectionResult; /** * Attach the report of unmatched paths, so a misspelling is visible rather * than reading as absent data. */ export declare function attachFieldReport(result: T, projection: ProjectionResult): T;