step 4/4: the docs say permissions too, and capability means one thing again
44 files of prose — CLAUDE.md, AGENTS.md, TODO.md, 20 docs, both plugin design
documents, and the comment surface the earlier steps could not reach.
Applied against an explicit keep-list, not swept, because the word turned out to
have SIX meanings in this repository rather than the three the offscale doc
recorded:
permissions renamed (steps 1–2)
$OFFICER_ROOT/capabilities/ KEPT — the item store, and now the only thing
the word means that is ours
sidecar routing keys renamed to `handles` (step 3)
Lightning wallet KEPT — a domain term, and on the wire to the mobile apps
terminfo queries KEPT — XTGETTCAP, in the pty sidecar
InvoiceShelf KEPT — per-resource { write, bulkDelete } flags
The sweep still falsified two things, both caught by checking rather than by
review, and both in prose that discusses more than one meaning at once:
CLAUDE.md began claiming the item store lives at `$OFFICER_ROOT/permissions`.
It does not; that directory is on disk and full of skills and tools.
And the offscale doc's own note about the collision became
"Named `permissions`, NOT `permissions`" — a sentence that had eaten the thing
it existed to warn about.
Both restored, and the note rewritten to say what is now true: capability means
one thing of ours, and three that belong to somebody else's vocabulary.
Verified live after restart: self and admin permission endpoints 200, gated
route 200, agent-status 200, 9 grants intact with 6 permissions offered.
tsgo clean, 797 tests, 787 pass, same 7.
The rename is done. Four steps, no data lost, no client break that survived
the step it was introduced in.
This commit is contained in:
@@ -6,7 +6,7 @@ import { useClient } from './useClient';
|
||||
//
|
||||
// THIS IS NOT ACCESS CONTROL. Every answer here is a courtesy: it stops the app offering a member a
|
||||
// Terminal icon that would 403, and stops a screen mounting a panel whose every request will fail. The
|
||||
// lock is server-side, in the capability gate and the websocket gate — both of which
|
||||
// lock is server-side, in the permission gate and the websocket gate — both of which
|
||||
// hold regardless of what this hook returns, including when it returns nothing because the request failed.
|
||||
//
|
||||
// Which is why the failure mode below is deliberately generous rather than restrictive: if this request
|
||||
@@ -42,7 +42,7 @@ export type SelfPermissions = {
|
||||
/** What an installed sidecar says about how it should appear. Mirrors UiManifest on the server. */
|
||||
export type PluginManifest = {
|
||||
sidecarId: string;
|
||||
capability: string | null;
|
||||
permission: string | null;
|
||||
name: string;
|
||||
icon?: string;
|
||||
image?: string;
|
||||
@@ -88,7 +88,7 @@ export function usePermissions() {
|
||||
);
|
||||
|
||||
/**
|
||||
* Whether a frontend route is reachable. Only routes a capability actually claims are ever denied —
|
||||
* Whether a frontend route is reachable. Only routes a permission actually claims are ever denied —
|
||||
* `/`, the settings shell and anything else unclaimed stays open, because denying by default here would
|
||||
* blank the app for everyone rather than restrict it for anyone.
|
||||
*/
|
||||
@@ -115,8 +115,8 @@ export function usePermissions() {
|
||||
if (!data) return null;
|
||||
if (!data.deniedRoutes.some((route) => path === route || path.startsWith(`${route}/`))) return null;
|
||||
|
||||
// Held but unavailable → the sidecar is missing. Checked against the capability that claims the route,
|
||||
// which is why `unavailable` is returned as capability keys rather than routes.
|
||||
// Held but unavailable → the sidecar is missing. Checked against the permission that claims the route,
|
||||
// which is why `unavailable` is returned as permission keys rather than routes.
|
||||
const unavailable = new Set(data.unavailable ?? []);
|
||||
const heldAndUnavailable = data.permissions.some(({ key }) => unavailable.has(key));
|
||||
if (data.isOwner || heldAndUnavailable) return 'not-installed';
|
||||
|
||||
@@ -49,7 +49,7 @@ export function useAppStore() {
|
||||
queryFn: () => client.get<{ items: StoreItem[] }>('/app-store'),
|
||||
});
|
||||
|
||||
// Every verb invalidates the same key, and also the capability answer: installing changes which dock
|
||||
// Every verb invalidates the same key, and also the permission answer: installing changes which dock
|
||||
// tiles exist, and a store that updated while the dock kept the old list would be visibly wrong on
|
||||
// the same screen.
|
||||
const invalidate = () => {
|
||||
|
||||
@@ -18,7 +18,7 @@ export type AgentGroup = { category: string; agents: AgentSummary[] };
|
||||
// wrong thing about what happens when you click.
|
||||
export const useAgents = () => {
|
||||
const client = useClient();
|
||||
// Agents are the `items` capability — skills, tools and agents on the owner's disk — and running one
|
||||
// Agents are the `items` permission — skills, tools and agents on the owner's disk — and running one
|
||||
// starts a chat session, which is `chat`. Both are execution-only, so a member gets no agent submenu.
|
||||
const { can } = usePermissions();
|
||||
const allowed = can('items');
|
||||
|
||||
@@ -19,7 +19,7 @@ export const useServerSettings = () => {
|
||||
const client = useClient();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
// `/server-settings` is the `server-admin` capability: owner only, and not grantable at any level. This
|
||||
// `/server-settings` is the `server-admin` permission: owner only, and not grantable at any level. This
|
||||
// hook is mounted by shell components that every account loads, so without the guard a member's first
|
||||
// paint fired a 403 at it.
|
||||
const { isOwner } = usePermissions();
|
||||
|
||||
Reference in New Issue
Block a user