Plugin Directory


Ignore:
Timestamp:
11/03/2026 11:52:29 PM (23 hours ago)
Author:
meumouse
Message:

Release 2.7.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • joinotify/trunk/admin/src/AI/Workflow_Generator.php

    r3771693 r3782814  
    269269     *
    270270     * @since 2.0.0
     271     * @version 2.7.0
    271272     * @return string
    272273     */
    273274    protected static function build_actions_reference() {
    274275        $catalog = Registry::get_actions_catalog();
     276        $excluded = self::get_excluded_action_slugs();
    275277        $lines = array();
    276278
    … …  
    278280            $slug = $action['action'] ?? '';
    279281
    280             if ( '' === $slug ) {
     282            if ( '' === $slug || isset( $excluded[ $slug ] ) ) {
    281283                continue;
    282284            }
    … …  
    717719     * Set of action slugs currently registered in the plugin.
    718720     *
     721     * Leaves out the actions the AI may not use (see get_excluded_action_slugs()), so a
     722     * generated node of one of them is dropped like a hallucinated slug.
     723     *
    719724     * @since 2.1.0
     725     * @version 2.7.0
    720726     * @return array<string,bool> Map of slug => true for O(1) lookups.
    721727     */
    722728    protected static function get_registered_action_slugs() {
    723729        $slugs = array();
     730        $excluded = self::get_excluded_action_slugs();
    724731
    725732        foreach ( Registry::get_actions_catalog() as $action ) {
    726             if ( ! empty( $action['action'] ) ) {
     733            if ( ! empty( $action['action'] ) && ! isset( $excluded[ (string) $action['action'] ] ) ) {
    727734                $slugs[ (string) $action['action'] ] = true;
    728735            }
    … …  
    730737
    731738        return $slugs;
     739    }
     740
     741
     742    /**
     743     * Action slugs the AI never puts in a workflow.
     744     *
     745     * The "HTTP request" action sends the store's data, and a credential, to the address it is
     746     * given: a prompt that can steer the model — a product name, a form entry — must not be able
     747     * to choose that address. The user adds the node by hand.
     748     *
     749     * @since 2.7.0
     750     * @return array<string,bool> Map of slug => true.
     751     */
     752    protected static function get_excluded_action_slugs() {
     753        /**
     754         * Filter the action slugs the AI workflow generator never uses.
     755         *
     756         * @since 2.7.0
     757         * @param array $slugs
     758         */
     759        $slugs = apply_filters( 'Joinotify/AI/Workflow_Generator/Excluded_Actions', array( 'http_request' ) );
     760
     761        return array_fill_keys( array_map( 'strval', is_array( $slugs ) ? $slugs : array() ), true );
    732762    }
    733763
Note: See TracChangeset for help on using the changeset viewer.