Skip to main content

Module permission_mode

Module permission_mode 

Source
Expand description

ai-permission-mode — the ACP permission menu (PU-B).

A momentary popup surface over a dynamic option list (design §5.3). The buffer is a BufferData::Help popup (so the popup renderer draws it) whose MAJOR mode is this one: the KIND names the surface, this mode names the behaviour. on_activate reads the oldest Pending permission from the ConversationStore and owner-writes the projection; <CR> on an option line resolves it (the file-tree / oil entry_at_line model), Esc/q defer. Resolution routes through ConversationStore::resolve_permission by the agent’s option_id (PU-B.2a).

v1 uses <CR>-by-cursor as the selector. The 1–9 digit accelerators the design also calls for need a count-override seam (bare digits are parsed as vim counts, Action::PushDigit, before any mode chord lookup), which no mode has today — deferred to a follow-up.

Structs§

AiPermissionGuard
PU-B.3: clears the coordinator’s menu_open flag when the menu closes (dismiss tears the buffer down → removes the active mode → drops this guard), so the auto-open tick callback opens the next queued request.
AiPermissionMode
ai-permission-mode: the major mode of the *ai-permission* popup buffer.
PermissionMenuCoordinator
PU-B.3: cross-cutting auto-open state shared by the mode (which sets it) and the install-time auto-open tick callback (which reads it). Registered as a service so both reach the same instance.

Constants§

PERMISSION_BUFFER_NAME
The synthetic buffer name the popup menu is projected into. :ai-permission and the (PU-B.3) auto-opener both name it in Effect::OpenPopup.

Functions§

auto_open_tick
PU-B.3: the auto-open decision, run every editor tick by the install-time tick callback (run_tick_pending fires on the actor’s async_landed wake — no keystroke, so a permission arriving while the user is idle opens the menu on its own). Opens the oldest non-deferred pending request when no menu is showing, and sets menu_open optimistically so it emits ONCE rather than every tick until on_activate lands. Returns the effects to apply.
register_ai_permission_actions
Register the ai-permission action commands so the mode’s keymap cmd names resolve at boot (the register_ai_conversation_actions pattern). The specs are pure shells returning Effect::None; the real bodies live in AiPermissionMode::action_handlers, consulted before the CommandSpec.

Type Aliases§

PermissionMenuCoordinatorHandle
Service handle for ServiceRegistry lookup (the Arc<T> alias convention, feedback_servicesregistry_arc_typeid).