| 32 | process.env.TOOLS.split(',').map(t=>t.trim()).filter(Boolean) : []; |
| 33 | |
| 34 | function build_allowed_tools(groups = [], custom_tools = []){ |
| 35 | const allowed = new Set(); |
| 36 | for (const group_id of groups) |
| 37 | { |
| 38 | const group = Object.values(GROUPS) |
| 39 | .find(g=>g.id===group_id); |
| 40 | if (!group) |
| 41 | continue; |
| 42 | for (const tool of group.tools) |
| 43 | allowed.add(tool); |
| 44 | } |
| 45 | for (const tool of custom_tools) |
| 46 | allowed.add(tool); |
| 47 | return allowed; |
| 48 | } |
| 49 | |
| 50 | const allowed_tools = build_allowed_tools(tool_groups, custom_tools); |
| 51 | function parse_rate_limit(rate_limit_str) { |