the plugin system says permissions, not the other word
i named the field permissions and then narrated in the overloaded one anyway, which is worse than either — the whole reason for the rename was that the word already means three things here. renamed what was mine: setPluginCapabilities -> setPluginPermissions, pluginCapabilities -> pluginPermissions, and the prose throughout. what remains is the platform's own vocabulary, not the plugin system's: the type it imports, and the field on a dock manifest, which is the shape the shell already renders. renaming those is a separate change to a separate system and is the owner's to make. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -99,7 +99,7 @@ export type Capability = {
|
||||
};
|
||||
|
||||
/**
|
||||
* The PLATFORM's own capabilities. A plugin's are added on top at runtime — see `setPluginCapabilities`.
|
||||
* The PLATFORM's own capabilities. A plugin's are added on top at runtime — see `setPluginPermissions`.
|
||||
*
|
||||
* Kept separate from the live `CAPABILITIES` below so two invariants hold by construction rather than by
|
||||
* anyone remembering them: a plugin can never become `core` (granted to everyone, undeniable), and a
|
||||
@@ -428,7 +428,7 @@ const CORE_REGISTRY: Capability[] = [
|
||||
// exports are live bindings, so an importer holding `CAPABILITY_BY_KEY` sees the reassignment — every
|
||||
// consumer reads these inside a function, never at module scope, which is what makes that safe.
|
||||
//
|
||||
// Nothing mutates the arrays in place. `setPluginCapabilities` replaces them, for the same reason
|
||||
// Nothing mutates the arrays in place. `setPluginPermissions` replaces them, for the same reason
|
||||
// `buildHonoApp` replaces the app rather than adding routes to it: a half-updated lookup is worse than a
|
||||
// stale one, and replacement has no half.
|
||||
|
||||
@@ -480,7 +480,7 @@ export const CORE_CAPABILITIES = CORE_REGISTRY.filter((c) => c.kind === 'core');
|
||||
* question. A key colliding with a core one is REFUSED here rather than silently overriding — a plugin
|
||||
* that could redefine `chat` or `terminal` could widen it.
|
||||
*/
|
||||
export function setPluginCapabilities(pluginCapabilities: Capability[]): { rejected: string[] } {
|
||||
export function setPluginPermissions(pluginCapabilities: Capability[]): { rejected: string[] } {
|
||||
const coreKeys = new Set(CORE_REGISTRY.map((c) => c.key));
|
||||
const seen = new Set<string>();
|
||||
const accepted: Capability[] = [];
|
||||
|
||||
Reference in New Issue
Block a user