Reconcile proven completed inputs without replay and hide internal fact notices

This commit is contained in:
aiagent
2026-10-20 00:52:29 -07:00
parent 885d6a842e
commit 43c99e78e2
12 changed files with 173 additions and 34 deletions
+5 -1
View File
@@ -1067,12 +1067,16 @@ class Store:
def conversation(self, sid):
from .conversation import project
from .notices import fact_answer_notice
sid = identifier(sid)
with self.db() as db:
self._get(db, 'sessions', sid)
rows = db.execute('SELECT * FROM (SELECT * FROM messages WHERE session_id=? ORDER BY created DESC LIMIT 500) ORDER BY created', (sid,)).fetchall()
links = [json.loads(row['data']) for row in db.execute('SELECT data FROM history_links WHERE session_id=?', (sid,))]
return project([dict(row) for row in rows], links)
notices = [json.loads(row['data']) for row in db.execute(
"SELECT data FROM decision_workflow_notifications WHERE json_extract(data,'$.target')='decision' "
"AND json_extract(data,'$.decision.session_id')=? AND json_extract(data,'$.event.kind')='fact_answered'", (sid,))]
return project([dict(row) for row in rows], links, {fact_answer_notice(n) for n in notices})
def claim(self, data):
sid, worker = identifier(data.get('session_id')), identifier(data.get('worker_id'))