feat(chat): per-user inbox anchor for listing kind=value threads

EA2 doesn't expose a generic flow-by-kind list endpoint; flow/processes
is definition-only. Migrated chat to flow.kind=value, so direct listing
needed a new strategy.

- Each user has a deterministic inbox flow.kind=value doc keyed by
  email slug. ensureInbox() creates it idempotently on first listThreads.
- createThread links the new thread into BOTH participants' inboxes via
  defines edges with role='presentation' (each link is one apply-batch).
- listThreads(userEmail) reads defines edges from the user's inbox key.
  No more reliance on source_context regex filtering through the
  definition catalogue.

Updated all 3 call sites: Chat.tsx (mount + after-create refresh) and
agentTools.send_chat. 31/31 tests green.
This commit is contained in:
2026-06-14 13:51:53 +04:00
parent 8f35f7b88b
commit 7aaba5fb47
3 changed files with 85 additions and 17 deletions
+2 -2
View File
@@ -34,7 +34,7 @@ export default function Chat() {
let cancelled = false;
setLoadingThreads(true);
chatApi
.listThreads()
.listThreads(me)
.then((rows) => {
if (cancelled) return;
setThreads(rows);
@@ -73,7 +73,7 @@ export default function Chat() {
try {
const otherLabel = personaLabel(recipient);
const key = await chatApi.createThread(`${personaLabel(me)}${otherLabel}`, [me, recipient]);
const next = await chatApi.listThreads();
const next = await chatApi.listThreads(me);
setThreads(next);
setActiveKey(key);
pushToast("ok", `Thread opened with ${otherLabel}`);