fix(a2a): unambiguous session scopes and validated context ids

This commit is contained in:
EugeneTes
2026-10-07 14:29:50 +00:00
parent d542fcfe42
commit 0d1ddcc4df
6 changed files with 52 additions and 6 deletions

View File

@@ -78,8 +78,10 @@ restart to reach that one endpoint (`/.well-known/agent-card.json` and the exten
## Sessions
One `AgentSession` per `(caller, contextId)`, opened or resumed the first time a message names that `contextId`
(a missing one gets a fresh UUID). Scope: `<ScopePrefix>-a2a-<caller>-<contextId>` (the Telegram host's
`ScopePrefix` is `telegram-<chatId>`). The session runs in the caller's workspace, so it loads that workspace's
(a missing one gets a fresh UUID). A client-chosen `contextId` must match `[A-Za-z0-9_-]{1,100}`, otherwise the
message is refused with `InvalidParams`. Scope: `<ScopePrefix>-a2a-<caller>_<contextId>` (the Telegram host's
`ScopePrefix` is `telegram-<chatId>`); caller names never contain `_`, so two different callers or contexts can't
share a session. The session runs in the caller's workspace, so it loads that workspace's
`AGENTS.md` (or `CLAUDE.md`), `PERSONA.md` and `MEMORY.md` exactly like any other session there — same persona,
same memory, separate conversation. It does **not** get a calendar (Google Calendar connections are keyed by
session scope, and an A2A scope never connects one).