[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ai-client/ -> class-wp-ai-client-ability-function-resolver.php (summary)

WP AI Client: WP_AI_Client_Ability_Function_Resolver class

File Size: 232 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_AI_Client_Ability_Function_Resolver:: (7 methods):
  __construct()
  is_ability_call()
  execute_ability()
  has_ability_calls()
  execute_abilities()
  ability_name_to_function_name()
  function_name_to_ability_name()


Class: WP_AI_Client_Ability_Function_Resolver  - X-Ref

Resolves and executes WordPress Abilities API function calls from AI models.

This class must be instantiated with the specific abilities that the AI model
is allowed to execute, ensuring that only explicitly specified abilities can
be called. This prevents the model from executing arbitrary abilities.

__construct( ...$abilities )   X-Ref
Constructor.

param: WP_Ability|string ...$abilities The abilities that this resolver is allowed to execute.

is_ability_call( FunctionCall $call )   X-Ref
Checks if a function call is an ability call.

return: bool True if the function call is an ability call, false otherwise.
param: FunctionCall $call The function call to check.

execute_ability( FunctionCall $call )   X-Ref
Executes a WordPress ability from a function call.

Only abilities that were specified in the constructor are allowed to be
executed. If the ability is not in the allowed list, an error response
with code `ability_not_allowed` is returned.

return: FunctionResponse The response from executing the ability.
param: FunctionCall $call The function call to execute.

has_ability_calls( Message $message )   X-Ref
Checks if a message contains any ability function calls.

return: bool True if the message contains ability calls, false otherwise.
param: Message $message The message to check.

execute_abilities( Message $message )   X-Ref
Executes all ability function calls in a message.

return: Message A new message with function responses.
param: Message $message The message containing function calls.

ability_name_to_function_name( string $ability_name )   X-Ref
Converts an ability name to a function name.

Transforms "tec/create_event" to "wpab__tec__create_event".

return: string The function name.
param: string $ability_name The ability name to convert.

function_name_to_ability_name( string $function_name )   X-Ref
Converts a function name to an ability name.

Transforms "wpab__tec__create_event" to "tec/create_event".

return: string The ability name.
param: string $function_name The function name to convert.



Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref