koishi-plugin-chatluna-plugin-common
Version:
plugin service for agent mode of chatluna
31 lines (30 loc) • 1.31 kB
TypeScript
import { StructuredTool } from '@langchain/core/tools';
import { Context, h } from 'koishi';
import type { Command as CommandType } from '@satorijs/protocol';
import { ChatLunaPlugin } from 'koishi-plugin-chatluna/services/chat';
import { Config } from '..';
import { ChatLunaToolRunnable } from 'koishi-plugin-chatluna/llm-core/platform/types';
import { CallbackManagerForToolRun } from '@langchain/core/callbacks/manager';
export declare function apply(ctx: Context, config: Config, plugin: ChatLunaPlugin): Promise<void>;
export declare class CommandExecuteTool extends StructuredTool {
ctx: Context;
name: string;
description: string;
private command;
private commandWithSend;
schema: any;
constructor(ctx: Context, name: string, description: string, command: PickCommandType, commandWithSend: boolean);
private generateSchema;
private getZodType;
/** @ignore */
_call(input: any, runManager: CallbackManagerForToolRun, config: ChatLunaToolRunnable): Promise<string>;
private parseInput;
}
export declare function randomString(size: number): string;
export declare function elementToString(elements: h[]): string;
type PickCommandType = Omit<CommandType, 'description'> & {
description?: string;
selector?: string[];
confirm?: boolean;
};
export {};