UNPKG

agents

Version:

A home for your AI agents

73 lines (72 loc) 2.7 kB
//#region src/callable-decorator.d.ts /** * The `@callable()` method decorator and its metadata registry. * * Consumed by Agent's legacy JSON RPC protocol and, as a fallback * interface source, by the WebSockets capability's Cap'n Web callables * endpoint. Kept dependency-free so both can import it without cycles. */ /** * Metadata for a callable method */ type CallableMetadata = { /** Optional description of what the method does */ description?: string /** Whether the method supports streaming responses */; streaming?: boolean; }; /** * Decorator that marks a method as callable by clients * @param metadata Optional metadata about the callable method */ declare function callable( metadata?: CallableMetadata ): <This, Args extends unknown[], Return>( target: (this: This, ...args: Args) => Return, _context: ClassMethodDecoratorContext ) => (this: This, ...args: Args) => Return; /** * Decorator that marks a method as callable by clients * @deprecated this has been renamed to callable, and unstable_callable will be removed in the next major version * @param metadata Optional metadata about the callable method */ declare const unstable_callable: ( metadata?: CallableMetadata ) => <This, Args extends unknown[], Return>( target: (this: This, ...args: Args) => Return, _context: ClassMethodDecoratorContext ) => (this: This, ...args: Args) => Return; /** @internal Read the metadata registered for a decorated method. */ declare function getCallableMetadata( method: Function ): CallableMetadata | undefined; /** @internal Whether a method was registered with `@callable()`. */ declare function isCallableMethod(method: Function): boolean; /** * @internal Preserve registration when a framework wraps a decorated * method (e.g. Agent's context auto-wrapping). */ declare function copyCallableMetadata(source: Function, target: Function): void; /** * Every `@callable()`-registered method reachable on a host's prototype * chain, with its metadata. The nearest declaration wins when a * subclass overrides a decorated parent method. * * The canonical decorator scan — Agent introspection and the WebSockets * capability's decorator-fallback target both consume it. * * @param host - The object whose prototype chain is scanned. * @returns Method names mapped to their registered metadata. */ declare function decoratedMethods( host: object ): ReadonlyMap<string, CallableMetadata>; //#endregion export { getCallableMetadata as a, decoratedMethods as i, callable as n, isCallableMethod as o, copyCallableMetadata as r, unstable_callable as s, CallableMetadata as t }; //# sourceMappingURL=callable-decorator-DP__HhBA.d.ts.map