openconstruct 0.1.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.
@@ -0,0 +1,15 @@
1
+ """OpenConstruct - Python thin client for SuperInstance ecosystem onboarding."""
2
+
3
+ from openconstruct.client import OpenConstructClient
4
+ from openconstruct.registry import ModuleRegistry
5
+ from openconstruct.types import AgentIdentity, ModuleInfo, OnboardingConfig
6
+
7
+ __version__ = "0.1.0"
8
+
9
+ __all__ = [
10
+ "OpenConstructClient",
11
+ "ModuleRegistry",
12
+ "AgentIdentity",
13
+ "ModuleInfo",
14
+ "OnboardingConfig",
15
+ ]
@@ -0,0 +1,165 @@
1
+ """Main OpenConstruct client for agent onboarding."""
2
+
3
+ import uuid
4
+ from datetime import datetime
5
+ from typing import Any, Dict, List, Optional
6
+
7
+ from openconstruct.registry import ModuleRegistry
8
+ from openconstruct.types import AgentIdentity, ModuleInfo, OnboardingConfig
9
+
10
+
11
+ class OpenConstructClient:
12
+ """Main client class for OpenConstruct onboarding."""
13
+
14
+ def __init__(self):
15
+ """Initialize the OpenConstruct client."""
16
+ self._session_id: Optional[str] = None
17
+ self._started = False
18
+ self._identity: Optional[AgentIdentity] = None
19
+ self._selected_modules: List[ModuleInfo] = []
20
+ self._selected_interfaces: List[str] = []
21
+ self._registry = ModuleRegistry()
22
+
23
+ def start(self) -> str:
24
+ """
25
+ Start a new onboarding session.
26
+
27
+ Returns:
28
+ Session ID for the new session
29
+ """
30
+ self._session_id = str(uuid.uuid4())
31
+ self._started = True
32
+ self._identity = None
33
+ self._selected_modules = []
34
+ self._selected_interfaces = []
35
+ return self._session_id
36
+
37
+ def declare_agent(self, identity: AgentIdentity) -> None:
38
+ """
39
+ Declare agent identity.
40
+
41
+ Args:
42
+ identity: AgentIdentity object with agent details
43
+
44
+ Raises:
45
+ RuntimeError: If session not started
46
+ """
47
+ if not self._started:
48
+ raise RuntimeError("Session not started. Call start() first.")
49
+ self._identity = identity
50
+
51
+ def list_modules(self, domain: Optional[str] = None) -> List[Dict[str, Any]]:
52
+ """
53
+ List available modules, optionally filtered by domain.
54
+
55
+ Args:
56
+ domain: Optional domain filter
57
+
58
+ Returns:
59
+ List of module dictionaries
60
+ """
61
+ modules = self._registry.list_modules(domain)
62
+ return [m.to_dict() for m in modules]
63
+
64
+ def select_modules(self, module_ids: List[str]) -> None:
65
+ """
66
+ Select modules for the agent.
67
+
68
+ Args:
69
+ module_ids: List of module IDs to select
70
+
71
+ Raises:
72
+ RuntimeError: If session not started
73
+ ValueError: If any module ID is invalid
74
+ """
75
+ if not self._started:
76
+ raise RuntimeError("Session not started. Call start() first.")
77
+
78
+ for module_id in module_ids:
79
+ if not self._registry.module_exists(module_id):
80
+ raise ValueError(f"Module '{module_id}' not found")
81
+
82
+ self._selected_modules = [
83
+ self._registry.get_module(mid) for mid in module_ids if self._registry.get_module(mid)
84
+ ]
85
+
86
+ def choose_interface(self, interfaces: List[str]) -> None:
87
+ """
88
+ Choose interface types for the agent.
89
+
90
+ Args:
91
+ interfaces: List of interface types (e.g., ["cli", "api"])
92
+
93
+ Raises:
94
+ RuntimeError: If session not started
95
+ """
96
+ if not self._started:
97
+ raise RuntimeError("Session not started. Call start() first.")
98
+ self._selected_interfaces = interfaces
99
+
100
+ def generate_config(self) -> Dict[str, Any]:
101
+ """
102
+ Generate the final onboarding configuration.
103
+
104
+ Returns:
105
+ Dictionary containing the complete onboarding configuration
106
+
107
+ Raises:
108
+ RuntimeError: If session not started or identity not declared
109
+ """
110
+ if not self._started:
111
+ raise RuntimeError("Session not started. Call start() first.")
112
+
113
+ if not self._identity:
114
+ raise RuntimeError("Agent identity not declared. Call declare_agent() first.")
115
+
116
+ config = OnboardingConfig(
117
+ session_id=self._session_id,
118
+ agent=self._identity.to_dict(),
119
+ selected_modules=[m.to_dict() for m in self._selected_modules],
120
+ selected_interfaces=self._selected_interfaces,
121
+ workspace=self._build_workspace_config(),
122
+ created_at=datetime.utcnow().isoformat() + "Z",
123
+ )
124
+
125
+ return config.to_dict()
126
+
127
+ def _build_workspace_config(self) -> Dict[str, Any]:
128
+ """
129
+ Build workspace configuration based on selections.
130
+
131
+ Returns:
132
+ Dictionary with workspace configuration
133
+ """
134
+ workspace_config = {
135
+ "agent_name": self._identity.name if self._identity else "",
136
+ "modules": [m.id for m in self._selected_modules],
137
+ "interfaces": self._selected_interfaces,
138
+ "environment_variables": {
139
+ "OPENCONSTRUCT_SESSION_ID": self._session_id or "",
140
+ },
141
+ }
142
+
143
+ # Add module-specific configurations
144
+ for module in self._selected_modules:
145
+ workspace_config[f"module_{module.id}_config"] = {
146
+ "version": module.version,
147
+ "enabled": True,
148
+ }
149
+
150
+ return workspace_config
151
+
152
+ @property
153
+ def session_id(self) -> Optional[str]:
154
+ """Get the current session ID."""
155
+ return self._session_id
156
+
157
+ @property
158
+ def is_started(self) -> bool:
159
+ """Check if a session is started."""
160
+ return self._started
161
+
162
+ @property
163
+ def identity(self) -> Optional[AgentIdentity]:
164
+ """Get the declared agent identity."""
165
+ return self._identity
@@ -0,0 +1,112 @@
1
+ """Module registry for browsing available modules."""
2
+
3
+ import uuid
4
+ from typing import List, Optional
5
+
6
+ from openconstruct.types import ModuleInfo
7
+
8
+
9
+ class ModuleRegistry:
10
+ """Registry of available OpenConstruct modules."""
11
+
12
+ def __init__(self):
13
+ """Initialize the module registry with sample modules."""
14
+ self._modules = self._initialize_modules()
15
+
16
+ def _initialize_modules(self) -> dict:
17
+ """Initialize with sample modules."""
18
+ return {
19
+ "spectral-graph-core": ModuleInfo(
20
+ id="spectral-graph-core",
21
+ name="Spectral Graph Core",
22
+ domain="math",
23
+ description="Core spectral graph theory operations and algorithms",
24
+ version="1.0.0",
25
+ dependencies=[],
26
+ requires_agent_capabilities=["computation"],
27
+ ),
28
+ "plato-room": ModuleInfo(
29
+ id="plato-room",
30
+ name="Plato Room",
31
+ domain="collaboration",
32
+ description="Virtual collaboration space for agent discussions",
33
+ version="0.9.0",
34
+ dependencies=["spectral-graph-core"],
35
+ requires_agent_capabilities=["communication"],
36
+ ),
37
+ "tensor-flow": ModuleInfo(
38
+ id="tensor-flow",
39
+ name="Tensor Flow Operations",
40
+ domain="math",
41
+ description="Advanced tensor manipulation and operations",
42
+ version="2.1.0",
43
+ dependencies=[],
44
+ requires_agent_capabilities=["computation"],
45
+ ),
46
+ "memory-bank": ModuleInfo(
47
+ id="memory-bank",
48
+ name="Memory Bank",
49
+ domain="storage",
50
+ description="Persistent memory storage for agents",
51
+ version="1.2.0",
52
+ dependencies=[],
53
+ requires_agent_capabilities=["persistence"],
54
+ ),
55
+ "code-analyzer": ModuleInfo(
56
+ id="code-analyzer",
57
+ name="Code Analyzer",
58
+ domain="analysis",
59
+ description="Static code analysis and quality checks",
60
+ version="0.8.0",
61
+ dependencies=[],
62
+ requires_agent_capabilities=["code_generation"],
63
+ ),
64
+ "web-crawler": ModuleInfo(
65
+ id="web-crawler",
66
+ name="Web Crawler",
67
+ domain="web",
68
+ description="Efficient web crawling and data extraction",
69
+ version="1.5.0",
70
+ dependencies=[],
71
+ requires_agent_capabilities=["web_search"],
72
+ ),
73
+ }
74
+
75
+ def list_modules(self, domain: Optional[str] = None) -> List[ModuleInfo]:
76
+ """
77
+ List all available modules, optionally filtered by domain.
78
+
79
+ Args:
80
+ domain: Optional domain filter (e.g., "math", "collaboration")
81
+
82
+ Returns:
83
+ List of ModuleInfo objects
84
+ """
85
+ modules = list(self._modules.values())
86
+ if domain:
87
+ modules = [m for m in modules if m.domain == domain]
88
+ return modules
89
+
90
+ def get_module(self, module_id: str) -> Optional[ModuleInfo]:
91
+ """
92
+ Get a specific module by ID.
93
+
94
+ Args:
95
+ module_id: The module identifier
96
+
97
+ Returns:
98
+ ModuleInfo if found, None otherwise
99
+ """
100
+ return self._modules.get(module_id)
101
+
102
+ def module_exists(self, module_id: str) -> bool:
103
+ """
104
+ Check if a module exists.
105
+
106
+ Args:
107
+ module_id: The module identifier
108
+
109
+ Returns:
110
+ True if module exists, False otherwise
111
+ """
112
+ return module_id in self._modules
openconstruct/types.py ADDED
@@ -0,0 +1,75 @@
1
+ """Data types for OpenConstruct."""
2
+
3
+ from dataclasses import dataclass, field
4
+ from typing import Any, Dict, List, Optional
5
+
6
+
7
+ @dataclass
8
+ class AgentIdentity:
9
+ """Agent self-declaration for onboarding."""
10
+
11
+ name: str
12
+ model: str
13
+ capabilities: List[str] = field(default_factory=list)
14
+ tools: List[str] = field(default_factory=list)
15
+ description: Optional[str] = None
16
+ version: Optional[str] = None
17
+
18
+ def to_dict(self) -> Dict[str, Any]:
19
+ """Convert identity to dictionary."""
20
+ return {
21
+ "name": self.name,
22
+ "model": self.model,
23
+ "capabilities": self.capabilities,
24
+ "tools": self.tools,
25
+ "description": self.description,
26
+ "version": self.version,
27
+ }
28
+
29
+
30
+ @dataclass
31
+ class ModuleInfo:
32
+ """Information about an available module."""
33
+
34
+ id: str
35
+ name: str
36
+ domain: str
37
+ description: str
38
+ version: str
39
+ dependencies: List[str] = field(default_factory=list)
40
+ requires_agent_capabilities: List[str] = field(default_factory=list)
41
+
42
+ def to_dict(self) -> Dict[str, Any]:
43
+ """Convert module info to dictionary."""
44
+ return {
45
+ "id": self.id,
46
+ "name": self.name,
47
+ "domain": self.domain,
48
+ "description": self.description,
49
+ "version": self.version,
50
+ "dependencies": self.dependencies,
51
+ "requires_agent_capabilities": self.requires_agent_capabilities,
52
+ }
53
+
54
+
55
+ @dataclass
56
+ class OnboardingConfig:
57
+ """Final onboarding configuration output."""
58
+
59
+ session_id: str
60
+ agent: Dict[str, Any]
61
+ selected_modules: List[Dict[str, Any]]
62
+ selected_interfaces: List[str]
63
+ workspace: Dict[str, Any] = field(default_factory=dict)
64
+ created_at: str = ""
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Convert config to dictionary."""
68
+ return {
69
+ "session_id": self.session_id,
70
+ "agent": self.agent,
71
+ "selected_modules": self.selected_modules,
72
+ "selected_interfaces": self.selected_interfaces,
73
+ "workspace": self.workspace,
74
+ "created_at": self.created_at,
75
+ }
@@ -0,0 +1,81 @@
1
+ Metadata-Version: 2.4
2
+ Name: openconstruct
3
+ Version: 0.1.0
4
+ Summary: Python thin client for OpenConstruct - SuperInstance ecosystem onboarding
5
+ Author-email: SuperInstance <contact@superinstance.dev>
6
+ Project-URL: Homepage, https://github.com/SuperInstance/openconstruct-python
7
+ Project-URL: Repository, https://github.com/SuperInstance/openconstruct-python
8
+ Project-URL: Issues, https://github.com/SuperInstance/openconstruct-python/issues
9
+ Keywords: openconstruct,agent,onboarding,superinstance
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0; extra == "dev"
24
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # OpenConstruct Python — Thin Client for Agent Onboarding
28
+
29
+ Python client for [OpenConstruct](https://github.com/SuperInstance/OpenConstruct). Onboard agents into the SuperInstance ecosystem in under 10 lines.
30
+
31
+ ## What This Gives You
32
+
33
+ - **5-phase onboarding** — `start()` → `declare_agent()` → `select_modules()` → `choose_interface()` → `generate_config()`
34
+ - **Module registry** — domain-filtered catalog of available modules
35
+ - **Pip-installable** — `pip install openconstruct`
36
+ - **Zero runtime dependencies** — pure Python, no native extensions
37
+
38
+ ## Quick Start
39
+
40
+ ```python
41
+ from openconstruct import OpenConstructClient, AgentIdentity
42
+
43
+ client = OpenConstructClient()
44
+ client.start()
45
+
46
+ identity = AgentIdentity(
47
+ name="my-agent",
48
+ model="claude-4",
49
+ capabilities=["code_generation", "web_search", "file_ops"],
50
+ tools=["exec", "read", "write"]
51
+ )
52
+ client.declare_agent(identity)
53
+
54
+ modules = client.list_modules(domain="math")
55
+ client.select_modules(["spectral-graph-core", "plato-room"])
56
+ client.choose_interface(["cli", "api"])
57
+
58
+ config = client.generate_config()
59
+ print(config)
60
+ ```
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ pip install openconstruct
66
+ ```
67
+
68
+ ## Testing
69
+
70
+ ```bash
71
+ pip install -e ".[dev]"
72
+ pytest
73
+ ```
74
+
75
+ ## How It Fits
76
+
77
+ One of the [polyglot OpenConstruct bindings](https://github.com/SuperInstance/OpenConstruct). Used by [openconstruct-jupyter](https://github.com/SuperInstance/openconstruct-jupyter) for notebook integration. See [openconstruct-examples](https://github.com/SuperInstance/openconstruct-examples) for a Python onboarding walkthrough.
78
+
79
+ ## License
80
+
81
+ MIT
@@ -0,0 +1,9 @@
1
+ openconstruct/__init__.py,sha256=K5y0cRjgluATFRM6rczOquUPl9he9_5Hny3mWU2_2QY,410
2
+ openconstruct/client.py,sha256=e-I4AQ9qfGyA85kGPkwhJ3ufEYFDP82MYgagwoosiCc,5211
3
+ openconstruct/registry.py,sha256=kJXmpCDwWur4-u6EFKHXEt5LX7q-hm-JULVRIIx7jYM,3758
4
+ openconstruct/types.py,sha256=uco2nrMglG6izSC4w0Uk34cu-40Ox-rbzl7Wr_r-cXk,2151
5
+ openconstruct-0.1.0.dist-info/licenses/LICENSE,sha256=mDMbUdFbAd32o_PXQ90a29eTn-6OHaRJM8TG5iMW5cA,1069
6
+ openconstruct-0.1.0.dist-info/METADATA,sha256=sWRyDuzpi3LsCZwFVFDH8SFHynV3JmCOt-J4Xd66eG0,2726
7
+ openconstruct-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
8
+ openconstruct-0.1.0.dist-info/top_level.txt,sha256=gacT2S17Czus64PnwhVofNQzxivfVs-Gt3PabCPCDOM,14
9
+ openconstruct-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SuperInstance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ openconstruct