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
| Python | |
|---|---|
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
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
readable(location)
Accept local reads and declared sources resolved by the test interpreter.
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.