is_eventin_connected() ) { return $prompt; } return $prompt . $this->feature_prompt(); } /** * Eventin facts the model cannot work out from the admin sitemap. * * Covers: RSVP (a Pro module, turned on at Eventin → Extensions), * creating an event in chat, and where templates are built. * * @return string */ private function feature_prompt(): string { $prompt = "\n## Eventin Feature Facts (authoritative — never contradict these)\n"; $prompt .= "\n### RSVP\n"; $prompt .= "1. RSVP is a Pro module. It only works when Eventin Pro is active AND the 'RSVP Module' card is switched ON at Eventin → Extensions.\n"; $prompt .= "2. ALWAYS name the Extensions page first when the user asks how to create, enable, set up, or manage RSVP, and link it with search-admin-pages (query: 'extensions'). Only then describe the steps below.\n"; $prompt .= "3. Once the module is on, RSVP is added per event: open the event (Eventin → Events → Add Event, or edit an existing event), go to the 'Event tickets' section, open the 'Add Ticket' dropdown and choose 'Add RSVP'.\n"; $prompt .= "4. Each event can hold only one RSVP. After it is added the dropdown item reads 'RSVP (added)' and is disabled.\n"; $prompt .= "5. RSVP options live behind the gear icon on the RSVP item inside the event: extra form fields, hide the purchase form, verify RSVP submission, show RSVP attendees, and the attendee waiting list.\n"; $prompt .= "6. Replies are tracked at Eventin → RSVP Report.\n"; $prompt .= "7. There is NO 'Free / RSVP' ticket type and no RSVP switch in Settings. Never tell the user to set a ticket type to make an event an RSVP event.\n"; $prompt .= "\n### Creating an event through chat\n"; $prompt .= "1. When the user asks you to create, add, set up or plan an event — for example 'Help me to create an event' — build the event yourself with the eventin-create-event tool. Do NOT answer with steps or with a link to the Add Event page, and do NOT call search-admin-pages for this. Only give page steps if the user asks where the screen is or says they want to do it by hand.\n"; $prompt .= "2. First ask for the details you still need, in ONE short message, as a numbered list: event title; date (or start and end date); start and end time; timezone; event type (offline, online or hybrid); venue address for offline or hybrid; meeting link for online or hybrid (say it can be added later).\n"; $prompt .= "3. Do not ask for the description, the FAQ, the banner image, the layout or the ticket. You write the description and the FAQ yourself, and the tool makes the images, the layout and one free ticket.\n"; $prompt .= "4. Ask again only for what is missing. If the user already gave a detail, keep it. If the user says 'you decide' or skips an optional detail, pick a sensible value and move on.\n"; $prompt .= "5. Never invent a date, a time or an address. Those must come from the user.\n"; $prompt .= "6. When you have the required details, call eventin-create-event once. The event is always saved as a draft.\n"; $prompt .= "7. After the event is created, tell the user it is a draft, give them the edit link, and ask one clear question: do they want you to publish it now? Stop there and wait for their answer.\n"; $prompt .= "8. Only when the user says yes, call eventin-publish-event with the event_id that eventin-create-event returned. Never publish without that yes, and never publish an event the user did not ask you to publish.\n"; $prompt .= "9. If the user says no, or wants to check it first, leave it as a draft and say they can ask you to publish it later.\n"; $prompt .= "10. After publishing, confirm the event is live and give the view link.\n"; $prompt .= "11. If the user wants categories or tags on the event, call eventin-list-categories and eventin-list-tags first to get the IDs.\n"; $prompt .= "\n### Event and ticket templates\n"; $prompt .= "1. Event and ticket templates are built at Eventin → Template Builder.\n"; $prompt .= "2. That page has four tabs: Landing page (event templates), Tickets, Certificate, and Speaker.\n"; $prompt .= "3. Templates are not created from the Settings pages. Always link Template Builder with search-admin-pages (query: 'template builder').\n"; return apply_filters( 'aisentic_eventin_feature_prompt', $prompt ); } /** * Add the Eventin settings a voice caller may ask about. * * @param string[] $subjects Setting names from other integrations. * @return string[] */ public function add_voice_setting_subjects( array $subjects ): array { if ( ! $this->is_eventin_connected() ) { return $subjects; } return array_merge( $subjects, self::VOICE_SETTING_SUBJECTS ); } /** * Check that Eventin is active and the integration is connected. * * @return bool */ private function is_eventin_connected(): bool { if ( ! class_exists( 'Wpeventin' ) ) { return false; } $saved = get_option( Integration_Controller::OPTION_KEY, [] ); return 'connected' === ( $saved['eventin']['status'] ?? '' ); } /** * Add Eventin mention resolver to the registry. * * @param array $resolvers Current list of resolvers. * @return array */ public function add_mention_resolvers( array $resolvers ): array { if ( ! class_exists( 'Wpeventin' ) ) { return $resolvers; } $saved = get_option( Integration_Controller::OPTION_KEY, [] ); $status = $saved['eventin']['status'] ?? ''; if ( 'connected' !== $status ) { return $resolvers; } $resolvers[] = new Eventin_Event_Resolver(); $resolvers[] = new Eventin_Speaker_Resolver(); $resolvers[] = new Eventin_Schedule_Resolver(); return $resolvers; } /** * Add Eventin tools to the admin assistant tool pool. * * All Eventin tools are added regardless of the current page so the agent * can discover and use them from any admin screen via tool_search. * * @param array $tools Current list of tools. * @param object $settings Settings instance. * @param string $plugin_context Active plugin context (unused; pool is page-agnostic). * @return array */ public function add_tools( array $tools, $settings, string $plugin_context = '' ): array { if ( ! class_exists( 'Wpeventin' ) ) { return $tools; } $saved = get_option( Integration_Controller::OPTION_KEY, [] ); $status = $saved['eventin']['status'] ?? ''; if ( 'connected' !== $status ) { return $tools; } $tools[] = new Eventin_List_Events_Tool(); $tools[] = new Eventin_Count_Events_Tool(); $tools[] = new Eventin_Event_Summary_Tool(); $tools[] = new Eventin_Count_Bookings_Tool(); $tools[] = new Eventin_Count_Attendees_Tool(); $tools[] = new Eventin_Speakers_Tool(); $tools[] = new Eventin_Organizers_Tool(); $tools[] = new Eventin_Schedules_Tool(); $tools[] = new Eventin_Create_Event_Tool(); $tools[] = new Eventin_Update_Event_Tool(); $tools[] = new Eventin_Publish_Event_Tool(); $tools[] = new Eventin_List_Categories_Tool(); $tools[] = new Eventin_Create_Category_Tool(); $tools[] = new Eventin_Update_Category_Tool(); $tools[] = new Eventin_List_Tags_Tool(); $tools[] = new Eventin_Create_Tag_Tool(); $tools[] = new Eventin_Update_Tag_Tool(); $tools[] = new Eventin_List_Event_Organizers_Tool(); $tools[] = new Eventin_Create_Organizer_Tool(); $tools[] = new Eventin_Update_Organizer_Tool(); $tools[] = new Eventin_List_Event_Speakers_Tool(); $tools[] = new Eventin_Create_Speaker_Tool(); $tools[] = new Eventin_Update_Speaker_Tool(); $tools[] = new Eventin_List_Schedules_Tool(); $tools[] = new Eventin_Get_Schedule_Tool(); $tools[] = new Eventin_Create_Schedule_Tool(); $tools[] = new Eventin_Update_Schedule_Tool(); return $tools; } }