(options: CreateAIToolsOptions)
| 18 | } |
| 19 | |
| 20 | export function createAITools(options: CreateAIToolsOptions): ToolSet { |
| 21 | const store = new WorkspaceFileStore(options.workspace); |
| 22 | const tools: ToolSet = { |
| 23 | read: createReadTool({ store, ...options.read }), |
| 24 | ls: createListTool({ workspace: options.workspace }), |
| 25 | }; |
| 26 | |
| 27 | if (options.readonly === true) return tools; |
| 28 | |
| 29 | tools.write = createWriteTool({ store, ...options.write }); |
| 30 | tools.edit = createEditTool({ store, ...options.edit }); |
| 31 | |
| 32 | if (options.shell !== undefined) { |
| 33 | tools.exec = createExecTool({ |
| 34 | workspace: options.workspace as ExecWorkspaceLike, |
| 35 | ...options.shell, |
| 36 | }); |
| 37 | } |
| 38 | |
| 39 | if (options.assets !== false && options.workspace.assets !== undefined) { |
| 40 | tools.publish = createPublishTool({ workspace: options.workspace as PublishWorkspaceLike }); |
| 41 | } |
| 42 | |
| 43 | return tools; |
| 44 | } |
no test coverage detected