Plugin Directory

Changeset 3810832


Ignore:
Timestamp:
11/19/2026 06:53:21 AM (less than one hour ago)
Author:
ibsofts
Message:

Update public JavaScript for version 1.0.8

Location:
ibs-webmcp-gateway
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ibs-webmcp-gateway/tags/1.0.8/public/js/ibs-webmcp-gateway-public.js

    r3804794 r3810832  
    1717
    1818    cartTokenKey: "ibs_webmcp_gateway_cart_token",
     19
     20    debug: false,
    1921  };
    2022
    … …  
    2729  class IbsWebMCPGatewayLogger {
    2830    static log(...args) {
     31      if (!CONFIG.debug) {
     32        return;
     33      }
     34
    2935      console.log("[ibsWebMCPGateway]", ...args);
    3036    }
    … …  
    19081914      if (!this.supported()) {
    19091915        IbsWebMCPGatewayLogger.warn("ModelContext API unavailable");
    1910 
    19111916        return;
    19121917      }
    19131918
    19141919      let registeredCount = 0;
     1920      let skippedCount = 0;
    19151921
    19161922      for (const tool of registry.getAll()) {
     1923        /*
     1924         * Form integration tools are registered directly by their
     1925         * respective add-on plugins.
     1926         *
     1927         * Avoid registering them again through the Gateway.
     1928         */
     1929        const formGroups = [
     1930          "form",
     1931          "forms",
     1932          "form_tools",
     1933          "wpforms",
     1934          "ninja_forms",
     1935          "gravity_forms",
     1936          "contact_form_7",
     1937        ];
     1938
     1939        if (formGroups.includes(String(tool.group || "").toLowerCase())) {
     1940          skippedCount++;
     1941
     1942          IbsWebMCPGatewayLogger.log(
     1943            `Skipping duplicate registration for ${tool.name}; handled by its form add-on.`,
     1944          );
     1945
     1946          continue;
     1947        }
     1948
    19171949        try {
    19181950          await modelContext.registerTool({
    … …  
    19301962
    19311963            execute: async (input = {}, { signal } = {}) => {
    1932               // WebMCP passes the input object directly.
    19331964              const params =
    19341965                input && typeof input === "object" && !Array.isArray(input)
    … …  
    19361967                  : {};
    19371968
    1938               // Do not log customer inputs or coupon codes.
    19391969              IbsWebMCPGatewayLogger.log("WebMCP tool invoked:", tool.name);
    19401970
    … …  
    19461976            },
    19471977          });
     1978
    19481979          registeredCount++;
    19491980        } catch (error) {
    … …  
    19551986      }
    19561987
    1957       // IbsWebMCPGatewayLogger.log(`${registeredCount} WebMCP tools registered`);
     1988      IbsWebMCPGatewayLogger.log(
     1989        `Gateway tools registered: ${registeredCount}, form tools skipped: ${skippedCount}`,
     1990      );
    19581991    }
    19591992
  • ibs-webmcp-gateway/trunk/public/js/ibs-webmcp-gateway-public.js

    r3781783 r3810832  
    1717
    1818    cartTokenKey: "ibs_webmcp_gateway_cart_token",
     19
     20    debug: false,
    1921  };
    2022
    … …  
    2729  class IbsWebMCPGatewayLogger {
    2830    static log(...args) {
     31      if (!CONFIG.debug) {
     32        return;
     33      }
     34
    2935      console.log("[ibsWebMCPGateway]", ...args);
    3036    }
    … …  
    19081914      if (!this.supported()) {
    19091915        IbsWebMCPGatewayLogger.warn("ModelContext API unavailable");
    1910 
    19111916        return;
    19121917      }
    19131918
    19141919      let registeredCount = 0;
     1920      let skippedCount = 0;
    19151921
    19161922      for (const tool of registry.getAll()) {
     1923        /*
     1924         * Form integration tools are registered directly by their
     1925         * respective add-on plugins.
     1926         *
     1927         * Avoid registering them again through the Gateway.
     1928         */
     1929        const formGroups = [
     1930          "form",
     1931          "forms",
     1932          "form_tools",
     1933          "wpforms",
     1934          "ninja_forms",
     1935          "gravity_forms",
     1936          "contact_form_7",
     1937        ];
     1938
     1939        if (formGroups.includes(String(tool.group || "").toLowerCase())) {
     1940          skippedCount++;
     1941
     1942          IbsWebMCPGatewayLogger.log(
     1943            `Skipping duplicate registration for ${tool.name}; handled by its form add-on.`,
     1944          );
     1945
     1946          continue;
     1947        }
     1948
    19171949        try {
    19181950          await modelContext.registerTool({
    … …  
    19301962
    19311963            execute: async (input = {}, { signal } = {}) => {
    1932               // WebMCP passes the input object directly.
    19331964              const params =
    19341965                input && typeof input === "object" && !Array.isArray(input)
    … …  
    19361967                  : {};
    19371968
    1938               // Do not log customer inputs or coupon codes.
    19391969              IbsWebMCPGatewayLogger.log("WebMCP tool invoked:", tool.name);
    19401970
    … …  
    19461976            },
    19471977          });
     1978
    19481979          registeredCount++;
    19491980        } catch (error) {
    … …  
    19551986      }
    19561987
    1957       // IbsWebMCPGatewayLogger.log(`${registeredCount} WebMCP tools registered`);
     1988      IbsWebMCPGatewayLogger.log(
     1989        `Gateway tools registered: ${registeredCount}, form tools skipped: ${skippedCount}`,
     1990      );
    19581991    }
    19591992
Note: See TracChangeset for help on using the changeset viewer.