@trac3er/oh-my-god 2.0.4 → 2.0.5

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 (206) hide show
  1. package/.agents/skills/omg/AGENTS.fragment.md +1 -1
  2. package/.agents/skills/omg/algorithms/SKILL.md +11 -0
  3. package/.agents/skills/omg/algorithms/openai.yaml +11 -0
  4. package/.agents/skills/omg/api-twin/SKILL.md +11 -0
  5. package/.agents/skills/omg/api-twin/openai.yaml +12 -0
  6. package/.agents/skills/omg/control-plane/SKILL.md +1 -1
  7. package/.agents/skills/omg/control-plane/openai.yaml +1 -1
  8. package/.agents/skills/omg/data-lineage/SKILL.md +11 -0
  9. package/.agents/skills/omg/data-lineage/openai.yaml +12 -0
  10. package/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
  11. package/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
  12. package/.agents/skills/omg/eval-gate/SKILL.md +11 -0
  13. package/.agents/skills/omg/eval-gate/openai.yaml +12 -0
  14. package/.agents/skills/omg/health/SKILL.md +11 -0
  15. package/.agents/skills/omg/health/openai.yaml +11 -0
  16. package/.agents/skills/omg/hook-governor/SKILL.md +1 -1
  17. package/.agents/skills/omg/hook-governor/openai.yaml +1 -1
  18. package/.agents/skills/omg/incident-replay/SKILL.md +11 -0
  19. package/.agents/skills/omg/incident-replay/openai.yaml +12 -0
  20. package/.agents/skills/omg/lsp-pack/SKILL.md +1 -1
  21. package/.agents/skills/omg/lsp-pack/openai.yaml +1 -1
  22. package/.agents/skills/omg/mcp-fabric/SKILL.md +1 -1
  23. package/.agents/skills/omg/mcp-fabric/openai.yaml +1 -1
  24. package/.agents/skills/omg/preflight/SKILL.md +11 -0
  25. package/.agents/skills/omg/preflight/openai.yaml +12 -0
  26. package/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
  27. package/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
  28. package/.agents/skills/omg/robotics/SKILL.md +11 -0
  29. package/.agents/skills/omg/robotics/openai.yaml +11 -0
  30. package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +1 -1
  31. package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +1 -1
  32. package/.agents/skills/omg/security-check/SKILL.md +11 -0
  33. package/.agents/skills/omg/security-check/openai.yaml +13 -0
  34. package/.agents/skills/omg/tracebank/SKILL.md +11 -0
  35. package/.agents/skills/omg/tracebank/openai.yaml +12 -0
  36. package/.agents/skills/omg/vision/SKILL.md +11 -0
  37. package/.agents/skills/omg/vision/openai.yaml +11 -0
  38. package/.claude-plugin/marketplace.json +3 -3
  39. package/.claude-plugin/plugin.json +1 -1
  40. package/.claude-plugin/scripts/uninstall.sh +2 -2
  41. package/OMG-setup.sh +1 -1
  42. package/OMG_COMPAT_CONTRACT.md +1 -1
  43. package/README.md +2 -2
  44. package/commands/__init__.py +1 -0
  45. package/control_plane/__init__.py +2 -0
  46. package/control_plane/openapi.yaml +228 -0
  47. package/control_plane/server.py +123 -0
  48. package/control_plane/service.py +185 -0
  49. package/dist/enterprise/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
  50. package/dist/enterprise/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
  51. package/dist/enterprise/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
  52. package/dist/enterprise/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
  53. package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
  54. package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
  55. package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
  56. package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
  57. package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
  58. package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
  59. package/dist/enterprise/bundle/.agents/skills/omg/health/SKILL.md +11 -0
  60. package/dist/enterprise/bundle/.agents/skills/omg/health/openai.yaml +11 -0
  61. package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
  62. package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
  63. package/dist/enterprise/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
  64. package/dist/enterprise/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
  65. package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
  66. package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
  67. package/dist/enterprise/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
  68. package/dist/enterprise/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
  69. package/dist/enterprise/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
  70. package/dist/enterprise/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
  71. package/dist/enterprise/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
  72. package/dist/enterprise/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
  73. package/dist/enterprise/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
  74. package/dist/enterprise/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
  75. package/dist/enterprise/bundle/.claude-plugin/marketplace.json +3 -3
  76. package/dist/enterprise/bundle/.claude-plugin/plugin.json +1 -1
  77. package/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +1 -1
  78. package/dist/enterprise/bundle/registry/bundles/algorithms.yaml +45 -0
  79. package/dist/enterprise/bundle/registry/bundles/api-twin.yaml +48 -0
  80. package/dist/enterprise/bundle/registry/bundles/control-plane.yaml +61 -0
  81. package/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +47 -0
  82. package/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +47 -0
  83. package/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +47 -0
  84. package/dist/enterprise/bundle/registry/bundles/health.yaml +45 -0
  85. package/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +97 -0
  86. package/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +47 -0
  87. package/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +48 -0
  88. package/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +53 -0
  89. package/dist/enterprise/bundle/registry/bundles/preflight.yaml +48 -0
  90. package/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +49 -0
  91. package/dist/enterprise/bundle/registry/bundles/robotics.yaml +45 -0
  92. package/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
  93. package/dist/enterprise/bundle/registry/bundles/security-check.yaml +50 -0
  94. package/dist/enterprise/bundle/registry/bundles/tracebank.yaml +47 -0
  95. package/dist/enterprise/bundle/registry/bundles/vision.yaml +45 -0
  96. package/dist/enterprise/bundle/registry/omg-capability.schema.json +80 -0
  97. package/dist/enterprise/bundle/settings.json +21 -6
  98. package/dist/enterprise/manifest.json +167 -11
  99. package/dist/public/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
  100. package/dist/public/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
  101. package/dist/public/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
  102. package/dist/public/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
  103. package/dist/public/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
  104. package/dist/public/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
  105. package/dist/public/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
  106. package/dist/public/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
  107. package/dist/public/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
  108. package/dist/public/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
  109. package/dist/public/bundle/.agents/skills/omg/health/SKILL.md +11 -0
  110. package/dist/public/bundle/.agents/skills/omg/health/openai.yaml +11 -0
  111. package/dist/public/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
  112. package/dist/public/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
  113. package/dist/public/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
  114. package/dist/public/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
  115. package/dist/public/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
  116. package/dist/public/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
  117. package/dist/public/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
  118. package/dist/public/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
  119. package/dist/public/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
  120. package/dist/public/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
  121. package/dist/public/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
  122. package/dist/public/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
  123. package/dist/public/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
  124. package/dist/public/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
  125. package/dist/public/bundle/.claude-plugin/marketplace.json +3 -3
  126. package/dist/public/bundle/.claude-plugin/plugin.json +1 -1
  127. package/dist/public/bundle/OMG_COMPAT_CONTRACT.md +1 -1
  128. package/dist/public/bundle/registry/bundles/algorithms.yaml +45 -0
  129. package/dist/public/bundle/registry/bundles/api-twin.yaml +48 -0
  130. package/dist/public/bundle/registry/bundles/control-plane.yaml +61 -0
  131. package/dist/public/bundle/registry/bundles/data-lineage.yaml +47 -0
  132. package/dist/public/bundle/registry/bundles/delta-classifier.yaml +47 -0
  133. package/dist/public/bundle/registry/bundles/eval-gate.yaml +47 -0
  134. package/dist/public/bundle/registry/bundles/health.yaml +45 -0
  135. package/dist/public/bundle/registry/bundles/hook-governor.yaml +97 -0
  136. package/dist/public/bundle/registry/bundles/incident-replay.yaml +47 -0
  137. package/dist/public/bundle/registry/bundles/lsp-pack.yaml +48 -0
  138. package/dist/public/bundle/registry/bundles/mcp-fabric.yaml +53 -0
  139. package/dist/public/bundle/registry/bundles/preflight.yaml +48 -0
  140. package/dist/public/bundle/registry/bundles/remote-supervisor.yaml +49 -0
  141. package/dist/public/bundle/registry/bundles/robotics.yaml +45 -0
  142. package/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
  143. package/dist/public/bundle/registry/bundles/security-check.yaml +50 -0
  144. package/dist/public/bundle/registry/bundles/tracebank.yaml +47 -0
  145. package/dist/public/bundle/registry/bundles/vision.yaml +45 -0
  146. package/dist/public/bundle/registry/omg-capability.schema.json +80 -0
  147. package/dist/public/bundle/settings.json +17 -4
  148. package/dist/public/manifest.json +167 -11
  149. package/docs/assets/omg-hud.svg +32 -0
  150. package/docs/install/claude-code.md +31 -0
  151. package/docs/install/codex.md +29 -0
  152. package/docs/migration/native-adoption.md +57 -0
  153. package/docs/proof.md +55 -0
  154. package/docs/release-checklist.md +38 -0
  155. package/docs/transcripts/crazy.md +17 -0
  156. package/docs/transcripts/setup.md +25 -0
  157. package/hooks/shadow_manager.py +6 -0
  158. package/package.json +1 -1
  159. package/plugins/__init__.py +1 -0
  160. package/plugins/core/plugin.json +1 -1
  161. package/pyproject.toml +38 -2
  162. package/registry/__init__.py +1 -0
  163. package/registry/bundles/algorithms.yaml +45 -0
  164. package/registry/bundles/api-twin.yaml +48 -0
  165. package/registry/bundles/control-plane.yaml +61 -0
  166. package/registry/bundles/data-lineage.yaml +47 -0
  167. package/registry/bundles/delta-classifier.yaml +47 -0
  168. package/registry/bundles/eval-gate.yaml +47 -0
  169. package/registry/bundles/health.yaml +45 -0
  170. package/registry/bundles/hook-governor.yaml +97 -0
  171. package/registry/bundles/incident-replay.yaml +47 -0
  172. package/registry/bundles/lsp-pack.yaml +48 -0
  173. package/registry/bundles/mcp-fabric.yaml +53 -0
  174. package/registry/bundles/preflight.yaml +48 -0
  175. package/registry/bundles/remote-supervisor.yaml +49 -0
  176. package/registry/bundles/robotics.yaml +45 -0
  177. package/registry/bundles/secure-worktree-pipeline.yaml +54 -0
  178. package/registry/bundles/security-check.yaml +50 -0
  179. package/registry/bundles/tracebank.yaml +47 -0
  180. package/registry/bundles/vision.yaml +45 -0
  181. package/registry/omg-capability.schema.json +80 -0
  182. package/registry/verify_artifact.py +90 -0
  183. package/runtime/adapters/claude.py +3 -0
  184. package/runtime/adapters/gpt.py +3 -0
  185. package/runtime/adapters/local.py +3 -0
  186. package/runtime/adoption.py +1 -1
  187. package/runtime/api_twin.py +60 -11
  188. package/runtime/asset_loader.py +62 -0
  189. package/runtime/compat.py +3 -2
  190. package/runtime/contract_compiler.py +171 -22
  191. package/runtime/data_lineage.py +73 -0
  192. package/runtime/delta_classifier.py +81 -0
  193. package/runtime/domain_packs.py +12 -0
  194. package/runtime/ecosystem.py +1 -1
  195. package/runtime/eval_gate.py +50 -0
  196. package/runtime/incident_replay.py +47 -0
  197. package/runtime/mcp_memory_server.py +1 -1
  198. package/runtime/omg_compat_contract_snapshot.json +1 -1
  199. package/runtime/omg_contract_snapshot.json +1 -1
  200. package/runtime/omg_mcp_server.py +3 -1
  201. package/runtime/preflight.py +22 -1
  202. package/runtime/remote_supervisor.py +64 -0
  203. package/runtime/security_check.py +119 -2
  204. package/runtime/tracebank.py +53 -0
  205. package/scripts/omg.py +187 -2
  206. package/settings.json +21 -6
@@ -0,0 +1,228 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: OMG Control Plane API
4
+ version: 2.0.5
5
+ description: Policy/trust/evidence/runtime/registry/lab endpoints for OMG v2, with deprecated v1 aliases for one release.
6
+ servers:
7
+ - url: https://api.omg.local
8
+ paths:
9
+ /v2/policy/evaluate:
10
+ post:
11
+ summary: Evaluate policy decision
12
+ requestBody:
13
+ required: true
14
+ content:
15
+ application/json:
16
+ schema:
17
+ $ref: '#/components/schemas/PolicyInput'
18
+ responses:
19
+ '200':
20
+ description: Decision result
21
+ content:
22
+ application/json:
23
+ schema:
24
+ $ref: '#/components/schemas/PolicyDecision'
25
+ /v1/policy/evaluate:
26
+ post:
27
+ deprecated: true
28
+ summary: Deprecated alias of /v2/policy/evaluate
29
+ responses:
30
+ '200':
31
+ description: Decision result
32
+ /v2/trust/review:
33
+ post:
34
+ summary: Review trust-sensitive config changes
35
+ responses:
36
+ '200':
37
+ description: Trust review report
38
+ content:
39
+ application/json:
40
+ schema:
41
+ $ref: '#/components/schemas/TrustReview'
42
+ /v1/trust/review:
43
+ post:
44
+ deprecated: true
45
+ summary: Deprecated alias of /v2/trust/review
46
+ responses:
47
+ '200':
48
+ description: Trust review report
49
+ /v2/evidence/ingest:
50
+ post:
51
+ summary: Ingest evidence pack
52
+ responses:
53
+ '202':
54
+ description: Accepted
55
+ /v1/evidence/ingest:
56
+ post:
57
+ deprecated: true
58
+ summary: Deprecated alias of /v2/evidence/ingest
59
+ responses:
60
+ '202':
61
+ description: Accepted
62
+ /v2/security/check:
63
+ post:
64
+ summary: Run canonical OMG security check
65
+ responses:
66
+ '200':
67
+ description: Security check result
68
+ content:
69
+ application/json:
70
+ schema:
71
+ $ref: '#/components/schemas/SecurityCheckResult'
72
+ /v1/security/check:
73
+ post:
74
+ deprecated: true
75
+ summary: Deprecated alias of /v2/security/check
76
+ responses:
77
+ '200':
78
+ description: Security check result
79
+ /v2/guide/assert:
80
+ post:
81
+ summary: Assert output against explicit project rules
82
+ responses:
83
+ '200':
84
+ description: Guide assertion result
85
+ content:
86
+ application/json:
87
+ schema:
88
+ $ref: '#/components/schemas/GuideAssertionResult'
89
+ /v1/guide/assert:
90
+ post:
91
+ deprecated: true
92
+ summary: Deprecated alias of /v2/guide/assert
93
+ responses:
94
+ '200':
95
+ description: Guide assertion result
96
+ /v2/runtime/dispatch:
97
+ post:
98
+ summary: Dispatch job to runtime adapter
99
+ responses:
100
+ '200':
101
+ description: Runtime dispatch result
102
+ /v1/runtime/dispatch:
103
+ post:
104
+ deprecated: true
105
+ summary: Deprecated alias of /v2/runtime/dispatch
106
+ responses:
107
+ '200':
108
+ description: Runtime dispatch result
109
+ /v2/registry/verify:
110
+ post:
111
+ summary: Verify supply-chain artifact
112
+ responses:
113
+ '200':
114
+ description: Verification decision
115
+ /v1/registry/verify:
116
+ post:
117
+ deprecated: true
118
+ summary: Deprecated alias of /v2/registry/verify
119
+ responses:
120
+ '200':
121
+ description: Verification decision
122
+ /v2/lab/jobs:
123
+ post:
124
+ summary: Create lab pipeline job
125
+ responses:
126
+ '201':
127
+ description: Created
128
+ /v1/lab/jobs:
129
+ post:
130
+ deprecated: true
131
+ summary: Deprecated alias of /v2/lab/jobs
132
+ responses:
133
+ '201':
134
+ description: Created
135
+ /v2/scoreboard/baseline:
136
+ get:
137
+ summary: Return baseline scorecard
138
+ responses:
139
+ '200':
140
+ description: KPI baseline snapshot
141
+ /v1/scoreboard/baseline:
142
+ get:
143
+ deprecated: true
144
+ summary: Deprecated alias of /v2/scoreboard/baseline
145
+ responses:
146
+ '200':
147
+ description: KPI baseline snapshot
148
+ components:
149
+ schemas:
150
+ PolicyInput:
151
+ type: object
152
+ properties:
153
+ tool:
154
+ type: string
155
+ input:
156
+ type: object
157
+ additionalProperties: true
158
+ PolicyDecision:
159
+ type: object
160
+ required: [action, risk_level, reason, controls]
161
+ properties:
162
+ action:
163
+ type: string
164
+ enum: [allow, ask, deny]
165
+ risk_level:
166
+ type: string
167
+ enum: [low, med, high, critical]
168
+ reason:
169
+ type: string
170
+ controls:
171
+ type: array
172
+ items:
173
+ type: string
174
+ TrustReview:
175
+ type: object
176
+ required: [changed_files, mcp_changes, hook_changes, env_changes, risk_score, verdict]
177
+ properties:
178
+ changed_files:
179
+ type: array
180
+ items: { type: string }
181
+ mcp_changes:
182
+ type: array
183
+ items: { type: object }
184
+ hook_changes:
185
+ type: object
186
+ env_changes:
187
+ type: array
188
+ items: { type: object }
189
+ risk_score:
190
+ type: integer
191
+ verdict:
192
+ type: string
193
+ SecurityCheckResult:
194
+ type: object
195
+ required: [schema, status, scope, findings, summary, provenance, trust_scores]
196
+ properties:
197
+ schema:
198
+ type: string
199
+ status:
200
+ type: string
201
+ scope:
202
+ type: string
203
+ findings:
204
+ type: array
205
+ items:
206
+ type: object
207
+ summary:
208
+ type: object
209
+ provenance:
210
+ type: array
211
+ items:
212
+ type: object
213
+ trust_scores:
214
+ type: object
215
+ GuideAssertionResult:
216
+ type: object
217
+ required: [schema, verdict, violations, summary]
218
+ properties:
219
+ schema:
220
+ type: string
221
+ verdict:
222
+ type: string
223
+ violations:
224
+ type: array
225
+ items:
226
+ type: object
227
+ summary:
228
+ type: object
@@ -0,0 +1,123 @@
1
+ """Lightweight HTTP server for OMG control-plane APIs."""
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+ import sys
6
+ from http.server import BaseHTTPRequestHandler, HTTPServer
7
+ import json
8
+ from typing import Any
9
+
10
+ from control_plane.service import ControlPlaneService
11
+
12
+
13
+ def _json_response(handler: BaseHTTPRequestHandler, status: int, payload: dict[str, Any]) -> None:
14
+ body = json.dumps(payload, ensure_ascii=True).encode("utf-8")
15
+ handler.send_response(status)
16
+ handler.send_header("Content-Type", "application/json")
17
+ handler.send_header("Content-Length", str(len(body)))
18
+ handler.end_headers()
19
+ handler.wfile.write(body)
20
+
21
+
22
+ def _read_json(handler: BaseHTTPRequestHandler) -> dict[str, Any]:
23
+ length = int(handler.headers.get("Content-Length", "0"))
24
+ if length <= 0:
25
+ return {}
26
+ raw = handler.rfile.read(length)
27
+ if not raw:
28
+ return {}
29
+ try:
30
+ parsed = json.loads(raw.decode("utf-8"))
31
+ return parsed if isinstance(parsed, dict) else {}
32
+ except json.JSONDecodeError:
33
+ return {}
34
+
35
+
36
+ _POST_ROUTE_TABLE = {
37
+ "/v2/policy/evaluate": ("policy_evaluate", False),
38
+ "/v1/policy/evaluate": ("policy_evaluate", True),
39
+ "/v2/trust/review": ("trust_review", False),
40
+ "/v1/trust/review": ("trust_review", True),
41
+ "/v2/evidence/ingest": ("evidence_ingest", False),
42
+ "/v1/evidence/ingest": ("evidence_ingest", True),
43
+ "/v2/security/check": ("security_check", False),
44
+ "/v1/security/check": ("security_check", True),
45
+ "/v2/guide/assert": ("guide_assert", False),
46
+ "/v1/guide/assert": ("guide_assert", True),
47
+ "/v2/runtime/dispatch": ("runtime_dispatch", False),
48
+ "/v1/runtime/dispatch": ("runtime_dispatch", True),
49
+ "/v2/registry/verify": ("registry_verify", False),
50
+ "/v1/registry/verify": ("registry_verify", True),
51
+ "/v2/lab/jobs": ("lab_jobs", False),
52
+ "/v1/lab/jobs": ("lab_jobs", True),
53
+ }
54
+
55
+ _GET_ROUTE_TABLE = {
56
+ "/v2/scoreboard/baseline": ("scoreboard_baseline", False),
57
+ "/v1/scoreboard/baseline": ("scoreboard_baseline", True),
58
+ }
59
+
60
+
61
+ def _decorate_payload(payload: dict[str, Any], *, deprecated: bool) -> dict[str, Any]:
62
+ decorated = dict(payload)
63
+ decorated["api_version"] = "v2"
64
+ if deprecated:
65
+ decorated["deprecated"] = True
66
+ decorated["deprecated_alias"] = "v1"
67
+ return decorated
68
+
69
+
70
+ def make_handler(service: ControlPlaneService):
71
+ class Handler(BaseHTTPRequestHandler):
72
+ def do_GET(self) -> None: # noqa: N802
73
+ route = _GET_ROUTE_TABLE.get(self.path)
74
+ if route is not None:
75
+ method_name, deprecated = route
76
+ status, payload = getattr(service, method_name)()
77
+ _json_response(self, status, _decorate_payload(payload, deprecated=deprecated))
78
+ return
79
+ _json_response(self, 404, {"status": "error", "message": "Not found"})
80
+
81
+ def do_POST(self) -> None: # noqa: N802
82
+ payload = _read_json(self)
83
+ route = _POST_ROUTE_TABLE.get(self.path)
84
+ if route is not None:
85
+ method_name, deprecated = route
86
+ status, out = getattr(service, method_name)(payload)
87
+ _json_response(self, status, _decorate_payload(out, deprecated=deprecated))
88
+ return
89
+
90
+ _json_response(self, 404, {"status": "error", "message": "Not found"})
91
+
92
+ def log_message(self, format: str, *args: Any) -> None: # noqa: A003
93
+ # Quiet default request logs; keep response JSON clean for local usage.
94
+ return
95
+
96
+ return Handler
97
+
98
+
99
+ def run_server(host: str = "127.0.0.1", port: int = 8787, project_dir: str | None = None) -> None:
100
+ service = ControlPlaneService(project_dir=project_dir)
101
+ handler = make_handler(service)
102
+ server = HTTPServer((host, port), handler)
103
+ try:
104
+ server.serve_forever()
105
+ finally:
106
+ server.server_close()
107
+
108
+
109
+ def _main() -> int:
110
+ parser = argparse.ArgumentParser(description="Run OMG control-plane API server")
111
+ parser.add_argument("--host", default="127.0.0.1")
112
+ parser.add_argument("--port", type=int, default=8787)
113
+ parser.add_argument("--project-dir", default=None)
114
+ args = parser.parse_args()
115
+ if args.host != "127.0.0.1":
116
+ print(f"⚠ WARNING: Binding to {args.host} exposes the control plane to the network. No authentication is configured.", file=sys.stderr)
117
+
118
+ run_server(args.host, args.port, args.project_dir)
119
+ return 0
120
+
121
+
122
+ if __name__ == "__main__":
123
+ raise SystemExit(_main())
@@ -0,0 +1,185 @@
1
+ """Control plane service handlers for OMG v1."""
2
+ from __future__ import annotations
3
+
4
+ from datetime import datetime, timezone
5
+ import os
6
+ from typing import Any
7
+
8
+ from hooks.policy_engine import (
9
+ evaluate_bash_command,
10
+ evaluate_file_access,
11
+ evaluate_supply_artifact,
12
+ )
13
+ from hooks.security_validators import validate_opaque_identifier
14
+ from hooks.shadow_manager import create_evidence_pack
15
+ from hooks.trust_review import review_config_change
16
+ from lab.pipeline import run_pipeline
17
+ from registry.verify_artifact import verify_artifact
18
+ from runtime.guide_assert import guide_assert
19
+ from runtime.dispatcher import dispatch_runtime
20
+ from runtime.security_check import run_security_check
21
+
22
+
23
+ class ControlPlaneService:
24
+ def __init__(self, project_dir: str | None = None):
25
+ self.project_dir = project_dir or os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
26
+
27
+ def policy_evaluate(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
28
+ tool = str(payload.get("tool", ""))
29
+ input_data = payload.get("input", {})
30
+
31
+ if tool == "Bash":
32
+ command = str((input_data or {}).get("command", ""))
33
+ decision = evaluate_bash_command(command)
34
+ return 200, decision.to_dict()
35
+
36
+ if tool in {"Read", "Write", "Edit", "MultiEdit"}:
37
+ file_path = str((input_data or {}).get("file_path", ""))
38
+ decision = evaluate_file_access(tool, file_path)
39
+ return 200, decision.to_dict()
40
+
41
+ if tool == "SupplyArtifact":
42
+ artifact = payload.get("artifact", {})
43
+ mode = str(payload.get("mode", "warn_and_run"))
44
+ decision = evaluate_supply_artifact(artifact, mode=mode)
45
+ return 200, decision.to_dict()
46
+
47
+ return 400, {
48
+ "status": "error",
49
+ "error_code": "INVALID_POLICY_INPUT",
50
+ "message": "Unsupported tool for policy evaluation",
51
+ }
52
+
53
+ def trust_review(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
54
+ file_path = str(payload.get("file_path", "settings.json"))
55
+ old_config = payload.get("old_config", {})
56
+ new_config = payload.get("new_config", {})
57
+ if not isinstance(old_config, dict) or not isinstance(new_config, dict):
58
+ return 400, {
59
+ "status": "error",
60
+ "error_code": "INVALID_TRUST_INPUT",
61
+ "message": "old_config and new_config must be objects",
62
+ }
63
+ review = review_config_change(file_path, old_config, new_config)
64
+ return 200, review
65
+
66
+ def evidence_ingest(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
67
+ run_id = str(payload.get("run_id", "")).strip()
68
+ required = ["tests", "security_scans", "diff_summary", "reproducibility", "unresolved_risks"]
69
+ missing = [key for key in required if key not in payload]
70
+
71
+ if not run_id:
72
+ return 400, {
73
+ "status": "error",
74
+ "error_code": "INVALID_EVIDENCE_INPUT",
75
+ "message": "run_id is required",
76
+ }
77
+ try:
78
+ run_id = validate_opaque_identifier(run_id, "run_id")
79
+ except ValueError as exc:
80
+ return 400, {
81
+ "status": "error",
82
+ "error_code": "INVALID_EVIDENCE_INPUT",
83
+ "message": str(exc),
84
+ }
85
+ if missing:
86
+ return 400, {
87
+ "status": "error",
88
+ "error_code": "INVALID_EVIDENCE_INPUT",
89
+ "message": f"Missing required fields: {', '.join(missing)}",
90
+ }
91
+
92
+ path = create_evidence_pack(
93
+ self.project_dir,
94
+ run_id,
95
+ tests=payload.get("tests"),
96
+ security_scans=payload.get("security_scans"),
97
+ diff_summary=payload.get("diff_summary"),
98
+ reproducibility=payload.get("reproducibility"),
99
+ unresolved_risks=payload.get("unresolved_risks"),
100
+ provenance=payload.get("provenance"),
101
+ trust_scores=payload.get("trust_scores"),
102
+ api_twin=payload.get("api_twin"),
103
+ route_metadata=payload.get("route_metadata"),
104
+ trace_ids=payload.get("trace_ids"),
105
+ lineage=payload.get("lineage"),
106
+ )
107
+ return 202, {
108
+ "status": "accepted",
109
+ "run_id": run_id,
110
+ "evidence_path": os.path.relpath(path, self.project_dir),
111
+ }
112
+
113
+ def security_check(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
114
+ scope = str(payload.get("scope", "."))
115
+ include_live_enrichment = bool(payload.get("include_live_enrichment", False))
116
+ result = run_security_check(
117
+ project_dir=self.project_dir,
118
+ scope=scope,
119
+ include_live_enrichment=include_live_enrichment,
120
+ )
121
+ return 200, result
122
+
123
+ def guide_assert(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
124
+ candidate = str(payload.get("candidate", ""))
125
+ rules = payload.get("rules", {})
126
+ if not isinstance(rules, dict):
127
+ return 400, {
128
+ "status": "error",
129
+ "error_code": "INVALID_GUIDE_INPUT",
130
+ "message": "rules must be an object",
131
+ }
132
+ return 200, guide_assert(candidate, rules)
133
+
134
+ def runtime_dispatch(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
135
+ runtime = str(payload.get("runtime", "")).strip()
136
+ idea = payload.get("idea", {})
137
+ if not runtime:
138
+ return 400, {
139
+ "status": "error",
140
+ "error_code": "INVALID_RUNTIME_INPUT",
141
+ "message": "runtime is required",
142
+ }
143
+ if not isinstance(idea, dict):
144
+ return 400, {
145
+ "status": "error",
146
+ "error_code": "INVALID_RUNTIME_INPUT",
147
+ "message": "idea must be an object",
148
+ }
149
+ result = dispatch_runtime(runtime, idea)
150
+ if result.get("status") == "error":
151
+ return 400, result
152
+ return 200, result
153
+
154
+ def registry_verify(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
155
+ artifact = payload.get("artifact", {})
156
+ mode = str(payload.get("mode", "warn_and_run"))
157
+ if not isinstance(artifact, dict):
158
+ return 400, {
159
+ "status": "error",
160
+ "error_code": "INVALID_REGISTRY_INPUT",
161
+ "message": "artifact must be an object",
162
+ }
163
+ decision = verify_artifact(artifact, mode=mode)
164
+ return 200, decision
165
+
166
+ def lab_jobs(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
167
+ if not isinstance(payload, dict):
168
+ return 400, {
169
+ "status": "error",
170
+ "error_code": "INVALID_LAB_INPUT",
171
+ "message": "job payload must be an object",
172
+ }
173
+ result = run_pipeline(payload)
174
+ return 201 if result.get("status") in {"ready", "failed_evaluation"} else 400, result
175
+
176
+ def scoreboard_baseline(self) -> tuple[int, dict[str, Any]]:
177
+ return 200, {
178
+ "generated_at": datetime.now(timezone.utc).isoformat(),
179
+ "baseline": {
180
+ "safe_autonomy_rate": 0.0,
181
+ "pr_throughput": 0.0,
182
+ "adoption_velocity": 0.0,
183
+ },
184
+ "target_policy": "non-regression-or-better",
185
+ }
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: omg-algorithms
3
+ description: "Determinism and benchmark attachments for algorithm-heavy work."
4
+ ---
5
+
6
+ # OMG Algorithms Pack
7
+
8
+ - Channel: `enterprise`
9
+ - Execution modes: `embedded, local_supervisor`
10
+ - MCP servers: `omg-control`
11
+ - Evidence outputs: `.omg/evals/latest.json`
@@ -0,0 +1,11 @@
1
+ name: omg-algorithms
2
+ description: "Determinism and benchmark attachments for algorithm-heavy work."
3
+ allow_implicit_invocation: false
4
+ metadata:
5
+ channel: enterprise
6
+ bundle_id: algorithms
7
+ title: "OMG Algorithms Pack"
8
+ mcp_servers:
9
+ - omg-control
10
+ allowed_tools:
11
+ - "Read"
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: omg-api-twin
3
+ description: "Versioned endpoint cassette replay with latency, drift, and cost reporting."
4
+ ---
5
+
6
+ # OMG API Twin
7
+
8
+ - Channel: `enterprise`
9
+ - Execution modes: `embedded, local_supervisor`
10
+ - MCP servers: `omg-control`
11
+ - Evidence outputs: `.omg/state/api_twin.json`
@@ -0,0 +1,12 @@
1
+ name: omg-api-twin
2
+ description: "Versioned endpoint cassette replay with latency, drift, and cost reporting."
3
+ allow_implicit_invocation: false
4
+ metadata:
5
+ channel: enterprise
6
+ bundle_id: api-twin
7
+ title: "OMG API Twin"
8
+ mcp_servers:
9
+ - omg-control
10
+ allowed_tools:
11
+ - "Read"
12
+ - "Bash(python3:*)"
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: omg-data-lineage
3
+ description: "Provenance and privacy tracking for traces, fixtures, examples, and synthetic artifacts."
4
+ ---
5
+
6
+ # OMG Data Lineage
7
+
8
+ - Channel: `enterprise`
9
+ - Execution modes: `embedded, local_supervisor`
10
+ - MCP servers: `omg-control`
11
+ - Evidence outputs: `.omg/lineage/*.json`
@@ -0,0 +1,12 @@
1
+ name: omg-data-lineage
2
+ description: "Provenance and privacy tracking for traces, fixtures, examples, and synthetic artifacts."
3
+ allow_implicit_invocation: true
4
+ metadata:
5
+ channel: enterprise
6
+ bundle_id: data-lineage
7
+ title: "OMG Data Lineage"
8
+ mcp_servers:
9
+ - omg-control
10
+ allowed_tools:
11
+ - "Read"
12
+ - "Bash(python3:*)"
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: omg-delta-classifier
3
+ description: "Change classifier that attaches risk-aware checks, approvals, and packs."
4
+ ---
5
+
6
+ # OMG Delta Classifier
7
+
8
+ - Channel: `enterprise`
9
+ - Execution modes: `embedded, local_supervisor`
10
+ - MCP servers: `omg-control`
11
+ - Evidence outputs: `.omg/tracebank/events.jsonl`
@@ -0,0 +1,12 @@
1
+ name: omg-delta-classifier
2
+ description: "Change classifier that attaches risk-aware checks, approvals, and packs."
3
+ allow_implicit_invocation: true
4
+ metadata:
5
+ channel: enterprise
6
+ bundle_id: delta-classifier
7
+ title: "OMG Delta Classifier"
8
+ mcp_servers:
9
+ - omg-control
10
+ allowed_tools:
11
+ - "Read"
12
+ - "Grep"
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: omg-eval-gate
3
+ description: "Reproducible evaluation gate that blocks regressions before release."
4
+ ---
5
+
6
+ # OMG Eval Gate
7
+
8
+ - Channel: `enterprise`
9
+ - Execution modes: `embedded, local_supervisor`
10
+ - MCP servers: `omg-control`
11
+ - Evidence outputs: `.omg/evals/latest.json`
@@ -0,0 +1,12 @@
1
+ name: omg-eval-gate
2
+ description: "Reproducible evaluation gate that blocks regressions before release."
3
+ allow_implicit_invocation: false
4
+ metadata:
5
+ channel: enterprise
6
+ bundle_id: eval-gate
7
+ title: "OMG Eval Gate"
8
+ mcp_servers:
9
+ - omg-control
10
+ allowed_tools:
11
+ - "Read"
12
+ - "Bash(python3:*)"
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: omg-health
3
+ description: "Health-sensitive approvals, provenance, and replay attachments."
4
+ ---
5
+
6
+ # OMG Health Pack
7
+
8
+ - Channel: `enterprise`
9
+ - Execution modes: `embedded, local_supervisor`
10
+ - MCP servers: `omg-control`
11
+ - Evidence outputs: `.omg/lineage/*.json`
@@ -0,0 +1,11 @@
1
+ name: omg-health
2
+ description: "Health-sensitive approvals, provenance, and replay attachments."
3
+ allow_implicit_invocation: false
4
+ metadata:
5
+ channel: enterprise
6
+ bundle_id: health
7
+ title: "OMG Health Pack"
8
+ mcp_servers:
9
+ - omg-control
10
+ allowed_tools:
11
+ - "Read"