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.
- hmctl/__init__.py +7 -0
- hmctl/cli.py +947 -0
- hypermind/__init__.py +208 -0
- hypermind/_deprecations.py +108 -0
- hypermind/agent.py +2896 -0
- hypermind/agent_card.py +127 -0
- hypermind/api/__init__.py +32 -0
- hypermind/api/app.py +686 -0
- hypermind/capability.py +923 -0
- hypermind/consult.py +493 -0
- hypermind/consult_bias.py +112 -0
- hypermind/contract_net.py +219 -0
- hypermind/crypto/__init__.py +21 -0
- hypermind/crypto/cose_encrypt.py +126 -0
- hypermind/crypto/dkg.py +246 -0
- hypermind/crypto/domain.py +59 -0
- hypermind/crypto/frost.py +771 -0
- hypermind/crypto/hashing.py +38 -0
- hypermind/crypto/hlc.py +163 -0
- hypermind/crypto/hpke.py +277 -0
- hypermind/crypto/kms.py +196 -0
- hypermind/crypto/kms_backends/__init__.py +56 -0
- hypermind/crypto/kms_backends/aws.py +128 -0
- hypermind/crypto/kms_backends/azure.py +114 -0
- hypermind/crypto/kms_backends/gcp.py +97 -0
- hypermind/crypto/kms_backends/vault.py +120 -0
- hypermind/crypto/namespace_root.py +204 -0
- hypermind/crypto/pq.py +152 -0
- hypermind/crypto/room_epoch.py +97 -0
- hypermind/crypto/signing.py +245 -0
- hypermind/deliberation.py +355 -0
- hypermind/did_web.py +256 -0
- hypermind/dispute.py +858 -0
- hypermind/errors.py +218 -0
- hypermind/eval/__init__.py +49 -0
- hypermind/eval/calibration.py +307 -0
- hypermind/eval/comparison.py +251 -0
- hypermind/eval/replay.py +202 -0
- hypermind/eval/swarm_iq.py +718 -0
- hypermind/knowledge/__init__.py +17 -0
- hypermind/knowledge/citation_graph.py +141 -0
- hypermind/knowledge/correlated_agreement.py +167 -0
- hypermind/knowledge/embedding_registry.py +115 -0
- hypermind/knowledge/kernel_store.py +197 -0
- hypermind/knowledge/rekor.py +173 -0
- hypermind/knowledge/reputation.py +364 -0
- hypermind/knowledge/swarm_memory.py +523 -0
- hypermind/knowledge/transparency.py +409 -0
- hypermind/mcp/__init__.py +60 -0
- hypermind/mcp/bridge.py +151 -0
- hypermind/mcp/client.py +142 -0
- hypermind/mcp/provenance.py +214 -0
- hypermind/mcp/relata_tools.py +152 -0
- hypermind/mcp/server.py +248 -0
- hypermind/mcp/transport.py +206 -0
- hypermind/mind/__init__.py +150 -0
- hypermind/mind/active.py +234 -0
- hypermind/mind/belief.py +369 -0
- hypermind/mind/deliberator.py +625 -0
- hypermind/mind/diversity.py +144 -0
- hypermind/mind/evolve.py +184 -0
- hypermind/mind/federation.py +154 -0
- hypermind/mind/goals.py +117 -0
- hypermind/mind/integration.py +190 -0
- hypermind/mind/mediator.py +74 -0
- hypermind/mind/memory_store.py +129 -0
- hypermind/mind/policy.py +307 -0
- hypermind/mind/records.py +260 -0
- hypermind/mind/roles.py +190 -0
- hypermind/mind/sybil_guard.py +41 -0
- hypermind/mind/world_model.py +166 -0
- hypermind/namespace.py +515 -0
- hypermind/namespace_policy.py +254 -0
- hypermind/observability/__init__.py +25 -0
- hypermind/observability/asgi.py +214 -0
- hypermind/observability/cost.py +277 -0
- hypermind/observability/otel_export.py +200 -0
- hypermind/observability/recorder.py +344 -0
- hypermind/observability/swarm_trace.py +438 -0
- hypermind/pin_policy.py +116 -0
- hypermind/py.typed +0 -0
- hypermind/responders/__init__.py +87 -0
- hypermind/responders/anthropic.py +159 -0
- hypermind/responders/base.py +162 -0
- hypermind/responders/openai.py +199 -0
- hypermind/responders/router.py +254 -0
- hypermind/responders/structured.py +287 -0
- hypermind/responders/tools.py +444 -0
- hypermind/revocation.py +270 -0
- hypermind/rule_ids.py +135 -0
- hypermind/schemas/encrypted_statement.cddl +28 -0
- hypermind/schemas/namespace_accept.cddl +20 -0
- hypermind/schemas/namespace_create.cddl +25 -0
- hypermind/schemas/namespace_founding_attest.cddl +30 -0
- hypermind/schemas/namespace_invite.cddl +22 -0
- hypermind/schemas/wire-v0.1.cddl +73 -0
- hypermind/simlab/__init__.py +15 -0
- hypermind/simlab/_persona_registry.py +93 -0
- hypermind/simlab/_scenario_impl.py +2778 -0
- hypermind/simlab/app.py +2538 -0
- hypermind/simlab/backends/__init__.py +27 -0
- hypermind/simlab/backends/anchor.py +88 -0
- hypermind/simlab/backends/local.py +32 -0
- hypermind/simlab/backends/server.py +79 -0
- hypermind/simlab/cli_command.py +108 -0
- hypermind/simlab/config.py +106 -0
- hypermind/simlab/deployment.py +26 -0
- hypermind/simlab/knowledge.py +716 -0
- hypermind/simlab/learning.py +295 -0
- hypermind/simlab/modes/__init__.py +115 -0
- hypermind/simlab/modes/_eval_real_llm.py +373 -0
- hypermind/simlab/modes/aar.py +611 -0
- hypermind/simlab/modes/backtest.py +610 -0
- hypermind/simlab/modes/binary_forecast.py +69 -0
- hypermind/simlab/modes/conformance.py +1869 -0
- hypermind/simlab/modes/evaluation.py +2271 -0
- hypermind/simlab/modes/governance.py +648 -0
- hypermind/simlab/modes/redteam.py +534 -0
- hypermind/simlab/modes/tabletop.py +797 -0
- hypermind/simlab/modes/tournament.py +448 -0
- hypermind/simlab/modes/whatif.py +523 -0
- hypermind/simlab/namespace.py +125 -0
- hypermind/simlab/personas.py +477 -0
- hypermind/simlab/prompt_generator.py +172 -0
- hypermind/simlab/question_sets/geopolitics_q20.json +122 -0
- hypermind/simlab/question_sets/governance_q5.json +67 -0
- hypermind/simlab/question_sets/msft_outlook_q10.json +62 -0
- hypermind/simlab/question_sets/whatif_q3.json +38 -0
- hypermind/simlab/registry.py +325 -0
- hypermind/simlab/runner.py +239 -0
- hypermind/simlab/scenario.py +147 -0
- hypermind/simlab/swarms.py +180 -0
- hypermind/simlab/tool_handlers/__init__.py +4 -0
- hypermind/simlab/tool_handlers/alpha_vantage.py +39 -0
- hypermind/simlab/tool_handlers/brave.py +46 -0
- hypermind/simlab/tool_handlers/newsapi.py +50 -0
- hypermind/simlab/tool_handlers/openweather.py +46 -0
- hypermind/simlab/tool_handlers/pinecone.py +52 -0
- hypermind/simlab/tool_handlers/qdrant.py +57 -0
- hypermind/simlab/tool_handlers/query_knowledge_base.py +21 -0
- hypermind/simlab/tool_handlers/relata_recall.py +61 -0
- hypermind/simlab/tool_handlers/retrieve_document.py +21 -0
- hypermind/simlab/tool_handlers/serper.py +46 -0
- hypermind/simlab/tool_handlers/tavily.py +53 -0
- hypermind/simlab/tool_handlers/weaviate.py +65 -0
- hypermind/simlab/tool_handlers/wikipedia.py +64 -0
- hypermind/simlab/tool_handlers/wolfram.py +48 -0
- hypermind/simlab/tool_handlers/yahoo_finance.py +49 -0
- hypermind/simlab/tool_registry.py +568 -0
- hypermind/simlab/topic_adapter.py +338 -0
- hypermind/simlab/topic_questions.py +259 -0
- hypermind/storage/__init__.py +69 -0
- hypermind/storage/backend.py +71 -0
- hypermind/storage/relata.py +245 -0
- hypermind/storage/sqlite.py +258 -0
- hypermind/sync.py +191 -0
- hypermind/tal.py +175 -0
- hypermind/tasks.py +334 -0
- hypermind/testing.py +16 -0
- hypermind/tools/__init__.py +32 -0
- hypermind/tools/registry.py +61 -0
- hypermind/transport/__init__.py +22 -0
- hypermind/transport/anti_entropy.py +708 -0
- hypermind/transport/bus.py +206 -0
- hypermind/transport/knows_delta.py +204 -0
- hypermind/transport/libp2p.py +298 -0
- hypermind/transport/placement.py +58 -0
- hypermind/transport/tcp.py +797 -0
- hypermind/transport/tls_profile.py +417 -0
- hypermind/types.py +59 -0
- hypermind/uncertainty.py +222 -0
- hypermind/wire.py +897 -0
- hypermind/workflow/__init__.py +72 -0
- hypermind/workflow/engine.py +655 -0
- hypermind/workflow/plan.py +182 -0
- hypermind/workflow/repair.py +203 -0
- hypermind-0.11.0.dist-info/METADATA +524 -0
- hypermind-0.11.0.dist-info/RECORD +181 -0
- hypermind-0.11.0.dist-info/WHEEL +4 -0
- hypermind-0.11.0.dist-info/entry_points.txt +2 -0
- hypermind-0.11.0.dist-info/licenses/LICENSE +201 -0
hypermind/agent_card.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""AgentCard — signed self-description for agent discovery (spec §3.2).
|
|
2
|
+
|
|
3
|
+
An AgentCard is published by an agent as a regular sealed claim (claim_type
|
|
4
|
+
"agent_card") so peers can discover its capabilities, supported topics, roles,
|
|
5
|
+
and contact endpoint. It rides in the standard SEAL SignedStatement envelope
|
|
6
|
+
and is stored in the shared transparency log like any other claim.
|
|
7
|
+
|
|
8
|
+
Spec reference: draft-hypermind-scitt-contested-claims-profile-00 §3.2 and
|
|
9
|
+
the A2A bridge normative requirement at §4.12.1.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from dataclasses import dataclass, field
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
__all__ = ["AgentCard"]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class AgentCard:
|
|
22
|
+
"""Signed self-description published by an agent for peer discovery.
|
|
23
|
+
|
|
24
|
+
Fields mirror spec §3.2. All fields are optional except ``agent_kid``,
|
|
25
|
+
which is the 32-byte Ed25519 public-key half used as the stable agent
|
|
26
|
+
address.
|
|
27
|
+
|
|
28
|
+
Serialisation contract
|
|
29
|
+
----------------------
|
|
30
|
+
``to_payload()`` / ``from_payload()`` are the only public serialisation
|
|
31
|
+
primitives; they produce/consume a plain ``dict`` that the standard
|
|
32
|
+
``publish_claim`` payload pipeline can embed directly. The ``agent_kid``
|
|
33
|
+
is encoded as a lowercase hex string so the JSON/CBOR payload layer
|
|
34
|
+
does not need to handle raw bytes.
|
|
35
|
+
|
|
36
|
+
Usage::
|
|
37
|
+
|
|
38
|
+
card = AgentCard(
|
|
39
|
+
agent_kid=agent.keypair.kid,
|
|
40
|
+
display_name="Alice the Scout",
|
|
41
|
+
topics=["ai-safety-evals", "threat-intel"],
|
|
42
|
+
roles=["Scout"],
|
|
43
|
+
sdk_version="0.10.0",
|
|
44
|
+
)
|
|
45
|
+
kid = await agent.publish_card(card)
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
agent_kid: bytes
|
|
49
|
+
"""32-byte Ed25519 public-key half; the stable agent address."""
|
|
50
|
+
|
|
51
|
+
display_name: str = ""
|
|
52
|
+
"""Human-readable name shown in dashboards and dispute panels."""
|
|
53
|
+
|
|
54
|
+
topics: list[str] = field(default_factory=list)
|
|
55
|
+
"""Topic strings this agent is willing to engage on."""
|
|
56
|
+
|
|
57
|
+
roles: list[str] = field(default_factory=list)
|
|
58
|
+
"""Role bundle names (Scout, Sceptic, Generalist, Synthesist, Mediator, Oracle)."""
|
|
59
|
+
|
|
60
|
+
capabilities: list[str] = field(default_factory=list)
|
|
61
|
+
"""Advertised CapToken caveat kinds (e.g. "topic", "rate", "expiry")."""
|
|
62
|
+
|
|
63
|
+
endpoint: str = ""
|
|
64
|
+
"""Optional contact endpoint URI (A2A / MCP server URL; see §4.12)."""
|
|
65
|
+
|
|
66
|
+
sdk_version: str = ""
|
|
67
|
+
"""SDK version string, e.g. "0.10.0"."""
|
|
68
|
+
|
|
69
|
+
metadata: dict[str, Any] = field(default_factory=dict)
|
|
70
|
+
"""Arbitrary extra fields; preserved round-trip but not interpreted."""
|
|
71
|
+
|
|
72
|
+
# ------------------------------------------------------------------
|
|
73
|
+
# Serialisation helpers
|
|
74
|
+
# ------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
def to_payload(self) -> dict[str, Any]:
|
|
77
|
+
"""Serialise to a JSON-serialisable dict for embedding in a claim payload.
|
|
78
|
+
|
|
79
|
+
``agent_kid`` is hex-encoded so the payload is safe for JSON and
|
|
80
|
+
deterministic CBOR transport layers.
|
|
81
|
+
"""
|
|
82
|
+
if len(self.agent_kid) != 32:
|
|
83
|
+
raise ValueError(
|
|
84
|
+
f"agent_kid must be exactly 32 bytes; got {len(self.agent_kid)}"
|
|
85
|
+
)
|
|
86
|
+
return {
|
|
87
|
+
"agent_kid": self.agent_kid.hex(),
|
|
88
|
+
"display_name": self.display_name,
|
|
89
|
+
"topics": list(self.topics),
|
|
90
|
+
"roles": list(self.roles),
|
|
91
|
+
"capabilities": list(self.capabilities),
|
|
92
|
+
"endpoint": self.endpoint,
|
|
93
|
+
"sdk_version": self.sdk_version,
|
|
94
|
+
"metadata": dict(self.metadata),
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_payload(cls, payload: dict[str, Any]) -> AgentCard:
|
|
99
|
+
"""Deserialise from a claim payload dict produced by ``to_payload()``.
|
|
100
|
+
|
|
101
|
+
Raises ``ValueError`` if the required ``agent_kid`` field is missing or
|
|
102
|
+
the hex string does not decode to exactly 32 bytes.
|
|
103
|
+
"""
|
|
104
|
+
if "agent_kid" not in payload:
|
|
105
|
+
raise ValueError("AgentCard payload missing required field 'agent_kid'")
|
|
106
|
+
agent_kid = bytes.fromhex(payload["agent_kid"])
|
|
107
|
+
if len(agent_kid) != 32:
|
|
108
|
+
raise ValueError(
|
|
109
|
+
f"agent_kid must decode to 32 bytes; got {len(agent_kid)}"
|
|
110
|
+
)
|
|
111
|
+
return cls(
|
|
112
|
+
agent_kid=agent_kid,
|
|
113
|
+
display_name=payload.get("display_name", ""),
|
|
114
|
+
topics=list(payload.get("topics", [])),
|
|
115
|
+
roles=list(payload.get("roles", [])),
|
|
116
|
+
capabilities=list(payload.get("capabilities", [])),
|
|
117
|
+
endpoint=payload.get("endpoint", ""),
|
|
118
|
+
sdk_version=payload.get("sdk_version", ""),
|
|
119
|
+
metadata=dict(payload.get("metadata", {})),
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
def __repr__(self) -> str:
|
|
123
|
+
return (
|
|
124
|
+
f"AgentCard(kid={self.agent_kid.hex()[:12]}... "
|
|
125
|
+
f"name={self.display_name!r} "
|
|
126
|
+
f"topics={self.topics!r})"
|
|
127
|
+
)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""HTTP management API for a HyperMindAgent.
|
|
2
|
+
|
|
3
|
+
Wraps a single agent in an ASGI 3 app so non-Python callers can:
|
|
4
|
+
|
|
5
|
+
* publish claims (POST /v1/claims)
|
|
6
|
+
* query a claim by kid (GET /v1/claims/{kid})
|
|
7
|
+
* stream the audit log (GET /v1/audit)
|
|
8
|
+
* read reputation (GET /v1/reputation/{agent_kid}?topic=...)
|
|
9
|
+
* list disputes (GET /v1/disputes)
|
|
10
|
+
* run a panel consult (POST /v1/consult)
|
|
11
|
+
* read agent introspection (GET /v1/introspect)
|
|
12
|
+
* read storage / health stats (GET /v1/stats, /healthz)
|
|
13
|
+
* scrape Prometheus metrics (GET /metrics)
|
|
14
|
+
|
|
15
|
+
Zero hard dependencies — pure ASGI 3, JSON only, runs under any ASGI
|
|
16
|
+
server (uvicorn, hypercorn, daphne).
|
|
17
|
+
|
|
18
|
+
Mount under uvicorn::
|
|
19
|
+
|
|
20
|
+
from hypermind import HyperMindAgent
|
|
21
|
+
from hypermind.api import management_app
|
|
22
|
+
|
|
23
|
+
agent = HyperMindAgent.sandbox(room="prod")
|
|
24
|
+
app = management_app(agent)
|
|
25
|
+
# uvicorn.run(app, host="0.0.0.0", port=8080)
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
from __future__ import annotations
|
|
29
|
+
|
|
30
|
+
from hypermind.api.app import management_app
|
|
31
|
+
|
|
32
|
+
__all__ = ["management_app"]
|