import type { ToolRuntime } from "@langchain/core/tools"; import type { RuntimeIdentity } from "../identity/index.js"; import type { RuntimeChannel } from "../channels/types.js"; import type { RuntimeConfigLike } from "./identity-runtime.js"; export type { RuntimeConfigLike } from "./identity-runtime.js"; /** * A LangChain/LangGraph tool from MDA's perspective: the only surface the runtime * seam touches is `invoke(input, runtime)`. Kept structural so the wrapper works * across `DynamicStructuredTool`, MCP tools, and any other tool shape. */ export interface InvokableTool { invoke(input: unknown, runtime?: RuntimeConfigLike): unknown; } /** The managed primitives MDA layers onto the tool runtime. */ export interface ManagedRuntimeExtras { identity?: RuntimeIdentity; /** * Present only for channel-originated runs. Ordinary HTTP and schedule runs * leave this undefined. */ channel?: RuntimeChannel; } /** * The runtime surface managed Deep Agent tools receive: LangGraph's * {@link ToolRuntime} plus MDA-managed primitives such as `identity`. * * Annotate the second parameter of a `tool(...)` handler when you need the * frozen identity envelope for the current run. */ export interface ManagedDeepAgentRuntime extends ToolRuntime, ManagedRuntimeExtras { } /** * The fields MDA overlays onto the runtime a tool/middleware hook receives: * the frozen `identity` (when an actor resolved) and a `configurable` with the * reserved identity keys stripped so downstream code can't read a * client-spoofed `actor_id`/`tenant_id`. Returns an empty object when there is * nothing to change, so the original runtime passes through untouched. */ export declare function managedRuntimeOverrides(runtime: RuntimeConfigLike | undefined): ManagedRuntimeExtras & { configurable?: Record; }; /** * Wrap a tool so its runtime carries the managed primitives (`runtime.identity`, * …) without changing its name, schema, or class. * * Augments `invoke` (for LangGraph's `ToolNode`) and patches a shallow copy's * internal `func`/`coroutine` so identity reaches the authored handler even when * LangChain rewrites the runtime into a RunnableConfig before calling the tool * function. The original tool instance is left untouched. */ export declare function withManagedRuntime(managedTool: T): T; /** Wrap every tool in a list with {@link withManagedRuntime}. */ export declare function wrapToolsWithManagedRuntime(tools: readonly T[]): T[]; //# sourceMappingURL=managed-tools.d.ts.map