feat(app): an activity log of what Jarvis did (chat actions, schedule deliveries)
Each chat channel action the brain's tool asked for and each schedule delivery is recorded in activity/<day>.jsonl by kind, target, who asked and outcome, never its text, kept 30 days. The worker's chat_action carries the asker. A 한 일 screen lists the newest entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,8 +16,10 @@ def _message(rec) -> dict:
|
||||
|
||||
|
||||
class ChatBridge:
|
||||
def __init__(self, session, loop: asyncio.AbstractEventLoop, turn: int, pending_deletes: dict):
|
||||
def __init__(self, session, loop: asyncio.AbstractEventLoop, turn: int, pending_deletes: dict,
|
||||
user: str | None = None):
|
||||
self._session = session
|
||||
self._user = user # who asked: the app records it with the action (admin.spec.md, "Activity")
|
||||
self._loop = loop
|
||||
self._channels = [dict(c) for c in session.chat_channels]
|
||||
self.turn = turn
|
||||
@@ -39,7 +41,8 @@ class ChatBridge:
|
||||
return store.chat_channel_of(message_id) if store else None
|
||||
|
||||
def act(self, action: str, channel_id: str, **kw: Any) -> dict:
|
||||
fut = asyncio.run_coroutine_threadsafe(self._session.chat_action(action, channel_id, kw), self._loop)
|
||||
args = {**kw, "user": self._user} if self._user else kw
|
||||
fut = asyncio.run_coroutine_threadsafe(self._session.chat_action(action, channel_id, args), self._loop)
|
||||
try:
|
||||
return fut.result(self._session.worker.chat_timeout_s + 5)
|
||||
except Exception as e: # loop gone or the wait broke
|
||||
|
||||
Reference in New Issue
Block a user