feat: Divi-Adapter sperren je Fähigkeit – ReleaseGate::feature/assertFeature(s), DiviLocked und Ablehnung nennen die betroffenen Fähigkeiten (D6), DiviSaver prüft Seiten schreiben und die Fähigkeit des Speicherbereichs (D5), DesignArea::feature; Test-Standard alle Fähigkeiten freigegeben
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c4efeb3ba4
commit
e387d8d29e
@@ -11,21 +11,28 @@ use WP_Error;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/** A write refused because the installed Divi is not released (spec §5.5); AbilityRegistrar returns toError(). */
|
||||
/**
|
||||
* A Divi call refused because a feature it needs is not released (spec §5.5, D6); AbilityRegistrar returns
|
||||
* toError(). Without features it is the general write lock of the overall status (texts of spec §5.6).
|
||||
*/
|
||||
final class DiviLocked extends RuntimeException implements ToolRefusal
|
||||
{
|
||||
public function __construct(public readonly ReleaseStatus $status)
|
||||
/** @param list<DiviFeature> $features The locked features the refused call needs; [] = writing in general. */
|
||||
public function __construct(public readonly ReleaseStatus $status, public readonly array $features = [])
|
||||
{
|
||||
parent::__construct(sprintf(
|
||||
'%s is %s for LIT MCP – write refused',
|
||||
'%s is %s for LIT MCP – %s refused',
|
||||
$status->versionLabel(),
|
||||
$status->state->value
|
||||
$status->state->value,
|
||||
$features === []
|
||||
? 'write'
|
||||
: implode(', ', array_map(static fn (DiviFeature $feature): string => $feature->value, $features))
|
||||
));
|
||||
}
|
||||
|
||||
public function toError(): WP_Error
|
||||
{
|
||||
return $this->status->refusal();
|
||||
return $this->features === [] ? $this->status->refusal() : $this->status->refusalFor($this->features);
|
||||
}
|
||||
|
||||
/** The lock anywhere in $e's chain of previous exceptions (callers wrap failures in WriteFailed). */
|
||||
|
||||
Reference in New Issue
Block a user