coreason-manifest 0.9.0__py3-none-any.whl → 0.12.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.
- coreason_manifest/__init__.py +47 -13
- coreason_manifest/common.py +64 -0
- coreason_manifest/governance.py +83 -0
- coreason_manifest/schemas/__init__.py +9 -1
- coreason_manifest/schemas/coreason-v2.schema.json +462 -0
- coreason_manifest/utils/__init__.py +10 -0
- coreason_manifest/utils/logger.py +10 -0
- coreason_manifest/v2/__init__.py +1 -0
- coreason_manifest/v2/governance.py +144 -0
- coreason_manifest/v2/io.py +132 -0
- coreason_manifest/v2/resolver.py +67 -0
- coreason_manifest/v2/spec/__init__.py +1 -0
- coreason_manifest/v2/spec/contracts.py +34 -0
- coreason_manifest/v2/spec/definitions.py +196 -0
- coreason_manifest/v2/validator.py +48 -0
- {coreason_manifest-0.9.0.dist-info → coreason_manifest-0.12.0.dist-info}/METADATA +68 -29
- coreason_manifest-0.12.0.dist-info/RECORD +20 -0
- {coreason_manifest-0.9.0.dist-info → coreason_manifest-0.12.0.dist-info}/WHEEL +1 -1
- coreason_manifest/definitions/__init__.py +0 -49
- coreason_manifest/definitions/agent.py +0 -292
- coreason_manifest/definitions/audit.py +0 -122
- coreason_manifest/definitions/events.py +0 -392
- coreason_manifest/definitions/message.py +0 -126
- coreason_manifest/definitions/simulation.py +0 -50
- coreason_manifest/definitions/topology.py +0 -255
- coreason_manifest/recipes.py +0 -76
- coreason_manifest/schemas/agent.schema.json +0 -849
- coreason_manifest-0.9.0.dist-info/RECORD +0 -18
- {coreason_manifest-0.9.0.dist-info → coreason_manifest-0.12.0.dist-info}/licenses/LICENSE +0 -0
- {coreason_manifest-0.9.0.dist-info → coreason_manifest-0.12.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2025 CoReason, Inc.
|
|
2
|
-
#
|
|
3
|
-
# This software is proprietary and dual-licensed.
|
|
4
|
-
# Licensed under the Prosperity Public License 3.0 (the "License").
|
|
5
|
-
# A copy of the license is available at https://prosperitylicense.com/versions/3.0.0
|
|
6
|
-
# For details, see the LICENSE file.
|
|
7
|
-
# Commercial use beyond a 30-day trial requires a separate license.
|
|
8
|
-
#
|
|
9
|
-
# Source Code: https://github.com/CoReason-AI/coreason_maco
|
|
10
|
-
|
|
11
|
-
from enum import Enum
|
|
12
|
-
from typing import Annotated, Any, Dict, List, Literal, Optional, Union
|
|
13
|
-
|
|
14
|
-
from pydantic import BaseModel, ConfigDict, Field, StringConstraints
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class StateSchema(BaseModel):
|
|
18
|
-
"""Defines the structure and persistence of the graph state.
|
|
19
|
-
|
|
20
|
-
Attributes:
|
|
21
|
-
data_schema: A JSON Schema or Pydantic definition describing the state structure.
|
|
22
|
-
persistence: Configuration for how state is checkpointed.
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
model_config = ConfigDict(extra="forbid")
|
|
26
|
-
|
|
27
|
-
data_schema: Dict[str, Any] = Field(
|
|
28
|
-
..., description="A JSON Schema or Pydantic definition describing the state structure."
|
|
29
|
-
)
|
|
30
|
-
persistence: str = Field(..., description="Configuration for how state is checkpointed (e.g., 'memory', 'redis').")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class CouncilConfig(BaseModel):
|
|
34
|
-
"""Configuration for 'Architectural Triangulation'.
|
|
35
|
-
|
|
36
|
-
Attributes:
|
|
37
|
-
strategy: The strategy for the council (e.g., 'consensus').
|
|
38
|
-
voters: List of agents or models that vote.
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
model_config = ConfigDict(extra="forbid")
|
|
42
|
-
|
|
43
|
-
strategy: str = Field(default="consensus", description="The strategy for the council, e.g., 'consensus'.")
|
|
44
|
-
voters: List[str] = Field(..., description="List of agents or models that vote.")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class VisualMetadata(BaseModel):
|
|
48
|
-
"""Data explicitly for the UI.
|
|
49
|
-
|
|
50
|
-
Attributes:
|
|
51
|
-
label: The label to display for the node.
|
|
52
|
-
x_y_coordinates: The X and Y coordinates for the node on the canvas.
|
|
53
|
-
icon: The icon to represent the node.
|
|
54
|
-
animation_style: The animation style for the node.
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
model_config = ConfigDict(extra="forbid")
|
|
58
|
-
|
|
59
|
-
label: Optional[str] = Field(None, description="The label to display for the node.")
|
|
60
|
-
x_y_coordinates: Optional[List[float]] = Field(
|
|
61
|
-
None, description="The X and Y coordinates for the node on the canvas."
|
|
62
|
-
)
|
|
63
|
-
icon: Optional[str] = Field(None, description="The icon to represent the node.")
|
|
64
|
-
animation_style: Optional[str] = Field(None, description="The animation style for the node.")
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class BaseNode(BaseModel):
|
|
68
|
-
"""Base model for all node types.
|
|
69
|
-
|
|
70
|
-
Attributes:
|
|
71
|
-
id: Unique identifier for the node.
|
|
72
|
-
council_config: Optional configuration for architectural triangulation.
|
|
73
|
-
visual: Visual metadata for the UI.
|
|
74
|
-
"""
|
|
75
|
-
|
|
76
|
-
model_config = ConfigDict(extra="forbid")
|
|
77
|
-
|
|
78
|
-
id: str = Field(..., description="Unique identifier for the node.")
|
|
79
|
-
council_config: Optional[CouncilConfig] = Field(
|
|
80
|
-
None, description="Optional configuration for architectural triangulation."
|
|
81
|
-
)
|
|
82
|
-
visual: Optional[VisualMetadata] = Field(None, description="Visual metadata for the UI.")
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
class AgentNode(BaseNode):
|
|
86
|
-
"""A node that calls a specific atomic agent.
|
|
87
|
-
|
|
88
|
-
Attributes:
|
|
89
|
-
type: The type of the node (must be 'agent').
|
|
90
|
-
agent_name: The name of the atomic agent to call.
|
|
91
|
-
"""
|
|
92
|
-
|
|
93
|
-
type: Literal["agent"] = Field("agent", description="Discriminator for AgentNode.")
|
|
94
|
-
agent_name: str = Field(..., description="The name of the atomic agent to call.")
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
class HumanNode(BaseNode):
|
|
98
|
-
"""A node that pauses execution for user input/approval.
|
|
99
|
-
|
|
100
|
-
Attributes:
|
|
101
|
-
type: The type of the node (must be 'human').
|
|
102
|
-
timeout_seconds: Optional timeout in seconds for the user interaction.
|
|
103
|
-
"""
|
|
104
|
-
|
|
105
|
-
type: Literal["human"] = Field("human", description="Discriminator for HumanNode.")
|
|
106
|
-
timeout_seconds: Optional[int] = Field(None, description="Optional timeout in seconds for the user interaction.")
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
class LogicNode(BaseNode):
|
|
110
|
-
"""A node that executes pure Python logic.
|
|
111
|
-
|
|
112
|
-
Attributes:
|
|
113
|
-
type: The type of the node (must be 'logic').
|
|
114
|
-
code: The Python logic code to execute.
|
|
115
|
-
"""
|
|
116
|
-
|
|
117
|
-
type: Literal["logic"] = Field("logic", description="Discriminator for LogicNode.")
|
|
118
|
-
code: str = Field(..., description="The Python logic code to execute.")
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
class DataMappingStrategy(str, Enum):
|
|
122
|
-
"""Strategy for mapping data."""
|
|
123
|
-
|
|
124
|
-
DIRECT = "direct"
|
|
125
|
-
JSONPATH = "jsonpath"
|
|
126
|
-
LITERAL = "literal"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
class DataMapping(BaseModel):
|
|
130
|
-
"""Defines how to transform data between parent and child."""
|
|
131
|
-
|
|
132
|
-
model_config = ConfigDict(extra="forbid")
|
|
133
|
-
|
|
134
|
-
source: str = Field(..., description="The path/key source.")
|
|
135
|
-
strategy: DataMappingStrategy = Field(default=DataMappingStrategy.DIRECT, description="The mapping strategy.")
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
class RecipeNode(BaseNode):
|
|
139
|
-
"""A node that executes another Recipe as a sub-graph.
|
|
140
|
-
|
|
141
|
-
Attributes:
|
|
142
|
-
type: The type of the node (must be 'recipe').
|
|
143
|
-
recipe_id: The ID of the recipe to execute.
|
|
144
|
-
input_mapping: How parent state maps to child inputs (parent_key -> child_key).
|
|
145
|
-
output_mapping: How child result maps back to parent state (child_key -> parent_key).
|
|
146
|
-
"""
|
|
147
|
-
|
|
148
|
-
type: Literal["recipe"] = Field("recipe", description="Discriminator for RecipeNode.")
|
|
149
|
-
recipe_id: str = Field(..., description="The ID of the recipe to execute.")
|
|
150
|
-
input_mapping: Dict[str, Union[str, DataMapping]] = Field(
|
|
151
|
-
..., description="Mapping of parent state keys to child input keys."
|
|
152
|
-
)
|
|
153
|
-
output_mapping: Dict[str, Union[str, DataMapping]] = Field(
|
|
154
|
-
..., description="Mapping of child output keys to parent state keys."
|
|
155
|
-
)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
class MapNode(BaseNode):
|
|
159
|
-
"""A node that spawns multiple parallel executions of a sub-branch.
|
|
160
|
-
|
|
161
|
-
Attributes:
|
|
162
|
-
type: The type of the node (must be 'map').
|
|
163
|
-
items_path: Dot-notation path to the list in the state.
|
|
164
|
-
processor_node_id: The node (or subgraph) to run for each item.
|
|
165
|
-
concurrency_limit: Max parallel executions.
|
|
166
|
-
"""
|
|
167
|
-
|
|
168
|
-
type: Literal["map"] = Field("map", description="Discriminator for MapNode.")
|
|
169
|
-
items_path: str = Field(..., description="Dot-notation path to the list in the state.")
|
|
170
|
-
processor_node_id: str = Field(..., description="The node (or subgraph) to run for each item.")
|
|
171
|
-
concurrency_limit: int = Field(..., description="Max parallel executions.")
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
# Discriminated Union for polymorphism
|
|
175
|
-
Node = Annotated[
|
|
176
|
-
Union[AgentNode, HumanNode, LogicNode, RecipeNode, MapNode],
|
|
177
|
-
Field(discriminator="type", description="Polymorphic node definition."),
|
|
178
|
-
]
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
class Edge(BaseModel):
|
|
182
|
-
"""Represents a connection between two nodes.
|
|
183
|
-
|
|
184
|
-
Attributes:
|
|
185
|
-
source_node_id: The ID of the source node.
|
|
186
|
-
target_node_id: The ID of the target node.
|
|
187
|
-
condition: Optional Python expression for conditional branching.
|
|
188
|
-
"""
|
|
189
|
-
|
|
190
|
-
model_config = ConfigDict(extra="forbid")
|
|
191
|
-
|
|
192
|
-
source_node_id: str = Field(..., description="The ID of the source node.")
|
|
193
|
-
target_node_id: str = Field(..., description="The ID of the target node.")
|
|
194
|
-
condition: Optional[str] = Field(None, description="Optional Python expression for conditional branching.")
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
RouterRef = Annotated[
|
|
198
|
-
str,
|
|
199
|
-
StringConstraints(
|
|
200
|
-
pattern=r"^[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)*$",
|
|
201
|
-
strip_whitespace=True,
|
|
202
|
-
),
|
|
203
|
-
]
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
class RouterExpression(BaseModel):
|
|
207
|
-
"""A structured expression for routing logic (e.g., CEL or JSONLogic)."""
|
|
208
|
-
|
|
209
|
-
model_config = ConfigDict(extra="forbid")
|
|
210
|
-
|
|
211
|
-
operator: str = Field(..., description="The operator (e.g., 'eq', 'gt').")
|
|
212
|
-
args: List[Any] = Field(..., description="Arguments for the expression.")
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
RouterDefinition = Annotated[
|
|
216
|
-
Union[RouterRef, RouterExpression],
|
|
217
|
-
Field(description="A reference to a python function or a logic expression."),
|
|
218
|
-
]
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
class ConditionalEdge(BaseModel):
|
|
222
|
-
"""Represents a dynamic routing connection from one node to multiple potential targets.
|
|
223
|
-
|
|
224
|
-
Attributes:
|
|
225
|
-
source_node_id: The ID of the source node.
|
|
226
|
-
router_logic: A reference to a python function or a logic expression that returns the next node ID.
|
|
227
|
-
mapping: A dictionary mapping the router's output (e.g., "approve", "reject") to target Node IDs.
|
|
228
|
-
"""
|
|
229
|
-
|
|
230
|
-
model_config = ConfigDict(extra="forbid")
|
|
231
|
-
|
|
232
|
-
source_node_id: str = Field(..., description="The ID of the source node.")
|
|
233
|
-
router_logic: RouterDefinition = Field(
|
|
234
|
-
..., description="A reference to a python function or logic expression that determines the path."
|
|
235
|
-
)
|
|
236
|
-
mapping: Dict[str, str] = Field(..., description="Map of router output values to target node IDs.")
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
class GraphTopology(BaseModel):
|
|
240
|
-
"""The topology definition of the recipe.
|
|
241
|
-
|
|
242
|
-
Attributes:
|
|
243
|
-
nodes: List of nodes in the graph.
|
|
244
|
-
edges: List of edges connecting the nodes.
|
|
245
|
-
state_schema: Optional schema definition for the graph state.
|
|
246
|
-
"""
|
|
247
|
-
|
|
248
|
-
model_config = ConfigDict(extra="forbid")
|
|
249
|
-
|
|
250
|
-
nodes: List[Node] = Field(..., description="List of nodes in the graph.")
|
|
251
|
-
edges: List[Union[Edge, ConditionalEdge]] = Field(..., description="List of edges connecting the nodes.")
|
|
252
|
-
state_schema: Optional[StateSchema] = Field(None, description="Schema definition for the graph state.")
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
Topology = GraphTopology
|
coreason_manifest/recipes.py
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2025 CoReason, Inc.
|
|
2
|
-
#
|
|
3
|
-
# This software is proprietary and dual-licensed.
|
|
4
|
-
# Licensed under the Prosperity Public License 3.0 (the "License").
|
|
5
|
-
# A copy of the license is available at https://prosperitylicense.com/versions/3.0.0
|
|
6
|
-
# For details, see the LICENSE file.
|
|
7
|
-
# Commercial use beyond a 30-day trial requires a separate license.
|
|
8
|
-
#
|
|
9
|
-
# Source Code: https://github.com/CoReason-AI/coreason_maco
|
|
10
|
-
|
|
11
|
-
from typing import Any, Dict, Literal, Optional
|
|
12
|
-
|
|
13
|
-
from pydantic import BaseModel, ConfigDict, Field
|
|
14
|
-
|
|
15
|
-
from .definitions.agent import VersionStr
|
|
16
|
-
from .definitions.topology import GraphTopology
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class RecipeInterface(BaseModel):
|
|
20
|
-
"""Defines the input/output contract for a Recipe.
|
|
21
|
-
|
|
22
|
-
Attributes:
|
|
23
|
-
inputs: JSON Schema defining valid entry arguments.
|
|
24
|
-
outputs: JSON Schema defining the guaranteed structure of the final result.
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
model_config = ConfigDict(extra="forbid")
|
|
28
|
-
|
|
29
|
-
inputs: Dict[str, Any] = Field(..., description="JSON Schema defining valid entry arguments.")
|
|
30
|
-
outputs: Dict[str, Any] = Field(
|
|
31
|
-
..., description="JSON Schema defining the guaranteed structure of the final result."
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class StateDefinition(BaseModel):
|
|
36
|
-
"""Defines the internal state (memory) of the Recipe.
|
|
37
|
-
|
|
38
|
-
Attributes:
|
|
39
|
-
schema: JSON Schema of the keys available in the shared memory.
|
|
40
|
-
persistence: Configuration for state durability.
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
model_config = ConfigDict(extra="forbid")
|
|
44
|
-
|
|
45
|
-
schema_: Dict[str, Any] = Field(
|
|
46
|
-
..., alias="schema", description="JSON Schema of the keys available in the shared memory."
|
|
47
|
-
)
|
|
48
|
-
persistence: Literal["ephemeral", "persistent"] = Field(
|
|
49
|
-
default="ephemeral", description="Configuration for state durability."
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class RecipeManifest(BaseModel):
|
|
54
|
-
"""The executable specification for the MACO engine.
|
|
55
|
-
|
|
56
|
-
Attributes:
|
|
57
|
-
id: Unique identifier for the recipe.
|
|
58
|
-
version: Version of the recipe.
|
|
59
|
-
name: Human-readable name of the recipe.
|
|
60
|
-
description: Detailed description of the recipe.
|
|
61
|
-
interface: Defines the input/output contract for the Recipe.
|
|
62
|
-
state: Defines the internal state (memory) of the Recipe.
|
|
63
|
-
parameters: Dictionary of build-time constants.
|
|
64
|
-
topology: The topology definition of the workflow.
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
model_config = ConfigDict(extra="forbid")
|
|
68
|
-
|
|
69
|
-
id: str = Field(..., description="Unique identifier for the recipe.")
|
|
70
|
-
version: VersionStr = Field(..., description="Version of the recipe.")
|
|
71
|
-
name: str = Field(..., description="Human-readable name of the recipe.")
|
|
72
|
-
description: Optional[str] = Field(None, description="Detailed description of the recipe.")
|
|
73
|
-
interface: RecipeInterface = Field(..., description="Defines the input/output contract for the Recipe.")
|
|
74
|
-
state: StateDefinition = Field(..., description="Defines the internal state (memory) of the Recipe.")
|
|
75
|
-
parameters: Dict[str, Any] = Field(..., description="Dictionary of build-time constants.")
|
|
76
|
-
topology: GraphTopology = Field(..., description="The topology definition of the workflow.")
|