Skip to content

feat(telegram-manager): Chat + Schemas tabs with nodes view; fix Chat panel showing 0 messages - #11

Draft
Secret297-CODER-SOURCE with Copilot wants to merge 14 commits into
mainfrom
copilot/add-dialog-structure-tab
Draft

feat(telegram-manager): Chat + Schemas tabs with nodes view; fix Chat panel showing 0 messages#11
Secret297-CODER-SOURCE with Copilot wants to merge 14 commits into
mainfrom
copilot/add-dialog-structure-tab

Conversation

Copilot AI commented Mar 13, 2026

Copy link
Copy Markdown

Adds Chat and Schemas tabs to each Telegram agent detail panel, and fixes a data bug that caused the Chat panel to always show zero messages.

Summary

  • Problem: No chat/graph view for inter-agent communication; Telegram manager had no way to visualize agent-to-agent message history or mission topology. Chat panel also had a silent data bug: loadTelegramMissionMessages replaces state.telegramMissionMessages on every call — looping over N missions left only the last mission's messages (race-to-last-write).
  • Why it matters: Users can't see what their Telegram agents are saying to each other or how missions are structured. The data bug meant Chat was always empty even with active missions.
  • What changed: Two new tabs (Chat, Schemas) added right after Auth; dedicated telegramChatMessages accumulator state + loadTelegramAllMissionMessages (parallel Promise.all fetch) replacing the broken serial-overwrite loop; TelegramProps extended with chatMessages / onChatRefresh.
  • What did NOT change: telegramMissionMessages (used by Communication panel single-mission view) is untouched; no backend/gateway server code changed; no WebSocket protocol changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Related #

User-visible / Behavior Changes

New tabs (order: Overview | Auth? | Chat | Schemas | Communication | Behaviors | Tasks | Events | Cron | Files):

  • Chat tab — two toggle modes:

    • 💬 Chat — chronological message bubbles across all missions; outgoing right-aligned (accent border), incoming left-aligned; each bubble shows sender→receiver, mission name, timestamp
    • ◎ Nodes — per-mission cards showing master agent → participants as a visual graph with status badges
  • Schemas tab — communication structure blueprint per mission: title/status, agent hierarchy tree (master → participants with role/type labels), goal text, optional system prompt

Bug fix: Chat panel now correctly shows messages from all missions (was always empty due to state overwrite).

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No — reuses existing telegram.mission.messages WS method, now called in parallel per mission
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: any
  • Runtime/container: browser UI + gateway with telegram-manager extension
  • Model/provider: n/a
  • Integration/channel (if any): Telegram Manager

Steps

  1. Select any Telegram agent → observe Chat and Schemas tabs appear after Auth (or after Overview for bots)
  2. Without missions: Chat shows empty-state callout linking to Communication tab
  3. Create missions with participants in Communication tab
  4. Return to Chat → messages appear as bubbles; click ◎ Nodes → mission graph renders
  5. Click Schemas → mission blueprint with agent tree and goal text renders

Expected

  • Chat tab shows accumulated messages from all missions; nodes view shows mission topology
  • Schemas tab shows per-mission structural skeleton

Actual (before fix)

  • Chat panel rendered but always showed 0 messages (state overwritten per mission load)
  • No Chat or Schemas tabs existed

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: TelegramPanel union, TelegramProps, AppViewState, app.ts, controller type all consistent; Promise.all pattern accumulates messages correctly; agent switch resets telegramChatMessages; telegramMissionsError = null cleared before early-return guard
  • Edge cases checked: no missions → empty state; bot agents (no Auth tab) → Chat+Schemas appear after Overview; zero messages → empty-state with CTA; onChatRefresh reloads both missions and messages
  • What you did not verify: live gateway round-trip with real Telegram sessions; narrow-viewport mobile layout

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery (if this breaks)

  • How to disable/revert: revert commits touching telegram.ts, app-render.ts, app-view-state.ts, app.ts, controllers/telegram.ts
  • Known bad symptoms: blank Chat panel (network error shown via missionsError callout); Schemas empty (same); nodes view shows no cards if missions haven't loaded yet (Refresh resolves it)

Risks and Mitigations

  • Risk: Promise.all over many missions could generate N parallel WS requests on Chat tab open
    • Mitigation: Per-mission message fetch is lightweight; missions are typically O(1–10); errors per-mission are caught individually so one failure doesn't break the whole panel

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Secret297-CODER-SOURCE and others added 9 commits March 10, 2026 14:43
Introduce scoped WorkspaceTools for Telegram agents (createWorkspaceTools) with explicit readable/writable file lists and Anthropic tool definitions. Add an Anthropic tool-calling loop (runAnthropicWithTools) to AiReplyEngine and accept an optional workspaceTools parameter in aiReply; when ANTHROPIC_API_KEY is present, use the tool-calling path (up to 5 iterations) and otherwise fall back to the existing adapter. Update BotAgent and UserBotAgent to create and pass per-agent workspace tools into aiReply so agents can safely read/write their own workspace files. Also adjust the UI file loader to always reload Telegram agent file contents to avoid showing stale/shared cache entries.
Remove the TG_ID pattern from PII_PATTERNS to avoid treating short numeric Telegram IDs as PII. Improve Telegram agent files loading UX: set agentFilesLoading=true when initiating file load to prevent a flash of the "click to load" callout, auto-load files when returning to an already-active Files panel, and import loadTelegramAgentFiles where needed. Update the Files panel UI to show a "Loading files…" state and replace the static callout with a clickable callout button that invokes the provided onLoadFiles handler.
Import loadTelegramAgentFileContent and, when returning to the Telegram Files panel, clear the shared agentFileContents cache and reload the agent's file list. If an active file is selected, also fetch its content so the Files panel doesn't show stale data left over from the main Agents tab. Adds a clarifying comment about the shared cache behavior.
…dex.ts

- UserBotAgent: add `EntityLike` type import from telegram/define and cast
  the BigInt peer to silence TS2345; gramjs handles native bigint at runtime
- Delete extensions/telegram-manager/src/index.ts — orphaned dead-code file
  that was never imported, had broken module paths, and contained the Cyrillic
  identifier character that caused the historical ReferenceError at load time

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
Copilot AI changed the title [WIP] Add dialog structure tab to Telegram managers feat(telegram-manager): add Communication Structure tab to agent detail panel Mar 13, 2026
…w behavior status in UI

Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
Copilot AI changed the title feat(telegram-manager): add Communication Structure tab to agent detail panel feat(telegram-manager): Communication Structure tab + auto-wire CommunicationBehavior on missions Mar 13, 2026
…rview panel

Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
Copilot AI changed the title feat(telegram-manager): Communication Structure tab + auto-wire CommunicationBehavior on missions feat(telegram-manager): Communication Structure — auto-wire CommunicationBehavior + UI discoverability Mar 13, 2026
Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
Copilot AI changed the title feat(telegram-manager): Communication Structure — auto-wire CommunicationBehavior + UI discoverability feat(telegram-manager): Chat + Schemas tabs with nodes/graph view Mar 13, 2026
… state (loadTelegramAllMissionMessages)

Co-authored-by: Secret297-CODER-SOURCE <73541046+Secret297-CODER-SOURCE@users.noreply.github.com>
Copilot AI changed the title feat(telegram-manager): Chat + Schemas tabs with nodes/graph view feat(telegram-manager): Chat + Schemas tabs with nodes view; fix Chat panel showing 0 messages Mar 13, 2026
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.

2 participants