hypermind 0.11.0__py3-none-any.whl

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 (181) hide show
  1. hmctl/__init__.py +7 -0
  2. hmctl/cli.py +947 -0
  3. hypermind/__init__.py +208 -0
  4. hypermind/_deprecations.py +108 -0
  5. hypermind/agent.py +2896 -0
  6. hypermind/agent_card.py +127 -0
  7. hypermind/api/__init__.py +32 -0
  8. hypermind/api/app.py +686 -0
  9. hypermind/capability.py +923 -0
  10. hypermind/consult.py +493 -0
  11. hypermind/consult_bias.py +112 -0
  12. hypermind/contract_net.py +219 -0
  13. hypermind/crypto/__init__.py +21 -0
  14. hypermind/crypto/cose_encrypt.py +126 -0
  15. hypermind/crypto/dkg.py +246 -0
  16. hypermind/crypto/domain.py +59 -0
  17. hypermind/crypto/frost.py +771 -0
  18. hypermind/crypto/hashing.py +38 -0
  19. hypermind/crypto/hlc.py +163 -0
  20. hypermind/crypto/hpke.py +277 -0
  21. hypermind/crypto/kms.py +196 -0
  22. hypermind/crypto/kms_backends/__init__.py +56 -0
  23. hypermind/crypto/kms_backends/aws.py +128 -0
  24. hypermind/crypto/kms_backends/azure.py +114 -0
  25. hypermind/crypto/kms_backends/gcp.py +97 -0
  26. hypermind/crypto/kms_backends/vault.py +120 -0
  27. hypermind/crypto/namespace_root.py +204 -0
  28. hypermind/crypto/pq.py +152 -0
  29. hypermind/crypto/room_epoch.py +97 -0
  30. hypermind/crypto/signing.py +245 -0
  31. hypermind/deliberation.py +355 -0
  32. hypermind/did_web.py +256 -0
  33. hypermind/dispute.py +858 -0
  34. hypermind/errors.py +218 -0
  35. hypermind/eval/__init__.py +49 -0
  36. hypermind/eval/calibration.py +307 -0
  37. hypermind/eval/comparison.py +251 -0
  38. hypermind/eval/replay.py +202 -0
  39. hypermind/eval/swarm_iq.py +718 -0
  40. hypermind/knowledge/__init__.py +17 -0
  41. hypermind/knowledge/citation_graph.py +141 -0
  42. hypermind/knowledge/correlated_agreement.py +167 -0
  43. hypermind/knowledge/embedding_registry.py +115 -0
  44. hypermind/knowledge/kernel_store.py +197 -0
  45. hypermind/knowledge/rekor.py +173 -0
  46. hypermind/knowledge/reputation.py +364 -0
  47. hypermind/knowledge/swarm_memory.py +523 -0
  48. hypermind/knowledge/transparency.py +409 -0
  49. hypermind/mcp/__init__.py +60 -0
  50. hypermind/mcp/bridge.py +151 -0
  51. hypermind/mcp/client.py +142 -0
  52. hypermind/mcp/provenance.py +214 -0
  53. hypermind/mcp/relata_tools.py +152 -0
  54. hypermind/mcp/server.py +248 -0
  55. hypermind/mcp/transport.py +206 -0
  56. hypermind/mind/__init__.py +150 -0
  57. hypermind/mind/active.py +234 -0
  58. hypermind/mind/belief.py +369 -0
  59. hypermind/mind/deliberator.py +625 -0
  60. hypermind/mind/diversity.py +144 -0
  61. hypermind/mind/evolve.py +184 -0
  62. hypermind/mind/federation.py +154 -0
  63. hypermind/mind/goals.py +117 -0
  64. hypermind/mind/integration.py +190 -0
  65. hypermind/mind/mediator.py +74 -0
  66. hypermind/mind/memory_store.py +129 -0
  67. hypermind/mind/policy.py +307 -0
  68. hypermind/mind/records.py +260 -0
  69. hypermind/mind/roles.py +190 -0
  70. hypermind/mind/sybil_guard.py +41 -0
  71. hypermind/mind/world_model.py +166 -0
  72. hypermind/namespace.py +515 -0
  73. hypermind/namespace_policy.py +254 -0
  74. hypermind/observability/__init__.py +25 -0
  75. hypermind/observability/asgi.py +214 -0
  76. hypermind/observability/cost.py +277 -0
  77. hypermind/observability/otel_export.py +200 -0
  78. hypermind/observability/recorder.py +344 -0
  79. hypermind/observability/swarm_trace.py +438 -0
  80. hypermind/pin_policy.py +116 -0
  81. hypermind/py.typed +0 -0
  82. hypermind/responders/__init__.py +87 -0
  83. hypermind/responders/anthropic.py +159 -0
  84. hypermind/responders/base.py +162 -0
  85. hypermind/responders/openai.py +199 -0
  86. hypermind/responders/router.py +254 -0
  87. hypermind/responders/structured.py +287 -0
  88. hypermind/responders/tools.py +444 -0
  89. hypermind/revocation.py +270 -0
  90. hypermind/rule_ids.py +135 -0
  91. hypermind/schemas/encrypted_statement.cddl +28 -0
  92. hypermind/schemas/namespace_accept.cddl +20 -0
  93. hypermind/schemas/namespace_create.cddl +25 -0
  94. hypermind/schemas/namespace_founding_attest.cddl +30 -0
  95. hypermind/schemas/namespace_invite.cddl +22 -0
  96. hypermind/schemas/wire-v0.1.cddl +73 -0
  97. hypermind/simlab/__init__.py +15 -0
  98. hypermind/simlab/_persona_registry.py +93 -0
  99. hypermind/simlab/_scenario_impl.py +2778 -0
  100. hypermind/simlab/app.py +2538 -0
  101. hypermind/simlab/backends/__init__.py +27 -0
  102. hypermind/simlab/backends/anchor.py +88 -0
  103. hypermind/simlab/backends/local.py +32 -0
  104. hypermind/simlab/backends/server.py +79 -0
  105. hypermind/simlab/cli_command.py +108 -0
  106. hypermind/simlab/config.py +106 -0
  107. hypermind/simlab/deployment.py +26 -0
  108. hypermind/simlab/knowledge.py +716 -0
  109. hypermind/simlab/learning.py +295 -0
  110. hypermind/simlab/modes/__init__.py +115 -0
  111. hypermind/simlab/modes/_eval_real_llm.py +373 -0
  112. hypermind/simlab/modes/aar.py +611 -0
  113. hypermind/simlab/modes/backtest.py +610 -0
  114. hypermind/simlab/modes/binary_forecast.py +69 -0
  115. hypermind/simlab/modes/conformance.py +1869 -0
  116. hypermind/simlab/modes/evaluation.py +2271 -0
  117. hypermind/simlab/modes/governance.py +648 -0
  118. hypermind/simlab/modes/redteam.py +534 -0
  119. hypermind/simlab/modes/tabletop.py +797 -0
  120. hypermind/simlab/modes/tournament.py +448 -0
  121. hypermind/simlab/modes/whatif.py +523 -0
  122. hypermind/simlab/namespace.py +125 -0
  123. hypermind/simlab/personas.py +477 -0
  124. hypermind/simlab/prompt_generator.py +172 -0
  125. hypermind/simlab/question_sets/geopolitics_q20.json +122 -0
  126. hypermind/simlab/question_sets/governance_q5.json +67 -0
  127. hypermind/simlab/question_sets/msft_outlook_q10.json +62 -0
  128. hypermind/simlab/question_sets/whatif_q3.json +38 -0
  129. hypermind/simlab/registry.py +325 -0
  130. hypermind/simlab/runner.py +239 -0
  131. hypermind/simlab/scenario.py +147 -0
  132. hypermind/simlab/swarms.py +180 -0
  133. hypermind/simlab/tool_handlers/__init__.py +4 -0
  134. hypermind/simlab/tool_handlers/alpha_vantage.py +39 -0
  135. hypermind/simlab/tool_handlers/brave.py +46 -0
  136. hypermind/simlab/tool_handlers/newsapi.py +50 -0
  137. hypermind/simlab/tool_handlers/openweather.py +46 -0
  138. hypermind/simlab/tool_handlers/pinecone.py +52 -0
  139. hypermind/simlab/tool_handlers/qdrant.py +57 -0
  140. hypermind/simlab/tool_handlers/query_knowledge_base.py +21 -0
  141. hypermind/simlab/tool_handlers/relata_recall.py +61 -0
  142. hypermind/simlab/tool_handlers/retrieve_document.py +21 -0
  143. hypermind/simlab/tool_handlers/serper.py +46 -0
  144. hypermind/simlab/tool_handlers/tavily.py +53 -0
  145. hypermind/simlab/tool_handlers/weaviate.py +65 -0
  146. hypermind/simlab/tool_handlers/wikipedia.py +64 -0
  147. hypermind/simlab/tool_handlers/wolfram.py +48 -0
  148. hypermind/simlab/tool_handlers/yahoo_finance.py +49 -0
  149. hypermind/simlab/tool_registry.py +568 -0
  150. hypermind/simlab/topic_adapter.py +338 -0
  151. hypermind/simlab/topic_questions.py +259 -0
  152. hypermind/storage/__init__.py +69 -0
  153. hypermind/storage/backend.py +71 -0
  154. hypermind/storage/relata.py +245 -0
  155. hypermind/storage/sqlite.py +258 -0
  156. hypermind/sync.py +191 -0
  157. hypermind/tal.py +175 -0
  158. hypermind/tasks.py +334 -0
  159. hypermind/testing.py +16 -0
  160. hypermind/tools/__init__.py +32 -0
  161. hypermind/tools/registry.py +61 -0
  162. hypermind/transport/__init__.py +22 -0
  163. hypermind/transport/anti_entropy.py +708 -0
  164. hypermind/transport/bus.py +206 -0
  165. hypermind/transport/knows_delta.py +204 -0
  166. hypermind/transport/libp2p.py +298 -0
  167. hypermind/transport/placement.py +58 -0
  168. hypermind/transport/tcp.py +797 -0
  169. hypermind/transport/tls_profile.py +417 -0
  170. hypermind/types.py +59 -0
  171. hypermind/uncertainty.py +222 -0
  172. hypermind/wire.py +897 -0
  173. hypermind/workflow/__init__.py +72 -0
  174. hypermind/workflow/engine.py +655 -0
  175. hypermind/workflow/plan.py +182 -0
  176. hypermind/workflow/repair.py +203 -0
  177. hypermind-0.11.0.dist-info/METADATA +524 -0
  178. hypermind-0.11.0.dist-info/RECORD +181 -0
  179. hypermind-0.11.0.dist-info/WHEEL +4 -0
  180. hypermind-0.11.0.dist-info/entry_points.txt +2 -0
  181. hypermind-0.11.0.dist-info/licenses/LICENSE +201 -0
hypermind/__init__.py ADDED
@@ -0,0 +1,208 @@
1
+ """HyperMind — federated agent intelligence.
2
+
3
+ Reference SDK for the `draft-hypermind-scitt-contested-claims-profile-00` profile.
4
+ v0.1 alpha — in-process implementation suitable for sandbox/testbed use.
5
+
6
+ Public surface (post-WS-F partial; ROADMAP §0.5.4–0.5.8):
7
+
8
+ - Top-level: ``HyperMindAgent``, ``CapToken``, ``Caveat``, ``Dispute``,
9
+ ``BlockReason``, ``open``, ``__version__``, ``__wire_version__``,
10
+ ``__protocol_version__``.
11
+ - ``hypermind.types`` — every supporting type re-exported. New code
12
+ SHOULD import from ``hypermind.types`` directly.
13
+ - ``hypermind.testing`` — ``testbed_cohort`` and other test helpers.
14
+
15
+ The legacy root re-exports (``ClaimType``, ``Subscription``, etc.) remain
16
+ available for compatibility but trigger ``PendingDeprecationWarning`` on
17
+ attribute lookup. The shim escalates to ``DeprecationWarning`` in v0.7
18
+ and is scheduled for removal in v1.0.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import warnings as _warnings
24
+ from typing import TYPE_CHECKING, Any
25
+
26
+ from hypermind import api as api
27
+ from hypermind import responders as responders
28
+
29
+ # Re-export storage + responders + api for one-line imports.
30
+ # Late-binding via __getattr__ would also work, but explicit re-export
31
+ # keeps mypy + pyright happy.
32
+ from hypermind import storage as storage
33
+ from hypermind.agent import HyperMindAgent
34
+ from hypermind.capability import CapToken, Caveat
35
+ from hypermind.consult import ConsultResult
36
+ from hypermind.dispute import Dispute
37
+ from hypermind.errors import (
38
+ AuthError,
39
+ BlockReason,
40
+ ConformanceError,
41
+ DisputeError,
42
+ HyperMindError,
43
+ KeyCompromiseError,
44
+ NetworkError,
45
+ ProtocolVersionError,
46
+ RampError,
47
+ RatePauseError,
48
+ UnresolvedPartitionError,
49
+ )
50
+
51
+ # v0.10 — install the agent-mind methods (pursue, tick, bind_deliberator,
52
+ # .deliberator) onto HyperMindAgent. Idempotent + zero behavioural impact
53
+ # on agents that don't call into the mind layer. See
54
+ # docs/spec/19-autonomy-contract.md.
55
+ from hypermind.mind import integration as _mind_integration
56
+ from hypermind.namespace_policy import NamespacePolicy
57
+ from hypermind.revocation import (
58
+ InMemoryRevocationStore,
59
+ RevocationEntry,
60
+ RevocationList,
61
+ RevocationStore,
62
+ )
63
+ from hypermind.uncertainty import Uncertainty
64
+
65
+ _mind_integration.install()
66
+
67
+ #: Canonical factory entry point — alias of :meth:`HyperMindAgent.open`.
68
+ #: Use ``await hypermind.open(mode="sandbox")`` for v1.0-style code.
69
+ open = HyperMindAgent.open
70
+
71
+ #: SDK release tag. ``0.9.0a0`` reflects code-complete through ROADMAP §v0.9
72
+ #: (conformance + wire-freeze scaffolding shipped). The trailing ``a0``
73
+ #: is held until the §External & human gates clear (IETF I-D, IANA,
74
+ #: third-party audit, OpenSSF acceptance, ≥3 pilots) — at that point we
75
+ #: cut ``1.0.0`` GA. See ROADMAP.md §Status snapshot.
76
+ __version__ = "0.11.0"
77
+
78
+ #: SLSA build-provenance level committed for every release artefact.
79
+ #: Cosign keyless signing + slsa-github-generator + PEP 740 attestations
80
+ #: together satisfy the four SLSA L3 properties documented in
81
+ #: docs/supply-chain/slsa.md.
82
+ SLSA_LEVEL = 3 # documented in docs/supply-chain/slsa.md
83
+
84
+ #: Wire format version — frozen at 0 through the entire v0.x line so a
85
+ #: v0.1 verifier can still parse a v0.9 envelope. Bumps are reserved
86
+ #: for v1.0+. See :mod:`hypermind.wire` docs.
87
+ __wire_version__ = 0
88
+
89
+ #: Protocol version negotiation primitive (ROADMAP §0.5.1). Held at 0
90
+ #: through v0.x because ``open(protocol_version_max=…)`` advertises this
91
+ #: number across the libp2p handshake; bumping is a federation break.
92
+ __protocol_version__ = 0
93
+
94
+
95
+ # ---------------------------------------------------------------------
96
+ # v0.5 deprecation shim — types moved to ``hypermind.types`` and
97
+ # ``hypermind.testing``. Legacy root attribute lookup fires
98
+ # PendingDeprecationWarning (escalates in v0.7, removed in v1.0).
99
+ # ---------------------------------------------------------------------
100
+
101
+ _RELOCATED: dict[str, str] = {
102
+ # → hypermind.types
103
+ "ArgumentDAG": "hypermind.types",
104
+ "ArgumentEdge": "hypermind.types",
105
+ "CalibTruthSnapshot": "hypermind.types",
106
+ "ClaimEvent": "hypermind.types",
107
+ "ClaimType": "hypermind.types",
108
+ "DisputeStatus": "hypermind.types",
109
+ "Kid": "hypermind.types",
110
+ "PanelMember": "hypermind.types",
111
+ "PinPolicy": "hypermind.types",
112
+ "RouteStrategy": "hypermind.types",
113
+ "SignedStatement": "hypermind.types",
114
+ "Subscription": "hypermind.types",
115
+ "VouchRequest": "hypermind.types",
116
+ # → hypermind.testing
117
+ "testbed_cohort": "hypermind.testing",
118
+ }
119
+
120
+
121
+ def __getattr__(name: str) -> Any:
122
+ """Lazy attribute lookup for deprecated root re-exports.
123
+
124
+ The legacy types still resolve to the same objects (so ``isinstance``
125
+ and identity checks keep working), but the lookup fires a
126
+ ``PendingDeprecationWarning`` pointing the caller at the new home.
127
+ """
128
+ if name in _RELOCATED:
129
+ target_module = _RELOCATED[name]
130
+ _warnings.warn(
131
+ f"hypermind.{name} is deprecated and will be removed in v1.0; "
132
+ f"import from {target_module} instead "
133
+ f"(e.g. ``from {target_module} import {name}``).",
134
+ PendingDeprecationWarning,
135
+ stacklevel=2,
136
+ )
137
+ import importlib
138
+
139
+ mod = importlib.import_module(target_module)
140
+ value = getattr(mod, name)
141
+ return value
142
+ raise AttributeError(f"module 'hypermind' has no attribute {name!r}")
143
+
144
+
145
+ if TYPE_CHECKING: # pragma: no cover
146
+ # Help type checkers see the relocated symbols at the top level so
147
+ # `from hypermind import ClaimType` keeps working with full types.
148
+ from hypermind.testing import testbed_cohort
149
+ from hypermind.types import (
150
+ ArgumentDAG,
151
+ ArgumentEdge,
152
+ CalibTruthSnapshot,
153
+ ClaimEvent,
154
+ ClaimType,
155
+ DisputeStatus,
156
+ Kid,
157
+ PanelMember,
158
+ PinPolicy,
159
+ RouteStrategy,
160
+ SignedStatement,
161
+ Subscription,
162
+ VouchRequest,
163
+ )
164
+
165
+
166
+ __all__ = [
167
+ "SLSA_LEVEL",
168
+ "ArgumentDAG",
169
+ "ArgumentEdge",
170
+ "AuthError",
171
+ "BlockReason",
172
+ "CalibTruthSnapshot",
173
+ "CapToken",
174
+ "Caveat",
175
+ "ClaimEvent",
176
+ "ClaimType",
177
+ "ConformanceError",
178
+ "ConsultResult",
179
+ "Dispute",
180
+ "DisputeError",
181
+ "DisputeStatus",
182
+ "HyperMindAgent",
183
+ "HyperMindError",
184
+ "InMemoryRevocationStore",
185
+ "KeyCompromiseError",
186
+ "Kid",
187
+ "NamespacePolicy",
188
+ "NetworkError",
189
+ "PanelMember",
190
+ "PinPolicy",
191
+ "ProtocolVersionError",
192
+ "RampError",
193
+ "RatePauseError",
194
+ "RevocationEntry",
195
+ "RevocationList",
196
+ "RevocationStore",
197
+ "RouteStrategy",
198
+ "SignedStatement",
199
+ "Subscription",
200
+ "Uncertainty",
201
+ "UnresolvedPartitionError",
202
+ "VouchRequest",
203
+ "__protocol_version__",
204
+ "__version__",
205
+ "__wire_version__",
206
+ "open",
207
+ "testbed_cohort",
208
+ ]
@@ -0,0 +1,108 @@
1
+ """Centralised deprecation registry (ROADMAP §0.5.10).
2
+
3
+ Every ``DeprecationWarning`` / ``PendingDeprecationWarning`` raise site
4
+ in the SDK SHOULD look up its metadata from :data:`DEPRECATIONS` rather
5
+ than hard-coding strings. The registry is the single source of truth
6
+ for the N-release warning window: a release manager can grep this file
7
+ to find all shims slated for removal in the next major.
8
+
9
+ Each entry records:
10
+ * ``deprecated_in`` — the version that introduced the warning.
11
+ * ``replaced_by`` — fully-qualified name of the new symbol/path.
12
+ * ``removed_in`` — the version that drops the shim entirely.
13
+ * ``hint`` — a one-line migration tip.
14
+ * ``category`` — ``DeprecationWarning`` (default) or
15
+ ``PendingDeprecationWarning``.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import warnings
21
+ from dataclasses import dataclass
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class DeprecationInfo:
26
+ """Stable metadata for a single deprecation."""
27
+
28
+ symbol: str
29
+ deprecated_in: str
30
+ replaced_by: str
31
+ removed_in: str
32
+ hint: str
33
+ category: type[Warning] = DeprecationWarning
34
+
35
+ def message(self) -> str:
36
+ return (
37
+ f"{self.symbol} is deprecated since v{self.deprecated_in}; "
38
+ f"use {self.replaced_by} instead. "
39
+ f"Scheduled for removal in v{self.removed_in}. {self.hint}"
40
+ )
41
+
42
+
43
+ # ---------------------------------------------------------------------
44
+ # The registry.
45
+ #
46
+ # Keys are stable symbol identifiers. They are referenced by raise sites
47
+ # and by `tests/test_deprecation_registry.py`.
48
+ # ---------------------------------------------------------------------
49
+
50
+ DEPRECATIONS: dict[str, DeprecationInfo] = {
51
+ "HyperMindAgent.from_env": DeprecationInfo(
52
+ symbol="HyperMindAgent.from_env()",
53
+ deprecated_in="0.7",
54
+ replaced_by="HyperMindAgent.open(mode=…)",
55
+ removed_in="1.0",
56
+ hint="See docs/migration/v0.7.md.",
57
+ category=PendingDeprecationWarning,
58
+ ),
59
+ "HyperMindAgent.testbed.list": DeprecationInfo(
60
+ symbol="HyperMindAgent.testbed(...) returning a plain list",
61
+ deprecated_in="0.5",
62
+ replaced_by="hypermind.testing.testbed_cohort(n=…)",
63
+ removed_in="1.0",
64
+ hint="The async-with cohort cleans up automatically.",
65
+ ),
66
+ "HyperMindAgent.classical_only": DeprecationInfo(
67
+ symbol="HyperMindAgent(pq=False) / legacy_ed25519=True",
68
+ deprecated_in="0.7",
69
+ replaced_by="pq=True (Composite Ed25519+ML-DSA-65)",
70
+ removed_in="1.0",
71
+ hint="Hybrid PQ is the default; classical-only is the legacy path.",
72
+ ),
73
+ "Dispute.close.no_witness_signatures": DeprecationInfo(
74
+ symbol="Dispute.close() without witness_signatures=…",
75
+ deprecated_in="0.8",
76
+ replaced_by="Dispute.close(witness_signatures=[…], quorum=k)",
77
+ removed_in="1.0",
78
+ hint="Single-witness sandbox path removed in v1.0; pass a k-of-n quorum "
79
+ "(rule HM-DISPUTE-QUORUM-001).",
80
+ category=FutureWarning,
81
+ ),
82
+ "hypermind.root.relocated": DeprecationInfo(
83
+ symbol="Top-level re-exports (ClaimType, Subscription, …)",
84
+ deprecated_in="0.5",
85
+ replaced_by="hypermind.types / hypermind.testing",
86
+ removed_in="1.0",
87
+ hint="Import the relocated symbol from its canonical module.",
88
+ category=PendingDeprecationWarning,
89
+ ),
90
+ }
91
+
92
+
93
+ def emit(key: str, *, stacklevel: int = 2, override_msg: str | None = None) -> None:
94
+ """Emit the warning registered under ``key``.
95
+
96
+ Raise ``KeyError`` if the key is not present (so a typo in the
97
+ raise-site fails loudly during testing).
98
+ """
99
+ info = DEPRECATIONS[key]
100
+ warnings.warn(override_msg or info.message(), info.category, stacklevel=stacklevel)
101
+
102
+
103
+ def lookup(key: str) -> DeprecationInfo:
104
+ """Read-only access to a registry entry (raises KeyError on miss)."""
105
+ return DEPRECATIONS[key]
106
+
107
+
108
+ __all__ = ["DEPRECATIONS", "DeprecationInfo", "emit", "lookup"]