@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
136 lines (135 loc) • 4.02 kB
TypeScript
/**
* Built-in agent tools for TaskManager.
*
* These tools allow the AI to self-schedule, manage, and inspect tasks
* during conversations. Created per-instance via `createTaskTools()` factory,
* following the same pattern as `createFileTools()` in files/fileTools.ts.
*
* @module tasks/tools/taskTools
*/
import type { TaskManager } from "../taskManager.js";
import type { TaskSchedule } from "../../types/index.js";
/**
* Create task management tools bound to a TaskManager instance.
*
* These tools follow the same factory pattern as `createFileTools()` in
* `src/lib/files/fileTools.ts`. The `manager` is captured via closure,
* eliminating the need for module-level singleton state.
*
* @param manager - The TaskManager instance to bind to
* @returns Record of tool name to tool definition
*
* @example
* ```typescript
* const manager = new TaskManager(neurolink, config);
* const tools = createTaskTools(manager);
* // tools.createTask, tools.listTasks, tools.getTaskRuns, etc.
* ```
*/
export declare function createTaskTools(manager: TaskManager): {
createTask: import("ai").Tool<{
name: string;
prompt: string;
schedule: {
type: "once" | "cron" | "interval";
expression?: string | undefined;
timezone?: string | undefined;
every?: number | undefined;
at?: string | undefined;
};
mode?: "isolated" | "continuation" | undefined;
}, {
success: boolean;
taskId: string;
name: string;
status: import("../../index.js").TaskStatus;
mode: import("../../index.js").TaskExecutionMode;
nextRunAt: string | undefined;
schedule: TaskSchedule;
error?: undefined;
} | {
success: boolean;
error: string;
taskId?: undefined;
name?: undefined;
status?: undefined;
mode?: undefined;
nextRunAt?: undefined;
schedule?: undefined;
}>;
listTasks: import("ai").Tool<{
status?: "failed" | "pending" | "completed" | "cancelled" | "active" | "paused" | undefined;
}, {
success: boolean;
count: number;
tasks: {
taskId: string;
name: string;
status: import("../../index.js").TaskStatus;
mode: import("../../index.js").TaskExecutionMode;
schedule: TaskSchedule;
runCount: number;
lastRunAt: string | undefined;
nextRunAt: string | undefined;
}[];
error?: undefined;
} | {
success: boolean;
error: string;
count?: undefined;
tasks?: undefined;
}>;
getTaskRuns: import("ai").Tool<{
taskId: string;
limit?: number | undefined;
}, {
success: boolean;
taskId: string;
count: number;
runs: {
runId: string;
status: "error" | "success";
output: string | undefined;
durationMs: number;
timestamp: string;
error: string | undefined;
}[];
error?: undefined;
} | {
success: boolean;
error: string;
taskId?: undefined;
count?: undefined;
runs?: undefined;
}>;
deleteTask: import("ai").Tool<{
taskId: string;
}, {
success: boolean;
error: string;
deletedTask?: undefined;
taskId?: undefined;
} | {
success: boolean;
deletedTask: string;
taskId: string;
error?: undefined;
}>;
runTaskNow: import("ai").Tool<{
taskId: string;
}, {
success: boolean;
runId: string;
status: "error" | "success";
output: string | undefined;
durationMs: number;
error: string | undefined;
} | {
success: boolean;
error: string;
runId?: undefined;
status?: undefined;
output?: undefined;
durationMs?: undefined;
}>;
};