mnemom-types 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ Metadata-Version: 2.4
2
+ Name: mnemom-types
3
+ Version: 0.1.0
4
+ Summary: Shared type definitions for Mnemom services and SDKs
5
+ Project-URL: Homepage, https://github.com/mnemom/mnemom-types
6
+ Project-URL: Repository, https://github.com/mnemom/mnemom-types.git
7
+ Project-URL: Issues, https://github.com/mnemom/mnemom-types/issues
8
+ Author-email: "Mnemom.ai" <dev@mnemom.ai>
9
+ License-Expression: Apache-2.0
10
+ Keywords: agents,ai,mnemom,reputation,types
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: pydantic>=2.0
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "mnemom-types"
7
+ version = "0.1.0"
8
+ description = "Shared type definitions for Mnemom services and SDKs"
9
+ license = "Apache-2.0"
10
+ requires-python = ">=3.10"
11
+ authors = [
12
+ { name = "Mnemom.ai", email = "dev@mnemom.ai" }
13
+ ]
14
+ keywords = [
15
+ "mnemom",
16
+ "reputation",
17
+ "types",
18
+ "ai",
19
+ "agents",
20
+ ]
21
+ classifiers = [
22
+ "Development Status :: 3 - Alpha",
23
+ "Intended Audience :: Developers",
24
+ "License :: OSI Approved :: Apache Software License",
25
+ "Operating System :: OS Independent",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3.10",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
30
+ "Typing :: Typed",
31
+ ]
32
+ dependencies = [
33
+ "pydantic>=2.0",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/mnemom/mnemom-types"
38
+ Repository = "https://github.com/mnemom/mnemom-types.git"
39
+ Issues = "https://github.com/mnemom/mnemom-types/issues"
40
+
41
+ [tool.hatch.build.targets.sdist]
42
+ include = ["/src"]
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["src/mnemom_types"]
@@ -0,0 +1,41 @@
1
+ """mnemom-types — Shared type definitions for Mnemom services and SDKs.
2
+
3
+ Example::
4
+
5
+ from mnemom_types import ReputationScore, ReputationGrade
6
+ from mnemom_types import GRADE_ORDINALS, COMPONENT_WEIGHTS
7
+ """
8
+
9
+ from mnemom_types.constants import (
10
+ COMPONENT_WEIGHTS,
11
+ GRADE_ORDINALS,
12
+ GRADE_SCALE,
13
+ ComponentWeightEntry,
14
+ GradeScaleEntry,
15
+ )
16
+ from mnemom_types.gate import GateResult, ReputationGateConfig
17
+ from mnemom_types.reputation import (
18
+ A2ATrustExtension,
19
+ ConfidenceLevel,
20
+ ReputationComponent,
21
+ ReputationGrade,
22
+ ReputationScore,
23
+ )
24
+
25
+ __all__ = [
26
+ # Reputation types
27
+ "ReputationGrade",
28
+ "ConfidenceLevel",
29
+ "ReputationComponent",
30
+ "ReputationScore",
31
+ "A2ATrustExtension",
32
+ # Gate types
33
+ "ReputationGateConfig",
34
+ "GateResult",
35
+ # Constants
36
+ "GRADE_ORDINALS",
37
+ "GRADE_SCALE",
38
+ "COMPONENT_WEIGHTS",
39
+ "GradeScaleEntry",
40
+ "ComponentWeightEntry",
41
+ ]
@@ -0,0 +1,8 @@
1
+ """A2A trust extension types.
2
+
3
+ Re-exports from reputation for convenience.
4
+ """
5
+
6
+ from .reputation import A2ATrustExtension
7
+
8
+ __all__ = ["A2ATrustExtension"]
@@ -0,0 +1,57 @@
1
+ """Reputation constants.
2
+
3
+ Centralizes grade ordinals, grade scale definitions, and
4
+ component weight definitions used across all services and SDKs.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import TypedDict
10
+
11
+ GRADE_ORDINALS: dict[str, int] = {
12
+ "AAA": 7,
13
+ "AA": 6,
14
+ "A": 5,
15
+ "BBB": 4,
16
+ "BB": 3,
17
+ "B": 2,
18
+ "CCC": 1,
19
+ "NR": 0,
20
+ }
21
+ """Ordinal ranking of reputation grades (higher = better)."""
22
+
23
+
24
+ class GradeScaleEntry(TypedDict):
25
+ grade: str
26
+ tier: str
27
+ min: int
28
+ max: int
29
+
30
+
31
+ GRADE_SCALE: list[GradeScaleEntry] = [
32
+ {"grade": "AAA", "tier": "Exemplary", "min": 900, "max": 1000},
33
+ {"grade": "AA", "tier": "Established", "min": 800, "max": 899},
34
+ {"grade": "A", "tier": "Reliable", "min": 700, "max": 799},
35
+ {"grade": "BBB", "tier": "Developing", "min": 600, "max": 699},
36
+ {"grade": "BB", "tier": "Emerging", "min": 500, "max": 599},
37
+ {"grade": "B", "tier": "Concerning", "min": 400, "max": 499},
38
+ {"grade": "CCC", "tier": "Critical", "min": 200, "max": 399},
39
+ ]
40
+ """Grade scale from highest to lowest."""
41
+
42
+
43
+ class ComponentWeightEntry(TypedDict):
44
+ key: str
45
+ label: str
46
+ weight: float
47
+ source: str
48
+
49
+
50
+ COMPONENT_WEIGHTS: list[ComponentWeightEntry] = [
51
+ {"key": "integrity_ratio", "label": "Integrity Ratio", "weight": 0.40, "source": "Checkpoint clear rate"},
52
+ {"key": "compliance", "label": "Compliance", "weight": 0.20, "source": "Violation impact decay"},
53
+ {"key": "drift_stability", "label": "Drift Stability", "weight": 0.20, "source": "Session stability ratio"},
54
+ {"key": "trace_completeness", "label": "Trace Completeness", "weight": 0.10, "source": "Trace/checkpoint balance"},
55
+ {"key": "coherence_compatibility", "label": "Coherence Compatibility", "weight": 0.10, "source": "Fleet coherence data"},
56
+ ]
57
+ """Scoring component weights."""
@@ -0,0 +1,39 @@
1
+ """Reputation gate types.
2
+
3
+ Types for gating agent interactions based on reputation
4
+ score and grade thresholds.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import Optional
10
+
11
+ from pydantic import BaseModel, Field
12
+
13
+ from .reputation import ReputationGrade, ReputationScore
14
+
15
+
16
+ class ReputationGateConfig(BaseModel):
17
+ """Configuration for a reputation gate."""
18
+
19
+ min_score: Optional[float] = Field(
20
+ None, description="Minimum numeric score required (0-1000)"
21
+ )
22
+ min_grade: Optional[ReputationGrade] = Field(
23
+ None, description="Minimum letter grade required"
24
+ )
25
+ base_url: str = Field(
26
+ "https://api.mnemom.ai", description="Base URL for the reputation API"
27
+ )
28
+
29
+
30
+ class GateResult(BaseModel):
31
+ """Result of a reputation gate check."""
32
+
33
+ allowed: bool = Field(..., description="Whether the agent passed the gate")
34
+ score: Optional[ReputationScore] = Field(
35
+ None, description="The agent's reputation score (None on fetch error)"
36
+ )
37
+ reason: Optional[str] = Field(
38
+ None, description="Reason for denial (None if allowed)"
39
+ )
File without changes
@@ -0,0 +1,75 @@
1
+ """Reputation score types.
2
+
3
+ Canonical definitions for Mnemom reputation scores, grades,
4
+ confidence levels, and score components.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from typing import Literal, Optional
10
+
11
+ from pydantic import BaseModel, Field
12
+
13
+ ReputationGrade = Literal["AAA", "AA", "A", "BBB", "BB", "B", "CCC", "NR"]
14
+ """Reputation grade scale from AAA (highest) to NR (not rated)."""
15
+
16
+ ConfidenceLevel = Literal["insufficient", "low", "medium", "high"]
17
+ """Confidence level of a reputation score."""
18
+
19
+
20
+ class ReputationComponent(BaseModel):
21
+ """A single component contributing to an agent's reputation score."""
22
+
23
+ key: str = Field(..., description="Machine-readable key (e.g. 'integrity_ratio')")
24
+ label: str = Field(..., description="Human-readable label (e.g. 'Integrity Ratio')")
25
+ score: float = Field(..., description="Raw component score (0-1000)")
26
+ weight: float = Field(..., description="Weight applied to this component (0-1)")
27
+ weighted_score: float = Field(..., description="score * weight, rounded")
28
+ factors: list[str] = Field(default_factory=list, description="Human-readable factors")
29
+
30
+
31
+ class A2ATrustExtension(BaseModel):
32
+ """A2A trust extension for inter-agent reputation sharing."""
33
+
34
+ extension_uri: str = Field(..., description="URI identifying this extension")
35
+ provider: str = Field(..., description="Reputation provider identifier")
36
+ score: float = Field(..., description="Numeric reputation score")
37
+ grade: ReputationGrade = Field(..., description="Letter grade")
38
+ confidence: ConfidenceLevel = Field(..., description="Confidence in the score")
39
+ verified_url: str = Field(..., description="URL to verify the score")
40
+ badge_url: str = Field(..., description="URL to the agent's badge")
41
+ methodology_url: str = Field(..., description="URL to the scoring methodology")
42
+ last_updated: str = Field(
43
+ ..., description="When the score was last updated (ISO 8601)"
44
+ )
45
+
46
+
47
+ class ReputationScore(BaseModel):
48
+ """Full reputation score for an agent."""
49
+
50
+ agent_id: str = Field(..., description="Agent identifier")
51
+ score: float = Field(..., description="Numeric reputation score (0-1000)")
52
+ grade: ReputationGrade = Field(..., description="Letter grade")
53
+ tier: str = Field(..., description="Tier label (e.g. 'Exemplary', 'Reliable')")
54
+ is_eligible: bool = Field(
55
+ ..., description="Whether the agent is eligible for reputation"
56
+ )
57
+ checkpoint_count: int = Field(
58
+ ..., description="Number of checkpoints contributing to the score"
59
+ )
60
+ confidence: ConfidenceLevel = Field(..., description="Confidence in the score")
61
+ components: list[ReputationComponent] = Field(
62
+ ..., description="Score components breakdown"
63
+ )
64
+ computed_at: str = Field(
65
+ ..., description="When the score was computed (ISO 8601)"
66
+ )
67
+ trend_30d: float = Field(
68
+ ..., description="30-day score trend (positive = improving)"
69
+ )
70
+ visibility: Literal["public", "unlisted", "private"] = Field(
71
+ ..., description="Visibility setting"
72
+ )
73
+ a2a_trust_extension: Optional[A2ATrustExtension] = Field(
74
+ None, description="Optional A2A trust extension"
75
+ )