@misterhuydo/sentinel 1.0.99 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cairn/.hint-lock +1 -1
- package/.cairn/session.json +2 -2
- package/package.json +1 -1
- package/python/sentinel/slack_bot.py +22 -6
package/.cairn/.hint-lock
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2026-03-
|
|
1
|
+
2026-03-23T08:08:15.205Z
|
package/.cairn/session.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"message": "Auto-checkpoint at 2026-03-
|
|
3
|
-
"checkpoint_at": "2026-03-
|
|
2
|
+
"message": "Auto-checkpoint at 2026-03-23T08:28:23.743Z",
|
|
3
|
+
"checkpoint_at": "2026-03-23T08:28:23.744Z",
|
|
4
4
|
"active_files": [],
|
|
5
5
|
"notes": [],
|
|
6
6
|
"mtime_snapshot": {}
|
package/package.json
CHANGED
|
@@ -379,9 +379,9 @@ async def _run_turn(session: _Session, message: str, client, cfg_loader, store,
|
|
|
379
379
|
if len(session.history) > _MAX_HISTORY_TURNS * 2:
|
|
380
380
|
session.history = session.history[-(_MAX_HISTORY_TURNS * 2):]
|
|
381
381
|
|
|
382
|
-
#
|
|
382
|
+
# Post "thinking..." and keep its ts so we can replace it with the real reply
|
|
383
383
|
session.busy = True
|
|
384
|
-
await _post(client, channel, "_thinking..._")
|
|
384
|
+
thinking_ts = await _post(client, channel, "_thinking..._")
|
|
385
385
|
|
|
386
386
|
reply = ""
|
|
387
387
|
is_done = True
|
|
@@ -401,20 +401,36 @@ async def _run_turn(session: _Session, message: str, client, cfg_loader, store,
|
|
|
401
401
|
finally:
|
|
402
402
|
session.busy = False
|
|
403
403
|
|
|
404
|
-
|
|
404
|
+
if thinking_ts:
|
|
405
|
+
await _update(client, channel, thinking_ts, reply)
|
|
406
|
+
else:
|
|
407
|
+
await _post(client, channel, reply)
|
|
405
408
|
# If session ended, save current history; if history was just cleared it will already be [] in DB
|
|
406
409
|
store.save_conversation(session.user_id, session.history)
|
|
407
410
|
|
|
408
411
|
|
|
409
412
|
# ── Helpers ───────────────────────────────────────────────────────────────────
|
|
410
413
|
|
|
411
|
-
async def _post(client, channel: str, text: str) ->
|
|
414
|
+
async def _post(client, channel: str, text: str) -> str:
|
|
415
|
+
"""Post a message and return its ts (for later update), or '' on failure."""
|
|
412
416
|
if not text:
|
|
413
|
-
return
|
|
417
|
+
return ""
|
|
414
418
|
try:
|
|
415
|
-
await client.chat_postMessage(channel=channel, text=text)
|
|
419
|
+
resp = await client.chat_postMessage(channel=channel, text=text)
|
|
420
|
+
return resp.get("ts", "")
|
|
416
421
|
except Exception as e:
|
|
417
422
|
logger.warning("Slack post failed: %s", e)
|
|
423
|
+
return ""
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
async def _update(client, channel: str, ts: str, text: str) -> None:
|
|
427
|
+
"""Delete the 'thinking...' message then post the real reply as a clean message."""
|
|
428
|
+
if ts:
|
|
429
|
+
try:
|
|
430
|
+
await client.chat_delete(channel=channel, ts=ts)
|
|
431
|
+
except Exception as e:
|
|
432
|
+
logger.debug("Could not delete thinking message: %s", e)
|
|
433
|
+
await _post(client, channel, text)
|
|
418
434
|
|
|
419
435
|
|
|
420
436
|
async def _resolve_name(client, user_id: str) -> str:
|