string, 'role' => 'assistant', * 'external_ref' => string ]. Non-relayable events (bot echoes, private * notes, non-message events) yield an empty array. * end_handoff( $ref ) : true|WP_Error * Resolve/close the external conversation (control returns to the bot). * verify_webhook( $request ) : bool * Authenticate an inbound webhook (shared secret / HMAC / capability). * Fail-closed: unverifiable requests return false and are rejected. * * @package WP_AI_Workflows */ if ( ! defined( 'ABSPATH' ) ) { exit; } interface WP_AI_Workflows_Handoff_Provider { /** * @param array $conversation { session_id, workflow_id }. * @param array $transcript Ordered [ { role, content } ] turns. * @param array $metadata { customer, summary, kb_refs, reason, ... }. * @return string|WP_Error External reference on success. */ public function start_handoff( array $conversation, array $transcript, array $metadata ); /** * @param string $ref External reference from start_handoff(). * @param string $message Visitor message to relay to the human. * @return true|WP_Error */ public function send_to_human( $ref, $message ); /** * @param array $payload Decoded inbound webhook body. * @return array */ public function receive_inbound( array $payload ); /** * @param string $ref External reference from start_handoff(). * @return true|WP_Error */ public function end_handoff( $ref ); /** * @param WP_REST_Request $request Inbound webhook request. * @return bool True when authentic (fail-closed). */ public function verify_webhook( $request ); }