AGENTS.md@packages/chat-gateway/src/client · git:20261019.0a763e4 · 2026-10-19 · sha256 7435fa823800cfea
AGENTS.md@packages/chat-gateway/src/client git:20261019.0a763e4A
Immutable. This exact content never changes and is served at /api/v1/blob/7435fa823800cfea.
# DOX — packages/chat-gateway/src/client
Files in this directory. One row per source file. See change: add-chat-gateway.
| File | Purpose |
|------|---------|
| `ChatGatewaySettings.tsx` | `ChatGatewaySettings` settings-section (lazy via manifest `module`; claimed as `ChatGatewaySettings`). Kit fields in 4 `SettingsGroup`s (Discord connection · Where sessions run · Who can use it · Behaviour) + pairing `SettingsNotice`, bound-channels `SettingsTable`, `<TeamControlsPanel />`. Header `GatewayStatus` pill (`chat-gateway-status`: Not set up / Paused / Running / Not running). Master switch labelled "Answer Discord messages" (testid `chat-gateway-enabled` kept). Save model: NO in-body Save; `useSettingsDraftSource({ id: "plugin:chat-gateway" })`; `draft` holds only EDITED keys (clean page adopts `plugin_config_update`, dirty keeps edited keys); `commit` sends ONLY edited keys via `plugin_config_write`, THROWS without writing when a channel-folders line is not `channelKey=folder` (field error names the line, `badMapLines`). Empty allowed folders → non-blocking warning `chat-gateway-allowed-roots-warning`. Bot token is write-only: draft holds only the typed replacement, never sent blank, cleared after commit/reset, never seeded from server; commit failure → `chat-gateway-notice` error `SettingsNotice` with generic sentence, raw server text only in "Copy details", run through `scrubSecret` (raw/trimmed/JSON/URL spellings of the token); host gets a generic `Error`. Bindings read from `GET /api/chat-gateway/bindings` (refetched after commit). Tested in `__tests__/ChatGatewaySettings.test.tsx` (jsdom; mock keeps real `useRuntimeT`; `hostSave()` drives the registered source; `configWrites()` filters the panel's own surface request). See change: align-ui-with-theme-tokens, hide-chat-gateway-sessions, chat-gateway-thread-per-conversation, chat-gateway-attach-dashboard-sessions, retro-ux-plugin-settings-wave-2. |
| `index.tsx` | Intentionally empty client entry (`export {}`); do not re-export lazy components. See change: lazy-plugin-claim-modules. |
| `team-controls-panel.tsx` | `TeamControlsPanel` — team-controls configuration surface (tasks 8.1-8.4), a PURE RENDERER of `TeamSurfaceView` that decides nothing. Renders in a `SettingsGroup`: Armed / Disarmed `SettingsStatusPill` (`team-disarm-state`, `data-status`) with Re-arm (`team-rearm`) beside it, `SettingsFacts` (highest level, allowed folders), one `SettingsItem` per binding (level + mirror pills, principals, roles with delegation disclosure, folders with "Not used" pill for inert), command-log `SettingsTable` with Done/Refused pills. Raw `problem` / `configError` / refusal `reason` never render: a sentence shows, raw text only via `SettingsNotice details` (Copy details). Reads/writes ride the plugin browser-handler lane (`TEAM_SURFACE_MESSAGE` / `TEAM_CONFIG_MESSAGE`, no HTTP route); re-arm WRITES config (dashboard-only asymmetry). Delegation `unavailable` = "missing permission: X", empty roster = "Nobody can assign this role" — must never collapse. Tested in `__tests__/team-controls-panel.test.tsx` (jsdom). See change: add-chat-gateway-team-controls, retro-ux-plugin-settings-wave-2. |