packfs-core
Version:
Semantic filesystem operations for LLM agent frameworks with natural language understanding. See LLM_AGENT_GUIDE.md for copy-paste examples.
62 lines • 1.9 kB
JavaScript
;
/**
* CrewAI tool implementation for PackFS
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.PackFSCrewAITool = void 0;
class PackFSCrewAITool {
constructor(config = {}) {
this.config = {
toolName: 'packfs_filesystem',
description: 'Secure filesystem operations for CrewAI agents',
...config
};
}
/**
* Get tool definition for CrewAI
*/
getToolDefinition() {
return {
name: this.config.toolName,
description: this.config.description,
func: this.execute.bind(this),
args_schema: {
operation: {
type: 'string',
description: 'Filesystem operation (read, write, list, exists, stat)'
},
path: {
type: 'string',
description: 'File or directory path'
},
content: {
type: 'string',
description: 'Content for write operations',
optional: true
}
}
};
}
/**
* Execute filesystem operation
*/
async execute(operation, path, _content) {
// Stub implementation
switch (operation) {
case 'read':
return `Reading file: ${path}`;
case 'write':
return `Writing to file: ${path}`;
case 'list':
return `Listing directory: ${path}`;
case 'exists':
return `Checking existence: ${path}`;
case 'stat':
return `Getting stats: ${path}`;
default:
throw new Error(`Unknown operation: ${operation}`);
}
}
}
exports.PackFSCrewAITool = PackFSCrewAITool;
//# sourceMappingURL=tool.js.map