Session contracts
session_contracts
SessionContractRegistry
Thread-safe registry of write contracts keyed by session identity.
Source code in packages/axm-mcp/src/axm_mcp/session_contracts.py
bind(session_id, contract)
Bind a write contract to one session.
purge_expired(now)
Drop bindings whose age is greater than the configured TTL.
Source code in packages/axm-mcp/src/axm_mcp/session_contracts.py
release(session_id)
resolve(session_id)
Return the contract bound to a session.
Source code in packages/axm-mcp/src/axm_mcp/session_contracts.py
| Python | |
|---|---|
UnboundSessionError
WriteContract
dataclass
Validated wire representation of a session filesystem write scope.
A prefix listed in markdown_only_prefixes carries a nature on top
of its path: it grants Markdown sidecars only. Without it, a documentation
prefix would have to be narrowed by whoever produces the contract, and
every producer would reinvent that filter — the divergence this field
exists to prevent. Such a prefix must also appear in allowed_prefixes;
one that does not is dropped rather than silently granting a wider path.
Source code in packages/axm/src/axm/tools/write_scope.py
contains(location)
Return whether a resolved location is under the execution root.
from_json(raw)
classmethod
Decode, validate and normalize a JSON transport payload.
Source code in packages/axm/src/axm/tools/write_scope.py
| Python | |
|---|---|
from_mapping(raw)
classmethod
Validate and normalize a transported contract mapping.
Source code in packages/axm/src/axm/tools/write_scope.py
permits(location)
Return whether a resolved location is under an allowed prefix.
A location granted only by Markdown-restricted prefixes must itself be Markdown: those prefixes carry a nature, not merely a path. A location also covered by an unrestricted prefix keeps that grant.
Source code in packages/axm/src/axm/tools/write_scope.py
resolve(base, candidate)
WriteContractHeaderError
parse_write_contract_header(raw)
Decode and validate an X-AXM-Write-Contract header value.