Skip to main content

Module activity

Module activity 

Source
Expand description

Facade of lean-ctx-activity: the per-session activity stream under <data dir>/activity, with this Instance’s secret redaction. Producers (hooks, MCP calls, ACP client callbacks) call record; it never fails the caller.

Structs§

Draft
What a producer reports; the store adds seq and at, redacts and bounds.
Event
One stored event: one line of a session’s log, and one item of activity.list (Local Read v1).
Filter
What a listing selects. session and project_root narrow, both may be given; with neither the listing is empty.
Listing
A listing: the newest limit matches, sorted oldest → newest.
Store
The activity store under one root directory.

Enums§

Kind
What happened.
Outcome
How a tool call, shell command or permission prompt ended.
Source
Who reported the event.

Constants§

DEFAULT_LIMIT
Events returned when no limit is given.
MAX_LABEL_BYTES
Longest label kept (session id, agent, tool name), in bytes.
MAX_LIMIT
The largest limit a listing accepts.
MAX_ROOT_BYTES
Longest project root kept, in bytes.
MAX_SESSIONS_PER_PROJECT
Sessions kept per project (most recently written).
MAX_SESSION_BYTES
A session log larger than this keeps its newest half.
MAX_SESSION_ID_BYTES
Longest accepted id.
MAX_SESSION_NAME_CHARS
Longest accepted session name, in characters.
MAX_TARGET_BYTES
Longest target kept (path, redacted shell command, URL, query), in bytes.
MAX_TEXT_BYTES
Longest message text kept (user or agent message, permission prompt, error), in bytes; longer text is cut at a char boundary.
SESSION_ENV
Environment variable naming the app’s session (LEAN_CTX_SESSION_ID).
SESSION_HEADER
Request header naming the app’s session at the proxy.
SESSION_NAME_ENV
Environment variable naming the app’s session for people (LEAN_CTX_SESSION_NAME, e.g. “LeanCTX · Contracts”): shown on the bus presence, never used to attribute or authorize anything.

Functions§

project_root
The project root a stream is kept under: normalized and promoted to its git root, so a hook’s cwd in a subdirectory, the MCP session’s root and a reader’s --project-root name the same project.
record
Record draft now: secrets masked (core::redaction, the shell’s redaction), text bounded. Fail-open: an event that cannot be stored is dropped with a debug log.
session_id
raw as a session id: trimmed, 1–128 bytes of [A-Za-z0-9._:-]; anything else is no id (ignored, never an error).
session_id_from_env
The app session id of this process (SESSION_ENV), if valid.
session_name
raw as a session name: trimmed, 1–128 characters, no control characters; anything else is no name (ignored, never an error).
session_name_from_env
The app session name of this process (SESSION_NAME_ENV), if valid.
store
The store of this Instance.