@trac3er/oh-my-god 2.0.3 → 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.
- package/.agents/skills/omg/AGENTS.fragment.md +5 -0
- package/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/.agents/skills/omg/codex-mcp.toml +4 -0
- package/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/.agents/skills/omg/health/SKILL.md +11 -0
- package/.agents/skills/omg/health/openai.yaml +11 -0
- package/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/.agents/skills/omg/vision/SKILL.md +11 -0
- package/.agents/skills/omg/vision/openai.yaml +11 -0
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/.claude-plugin/scripts/uninstall.sh +2 -2
- package/.mcp.json +20 -4
- package/CHANGELOG.md +10 -0
- package/OMG-setup.sh +9 -3
- package/OMG_COMPAT_CONTRACT.md +92 -0
- package/README.md +24 -4
- package/SECURITY.md +6 -0
- package/commands/OMG:api-twin.md +22 -0
- package/commands/OMG:preflight.md +26 -0
- package/commands/OMG:security-check.md +28 -0
- package/commands/__init__.py +1 -0
- package/control_plane/__init__.py +2 -0
- package/control_plane/openapi.yaml +228 -0
- package/control_plane/server.py +123 -0
- package/control_plane/service.py +185 -0
- package/dist/enterprise/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
- package/dist/enterprise/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
- package/dist/enterprise/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/health/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/health/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/dist/enterprise/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/dist/enterprise/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/dist/enterprise/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
- package/dist/enterprise/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
- package/dist/enterprise/bundle/.claude-plugin/marketplace.json +36 -0
- package/dist/enterprise/bundle/.claude-plugin/plugin.json +23 -0
- package/dist/enterprise/bundle/.mcp.json +40 -0
- package/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +92 -0
- package/dist/enterprise/bundle/registry/bundles/algorithms.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/api-twin.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/control-plane.yaml +61 -0
- package/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/health.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +97 -0
- package/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +53 -0
- package/dist/enterprise/bundle/registry/bundles/preflight.yaml +48 -0
- package/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +49 -0
- package/dist/enterprise/bundle/registry/bundles/robotics.yaml +45 -0
- package/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/dist/enterprise/bundle/registry/bundles/security-check.yaml +50 -0
- package/dist/enterprise/bundle/registry/bundles/tracebank.yaml +47 -0
- package/dist/enterprise/bundle/registry/bundles/vision.yaml +45 -0
- package/dist/enterprise/bundle/registry/omg-capability.schema.json +80 -0
- package/dist/enterprise/bundle/settings.json +381 -0
- package/dist/enterprise/manifest.json +255 -0
- package/dist/public/bundle/.agents/skills/omg/AGENTS.fragment.md +5 -0
- package/dist/public/bundle/.agents/skills/omg/algorithms/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/algorithms/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/api-twin/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/api-twin/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/codex-mcp.toml +4 -0
- package/dist/public/bundle/.agents/skills/omg/control-plane/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/control-plane/openai.yaml +14 -0
- package/dist/public/bundle/.agents/skills/omg/data-lineage/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/data-lineage/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/delta-classifier/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/delta-classifier/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/eval-gate/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/eval-gate/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/health/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/health/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/hook-governor/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/hook-governor/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/incident-replay/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/incident-replay/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/lsp-pack/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/lsp-pack/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/mcp-fabric/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/mcp-fabric/openai.yaml +13 -0
- package/dist/public/bundle/.agents/skills/omg/preflight/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/preflight/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/remote-supervisor/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/remote-supervisor/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/robotics/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/robotics/openai.yaml +11 -0
- package/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/security-check/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/security-check/openai.yaml +13 -0
- package/dist/public/bundle/.agents/skills/omg/tracebank/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/tracebank/openai.yaml +12 -0
- package/dist/public/bundle/.agents/skills/omg/vision/SKILL.md +11 -0
- package/dist/public/bundle/.agents/skills/omg/vision/openai.yaml +11 -0
- package/dist/public/bundle/.claude-plugin/marketplace.json +36 -0
- package/dist/public/bundle/.claude-plugin/plugin.json +23 -0
- package/dist/public/bundle/.mcp.json +40 -0
- package/dist/public/bundle/OMG_COMPAT_CONTRACT.md +92 -0
- package/dist/public/bundle/registry/bundles/algorithms.yaml +45 -0
- package/dist/public/bundle/registry/bundles/api-twin.yaml +48 -0
- package/dist/public/bundle/registry/bundles/control-plane.yaml +61 -0
- package/dist/public/bundle/registry/bundles/data-lineage.yaml +47 -0
- package/dist/public/bundle/registry/bundles/delta-classifier.yaml +47 -0
- package/dist/public/bundle/registry/bundles/eval-gate.yaml +47 -0
- package/dist/public/bundle/registry/bundles/health.yaml +45 -0
- package/dist/public/bundle/registry/bundles/hook-governor.yaml +97 -0
- package/dist/public/bundle/registry/bundles/incident-replay.yaml +47 -0
- package/dist/public/bundle/registry/bundles/lsp-pack.yaml +48 -0
- package/dist/public/bundle/registry/bundles/mcp-fabric.yaml +53 -0
- package/dist/public/bundle/registry/bundles/preflight.yaml +48 -0
- package/dist/public/bundle/registry/bundles/remote-supervisor.yaml +49 -0
- package/dist/public/bundle/registry/bundles/robotics.yaml +45 -0
- package/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/dist/public/bundle/registry/bundles/security-check.yaml +50 -0
- package/dist/public/bundle/registry/bundles/tracebank.yaml +47 -0
- package/dist/public/bundle/registry/bundles/vision.yaml +45 -0
- package/dist/public/bundle/registry/omg-capability.schema.json +80 -0
- package/dist/public/bundle/settings.json +379 -0
- package/dist/public/manifest.json +255 -0
- package/docs/assets/omg-hud.svg +32 -0
- package/docs/install/claude-code.md +31 -0
- package/docs/install/codex.md +29 -0
- package/docs/migration/native-adoption.md +57 -0
- package/docs/proof.md +55 -0
- package/docs/release-checklist.md +38 -0
- package/docs/transcripts/crazy.md +17 -0
- package/docs/transcripts/setup.md +25 -0
- package/hooks/policy_engine.py +38 -7
- package/hooks/post-write.py +1 -1
- package/hooks/prompt-enhancer.py +1 -1
- package/hooks/security_validators.py +75 -0
- package/hooks/setup_wizard.py +43 -8
- package/hooks/shadow_manager.py +28 -2
- package/package.json +1 -1
- package/plugins/README.md +3 -1
- package/plugins/__init__.py +1 -0
- package/plugins/advanced/commands/OMG:deep-plan.md +1 -1
- package/plugins/advanced/commands/OMG:security-review.md +10 -113
- package/plugins/advanced/commands/OMG:ship.md +1 -1
- package/plugins/advanced/plugin.json +1 -10
- package/plugins/core/plugin.json +25 -2
- package/pyproject.toml +38 -2
- package/registry/__init__.py +1 -0
- package/registry/bundles/algorithms.yaml +45 -0
- package/registry/bundles/api-twin.yaml +48 -0
- package/registry/bundles/control-plane.yaml +61 -0
- package/registry/bundles/data-lineage.yaml +47 -0
- package/registry/bundles/delta-classifier.yaml +47 -0
- package/registry/bundles/eval-gate.yaml +47 -0
- package/registry/bundles/health.yaml +45 -0
- package/registry/bundles/hook-governor.yaml +97 -0
- package/registry/bundles/incident-replay.yaml +47 -0
- package/registry/bundles/lsp-pack.yaml +48 -0
- package/registry/bundles/mcp-fabric.yaml +53 -0
- package/registry/bundles/preflight.yaml +48 -0
- package/registry/bundles/remote-supervisor.yaml +49 -0
- package/registry/bundles/robotics.yaml +45 -0
- package/registry/bundles/secure-worktree-pipeline.yaml +54 -0
- package/registry/bundles/security-check.yaml +50 -0
- package/registry/bundles/tracebank.yaml +47 -0
- package/registry/bundles/vision.yaml +45 -0
- package/registry/omg-capability.schema.json +80 -0
- package/registry/verify_artifact.py +90 -0
- package/runtime/adapters/claude.py +3 -0
- package/runtime/adapters/gpt.py +3 -0
- package/runtime/adapters/local.py +3 -0
- package/runtime/adoption.py +1 -1
- package/runtime/api_twin.py +179 -0
- package/runtime/asset_loader.py +62 -0
- package/runtime/compat.py +24 -3
- package/runtime/contract_compiler.py +847 -0
- package/runtime/data_lineage.py +73 -0
- package/runtime/delta_classifier.py +81 -0
- package/runtime/domain_packs.py +46 -0
- package/runtime/ecosystem.py +1 -1
- package/runtime/eval_gate.py +50 -0
- package/runtime/guide_assert.py +45 -0
- package/runtime/incident_replay.py +47 -0
- package/runtime/mcp_config_writers.py +147 -30
- package/runtime/mcp_memory_server.py +1 -1
- package/runtime/omg_compat_contract_snapshot.json +9 -8
- package/runtime/omg_contract_snapshot.json +9 -8
- package/runtime/omg_mcp_server.py +207 -0
- package/runtime/preflight.py +73 -0
- package/runtime/providers/codex_provider.py +2 -12
- package/runtime/providers/gemini_provider.py +2 -21
- package/runtime/providers/kimi_provider.py +2 -21
- package/runtime/remote_supervisor.py +64 -0
- package/runtime/runtime_profile.py +61 -0
- package/runtime/security_check.py +464 -0
- package/runtime/subagent_dispatcher.py +117 -10
- package/runtime/team_router.py +3 -1
- package/runtime/tracebank.py +53 -0
- package/runtime/untrusted_content.py +102 -0
- package/scripts/omg.py +360 -2
- package/settings.json +81 -18
- package/tools/python_repl.py +33 -3
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from collections.abc import AsyncIterator
|
|
5
|
+
from contextlib import asynccontextmanager
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from runtime.asset_loader import resolve_asset
|
|
11
|
+
|
|
12
|
+
_MCP_IMPORT_ERROR: ModuleNotFoundError | None = None
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from fastmcp import FastMCP
|
|
16
|
+
except ModuleNotFoundError as exc:
|
|
17
|
+
_MCP_IMPORT_ERROR = exc
|
|
18
|
+
|
|
19
|
+
def _passthrough_decorator(*_args: Any, **_kwargs: Any):
|
|
20
|
+
def decorator(func: Any) -> Any:
|
|
21
|
+
return func
|
|
22
|
+
|
|
23
|
+
return decorator
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class _StubPrompt:
|
|
27
|
+
name: str
|
|
28
|
+
description: str
|
|
29
|
+
handler: Any
|
|
30
|
+
|
|
31
|
+
@dataclass
|
|
32
|
+
class _StubResource:
|
|
33
|
+
uri: str
|
|
34
|
+
name: str
|
|
35
|
+
description: str
|
|
36
|
+
mime_type: str
|
|
37
|
+
handler: Any
|
|
38
|
+
|
|
39
|
+
class FastMCP: # type: ignore[override]
|
|
40
|
+
def __init__(self, *_args: Any, **_kwargs: Any) -> None:
|
|
41
|
+
self._import_error = _MCP_IMPORT_ERROR
|
|
42
|
+
self.instructions = str(_kwargs.get("instructions", ""))
|
|
43
|
+
self._prompts: list[_StubPrompt] = []
|
|
44
|
+
self._resources: dict[str, _StubResource] = {}
|
|
45
|
+
|
|
46
|
+
def tool(self, *_args: Any, **_kwargs: Any):
|
|
47
|
+
return _passthrough_decorator(*_args, **_kwargs)
|
|
48
|
+
|
|
49
|
+
def prompt(self, *, name: str, description: str = ""):
|
|
50
|
+
def decorator(func: Any) -> Any:
|
|
51
|
+
self._prompts.append(_StubPrompt(name=name, description=description, handler=func))
|
|
52
|
+
return func
|
|
53
|
+
|
|
54
|
+
return decorator
|
|
55
|
+
|
|
56
|
+
def resource(
|
|
57
|
+
self,
|
|
58
|
+
uri: str,
|
|
59
|
+
*,
|
|
60
|
+
name: str = "",
|
|
61
|
+
description: str = "",
|
|
62
|
+
mime_type: str = "text/plain",
|
|
63
|
+
):
|
|
64
|
+
def decorator(func: Any) -> Any:
|
|
65
|
+
self._resources[uri] = _StubResource(
|
|
66
|
+
uri=uri,
|
|
67
|
+
name=name,
|
|
68
|
+
description=description,
|
|
69
|
+
mime_type=mime_type,
|
|
70
|
+
handler=func,
|
|
71
|
+
)
|
|
72
|
+
return func
|
|
73
|
+
|
|
74
|
+
return decorator
|
|
75
|
+
|
|
76
|
+
async def list_prompts(self) -> list[_StubPrompt]:
|
|
77
|
+
return list(self._prompts)
|
|
78
|
+
|
|
79
|
+
async def list_resources(self) -> list[_StubResource]:
|
|
80
|
+
return list(self._resources.values())
|
|
81
|
+
|
|
82
|
+
async def read_resource(self, uri: str) -> Any:
|
|
83
|
+
resource = self._resources[str(uri)]
|
|
84
|
+
return resource.handler()
|
|
85
|
+
|
|
86
|
+
def run(self, *_args: Any, **_kwargs: Any) -> None:
|
|
87
|
+
raise RuntimeError("fastmcp is required to run the OMG MCP server") from self._import_error
|
|
88
|
+
|
|
89
|
+
FastMCP.__module__ = "fastmcp"
|
|
90
|
+
|
|
91
|
+
from control_plane.service import ControlPlaneService
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
MCP_INSTRUCTIONS = (
|
|
95
|
+
"OMG production control plane MCP. Prefer omg-control prompts and resources for "
|
|
96
|
+
"contract, release-readiness, and governance context before using direct tools."
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _root_dir() -> Path:
|
|
101
|
+
return Path(__file__).resolve().parents[1]
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@asynccontextmanager
|
|
105
|
+
async def lifespan(_: object) -> AsyncIterator[None]:
|
|
106
|
+
yield
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
mcp = FastMCP("OMG Control MCP", lifespan=lifespan, instructions=MCP_INSTRUCTIONS)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _service() -> ControlPlaneService:
|
|
113
|
+
return ControlPlaneService(project_dir=os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd()))
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _read_repo_text(rel_path: str) -> str:
|
|
117
|
+
return resolve_asset(rel_path).read_text(encoding="utf-8")
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@mcp.tool()
|
|
121
|
+
def omg_policy_evaluate(tool: str, input: dict[str, Any]) -> dict[str, Any]:
|
|
122
|
+
_status, payload = _service().policy_evaluate({"tool": tool, "input": input})
|
|
123
|
+
return payload
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@mcp.tool()
|
|
127
|
+
def omg_trust_review(file_path: str, old_config: dict[str, Any], new_config: dict[str, Any]) -> dict[str, Any]:
|
|
128
|
+
_status, payload = _service().trust_review({"file_path": file_path, "old_config": old_config, "new_config": new_config})
|
|
129
|
+
return payload
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@mcp.tool()
|
|
133
|
+
def omg_evidence_ingest(
|
|
134
|
+
run_id: str,
|
|
135
|
+
tests: list[dict[str, Any]],
|
|
136
|
+
security_scans: list[dict[str, Any]],
|
|
137
|
+
diff_summary: dict[str, Any],
|
|
138
|
+
reproducibility: dict[str, Any],
|
|
139
|
+
unresolved_risks: list[str],
|
|
140
|
+
provenance: list[dict[str, Any]] | None = None,
|
|
141
|
+
trust_scores: dict[str, Any] | None = None,
|
|
142
|
+
api_twin: dict[str, Any] | None = None,
|
|
143
|
+
) -> dict[str, Any]:
|
|
144
|
+
_status, payload = _service().evidence_ingest(
|
|
145
|
+
{
|
|
146
|
+
"run_id": run_id,
|
|
147
|
+
"tests": tests,
|
|
148
|
+
"security_scans": security_scans,
|
|
149
|
+
"diff_summary": diff_summary,
|
|
150
|
+
"reproducibility": reproducibility,
|
|
151
|
+
"unresolved_risks": unresolved_risks,
|
|
152
|
+
"provenance": provenance or [],
|
|
153
|
+
"trust_scores": trust_scores or {},
|
|
154
|
+
"api_twin": api_twin or {},
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
return payload
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@mcp.tool()
|
|
161
|
+
def omg_runtime_dispatch(runtime: str, idea: dict[str, Any]) -> dict[str, Any]:
|
|
162
|
+
_status, payload = _service().runtime_dispatch({"runtime": runtime, "idea": idea})
|
|
163
|
+
return payload
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
@mcp.tool()
|
|
167
|
+
def omg_security_check(scope: str = ".", include_live_enrichment: bool = False) -> dict[str, Any]:
|
|
168
|
+
_status, payload = _service().security_check({"scope": scope, "include_live_enrichment": include_live_enrichment})
|
|
169
|
+
return payload
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@mcp.tool()
|
|
173
|
+
def omg_guide_assert(candidate: str, rules: dict[str, Any]) -> dict[str, Any]:
|
|
174
|
+
_status, payload = _service().guide_assert({"candidate": candidate, "rules": rules})
|
|
175
|
+
return payload
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@mcp.prompt(name="omg_contract_summary", description="Summarize the OMG production contract and generated host outputs")
|
|
179
|
+
def omg_contract_summary(channel: str = "public") -> str:
|
|
180
|
+
return (
|
|
181
|
+
"Summarize the OMG production control plane contract for channel "
|
|
182
|
+
f"`{channel}`. Include execution_contract, host_compilation_rules, "
|
|
183
|
+
"MCP resources, prompts, and release-readiness expectations."
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@mcp.resource("resource://omg/contract", name="omg_contract", description="Canonical OMG production contract document", mime_type="text/markdown")
|
|
188
|
+
def omg_contract_resource() -> str:
|
|
189
|
+
return _read_repo_text("OMG_COMPAT_CONTRACT.md")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
@mcp.resource(
|
|
193
|
+
"resource://omg/release-checklist",
|
|
194
|
+
name="omg_release_checklist",
|
|
195
|
+
description="Public release checklist for OMG",
|
|
196
|
+
mime_type="text/markdown",
|
|
197
|
+
)
|
|
198
|
+
def omg_release_checklist_resource() -> str:
|
|
199
|
+
return _read_repo_text("docs/release-checklist.md")
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def run_server() -> None:
|
|
203
|
+
mcp.run(transport="stdio")
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if __name__ == "__main__":
|
|
207
|
+
run_server()
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Structured preflight routing for OMG."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from runtime.delta_classifier import classify_project_changes
|
|
5
|
+
from runtime.tracebank import record_trace
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def run_preflight(project_dir: str, *, goal: str) -> dict[str, Any]:
|
|
10
|
+
lowered = goal.lower()
|
|
11
|
+
task_class = "implementation"
|
|
12
|
+
risk_class = "medium"
|
|
13
|
+
route = "teams"
|
|
14
|
+
delta = classify_project_changes(project_dir, goal=goal)
|
|
15
|
+
categories = set(delta["categories"])
|
|
16
|
+
domain_packs = [category for category in delta["categories"] if category in {"robotics", "vision", "algorithms", "health"}]
|
|
17
|
+
|
|
18
|
+
if categories & {"auth", "payment", "health", "compliance"}:
|
|
19
|
+
task_class = "security"
|
|
20
|
+
risk_class = "high"
|
|
21
|
+
route = "security-check"
|
|
22
|
+
elif categories & {"api"} or any(token in lowered for token in ("openapi", "swagger", "postman", "contract", "fixture", "replay")):
|
|
23
|
+
task_class = "contract"
|
|
24
|
+
route = "api-twin"
|
|
25
|
+
elif any(token in lowered for token in ("auth", "secret", "security", "token", "injection")):
|
|
26
|
+
task_class = "security"
|
|
27
|
+
risk_class = "high"
|
|
28
|
+
route = "security-check"
|
|
29
|
+
elif any(token in lowered for token in ("full stack", "frontend and backend", "dashboard", "orchestrate")):
|
|
30
|
+
task_class = "orchestration"
|
|
31
|
+
risk_class = "high"
|
|
32
|
+
route = "crazy"
|
|
33
|
+
|
|
34
|
+
trace = record_trace(
|
|
35
|
+
project_dir,
|
|
36
|
+
trace_type="preflight",
|
|
37
|
+
route=route,
|
|
38
|
+
status="ok",
|
|
39
|
+
plan={"goal": goal, "delta_categories": delta["categories"]},
|
|
40
|
+
verify={"risk_class": risk_class},
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
"schema": "PreflightResult",
|
|
45
|
+
"project_dir": project_dir,
|
|
46
|
+
"goal": goal,
|
|
47
|
+
"task_class": task_class,
|
|
48
|
+
"risk_class": risk_class,
|
|
49
|
+
"route": route,
|
|
50
|
+
"required_tools": _required_tools(route),
|
|
51
|
+
"required_mcps": ["omg-control"] if route in {"security-check", "api-twin", "crazy"} else [],
|
|
52
|
+
"missing_constraints": [],
|
|
53
|
+
"evidence_plan": _evidence_plan(route),
|
|
54
|
+
"delta_classification": delta,
|
|
55
|
+
"domain_packs": domain_packs,
|
|
56
|
+
"trace": {"trace_id": trace["trace_id"], "path": trace["path"]},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _required_tools(route: str) -> list[str]:
|
|
61
|
+
return {
|
|
62
|
+
"security-check": ["security"],
|
|
63
|
+
"api-twin": ["api-twin"],
|
|
64
|
+
"crazy": ["teams", "ccg"],
|
|
65
|
+
}.get(route, ["teams"])
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _evidence_plan(route: str) -> list[str]:
|
|
69
|
+
return {
|
|
70
|
+
"security-check": ["security findings", "provenance"],
|
|
71
|
+
"api-twin": ["fixture fidelity", "live verification"],
|
|
72
|
+
"crazy": ["verification output", "evidence pack"],
|
|
73
|
+
}.get(route, ["verification output"])
|
|
@@ -11,6 +11,7 @@ import uuid
|
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
13
|
from runtime.cli_provider import CLIProvider, register_provider
|
|
14
|
+
from runtime.mcp_config_writers import write_codex_mcp_config
|
|
14
15
|
from runtime.tmux_session_manager import TmuxSessionManager
|
|
15
16
|
|
|
16
17
|
_logger = logging.getLogger(__name__)
|
|
@@ -94,18 +95,7 @@ class CodexProvider(CLIProvider):
|
|
|
94
95
|
|
|
95
96
|
def write_mcp_config(self, server_url: str, server_name: str = "memory-server") -> None:
|
|
96
97
|
"""Write an MCP server entry to ``~/.codex/config.toml``."""
|
|
97
|
-
config_path
|
|
98
|
-
os.makedirs(os.path.dirname(config_path), exist_ok=True)
|
|
99
|
-
|
|
100
|
-
entry = (
|
|
101
|
-
f'[mcp_servers."{server_name}"]\n'
|
|
102
|
-
f'url = "{server_url}"\n'
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
# Append or create
|
|
106
|
-
mode = "a" if os.path.exists(config_path) else "w"
|
|
107
|
-
with open(config_path, mode) as fh:
|
|
108
|
-
fh.write(entry)
|
|
98
|
+
write_codex_mcp_config(server_url, server_name, config_path=self.get_config_path())
|
|
109
99
|
|
|
110
100
|
|
|
111
101
|
# -- auto-register on import -----------------------------------------------
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import json
|
|
6
5
|
import logging
|
|
7
6
|
import os
|
|
8
7
|
import shlex
|
|
@@ -12,6 +11,7 @@ import uuid
|
|
|
12
11
|
from typing import Any
|
|
13
12
|
|
|
14
13
|
from runtime.cli_provider import CLIProvider, register_provider
|
|
14
|
+
from runtime.mcp_config_writers import write_gemini_mcp_config
|
|
15
15
|
from runtime.tmux_session_manager import TmuxSessionManager
|
|
16
16
|
|
|
17
17
|
_logger = logging.getLogger(__name__)
|
|
@@ -102,26 +102,7 @@ class GeminiProvider(CLIProvider):
|
|
|
102
102
|
Uses JSON format with ``mcpServers`` key and ``httpUrl`` field,
|
|
103
103
|
merging into any existing configuration.
|
|
104
104
|
"""
|
|
105
|
-
config_path
|
|
106
|
-
os.makedirs(os.path.dirname(config_path), exist_ok=True)
|
|
107
|
-
|
|
108
|
-
# Load existing config or start fresh
|
|
109
|
-
existing: dict[str, Any] = {} # pyright: ignore[reportExplicitAny]
|
|
110
|
-
if os.path.exists(config_path):
|
|
111
|
-
with open(config_path) as fh:
|
|
112
|
-
try:
|
|
113
|
-
existing = json.load(fh)
|
|
114
|
-
except (json.JSONDecodeError, ValueError):
|
|
115
|
-
existing = {}
|
|
116
|
-
|
|
117
|
-
# Ensure mcpServers dict exists
|
|
118
|
-
if "mcpServers" not in existing:
|
|
119
|
-
existing["mcpServers"] = {}
|
|
120
|
-
|
|
121
|
-
existing["mcpServers"][server_name] = {"httpUrl": server_url}
|
|
122
|
-
|
|
123
|
-
with open(config_path, "w") as fh:
|
|
124
|
-
json.dump(existing, fh, indent=2)
|
|
105
|
+
write_gemini_mcp_config(server_url, server_name, config_path=self.get_config_path())
|
|
125
106
|
|
|
126
107
|
|
|
127
108
|
# -- auto-register on import -----------------------------------------------
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import json
|
|
6
5
|
import logging
|
|
7
6
|
import os
|
|
8
7
|
import shlex
|
|
@@ -12,6 +11,7 @@ import uuid
|
|
|
12
11
|
from typing import Any
|
|
13
12
|
|
|
14
13
|
from runtime.cli_provider import CLIProvider, register_provider
|
|
14
|
+
from runtime.mcp_config_writers import write_kimi_mcp_config
|
|
15
15
|
from runtime.tmux_session_manager import TmuxSessionManager
|
|
16
16
|
|
|
17
17
|
_logger = logging.getLogger(__name__)
|
|
@@ -125,26 +125,7 @@ class KimiCodeProvider(CLIProvider):
|
|
|
125
125
|
Uses standard ``mcpServers`` JSON format with ``type: "http"`` and ``url`` field,
|
|
126
126
|
merging into any existing configuration.
|
|
127
127
|
"""
|
|
128
|
-
config_path
|
|
129
|
-
os.makedirs(os.path.dirname(config_path), exist_ok=True)
|
|
130
|
-
|
|
131
|
-
# Load existing config or start fresh
|
|
132
|
-
existing: dict[str, Any] = {} # pyright: ignore[reportExplicitAny]
|
|
133
|
-
if os.path.exists(config_path):
|
|
134
|
-
with open(config_path) as fh:
|
|
135
|
-
try:
|
|
136
|
-
existing = json.load(fh)
|
|
137
|
-
except (json.JSONDecodeError, ValueError):
|
|
138
|
-
existing = {}
|
|
139
|
-
|
|
140
|
-
# Ensure mcpServers dict exists
|
|
141
|
-
if "mcpServers" not in existing:
|
|
142
|
-
existing["mcpServers"] = {}
|
|
143
|
-
|
|
144
|
-
existing["mcpServers"][server_name] = {"type": "http", "url": server_url}
|
|
145
|
-
|
|
146
|
-
with open(config_path, "w") as fh:
|
|
147
|
-
json.dump(existing, fh, indent=2)
|
|
128
|
+
write_kimi_mcp_config(server_url, server_name, config_path=self.get_config_path())
|
|
148
129
|
|
|
149
130
|
|
|
150
131
|
# -- auto-register on import -----------------------------------------------
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Local-only authenticated supervisor sessions."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import base64
|
|
5
|
+
from datetime import datetime, timezone
|
|
6
|
+
import hashlib
|
|
7
|
+
import hmac
|
|
8
|
+
import json
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Any
|
|
11
|
+
from uuid import uuid4
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _now() -> str:
|
|
15
|
+
return datetime.now(timezone.utc).isoformat()
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def issue_local_supervisor_session(project_dir: str, *, worker_id: str, shared_secret: str) -> dict[str, Any]:
|
|
19
|
+
session_id = f"session-{uuid4().hex}"
|
|
20
|
+
issued_at = _now()
|
|
21
|
+
token_payload = {
|
|
22
|
+
"session_id": session_id,
|
|
23
|
+
"worker_id": worker_id,
|
|
24
|
+
"issued_at": issued_at,
|
|
25
|
+
}
|
|
26
|
+
payload_json = json.dumps(token_payload, sort_keys=True, separators=(",", ":"))
|
|
27
|
+
signature = hmac.new(shared_secret.encode("utf-8"), payload_json.encode("utf-8"), hashlib.sha256).hexdigest()
|
|
28
|
+
token = base64.urlsafe_b64encode(
|
|
29
|
+
json.dumps({"payload": token_payload, "signature": signature}, sort_keys=True, separators=(",", ":")).encode("utf-8")
|
|
30
|
+
).decode("ascii")
|
|
31
|
+
|
|
32
|
+
result = {
|
|
33
|
+
"schema": "RemoteSupervisorSession",
|
|
34
|
+
"status": "ok",
|
|
35
|
+
"session_id": session_id,
|
|
36
|
+
"worker_id": worker_id,
|
|
37
|
+
"issued_at": issued_at,
|
|
38
|
+
"local_only": True,
|
|
39
|
+
"token": token,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
rel_path = Path(".omg") / "supervisor" / "sessions" / f"{session_id}.json"
|
|
43
|
+
path = Path(project_dir) / rel_path
|
|
44
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
45
|
+
path.write_text(json.dumps({k: v for k, v in result.items() if k != "token"}, indent=2, ensure_ascii=True) + "\n", encoding="utf-8")
|
|
46
|
+
result["path"] = rel_path.as_posix()
|
|
47
|
+
return result
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def verify_local_supervisor_token(token: str, *, shared_secret: str) -> dict[str, Any]:
|
|
51
|
+
decoded = json.loads(base64.urlsafe_b64decode(token.encode("ascii")).decode("utf-8"))
|
|
52
|
+
payload = decoded["payload"]
|
|
53
|
+
payload_json = json.dumps(payload, sort_keys=True, separators=(",", ":"))
|
|
54
|
+
signature = str(decoded["signature"])
|
|
55
|
+
expected = hmac.new(shared_secret.encode("utf-8"), payload_json.encode("utf-8"), hashlib.sha256).hexdigest()
|
|
56
|
+
status = "ok" if hmac.compare_digest(signature, expected) else "error"
|
|
57
|
+
return {
|
|
58
|
+
"schema": "RemoteSupervisorTokenVerification",
|
|
59
|
+
"status": status,
|
|
60
|
+
"session_id": str(payload["session_id"]),
|
|
61
|
+
"worker_id": str(payload["worker_id"]),
|
|
62
|
+
"issued_at": str(payload["issued_at"]),
|
|
63
|
+
"local_only": True,
|
|
64
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Runtime profile loading and parallelism budgets."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import yaml
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
PROFILE_PRESETS: dict[str, dict[str, Any]] = {
|
|
11
|
+
"eco": {"profile": "eco", "max_workers": 2, "background_polling": False},
|
|
12
|
+
"balanced": {"profile": "balanced", "max_workers": 3, "background_polling": False},
|
|
13
|
+
"turbo": {"profile": "turbo", "max_workers": 5, "background_polling": True},
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def load_runtime_profile(project_dir: str) -> dict[str, Any]:
|
|
18
|
+
runtime_path = Path(project_dir) / ".omg" / "runtime.yaml"
|
|
19
|
+
profile_name = "balanced"
|
|
20
|
+
if runtime_path.exists():
|
|
21
|
+
try:
|
|
22
|
+
payload = yaml.safe_load(runtime_path.read_text(encoding="utf-8")) or {}
|
|
23
|
+
except Exception:
|
|
24
|
+
payload = {}
|
|
25
|
+
if isinstance(payload, dict):
|
|
26
|
+
candidate = str(payload.get("profile", profile_name)).strip()
|
|
27
|
+
if candidate in PROFILE_PRESETS:
|
|
28
|
+
profile_name = candidate
|
|
29
|
+
return dict(PROFILE_PRESETS[profile_name])
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def resolve_parallel_workers(project_dir: str, *, requested_workers: int) -> int:
|
|
33
|
+
profile = load_runtime_profile(project_dir)
|
|
34
|
+
max_workers = int(profile["max_workers"])
|
|
35
|
+
cli_cap = _load_cli_parallel_cap(project_dir)
|
|
36
|
+
if cli_cap is not None:
|
|
37
|
+
max_workers = min(max_workers, cli_cap)
|
|
38
|
+
return max(1, min(requested_workers, max_workers))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _load_cli_parallel_cap(project_dir: str) -> int | None:
|
|
42
|
+
config_path = Path(project_dir) / ".omg" / "state" / "cli-config.yaml"
|
|
43
|
+
if not config_path.exists():
|
|
44
|
+
return None
|
|
45
|
+
try:
|
|
46
|
+
payload = yaml.safe_load(config_path.read_text(encoding="utf-8")) or {}
|
|
47
|
+
except Exception:
|
|
48
|
+
return None
|
|
49
|
+
if not isinstance(payload, dict):
|
|
50
|
+
return None
|
|
51
|
+
cli_configs = payload.get("cli_configs", {})
|
|
52
|
+
if not isinstance(cli_configs, dict):
|
|
53
|
+
return None
|
|
54
|
+
caps = []
|
|
55
|
+
for config in cli_configs.values():
|
|
56
|
+
if not isinstance(config, dict):
|
|
57
|
+
continue
|
|
58
|
+
value = config.get("max_parallel_agents")
|
|
59
|
+
if isinstance(value, int) and value > 0:
|
|
60
|
+
caps.append(value)
|
|
61
|
+
return min(caps) if caps else None
|