fcbfab765b
- Removed custom TypeScript path aliases and the associated transformation script. - Replaced aliased imports with direct `@oh-my-pi` package imports for improved clarity. - Simplified internal module references by removing explicit `/index` suffixes.
39 lines
905 B
TypeScript
39 lines
905 B
TypeScript
/**
|
|
* Custom Tools Capability
|
|
*
|
|
* User-defined tools that extend agent capabilities.
|
|
*/
|
|
|
|
import { defineCapability } from ".";
|
|
import type { SourceMeta } from "./types";
|
|
|
|
/**
|
|
* A custom tool definition.
|
|
*/
|
|
export interface CustomTool {
|
|
/** Tool name (unique key) */
|
|
name: string;
|
|
/** Absolute path to tool definition file */
|
|
path: string;
|
|
/** Tool description */
|
|
description?: string;
|
|
/** Tool implementation (script path or inline) */
|
|
implementation?: string;
|
|
/** Source level */
|
|
level: "user" | "project";
|
|
/** Source metadata */
|
|
_source: SourceMeta;
|
|
}
|
|
|
|
export const toolCapability = defineCapability<CustomTool>({
|
|
id: "tools",
|
|
displayName: "Custom Tools",
|
|
description: "User-defined tools that extend agent capabilities",
|
|
key: (tool) => tool.name,
|
|
validate: (tool) => {
|
|
if (!tool.name) return "Missing name";
|
|
if (!tool.path) return "Missing path";
|
|
return undefined;
|
|
},
|
|
});
|