( matchId: string, policies: readonly ToolkitPolicyResponse[], requiresApproval?: boolean, )
| 137 | }; |
| 138 | |
| 139 | const resolveToolkitPolicy = ( |
| 140 | matchId: string, |
| 141 | policies: readonly ToolkitPolicyResponse[], |
| 142 | requiresApproval?: boolean, |
| 143 | ): EffectivePolicy => { |
| 144 | for (const policy of [...policies].sort(comparePolicy)) { |
| 145 | if (!matchPattern(policy.pattern, matchId)) continue; |
| 146 | return { |
| 147 | action: policy.action, |
| 148 | source: "user", |
| 149 | pattern: policy.pattern, |
| 150 | policyId: policy.id, |
| 151 | }; |
| 152 | } |
| 153 | return pluginDefaultPolicy(requiresApproval); |
| 154 | }; |
| 155 | |
| 156 | const toolMatchId = (tool: ToolRow): string => |
| 157 | tool.static ? String(tool.address) : String(tool.address).replace(/^tools\./, ""); |
no test coverage detected