Skip to content

Commit 71d39bc

Browse files
superdav42claude
andcommitted
v1.1.0: rename provider id to ultimate-ai-connector-anthropic-max + fix render clobber
This commit makes two coordinated changes that have to ship together: 1. RENAME the AI Client provider id from 'anthropic-max' to 'ultimate-ai-connector-anthropic-max', and the JS registerConnector() slug from 'ai-provider-for-anthropic-max/connector' to the same 'ultimate-ai-connector-anthropic-max'. This: - Matches the naming convention used by the sister plugins (ultimate-ai-connector-webllm, ultimate-ai-connector-compatible-endpoints). - Claims the 'ultimate-ai-connector-' namespace properly so a future third-party 'anthropic-max' plugin can't collide with this one. - Causes the WP Connectors page to render ONE card instead of two — previously a hidden duplicate auto-registered ApiKeyConnector card existed alongside the custom-rendered card because the slugs differed. This is a BREAKING change for any caller that hardcoded the old provider id (e.g. AiClient::defaultRegistry()->getProvider('anthropic-max')). Stored OAuth tokens, REST endpoint URLs, option keys, transient prefixes, plugin folder name, text domain, and css class are unchanged. 2. WORKAROUND for WP core's registerDefaultConnectors() clobbering custom renders. The rename in (1) makes the slugs match, which exposes this plugin to the same race the other Ultimate-Multisite connector plugins hit: WP core's routes/connectors-home/content module runs registerDefaultConnectors() inside an async dynamic import, after our top-level registerConnector() has already populated the store, and the reducer's spread overwrites our custom render with the generic ApiKeyConnector. Re-assert the registration on five ticks (sync + microtask + setTimeout 0/50/250/1000ms) so we always end up last. The proper upstream fix is in WordPress/gutenberg#77116. Once that ships in a Gutenberg release, the 5-tick workaround can be removed; the rename is permanent. CSS class on the rendered card also updated from `connector-item--anthropic-max` to `connector-item--ultimate-ai-connector-anthropic-max` to match the new slug and the convention used by the sister plugins. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 116cb06 commit 71d39bc

File tree

5 files changed

+34
-22
lines changed

5 files changed

+34
-22
lines changed

js/connector.jsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ function AnthropicMaxConnectorCard( { slug, label, description } ) {
509509

510510
return (
511511
<ConnectorItem
512-
className="connector-item--anthropic-max"
512+
className="connector-item--ultimate-ai-connector-anthropic-max"
513513
icon={ <Logo /> }
514514
name={ label }
515515
description={ description }
@@ -521,7 +521,11 @@ function AnthropicMaxConnectorCard( { slug, label, description } ) {
521521
}
522522

523523
// Register the connector card.
524-
const SLUG = 'ai-provider-for-anthropic-max/connector';
524+
//
525+
// SLUG matches the PHP provider id from AnthropicMaxProvider::createProviderMetadata()
526+
// so the WP core Connectors page renders ONE card instead of two (the
527+
// auto-discovered server entry + a separately-keyed JS entry).
528+
const SLUG = 'ultimate-ai-connector-anthropic-max';
525529
const CONFIG = {
526530
label: __( 'Anthropic Max' ),
527531
description: __(
@@ -534,14 +538,12 @@ const CONFIG = {
534538
// `registerDefaultConnectors()` from inside an async dynamic import. By the
535539
// time it executes, our top-level registerConnector() has already populated
536540
// the store — and the store reducer spreads new config over existing
537-
// entries, so the default's `args.render = ApiKeyConnector` can overwrite
538-
// our custom render. We currently dodge this by using a slug that doesn't
539-
// collide with the PHP-side provider id, but that's fragile (a future
540-
// upstream change to slug normalization could break it). The proper fix is
541-
// in WordPress/gutenberg#77116; until that ships we re-assert our
542-
// registration on five ticks (sync + microtask + setTimeout 0/50/250/1000ms)
543-
// as defense in depth so our render always ends up last regardless of
544-
// dynamic-import resolution order.
541+
// entries, so the default's `args.render = ApiKeyConnector` would overwrite
542+
// our custom render. The proper fix is in WordPress/gutenberg#77116; until
543+
// that ships we re-assert our registration on five ticks (sync + microtask
544+
// + setTimeout 0/50/250/1000ms) so our render always ends up last regardless
545+
// of dynamic-import resolution order. Re-registering with the same render
546+
// reference is idempotent so the redundant calls cost essentially nothing.
545547
function registerOurs() {
546548
registerConnector( SLUG, CONFIG );
547549
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ai-provider-for-anthropic-max",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"private": true,
55
"license": "GPL-2.0-or-later",
66
"scripts": {

plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Anthropic provider for the WordPress AI Client using Claude Max OAuth tokens with account pool rotation.
66
* Requires at least: 6.9
77
* Requires PHP: 7.4
8-
* Version: 1.0.1
8+
* Version: 1.1.0
99
* Author: Ultimate Multisite Community
1010
* Author URI: https://ultimatemultisite.com
1111
* License: GPL-2.0-or-later
@@ -21,7 +21,7 @@
2121
return;
2222
}
2323

24-
define( 'ANTHROPIC_MAX_AI_PROVIDER_VERSION', '1.0.1' );
24+
define( 'ANTHROPIC_MAX_AI_PROVIDER_VERSION', '1.1.0' );
2525

2626
// ---------------------------------------------------------------------------
2727
// PSR-4 autoloader for src/ classes.

readme.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: superdav42
33
Tags: ai, anthropic, claude, oauth, max
44
Requires at least: 6.9
55
Tested up to: 7.0
6-
Stable tag: 1.0.1
6+
Stable tag: 1.1.0
77
Requires PHP: 7.4
88
License: GPL-2.0-or-later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -65,9 +65,11 @@ OAuth tokens are stored in the WordPress options table. Only site administrators
6565

6666
== Changelog ==
6767

68-
= 1.0.1 =
68+
= 1.1.0 =
6969

70-
* Defensive: re-assert our `registerConnector()` call across multiple ticks (microtask + 0/50/250/1000 ms) so the WP core `registerDefaultConnectors()` auto-register can't clobber the custom card with the generic API-key UI. Today this plugin happens to escape the bug because its JS slug doesn't collide with the PHP-side provider id, but that's fragile. The proper upstream fix is in https://github.com/WordPress/gutenberg/pull/77116 — once that ships in a Gutenberg release, this defense can be removed.
70+
* **BREAKING**: renamed the AI Client provider id from `anthropic-max` to `ultimate-ai-connector-anthropic-max` for consistency with the sister plugins (`ultimate-ai-connector-webllm`, `ultimate-ai-connector-compatible-endpoints`) and to claim the namespace properly. Code that called `AiClient::defaultRegistry()->getProvider('anthropic-max')` must update the id. Stored OAuth tokens, REST endpoints, and option keys are unchanged so existing setups continue to work.
71+
* Improved: the JS-side `registerConnector()` slug now matches the PHP provider id, so the WP core Connectors page renders one card instead of two (a previously-hidden duplicate auto-registered card with the generic API-key form is now suppressed).
72+
* Fix: re-assert our `registerConnector()` call across multiple ticks (microtask + 0/50/250/1000 ms) so the WP core `registerDefaultConnectors()` auto-register can't clobber the custom card with the generic API-key UI. Necessary because matching the slug exposes us to the same race the other Ultimate-Multisite connector plugins hit. The proper upstream fix is in https://github.com/WordPress/gutenberg/pull/77116 — once that ships in a Gutenberg release, this workaround can be removed.
7173

7274
= 1.0.0 =
7375

src/Provider/AnthropicMaxProvider.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/**
33
* Anthropic Max provider for the WordPress AI Client.
44
*
5-
* Registers as a separate provider ('anthropic-max') so it can coexist
6-
* with the standard API-key-based Anthropic provider.
5+
* Registers as a separate provider ('ultimate-ai-connector-anthropic-max')
6+
* so it can coexist with the standard API-key-based Anthropic provider.
77
*
88
* @since 1.0.0
99
*
@@ -77,17 +77,25 @@ protected static function createModel(
7777
/**
7878
* Creates the provider metadata.
7979
*
80-
* Uses 'anthropic-max' as the provider ID to avoid conflicts
81-
* with the standard API-key-based Anthropic provider.
80+
* Uses 'ultimate-ai-connector-anthropic-max' as the provider ID. The
81+
* `ultimate-ai-connector-` namespace matches the sister plugins
82+
* (`ultimate-ai-connector-webllm`, `ultimate-ai-connector-compatible-endpoints`)
83+
* and avoids any future collision with another plugin author who might
84+
* register a generic 'anthropic-max' provider id.
8285
*
83-
* @since 1.0.0
86+
* @since 1.0.0 As 'anthropic-max'.
87+
* @since 1.1.0 Renamed to 'ultimate-ai-connector-anthropic-max' for
88+
* consistency with other Ultimate-Multisite connector plugins
89+
* and to make the JS-side `registerConnector()` slug match
90+
* this id (so the WP core Connectors page renders one card
91+
* instead of two).
8492
*
8593
* @return ProviderMetadata
8694
*/
8795
protected static function createProviderMetadata(): ProviderMetadata
8896
{
8997
$args = [
90-
'anthropic-max',
98+
'ultimate-ai-connector-anthropic-max',
9199
'Anthropic Max',
92100
ProviderTypeEnum::cloud(),
93101
null,

0 commit comments

Comments
 (0)