/** * Graph Model v2 — Data Passthrough Transform * * Version: 2.0 * Date: 2026-07-25 * * Pure, side-effect-free application of an edge's `data_passthrough` * ({@link DataMapping}) to an {@link EdgePayload} before it is handed * downstream. The engine calls this once per activating edge so each * downstream edge can reshape the same upstream result independently. * * Semantics: * - `maxChars` truncates `payload.result` to at most N characters. * - `exclude` removes artifact paths whose full path or basename matches an * excluded name, and — when `payload.result` is parseable JSON — drops the * matching top-level keys from the JSON object. * * The module holds no state and mutates nothing: a payload that needs no * transformation is returned by reference (identity preserved); a payload that * does need a transformation is cloned shallowly first. * * Design reference: .rolebox/design/tool-merge-map.md §2.2 (data_passthrough). */ import type { EdgePayload } from "../../types.engine-v2.ts"; import type { DataMapping } from "../../types.graph-v2.ts"; /** * Apply an edge's {@link DataMapping} to an upstream payload. * * Application order (each step operates on the output of the previous): * 1. `fields` (include whitelist) — when non-empty, keep only the * whitelisted top-level keys from `payload.result` (parsed as JSON). * Non-JSON / non-object results pass through unchanged. * 2. `exclude` — strip matching top-level JSON keys and artifact paths. * 3. `maxChars` — truncate `payload.result` after both key-level * transforms have been applied. * * A `mapping` that is undefined or carries no applicable field is a no-op and * returns the payload by reference. Otherwise the payload is shallow-cloned and * its `result` (whitelisted / key-stripped / truncated) and `artifacts` * (filtered) are updated. `fromNode`, `fromSignal`, and `budgetConsumed` are * untouched. * * @param payload - the upstream {@link EdgePayload}. * @param mapping - the edge's data passthrough mapping (optional). * @returns the transformed payload (a clone when a change applied, otherwise * the same reference). */ export declare function applyDataMapping(payload: EdgePayload, mapping?: DataMapping): EdgePayload; //# sourceMappingURL=data-mapping-transform.d.ts.map