compute_config_revision
Function
This function is defined in the protocols module.Return a stable, short revision id for a gateway config mapping. Deterministic hash over the canonical form of
config (keys sorted,
whitespace-insensitive) so the same logical config always yields the same
revision regardless of key ordering or formatting. Comparing the revision
of the running config against the revision of what is on disk gives a
first-class config-drift signal (“did my change take effect / is a restart
still owed?”).
Pure and dependency-free (stdlib json + hashlib) so it lives in
core and is reused by both the SDK and the bot without divergence.
Signature
Parameters
Optional
required
The parsed gateway config mapping (or
None/empty).Returns
str
A 12-character hex revision id; a stable sentinel for an empty config.
Uses
json.dumpshexdigesthashlib.sha256canonical.encode
Source
View on GitHub
praisonaiagents/gateway/protocols.py at line 1156
