Skip to main content

canonicalize

Method
This is a method of the BasePlatformAdapter class in the base module.
Map a raw, potentially-volatile platform id to a stable canonical id. Consulted on the session-key path before link/pairing resolution so an alias/format change for the same human (e.g. WhatsApp’s JID→LID migration, a number↔UUID alias flip) collapses to one stable session key — preserving transcript, memory and in-flight run-state — instead of silently forking the conversation. This is the :class:~praisonaiagents.gateway.protocols. IdentityCanonicalizerProtocol method, so a BasePlatformAdapter conforms structurally and can be handed anywhere that protocol is accepted. Default is the identity function, so adapters that do not override this are fully backward-compatible (the raw id keys the session exactly as before). Implementations MUST be deterministic and total: return the raw id unchanged when no canonical form is known, never raise.

Signature

Parameters

str
required
No description available.
str
required
No description available.

Returns

str
The result of the operation.

Source

View on GitHub

praisonaiagents/bots/base.py at line 461