annals.sessions#
The sessions that made a document: each one’s name and the link that opens it.
A document’s meta carries them as sessions, a list of {"name": ..., "url": ...}
in the order they first worked on it: the session that published it, then each session
that published a new version (annals publish --replace). A group shows the sessions of
its documents. The link is a claude.ai link (https://claude.ai/code/<bridge session id>),
which only the owner can open; it is provenance, like source and artifact, so it is
never part of the document’s own content and leaves with the meta: a share or a room shows
an allowlist of meta fields that does not name it.
>>> sessions_of({"source": {"session": "b2", "session_url": "https://claude.ai/code/session_01X"}})
[{'name': 'b2', 'url': 'https://claude.ai/code/session_01X'}]
>>> merged_sessions([{"name": "a", "url": ""}], [{"name": "a", "url": "https://claude.ai/code/s"}, {"name": "b", "url": ""}])
[{'name': 'a', 'url': 'https://claude.ai/code/s'}, {'name': 'b', 'url': ''}]
Module Attributes
the claude.ai link of a session, from its Remote Control (bridge) session id |
|
its Remote Control session id |
|
the first, and the latest ones (a living page republished by a new session every day would otherwise grow without end) |
|
the most entries read from a meta written elsewhere, before merging |
Functions
|
|
|
The sessions of |
|
The names of the sessions that made |
|
The claude.ai link of the Claude Code session this process runs in, or |
|
The sessions that made the document |
- annals.sessions.BRIDGE_ENV_VAR = 'CLAUDE_CODE_BRIDGE_SESSION_ID'#
its Remote Control session id
- Type:
the variable Claude Code sets in a session’s shell
- annals.sessions.MAX_READ = 200#
the most entries read from a meta written elsewhere, before merging
- annals.sessions.MAX_SESSIONS = 12#
the first, and the latest ones (a living page republished by a new session every day would otherwise grow without end)
- Type:
the most sessions a document keeps
- annals.sessions.SESSION_URL_TEMPLATE = 'https://claude.ai/code/{bridge_id}'#
the claude.ai link of a session, from its Remote Control (bridge) session id
- annals.sessions.checked_sessions(sessions, check_url)[source]#
sessionswith each linkcheck_urlrefuses (it raisesValueError) emptied: a meta written by another publisher is checked again before a page shows its links.
- annals.sessions.merged_sessions(*lists, limit=12)[source]#
The sessions of
listsin order, one entry each: the same link, or the same name when one of the two has no link, is the same session (the link is kept). At mostlimit: the first session and the latest ones.>>> [s["name"] for s in merged_sessions([{"name": str(i), "url": ""} for i in range(20)], limit=4)] ['0', '17', '18', '19']
- annals.sessions.session_names(meta)[source]#
The names of the sessions that made
meta’s document (forls --session).
- annals.sessions.session_url_from_env(env=None, *, var='CLAUDE_CODE_BRIDGE_SESSION_ID', template='https://claude.ai/code/{bridge_id}')[source]#
The claude.ai link of the Claude Code session this process runs in, or
"".>>> session_url_from_env({"CLAUDE_CODE_BRIDGE_SESSION_ID": "session_01X"}) 'https://claude.ai/code/session_01X' >>> session_url_from_env({}) ''
- Return type: