import { DynamicStructuredTool } from "@langchain/core/tools"; import { z } from "zod"; import { ToolFactory, ToolCallRecord, UserContext } from "./tool.factory"; import { ToolFieldFormatterService } from "../services/field-formatting"; import { GraphCatalogService } from "../services/graph.catalog.service"; import { EntityServiceRegistry } from "../../../common/registries/entity.service.registry"; import { ScopeGuard } from "../services/scope.guard"; import { RelatedEdgesService } from "../services/related-edges.service"; declare const FilterOpEnum: z.ZodEnum<{ in: "in"; eq: "eq"; ne: "ne"; like: "like"; gt: "gt"; gte: "gte"; lt: "lt"; lte: "lte"; isNull: "isNull"; isNotNull: "isNotNull"; }>; declare const inputSchema: z.ZodObject<{ fromType: z.ZodString; fromId: z.ZodString; relationship: z.ZodString; filters: z.ZodOptional; sort: z.ZodOptional; limit: z.ZodOptional; }, z.core.$strip>; export { inputSchema as traverseInputSchema }; export interface NormalisedSort { field: string; direction: "asc" | "desc"; } export type NormalisedFilterValue = string | number | boolean | string[] | number[]; export interface NormalisedFilter { field: string; op: z.infer; value?: NormalisedFilterValue; } /** * Coerce any LLM-emitted sort shape into an array of {field, direction}. * Accepts: * [{field:"date", direction:"desc"}] — canonical * {field:"date", direction:"desc"} — single object * {date:"desc"} — map form * [{date:"desc"}, {name:"asc"}] — array of maps * "date" — bare field (asc default) * "date desc" — bare field with direction * ["date", "name desc"] — array of strings */ export declare function coerceSort(raw: unknown): NormalisedSort[]; /** * Coerce any LLM-emitted filters shape into an array of {field, op, value}. * Accepts the canonical shape or a single object. */ export declare function coerceFilters(raw: unknown): NormalisedFilter[]; export declare class TraverseTool { private readonly factory; private readonly catalog; private readonly registry; private readonly scopeGuard; private readonly formatter; private readonly relatedEdges; constructor(factory: ToolFactory, catalog: GraphCatalogService, registry: EntityServiceRegistry, scopeGuard: ScopeGuard, formatter: ToolFieldFormatterService, relatedEdges: RelatedEdgesService); build(ctx: UserContext, recorder: ToolCallRecord[]): DynamicStructuredTool; invoke(input: z.infer, ctx: UserContext, recorder: ToolCallRecord[]): Promise; /** * Polymorphic traversal: one edge label, no single target type. The edge * lookup returns bare ids + labels; every surviving row is then re-read * through its OWN type's service, so tenancy stays in the repository layer * and each item is projected with its own type's stage-1 fields. * * Silent drops (unknown label, module-gated type, out-of-scope record) match * the materialise-bridge contract: the model is never told a record exists * that it may not see. */ private invokePolymorphic; /** * Drop records outside the run's scope. An unscoped run short-circuits * before the guard is consulted — the same contract ScopeGuard.filter * applies internally, restated here so an unscoped run never depends on it. */ private filterInScope; } //# sourceMappingURL=traverse.tool.d.ts.map