Files
pad/internal/server/testdata
xarmian 1c6c9740ab feat(server): chat HTTP API and access model (TASK-4039) (#2292)
* feat(server): chat API core: conversations, messages, read marker, unread, limits (TASK-4039, part A)

Add membership-gated chat HTTP endpoints, credential-derived authorship,
private wire DTOs, replay and read markers, and per-agent/user limits.
Document the access and provenance model and pin it with handler guards.

Claude-Session: https://claude.ai/code/session_01LL3BV3H4zot6QrMQMsVfVc

* feat(server): chat read-time visibility for context workspace and item refs (TASK-4039, part B)

Authorize context workspaces on send and at read time, omitting hidden
contexts and projecting item refs through the caller's current access.
Keep unknown and denied refs indistinguishable, with unresolved overflow
past 50 distinct refs per response. Pin the wire behavior and document it.

Claude-Session: https://claude.ai/code/session_01LL3BV3H4zot6QrMQMsVfVc

* fix(chat): a retry replays after context loss; sentinel for context refusal; source, ref cap and empty body (TASK-4039, r1)

F1: Add a read-only replay lookup scoped to the author's current conversation
membership, and replay identical HTTP retries after context access loss with
the same ChatSend charge as normal replays.
F2: Use a context refusal sentinel wrapping ErrInvalidConversationInput while
preserving the store error text and HTTP response body.
F3: Derive chat source from the actor's bearer signal, preserving in-process
remote MCP attribution; assert the router rejects stray Basic authorization.
F4: Count only distinct refs with a workspace toward the 50-ref lookup cap.
F5: Accept empty conversation-ensure bodies for agents while humans still
require agent_key. Document the lookup cap and remaining-token header.

Claude-Session: https://claude.ai/code/session_01LL3BV3H4zot6QrMQMsVfVc

* fix(chat): refs capped at 200 with refs_truncated; ensure charges only a create (TASK-4039, r2)

L1: Cap deduplicated response refs at 200, retain the 50-lookup limit,
report refs_truncated on list/send/replay, and stop extraction after a drop.
Document plain-text fallback and cover 6,000 refs, duplicates, and false flags.

L2: Validate agent keys and check the owner's inbox before charging ChatDM.
Reuse is free; only creation attempts spend a token. Document the concurrent
create race and cover 40 reuses, invalid keys, and the 30/hour creation cap.

Claude-Session: https://claude.ai/code/session_01LL3BV3H4zot6QrMQMsVfVc

* fix(chat): a human's agent_key must already be a normalised agent name (TASK-4039, r3)

Claude-Session: https://claude.ai/code/session_01LL3BV3H4zot6QrMQMsVfVc
2026-10-23 16:07:40 -04:00
..