| 203 | } |
| 204 | |
| 205 | fn script_allowed_tools(args: &serde_json::Value, registry: &ToolRegistry) -> HashSet<String> { |
| 206 | let mut allowed = args |
| 207 | .get("allowed_tools") |
| 208 | .and_then(|value| value.as_array()) |
| 209 | .map(|items| { |
| 210 | items |
| 211 | .iter() |
| 212 | .filter_map(|item| item.as_str()) |
| 213 | .map(ToString::to_string) |
| 214 | .collect::<HashSet<_>>() |
| 215 | }) |
| 216 | .unwrap_or_else(|| registry.list().into_iter().collect()); |
| 217 | |
| 218 | allowed.remove("program"); |
| 219 | // `task`/`parallel_task` ARE allowed in PTC scripts now: host tool calls run |
| 220 | // on the outer multi-threaded runtime (see execute_host_tool_json), so |
| 221 | // `ctx.tool("parallel_task", …)` fans out child agents in parallel. |
| 222 | allowed |
| 223 | } |
| 224 | |
| 225 | fn script_limits(args: &serde_json::Value) -> ScriptLimits { |
| 226 | args.get("limits") |