feat: approval-gated visual executor + cursor + highlight + audit trail - #21
Draft
EpicStarAi wants to merge 1 commit into
Draft
feat: approval-gated visual executor + cursor + highlight + audit trail#21EpicStarAi wants to merge 1 commit into
EpicStarAi wants to merge 1 commit into
Conversation
Adds a controlled visual execution mode to the TMA AI Operator: after 'Разрешить', a visible AI cursor moves to allowlisted targets, phase-coloured highlights track each step, a progress panel offers Pause/Cancel/Hide, and the irreversible save requires a separate final confirmation. Every step is written to an audit trail. UI-only + local demo executor — no Telegram/TDLib mutation. - apps/web/lib/visualExecutor.ts: framework-agnostic state machine, DOM target allowlist, audit builder, cursor geometry (TELEGRAM_MUTATION always false). - components/tma/VisualExecutorCursor.tsx: pointer-events:none AI cursor. - components/tma/TelegramNativeProfile.tsx: wire executor, cursor, highlight, progress panel, final confirmation, audit log; data-epic-target attributes. - tests/visualExecutor.test.ts: 15 node:test cases (approval gate, allowlist, pause, cancel, no-save-before-confirm, mutation-always-false, audit order, /client isolation, viewport clamp). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P-VISUAL-EXECUTOR-1 — Visual Executor + Cursor + Action Highlight + Audit Trail
Approval-gated visual execution mode for the TMA AI Operator. After the user taps «Разрешить», the operator enters a controlled, observable flow: a visible AI cursor moves to targets, targets get phase-coloured highlights, a step progress panel offers pause/cancel/hide, the irreversible save requires a separate final confirmation, and every step is recorded to an audit trail.
UI-only + local demo executor. No Telegram send, no TDLib mutation, no changes to
/client, backend, or VPS. The existing approval gate (pending/cancelled/approved) was reused, not rewritten.State machine
idle → pending_approval → approved → executing → (paused) → awaiting_final_confirmation → completed | cancelled | failedDemo scenario «Изменить bio на: TOP SECRET // AI MODE»: highlight profile card → cursor to «Изменить» → highlight → open sim form → highlight Bio → stage text in local React state only →
awaiting_final_confirmation→[Назад] [Отмена] [Сохранить]→ only «Сохранить» commits the local demo bio. Nothing reaches Telegram/external APIs.DOM targeting allowlist (no text search, no arbitrary CSS, no eval)
profile-card,profile-edit-button,profile-bio-field,profile-save-button— resolved only via[data-epic-target="…"]after an allowlist check.Safety invariants
TELEGRAM_MUTATIONis always false — no code path flips it.EXECUTION_MODE = local_demo.Files
apps/web/lib/visualExecutor.ts— framework-agnostic state machine, allowlist, audit builder, cursor geometry/clamp, phase colours.apps/web/components/tma/VisualExecutorCursor.tsx—pointer-events:noneEPIC💀CLAW cursor, reduced-motion aware.apps/web/components/tma/TelegramNativeProfile.tsx— wires executor, cursor, highlight overlay, progress panel, final confirmation, audit log; addsdata-epic-targetattributes.tests/visualExecutor.test.ts— 15node:testcases.package.json—testscript (node --test, zero new deps).Verification
npm test).next lintexit 0, no new warnings.next buildexit 0,/tma/profile13 kB.TELEGRAM_MUTATION=falsethroughout.Notes / blockers
origin/main(localmainhad diverged: 21 ahead / 27 behind, and the target files existed only onorigin/main).setIntervalrather thanrequestAnimationFrameso cursor/highlight tracking keeps working when the tab is backgrounded (rAF is paused for hidden tabs).🤖 Generated with Claude Code