@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,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
+ }
@@ -3,11 +3,15 @@ from __future__ import annotations
3
3
 
4
4
  import ast
5
5
  from collections import Counter
6
+ from hashlib import sha256
7
+ import json
6
8
  from pathlib import Path
7
9
  import subprocess
8
10
  from typing import Any
9
11
 
10
12
  from hooks.security_validators import ensure_path_within_dir
13
+ from runtime.delta_classifier import classify_project_changes
14
+ from runtime.tracebank import record_trace
11
15
  from plugins.dephealth.cve_scanner import scan_for_cves
12
16
  from plugins.dephealth.manifest_detector import detect_manifests
13
17
  from plugins.dephealth.vuln_analyzer import analyze_reachability
@@ -33,9 +37,11 @@ def run_security_check(
33
37
  project_dir: str,
34
38
  scope: str = ".",
35
39
  include_live_enrichment: bool = False,
40
+ external_inputs: list[dict[str, Any]] | None = None,
36
41
  ) -> dict[str, Any]:
37
42
  scope_path = _resolve_scope(project_dir, scope)
38
43
  findings: list[dict[str, Any]] = []
44
+ manifests = detect_manifests(str(scope_path))
39
45
 
40
46
  findings.extend(_scan_python_ast(scope_path))
41
47
  findings.extend(_scan_dependency_health(scope_path, include_live_enrichment))
@@ -44,6 +50,33 @@ def run_security_check(
44
50
  severity_counts = Counter(finding["severity"] for finding in findings)
45
51
  source_counts = Counter(finding["source"] for finding in findings)
46
52
  relative_scope = _display_scope(project_dir, scope_path)
53
+ delta = classify_project_changes(project_dir, touched_files=[relative_scope], goal="security check")
54
+ provenance = _build_provenance(
55
+ scope=relative_scope,
56
+ manifests=manifests.manifests,
57
+ findings=findings,
58
+ include_live_enrichment=include_live_enrichment,
59
+ external_inputs=external_inputs or [],
60
+ )
61
+ trust_scores = _build_trust_scores(findings)
62
+ trace = record_trace(
63
+ project_dir,
64
+ trace_type="security-check",
65
+ route="security-check",
66
+ status="ok",
67
+ plan={"scope": relative_scope, "delta_categories": delta["categories"]},
68
+ verify={"finding_count": len(findings)},
69
+ failures=[],
70
+ rejections=[],
71
+ )
72
+ evidence_path = _write_evidence_record(
73
+ project_dir,
74
+ scope=relative_scope,
75
+ findings=findings,
76
+ provenance=provenance,
77
+ trust_scores=trust_scores,
78
+ include_live_enrichment=include_live_enrichment,
79
+ )
47
80
  return {
48
81
  "schema": "SecurityCheckResult",
49
82
  "status": "ok",
@@ -54,9 +87,14 @@ def run_security_check(
54
87
  "by_severity": dict(sorted(severity_counts.items())),
55
88
  "by_source": dict(sorted(source_counts.items())),
56
89
  "live_enrichment": include_live_enrichment,
90
+ "scan_status": "completed",
91
+ "manifest_count": len(manifests.manifests),
92
+ "delta_categories": delta["categories"],
57
93
  },
58
- "provenance": [],
59
- "trust_scores": {},
94
+ "provenance": provenance,
95
+ "trust_scores": trust_scores,
96
+ "evidence": {"path": evidence_path},
97
+ "trace": {"trace_id": trace["trace_id"], "path": trace["path"]},
60
98
  }
61
99
 
62
100
 
@@ -345,3 +383,82 @@ def _finding(
345
383
  "recommendation": recommendation,
346
384
  "message": message,
347
385
  }
386
+
387
+
388
+ def _build_provenance(
389
+ *,
390
+ scope: str,
391
+ manifests: list[Any],
392
+ findings: list[dict[str, Any]],
393
+ include_live_enrichment: bool,
394
+ external_inputs: list[dict[str, Any]],
395
+ ) -> list[dict[str, Any]]:
396
+ provenance = [
397
+ {
398
+ "source": "bandit-lite",
399
+ "scope": scope,
400
+ "mode": "static",
401
+ "finding_count": len([finding for finding in findings if finding["source"] == "bandit-lite"]),
402
+ },
403
+ {
404
+ "source": "manifest-detector",
405
+ "scope": scope,
406
+ "manifest_count": len(manifests),
407
+ "mode": "live" if include_live_enrichment else "offline",
408
+ },
409
+ ]
410
+ if include_live_enrichment:
411
+ provenance.append(
412
+ {
413
+ "source": "osv",
414
+ "scope": scope,
415
+ "mode": "live-enrichment",
416
+ }
417
+ )
418
+ if external_inputs:
419
+ provenance.append(
420
+ {
421
+ "source": "external-content",
422
+ "scope": scope,
423
+ "mode": "zero-trust",
424
+ "count": len(external_inputs),
425
+ }
426
+ )
427
+ return provenance
428
+
429
+
430
+ def _build_trust_scores(findings: list[dict[str, Any]]) -> dict[str, float]:
431
+ if not findings:
432
+ return {"overall": 1.0}
433
+ weighted = 0.0
434
+ for finding in findings:
435
+ severity = finding.get("severity", "medium")
436
+ weighted += {"critical": 0.4, "high": 0.25, "medium": 0.1, "low": 0.05}.get(str(severity), 0.1)
437
+ overall = max(0.0, round(1.0 - min(weighted, 0.95), 3))
438
+ return {"overall": overall}
439
+
440
+
441
+ def _write_evidence_record(
442
+ project_dir: str,
443
+ *,
444
+ scope: str,
445
+ findings: list[dict[str, Any]],
446
+ provenance: list[dict[str, Any]],
447
+ trust_scores: dict[str, float],
448
+ include_live_enrichment: bool,
449
+ ) -> str:
450
+ rel_name = f"security-check-{sha256(scope.encode('utf-8')).hexdigest()[:12]}.json"
451
+ rel_path = Path(".omg") / "evidence" / rel_name
452
+ path = Path(project_dir) / rel_path
453
+ path.parent.mkdir(parents=True, exist_ok=True)
454
+ payload = {
455
+ "schema": "SecurityCheckEvidence",
456
+ "scope": scope,
457
+ "scan_status": "completed",
458
+ "live_enrichment": include_live_enrichment,
459
+ "findings": findings,
460
+ "provenance": provenance,
461
+ "trust_scores": trust_scores,
462
+ }
463
+ path.write_text(json.dumps(payload, indent=2, ensure_ascii=True) + "\n", encoding="utf-8")
464
+ return rel_path.as_posix()
@@ -0,0 +1,53 @@
1
+ """Structured trace capture for OMG routes and release evidence."""
2
+ from __future__ import annotations
3
+
4
+ from datetime import datetime, timezone
5
+ import json
6
+ from pathlib import Path
7
+ from typing import Any
8
+ from uuid import uuid4
9
+
10
+
11
+ TRACEBANK_REL_PATH = Path(".omg") / "tracebank" / "events.jsonl"
12
+
13
+
14
+ def _now() -> str:
15
+ return datetime.now(timezone.utc).isoformat()
16
+
17
+
18
+ def record_trace(
19
+ project_dir: str,
20
+ *,
21
+ trace_type: str,
22
+ route: str,
23
+ status: str,
24
+ plan: dict[str, Any] | None = None,
25
+ patch: dict[str, Any] | None = None,
26
+ verify: dict[str, Any] | None = None,
27
+ failures: list[dict[str, Any]] | None = None,
28
+ rejections: list[dict[str, Any]] | None = None,
29
+ metadata: dict[str, Any] | None = None,
30
+ ) -> dict[str, Any]:
31
+ trace_id = f"trace-{uuid4().hex}"
32
+ record = {
33
+ "schema": "TracebankRecord",
34
+ "trace_id": trace_id,
35
+ "recorded_at": _now(),
36
+ "trace_type": trace_type,
37
+ "route": route,
38
+ "status": status,
39
+ "plan": plan or {},
40
+ "patch": patch or {},
41
+ "verify": verify or {},
42
+ "failures": failures or [],
43
+ "rejections": rejections or [],
44
+ "metadata": metadata or {},
45
+ }
46
+
47
+ path = Path(project_dir) / TRACEBANK_REL_PATH
48
+ path.parent.mkdir(parents=True, exist_ok=True)
49
+ with path.open("a", encoding="utf-8") as handle:
50
+ handle.write(json.dumps(record, ensure_ascii=True) + "\n")
51
+
52
+ record["path"] = TRACEBANK_REL_PATH.as_posix()
53
+ return record
package/scripts/omg.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env python3
2
- """OMG 2.0.4 CLI entrypoint.
2
+ """OMG 2.0.5 CLI entrypoint.
3
3
 
4
4
  Implements practical command-line flows for:
5
5
  - omg ship
@@ -33,14 +33,19 @@ from hooks.trust_review import review_config_change, write_trust_manifest
33
33
  from lab.pipeline import publish_artifact, run_pipeline
34
34
  from runtime.dispatcher import dispatch_runtime
35
35
  from runtime.api_twin import ingest_contract, record_fixture, serve_fixture, verify_fixture
36
+ from runtime.data_lineage import build_lineage_manifest
37
+ from runtime.eval_gate import evaluate_trace
38
+ from runtime.incident_replay import build_incident_pack
36
39
  from runtime.domain_packs import get_domain_pack_contract
37
40
  from runtime.preflight import run_preflight
41
+ from runtime.remote_supervisor import issue_local_supervisor_session, verify_local_supervisor_token
38
42
  from runtime.security_check import run_security_check
39
43
  from runtime.contract_compiler import (
40
44
  build_release_readiness,
41
45
  compile_contract_outputs,
42
46
  validate_contract_registry,
43
47
  )
48
+ from runtime.tracebank import record_trace
44
49
  from runtime.compat import (
45
50
  DEFAULT_CONTRACT_SNAPSHOT_PATH,
46
51
  DEFAULT_GAP_REPORT_PATH,
@@ -130,14 +135,55 @@ def cmd_ship(args: argparse.Namespace) -> int:
130
135
  run_id = args.run_id or _now_run_id()
131
136
  verification = dispatched.get("verification", {})
132
137
  checks = verification.get("checks", []) if isinstance(verification, dict) else []
138
+ preflight = run_preflight(project_dir, goal=str(idea.get("goal", "")))
139
+ security_result = run_security_check(project_dir=project_dir, scope=".")
140
+ trace = record_trace(
141
+ project_dir,
142
+ trace_type="ship",
143
+ route=preflight["route"],
144
+ status="ok",
145
+ plan=dispatched.get("plan", {}),
146
+ verify=verification if isinstance(verification, dict) else {},
147
+ metadata={"runtime": runtime, "run_id": run_id},
148
+ )
149
+ eval_result = evaluate_trace(
150
+ project_dir,
151
+ trace_id=trace["trace_id"],
152
+ suites=["planning", "security"],
153
+ metrics={
154
+ "planning": 1.0 if dispatched.get("status") == "ok" else 0.0,
155
+ "security": max(float(security_result["trust_scores"].get("overall", 0.0)), 0.0),
156
+ },
157
+ )
158
+ lineage = build_lineage_manifest(
159
+ project_dir,
160
+ artifact_type="evidence-pack",
161
+ sources=[{"kind": "repo", "path": ".", "license": "MIT"}],
162
+ privacy="internal",
163
+ license="MIT",
164
+ derivation={"trace_id": trace["trace_id"], "route": preflight["route"], "eval_path": eval_result["path"]},
165
+ trace_id=trace["trace_id"],
166
+ )
133
167
  evidence_path = create_evidence_pack(
134
168
  project_dir,
135
169
  run_id,
136
170
  tests=checks if isinstance(checks, list) else [],
137
- security_scans=[],
171
+ security_scans=[
172
+ {
173
+ "tool": "security-check",
174
+ "finding_count": security_result["summary"]["finding_count"],
175
+ "path": security_result["evidence"]["path"],
176
+ }
177
+ ],
138
178
  diff_summary={"runtime": runtime, "goal": idea.get("goal", "")},
139
179
  reproducibility={"command": f"omg ship --runtime {runtime} --idea {idea_path}"},
140
180
  unresolved_risks=[],
181
+ provenance=security_result["provenance"],
182
+ trust_scores=security_result["trust_scores"],
183
+ api_twin={"recommended_route": preflight["route"] if preflight["route"] == "api-twin" else ""},
184
+ route_metadata=preflight,
185
+ trace_ids=[trace["trace_id"]],
186
+ lineage=lineage,
141
187
  )
142
188
 
143
189
  out = {
@@ -147,6 +193,8 @@ def cmd_ship(args: argparse.Namespace) -> int:
147
193
  "run_id": run_id,
148
194
  "goal": idea.get("goal", ""),
149
195
  "evidence_path": os.path.relpath(evidence_path, project_dir),
196
+ "trace_id": trace["trace_id"],
197
+ "eval_path": eval_result["path"],
150
198
  }
151
199
  print(json.dumps(out, indent=2))
152
200
  return 0
@@ -185,9 +233,12 @@ def cmd_api_twin_record(args: argparse.Namespace) -> int:
185
233
  result = record_fixture(
186
234
  _ensure_project_dir(),
187
235
  name=args.name,
236
+ endpoint=args.endpoint,
237
+ cassette_version=args.cassette_version,
188
238
  request=json.loads(args.request_json),
189
239
  response=json.loads(args.response_json),
190
240
  validated=bool(args.validated),
241
+ redactions=json.loads(args.redactions_json) if args.redactions_json else None,
191
242
  )
192
243
  print(json.dumps(result, indent=2))
193
244
  return 0
@@ -197,6 +248,8 @@ def cmd_api_twin_serve(args: argparse.Namespace) -> int:
197
248
  result = serve_fixture(
198
249
  _ensure_project_dir(),
199
250
  name=args.name,
251
+ endpoint=args.endpoint,
252
+ cassette_version=args.cassette_version,
200
253
  latency_ms=int(args.latency_ms),
201
254
  failure_mode=args.failure_mode,
202
255
  schema_drift=bool(args.schema_drift),
@@ -209,6 +262,8 @@ def cmd_api_twin_verify(args: argparse.Namespace) -> int:
209
262
  result = verify_fixture(
210
263
  _ensure_project_dir(),
211
264
  name=args.name,
265
+ endpoint=args.endpoint,
266
+ cassette_version=args.cassette_version,
212
267
  live_response=json.loads(args.live_response_json),
213
268
  )
214
269
  print(json.dumps(result, indent=2))
@@ -227,6 +282,82 @@ def cmd_domain_pack(args: argparse.Namespace) -> int:
227
282
  return 0
228
283
 
229
284
 
285
+ def cmd_trace_record(args: argparse.Namespace) -> int:
286
+ result = record_trace(
287
+ _ensure_project_dir(),
288
+ trace_type=args.trace_type,
289
+ route=args.route,
290
+ status=args.status,
291
+ plan=json.loads(args.plan_json) if args.plan_json else {},
292
+ verify=json.loads(args.verify_json) if args.verify_json else {},
293
+ )
294
+ print(json.dumps(result, indent=2))
295
+ return 0
296
+
297
+
298
+ def cmd_eval_gate(args: argparse.Namespace) -> int:
299
+ result = evaluate_trace(
300
+ _ensure_project_dir(),
301
+ trace_id=args.trace_id,
302
+ suites=args.suites.split(","),
303
+ metrics=json.loads(args.metrics_json),
304
+ )
305
+ print(json.dumps(result, indent=2))
306
+ return 0 if result["status"] == "ok" else 2
307
+
308
+
309
+ def cmd_delta_classify(args: argparse.Namespace) -> int:
310
+ from runtime.delta_classifier import classify_project_changes
311
+
312
+ touched_files = [item for item in args.files.split(",") if item]
313
+ result = classify_project_changes(_ensure_project_dir(), touched_files=touched_files or None, goal=args.goal)
314
+ print(json.dumps(result, indent=2))
315
+ return 0
316
+
317
+
318
+ def cmd_incident_replay(args: argparse.Namespace) -> int:
319
+ result = build_incident_pack(
320
+ _ensure_project_dir(),
321
+ title=args.title,
322
+ failing_tests=[item for item in args.failing_tests.split(",") if item],
323
+ logs=[item for item in args.logs.split("|") if item],
324
+ diff_summary=json.loads(args.diff_summary_json),
325
+ trace_id=args.trace_id or None,
326
+ )
327
+ print(json.dumps(result, indent=2))
328
+ return 0
329
+
330
+
331
+ def cmd_lineage(args: argparse.Namespace) -> int:
332
+ result = build_lineage_manifest(
333
+ _ensure_project_dir(),
334
+ artifact_type=args.artifact_type,
335
+ sources=json.loads(args.sources_json),
336
+ privacy=args.privacy,
337
+ license=args.license_name,
338
+ derivation=json.loads(args.derivation_json),
339
+ trace_id=args.trace_id or None,
340
+ )
341
+ print(json.dumps(result, indent=2))
342
+ return 0 if result["status"] == "ok" else 2
343
+
344
+
345
+ def cmd_supervisor_issue(args: argparse.Namespace) -> int:
346
+ result = issue_local_supervisor_session(
347
+ _ensure_project_dir(),
348
+ worker_id=args.worker_id,
349
+ shared_secret=args.shared_secret,
350
+ )
351
+ print(json.dumps(result, indent=2))
352
+ return 0
353
+
354
+
355
+ def cmd_supervisor_verify(args: argparse.Namespace) -> int:
356
+ result = verify_local_supervisor_token(args.token, shared_secret=args.shared_secret)
357
+ print(json.dumps(result, indent=2))
358
+ return 0 if result["status"] == "ok" else 2
359
+
360
+
230
361
  def cmd_maintainer(args: argparse.Namespace) -> int:
231
362
  project_dir = _ensure_project_dir()
232
363
  out_dir = Path(project_dir) / ".omg" / "evidence"
@@ -562,18 +693,25 @@ def build_parser() -> argparse.ArgumentParser:
562
693
  api_twin_ingest.set_defaults(func=cmd_api_twin_ingest)
563
694
  api_twin_record = api_twin_sub.add_parser("record", help="Record approved fixture response")
564
695
  api_twin_record.add_argument("--name", required=True)
696
+ api_twin_record.add_argument("--endpoint", default="default")
697
+ api_twin_record.add_argument("--cassette-version", default="v1")
565
698
  api_twin_record.add_argument("--request-json", required=True)
566
699
  api_twin_record.add_argument("--response-json", required=True)
567
700
  api_twin_record.add_argument("--validated", action="store_true")
701
+ api_twin_record.add_argument("--redactions-json", default="")
568
702
  api_twin_record.set_defaults(func=cmd_api_twin_record)
569
703
  api_twin_serve = api_twin_sub.add_parser("serve", help="Replay a fixture with optional drift/failure injection")
570
704
  api_twin_serve.add_argument("--name", required=True)
705
+ api_twin_serve.add_argument("--endpoint", default="default")
706
+ api_twin_serve.add_argument("--cassette-version", default="v1")
571
707
  api_twin_serve.add_argument("--latency-ms", type=int, default=0)
572
708
  api_twin_serve.add_argument("--failure-mode", default="")
573
709
  api_twin_serve.add_argument("--schema-drift", action="store_true")
574
710
  api_twin_serve.set_defaults(func=cmd_api_twin_serve)
575
711
  api_twin_verify = api_twin_sub.add_parser("verify", help="Validate a fixture against a live response")
576
712
  api_twin_verify.add_argument("--name", required=True)
713
+ api_twin_verify.add_argument("--endpoint", default="default")
714
+ api_twin_verify.add_argument("--cassette-version", default="v1")
577
715
  api_twin_verify.add_argument("--live-response-json", required=True)
578
716
  api_twin_verify.set_defaults(func=cmd_api_twin_verify)
579
717
 
@@ -585,6 +723,53 @@ def build_parser() -> argparse.ArgumentParser:
585
723
  domain_pack.add_argument("--name", required=True, choices=["robotics", "vision", "algorithms", "health"])
586
724
  domain_pack.set_defaults(func=cmd_domain_pack)
587
725
 
726
+ tracebank = sub.add_parser("tracebank", help="Record structured route traces")
727
+ tracebank.add_argument("--trace-type", required=True)
728
+ tracebank.add_argument("--route", required=True)
729
+ tracebank.add_argument("--status", default="ok")
730
+ tracebank.add_argument("--plan-json", default="")
731
+ tracebank.add_argument("--verify-json", default="")
732
+ tracebank.set_defaults(func=cmd_trace_record)
733
+
734
+ eval_gate = sub.add_parser("eval-gate", help="Evaluate a trace for release gating")
735
+ eval_gate.add_argument("--trace-id", required=True)
736
+ eval_gate.add_argument("--suites", required=True, help="Comma-separated suite names")
737
+ eval_gate.add_argument("--metrics-json", required=True)
738
+ eval_gate.set_defaults(func=cmd_eval_gate)
739
+
740
+ delta = sub.add_parser("delta-classifier", help="Classify repo changes for routing and policy")
741
+ delta.add_argument("--goal", default="")
742
+ delta.add_argument("--files", default="")
743
+ delta.set_defaults(func=cmd_delta_classify)
744
+
745
+ incident = sub.add_parser("incident-replay", help="Build an incident replay pack")
746
+ incident.add_argument("--title", required=True)
747
+ incident.add_argument("--failing-tests", default="")
748
+ incident.add_argument("--logs", default="")
749
+ incident.add_argument("--diff-summary-json", required=True)
750
+ incident.add_argument("--trace-id", default="")
751
+ incident.set_defaults(func=cmd_incident_replay)
752
+
753
+ lineage = sub.add_parser("data-lineage", help="Build lineage metadata for generated artifacts")
754
+ lineage.add_argument("--artifact-type", required=True)
755
+ lineage.add_argument("--sources-json", required=True)
756
+ lineage.add_argument("--privacy", required=True)
757
+ lineage.add_argument("--license-name", required=True)
758
+ lineage.add_argument("--derivation-json", required=True)
759
+ lineage.add_argument("--trace-id", default="")
760
+ lineage.set_defaults(func=cmd_lineage)
761
+
762
+ supervisor = sub.add_parser("remote-supervisor", help="Local-only authenticated supervisor session helpers")
763
+ supervisor_sub = supervisor.add_subparsers(dest="remote_supervisor_command", required=True)
764
+ supervisor_issue = supervisor_sub.add_parser("issue", help="Issue a local supervisor session")
765
+ supervisor_issue.add_argument("--worker-id", required=True)
766
+ supervisor_issue.add_argument("--shared-secret", required=True)
767
+ supervisor_issue.set_defaults(func=cmd_supervisor_issue)
768
+ supervisor_verify = supervisor_sub.add_parser("verify", help="Verify a supervisor session token")
769
+ supervisor_verify.add_argument("--token", required=True)
770
+ supervisor_verify.add_argument("--shared-secret", required=True)
771
+ supervisor_verify.set_defaults(func=cmd_supervisor_verify)
772
+
588
773
  maintainer = sub.add_parser("maintainer", help="OSS maintainer evidence helper")
589
774
  maintainer.add_argument("--mode", default="impact", choices=["triage", "release", "review", "impact"])
590
775
  maintainer.set_defaults(func=cmd_maintainer)
package/settings.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
- "_comment": "OMG 2.0.4 - project-level config with hook registrations, presets, and feature flags.",
3
+ "_comment": "OMG 2.0.5 - project-level config with hook registrations, presets, and feature flags.",
4
4
  "permissions": {
5
5
  "allow": [
6
6
  "Agent",
@@ -284,7 +284,7 @@
284
284
  ]
285
285
  },
286
286
  "_omg": {
287
- "_version": "2.0.4",
287
+ "_version": "2.0.5",
288
288
  "preset": "safe",
289
289
  "default_mode": "ulw+ralph",
290
290
  "vision_auto": true,
@@ -337,20 +337,35 @@
337
337
  "CONTEXT_MANAGER": false
338
338
  },
339
339
  "generated": {
340
- "contract_version": "2.0.4",
341
- "channel": "public",
340
+ "contract_version": "2.0.5",
341
+ "channel": "enterprise",
342
342
  "required_bundles": [
343
343
  "control-plane",
344
344
  "hook-governor",
345
345
  "mcp-fabric",
346
346
  "lsp-pack",
347
- "secure-worktree-pipeline"
347
+ "secure-worktree-pipeline",
348
+ "security-check",
349
+ "api-twin",
350
+ "preflight",
351
+ "robotics",
352
+ "vision",
353
+ "algorithms",
354
+ "health",
355
+ "tracebank",
356
+ "eval-gate",
357
+ "delta-classifier",
358
+ "incident-replay",
359
+ "data-lineage",
360
+ "remote-supervisor"
348
361
  ],
349
362
  "protected_paths": [
350
363
  ".omg/**",
351
364
  ".agents/**",
352
365
  ".codex/**",
353
- ".claude/**"
366
+ ".claude/**",
367
+ "registry/**",
368
+ "dist/**"
354
369
  ],
355
370
  "emulated_events": [
356
371
  "PreCompact",