getstack 4.4.0__tar.gz → 4.4.1__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 (179) hide show
  1. {getstack-4.4.0 → getstack-4.4.1}/PKG-INFO +1 -1
  2. {getstack-4.4.0 → getstack-4.4.1}/pyproject.toml +1 -1
  3. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/accounts.py +3 -2
  4. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/rentahuman.py +3 -3
  5. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/accounts.py +8 -2
  6. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/client.py +13 -2
  7. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/rentahuman.py +8 -2
  8. {getstack-4.4.0 → getstack-4.4.1}/tests/test_accounts.py +3 -1
  9. {getstack-4.4.0 → getstack-4.4.1}/tests/test_rentahuman.py +12 -2
  10. {getstack-4.4.0 → getstack-4.4.1}/tests/test_x402.py +28 -0
  11. {getstack-4.4.0 → getstack-4.4.1}/.gitignore +0 -0
  12. {getstack-4.4.0 → getstack-4.4.1}/CLAUDE.md +0 -0
  13. {getstack-4.4.0 → getstack-4.4.1}/LICENSE +0 -0
  14. {getstack-4.4.0 → getstack-4.4.1}/README.md +0 -0
  15. {getstack-4.4.0 → getstack-4.4.1}/scripts/verify_sign_claim_crosslang.py +0 -0
  16. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/__init__.py +0 -0
  17. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/__init__.py +0 -0
  18. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/agent_identity.py +0 -0
  19. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/agents.py +0 -0
  20. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/audit.py +0 -0
  21. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/authority.py +0 -0
  22. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/billing.py +0 -0
  23. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/brain.py +0 -0
  24. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/calendar.py +0 -0
  25. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/catalogue.py +0 -0
  26. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/chat_channels.py +0 -0
  27. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/control_policies.py +0 -0
  28. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/control_socket.py +0 -0
  29. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/credentials.py +0 -0
  30. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/delivery_methods.py +0 -0
  31. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/detector_config.py +0 -0
  32. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/drive.py +0 -0
  33. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/dropoffs.py +0 -0
  34. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/evidence_packs.py +0 -0
  35. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/flagged_content.py +0 -0
  36. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/fleets.py +0 -0
  37. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/governance.py +0 -0
  38. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/identity.py +0 -0
  39. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/inbound_webhooks.py +0 -0
  40. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/intents.py +0 -0
  41. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/llm.py +0 -0
  42. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/making.py +0 -0
  43. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/meetings.py +0 -0
  44. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/memory.py +0 -0
  45. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/message_access.py +0 -0
  46. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/missions.py +0 -0
  47. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/network.py +0 -0
  48. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/notifications.py +0 -0
  49. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/partner_accounts.py +0 -0
  50. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/passport_session.py +0 -0
  51. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/passports.py +0 -0
  52. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/payments.py +0 -0
  53. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/pii_config.py +0 -0
  54. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/post.py +0 -0
  55. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/proxy.py +0 -0
  56. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/reviews.py +0 -0
  57. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/scan.py +0 -0
  58. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/security_events.py +0 -0
  59. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/services.py +0 -0
  60. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/skills.py +0 -0
  61. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/team.py +0 -0
  62. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/trust.py +0 -0
  63. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/usage.py +0 -0
  64. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/wake.py +0 -0
  65. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_async/website.py +0 -0
  66. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_authority_request.py +0 -0
  67. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_control_ref.py +0 -0
  68. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/_fleet_key.py +0 -0
  69. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/agent_auth.py +0 -0
  70. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/agent_identity.py +0 -0
  71. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/agents.py +0 -0
  72. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/audit.py +0 -0
  73. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/auth.py +0 -0
  74. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/authority.py +0 -0
  75. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/billing.py +0 -0
  76. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/brain.py +0 -0
  77. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/browser_bootstrap.py +0 -0
  78. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/calendar.py +0 -0
  79. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/catalogue.py +0 -0
  80. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/chat_channels.py +0 -0
  81. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/control_policies.py +0 -0
  82. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/control_server.py +0 -0
  83. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/control_socket.py +0 -0
  84. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/credentials.py +0 -0
  85. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/delivery_methods.py +0 -0
  86. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/detector_config.py +0 -0
  87. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/drive.py +0 -0
  88. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/dropoffs.py +0 -0
  89. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/errors.py +0 -0
  90. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/evidence_packs.py +0 -0
  91. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/flagged_content.py +0 -0
  92. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/fleets.py +0 -0
  93. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/governance.py +0 -0
  94. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/identity.py +0 -0
  95. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/inbound_webhooks.py +0 -0
  96. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/intents.py +0 -0
  97. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/llm.py +0 -0
  98. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/making.py +0 -0
  99. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/meetings.py +0 -0
  100. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/memory.py +0 -0
  101. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/message_access.py +0 -0
  102. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/missions.py +0 -0
  103. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/network.py +0 -0
  104. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/network_install.py +0 -0
  105. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/network_keys.py +0 -0
  106. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/notifications.py +0 -0
  107. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/partner_accounts.py +0 -0
  108. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/passport_header_verify.py +0 -0
  109. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/passport_session.py +0 -0
  110. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/passports.py +0 -0
  111. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/payments.py +0 -0
  112. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/pii_config.py +0 -0
  113. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/post.py +0 -0
  114. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/proxy.py +0 -0
  115. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/py.typed +0 -0
  116. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/reviews.py +0 -0
  117. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/scan.py +0 -0
  118. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/security_events.py +0 -0
  119. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/service_mcp.py +0 -0
  120. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/services.py +0 -0
  121. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/sign_claim.py +0 -0
  122. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/skills.py +0 -0
  123. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/team.py +0 -0
  124. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/trust.py +0 -0
  125. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/types.py +0 -0
  126. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/usage.py +0 -0
  127. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/verify_agent_identity.py +0 -0
  128. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/verify_network.py +0 -0
  129. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/verify_offline.py +0 -0
  130. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/wake.py +0 -0
  131. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/wake_webhook.py +0 -0
  132. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/wallet_key.py +0 -0
  133. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/webhook.py +0 -0
  134. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/website.py +0 -0
  135. {getstack-4.4.0 → getstack-4.4.1}/src/getstack/x402.py +0 -0
  136. {getstack-4.4.0 → getstack-4.4.1}/tests/test_agent_identity.py +0 -0
  137. {getstack-4.4.0 → getstack-4.4.1}/tests/test_agents_overview.py +0 -0
  138. {getstack-4.4.0 → getstack-4.4.1}/tests/test_authority.py +0 -0
  139. {getstack-4.4.0 → getstack-4.4.1}/tests/test_billing.py +0 -0
  140. {getstack-4.4.0 → getstack-4.4.1}/tests/test_brain.py +0 -0
  141. {getstack-4.4.0 → getstack-4.4.1}/tests/test_calendar.py +0 -0
  142. {getstack-4.4.0 → getstack-4.4.1}/tests/test_catalogue.py +0 -0
  143. {getstack-4.4.0 → getstack-4.4.1}/tests/test_chat_channels.py +0 -0
  144. {getstack-4.4.0 → getstack-4.4.1}/tests/test_connect_links.py +0 -0
  145. {getstack-4.4.0 → getstack-4.4.1}/tests/test_control_policies.py +0 -0
  146. {getstack-4.4.0 → getstack-4.4.1}/tests/test_control_ref.py +0 -0
  147. {getstack-4.4.0 → getstack-4.4.1}/tests/test_control_socket.py +0 -0
  148. {getstack-4.4.0 → getstack-4.4.1}/tests/test_credentials_files.py +0 -0
  149. {getstack-4.4.0 → getstack-4.4.1}/tests/test_delivery_methods.py +0 -0
  150. {getstack-4.4.0 → getstack-4.4.1}/tests/test_drive.py +0 -0
  151. {getstack-4.4.0 → getstack-4.4.1}/tests/test_dropoffs.py +0 -0
  152. {getstack-4.4.0 → getstack-4.4.1}/tests/test_errors.py +0 -0
  153. {getstack-4.4.0 → getstack-4.4.1}/tests/test_evidence_packs.py +0 -0
  154. {getstack-4.4.0 → getstack-4.4.1}/tests/test_flagged_content.py +0 -0
  155. {getstack-4.4.0 → getstack-4.4.1}/tests/test_fleets.py +0 -0
  156. {getstack-4.4.0 → getstack-4.4.1}/tests/test_identity_requirements.py +0 -0
  157. {getstack-4.4.0 → getstack-4.4.1}/tests/test_identity_sso_domains.py +0 -0
  158. {getstack-4.4.0 → getstack-4.4.1}/tests/test_inbound_webhooks.py +0 -0
  159. {getstack-4.4.0 → getstack-4.4.1}/tests/test_llm_cost_cap.py +0 -0
  160. {getstack-4.4.0 → getstack-4.4.1}/tests/test_llm_images.py +0 -0
  161. {getstack-4.4.0 → getstack-4.4.1}/tests/test_llm_openrouter.py +0 -0
  162. {getstack-4.4.0 → getstack-4.4.1}/tests/test_making.py +0 -0
  163. {getstack-4.4.0 → getstack-4.4.1}/tests/test_meetings.py +0 -0
  164. {getstack-4.4.0 → getstack-4.4.1}/tests/test_memory.py +0 -0
  165. {getstack-4.4.0 → getstack-4.4.1}/tests/test_message_access.py +0 -0
  166. {getstack-4.4.0 → getstack-4.4.1}/tests/test_mission_binding.py +0 -0
  167. {getstack-4.4.0 → getstack-4.4.1}/tests/test_missions.py +0 -0
  168. {getstack-4.4.0 → getstack-4.4.1}/tests/test_network.py +0 -0
  169. {getstack-4.4.0 → getstack-4.4.1}/tests/test_parity.py +0 -0
  170. {getstack-4.4.0 → getstack-4.4.1}/tests/test_partner_accounts.py +0 -0
  171. {getstack-4.4.0 → getstack-4.4.1}/tests/test_post.py +0 -0
  172. {getstack-4.4.0 → getstack-4.4.1}/tests/test_service_connections.py +0 -0
  173. {getstack-4.4.0 → getstack-4.4.1}/tests/test_sign_claim.py +0 -0
  174. {getstack-4.4.0 → getstack-4.4.1}/tests/test_team.py +0 -0
  175. {getstack-4.4.0 → getstack-4.4.1}/tests/test_trust.py +0 -0
  176. {getstack-4.4.0 → getstack-4.4.1}/tests/test_wake.py +0 -0
  177. {getstack-4.4.0 → getstack-4.4.1}/tests/test_wallet_key.py +0 -0
  178. {getstack-4.4.0 → getstack-4.4.1}/tests/test_webhook.py +0 -0
  179. {getstack-4.4.0 → getstack-4.4.1}/tests/test_website_payments.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: getstack
3
- Version: 4.4.0
3
+ Version: 4.4.1
4
4
  Summary: Python SDK for STACK — trust infrastructure for AI agents
5
5
  Project-URL: Homepage, https://getstack.run
6
6
  Project-URL: Documentation, https://getstack.run/docs/sdk
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "getstack"
7
- version = "4.4.0"
7
+ version = "4.4.1"
8
8
  description = "Python SDK for STACK — trust infrastructure for AI agents"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -11,6 +11,7 @@ from ..accounts import (
11
11
  _account,
12
12
  _agent_passport,
13
13
  _approval,
14
+ _as_agent,
14
15
  _budget_body,
15
16
  _message_params,
16
17
  _open_headers,
@@ -748,7 +749,7 @@ class AsyncAccountWalletService(_AsyncBase):
748
749
  return cast(
749
750
  "dict[str, Any]",
750
751
  await self._call(
751
- "POST", f"{_account(account_id)}/wallet/payments", json=payment, headers=_passport(passport_token)
752
+ "POST", f"{_account(account_id)}/wallet/payments", json=payment, headers=_as_agent(passport_token)
752
753
  ),
753
754
  )
754
755
 
@@ -768,7 +769,7 @@ class AsyncAccountWalletService(_AsyncBase):
768
769
  """The asynchronous ``Stack.accounts.wallet.pay_url``. ``http`` is an optional ``httpx.AsyncClient``."""
769
770
  assert_payable_url(url)
770
771
  account = cast(
771
- "dict[str, Any]", await self._call("GET", _account(account_id), headers=_passport(passport_token))
772
+ "dict[str, Any]", await self._call("GET", _account(account_id), headers=_as_agent(passport_token))
772
773
  )
773
774
 
774
775
  async def pay(payment: dict[str, Any]) -> dict[str, Any]:
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
  from typing import Any, cast
6
6
 
7
7
  from ..client import AsyncHttpClient
8
- from ..rentahuman import _base, _join_body, _passport, sign_rentahuman_payment
8
+ from ..rentahuman import _as_agent, _base, _join_body, _passport, sign_rentahuman_payment
9
9
  from ..wallet_key import AgentWalletKey
10
10
 
11
11
 
@@ -44,7 +44,7 @@ class AsyncRentAHumanService:
44
44
  "POST",
45
45
  f"{_base(account_id)}/join/complete",
46
46
  json={"join_id": join_id, "signed": signed},
47
- extra_headers=_passport(passport_token),
47
+ extra_headers=_as_agent(passport_token),
48
48
  ),
49
49
  )
50
50
 
@@ -94,7 +94,7 @@ class AsyncRentAHumanService:
94
94
  "POST",
95
95
  f"{_base(account_id)}/fund/complete",
96
96
  json={"fund_id": fund_id, "signed": signed},
97
- extra_headers=_passport(passport_token),
97
+ extra_headers=_as_agent(passport_token),
98
98
  ),
99
99
  )
100
100
 
@@ -66,6 +66,12 @@ def _passport(passport_token: str | None) -> dict[str, str] | None:
66
66
  return {"X-Passport-Token": passport_token} if passport_token else None
67
67
 
68
68
 
69
+ def _as_agent(passport_token: str | None) -> dict[str, str] | None:
70
+ """The headers of a call the account's agent must make as the agent: the Passport is the bearer credential as well
71
+ as ``X-Passport-Token``, because the wallet payment route accepts only an agent and never a person's token."""
72
+ return {"X-Passport-Token": passport_token, "Authorization": f"Bearer {passport_token}"} if passport_token else None
73
+
74
+
69
75
  def _agent_passport(passport_token: str) -> dict[str, str]:
70
76
  if not isinstance(passport_token, str) or not passport_token:
71
77
  raise ValueError("passport_token is required: the account's agent calls this under its Passport")
@@ -1013,7 +1019,7 @@ class AccountWalletService(_Base):
1013
1019
  return cast(
1014
1020
  "dict[str, Any]",
1015
1021
  self._call(
1016
- "POST", f"{_account(account_id)}/wallet/payments", json=payment, headers=_passport(passport_token)
1022
+ "POST", f"{_account(account_id)}/wallet/payments", json=payment, headers=_as_agent(passport_token)
1017
1023
  ),
1018
1024
  )
1019
1025
 
@@ -1037,7 +1043,7 @@ class AccountWalletService(_Base):
1037
1043
  and 2); any other ask, a price over ``max_cents`` or a URL that is not https raises ``X402PaymentError`` before
1038
1044
  STACK is asked. ``http`` is an optional ``httpx.Client`` for the seller."""
1039
1045
  assert_payable_url(url)
1040
- account = cast("dict[str, Any]", self._call("GET", _account(account_id), headers=_passport(passport_token)))
1046
+ account = cast("dict[str, Any]", self._call("GET", _account(account_id), headers=_as_agent(passport_token)))
1041
1047
  return pay_x402(
1042
1048
  url,
1043
1049
  key=key,
@@ -18,6 +18,17 @@ CONTROL_REF_HEADER = "X-Control-Ref"
18
18
  _C = TypeVar("_C", "HttpClient", "AsyncHttpClient")
19
19
 
20
20
 
21
+ def _credential_headers(auth: AuthStrategy, extra_headers: dict[str, str] | None) -> dict[str, str]:
22
+ """The client's own credential, unless the call brings its own ``Authorization``.
23
+
24
+ A call that must be made as an agent (a payment from its wallet) sends the agent's Passport as the bearer: that
25
+ replaces the client's credential for the one call, and no sign-in is needed for it.
26
+ """
27
+ if extra_headers and any(name.lower() == "authorization" for name in extra_headers):
28
+ return {}
29
+ return auth.get_headers()
30
+
31
+
21
32
  def _scoped_to_ref(client: _C, ref: str) -> _C:
22
33
  """A copy of the client that sends `X-Control-Ref: <ref>` on every request it makes.
23
34
 
@@ -70,7 +81,7 @@ class HttpClient:
70
81
  ) -> Any:
71
82
  headers = {
72
83
  "Content-Type": "application/json",
73
- **self.auth.get_headers(),
84
+ **_credential_headers(self.auth, extra_headers),
74
85
  **self._ref_headers(),
75
86
  **(extra_headers or {}),
76
87
  }
@@ -311,7 +322,7 @@ class AsyncHttpClient:
311
322
  ) -> Any:
312
323
  headers = {
313
324
  "Content-Type": "application/json",
314
- **self.auth.get_headers(),
325
+ **_credential_headers(self.auth, extra_headers),
315
326
  **self._ref_headers(),
316
327
  **(extra_headers or {}),
317
328
  }
@@ -34,6 +34,12 @@ def _passport(passport_token: str | None) -> dict[str, str] | None:
34
34
  return {"X-Passport-Token": passport_token} if passport_token else None
35
35
 
36
36
 
37
+ def _as_agent(passport_token: str | None) -> dict[str, str] | None:
38
+ """The two calls that pay from the wallet are made as the agent: the Passport is the bearer credential as well as
39
+ ``X-Passport-Token``."""
40
+ return {"X-Passport-Token": passport_token, "Authorization": f"Bearer {passport_token}"} if passport_token else None
41
+
42
+
37
43
  def _base(account_id: str) -> str:
38
44
  return f"/v1/accounts/{_seg(account_id)}/rentahuman"
39
45
 
@@ -106,7 +112,7 @@ class RentAHumanService:
106
112
  "POST",
107
113
  f"{_base(account_id)}/join/complete",
108
114
  json={"join_id": join_id, "signed": signed},
109
- extra_headers=_passport(passport_token),
115
+ extra_headers=_as_agent(passport_token),
110
116
  ),
111
117
  )
112
118
 
@@ -156,7 +162,7 @@ class RentAHumanService:
156
162
  "POST",
157
163
  f"{_base(account_id)}/fund/complete",
158
164
  json={"fund_id": fund_id, "signed": signed},
159
- extra_headers=_passport(passport_token),
165
+ extra_headers=_as_agent(passport_token),
160
166
  ),
161
167
  )
162
168
 
@@ -284,6 +284,8 @@ async def _drive_async(accounts: AsyncAccountsService) -> None:
284
284
 
285
285
 
286
286
  PPT = {"X-Passport-Token": "ppt"}
287
+ # A payment from the wallet is made as the agent: its Passport is the bearer credential as well.
288
+ PPT_AS_AGENT = {"X-Passport-Token": "ppt", "Authorization": "Bearer ppt"}
287
289
 
288
290
  EXPECTED_CALLS: list[tuple[str, str, dict[str, Any]]] = [
289
291
  (
@@ -422,7 +424,7 @@ EXPECTED_CALLS: list[tuple[str, str, dict[str, Any]]] = [
422
424
  (
423
425
  "POST",
424
426
  f"/v1/accounts/{Q}/wallet/payments",
425
- {"json": {"typed_data": {"a": 1}, "agent_signature": "sig"}, "extra_headers": PPT},
427
+ {"json": {"typed_data": {"a": 1}, "agent_signature": "sig"}, "extra_headers": PPT_AS_AGENT},
426
428
  ),
427
429
  ("GET", "/v1/accounts/wallet-owner", {}),
428
430
  ("GET", "/v1/accounts/mail-domains", {}),
@@ -22,6 +22,8 @@ from getstack.service_mcp import SERVICE_MCP_ENDPOINTS
22
22
  from getstack.wallet_key import WalletPaymentTarget, generate_agent_wallet_key, wallet_payment_authorization_payload
23
23
 
24
24
  PASSPORT = {"X-Passport-Token": "ppt_1"}
25
+ # The two calls that pay from the wallet are made as the agent: its Passport is the bearer credential as well.
26
+ PASSPORT_AS_AGENT = {"X-Passport-Token": "ppt_1", "Authorization": "Bearer ppt_1"}
25
27
  BASE = "/v1/accounts/acct_1/rentahuman"
26
28
  START = {
27
29
  "join_id": "rahj_1",
@@ -75,9 +77,17 @@ async def _drive_async(service: AsyncRentAHumanService) -> None:
75
77
 
76
78
  EXPECTED: list[tuple[str, str, dict[str, Any]]] = [
77
79
  ("POST", f"{BASE}/join", {"json": {"country": "US", "accept_terms": True}, "extra_headers": PASSPORT}),
78
- ("POST", f"{BASE}/join/complete", {"json": {"join_id": "rahj_1", "signed": "c2ln"}, "extra_headers": PASSPORT}),
80
+ (
81
+ "POST",
82
+ f"{BASE}/join/complete",
83
+ {"json": {"join_id": "rahj_1", "signed": "c2ln"}, "extra_headers": PASSPORT_AS_AGENT},
84
+ ),
79
85
  ("POST", f"{BASE}/fund", {"json": {"amount_cents": 2500}, "extra_headers": PASSPORT}),
80
- ("POST", f"{BASE}/fund/complete", {"json": {"fund_id": "rahj_2", "signed": "c2ln"}, "extra_headers": PASSPORT}),
86
+ (
87
+ "POST",
88
+ f"{BASE}/fund/complete",
89
+ {"json": {"fund_id": "rahj_2", "signed": "c2ln"}, "extra_headers": PASSPORT_AS_AGENT},
90
+ ),
81
91
  ("GET", BASE, {"extra_headers": None}),
82
92
  ]
83
93
 
@@ -235,6 +235,33 @@ def test_stack_accounts_wallet_pay_url() -> None:
235
235
  ("POST", f"/v1/accounts/{ACCOUNT}/wallet/payments"),
236
236
  ]
237
237
  assert all(r.headers.get("x-passport-token") == "passport-token" for r in seen)
238
+ # The wallet payment route accepts only an agent: the Passport is the bearer credential of both calls.
239
+ assert all(r.headers.get("authorization") == "Bearer passport-token" for r in seen)
240
+
241
+
242
+ class _NotSignedIn:
243
+ def get_headers(self) -> dict[str, str]:
244
+ raise RuntimeError("not signed in")
245
+
246
+
247
+ def test_pay_url_with_a_passport_needs_no_sign_in() -> None:
248
+ transport, seen = _stack_api()
249
+ stack = Stack(api_key="sk_live_wallet_test", base_url="http://api.fixture")
250
+ stack._client.auth = _NotSignedIn() # type: ignore[assignment]
251
+ stack._client._client = httpx.Client(transport=transport)
252
+ with httpx.Client(transport=httpx.MockTransport(Seller(2))) as http:
253
+ stack.accounts.wallet.pay_url(ACCOUNT, SELLER, key=KEY, passport_token="passport-token", http=http)
254
+ assert all(r.headers.get("authorization") == "Bearer passport-token" for r in seen)
255
+
256
+
257
+ def test_pay_url_without_a_passport_keeps_the_client_credential() -> None:
258
+ transport, seen = _stack_api()
259
+ stack = Stack(api_key="sk_live_wallet_test", base_url="http://api.fixture")
260
+ stack._client._client = httpx.Client(transport=transport)
261
+ with httpx.Client(transport=httpx.MockTransport(Seller(2))) as http:
262
+ stack.accounts.wallet.pay_url(ACCOUNT, SELLER, key=KEY, http=http)
263
+ assert all(r.headers.get("authorization") == "Bearer sk_live_wallet_test" for r in seen)
264
+ assert all("x-passport-token" not in r.headers for r in seen)
238
265
 
239
266
 
240
267
  def test_pay_url_refuses_a_wallet_that_is_not_ready() -> None:
@@ -279,3 +306,4 @@ def test_async_stack_accounts_wallet_pay_url() -> None:
279
306
 
280
307
  result = asyncio.run(run())
281
308
  assert result.response.text == "the report" and [r.method for r in seen] == ["GET", "POST"]
309
+ assert all(r.headers.get("authorization") == "Bearer p" for r in seen)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes