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/revocation.py
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"""Key revocation primitive — Certificate-Revocation-List (CRL) shape.
|
|
2
|
+
|
|
3
|
+
Spec: ``docs/spec/18-revocation.md`` (v0.7).
|
|
4
|
+
|
|
5
|
+
The federation-root operator publishes a signed ``RevocationList`` that
|
|
6
|
+
enumerates kids that MUST NOT be trusted past their ``revoked_at_hlc``.
|
|
7
|
+
Verifiers consult a pluggable ``RevocationStore`` while validating each
|
|
8
|
+
``SignedStatement`` — any statement whose ``hlc >= entry.revoked_at_hlc``
|
|
9
|
+
and whose ``issuer_kid`` matches a revoked entry is rejected with rule_id
|
|
10
|
+
``HM-KEY-REVOKED-001``.
|
|
11
|
+
|
|
12
|
+
Statements signed BEFORE the revocation point remain valid (replay-safety
|
|
13
|
+
for historical claims). The revocation list itself is signed over its
|
|
14
|
+
canonical CBOR encoding by the namespace-root keypair, and SHOULD be
|
|
15
|
+
witness-cosigned and inserted into the transparency log so any auditor
|
|
16
|
+
can independently verify a CRL was actually published (vs. an out-of-band
|
|
17
|
+
forgery).
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
from dataclasses import dataclass
|
|
23
|
+
from typing import Literal, Protocol
|
|
24
|
+
|
|
25
|
+
import cbor2
|
|
26
|
+
|
|
27
|
+
from hypermind.crypto.signing import (
|
|
28
|
+
Keypair,
|
|
29
|
+
verify_ed25519,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
RevocationReason = Literal["compromise", "rotation", "operator_revoke"]
|
|
33
|
+
_REVOCATION_REASONS: frozenset[str] = frozenset(("compromise", "rotation", "operator_revoke"))
|
|
34
|
+
|
|
35
|
+
#: Domain-separation tag for the RevocationList signature preimage.
|
|
36
|
+
#: Keeps a CRL signature unforgeable against a colliding statement-kind
|
|
37
|
+
#: (per `domain.py` WF-DOMAIN refinement lemma).
|
|
38
|
+
_DOMAIN_TAG = b"\x07hypermind-revocation-list-v1"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True, slots=True)
|
|
42
|
+
class RevocationEntry:
|
|
43
|
+
"""Single revoked key.
|
|
44
|
+
|
|
45
|
+
`revoked_at_hlc` is the (logical_ms, counter) HLC pair past which any
|
|
46
|
+
statement signed by `kid` MUST be rejected. Statements with HLC
|
|
47
|
+
*strictly less than* the revocation point remain valid — this
|
|
48
|
+
preserves the historical record (they were signed by a then-trusted
|
|
49
|
+
key) while denying new traffic.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
kid: bytes
|
|
53
|
+
revoked_at_hlc: tuple[int, int]
|
|
54
|
+
reason: RevocationReason
|
|
55
|
+
reason_detail: str | None = None
|
|
56
|
+
|
|
57
|
+
def __post_init__(self) -> None:
|
|
58
|
+
if not isinstance(self.kid, (bytes, bytearray)) or len(self.kid) != 32:
|
|
59
|
+
raise ValueError("RevocationEntry.kid must be 32 bytes")
|
|
60
|
+
if (
|
|
61
|
+
not isinstance(self.revoked_at_hlc, tuple)
|
|
62
|
+
or len(self.revoked_at_hlc) != 2
|
|
63
|
+
or not all(isinstance(x, int) and x >= 0 for x in self.revoked_at_hlc)
|
|
64
|
+
):
|
|
65
|
+
raise ValueError("RevocationEntry.revoked_at_hlc must be a (int>=0, int>=0) tuple")
|
|
66
|
+
if self.reason not in _REVOCATION_REASONS:
|
|
67
|
+
raise ValueError(
|
|
68
|
+
f"RevocationEntry.reason must be one of {sorted(_REVOCATION_REASONS)!r}; "
|
|
69
|
+
f"got {self.reason!r}"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
def to_canonical(self) -> dict:
|
|
73
|
+
"""Return the canonical-CBOR-friendly representation (sorted keys)."""
|
|
74
|
+
d: dict = {
|
|
75
|
+
"kid": bytes(self.kid),
|
|
76
|
+
"revoked_at_hlc": [self.revoked_at_hlc[0], self.revoked_at_hlc[1]],
|
|
77
|
+
"reason": self.reason,
|
|
78
|
+
}
|
|
79
|
+
if self.reason_detail is not None:
|
|
80
|
+
d["reason_detail"] = self.reason_detail
|
|
81
|
+
return d
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@dataclass(frozen=True, slots=True)
|
|
85
|
+
class RevocationList:
|
|
86
|
+
"""Signed list of revoked kids in a namespace.
|
|
87
|
+
|
|
88
|
+
The signature is computed by the namespace root keypair over
|
|
89
|
+
deterministic CBOR of (entries, issued_by, issued_at_hlc) prefixed by
|
|
90
|
+
a fixed domain-separation tag.
|
|
91
|
+
|
|
92
|
+
Per spec/18-revocation.md §12.3, the issued list SHOULD additionally
|
|
93
|
+
be witness-cosigned and submitted to the transparency log; that
|
|
94
|
+
cosigning is layered on top of `RevocationList` and lives in
|
|
95
|
+
`hypermind.knowledge.transparency`.
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
entries: tuple[RevocationEntry, ...]
|
|
99
|
+
issued_by: bytes
|
|
100
|
+
issued_at_hlc: tuple[int, int]
|
|
101
|
+
sig: bytes
|
|
102
|
+
|
|
103
|
+
def __post_init__(self) -> None:
|
|
104
|
+
if not isinstance(self.entries, tuple):
|
|
105
|
+
raise TypeError("RevocationList.entries must be a tuple")
|
|
106
|
+
if not isinstance(self.issued_by, (bytes, bytearray)) or len(self.issued_by) != 32:
|
|
107
|
+
raise ValueError("RevocationList.issued_by must be a 32-byte kid")
|
|
108
|
+
if not isinstance(self.issued_at_hlc, tuple) or len(self.issued_at_hlc) != 2:
|
|
109
|
+
raise ValueError("RevocationList.issued_at_hlc must be a (int, int) tuple")
|
|
110
|
+
|
|
111
|
+
@staticmethod
|
|
112
|
+
def _signing_preimage(
|
|
113
|
+
entries: tuple[RevocationEntry, ...],
|
|
114
|
+
issued_by: bytes,
|
|
115
|
+
issued_at_hlc: tuple[int, int],
|
|
116
|
+
) -> bytes:
|
|
117
|
+
body = {
|
|
118
|
+
"entries": [e.to_canonical() for e in entries],
|
|
119
|
+
"issued_by": bytes(issued_by),
|
|
120
|
+
"issued_at_hlc": [issued_at_hlc[0], issued_at_hlc[1]],
|
|
121
|
+
}
|
|
122
|
+
return _DOMAIN_TAG + cbor2.dumps(body, canonical=True)
|
|
123
|
+
|
|
124
|
+
@classmethod
|
|
125
|
+
def issue(
|
|
126
|
+
cls,
|
|
127
|
+
*,
|
|
128
|
+
entries: tuple[RevocationEntry, ...] | list[RevocationEntry],
|
|
129
|
+
issuer: Keypair,
|
|
130
|
+
issued_at_hlc: tuple[int, int],
|
|
131
|
+
) -> RevocationList:
|
|
132
|
+
"""Sign a fresh RevocationList from a list of entries."""
|
|
133
|
+
ents = tuple(entries)
|
|
134
|
+
# Reject duplicate kids — a CRL with two entries for the same kid
|
|
135
|
+
# is ambiguous (which `revoked_at_hlc` wins?). Operators should
|
|
136
|
+
# collapse duplicates before issuing.
|
|
137
|
+
seen: set[bytes] = set()
|
|
138
|
+
for e in ents:
|
|
139
|
+
if bytes(e.kid) in seen:
|
|
140
|
+
raise ValueError(f"duplicate kid in RevocationList: {bytes(e.kid).hex()[:16]}…")
|
|
141
|
+
seen.add(bytes(e.kid))
|
|
142
|
+
|
|
143
|
+
preimage = cls._signing_preimage(ents, issuer.kid, issued_at_hlc)
|
|
144
|
+
sig = issuer.sign(preimage)
|
|
145
|
+
return cls(
|
|
146
|
+
entries=ents,
|
|
147
|
+
issued_by=issuer.kid,
|
|
148
|
+
issued_at_hlc=issued_at_hlc,
|
|
149
|
+
sig=sig,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
def verify(self, *, issuer_pk: bytes | None = None) -> bool:
|
|
153
|
+
"""Verify the RevocationList signature against the issuer's pubkey.
|
|
154
|
+
|
|
155
|
+
For Ed25519 (v0.1 default for namespace-roots), `issuer_kid` IS
|
|
156
|
+
the public key and `issuer_pk` may be omitted. For composite
|
|
157
|
+
algorithms the caller MUST supply the full public key — the
|
|
158
|
+
revocation list does not currently carry the ML-DSA half on the
|
|
159
|
+
wire (a v0.8 follow-up if PQ namespace-roots prove necessary).
|
|
160
|
+
"""
|
|
161
|
+
pk = issuer_pk if issuer_pk is not None else self.issued_by
|
|
162
|
+
if len(pk) < 32:
|
|
163
|
+
return False
|
|
164
|
+
preimage = self._signing_preimage(self.entries, self.issued_by, self.issued_at_hlc)
|
|
165
|
+
# If a 32-byte pk is supplied, treat as Ed25519. If composite is
|
|
166
|
+
# ever wired, dispatch via verify_signature(alg=…) here.
|
|
167
|
+
return verify_ed25519(pk[:32], self.sig, preimage)
|
|
168
|
+
|
|
169
|
+
def to_cbor(self) -> bytes:
|
|
170
|
+
"""Canonical CBOR serialization for transport / storage."""
|
|
171
|
+
return cbor2.dumps(
|
|
172
|
+
{
|
|
173
|
+
"entries": [e.to_canonical() for e in self.entries],
|
|
174
|
+
"issued_by": bytes(self.issued_by),
|
|
175
|
+
"issued_at_hlc": [self.issued_at_hlc[0], self.issued_at_hlc[1]],
|
|
176
|
+
"sig": bytes(self.sig),
|
|
177
|
+
},
|
|
178
|
+
canonical=True,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
@classmethod
|
|
182
|
+
def from_cbor(cls, raw: bytes, *, verify: bool = True) -> RevocationList:
|
|
183
|
+
"""Parse a serialised RevocationList.
|
|
184
|
+
|
|
185
|
+
When ``verify=True`` (the default), the signature is verified before
|
|
186
|
+
returning. Pass ``verify=False`` only when the caller will explicitly
|
|
187
|
+
call ``.verify()`` immediately after (e.g. inside a custom store).
|
|
188
|
+
"""
|
|
189
|
+
body = cbor2.loads(raw)
|
|
190
|
+
if not isinstance(body, dict):
|
|
191
|
+
raise ValueError("RevocationList CBOR must be a map")
|
|
192
|
+
entries = tuple(
|
|
193
|
+
RevocationEntry(
|
|
194
|
+
kid=bytes(e["kid"]),
|
|
195
|
+
revoked_at_hlc=(int(e["revoked_at_hlc"][0]), int(e["revoked_at_hlc"][1])),
|
|
196
|
+
reason=e["reason"],
|
|
197
|
+
reason_detail=e.get("reason_detail"),
|
|
198
|
+
)
|
|
199
|
+
for e in body["entries"]
|
|
200
|
+
)
|
|
201
|
+
crl = cls(
|
|
202
|
+
entries=entries,
|
|
203
|
+
issued_by=bytes(body["issued_by"]),
|
|
204
|
+
issued_at_hlc=(int(body["issued_at_hlc"][0]), int(body["issued_at_hlc"][1])),
|
|
205
|
+
sig=bytes(body["sig"]),
|
|
206
|
+
)
|
|
207
|
+
if verify and not crl.verify():
|
|
208
|
+
raise ValueError("RevocationList signature verification failed")
|
|
209
|
+
return crl
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# ----------------------------------------------------------------------- #
|
|
213
|
+
# Pluggable revocation store
|
|
214
|
+
# ----------------------------------------------------------------------- #
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class RevocationStore(Protocol):
|
|
218
|
+
"""Verifier-side lookup: is a kid revoked at a given HLC?
|
|
219
|
+
|
|
220
|
+
Production deployments ship a libp2p-gossiped store backed by the
|
|
221
|
+
transparency log; sandboxes use the in-memory ``InMemoryRevocationStore``.
|
|
222
|
+
"""
|
|
223
|
+
|
|
224
|
+
def is_revoked(self, kid: bytes, hlc: tuple[int, int]) -> RevocationEntry | None:
|
|
225
|
+
"""Return the matching RevocationEntry if `kid` is revoked at or
|
|
226
|
+
before `hlc`, else None. Statements with HLC strictly less than
|
|
227
|
+
the entry's `revoked_at_hlc` MUST return None (historical-claim
|
|
228
|
+
immutability)."""
|
|
229
|
+
...
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@dataclass
|
|
233
|
+
class InMemoryRevocationStore:
|
|
234
|
+
"""Sandbox/test store. Holds a single RevocationList per namespace."""
|
|
235
|
+
|
|
236
|
+
crl: RevocationList | None = None
|
|
237
|
+
|
|
238
|
+
def install(self, crl: RevocationList) -> None:
|
|
239
|
+
"""Replace the current CRL. Verifies the signature first.
|
|
240
|
+
|
|
241
|
+
For composite namespace-root keys the caller must validate the
|
|
242
|
+
signature themselves before install (the in-memory store doesn't
|
|
243
|
+
know which alg the issuer uses); for Ed25519 we self-check.
|
|
244
|
+
"""
|
|
245
|
+
if not crl.verify():
|
|
246
|
+
raise ValueError(
|
|
247
|
+
"RevocationList signature does not verify under issued_by; "
|
|
248
|
+
"refusing to install (rule_id=HM-KEY-REVOKED-001)"
|
|
249
|
+
)
|
|
250
|
+
self.crl = crl
|
|
251
|
+
|
|
252
|
+
def is_revoked(self, kid: bytes, hlc: tuple[int, int]) -> RevocationEntry | None:
|
|
253
|
+
if self.crl is None:
|
|
254
|
+
return None
|
|
255
|
+
for e in self.crl.entries:
|
|
256
|
+
if bytes(e.kid) != bytes(kid):
|
|
257
|
+
continue
|
|
258
|
+
# Statements signed strictly before revocation remain valid.
|
|
259
|
+
if hlc >= e.revoked_at_hlc:
|
|
260
|
+
return e
|
|
261
|
+
return None
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
__all__ = [
|
|
265
|
+
"InMemoryRevocationStore",
|
|
266
|
+
"RevocationEntry",
|
|
267
|
+
"RevocationList",
|
|
268
|
+
"RevocationReason",
|
|
269
|
+
"RevocationStore",
|
|
270
|
+
]
|
hypermind/rule_ids.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Rule-ID taxonomy — stable across minor versions.
|
|
2
|
+
|
|
3
|
+
Each constant maps ``rule_id`` → ``spec_ref``. Use these via
|
|
4
|
+
``BlockReason(rule_id=RULE_..., spec_ref=SPEC_REFS[RULE_...], ...)``.
|
|
5
|
+
|
|
6
|
+
Renaming or removing a constant is a MAJOR-version bump per the public-surface
|
|
7
|
+
stability contract. Adding new rule_ids is MINOR.
|
|
8
|
+
|
|
9
|
+
The 15 v0.1 rule_ids come from the cycle-2026-04-27 expert panel
|
|
10
|
+
synthesis. The v0.8 expansion (ROADMAP §0.8.15) adds ~18 more covering
|
|
11
|
+
namespace bootstrap, capability lifetime, wire/record discriminators,
|
|
12
|
+
vouching, consult/oracle/dispute/witness lifecycle, partition,
|
|
13
|
+
inclusion-proof verification, FROST quorum, and CRL freshness.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
# v0.1 rule_ids — DO NOT renumber; suffix `-001` reserves room for revisions.
|
|
19
|
+
ADMIT_RAMP = "HM-ADMIT-RAMP-001"
|
|
20
|
+
BOND_TOPIC_MISMATCH = "HM-BOND-MISMATCH-001"
|
|
21
|
+
CAP_SCOPE = "HM-CAP-SCOPE-001"
|
|
22
|
+
CAP_CHAIN = "HM-CAP-CHAIN-001"
|
|
23
|
+
WITNESS_LAG = "HM-WIT-LAG-001"
|
|
24
|
+
HLC_SKEW = "HM-HLC-SKEW-001"
|
|
25
|
+
ALG_PIN = "HM-ALG-PIN-001"
|
|
26
|
+
WIRE_REENCODE = "HM-WIRE-REENCODE-001"
|
|
27
|
+
PQ_REQUIRED = "HM-PQ-REQUIRED-001"
|
|
28
|
+
FROST_REPLAY = "HM-FROST-REPLAY-001"
|
|
29
|
+
RATE_CAP = "HM-RATE-CAP-001"
|
|
30
|
+
DISPUTE_FSM = "HM-DISPUTE-FSM-001"
|
|
31
|
+
KEY_REVOKED = "HM-KEY-REVOKED-001"
|
|
32
|
+
MIN_ALG = "HM-MIN-ALG-001"
|
|
33
|
+
PROTO_VER = "HM-PROTO-VER-001"
|
|
34
|
+
|
|
35
|
+
# v0.8 rule_ids (ROADMAP §0.8.15) — taxonomy completion.
|
|
36
|
+
NAMESPACE_BOOTSTRAP = "HM-NAMESPACE-BOOTSTRAP-001"
|
|
37
|
+
CAP_EXPIRED = "HM-CAP-EXPIRED-001"
|
|
38
|
+
CAP_FUTURE_DATED = "HM-CAP-FUTURE-DATED-001"
|
|
39
|
+
WIRE_VERSION = "HM-WIRE-VERSION-001"
|
|
40
|
+
RECORD_TYPE = "HM-RECORD-TYPE-001"
|
|
41
|
+
NAMESPACE_MISMATCH = "HM-NAMESPACE-MISMATCH-001"
|
|
42
|
+
VOUCH_CAP = "HM-VOUCH-CAP-001"
|
|
43
|
+
VOUCH_SELF = "HM-VOUCH-SELF-001"
|
|
44
|
+
CONSULT_NO_PANEL = "HM-CONSULT-NO-PANEL-001"
|
|
45
|
+
CONSULT_DEADLOCK = "HM-CONSULT-DEADLOCK-001"
|
|
46
|
+
ORACLE_AUTH = "HM-ORACLE-AUTH-001"
|
|
47
|
+
DISPUTE_DOUBLE = "HM-DISPUTE-DOUBLE-001"
|
|
48
|
+
DISPUTE_QUORUM = "HM-DISPUTE-QUORUM-001"
|
|
49
|
+
WITNESS_OFFLINE = "HM-WITNESS-OFFLINE-001"
|
|
50
|
+
PARTITION_DETECTED = "HM-PARTITION-DETECTED-001"
|
|
51
|
+
MERKLE_INCLUSION = "HM-MERKLE-INCLUSION-001"
|
|
52
|
+
FROST_THRESHOLD = "HM-FROST-THRESHOLD-001"
|
|
53
|
+
CRL_SIGNATURE = "HM-CRL-SIGNATURE-001"
|
|
54
|
+
CRL_STALE = "HM-CRL-STALE-001"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
SPEC_REFS: dict[str, str] = {
|
|
58
|
+
# v0.1
|
|
59
|
+
ADMIT_RAMP: "draft-hypermind-scitt-contested-claims §7.2",
|
|
60
|
+
BOND_TOPIC_MISMATCH: "draft-hypermind-scitt-contested-claims §10.4",
|
|
61
|
+
CAP_SCOPE: "draft-hypermind-scitt-contested-claims §11.3",
|
|
62
|
+
CAP_CHAIN: "draft-hypermind-scitt-contested-claims §11.4",
|
|
63
|
+
WITNESS_LAG: "draft-hypermind-scitt-contested-claims §6.5",
|
|
64
|
+
HLC_SKEW: "draft-hypermind-scitt-contested-claims §5.2",
|
|
65
|
+
ALG_PIN: "draft-hypermind-scitt-contested-claims §3.1",
|
|
66
|
+
WIRE_REENCODE: "draft-hypermind-scitt-contested-claims §3.4",
|
|
67
|
+
PQ_REQUIRED: "draft-hypermind-scitt-contested-claims §3.6",
|
|
68
|
+
FROST_REPLAY: "draft-hypermind-scitt-contested-claims §9.3",
|
|
69
|
+
RATE_CAP: "draft-hypermind-scitt-contested-claims §12.2",
|
|
70
|
+
DISPUTE_FSM: "draft-hypermind-scitt-contested-claims §10.2",
|
|
71
|
+
KEY_REVOKED: "draft-hypermind-scitt-contested-claims §12.1 (Revocation)",
|
|
72
|
+
MIN_ALG: "draft-hypermind-scitt-contested-claims §3.7 (min_signature_alg)",
|
|
73
|
+
PROTO_VER: "draft-hypermind-scitt-contested-claims §17 (protocol-version-negotiation)",
|
|
74
|
+
# v0.8
|
|
75
|
+
NAMESPACE_BOOTSTRAP: "draft-hypermind-scitt-contested-claims §8.1 (admission)",
|
|
76
|
+
CAP_EXPIRED: "draft-hypermind-scitt-contested-claims §11.5 (capability lifetime)",
|
|
77
|
+
CAP_FUTURE_DATED: "draft-hypermind-scitt-contested-claims §11.5 (capability lifetime)",
|
|
78
|
+
WIRE_VERSION: "draft-hypermind-scitt-contested-claims §3.3 (wire_version)",
|
|
79
|
+
RECORD_TYPE: "draft-hypermind-scitt-contested-claims §3.5 (record_type)",
|
|
80
|
+
NAMESPACE_MISMATCH: "draft-hypermind-scitt-contested-claims §8.2 (namespace binding)",
|
|
81
|
+
VOUCH_CAP: "draft-hypermind-scitt-contested-claims §7.4 (vouch contribution cap)",
|
|
82
|
+
VOUCH_SELF: "draft-hypermind-scitt-contested-claims §7.4 (no self-vouching)",
|
|
83
|
+
CONSULT_NO_PANEL: "draft-hypermind-scitt-contested-claims §5.1 (panel selection)",
|
|
84
|
+
CONSULT_DEADLOCK: "draft-hypermind-scitt-contested-claims §5.6 (consult timeout)",
|
|
85
|
+
ORACLE_AUTH: "draft-hypermind-scitt-contested-claims §6.7 (oracle authority)",
|
|
86
|
+
DISPUTE_DOUBLE: "draft-hypermind-scitt-contested-claims §10.5 (double-dispute)",
|
|
87
|
+
DISPUTE_QUORUM: "draft-hypermind-scitt-contested-claims §10.6 (close quorum)",
|
|
88
|
+
WITNESS_OFFLINE: "draft-hypermind-scitt-contested-claims §6.5 (witness availability)",
|
|
89
|
+
PARTITION_DETECTED: "draft-hypermind-scitt-contested-claims §10.7 (UNRESOLVED_PARTITION)",
|
|
90
|
+
MERKLE_INCLUSION: "draft-hypermind-scitt-contested-claims §6.4 (inclusion proof)",
|
|
91
|
+
FROST_THRESHOLD: "draft-hypermind-scitt-contested-claims §9.2 (k-of-n)",
|
|
92
|
+
CRL_SIGNATURE: "draft-hypermind-scitt-contested-claims §12.3 (CRL signature)",
|
|
93
|
+
CRL_STALE: "draft-hypermind-scitt-contested-claims §12.4 (CRL freshness)",
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
__all__ = [
|
|
98
|
+
# v0.1
|
|
99
|
+
"ADMIT_RAMP",
|
|
100
|
+
"ALG_PIN",
|
|
101
|
+
"BOND_TOPIC_MISMATCH",
|
|
102
|
+
"CAP_CHAIN",
|
|
103
|
+
# v0.8
|
|
104
|
+
"CAP_EXPIRED",
|
|
105
|
+
"CAP_FUTURE_DATED",
|
|
106
|
+
"CAP_SCOPE",
|
|
107
|
+
"CONSULT_DEADLOCK",
|
|
108
|
+
"CONSULT_NO_PANEL",
|
|
109
|
+
"CRL_SIGNATURE",
|
|
110
|
+
"CRL_STALE",
|
|
111
|
+
"DISPUTE_DOUBLE",
|
|
112
|
+
"DISPUTE_FSM",
|
|
113
|
+
"DISPUTE_QUORUM",
|
|
114
|
+
"FROST_REPLAY",
|
|
115
|
+
"FROST_THRESHOLD",
|
|
116
|
+
"HLC_SKEW",
|
|
117
|
+
"KEY_REVOKED",
|
|
118
|
+
"MERKLE_INCLUSION",
|
|
119
|
+
"MIN_ALG",
|
|
120
|
+
"NAMESPACE_BOOTSTRAP",
|
|
121
|
+
"NAMESPACE_MISMATCH",
|
|
122
|
+
"ORACLE_AUTH",
|
|
123
|
+
"PARTITION_DETECTED",
|
|
124
|
+
"PQ_REQUIRED",
|
|
125
|
+
"PROTO_VER",
|
|
126
|
+
"RATE_CAP",
|
|
127
|
+
"RECORD_TYPE",
|
|
128
|
+
"SPEC_REFS",
|
|
129
|
+
"VOUCH_CAP",
|
|
130
|
+
"VOUCH_SELF",
|
|
131
|
+
"WIRE_REENCODE",
|
|
132
|
+
"WIRE_VERSION",
|
|
133
|
+
"WITNESS_LAG",
|
|
134
|
+
"WITNESS_OFFLINE",
|
|
135
|
+
]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
; encrypted_statement.cddl - EncryptedStatement payload schema
|
|
2
|
+
; HyperMind v0.9.x - wire_version >= 2
|
|
3
|
+
; This file is co-located in src/hypermind/schemas/ and reference_verifier/schemas/.
|
|
4
|
+
; Keep them byte-equal.
|
|
5
|
+
;
|
|
6
|
+
; Encoding: RFC 8949 deterministic CBOR (sec 4.2). This payload is the
|
|
7
|
+
; ciphertext envelope used for private/hybrid namespace records. The outer
|
|
8
|
+
; SignedStatement carries this CBOR array as its payload bstr; the inner
|
|
9
|
+
; plaintext (after AEAD decryption) is itself a deterministic-CBOR record.
|
|
10
|
+
;
|
|
11
|
+
; HPKE alignment: kdf and aead values use the IANA HPKE registry from
|
|
12
|
+
; RFC 9180 sec 7 (e.g. kdf=1 HKDF-SHA256, aead=1 AES-128-GCM, aead=2
|
|
13
|
+
; AES-256-GCM, aead=3 ChaCha20-Poly1305). Recipient.enc carries the HPKE
|
|
14
|
+
; encapsulated key for that recipient.
|
|
15
|
+
|
|
16
|
+
EncryptedStatement = [
|
|
17
|
+
kdf: int, ; HPKE KDF id (RFC 9180 sec 7.2)
|
|
18
|
+
aead: int, ; HPKE AEAD id (RFC 9180 sec 7.3)
|
|
19
|
+
enc_recipients: [+ Recipient],
|
|
20
|
+
aad_hash: bstr .size 32, ; BLAKE3-256 of the AEAD additional-authenticated-data
|
|
21
|
+
ciphertext: bstr, ; AEAD output for the chosen suite
|
|
22
|
+
? epoch_tag: bstr .size 16 ; optional MLS-style epoch / key-rotation tag
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
Recipient = {
|
|
26
|
+
recipient_kid: bstr .size 32, ; Ed25519 pubkey half of the recipient
|
|
27
|
+
enc: bstr ; HPKE encapsulated key (suite-dependent length)
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
; namespace_accept.cddl - NAMESPACE_ACCEPT record payload schema
|
|
2
|
+
; HyperMind v0.9.x - wire_version >= 2
|
|
3
|
+
; This file is co-located in src/hypermind/schemas/ and reference_verifier/schemas/.
|
|
4
|
+
; Keep them byte-equal.
|
|
5
|
+
;
|
|
6
|
+
; Encoding: RFC 8949 deterministic CBOR (sec 4.2). This payload is carried
|
|
7
|
+
; as the COSE_Sign1 payload bstr for record_type = "NAMESPACE_ACCEPT".
|
|
8
|
+
; Its BLAKE3-256 digest is bound into the protected header under the
|
|
9
|
+
; HM_ENVELOPE_SCHEMA_HASH (-65605) label.
|
|
10
|
+
|
|
11
|
+
NamespaceAccept = {
|
|
12
|
+
ns_id: bstr .size 16,
|
|
13
|
+
invitee_kid: bstr .size 32, ; MUST equal kid of the signer
|
|
14
|
+
invite_hash: bstr .size 32, ; BLAKE3-256 of the canonical NamespaceInvite payload
|
|
15
|
+
accepted_at_hlc: hlc,
|
|
16
|
+
signature: bstr ; Ed25519 (or hybrid) signature by invitee_kid
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
; Hybrid Logical Clock - [logical_ms, counter, node_id]
|
|
20
|
+
hlc = [uint, uint, bstr]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
; namespace_create.cddl - NAMESPACE_CREATE record payload schema
|
|
2
|
+
; HyperMind v0.9.x - wire_version >= 2
|
|
3
|
+
; This file is co-located in src/hypermind/schemas/ and reference_verifier/schemas/.
|
|
4
|
+
; Keep them byte-equal.
|
|
5
|
+
;
|
|
6
|
+
; Encoding: RFC 8949 deterministic CBOR (sec 4.2). This payload is carried
|
|
7
|
+
; as the COSE_Sign1 payload bstr for record_type = "NAMESPACE_CREATE".
|
|
8
|
+
; Its BLAKE3-256 digest is bound into the protected header under the
|
|
9
|
+
; HM_ENVELOPE_SCHEMA_HASH (-65605) label.
|
|
10
|
+
|
|
11
|
+
NamespaceCreate = {
|
|
12
|
+
ns_id: bstr .size 16, ; UUIDv7-shaped namespace id
|
|
13
|
+
founding_cohort: [+ bstr .size 32], ; list of founder kids (Ed25519 pubkey halves)
|
|
14
|
+
threshold: { k: uint, n: uint }, ; FROST k-of-n threshold parameters
|
|
15
|
+
dkg_transcript_hash: bstr .size 32, ; BLAKE3-256 of the DKG transcript
|
|
16
|
+
root_pubkey: bstr, ; FROST group public key (aggregated)
|
|
17
|
+
visibility: ("public" / "private" / "hybrid"),
|
|
18
|
+
created_at_hlc: hlc,
|
|
19
|
+
frost_signature: bstr ; RFC 9591 FROST signature over the canonical preimage
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
; Hybrid Logical Clock - [logical_ms, counter, node_id]
|
|
23
|
+
; Mirrors the definition in wire-v0.1.cddl; duplicated here so this
|
|
24
|
+
; payload schema stands alone for digest computation.
|
|
25
|
+
hlc = [uint, uint, bstr]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
; namespace_founding_attest.cddl - NAMESPACE_FOUNDING_ATTEST record payload schema
|
|
2
|
+
; HyperMind v0.9.x - wire_version >= 2
|
|
3
|
+
; This file is co-located in src/hypermind/schemas/ and reference_verifier/schemas/.
|
|
4
|
+
; Keep them byte-equal.
|
|
5
|
+
;
|
|
6
|
+
; Encoding: RFC 8949 deterministic CBOR (sec 4.2). This payload is carried
|
|
7
|
+
; as the COSE_Sign1 payload bstr for record_type = "NAMESPACE_FOUNDING_ATTEST".
|
|
8
|
+
; Its BLAKE3-256 digest is bound into the protected header under the
|
|
9
|
+
; HM_ENVELOPE_SCHEMA_HASH (-65605) label.
|
|
10
|
+
|
|
11
|
+
NamespaceFoundingAttest = {
|
|
12
|
+
ns_id: bstr .size 16,
|
|
13
|
+
members: [+ Member],
|
|
14
|
+
dkg_transcript_hash: bstr .size 32,
|
|
15
|
+
root_pubkey: bstr, ; FROST group public key
|
|
16
|
+
? root_cert: bstr, ; optional X.509 / SCITT root cert chain
|
|
17
|
+
visibility: ("public" / "private" / "hybrid"),
|
|
18
|
+
created_at_hlc: hlc,
|
|
19
|
+
frost_signature: bstr ; RFC 9591 FROST signature
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Member = {
|
|
23
|
+
kid: bstr .size 32, ; Ed25519 pubkey half = stable address
|
|
24
|
+
jurisdiction: tstr, ; ISO 3166-1 alpha-2 or "XX" for unspecified
|
|
25
|
+
org_did: tstr, ; W3C DID for the founding org
|
|
26
|
+
coi_disclosure_hash: bstr .size 32 ; BLAKE3-256 of conflict-of-interest disclosure
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
; Hybrid Logical Clock - [logical_ms, counter, node_id]
|
|
30
|
+
hlc = [uint, uint, bstr]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
; namespace_invite.cddl - NAMESPACE_INVITE record payload schema
|
|
2
|
+
; HyperMind v0.9.x - wire_version >= 2
|
|
3
|
+
; This file is co-located in src/hypermind/schemas/ and reference_verifier/schemas/.
|
|
4
|
+
; Keep them byte-equal.
|
|
5
|
+
;
|
|
6
|
+
; Encoding: RFC 8949 deterministic CBOR (sec 4.2). This payload is carried
|
|
7
|
+
; as the COSE_Sign1 payload bstr for record_type = "NAMESPACE_INVITE".
|
|
8
|
+
; Its BLAKE3-256 digest is bound into the protected header under the
|
|
9
|
+
; HM_ENVELOPE_SCHEMA_HASH (-65605) label.
|
|
10
|
+
|
|
11
|
+
NamespaceInvite = {
|
|
12
|
+
ns_id: bstr .size 16,
|
|
13
|
+
inviter_kid: bstr .size 32, ; member already in the namespace
|
|
14
|
+
invitee_kid: bstr .size 32, ; prospective member
|
|
15
|
+
scope: { rooms: [* tstr], topics: [* tstr] },
|
|
16
|
+
valid_from_hlc: hlc,
|
|
17
|
+
valid_until_hlc: hlc,
|
|
18
|
+
signature: bstr ; Ed25519 (or hybrid) signature by inviter_kid
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
; Hybrid Logical Clock - [logical_ms, counter, node_id]
|
|
22
|
+
hlc = [uint, uint, bstr]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
; HyperMind SCITT Contested-Claims Profile — wire format v0.1
|
|
2
|
+
; draft-hypermind-scitt-contested-claims-profile-00
|
|
3
|
+
;
|
|
4
|
+
; This CDDL is the canonical schema for the SignedStatement envelope.
|
|
5
|
+
; Its BLAKE3-256 digest is bound into every protected header under the
|
|
6
|
+
; HM_ENVELOPE_SCHEMA_HASH (-65605) label. Any change to this file is a
|
|
7
|
+
; wire-format change and MUST bump WIRE_VERSION.
|
|
8
|
+
;
|
|
9
|
+
; Encoding: RFC 8949 deterministic CBOR (§4.2). Outer envelope is a
|
|
10
|
+
; COSE_Sign1 4-tuple per RFC 9052 §4.2.
|
|
11
|
+
|
|
12
|
+
SignedStatement = [
|
|
13
|
+
protected: bstr .cbor protected-header,
|
|
14
|
+
unprotected: { * (int / tstr) => any },
|
|
15
|
+
payload: bstr,
|
|
16
|
+
signature: bstr
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
; ---- Protected header --------------------------------------------------
|
|
20
|
+
; Standard COSE labels:
|
|
21
|
+
; 1 alg
|
|
22
|
+
; 4 kid (32-byte Ed25519 public key half = stable agent address)
|
|
23
|
+
;
|
|
24
|
+
; HyperMind extension labels (proposed IANA -65600..-65624):
|
|
25
|
+
|
|
26
|
+
protected-header = {
|
|
27
|
+
1 => sig-alg, ; COSE alg
|
|
28
|
+
4 => bstr .size 32, ; issuer_kid
|
|
29
|
+
-65601 => record-type,
|
|
30
|
+
-65602 => bstr .size 16, ; namespace_id (UUIDv7-shaped)
|
|
31
|
+
-65603 => hlc,
|
|
32
|
+
-65604 => sig-alg, ; sig_alg_disc — MUST equal label 1
|
|
33
|
+
-65605 => bstr .size 32, ; envelope_schema_hash (BLAKE3 of this CDDL)
|
|
34
|
+
-65606 => uint, ; wire_version (= 0 for v0.1)
|
|
35
|
+
-65607 => bool, ; pq_required
|
|
36
|
+
-65611 => uint, ; protocol_version (HyperMind v0.5+; = 0)
|
|
37
|
+
? -65608 => uncertainty, ; receipt_uncertainty (RECEIPT only)
|
|
38
|
+
? -65609 => [+ bstr .size 32], ; confirmer_set (SEAL only, ≥3)
|
|
39
|
+
? -65610 => dispute-state,
|
|
40
|
+
? -65620 => bstr .size 32, ; dispute_target_kid (DISPUTE only)
|
|
41
|
+
? -65621 => dispute-subtype,
|
|
42
|
+
? -65622 => bond-commitment,
|
|
43
|
+
? -65623 => [* bstr .size 32], ; prior_dispute_chain
|
|
44
|
+
? -65624 => ramp-state
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
record-type = "SEAL" / "RECEIPT" / "DISPUTE" / "KEY_ROTATE"
|
|
48
|
+
/ "NAMESPACE_FOUNDING_ATTEST"
|
|
49
|
+
|
|
50
|
+
dispute-state = "OPEN" / "ARGUE" / "COUNTER" / "FRIVOLOUS"
|
|
51
|
+
/ "CLOSED" / "UNRESOLVED_PARTITION"
|
|
52
|
+
dispute-subtype = "OPEN" / "ARGUE" / "COUNTER" / "FRIVOLOUS"
|
|
53
|
+
|
|
54
|
+
; v0.1 algorithms (RFC 9053 + composite per LAMPS draft):
|
|
55
|
+
; -8 Ed25519
|
|
56
|
+
; -49 Ed25519+ML-DSA-65 composite
|
|
57
|
+
sig-alg = -8 / -49
|
|
58
|
+
|
|
59
|
+
; Hybrid Logical Clock — [logical_ms, counter, node_id]
|
|
60
|
+
hlc = [uint, uint, bstr]
|
|
61
|
+
|
|
62
|
+
; Receipt uncertainty bundle — opaque CBOR map; semantics in §03-messages.md
|
|
63
|
+
uncertainty = { * (int / tstr) => any }
|
|
64
|
+
|
|
65
|
+
; Bond commitment — opaque CBOR map; semantics in §10-disputes.md
|
|
66
|
+
bond-commitment = { * (int / tstr) => any }
|
|
67
|
+
|
|
68
|
+
; Ramp state — opaque CBOR map; semantics in §10-disputes.md
|
|
69
|
+
ramp-state = { * (int / tstr) => any }
|
|
70
|
+
|
|
71
|
+
; ---- Sig_structure preimage (RFC 9052 §4.4) ---------------------------
|
|
72
|
+
; The signed bytes are deterministic-CBOR(Sig_structure) where:
|
|
73
|
+
; Sig_structure = [ "Signature1", protected, h'' (ext_aad), payload ]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""HyperMind SimLab — multi-sim app: registry, runner, scenarios.
|
|
2
|
+
|
|
3
|
+
Public API:
|
|
4
|
+
SimConfig — declarative simulation request shape
|
|
5
|
+
run_persona_sim() — async entrypoint that runs a persona-panel sim
|
|
6
|
+
SimResult — what run_persona_sim() returns
|
|
7
|
+
|
|
8
|
+
The HTTP surface lives in `src/hypermind/api/app.py` (`/v1/sims/*`); the
|
|
9
|
+
CLI surface is `hmctl simlab`.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from .config import SimConfig
|
|
13
|
+
from .scenario import SimResult, run_persona_sim
|
|
14
|
+
|
|
15
|
+
__all__ = ["SimConfig", "SimResult", "run_persona_sim"]
|