aikernel-governance 0.1.2__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.
Files changed (34) hide show
  1. aikernel_governance-0.1.2/PKG-INFO +129 -0
  2. aikernel_governance-0.1.2/README.md +107 -0
  3. aikernel_governance-0.1.2/pyproject.toml +62 -0
  4. aikernel_governance-0.1.2/setup.cfg +4 -0
  5. aikernel_governance-0.1.2/src/aikernel_governance/__init__.py +76 -0
  6. aikernel_governance-0.1.2/src/aikernel_governance/api_catalog.py +898 -0
  7. aikernel_governance-0.1.2/src/aikernel_governance/governance/__init__.py +50 -0
  8. aikernel_governance-0.1.2/src/aikernel_governance/governance/bonsai.py +368 -0
  9. aikernel_governance-0.1.2/src/aikernel_governance/governance/client.py +71 -0
  10. aikernel_governance-0.1.2/src/aikernel_governance/governance/cpu.py +57 -0
  11. aikernel_governance-0.1.2/src/aikernel_governance/governance/diagnostics.py +44 -0
  12. aikernel_governance-0.1.2/src/aikernel_governance/governance/emulator.py +159 -0
  13. aikernel_governance-0.1.2/src/aikernel_governance/governance/gpu.py +31 -0
  14. aikernel_governance-0.1.2/src/aikernel_governance/governance/managed.py +68 -0
  15. aikernel_governance-0.1.2/src/aikernel_governance/governance/provider.py +20 -0
  16. aikernel_governance-0.1.2/src/aikernel_governance/governance/request.py +65 -0
  17. aikernel_governance-0.1.2/src/aikernel_governance/governance/result.py +61 -0
  18. aikernel_governance-0.1.2/src/aikernel_governance/governance/snapshot.py +73 -0
  19. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Abstractions.dll +0 -0
  20. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Control.CPU.dll +0 -0
  21. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Control.Core.deps.json +79 -0
  22. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Control.Core.dll +0 -0
  23. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Control.Diagnostics.dll +0 -0
  24. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Control.Emulator.dll +0 -0
  25. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Control.GPU.dll +0 -0
  26. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Dtos.dll +0 -0
  27. aikernel_governance-0.1.2/src/aikernel_governance/native/AIKernel.Enums.dll +0 -0
  28. aikernel_governance-0.1.2/src/aikernel_governance/native/__init__.py +170 -0
  29. aikernel_governance-0.1.2/src/aikernel_governance.egg-info/PKG-INFO +129 -0
  30. aikernel_governance-0.1.2/src/aikernel_governance.egg-info/SOURCES.txt +32 -0
  31. aikernel_governance-0.1.2/src/aikernel_governance.egg-info/dependency_links.txt +1 -0
  32. aikernel_governance-0.1.2/src/aikernel_governance.egg-info/requires.txt +4 -0
  33. aikernel_governance-0.1.2/src/aikernel_governance.egg-info/top_level.txt +1 -0
  34. aikernel_governance-0.1.2/tests/test_governance_contract.py +146 -0
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: aikernel-governance
3
+ Version: 0.1.2
4
+ Summary: Python wrapper for AIKernel.Control v0.1.2 governance contracts with bundled managed assemblies and pythonnet loading.
5
+ Author: Takuya Sogawa
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/AIKernel-NET/AIKernel.Control
8
+ Project-URL: Repository, https://github.com/AIKernel-NET/AIKernel.Control
9
+ Project-URL: Issues, https://github.com/AIKernel-NET/AIKernel.Control/issues
10
+ Project-URL: Releases, https://github.com/AIKernel-NET/AIKernel.Control/releases
11
+ Keywords: aikernel,governance,control-plane,semantic-runtime,bonsai,managed-assemblies,pythonnet
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Software Development :: Libraries
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: pythonnet>=3.0.3
20
+ Provides-Extra: test
21
+ Requires-Dist: pytest>=9.0; extra == "test"
22
+
23
+ # aikernel-governance
24
+
25
+ [日本語](README-ja.md)
26
+
27
+ Python wrapper surface for AIKernel.Control.
28
+
29
+ Starting with the 0.1.2 canon line, `aikernel-governance` is the PyPI package
30
+ for the public AIKernel.Control governance boundary. The package remains a thin
31
+ wrapper over managed C# assemblies and does not re-implement CTG Gate logic in
32
+ Python.
33
+
34
+ ## Scope
35
+
36
+ `aikernel-governance` exposes the public AIKernel.Control contract boundary as a
37
+ single Python API:
38
+
39
+ - execution request, result, and snapshot envelopes
40
+ - provider contract metadata
41
+ - Bonsai provider, tokenizer, model config, and model-state wrappers
42
+ - emulator graph, node, scheduler, policy, and engine wrappers
43
+ - CPU kernel wrapper
44
+ - diagnostics replay approval wrapper
45
+ - GPU delegate contract loader
46
+ - managed assembly discovery and pythonnet loading
47
+
48
+ The reference package does not provide a separate Python implementation of
49
+ governance semantics. It does not expose internal engine helpers,
50
+ transport-specific logic, OS-specific implementations, or private runtime
51
+ state.
52
+
53
+ ## Managed Assemblies
54
+
55
+ Python packaging resolves the public Control and contract assemblies under
56
+ `aikernel_governance/native`:
57
+
58
+ - `AIKernel.Abstractions.dll`
59
+ - `AIKernel.Dtos.dll`
60
+ - `AIKernel.Enums.dll`
61
+ - `AIKernel.Control.Core.dll`
62
+ - `AIKernel.Control.CPU.dll`
63
+ - `AIKernel.Control.Diagnostics.dll`
64
+ - `AIKernel.Control.Emulator.dll`
65
+ - `AIKernel.Control.GPU.dll`
66
+
67
+ `governance_assemblies()` resolves bundled assemblies first, then paths from
68
+ `AIKERNEL_GOVERNANCE_ASSEMBLY_PATH`, then matching packages from the NuGet
69
+ global-packages cache.
70
+
71
+ `load_governance_runtime()` loads the resolved assemblies through pythonnet.
72
+
73
+ ## Managed API Catalog
74
+
75
+ The v0.1.2 package exposes the generated managed API catalog through
76
+ `managed_api_catalog()`, `managed_api_summary()`, `managed_type_names()`, and
77
+ `find_managed_type(full_name)`.
78
+
79
+ ## API
80
+
81
+ ```python
82
+ from aikernel_governance import (
83
+ ExecutionRequest,
84
+ ExecutionResult,
85
+ Snapshot,
86
+ ProviderContract,
87
+ GovernanceClient,
88
+ )
89
+ ```
90
+
91
+ Example:
92
+
93
+ ```python
94
+ from aikernel_governance import ExecutionRequest, GovernanceClient
95
+
96
+ request = ExecutionRequest(
97
+ model="bonsai-1.7b",
98
+ input="hello",
99
+ parameters={"execution_id": "exec-001"},
100
+ )
101
+
102
+ client = GovernanceClient(backend)
103
+ result = client.submit(request)
104
+ snapshot = client.snapshot("exec-001")
105
+ ```
106
+
107
+ `backend` must provide the governance operations used by the client:
108
+
109
+ - `submit(request)`
110
+ - `snapshot(id)`
111
+ - `result(id)`
112
+
113
+ When pythonnet is available, wrappers can be converted to public C# DTOs with
114
+ `to_managed()`.
115
+
116
+ ## Build and Validate
117
+
118
+ For local validation:
119
+
120
+ ```powershell
121
+ cd C:\Users\HP\source\repos\AIKernel-NET\AIKernel.Control
122
+ py -m pytest python\tests
123
+ ```
124
+
125
+ ## Distribution
126
+
127
+ PyPI publishing is handled by the repository GitHub Actions workflow on release
128
+ tags using Trusted Publishing. Keep Python experiments thin over the managed
129
+ assemblies and do not add CTG Gate rules to Python code.
@@ -0,0 +1,107 @@
1
+ # aikernel-governance
2
+
3
+ [日本語](README-ja.md)
4
+
5
+ Python wrapper surface for AIKernel.Control.
6
+
7
+ Starting with the 0.1.2 canon line, `aikernel-governance` is the PyPI package
8
+ for the public AIKernel.Control governance boundary. The package remains a thin
9
+ wrapper over managed C# assemblies and does not re-implement CTG Gate logic in
10
+ Python.
11
+
12
+ ## Scope
13
+
14
+ `aikernel-governance` exposes the public AIKernel.Control contract boundary as a
15
+ single Python API:
16
+
17
+ - execution request, result, and snapshot envelopes
18
+ - provider contract metadata
19
+ - Bonsai provider, tokenizer, model config, and model-state wrappers
20
+ - emulator graph, node, scheduler, policy, and engine wrappers
21
+ - CPU kernel wrapper
22
+ - diagnostics replay approval wrapper
23
+ - GPU delegate contract loader
24
+ - managed assembly discovery and pythonnet loading
25
+
26
+ The reference package does not provide a separate Python implementation of
27
+ governance semantics. It does not expose internal engine helpers,
28
+ transport-specific logic, OS-specific implementations, or private runtime
29
+ state.
30
+
31
+ ## Managed Assemblies
32
+
33
+ Python packaging resolves the public Control and contract assemblies under
34
+ `aikernel_governance/native`:
35
+
36
+ - `AIKernel.Abstractions.dll`
37
+ - `AIKernel.Dtos.dll`
38
+ - `AIKernel.Enums.dll`
39
+ - `AIKernel.Control.Core.dll`
40
+ - `AIKernel.Control.CPU.dll`
41
+ - `AIKernel.Control.Diagnostics.dll`
42
+ - `AIKernel.Control.Emulator.dll`
43
+ - `AIKernel.Control.GPU.dll`
44
+
45
+ `governance_assemblies()` resolves bundled assemblies first, then paths from
46
+ `AIKERNEL_GOVERNANCE_ASSEMBLY_PATH`, then matching packages from the NuGet
47
+ global-packages cache.
48
+
49
+ `load_governance_runtime()` loads the resolved assemblies through pythonnet.
50
+
51
+ ## Managed API Catalog
52
+
53
+ The v0.1.2 package exposes the generated managed API catalog through
54
+ `managed_api_catalog()`, `managed_api_summary()`, `managed_type_names()`, and
55
+ `find_managed_type(full_name)`.
56
+
57
+ ## API
58
+
59
+ ```python
60
+ from aikernel_governance import (
61
+ ExecutionRequest,
62
+ ExecutionResult,
63
+ Snapshot,
64
+ ProviderContract,
65
+ GovernanceClient,
66
+ )
67
+ ```
68
+
69
+ Example:
70
+
71
+ ```python
72
+ from aikernel_governance import ExecutionRequest, GovernanceClient
73
+
74
+ request = ExecutionRequest(
75
+ model="bonsai-1.7b",
76
+ input="hello",
77
+ parameters={"execution_id": "exec-001"},
78
+ )
79
+
80
+ client = GovernanceClient(backend)
81
+ result = client.submit(request)
82
+ snapshot = client.snapshot("exec-001")
83
+ ```
84
+
85
+ `backend` must provide the governance operations used by the client:
86
+
87
+ - `submit(request)`
88
+ - `snapshot(id)`
89
+ - `result(id)`
90
+
91
+ When pythonnet is available, wrappers can be converted to public C# DTOs with
92
+ `to_managed()`.
93
+
94
+ ## Build and Validate
95
+
96
+ For local validation:
97
+
98
+ ```powershell
99
+ cd C:\Users\HP\source\repos\AIKernel-NET\AIKernel.Control
100
+ py -m pytest python\tests
101
+ ```
102
+
103
+ ## Distribution
104
+
105
+ PyPI publishing is handled by the repository GitHub Actions workflow on release
106
+ tags using Trusted Publishing. Keep Python experiments thin over the managed
107
+ assemblies and do not add CTG Gate rules to Python code.
@@ -0,0 +1,62 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "aikernel-governance"
7
+ version = "0.1.2"
8
+ description = "Python wrapper for AIKernel.Control v0.1.2 governance contracts with bundled managed assemblies and pythonnet loading."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ authors = [
13
+ { name = "Takuya Sogawa" }
14
+ ]
15
+ keywords = [
16
+ "aikernel",
17
+ "governance",
18
+ "control-plane",
19
+ "semantic-runtime",
20
+ "bonsai",
21
+ "managed-assemblies",
22
+ "pythonnet"
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 3 - Alpha",
26
+ "Intended Audience :: Developers",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3 :: Only",
29
+ "Topic :: Software Development :: Libraries"
30
+ ]
31
+ dependencies = [
32
+ "pythonnet>=3.0.3"
33
+ ]
34
+
35
+ [project.optional-dependencies]
36
+ test = [
37
+ "pytest>=9.0"
38
+ ]
39
+
40
+ [project.urls]
41
+ Homepage = "https://github.com/AIKernel-NET/AIKernel.Control"
42
+ Repository = "https://github.com/AIKernel-NET/AIKernel.Control"
43
+ Issues = "https://github.com/AIKernel-NET/AIKernel.Control/issues"
44
+ Releases = "https://github.com/AIKernel-NET/AIKernel.Control/releases"
45
+
46
+ [tool.setuptools]
47
+ package-dir = { "" = "src" }
48
+
49
+ [tool.setuptools.packages.find]
50
+ where = ["src"]
51
+
52
+ [tool.setuptools.package-data]
53
+ aikernel_governance = [
54
+ "native/*.dll",
55
+ "native/*.so",
56
+ "native/*.dylib",
57
+ "native/*.deps.json"
58
+ ]
59
+
60
+ [tool.pytest.ini_options]
61
+ pythonpath = ["src"]
62
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,76 @@
1
+ """[EN]
2
+ Unified Python API for the AIKernel.Control governance contract surface.
3
+
4
+ [JA]
5
+ AIKernel.Control の governance 契約境界を統合して公開する Python API です。
6
+ """
7
+
8
+ from .api_catalog import (
9
+ ManagedMemberDescriptor,
10
+ ManagedTypeDescriptor,
11
+ find_managed_type,
12
+ managed_api_catalog,
13
+ managed_api_summary,
14
+ managed_type_names,
15
+ )
16
+ from .governance import (
17
+ AllowAllControlPolicy,
18
+ Bonsai1BitCpuKernel,
19
+ BonsaiBuiltInProvider,
20
+ BonsaiModelConfig,
21
+ BonsaiModelState,
22
+ BonsaiProviderCapabilities,
23
+ BonsaiTokenizer,
24
+ ControlEmulatorEngine,
25
+ DeterministicNodeScheduler,
26
+ EmulatedExecutionGraph,
27
+ EmulatedExecutionNode,
28
+ ExecutionRequest,
29
+ ExecutionResult,
30
+ GovernanceClient,
31
+ ProviderContract,
32
+ ReplayApprovalRecord,
33
+ Snapshot,
34
+ SnapshotMetadata,
35
+ bonsai_gpu_execution_delegate_contract,
36
+ )
37
+ from .native import (
38
+ GovernanceAssemblySet,
39
+ governance_assemblies,
40
+ load_governance_runtime,
41
+ require_governance_assemblies,
42
+ )
43
+
44
+ __all__ = [
45
+ "ManagedMemberDescriptor",
46
+ "ManagedTypeDescriptor",
47
+ "find_managed_type",
48
+ "managed_api_catalog",
49
+ "managed_api_summary",
50
+ "managed_type_names",
51
+ "AllowAllControlPolicy",
52
+ "Bonsai1BitCpuKernel",
53
+ "BonsaiBuiltInProvider",
54
+ "BonsaiModelConfig",
55
+ "BonsaiModelState",
56
+ "BonsaiProviderCapabilities",
57
+ "BonsaiTokenizer",
58
+ "ControlEmulatorEngine",
59
+ "DeterministicNodeScheduler",
60
+ "EmulatedExecutionGraph",
61
+ "EmulatedExecutionNode",
62
+ "ExecutionRequest",
63
+ "ExecutionResult",
64
+ "GovernanceAssemblySet",
65
+ "GovernanceClient",
66
+ "ProviderContract",
67
+ "ReplayApprovalRecord",
68
+ "Snapshot",
69
+ "SnapshotMetadata",
70
+ "bonsai_gpu_execution_delegate_contract",
71
+ "governance_assemblies",
72
+ "load_governance_runtime",
73
+ "require_governance_assemblies",
74
+ ]
75
+
76
+ __version__ = "0.1.2"