@trac3er/oh-my-god 1.0.2

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 (229) hide show
  1. package/.claude-plugin/marketplace.json +36 -0
  2. package/.claude-plugin/plugin.json +23 -0
  3. package/.claude-plugin/scripts/install.sh +49 -0
  4. package/.claude-plugin/scripts/uninstall.sh +80 -0
  5. package/.claude-plugin/scripts/update.sh +84 -0
  6. package/.mcp.json +20 -0
  7. package/LICENSE +21 -0
  8. package/OMG-setup.sh +1093 -0
  9. package/README.md +335 -0
  10. package/THIRD_PARTY_NOTICES.md +24 -0
  11. package/UPSTREAM_DIFF.md +20 -0
  12. package/agents/__init__.py +1 -0
  13. package/agents/_model_roles.yaml +26 -0
  14. package/agents/designer.md +67 -0
  15. package/agents/explore.md +60 -0
  16. package/agents/model_roles.py +196 -0
  17. package/agents/omg-api-builder.md +23 -0
  18. package/agents/omg-architect-mode.md +43 -0
  19. package/agents/omg-architect.md +13 -0
  20. package/agents/omg-backend-engineer.md +43 -0
  21. package/agents/omg-critic.md +16 -0
  22. package/agents/omg-database-engineer.md +43 -0
  23. package/agents/omg-escalation-router.md +17 -0
  24. package/agents/omg-executor.md +12 -0
  25. package/agents/omg-frontend-designer.md +42 -0
  26. package/agents/omg-implement-mode.md +50 -0
  27. package/agents/omg-infra-engineer.md +43 -0
  28. package/agents/omg-qa-tester.md +16 -0
  29. package/agents/omg-research-mode.md +43 -0
  30. package/agents/omg-security-auditor.md +43 -0
  31. package/agents/omg-testing-engineer.md +43 -0
  32. package/agents/plan.md +80 -0
  33. package/agents/quick_task.md +64 -0
  34. package/agents/reviewer.md +83 -0
  35. package/agents/task.md +71 -0
  36. package/commands/OMG:ccg.md +22 -0
  37. package/commands/OMG:compat.md +57 -0
  38. package/commands/OMG:crazy.md +125 -0
  39. package/commands/OMG:domain-init.md +11 -0
  40. package/commands/OMG:escalate.md +52 -0
  41. package/commands/OMG:health-check.md +45 -0
  42. package/commands/OMG:init.md +134 -0
  43. package/commands/OMG:mode.md +44 -0
  44. package/commands/OMG:project-init.md +11 -0
  45. package/commands/OMG:ralph-start.md +43 -0
  46. package/commands/OMG:ralph-stop.md +23 -0
  47. package/commands/OMG:teams.md +39 -0
  48. package/commands/ai-commit.md +113 -0
  49. package/commands/ccg.md +9 -0
  50. package/commands/create-agent.md +183 -0
  51. package/commands/omc-teams.md +9 -0
  52. package/commands/session-branch.md +85 -0
  53. package/commands/session-fork.md +53 -0
  54. package/commands/session-merge.md +134 -0
  55. package/commands/theme.md +44 -0
  56. package/config/lsp_languages.yaml +324 -0
  57. package/config/themes/catppuccin-frappe.yaml +14 -0
  58. package/config/themes/catppuccin-latte.yaml +14 -0
  59. package/config/themes/catppuccin-macchiato.yaml +14 -0
  60. package/config/themes/catppuccin-mocha.yaml +14 -0
  61. package/config/themes/dracula.yaml +14 -0
  62. package/config/themes/gruvbox-dark.yaml +14 -0
  63. package/config/themes/nord.yaml +14 -0
  64. package/config/themes/one-dark.yaml +14 -0
  65. package/config/themes/solarized-dark.yaml +14 -0
  66. package/config/themes/tokyo-night.yaml +14 -0
  67. package/control_plane/__init__.py +2 -0
  68. package/control_plane/openapi.yaml +109 -0
  69. package/control_plane/server.py +107 -0
  70. package/control_plane/service.py +148 -0
  71. package/crates/omg-natives/Cargo.toml +17 -0
  72. package/crates/omg-natives/src/clipboard.rs +5 -0
  73. package/crates/omg-natives/src/glob.rs +15 -0
  74. package/crates/omg-natives/src/grep.rs +15 -0
  75. package/crates/omg-natives/src/highlight.rs +15 -0
  76. package/crates/omg-natives/src/html.rs +14 -0
  77. package/crates/omg-natives/src/image.rs +5 -0
  78. package/crates/omg-natives/src/keys.rs +5 -0
  79. package/crates/omg-natives/src/lib.rs +36 -0
  80. package/crates/omg-natives/src/prof.rs +5 -0
  81. package/crates/omg-natives/src/ps.rs +5 -0
  82. package/crates/omg-natives/src/shell.rs +5 -0
  83. package/crates/omg-natives/src/task.rs +5 -0
  84. package/crates/omg-natives/src/text.rs +14 -0
  85. package/hooks/_agent_registry.py +421 -0
  86. package/hooks/_budget.py +31 -0
  87. package/hooks/_common.py +476 -0
  88. package/hooks/_learnings.py +126 -0
  89. package/hooks/_memory.py +103 -0
  90. package/hooks/circuit-breaker.py +270 -0
  91. package/hooks/config-guard.py +163 -0
  92. package/hooks/context_pressure.py +53 -0
  93. package/hooks/credential_store.py +801 -0
  94. package/hooks/fetch-rate-limits.py +212 -0
  95. package/hooks/firewall.py +48 -0
  96. package/hooks/hashline-formatter-bridge.py +224 -0
  97. package/hooks/hashline-injector.py +273 -0
  98. package/hooks/hashline-validator.py +216 -0
  99. package/hooks/idle-detector.py +95 -0
  100. package/hooks/intentgate-keyword-detector.py +188 -0
  101. package/hooks/magic-keyword-router.py +195 -0
  102. package/hooks/policy_engine.py +310 -0
  103. package/hooks/post-tool-failure.py +19 -0
  104. package/hooks/post-write.py +199 -0
  105. package/hooks/pre-compact.py +204 -0
  106. package/hooks/pre-tool-inject.py +98 -0
  107. package/hooks/prompt-enhancer.py +672 -0
  108. package/hooks/quality-runner.py +191 -0
  109. package/hooks/secret-guard.py +47 -0
  110. package/hooks/session-end-capture.py +137 -0
  111. package/hooks/session-start.py +275 -0
  112. package/hooks/shadow_manager.py +297 -0
  113. package/hooks/state_migration.py +209 -0
  114. package/hooks/stop-gate.py +7 -0
  115. package/hooks/stop_dispatcher.py +929 -0
  116. package/hooks/test-validator.py +138 -0
  117. package/hooks/todo-state-tracker.py +114 -0
  118. package/hooks/tool-ledger.py +126 -0
  119. package/hooks/trust_review.py +524 -0
  120. package/install.sh +9 -0
  121. package/omg_natives/__init__.py +186 -0
  122. package/omg_natives/_bindings.py +165 -0
  123. package/omg_natives/clipboard.py +36 -0
  124. package/omg_natives/glob.py +42 -0
  125. package/omg_natives/grep.py +61 -0
  126. package/omg_natives/highlight.py +54 -0
  127. package/omg_natives/html.py +157 -0
  128. package/omg_natives/image.py +51 -0
  129. package/omg_natives/keys.py +46 -0
  130. package/omg_natives/prof.py +39 -0
  131. package/omg_natives/ps.py +93 -0
  132. package/omg_natives/shell.py +58 -0
  133. package/omg_natives/task.py +41 -0
  134. package/omg_natives/text.py +50 -0
  135. package/package.json +26 -0
  136. package/plugins/README.md +82 -0
  137. package/plugins/advanced/commands/OMG:code-review.md +114 -0
  138. package/plugins/advanced/commands/OMG:deep-plan.md +221 -0
  139. package/plugins/advanced/commands/OMG:handoff.md +115 -0
  140. package/plugins/advanced/commands/OMG:learn.md +110 -0
  141. package/plugins/advanced/commands/OMG:maintainer.md +31 -0
  142. package/plugins/advanced/commands/OMG:ralph-start.md +43 -0
  143. package/plugins/advanced/commands/OMG:ralph-stop.md +23 -0
  144. package/plugins/advanced/commands/OMG:security-review.md +119 -0
  145. package/plugins/advanced/commands/OMG:sequential-thinking.md +20 -0
  146. package/plugins/advanced/commands/OMG:ship.md +46 -0
  147. package/plugins/advanced/plugin.json +96 -0
  148. package/plugins/core/plugin.json +82 -0
  149. package/pytest.ini +5 -0
  150. package/registry/__init__.py +1 -0
  151. package/registry/verify_artifact.py +90 -0
  152. package/rules/contextual/architect-mode.md +9 -0
  153. package/rules/contextual/big-picture.md +20 -0
  154. package/rules/contextual/code-hygiene.md +26 -0
  155. package/rules/contextual/context-management.md +19 -0
  156. package/rules/contextual/context-minimization.md +32 -0
  157. package/rules/contextual/ddd-sdd.md +28 -0
  158. package/rules/contextual/dependency-safety.md +16 -0
  159. package/rules/contextual/doc-check.md +13 -0
  160. package/rules/contextual/implement-mode.md +9 -0
  161. package/rules/contextual/infra-safety.md +14 -0
  162. package/rules/contextual/outside-in.md +13 -0
  163. package/rules/contextual/persistent-mode.md +24 -0
  164. package/rules/contextual/research-mode.md +9 -0
  165. package/rules/contextual/security-domains.md +25 -0
  166. package/rules/contextual/vision-detection.md +27 -0
  167. package/rules/contextual/web-search.md +25 -0
  168. package/rules/contextual/write-verify.md +23 -0
  169. package/rules/core/00-truth.md +20 -0
  170. package/rules/core/01-surgical.md +19 -0
  171. package/rules/core/02-circuit-breaker.md +22 -0
  172. package/rules/core/03-ensemble.md +28 -0
  173. package/rules/core/04-testing.md +30 -0
  174. package/runtime/__init__.py +32 -0
  175. package/runtime/adapters/__init__.py +13 -0
  176. package/runtime/adapters/claude.py +60 -0
  177. package/runtime/adapters/gpt.py +53 -0
  178. package/runtime/adapters/local.py +53 -0
  179. package/runtime/business_workflow.py +220 -0
  180. package/runtime/compat.py +1299 -0
  181. package/runtime/custom_agent_loader.py +366 -0
  182. package/runtime/dispatcher.py +47 -0
  183. package/runtime/ecosystem.py +371 -0
  184. package/runtime/legacy_compat.py +7 -0
  185. package/runtime/omc_compat.py +7 -0
  186. package/runtime/omc_contract_snapshot.json +916 -0
  187. package/runtime/omg_compat_contract_snapshot.json +916 -0
  188. package/runtime/subagent_dispatcher.py +362 -0
  189. package/runtime/team_router.py +838 -0
  190. package/scripts/check-omc-contract-snapshot.py +12 -0
  191. package/scripts/check-omg-compat-contract-snapshot.py +137 -0
  192. package/scripts/check-omg-standalone-clean.py +102 -0
  193. package/scripts/legacy_to_omg_migrate.py +29 -0
  194. package/scripts/migrate-omc.py +464 -0
  195. package/scripts/omc_to_omg_migrate.py +12 -0
  196. package/scripts/omg.py +493 -0
  197. package/scripts/settings-merge.py +224 -0
  198. package/scripts/verify-no-omc.sh +5 -0
  199. package/scripts/verify-standalone.sh +21 -0
  200. package/templates/idea.yml +30 -0
  201. package/templates/policy.yaml +15 -0
  202. package/templates/profile.yaml +25 -0
  203. package/templates/runtime.yaml +12 -0
  204. package/templates/working-memory.md +17 -0
  205. package/tools/__init__.py +2 -0
  206. package/tools/browser_consent.py +289 -0
  207. package/tools/browser_stealth.py +481 -0
  208. package/tools/browser_tool.py +448 -0
  209. package/tools/changelog_generator.py +268 -0
  210. package/tools/commit_splitter.py +361 -0
  211. package/tools/config_discovery.py +151 -0
  212. package/tools/config_merger.py +449 -0
  213. package/tools/git_inspector.py +298 -0
  214. package/tools/lsp_client.py +275 -0
  215. package/tools/lsp_discovery.py +231 -0
  216. package/tools/lsp_operations.py +392 -0
  217. package/tools/python_repl.py +656 -0
  218. package/tools/python_sandbox.py +609 -0
  219. package/tools/search_providers/__init__.py +77 -0
  220. package/tools/search_providers/brave.py +115 -0
  221. package/tools/search_providers/exa.py +116 -0
  222. package/tools/search_providers/jina.py +104 -0
  223. package/tools/search_providers/perplexity.py +139 -0
  224. package/tools/search_providers/synthetic.py +74 -0
  225. package/tools/session_snapshot.py +736 -0
  226. package/tools/ssh_manager.py +912 -0
  227. package/tools/theme_engine.py +294 -0
  228. package/tools/theme_selector.py +137 -0
  229. package/tools/web_search.py +622 -0
@@ -0,0 +1,14 @@
1
+ name: "Tokyo Night"
2
+ variant: "dark"
3
+ colors:
4
+ background: "#1a1b26"
5
+ foreground: "#a9b1d6"
6
+ primary: "#7aa2f7"
7
+ secondary: "#565f89"
8
+ accent: "#bb9af7"
9
+ error: "#f7768e"
10
+ warning: "#e0af68"
11
+ success: "#9ece6a"
12
+ metadata:
13
+ author: "Enkia"
14
+ url: "https://github.com/enkia/tokyo-night-vscode-theme"
@@ -0,0 +1,2 @@
1
+ """Control plane package for OMG v1."""
2
+
@@ -0,0 +1,109 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: OMG Control Plane API
4
+ version: 1.0.0
5
+ description: Policy/trust/evidence/runtime/registry/lab endpoints for OMG v1.
6
+ servers:
7
+ - url: https://api.omg.local
8
+ paths:
9
+ /v1/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/trust/review:
26
+ post:
27
+ summary: Review trust-sensitive config changes
28
+ responses:
29
+ '200':
30
+ description: Trust review report
31
+ content:
32
+ application/json:
33
+ schema:
34
+ $ref: '#/components/schemas/TrustReview'
35
+ /v1/evidence/ingest:
36
+ post:
37
+ summary: Ingest evidence pack
38
+ responses:
39
+ '202':
40
+ description: Accepted
41
+ /v1/runtime/dispatch:
42
+ post:
43
+ summary: Dispatch job to runtime adapter
44
+ responses:
45
+ '200':
46
+ description: Runtime dispatch result
47
+ /v1/registry/verify:
48
+ post:
49
+ summary: Verify supply-chain artifact
50
+ responses:
51
+ '200':
52
+ description: Verification decision
53
+ /v1/lab/jobs:
54
+ post:
55
+ summary: Create lab pipeline job
56
+ responses:
57
+ '201':
58
+ description: Created
59
+ /v1/scoreboard/baseline:
60
+ get:
61
+ summary: Return baseline scorecard
62
+ responses:
63
+ '200':
64
+ description: KPI baseline snapshot
65
+ components:
66
+ schemas:
67
+ PolicyInput:
68
+ type: object
69
+ properties:
70
+ tool:
71
+ type: string
72
+ input:
73
+ type: object
74
+ additionalProperties: true
75
+ PolicyDecision:
76
+ type: object
77
+ required: [action, risk_level, reason, controls]
78
+ properties:
79
+ action:
80
+ type: string
81
+ enum: [allow, ask, deny]
82
+ risk_level:
83
+ type: string
84
+ enum: [low, med, high, critical]
85
+ reason:
86
+ type: string
87
+ controls:
88
+ type: array
89
+ items:
90
+ type: string
91
+ TrustReview:
92
+ type: object
93
+ required: [changed_files, mcp_changes, hook_changes, env_changes, risk_score, verdict]
94
+ properties:
95
+ changed_files:
96
+ type: array
97
+ items: { type: string }
98
+ mcp_changes:
99
+ type: array
100
+ items: { type: object }
101
+ hook_changes:
102
+ type: object
103
+ env_changes:
104
+ type: array
105
+ items: { type: object }
106
+ risk_score:
107
+ type: integer
108
+ verdict:
109
+ type: string
@@ -0,0 +1,107 @@
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
+ def make_handler(service: ControlPlaneService):
37
+ class Handler(BaseHTTPRequestHandler):
38
+ def do_GET(self) -> None: # noqa: N802
39
+ if self.path == "/v1/scoreboard/baseline":
40
+ status, payload = service.scoreboard_baseline()
41
+ _json_response(self, status, payload)
42
+ return
43
+ _json_response(self, 404, {"status": "error", "message": "Not found"})
44
+
45
+ def do_POST(self) -> None: # noqa: N802
46
+ payload = _read_json(self)
47
+
48
+ if self.path == "/v1/policy/evaluate":
49
+ status, out = service.policy_evaluate(payload)
50
+ _json_response(self, status, out)
51
+ return
52
+ if self.path == "/v1/trust/review":
53
+ status, out = service.trust_review(payload)
54
+ _json_response(self, status, out)
55
+ return
56
+ if self.path == "/v1/evidence/ingest":
57
+ status, out = service.evidence_ingest(payload)
58
+ _json_response(self, status, out)
59
+ return
60
+ if self.path == "/v1/runtime/dispatch":
61
+ status, out = service.runtime_dispatch(payload)
62
+ _json_response(self, status, out)
63
+ return
64
+ if self.path == "/v1/registry/verify":
65
+ status, out = service.registry_verify(payload)
66
+ _json_response(self, status, out)
67
+ return
68
+ if self.path == "/v1/lab/jobs":
69
+ status, out = service.lab_jobs(payload)
70
+ _json_response(self, status, out)
71
+ return
72
+
73
+ _json_response(self, 404, {"status": "error", "message": "Not found"})
74
+
75
+ def log_message(self, format: str, *args: Any) -> None: # noqa: A003
76
+ # Quiet default request logs; keep response JSON clean for local usage.
77
+ return
78
+
79
+ return Handler
80
+
81
+
82
+ def run_server(host: str = "127.0.0.1", port: int = 8787, project_dir: str | None = None) -> None:
83
+ service = ControlPlaneService(project_dir=project_dir)
84
+ handler = make_handler(service)
85
+ server = HTTPServer((host, port), handler)
86
+ try:
87
+ server.serve_forever()
88
+ finally:
89
+ server.server_close()
90
+
91
+
92
+ def _main() -> int:
93
+ parser = argparse.ArgumentParser(description="Run OMG control-plane API server")
94
+ parser.add_argument("--host", default="127.0.0.1")
95
+ parser.add_argument("--port", type=int, default=8787)
96
+ parser.add_argument("--project-dir", default=None)
97
+ args = parser.parse_args()
98
+ if args.host != "127.0.0.1":
99
+ print(f"⚠ WARNING: Binding to {args.host} exposes the control plane to the network. No authentication is configured.", file=sys.stderr)
100
+
101
+ run_server(args.host, args.port, args.project_dir)
102
+ return 0
103
+
104
+
105
+ if __name__ == "__main__":
106
+ raise SystemExit(_main())
107
+
@@ -0,0 +1,148 @@
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.shadow_manager import create_evidence_pack
14
+ from hooks.trust_review import review_config_change
15
+ from lab.pipeline import run_pipeline
16
+ from registry.verify_artifact import verify_artifact
17
+ from runtime.dispatcher import dispatch_runtime
18
+
19
+
20
+ class ControlPlaneService:
21
+ def __init__(self, project_dir: str | None = None):
22
+ self.project_dir = project_dir or os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd())
23
+
24
+ def policy_evaluate(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
25
+ tool = str(payload.get("tool", ""))
26
+ input_data = payload.get("input", {})
27
+
28
+ if tool == "Bash":
29
+ command = str((input_data or {}).get("command", ""))
30
+ decision = evaluate_bash_command(command)
31
+ return 200, decision.to_dict()
32
+
33
+ if tool in {"Read", "Write", "Edit", "MultiEdit"}:
34
+ file_path = str((input_data or {}).get("file_path", ""))
35
+ decision = evaluate_file_access(tool, file_path)
36
+ return 200, decision.to_dict()
37
+
38
+ if tool == "SupplyArtifact":
39
+ artifact = payload.get("artifact", {})
40
+ mode = str(payload.get("mode", "warn_and_run"))
41
+ decision = evaluate_supply_artifact(artifact, mode=mode)
42
+ return 200, decision.to_dict()
43
+
44
+ return 400, {
45
+ "status": "error",
46
+ "error_code": "INVALID_POLICY_INPUT",
47
+ "message": "Unsupported tool for policy evaluation",
48
+ }
49
+
50
+ def trust_review(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
51
+ file_path = str(payload.get("file_path", "settings.json"))
52
+ old_config = payload.get("old_config", {})
53
+ new_config = payload.get("new_config", {})
54
+ if not isinstance(old_config, dict) or not isinstance(new_config, dict):
55
+ return 400, {
56
+ "status": "error",
57
+ "error_code": "INVALID_TRUST_INPUT",
58
+ "message": "old_config and new_config must be objects",
59
+ }
60
+ review = review_config_change(file_path, old_config, new_config)
61
+ return 200, review
62
+
63
+ def evidence_ingest(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
64
+ run_id = str(payload.get("run_id", "")).strip()
65
+ required = ["tests", "security_scans", "diff_summary", "reproducibility", "unresolved_risks"]
66
+ missing = [key for key in required if key not in payload]
67
+
68
+ if not run_id:
69
+ return 400, {
70
+ "status": "error",
71
+ "error_code": "INVALID_EVIDENCE_INPUT",
72
+ "message": "run_id is required",
73
+ }
74
+ if missing:
75
+ return 400, {
76
+ "status": "error",
77
+ "error_code": "INVALID_EVIDENCE_INPUT",
78
+ "message": f"Missing required fields: {', '.join(missing)}",
79
+ }
80
+
81
+ path = create_evidence_pack(
82
+ self.project_dir,
83
+ run_id,
84
+ tests=payload.get("tests"),
85
+ security_scans=payload.get("security_scans"),
86
+ diff_summary=payload.get("diff_summary"),
87
+ reproducibility=payload.get("reproducibility"),
88
+ unresolved_risks=payload.get("unresolved_risks"),
89
+ )
90
+ return 202, {
91
+ "status": "accepted",
92
+ "run_id": run_id,
93
+ "evidence_path": os.path.relpath(path, self.project_dir),
94
+ }
95
+
96
+ def runtime_dispatch(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
97
+ runtime = str(payload.get("runtime", "")).strip()
98
+ idea = payload.get("idea", {})
99
+ if not runtime:
100
+ return 400, {
101
+ "status": "error",
102
+ "error_code": "INVALID_RUNTIME_INPUT",
103
+ "message": "runtime is required",
104
+ }
105
+ if not isinstance(idea, dict):
106
+ return 400, {
107
+ "status": "error",
108
+ "error_code": "INVALID_RUNTIME_INPUT",
109
+ "message": "idea must be an object",
110
+ }
111
+ result = dispatch_runtime(runtime, idea)
112
+ if result.get("status") == "error":
113
+ return 400, result
114
+ return 200, result
115
+
116
+ def registry_verify(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
117
+ artifact = payload.get("artifact", {})
118
+ mode = str(payload.get("mode", "warn_and_run"))
119
+ if not isinstance(artifact, dict):
120
+ return 400, {
121
+ "status": "error",
122
+ "error_code": "INVALID_REGISTRY_INPUT",
123
+ "message": "artifact must be an object",
124
+ }
125
+ decision = verify_artifact(artifact, mode=mode)
126
+ return 200, decision
127
+
128
+ def lab_jobs(self, payload: dict[str, Any]) -> tuple[int, dict[str, Any]]:
129
+ if not isinstance(payload, dict):
130
+ return 400, {
131
+ "status": "error",
132
+ "error_code": "INVALID_LAB_INPUT",
133
+ "message": "job payload must be an object",
134
+ }
135
+ result = run_pipeline(payload)
136
+ return 201 if result.get("status") in {"ready", "failed_evaluation"} else 400, result
137
+
138
+ def scoreboard_baseline(self) -> tuple[int, dict[str, Any]]:
139
+ return 200, {
140
+ "generated_at": datetime.now(timezone.utc).isoformat(),
141
+ "baseline": {
142
+ "safe_autonomy_rate": 0.0,
143
+ "pr_throughput": 0.0,
144
+ "adoption_velocity": 0.0,
145
+ },
146
+ "target_policy": "non-regression-or-better",
147
+ }
148
+
@@ -0,0 +1,17 @@
1
+ [package]
2
+ name = "omg-natives"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ description = "Native Rust acceleration for OMG hot paths"
6
+ license = "MIT"
7
+
8
+ [lib]
9
+ name = "omg_natives"
10
+ crate-type = ["cdylib", "rlib"]
11
+
12
+ [dependencies]
13
+ pyo3 = { version = "0.21", features = ["extension-module"] }
14
+
15
+ [profile.release]
16
+ opt-level = 3
17
+ lto = true
@@ -0,0 +1,5 @@
1
+ //! Clipboard access and manipulation.
2
+
3
+ pub fn placeholder() -> &'static str {
4
+ "not implemented"
5
+ }
@@ -0,0 +1,15 @@
1
+ //! Fast glob pattern matching for file discovery.
2
+
3
+ use pyo3::prelude::*;
4
+
5
+ /// Match files against a glob pattern starting from a base directory.
6
+ #[pyfunction]
7
+ pub fn glob_match(pattern: &str, base: &str) -> PyResult<Vec<String>> {
8
+ // Stub: full implementation will use globset crate
9
+ let _ = (pattern, base);
10
+ Ok(Vec::new())
11
+ }
12
+
13
+ pub fn placeholder() -> &'static str {
14
+ "not implemented"
15
+ }
@@ -0,0 +1,15 @@
1
+ //! Fast pattern matching for file content search.
2
+
3
+ use pyo3::prelude::*;
4
+
5
+ /// Search for a regex pattern in a file, returning matching lines.
6
+ #[pyfunction]
7
+ pub fn grep(pattern: &str, path: &str) -> PyResult<Vec<String>> {
8
+ // Stub: full implementation will use regex crate for ~10x speedup
9
+ let _ = (pattern, path);
10
+ Ok(Vec::new())
11
+ }
12
+
13
+ pub fn placeholder() -> &'static str {
14
+ "not implemented"
15
+ }
@@ -0,0 +1,15 @@
1
+ //! Syntax highlighting for code snippets.
2
+
3
+ use pyo3::prelude::*;
4
+
5
+ /// Highlight source code with ANSI escape codes.
6
+ #[pyfunction]
7
+ pub fn highlight_syntax(code: &str, language: &str) -> PyResult<String> {
8
+ // Stub: will use tree-sitter or syntect for fast highlighting
9
+ let _ = language;
10
+ Ok(code.to_string())
11
+ }
12
+
13
+ pub fn placeholder() -> &'static str {
14
+ "not implemented"
15
+ }
@@ -0,0 +1,14 @@
1
+ //! HTML parsing and tag stripping.
2
+
3
+ use pyo3::prelude::*;
4
+
5
+ /// Strip HTML tags from a string, returning plain text.
6
+ #[pyfunction]
7
+ pub fn strip_tags(html: &str) -> PyResult<String> {
8
+ // Stub: will use a fast state-machine parser
9
+ Ok(html.to_string())
10
+ }
11
+
12
+ pub fn placeholder() -> &'static str {
13
+ "not implemented"
14
+ }
@@ -0,0 +1,5 @@
1
+ //! Image processing and thumbnail generation.
2
+
3
+ pub fn placeholder() -> &'static str {
4
+ "not implemented"
5
+ }
@@ -0,0 +1,5 @@
1
+ //! Key management and cryptographic utilities.
2
+
3
+ pub fn placeholder() -> &'static str {
4
+ "not implemented"
5
+ }
@@ -0,0 +1,36 @@
1
+ //! OMG Natives — Rust acceleration for OMG hot paths.
2
+ //!
3
+ //! This crate provides high-performance implementations of CPU-intensive
4
+ //! operations used by OMG hooks and tools. When compiled and installed,
5
+ //! the Python `omg_natives` package will automatically use these native
6
+ //! implementations instead of the pure-Python fallbacks.
7
+
8
+ use pyo3::prelude::*;
9
+
10
+ pub mod grep;
11
+ pub mod shell;
12
+ pub mod text;
13
+ pub mod keys;
14
+ pub mod highlight;
15
+ pub mod glob;
16
+ pub mod task;
17
+ pub mod ps;
18
+ pub mod prof;
19
+ pub mod image;
20
+ pub mod clipboard;
21
+ pub mod html;
22
+
23
+ /// The main Python module entry point.
24
+ ///
25
+ /// When built with `maturin develop` or `maturin build`, this creates
26
+ /// the `omg_natives._native` extension module.
27
+ #[pymodule]
28
+ fn _native(m: &Bound<'_, PyModule>) -> PyResult<()> {
29
+ m.add("__version__", env!("CARGO_PKG_VERSION"))?;
30
+ m.add_function(wrap_pyfunction!(grep::grep, m)?)?;
31
+ m.add_function(wrap_pyfunction!(glob::glob_match, m)?)?;
32
+ m.add_function(wrap_pyfunction!(text::normalize, m)?)?;
33
+ m.add_function(wrap_pyfunction!(highlight::highlight_syntax, m)?)?;
34
+ m.add_function(wrap_pyfunction!(html::strip_tags, m)?)?;
35
+ Ok(())
36
+ }
@@ -0,0 +1,5 @@
1
+ //! Profiling and performance measurement utilities.
2
+
3
+ pub fn placeholder() -> &'static str {
4
+ "not implemented"
5
+ }
@@ -0,0 +1,5 @@
1
+ //! Process inspection and management.
2
+
3
+ pub fn placeholder() -> &'static str {
4
+ "not implemented"
5
+ }
@@ -0,0 +1,5 @@
1
+ //! Shell command execution and output parsing.
2
+
3
+ pub fn placeholder() -> &'static str {
4
+ "not implemented"
5
+ }
@@ -0,0 +1,5 @@
1
+ //! Task scheduling and parallel execution primitives.
2
+
3
+ pub fn placeholder() -> &'static str {
4
+ "not implemented"
5
+ }
@@ -0,0 +1,14 @@
1
+ //! Text normalization and processing utilities.
2
+
3
+ use pyo3::prelude::*;
4
+
5
+ /// Normalize text: strip whitespace, normalize line endings.
6
+ #[pyfunction]
7
+ pub fn normalize(text: &str) -> PyResult<String> {
8
+ // Stub: will provide fast Unicode normalization
9
+ Ok(text.to_string())
10
+ }
11
+
12
+ pub fn placeholder() -> &'static str {
13
+ "not implemented"
14
+ }