Heartbeats
heartbeats.HeartbeatLog
The dispatch_heartbeats table in ~/.cc-transcript/decisions.db.
Usage
heartbeats.HeartbeatLog(actor)Opened in WAL mode with a busy timeout, matching the decision ledger it shares a file with. beat upserts one (session, event) row per dispatch, so a session holds at most one row per event. Requires a local disk — WAL does not work over NFS.
Example
>>> log = await HeartbeatLog.open()
>>> async with log:
... await log.beat(session_id, "PreToolUse", ts_ms)
... await log.for_session(session_id)Methods
| Name | Description |
|---|---|
| beat() |
Records one dispatch of event in session_id at ts_ms (upsert; count += 1).
|
| close() | Closes the underlying connection; a second call is a no-op. |
| for_session() |
Every (session, event) beat for session_id, ordered by first dispatch.
|
| open() |
Opens the exact v1 decision ledger at path.
|
beat()
Records one dispatch of event in session_id at ts_ms (upsert; count += 1).
Usage
beat(session_id, event, ts_ms)close()
Closes the underlying connection; a second call is a no-op.
Usage
close()for_session()
Every (session, event) beat for session_id, ordered by first dispatch.
Usage
for_session(session_id)open()
Opens the exact v1 decision ledger at path.
Usage
open(path=None)