Mandate Protocol: explicit, bounded authority for one Player to represent another. Release 1 implements the request side only. A request is an invitation to evaluate representation; it grants no authority.
Mandate Protocol: explicit, bounded authority for one Player to represent another. Release 1 implements the request side only. A request is an invitation to evaluate representation; it grants no authority.
(authority-decision state
actor
{:keys [mandate-id revision action subject]}
timestamp)Answer, from state alone, whether actor may take action on subject now.
Public and pure on purpose. The Market bridge must verify authority synchronously, inside the same authoritative Game transition as the command it guards, so what it needs is a function it can call — not an event it must send and a response it must trust.
A refusal is a decision, not an error: the caller asked a question and no
is a valid answer with a machine-readable reason attached.
What this CANNOT decide is the free-form constraints a Game wrote into the
terms — territory, channel, price ceilings. Those are domain rules gm-lib
has no way to evaluate, so a grant returns them verbatim alongside
:constraints-evaluated false. A caller that ignores them has not finished
checking.
Answer, from state alone, whether `actor` may take `action` on `subject` now. Public and pure on purpose. The Market bridge must verify authority synchronously, inside the same authoritative Game transition as the command it guards, so what it needs is a function it can call — not an event it must send and a response it must trust. A refusal is a decision, not an error: the caller asked a question and `no` is a valid answer with a machine-readable reason attached. What this CANNOT decide is the free-form `constraints` a Game wrote into the terms — territory, channel, price ceilings. Those are domain rules gm-lib has no way to evaluate, so a grant returns them verbatim alongside `:constraints-evaluated false`. A caller that ignores them has not finished checking.
Statuses in which a Mandate still holds its claim on the subject.
suspended counts, and must: suspension is a pause, not an ending, so a
second exclusive Mandate granted during one would collide the moment it
resumed. pending counts for the same reason — a term that has not started
yet is still promised.
Statuses in which a Mandate still holds its claim on the subject. `suspended` counts, and must: suspension is a pause, not an ending, so a second exclusive Mandate granted during one would collide the moment it resumed. `pending` counts for the same reason — a term that has not started yet is still promised.
Settings a game may override through mandate/set-policy. Defaults are
deliberately conservative: a representative is a seller because that is the
only role every market-bearing game already has, and a game that means
something else says so.
Settings a game may override through `mandate/set-policy`. Defaults are deliberately conservative: a representative is a `seller` because that is the only role every market-bearing game already has, and a game that means something else says so.
The one profile gm-lib ships. It constrains nothing beyond safe-summary
being an object, so a game can send a Mandate request before defining any
domain of its own. Everything else is registered by the game — see
mandate/register-profile.
The one profile gm-lib ships. It constrains nothing beyond `safe-summary` being an object, so a game can send a Mandate request before defining any domain of its own. Everything else is registered by the game — see `mandate/register-profile`.
(handle-accept-terms payload)The principal accepts an exact terms revision, and a Mandate becomes active.
Only the principal may accept. Authority over one's own affairs is granted, never taken, so a representative cannot conclude a negotiation in their own favour however the terms got onto the table.
The revision accepted must be the current one AND must have been proposed by the representative. Those two rules together are what make the record evidence of BOTH parties' assent: the representative assented by proposing it, the principal by accepting it. A principal who wants their own counter must wait for the representative to echo it back — which step 3 deliberately records as a real revision rather than swallowing as a no-op.
The principal accepts an exact terms revision, and a Mandate becomes active. Only the principal may accept. Authority over one's own affairs is granted, never taken, so a representative cannot conclude a negotiation in their own favour however the terms got onto the table. The revision accepted must be the current one AND must have been proposed by the representative. Those two rules together are what make the record evidence of BOTH parties' assent: the representative assented by proposing it, the principal by accepting it. A principal who wants their own counter must wait for the representative to echo it back — which step 3 deliberately records as a real revision rather than swallowing as a no-op.
(handle-authorize payload)(handle-complete payload)Either party marks the engagement finished rather than abandoned.
Neither can harm the other by doing so — completion ends the
representative's own authority, and this protocol settles no money — so the
distinction from revoked is what the record says happened, not who is
allowed to say it.
Either party marks the engagement finished rather than abandoned. Neither can harm the other by doing so — completion ends the representative's own authority, and this protocol settles no money — so the distinction from `revoked` is what the record says happened, not who is allowed to say it.
(handle-propose-terms payload)Propose terms, or counter terms already proposed.
Opening and countering are the same act at different points in a chain, so
they are one capability, told apart by which identifier the caller sends: a
request-id opens a negotiation, a negotiation-id counters one. Only the
representative can open — the principal has already stated what they want in
the request itself — but either party may counter from then on.
Countering carries supersedes, the revision being answered. A mismatch is
a conflict rather than a silent overwrite, so two counters racing cannot
lose one another's terms.
Propose terms, or counter terms already proposed. Opening and countering are the same act at different points in a chain, so they are one capability, told apart by which identifier the caller sends: a `request-id` opens a negotiation, a `negotiation-id` counters one. Only the representative can open — the principal has already stated what they want in the request itself — but either party may counter from then on. Countering carries `supersedes`, the revision being answered. A mismatch is a conflict rather than a silent overwrite, so two counters racing cannot lose one another's terms.
(handle-query-mandates payload)(handle-query-request payload)(handle-query-requests payload)(handle-query-terms payload)(handle-register-profile payload)Register or update one profile version. A profile is pure data — a
description and a safe-summary-schema — because it has to survive the
round trip through MoM as JSON. gm-lib enforces only the subset
game.schema implements; domain rules beyond that belong to the GM.
Idempotent: re-registering identical data succeeds and changes nothing, so a boot-time seeder can run on every start.
Register or update one profile version. A profile is pure data — a description and a `safe-summary-schema` — because it has to survive the round trip through MoM as JSON. gm-lib enforces only the subset `game.schema` implements; domain rules beyond that belong to the GM. Idempotent: re-registering identical data succeeds and changes nothing, so a boot-time seeder can run on every start.
(handle-request payload)(handle-respond-to-request payload)A representative answers a request: begins evaluating it, or declines.
This is a response, NOT authority. Evaluating means only that someone is considering the work; declining removes them from consideration. Neither grants anything, and the request's status stays derived from the set of responses rather than being overwritten here.
A representative answers a request: begins evaluating it, or declines. This is a response, NOT authority. Evaluating means only that someone is considering the work; declining removes them from consideration. Neither grants anything, and the request's status stays derived from the set of responses rather than being overwritten here.
(handle-resume payload)(handle-revoke payload)Either party ends the relationship early.
Both, deliberately: the principal taking authority back and the representative standing down are the same transition seen from two sides, and a protocol that let only one of them out would be modelling servitude. Which of them did it is recorded rather than encoded in separate states.
Either party ends the relationship early. Both, deliberately: the principal taking authority back and the representative standing down are the same transition seen from two sides, and a protocol that let only one of them out would be modelling servitude. Which of them did it is recorded rather than encoded in separate states.
(handle-set-policy payload)Game Master configures who may be a representative, who administers, and
page sizes. Unspecified fields keep their current value, matching
coseller/set-policy.
Game Master configures who may be a representative, who administers, and page sizes. Unspecified fields keep their current value, matching `coseller/set-policy`.
(handle-suspend payload)The principal pauses authority without ending it.
Principal-only. Suspension is a control the grantor holds; a representative who does not wish to act can simply not act, and does not need the protocol to say so on their behalf.
The principal pauses authority without ending it. Principal-only. Suspension is a control the grantor holds; a representative who does not wish to act can simply not act, and does not need the protocol to say so on their behalf.
(handle-withdraw-request payload)(mandate-state payload)(now)Ends that are facts about how the relationship finished, and which nothing later can overwrite.
Ends that are facts about how the relationship finished, and which nothing later can overwrite.
(validate-payload event-key payload)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |