Skip to content

feat(client): Telegram-like messenger UI at /client (Draft) - #32

Draft
EpicStarAi wants to merge 1 commit into
backup/operator-ui-account-fetchfrom
feat/tg-like-client
Draft

feat(client): Telegram-like messenger UI at /client (Draft)#32
EpicStarAi wants to merge 1 commit into
backup/operator-ui-account-fetchfrom
feat/tg-like-client

Conversation

@EpicStarAi

Copy link
Copy Markdown
Owner

What & why

Brings the EPICGRAM /client surface to a familiar Telegram look so that,
after EPICGRAM login, the user lands in a recognisable two-pane messenger
instead of the operator "cabinet".

Base branch: backup/operator-ui-account-fetch (the full foundation lives
there, not on main). Isolated build done in a dedicated git worktree; the
shared agent-control tree was not touched.

Scope delivered

  • New components/tg/ shell wired into app/client/page.tsx (server-side
    auth gate preserved). The large red-neon EpicGramShell is left untouched.
  • Layout: chat list left · active chat right · optional third panel (info /
    AI-operator). Collapsible sidebar; single-pane on mobile.
  • Chat list: avatar (real photo or tinted initials), name, last-message
    preview, timestamp, unread counter, active highlight, folder tabs, pinned
    section (rendered only if the backend ever exposes a pin flag — honest).
  • Message feed: bubbles (own right / others left), consecutive-sender
    grouping, date separators, time + a sent check, autoscroll, load-older on
    scroll-up.
  • Composer: multiline, Enter = send, Shift+Enter = newline.
  • Theme: authentic Telegram palette in an isolated .tgx scope — dark by
    default, optional light — so it never re-skins the app-wide red tg-* tokens.
  • AI-operator as a separate right panel (toggle), prepares a review-only
    draft; the human still sends.

Security posture — unchanged

Server resolves the slot, the approval gate stays authoritative, audit intact.
The browser sends no accountId for auth and no MTProto; send always
passes /api/telegram/send (denied while TELEGRAM_MUTATION=false). No demo
chats, no hardcoded messages, no fake avatars — honest empty states only. The
5 security tests still pass; TELEGRAM_MUTATION not changed.

⚠️ Needs security review — restored missing glue

resolveBoundAccount was imported by 7 route files but defined nowhere on
this base branch, so it did not compile. This PR restores it in
lib/telegramGuard.ts as a thin deny-by-default wrapper over the existing
resolveBoundAccountId (which returns null for everyone). It cannot return
ok while the resolver returns null, so the incident-containment posture is
preserved exactly — but please confirm the intent.

Verification

  • npm run build (type-check) ✅ · npm run lint ✅ (new files clean; only the
    pre-existing warnings-only baseline elsewhere) · npm test ✅ (5/5).
  • Screenshots (real API, authenticated session, honest empty state — the
    browser had no bound Telegram account): see
    docs/tg-client/README.md.

Known gap (not faked)

Populated chat screenshots need a bound, authorized Telegram account, which
depends on the owner-matched binding model (P-EPICGRAM-CLIENT-PLATFORM-1) and
the :8788 TDLib backend — neither available on the candidate. The client
therefore renders honest empty/connect states rather than fabricated data.

🤖 Generated with Claude Code

Replace the operator "cabinet" landing with a familiar two-pane Telegram
interface. Real data only, honest empty states, security model untouched.

- components/tg/: TgClient shell + ChatList, MessageThread (bubbles, grouping,
  date separators, autoscroll, load-older), Composer (Enter=send /
  Shift+Enter=newline, server-gated), Avatar (photo or tinted initials),
  Info + AI-operator side panels, real-API data hook.
- globals.css: isolated .tgx palette (authentic Telegram look), dark default +
  optional light, scoped so it never disturbs the app-wide red tg-* tokens.
- No mock data: chats/messages/photo/status all come from /api/telegram/*; send
  passes the server approval gate; no MTProto in the browser.

Also restores the pre-existing missing `resolveBoundAccount` glue in
telegramGuard.ts (imported by 7 routes but undefined on this base branch, so the
branch did not compile). It is a thin deny-by-default wrapper over the existing
resolveBoundAccountId and preserves the exact incident-containment posture —
flagged for the security owner to review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant