UNPKG

koishi-plugin-chatluna-plugin-common

Version:
69 lines (68 loc) 2.31 kB
import { StructuredTool } from '@langchain/core/tools'; import { Context, Dict, Session, Universal } from 'koishi'; import { ChatLunaPlugin } from 'koishi-plugin-chatluna/services/chat'; import { Config } from '..'; import { z } from 'zod'; import { ChatLunaToolRunnable } from 'koishi-plugin-chatluna/llm-core/platform/types'; export declare function apply(ctx: Context, config: Config, plugin: ChatLunaPlugin): Promise<void>; export declare class CronTool extends StructuredTool { private ctx; private config; private scheduledTasks; private prepareTask; name: string; schema: z.ZodObject<{ action: z.ZodEnum<["create", "get", "cancel"]>; type: z.ZodOptional<z.ZodEnum<["notification", "command"]>>; time: z.ZodOptional<z.ZodString>; content: z.ZodOptional<z.ZodString>; recipient: z.ZodOptional<z.ZodString>; executorUserId: z.ZodOptional<z.ZodString>; taskId: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { type?: "command" | "notification"; time?: string; content?: string; action?: "get" | "create" | "cancel"; recipient?: string; executorUserId?: string; taskId?: number; }, { type?: "command" | "notification"; time?: string; content?: string; action?: "get" | "create" | "cancel"; recipient?: string; executorUserId?: string; taskId?: number; }>; constructor(ctx: Context, config: Config, scheduledTasks: Dict<(() => void)[]>, prepareTask: (task: CronTask, session: Session) => Promise<void>); _call(input: z.infer<typeof this.schema>, _: any, config: ChatLunaToolRunnable): Promise<string>; private listTasks; private cancelTask; private createTask; description: string; } declare module 'koishi' { interface Tables { chatluna_cron_task: CronTask; } } export interface CronTask { id: number; selfId: string; userId: string; groupId?: string; guildId?: string; channelId?: string; type: 'notification' | 'command'; time: Date; lastCall?: Date; interval?: number; content: string; recipient?: string; command?: string; event: Universal.Event; createdAt: Date; executorUserId?: string; }