macp-sdk-python 0.12.1__tar.gz → 0.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/PKG-INFO +1 -1
  2. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/pyproject.toml +1 -1
  3. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/projections.py +4 -1
  4. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/proposal.py +39 -4
  5. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/quorum.py +6 -2
  6. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk_python.egg-info/PKG-INFO +1 -1
  7. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/LICENSE +0 -0
  8. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/README.md +0 -0
  9. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/setup.cfg +0 -0
  10. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/__init__.py +0 -0
  11. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/_logging.py +0 -0
  12. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/agent/__init__.py +0 -0
  13. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/agent/cancel_callback.py +0 -0
  14. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/agent/dispatcher.py +0 -0
  15. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/agent/participant.py +0 -0
  16. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/agent/runner.py +0 -0
  17. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/agent/strategies.py +0 -0
  18. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/agent/transports.py +0 -0
  19. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/agent/types.py +0 -0
  20. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/auth.py +0 -0
  21. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/base_projection.py +0 -0
  22. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/base_session.py +0 -0
  23. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/client.py +0 -0
  24. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/commitment_hash.py +0 -0
  25. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/constants.py +0 -0
  26. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/decision.py +0 -0
  27. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/envelope.py +0 -0
  28. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/errors.py +0 -0
  29. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/handoff.py +0 -0
  30. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/policy.py +0 -0
  31. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/proto_registry.py +0 -0
  32. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/py.typed +0 -0
  33. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/retry.py +0 -0
  34. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/task.py +0 -0
  35. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/validation.py +0 -0
  36. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk/watchers.py +0 -0
  37. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk_python.egg-info/SOURCES.txt +0 -0
  38. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk_python.egg-info/dependency_links.txt +0 -0
  39. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk_python.egg-info/requires.txt +0 -0
  40. {macp_sdk_python-0.12.1 → macp_sdk_python-0.13.0}/src/macp_sdk_python.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macp-sdk-python
3
- Version: 0.12.1
3
+ Version: 0.13.0
4
4
  Summary: Python SDK for the MACP Rust runtime
5
5
  Author-email: Multi-Agent Coordination Protocol <macp@multiagentcoordinationprotocol.org>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "macp-sdk-python"
7
- version = "0.12.1"
7
+ version = "0.13.0"
8
8
  description = "Python SDK for the MACP Rust runtime"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -132,7 +132,10 @@ class DecisionProjection(BaseProjection):
132
132
  """Count votes per proposal, keyed by proposal_id.
133
133
 
134
134
  ABSTAIN votes are tracked but excluded from the totals returned
135
- here (which counts only APPROVE votes).
135
+ here (which counts only APPROVE votes). A proposal_id that received
136
+ no votes at all is **absent** from the returned dict -- not present
137
+ with a 0 value. Use ``.get(proposal_id, 0)`` when checking an
138
+ arbitrary proposal_id.
136
139
  """
137
140
  totals: dict[str, int] = {}
138
141
  for proposal_id, sender_votes in self.votes.items():
@@ -25,7 +25,7 @@ class ProposalRecord:
25
25
  proposal_id: str
26
26
  title: str
27
27
  summary: str
28
- proposer: str
28
+ sender: str
29
29
  supersedes: str # "" if original
30
30
  # Reachable values only. An Accept is recorded on the projection's
31
31
  # ``accepts`` list (and surfaced via ``accepted_proposal`` /
@@ -45,6 +45,30 @@ class ProposalRecord:
45
45
  status: str # "open" | "rejected" | "withdrawn"
46
46
  tags: list[str]
47
47
 
48
+ # ── Deprecated alias (issue #120 / multiagentcoordinationprotocol#177) ──
49
+ # ``proposer`` is kept as a read-only, INSTANCE-level property alias for
50
+ # one minor version, removed at this SDK's next major version. This is a
51
+ # different mechanism from the module-level ``__getattr__``/PEP 562
52
+ # aliases below (``RejectRecord``/``AcceptRecord``, issue #103): those
53
+ # intercept MODULE attribute access (``macp_sdk.proposal.RejectRecord``);
54
+ # PEP 562 has no bearing on INSTANCE attribute access
55
+ # (``some_record.proposer``), which is what this field needs. A
56
+ # ``@dataclass(slots=True)`` class derives ``__slots__`` strictly from
57
+ # its annotated fields, so a plain same-named class attribute alias is
58
+ # not an option here -- but a property is not a field and is untouched
59
+ # by the slots transformation, so it coexists cleanly: ``fields()``,
60
+ # ``__slots__``, ``repr()``, and ``dataclasses.replace()`` all still
61
+ # see/use only the real ``sender`` field. No setter is defined: nothing
62
+ # in this module ever assigns ``.proposer``.
63
+ @property
64
+ def proposer(self) -> str:
65
+ warnings.warn(
66
+ "ProposalRecord.proposer is deprecated; use ProposalRecord.sender instead.",
67
+ DeprecationWarning,
68
+ stacklevel=2,
69
+ )
70
+ return self.sender
71
+
48
72
 
49
73
  @dataclass(slots=True)
50
74
  class ProposalRejectRecord:
@@ -94,7 +118,7 @@ class ProposalProjection(BaseProjection):
94
118
  proposal_id=p.proposal_id,
95
119
  title=p.title,
96
120
  summary=p.summary,
97
- proposer=envelope.sender,
121
+ sender=envelope.sender,
98
122
  supersedes="",
99
123
  status="open",
100
124
  tags=list(p.tags),
@@ -108,7 +132,7 @@ class ProposalProjection(BaseProjection):
108
132
  proposal_id=p.proposal_id,
109
133
  title=p.title,
110
134
  summary=p.summary,
111
- proposer=envelope.sender,
135
+ sender=envelope.sender,
112
136
  supersedes=p.supersedes_proposal_id,
113
137
  status="open",
114
138
  tags=[],
@@ -141,9 +165,20 @@ class ProposalProjection(BaseProjection):
141
165
  )
142
166
  if p.terminal:
143
167
  rec = self.proposals.get(p.proposal_id)
168
+ # A terminal Reject must name a proposal this projection has
169
+ # actually seen (RFC-MACP-0008 §5 rule 3) before it ends the
170
+ # negotiation. "TerminalRejected" is in TERMINAL_PHASES
171
+ # (agent/participant.py:57-59), so moving phase here for an
172
+ # unknown proposal_id would fire a Participant's on_terminal
173
+ # and tear down its stream for a session that never actually
174
+ # terminated. Same shape as task.py's per-task gates
175
+ # (:172/:196/:212): gate the state transition, keep the
176
+ # audit append above unconditional. has_terminal_rejection()
177
+ # / is_terminally_rejected() deliberately still read
178
+ # self.rejections, not phase, so they stay True either way.
144
179
  if rec is not None:
145
180
  rec.status = "rejected"
146
- self._set_phase("TerminalRejected")
181
+ self._set_phase("TerminalRejected")
147
182
  return
148
183
 
149
184
  if mt == "Withdraw":
@@ -97,8 +97,12 @@ class QuorumProjection(BaseProjection):
97
97
  # enforces RFC-MACP-0011 §5 rule 3's *across-type* cardinality rule
98
98
  # ("at most one ballot across Approve, Reject, or Abstain"). First
99
99
  # ballot per sender stands; which-of-two-stands is inferred from
100
- # RFC-MACP-0007 §5.3 parity plus what the only runtime enforces
101
- # (quorum.rs:164/184/204) -- RFC-0011 itself is silent on that.
100
+ # RFC-MACP-0007 §5.3 parity plus what the only runtime enforces: the
101
+ # three same-sender ballot guards in macp-runtime's
102
+ # crates/macp-modes/src/mode/quorum.rs (QuorumMode's
103
+ # Approve/Reject/Abstain arms, each rejecting when
104
+ # state.ballots.contains_key(&env.sender), confirmed at runtime
105
+ # v0.8.6) -- RFC-0011 itself is silent on that.
102
106
  sender = envelope.sender
103
107
  sender_map = self.ballots.setdefault(request_id, {})
104
108
  existing = sender_map.get(sender)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macp-sdk-python
3
- Version: 0.12.1
3
+ Version: 0.13.0
4
4
  Summary: Python SDK for the MACP Rust runtime
5
5
  Author-email: Multi-Agent Coordination Protocol <macp@multiagentcoordinationprotocol.org>
6
6
  License: Apache-2.0