A
Agentee
AAB-143 · Chat UI
AAB-143 Phase 02 · UI Layer Pre-implementation

A chat surface for operators,
wired to your ERP.

Independent web app at chat.twendeesoft.com with shared‑cookie SSO from work.twendeesoft.com. SSE streaming, scope confirmation, ERP audit binding, and a Telegram bridge — all reusing the agent runtime that powers your ERP today.

00 — Overview

Six surfaces, one runtime.

From parent-cookie SSO at .twendeesoft.com through scope confirmation to ERP audit binding — every step preserves the same erp_user_id and tenant scope.

01
SSO splash
Cookie present? Boot. Else redirect to work.twendeesoft.com/login.
02
User boot
/me hydrates user, tenant, role mapping, feature flags.
Hero
03
Chat surface
Compose · stream · confirm scope · pin entities · open in ERP.
04
Tool execution
Sales / Delivery / Customer-care agents via inter-agent bus.
05
ERP write
Tenant-scoped HTTP with token cache · re-login on 401.
06
Audit emit
pipeline_events with erp_user_id + correlation id.
latency budget p95 first-token < 800ms · tool round-trip < 2.4s
⌘Kcommand palette
01 — Auth

Single login. Both surfaces.

A parent-domain cookie scoped to .twendeesoft.com covers both work.twendeesoft.com and chat.twendeesoft.com. Chat never renders a login form — only a transient splash while the cookie is verified.

HttpOnly · Secure · SameSite=Lax cookie, set by /auth/login on parent domain.
Double-submit twd_csrf cookie + X-CSRF-Token header for write methods.
Logout broadcast via BroadcastChannel('twd-auth') drops every open tab.
chat.twendeesoft.com
A
Verifying your session

Reading parent-domain cookie from .twendeesoft.com

Cookie verified 12ms
/me hydrated 94ms
Loading workspace
Not signed in? You'll be redirected to work.twendeesoft.com/login with a return URL.
02 — Chat surface

Operator console.

chat.twendeesoft.com / s/2026-Q2-pipeline-review
2026 Q2 pipeline review
connected
corr_3a2f · sales-agent · gpt-4-class · 28 turns · 9.4k tokens
Open in ERP
Pinned
D D-1192 · An Phú Group
A acc_88421 · Saigon Tech Co
SO SO-4521
today · 12:31
List my deals closing in Q2 with no recent activity. Group by owner.
12:31·Linh Mai
LM
A
Agentee sales-agent streaming
tools.deals.list · { owner_id: 2041, close_q: 'Q2', activity_max_days: 14 } 312ms
Found 14 deals matching your filter, grouped by owner. Total pipeline value: ₫4.82B.
Deals · Q2 stale 14 results
View list in ERP
D-1192
An Phú Group · annual renewal
Last activity 22d · stage: Negotiation
₫820M stale
D-1207
Saigon Tech Co · platform upgrade
Last activity 18d · stage: Proposal
₫1.2B stale
D-1218
Hà Nội Logistics · pilot expansion
Last activity 7d · stage: Discovery
₫380M fresh
+ 11 more
12:34·312ms tool·1.8s total
Quick actions tab to cycle
/ for slash commands
enter to send · shift+enter for newline 12 / 4000
03 — Guardrails

Confirm before write.

Clarify scope scope ambiguity
You said "Update the deal stage". I found 3 candidates from your pinned entities and recent context.
esc to cancel
Approval required write · ERP
Agentee wants to close deal D-1192 as Won and post an invoice draft to An Phú Group for ₫820,000,000.
tool
deals.transition
tenant
Mai Linh Distribution
stage
Negotiation → Won
side-effects
Invoice draft · email queued
approved by you · audited as erp_user 2041
04 — Sessions

Resumable, shareable, scoped.

Every session is keyed by erp_user_id × tenant_id, persisted server-side, and replayable from audit. Switch in the sidebar — context (pinned entities, transcript, tool history) hydrates from the same store.

Session
Status
Agent
Last touch
Turns
2026 Q2 pipeline review
s_3a2f · 3 pinned entities
active
sales-agent
12:34 · 2m ago
28
SO #4521 delivery status
s_3a1c · 1 pinned entity
awaiting input
delivery-agent
11:08 · 1h 28m
9
Draft proposal — Saigon Tech
s_2f99 · approval pending
HITL approval
sales-agent
10:42 · 1h 54m
14
Stock check — wh-hn-01
s_2e10 · alert raised
alert
customer-care
09:18 · 3h 18m
6
Lead intake — Linh Mai
s_2c41 · closed clean
closed
sales-agent
yesterday
11
05 — Audit

Bound to erp_user_id.

Every tool call writes to pipeline_events with the operator's ERP user, tenant, correlation id, and tool name. Replay any session deterministically.

Today · tool calls
1,284
↑ 12% vs 7d avg
p95 first-token
684ms
Approval rate
94.2%
Refresh p95
142ms
401 retries
0.18%
pipeline_events · today tenant_42
Time Tool Operator Entity Status Latency
12:34:18 deals.list Linh Mai · 2041 ok 312ms
12:35:02 deals.transition Linh Mai · 2041 D-1192 approved 847ms
12:35:09 invoices.draft Linh Mai · 2041 acc_88421 ok 528ms
12:36:41 stock.check Tu Anh · 2089 wh-hn-01 retry 1.2s
12:38:14 delivery.eta Linh Mai · 2041 SO-4521 ok 204ms
12:40:55 auth.refresh Linh Mai · 2041 silent 142ms
showing 6 / 1,284 retention 90 days · partition by tenant_id
06 — Settings

Lean preferences. ERP source-of-truth.

Identity, role, and tenant come from the ERP. Chat owns only display preferences and Telegram pairing. One link out to the full settings surface.

Identity
Name
Linh Mai
ERP user
2041
Tenant
Mai Linh Distribution · tenant_42
Role
Sales read · write · approve
Identity is read-only here · edit in ERP.
Display
Telegram pairing
Linked: @linhmai_twd · last seen 2m ago
07 — Telegram bridge

Off-desk reach.

Operators on the road approve, query, and acknowledge in Telegram. Same agent runtime, same audit, same erp_user_id — pairing one-off via deep link from chat.twendeesoft.com.

Webhook → bus → tenant routing on bot username, not chat id.
Approval inline buttons for risky tools — same payload schema as web.
Rate-limited; bot replies degrade gracefully when token limit hit.
A
@agentee_twd
bot · paired with Linh Mai
online
Hi Linh, I drafted the Q2 review. 3 deals need approval to advance.
12:39
D-1192 · An Phú Group
Negotiation → Won · ₫820M · invoice draft included
Approved. Send invoice to finance@anphugroup.vn.
12:40 ✓✓
Done.
D-1192 → Won · INV-9821 drafted · audit_3a2f
12:40
08 — Edge cases

Fail loudly. Recover quietly.

session expired
Cookie refresh in flight

Composer disabled with shimmer. Background /auth/refresh retries; chat resumes on success.

POST /auth/refresh
→ 200 · token rotated · 142ms
tool failure
ERP returned 503

Inline error card with retry. Audit row marked failed; correlation id surfaced.

tools.invoices.draft
→ 503 · upstream timeout
retry-after: 4s · attempt 1/3
scope mismatch
Tenant boundary crossed

Pinned entity from different tenant rejected before tool call. User offered to switch context explicitly.

D-9981 belongs to tenant_07
→ rejected · suggest switch
09 — Mobile

Pocket-grade.

Same agent, half the chrome. Sessions sheet, sticky composer with quick-actions, single tap to Open in ERP.

Tap target
≥ 44px
Composer font
16px
no zoom on focus
Viewport
100dvh
Offline
queue
flush on reconnect
Q2 pipeline
28 turns
Found 14 stale Q2 deals.
D-1192 · An Phú
₫820M · 22d stale
Send a nudge email.
Approve write
deals.transition
Close D-1192 as Won and post invoice to An Phú Group?
amount₫820,000,000
side-effects1 email