Heartbeats

heartbeats.HeartbeatLog

The dispatch_heartbeats table in ~/.cc-transcript/decisions.db.

Usage

Source

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

Source

beat(session_id, event, ts_ms)
close()

Closes the underlying connection; a second call is a no-op.

Usage

Source

close()
for_session()

Every (session, event) beat for session_id, ordered by first dispatch.

Usage

Source

for_session(session_id)
open()

Opens the exact v1 decision ledger at path.

Usage

Source

open(path=None)