@trac3er/oh-my-god 2.1.0 → 2.1.4
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 +2 -2
- package/.agents/skills/omg/algorithms/SKILL.md +1 -1
- package/.agents/skills/omg/algorithms/openai.yaml +1 -1
- package/.agents/skills/omg/api-twin/SKILL.md +1 -1
- package/.agents/skills/omg/api-twin/openai.yaml +1 -1
- package/.agents/skills/omg/claim-judge/SKILL.md +1 -1
- package/.agents/skills/omg/claim-judge/openai.yaml +1 -1
- package/.agents/skills/omg/codex-rules.md +1 -1
- package/.agents/skills/omg/control-plane/SKILL.md +1 -1
- package/.agents/skills/omg/control-plane/openai.yaml +1 -1
- package/.agents/skills/omg/data-lineage/SKILL.md +1 -1
- package/.agents/skills/omg/data-lineage/openai.yaml +1 -1
- package/.agents/skills/omg/delta-classifier/SKILL.md +1 -1
- package/.agents/skills/omg/delta-classifier/openai.yaml +1 -1
- package/.agents/skills/omg/eval-gate/SKILL.md +1 -1
- package/.agents/skills/omg/eval-gate/openai.yaml +1 -1
- package/.agents/skills/omg/health/SKILL.md +1 -1
- package/.agents/skills/omg/health/openai.yaml +1 -1
- package/.agents/skills/omg/hook-governor/SKILL.md +1 -1
- package/.agents/skills/omg/hook-governor/openai.yaml +1 -1
- package/.agents/skills/omg/incident-replay/SKILL.md +1 -1
- package/.agents/skills/omg/incident-replay/openai.yaml +1 -1
- package/.agents/skills/omg/lsp-pack/SKILL.md +1 -1
- package/.agents/skills/omg/lsp-pack/openai.yaml +1 -1
- package/.agents/skills/omg/mcp-fabric/SKILL.md +1 -1
- package/.agents/skills/omg/mcp-fabric/openai.yaml +1 -1
- package/.agents/skills/omg/plan-council/SKILL.md +1 -1
- package/.agents/skills/omg/plan-council/openai.yaml +1 -1
- package/.agents/skills/omg/preflight/SKILL.md +1 -1
- package/.agents/skills/omg/preflight/openai.yaml +1 -1
- package/.agents/skills/omg/proof-gate/SKILL.md +1 -1
- package/.agents/skills/omg/proof-gate/openai.yaml +1 -1
- package/.agents/skills/omg/remote-supervisor/SKILL.md +1 -1
- package/.agents/skills/omg/remote-supervisor/openai.yaml +1 -1
- package/.agents/skills/omg/robotics/SKILL.md +1 -1
- package/.agents/skills/omg/robotics/openai.yaml +1 -1
- package/.agents/skills/omg/secure-worktree-pipeline/SKILL.md +1 -1
- package/.agents/skills/omg/secure-worktree-pipeline/openai.yaml +1 -1
- package/.agents/skills/omg/security-check/SKILL.md +1 -1
- package/.agents/skills/omg/security-check/openai.yaml +1 -1
- package/.agents/skills/omg/test-intent-lock/SKILL.md +1 -1
- package/.agents/skills/omg/test-intent-lock/openai.yaml +1 -1
- package/.agents/skills/omg/tracebank/SKILL.md +1 -1
- package/.agents/skills/omg/tracebank/openai.yaml +1 -1
- package/.agents/skills/omg/vision/SKILL.md +1 -1
- package/.agents/skills/omg/vision/openai.yaml +1 -1
- package/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +16 -0
- package/CLI-ADAPTER-MAP.md +3 -3
- package/OMG-setup.sh +114 -1
- package/OMG_COMPAT_CONTRACT.md +1 -1
- package/README.md +2 -1
- package/artifacts/release/.claude-plugin/marketplace.json +3 -3
- package/artifacts/release/.claude-plugin/plugin.json +1 -1
- package/artifacts/release/OMG_COMPAT_CONTRACT.md +1 -1
- package/artifacts/release/dist/enterprise/bundle/.claude-plugin/marketplace.json +3 -3
- package/artifacts/release/dist/enterprise/bundle/.claude-plugin/plugin.json +1 -1
- package/artifacts/release/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +1 -1
- package/artifacts/release/dist/enterprise/bundle/plugins/advanced/plugin.json +26 -9
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/algorithms.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/api-twin.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/claim-judge.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/control-plane.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/health.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/plan-council.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/preflight.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/proof-gate.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/robotics.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/security-check.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/test-intent-lock.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/tracebank.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/bundles/vision.yaml +1 -1
- package/artifacts/release/dist/enterprise/bundle/registry/omg-capability.schema.json +1 -1
- package/artifacts/release/dist/enterprise/bundle/settings.json +3 -3
- package/artifacts/release/dist/enterprise/manifest.json +30 -40
- package/artifacts/release/dist/public/bundle/.claude-plugin/marketplace.json +3 -3
- package/artifacts/release/dist/public/bundle/.claude-plugin/plugin.json +1 -1
- package/artifacts/release/dist/public/bundle/OMG_COMPAT_CONTRACT.md +1 -1
- package/artifacts/release/dist/public/bundle/plugins/advanced/plugin.json +26 -9
- package/artifacts/release/dist/public/bundle/registry/bundles/algorithms.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/api-twin.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/claim-judge.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/control-plane.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/data-lineage.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/delta-classifier.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/eval-gate.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/health.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/hook-governor.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/incident-replay.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/lsp-pack.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/mcp-fabric.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/plan-council.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/preflight.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/proof-gate.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/remote-supervisor.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/robotics.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/security-check.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/test-intent-lock.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/tracebank.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/bundles/vision.yaml +1 -1
- package/artifacts/release/dist/public/bundle/registry/omg-capability.schema.json +1 -1
- package/artifacts/release/dist/public/bundle/settings.json +3 -3
- package/artifacts/release/dist/public/manifest.json +30 -40
- package/artifacts/release/plugins/advanced/plugin.json +26 -9
- package/artifacts/release/registry/bundles/algorithms.yaml +1 -1
- package/artifacts/release/registry/bundles/api-twin.yaml +1 -1
- package/artifacts/release/registry/bundles/claim-judge.yaml +1 -1
- package/artifacts/release/registry/bundles/control-plane.yaml +1 -1
- package/artifacts/release/registry/bundles/data-lineage.yaml +1 -1
- package/artifacts/release/registry/bundles/delta-classifier.yaml +1 -1
- package/artifacts/release/registry/bundles/eval-gate.yaml +1 -1
- package/artifacts/release/registry/bundles/health.yaml +1 -1
- package/artifacts/release/registry/bundles/hook-governor.yaml +1 -1
- package/artifacts/release/registry/bundles/incident-replay.yaml +1 -1
- package/artifacts/release/registry/bundles/lsp-pack.yaml +1 -1
- package/artifacts/release/registry/bundles/mcp-fabric.yaml +1 -1
- package/artifacts/release/registry/bundles/plan-council.yaml +1 -1
- package/artifacts/release/registry/bundles/preflight.yaml +1 -1
- package/artifacts/release/registry/bundles/proof-gate.yaml +1 -1
- package/artifacts/release/registry/bundles/remote-supervisor.yaml +1 -1
- package/artifacts/release/registry/bundles/robotics.yaml +1 -1
- package/artifacts/release/registry/bundles/secure-worktree-pipeline.yaml +1 -1
- package/artifacts/release/registry/bundles/security-check.yaml +1 -1
- package/artifacts/release/registry/bundles/test-intent-lock.yaml +1 -1
- package/artifacts/release/registry/bundles/tracebank.yaml +1 -1
- package/artifacts/release/registry/bundles/vision.yaml +1 -1
- package/artifacts/release/registry/omg-capability.schema.json +1 -1
- package/artifacts/release/settings.json +3 -3
- package/build/lib/commands/OMG:profile-review.md +43 -0
- package/build/lib/commands/OMG:validate.md +59 -0
- package/build/lib/control_plane/service.py +40 -1
- package/build/lib/hooks/_agent_registry.py +2 -0
- package/build/lib/hooks/firewall.py +263 -4
- package/build/lib/hooks/intentgate-keyword-detector.py +15 -3
- package/build/lib/hooks/policy_engine.py +77 -0
- package/build/lib/hooks/prompt-enhancer.py +146 -0
- package/build/lib/hooks/session-end-capture.py +374 -6
- package/build/lib/hooks/session-start.py +13 -35
- package/build/lib/hooks/setup_wizard.py +333 -1
- package/build/lib/hooks/shadow_manager.py +111 -2
- package/build/lib/hooks/stop_dispatcher.py +108 -4
- package/build/lib/plugins/advanced/plugin.json +26 -9
- package/build/lib/plugins/core/plugin.json +44 -11
- package/build/lib/registry/bundles/algorithms.yaml +1 -1
- package/build/lib/registry/bundles/api-twin.yaml +1 -1
- package/build/lib/registry/bundles/claim-judge.yaml +1 -1
- package/build/lib/registry/bundles/control-plane.yaml +1 -1
- package/build/lib/registry/bundles/data-lineage.yaml +1 -1
- package/build/lib/registry/bundles/delta-classifier.yaml +1 -1
- package/build/lib/registry/bundles/eval-gate.yaml +1 -1
- package/build/lib/registry/bundles/health.yaml +1 -1
- package/build/lib/registry/bundles/hook-governor.yaml +1 -1
- package/build/lib/registry/bundles/incident-replay.yaml +1 -1
- package/build/lib/registry/bundles/lsp-pack.yaml +1 -1
- package/build/lib/registry/bundles/mcp-fabric.yaml +1 -1
- package/build/lib/registry/bundles/plan-council.yaml +1 -1
- package/build/lib/registry/bundles/preflight.yaml +1 -1
- package/build/lib/registry/bundles/proof-gate.yaml +1 -1
- package/build/lib/registry/bundles/remote-supervisor.yaml +1 -1
- package/build/lib/registry/bundles/robotics.yaml +1 -1
- package/build/lib/registry/bundles/secure-worktree-pipeline.yaml +1 -1
- package/build/lib/registry/bundles/security-check.yaml +1 -1
- package/build/lib/registry/bundles/test-intent-lock.yaml +1 -1
- package/build/lib/registry/bundles/tracebank.yaml +1 -1
- package/build/lib/registry/bundles/vision.yaml +1 -1
- package/build/lib/registry/omg-capability.schema.json +1 -1
- package/build/lib/runtime/adoption.py +1 -1
- package/build/lib/runtime/background_verification.py +62 -0
- package/build/lib/runtime/claim_judge.py +165 -5
- package/build/lib/runtime/compat.py +15 -1
- package/build/lib/runtime/context_engine.py +261 -4
- package/build/lib/runtime/contract_compiler.py +370 -93
- package/build/lib/runtime/defense_state.py +79 -8
- package/build/lib/runtime/delta_classifier.py +80 -2
- package/build/lib/runtime/evidence_query.py +56 -4
- package/build/lib/runtime/evidence_registry.py +16 -0
- package/build/lib/runtime/evidence_requirements.py +47 -0
- package/build/lib/runtime/forge_agents.py +179 -9
- package/build/lib/runtime/forge_contracts.py +208 -2
- package/build/lib/runtime/interaction_journal.py +318 -42
- package/build/lib/runtime/memory_store.py +134 -1
- package/build/lib/runtime/mutation_gate.py +57 -11
- package/build/lib/runtime/omg_compat_contract_snapshot.json +2 -2
- package/build/lib/runtime/omg_mcp_server.py +14 -4
- package/build/lib/runtime/preflight.py +14 -0
- package/build/lib/runtime/profile_io.py +294 -0
- package/build/lib/runtime/proof_gate.py +122 -7
- package/build/lib/runtime/release_run_coordinator.py +339 -0
- package/build/lib/runtime/release_surfaces.py +243 -0
- package/build/lib/runtime/rollback_manifest.py +136 -0
- package/build/lib/runtime/router_critics.py +50 -0
- package/build/lib/runtime/runtime_contracts.py +137 -0
- package/build/lib/runtime/security_check.py +16 -0
- package/build/lib/runtime/session_health.py +60 -16
- package/build/lib/runtime/team_router.py +156 -13
- package/build/lib/runtime/test_intent_lock.py +102 -0
- package/build/lib/runtime/tool_plan_gate.py +249 -24
- package/build/lib/runtime/validate.py +194 -0
- package/build/lib/runtime/verification_controller.py +52 -2
- package/commands/OMG:diagnose-plugins.md +33 -0
- package/commands/OMG:profile-review.md +43 -0
- package/commands/OMG:setup.md +4 -1
- package/commands/OMG:validate.md +59 -0
- package/control_plane/service.py +40 -1
- package/dist/enterprise/bundle/.claude-plugin/marketplace.json +3 -3
- package/dist/enterprise/bundle/.claude-plugin/plugin.json +1 -1
- package/dist/enterprise/bundle/OMG_COMPAT_CONTRACT.md +1 -1
- package/dist/enterprise/bundle/plugins/advanced/plugin.json +26 -9
- package/dist/enterprise/bundle/registry/bundles/algorithms.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/api-twin.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/claim-judge.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/control-plane.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/data-lineage.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/delta-classifier.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/eval-gate.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/health.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/hook-governor.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/incident-replay.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/lsp-pack.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/mcp-fabric.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/plan-council.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/preflight.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/proof-gate.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/remote-supervisor.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/robotics.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/secure-worktree-pipeline.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/security-check.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/test-intent-lock.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/tracebank.yaml +1 -1
- package/dist/enterprise/bundle/registry/bundles/vision.yaml +1 -1
- package/dist/enterprise/bundle/registry/omg-capability.schema.json +1 -1
- package/dist/enterprise/bundle/settings.json +3 -3
- package/dist/enterprise/manifest.json +30 -40
- package/dist/oh_my_god-2.1.4-py3-none-any.whl +0 -0
- package/dist/oh_my_god-2.1.4.tar.gz +0 -0
- package/dist/public/bundle/.claude-plugin/marketplace.json +3 -3
- package/dist/public/bundle/.claude-plugin/plugin.json +1 -1
- package/dist/public/bundle/OMG_COMPAT_CONTRACT.md +1 -1
- package/dist/public/bundle/plugins/advanced/plugin.json +26 -9
- package/dist/public/bundle/registry/bundles/algorithms.yaml +1 -1
- package/dist/public/bundle/registry/bundles/api-twin.yaml +1 -1
- package/dist/public/bundle/registry/bundles/claim-judge.yaml +1 -1
- package/dist/public/bundle/registry/bundles/control-plane.yaml +1 -1
- package/dist/public/bundle/registry/bundles/data-lineage.yaml +1 -1
- package/dist/public/bundle/registry/bundles/delta-classifier.yaml +1 -1
- package/dist/public/bundle/registry/bundles/eval-gate.yaml +1 -1
- package/dist/public/bundle/registry/bundles/health.yaml +1 -1
- package/dist/public/bundle/registry/bundles/hook-governor.yaml +1 -1
- package/dist/public/bundle/registry/bundles/incident-replay.yaml +1 -1
- package/dist/public/bundle/registry/bundles/lsp-pack.yaml +1 -1
- package/dist/public/bundle/registry/bundles/mcp-fabric.yaml +1 -1
- package/dist/public/bundle/registry/bundles/plan-council.yaml +1 -1
- package/dist/public/bundle/registry/bundles/preflight.yaml +1 -1
- package/dist/public/bundle/registry/bundles/proof-gate.yaml +1 -1
- package/dist/public/bundle/registry/bundles/remote-supervisor.yaml +1 -1
- package/dist/public/bundle/registry/bundles/robotics.yaml +1 -1
- package/dist/public/bundle/registry/bundles/secure-worktree-pipeline.yaml +1 -1
- package/dist/public/bundle/registry/bundles/security-check.yaml +1 -1
- package/dist/public/bundle/registry/bundles/test-intent-lock.yaml +1 -1
- package/dist/public/bundle/registry/bundles/tracebank.yaml +1 -1
- package/dist/public/bundle/registry/bundles/vision.yaml +1 -1
- package/dist/public/bundle/registry/omg-capability.schema.json +1 -1
- package/dist/public/bundle/settings.json +3 -3
- package/dist/public/manifest.json +30 -40
- package/docs/install/opencode.md +30 -0
- package/docs/proof.md +11 -0
- package/docs/release-checklist.md +14 -1
- package/hooks/_agent_registry.py +2 -0
- package/hooks/firewall.py +263 -4
- package/hooks/intentgate-keyword-detector.py +15 -3
- package/hooks/policy_engine.py +77 -0
- package/hooks/prompt-enhancer.py +146 -0
- package/hooks/session-end-capture.py +374 -6
- package/hooks/session-start.py +13 -35
- package/hooks/setup_wizard.py +342 -2
- package/hooks/shadow_manager.py +111 -2
- package/hooks/stop_dispatcher.py +108 -4
- package/hud/omg-hud.mjs +30 -6
- package/lab/pipeline.py +197 -26
- package/package.json +1 -1
- package/plugins/advanced/plugin.json +26 -9
- package/plugins/core/plugin.json +51 -12
- package/pyproject.toml +10 -2
- package/registry/bundles/algorithms.yaml +1 -1
- package/registry/bundles/api-twin.yaml +1 -1
- package/registry/bundles/claim-judge.yaml +1 -1
- package/registry/bundles/control-plane.yaml +1 -1
- package/registry/bundles/data-lineage.yaml +1 -1
- package/registry/bundles/delta-classifier.yaml +1 -1
- package/registry/bundles/eval-gate.yaml +1 -1
- package/registry/bundles/health.yaml +1 -1
- package/registry/bundles/hook-governor.yaml +1 -1
- package/registry/bundles/incident-replay.yaml +1 -1
- package/registry/bundles/lsp-pack.yaml +1 -1
- package/registry/bundles/mcp-fabric.yaml +1 -1
- package/registry/bundles/plan-council.yaml +1 -1
- package/registry/bundles/preflight.yaml +1 -1
- package/registry/bundles/proof-gate.yaml +1 -1
- package/registry/bundles/remote-supervisor.yaml +1 -1
- package/registry/bundles/robotics.yaml +1 -1
- package/registry/bundles/secure-worktree-pipeline.yaml +1 -1
- package/registry/bundles/security-check.yaml +1 -1
- package/registry/bundles/test-intent-lock.yaml +1 -1
- package/registry/bundles/tracebank.yaml +1 -1
- package/registry/bundles/vision.yaml +1 -1
- package/registry/omg-capability.schema.json +1 -1
- package/runtime/adoption.py +7 -5
- package/runtime/background_verification.py +62 -0
- package/runtime/claim_judge.py +165 -5
- package/runtime/compat.py +48 -1
- package/runtime/context_engine.py +261 -4
- package/runtime/contract_compiler.py +370 -93
- package/runtime/defense_state.py +79 -8
- package/runtime/delta_classifier.py +80 -2
- package/runtime/evidence_query.py +56 -4
- package/runtime/evidence_registry.py +16 -0
- package/runtime/evidence_requirements.py +47 -0
- package/runtime/forge_agents.py +179 -9
- package/runtime/forge_contracts.py +208 -2
- package/runtime/hook_governor.py +19 -1
- package/runtime/interaction_journal.py +318 -42
- package/runtime/memory_store.py +134 -1
- package/runtime/mutation_gate.py +57 -11
- package/runtime/omg_compat_contract_snapshot.json +2 -2
- package/runtime/omg_mcp_server.py +14 -4
- package/runtime/plugin_diagnostics.py +248 -0
- package/runtime/plugin_interop.py +1007 -0
- package/runtime/preflight.py +14 -0
- package/runtime/profile_io.py +294 -0
- package/runtime/proof_gate.py +122 -7
- package/runtime/providers/opencode_provider.py +94 -0
- package/runtime/release_run_coordinator.py +339 -0
- package/runtime/release_surfaces.py +243 -0
- package/runtime/rollback_manifest.py +136 -0
- package/runtime/router_critics.py +50 -0
- package/runtime/runtime_contracts.py +137 -0
- package/runtime/security_check.py +16 -0
- package/runtime/session_health.py +60 -16
- package/runtime/team_router.py +156 -13
- package/runtime/test_intent_lock.py +102 -0
- package/runtime/tool_plan_gate.py +218 -19
- package/runtime/validate.py +289 -0
- package/runtime/verification_controller.py +52 -2
- package/scripts/omg.py +306 -3
- package/scripts/prepare-release-proof-fixtures.py +191 -7
- package/scripts/print-canonical-version.py +80 -0
- package/scripts/sync-release-identity.py +476 -0
- package/scripts/validate-release-identity.py +246 -0
- package/scripts/verify-standalone.sh +3 -0
- package/settings.json +3 -3
- package/templates/plugins-allowlist.yaml +19 -0
- package/artifacts/release/dist/enterprise/bundle/.gemini/settings.json +0 -11
- package/artifacts/release/dist/enterprise/bundle/.kimi/mcp.json +0 -11
- package/artifacts/release/dist/public/bundle/.gemini/settings.json +0 -11
- package/artifacts/release/dist/public/bundle/.kimi/mcp.json +0 -11
- package/build/lib/yaml.py +0 -321
- package/dist/enterprise/bundle/.gemini/settings.json +0 -11
- package/dist/enterprise/bundle/.kimi/mcp.json +0 -11
- package/dist/public/bundle/.gemini/settings.json +0 -11
- package/dist/public/bundle/.kimi/mcp.json +0 -11
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
import hashlib
|
|
5
5
|
import asyncio
|
|
6
6
|
import importlib
|
|
7
|
+
import importlib.util
|
|
7
8
|
import json
|
|
8
9
|
import os
|
|
9
10
|
from pathlib import Path
|
|
@@ -20,6 +21,8 @@ import yaml
|
|
|
20
21
|
|
|
21
22
|
from runtime.asset_loader import resolve_asset, resolve_assets
|
|
22
23
|
from runtime.proof_chain import _normalize_evidence_pack
|
|
24
|
+
from runtime.evidence_requirements import requirements_for_profile
|
|
25
|
+
from runtime.runtime_contracts import schema_versions
|
|
23
26
|
from runtime.adoption import (
|
|
24
27
|
CANONICAL_MARKETPLACE_ID,
|
|
25
28
|
CANONICAL_PACKAGE_NAME,
|
|
@@ -141,6 +144,23 @@ HOST_COMPILED_ARTIFACTS = {
|
|
|
141
144
|
),
|
|
142
145
|
}
|
|
143
146
|
|
|
147
|
+
_REQUIRED_EXECUTION_PRIMITIVES = (
|
|
148
|
+
"release_run_coordinator_state",
|
|
149
|
+
"tdd_proof_chain_lock",
|
|
150
|
+
"rollback_manifest",
|
|
151
|
+
"intent_gate_state",
|
|
152
|
+
"profile_digest",
|
|
153
|
+
"session_health_state",
|
|
154
|
+
"council_verdicts",
|
|
155
|
+
"forge_starter_proof",
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
_REQUIRED_CONTEXT_METADATA = (
|
|
159
|
+
"context_checksum",
|
|
160
|
+
"profile_version",
|
|
161
|
+
"intent_gate_version",
|
|
162
|
+
)
|
|
163
|
+
|
|
144
164
|
|
|
145
165
|
def _ensure_list(
|
|
146
166
|
*,
|
|
@@ -1419,78 +1439,58 @@ def _check_mcp_fabric() -> dict[str, Any]:
|
|
|
1419
1439
|
|
|
1420
1440
|
|
|
1421
1441
|
def _check_version_identity_drift(root: Path) -> dict[str, Any]:
|
|
1422
|
-
"""Check version/identity drift across all public surface files.
|
|
1423
|
-
|
|
1424
|
-
Returns a dict with:
|
|
1425
|
-
- status: "ok" or "error"
|
|
1426
|
-
- blockers: list of named blockers for each mismatch
|
|
1427
|
-
- drift_details: dict mapping file paths to their found versions
|
|
1428
|
-
"""
|
|
1429
1442
|
canonical_version = CANONICAL_VERSION
|
|
1430
1443
|
blockers: list[str] = []
|
|
1431
1444
|
drift_details: dict[str, str] = {}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
else:
|
|
1471
|
-
# JSON file: use json_path to navigate
|
|
1472
|
-
data = _load_json(full_path)
|
|
1473
|
-
current = data
|
|
1474
|
-
if json_path:
|
|
1475
|
-
for key in json_path:
|
|
1476
|
-
current = current.get(key)
|
|
1477
|
-
if current is None:
|
|
1478
|
-
break
|
|
1479
|
-
found_version = current
|
|
1480
|
-
except Exception as e:
|
|
1481
|
-
blockers.append(f"version_drift: failed to parse {file_path}: {e}")
|
|
1445
|
+
|
|
1446
|
+
from runtime.release_surfaces import AUTHORED_SURFACES
|
|
1447
|
+
|
|
1448
|
+
sync_script = Path(__file__).resolve().parents[1] / "scripts" / "sync-release-identity.py"
|
|
1449
|
+
if not sync_script.exists():
|
|
1450
|
+
return {
|
|
1451
|
+
"status": "error",
|
|
1452
|
+
"canonical_version": canonical_version,
|
|
1453
|
+
"blockers": ["version_drift: missing scripts/sync-release-identity.py"],
|
|
1454
|
+
"drift_details": {},
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
spec = importlib.util.spec_from_file_location("sync_release_identity", sync_script)
|
|
1458
|
+
if spec is None or spec.loader is None:
|
|
1459
|
+
return {
|
|
1460
|
+
"status": "error",
|
|
1461
|
+
"canonical_version": canonical_version,
|
|
1462
|
+
"blockers": ["version_drift: unable to load scripts/sync-release-identity.py"],
|
|
1463
|
+
"drift_details": {},
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
module = importlib.util.module_from_spec(spec)
|
|
1467
|
+
spec.loader.exec_module(module)
|
|
1468
|
+
check_surface = getattr(module, "check_surface", None)
|
|
1469
|
+
if not callable(check_surface):
|
|
1470
|
+
return {
|
|
1471
|
+
"status": "error",
|
|
1472
|
+
"canonical_version": canonical_version,
|
|
1473
|
+
"blockers": ["version_drift: scripts/sync-release-identity.py missing check_surface"],
|
|
1474
|
+
"drift_details": {},
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
for surface in AUTHORED_SURFACES:
|
|
1478
|
+
raw_drifts = check_surface(root, surface, canonical_version)
|
|
1479
|
+
if not isinstance(raw_drifts, list):
|
|
1480
|
+
blockers.append(
|
|
1481
|
+
f"version_drift: {surface.file_path} has version <invalid drift payload>, expected {canonical_version}"
|
|
1482
|
+
)
|
|
1482
1483
|
continue
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1484
|
+
for drift in raw_drifts:
|
|
1485
|
+
if not isinstance(drift, (tuple, list)) or len(drift) != 2:
|
|
1486
|
+
continue
|
|
1487
|
+
label, found = drift
|
|
1488
|
+
found_value = "<not found>" if found is None else str(found)
|
|
1487
1489
|
blockers.append(
|
|
1488
|
-
f"version_drift: {
|
|
1490
|
+
f"version_drift: {label} has version {found_value}, expected {canonical_version}"
|
|
1489
1491
|
)
|
|
1490
|
-
drift_details[
|
|
1491
|
-
|
|
1492
|
-
drift_details[file_path] = str(found_version)
|
|
1493
|
-
|
|
1492
|
+
drift_details[str(label)] = found_value
|
|
1493
|
+
|
|
1494
1494
|
return {
|
|
1495
1495
|
"status": "ok" if not blockers else "error",
|
|
1496
1496
|
"canonical_version": canonical_version,
|
|
@@ -1811,6 +1811,10 @@ def build_release_readiness(
|
|
|
1811
1811
|
checks["proof_chain"] = proof_chain_check
|
|
1812
1812
|
blockers.extend(proof_chain_check.get("blockers", []))
|
|
1813
1813
|
|
|
1814
|
+
execution_primitives = _check_execution_primitives(output_root=output, evidence_profile="release")
|
|
1815
|
+
checks["execution_primitives"] = execution_primitives
|
|
1816
|
+
blockers.extend(execution_primitives.get("blockers", []))
|
|
1817
|
+
|
|
1814
1818
|
security_blockers = [
|
|
1815
1819
|
blocker
|
|
1816
1820
|
for blocker in evidence_check.get("blockers", [])
|
|
@@ -1879,35 +1883,11 @@ def build_release_readiness(
|
|
|
1879
1883
|
|
|
1880
1884
|
|
|
1881
1885
|
def _check_recent_evidence(output_root: Path) -> dict[str, Any]:
|
|
1882
|
-
|
|
1883
|
-
if
|
|
1884
|
-
return {"status": "missing", "blockers": []}
|
|
1885
|
-
|
|
1886
|
-
evidence_files = sorted(path for path in evidence_dir.glob("*.json") if path.is_file())
|
|
1887
|
-
if not evidence_files:
|
|
1886
|
+
latest = _latest_evidence_pack(output_root)
|
|
1887
|
+
if latest is None:
|
|
1888
1888
|
return {"status": "missing", "blockers": []}
|
|
1889
1889
|
|
|
1890
|
-
|
|
1891
|
-
for path in evidence_files:
|
|
1892
|
-
try:
|
|
1893
|
-
payload = _load_json(path)
|
|
1894
|
-
except Exception:
|
|
1895
|
-
continue
|
|
1896
|
-
if payload.get("schema") == "EvidencePack":
|
|
1897
|
-
try:
|
|
1898
|
-
payload = _normalize_evidence_pack(payload)
|
|
1899
|
-
except ValueError as exc:
|
|
1900
|
-
return {
|
|
1901
|
-
"status": "error",
|
|
1902
|
-
"evidence_file": str(path.relative_to(output_root)),
|
|
1903
|
-
"blockers": [f"invalid evidence pack: {exc}"],
|
|
1904
|
-
}
|
|
1905
|
-
evidence_payloads.append((path, payload))
|
|
1906
|
-
|
|
1907
|
-
if not evidence_payloads:
|
|
1908
|
-
return {"status": "missing", "blockers": []}
|
|
1909
|
-
|
|
1910
|
-
evidence_path, payload = evidence_payloads[-1]
|
|
1890
|
+
evidence_path, payload = latest
|
|
1911
1891
|
blockers: list[str] = []
|
|
1912
1892
|
if not payload.get("security_scans"):
|
|
1913
1893
|
blockers.append("cosmetic evidence: security_scans is empty")
|
|
@@ -1936,10 +1916,307 @@ def _check_recent_evidence(output_root: Path) -> dict[str, Any]:
|
|
|
1936
1916
|
return {
|
|
1937
1917
|
"status": "ok" if not blockers else "error",
|
|
1938
1918
|
"evidence_file": str(evidence_path.relative_to(output_root)),
|
|
1919
|
+
"run_id": str(payload.get("run_id", "")).strip(),
|
|
1939
1920
|
"blockers": blockers,
|
|
1940
1921
|
}
|
|
1941
1922
|
|
|
1942
1923
|
|
|
1924
|
+
def _latest_evidence_pack(output_root: Path) -> tuple[Path, dict[str, Any]] | None:
|
|
1925
|
+
evidence_dir = output_root / ".omg" / "evidence"
|
|
1926
|
+
if not evidence_dir.exists():
|
|
1927
|
+
return None
|
|
1928
|
+
|
|
1929
|
+
evidence_files = sorted(path for path in evidence_dir.glob("*.json") if path.is_file())
|
|
1930
|
+
evidence_payloads: list[tuple[Path, dict[str, Any]]] = []
|
|
1931
|
+
for path in evidence_files:
|
|
1932
|
+
try:
|
|
1933
|
+
payload = _load_json(path)
|
|
1934
|
+
except Exception:
|
|
1935
|
+
continue
|
|
1936
|
+
if payload.get("schema") != "EvidencePack":
|
|
1937
|
+
continue
|
|
1938
|
+
try:
|
|
1939
|
+
payload = _normalize_evidence_pack(payload)
|
|
1940
|
+
except ValueError as exc:
|
|
1941
|
+
return path, {"schema": "EvidencePack", "invalid": f"invalid evidence pack: {exc}"}
|
|
1942
|
+
evidence_payloads.append((path, payload))
|
|
1943
|
+
|
|
1944
|
+
if not evidence_payloads:
|
|
1945
|
+
return None
|
|
1946
|
+
return evidence_payloads[-1]
|
|
1947
|
+
|
|
1948
|
+
|
|
1949
|
+
def _required_fields_for_module(module: str) -> list[str]:
|
|
1950
|
+
metadata = schema_versions().get(module, {})
|
|
1951
|
+
required = metadata.get("required_fields", []) if isinstance(metadata, dict) else []
|
|
1952
|
+
if isinstance(required, list):
|
|
1953
|
+
return [str(field) for field in required if str(field).strip()]
|
|
1954
|
+
return []
|
|
1955
|
+
|
|
1956
|
+
|
|
1957
|
+
def _missing_context_metadata(payload: dict[str, Any]) -> list[str]:
|
|
1958
|
+
missing: list[str] = []
|
|
1959
|
+
for key in _REQUIRED_CONTEXT_METADATA:
|
|
1960
|
+
value = str(payload.get(key, "")).strip()
|
|
1961
|
+
if not value:
|
|
1962
|
+
missing.append(key)
|
|
1963
|
+
return missing
|
|
1964
|
+
|
|
1965
|
+
|
|
1966
|
+
def _check_execution_primitives(*, output_root: Path, evidence_profile: str | None = None) -> dict[str, Any]:
|
|
1967
|
+
blockers: list[str] = []
|
|
1968
|
+
missing: list[str] = []
|
|
1969
|
+
invalid: list[str] = []
|
|
1970
|
+
evidence_paths: dict[str, str] = {key: "" for key in _REQUIRED_EXECUTION_PRIMITIVES}
|
|
1971
|
+
resolved_profile = (evidence_profile or "").strip()
|
|
1972
|
+
required_evidence_requirements = requirements_for_profile(resolved_profile)
|
|
1973
|
+
|
|
1974
|
+
latest = _latest_evidence_pack(output_root)
|
|
1975
|
+
if latest is None:
|
|
1976
|
+
missing.extend(list(_REQUIRED_EXECUTION_PRIMITIVES))
|
|
1977
|
+
blockers.extend(f"missing_execution_primitive: {item}" for item in missing)
|
|
1978
|
+
return {
|
|
1979
|
+
"status": "error",
|
|
1980
|
+
"run_id": "",
|
|
1981
|
+
"evidence_profile": resolved_profile,
|
|
1982
|
+
"required_evidence_requirements": list(required_evidence_requirements),
|
|
1983
|
+
"required": list(_REQUIRED_EXECUTION_PRIMITIVES),
|
|
1984
|
+
"missing": missing,
|
|
1985
|
+
"invalid": invalid,
|
|
1986
|
+
"evidence_paths": evidence_paths,
|
|
1987
|
+
"blockers": blockers,
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
evidence_path, evidence_payload = latest
|
|
1991
|
+
invalid_evidence = str(evidence_payload.get("invalid", "")).strip()
|
|
1992
|
+
if invalid_evidence:
|
|
1993
|
+
invalid.append(f"release_evidence_pack:{invalid_evidence}")
|
|
1994
|
+
blockers.append(f"invalid_execution_primitive: release_evidence_pack: {invalid_evidence}")
|
|
1995
|
+
return {
|
|
1996
|
+
"status": "error",
|
|
1997
|
+
"run_id": "",
|
|
1998
|
+
"evidence_profile": resolved_profile,
|
|
1999
|
+
"required_evidence_requirements": list(required_evidence_requirements),
|
|
2000
|
+
"required": list(_REQUIRED_EXECUTION_PRIMITIVES),
|
|
2001
|
+
"missing": list(_REQUIRED_EXECUTION_PRIMITIVES),
|
|
2002
|
+
"invalid": invalid,
|
|
2003
|
+
"evidence_paths": evidence_paths,
|
|
2004
|
+
"blockers": blockers,
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
if not resolved_profile:
|
|
2008
|
+
resolved_profile = str(evidence_payload.get("evidence_profile", "")).strip()
|
|
2009
|
+
required_evidence_requirements = requirements_for_profile(resolved_profile)
|
|
2010
|
+
|
|
2011
|
+
run_id = str(evidence_payload.get("run_id", "")).strip()
|
|
2012
|
+
if not run_id:
|
|
2013
|
+
invalid.append("run_id_unresolved")
|
|
2014
|
+
blockers.append("invalid_execution_primitive: run_id_unresolved")
|
|
2015
|
+
|
|
2016
|
+
evidence_metadata_missing = _missing_context_metadata(evidence_payload)
|
|
2017
|
+
if evidence_metadata_missing:
|
|
2018
|
+
invalid.append("release_evidence_pack:missing_context_metadata")
|
|
2019
|
+
blockers.append(
|
|
2020
|
+
"invalid_execution_primitive: release_evidence_pack: "
|
|
2021
|
+
f"missing_context_metadata={','.join(sorted(evidence_metadata_missing))}"
|
|
2022
|
+
)
|
|
2023
|
+
|
|
2024
|
+
checks: list[tuple[str, str, str]] = [
|
|
2025
|
+
("release_run_coordinator_state", "release_run_coordinator", "ReleaseRunCoordinatorState"),
|
|
2026
|
+
("rollback_manifest", "rollback_manifest", "RollbackManifest"),
|
|
2027
|
+
("intent_gate_state", "intent_gate", "IntentGateDecision"),
|
|
2028
|
+
("session_health_state", "session_health", "SessionHealth"),
|
|
2029
|
+
("council_verdicts", "council_verdicts", "CouncilVerdicts"),
|
|
2030
|
+
]
|
|
2031
|
+
for token, module, schema_name in checks:
|
|
2032
|
+
matched_path, matched_payload = _find_state_for_run(output_root=output_root, module=module, run_id=run_id)
|
|
2033
|
+
if matched_path is None or matched_payload is None:
|
|
2034
|
+
missing.append(token)
|
|
2035
|
+
blockers.append(f"missing_execution_primitive: {token}")
|
|
2036
|
+
continue
|
|
2037
|
+
evidence_paths[token] = str(matched_path.relative_to(output_root)).replace("\\", "/")
|
|
2038
|
+
schema = str(matched_payload.get("schema", "")).strip()
|
|
2039
|
+
if schema != schema_name:
|
|
2040
|
+
invalid.append(f"{token}:schema_mismatch")
|
|
2041
|
+
blockers.append(f"invalid_execution_primitive: {token}: schema_mismatch")
|
|
2042
|
+
continue
|
|
2043
|
+
required_fields = _required_fields_for_module(module)
|
|
2044
|
+
missing_fields = [field for field in required_fields if field not in matched_payload]
|
|
2045
|
+
if missing_fields:
|
|
2046
|
+
invalid.append(f"{token}:missing_fields")
|
|
2047
|
+
blockers.append(
|
|
2048
|
+
f"invalid_execution_primitive: {token}: missing_fields={','.join(sorted(missing_fields))}"
|
|
2049
|
+
)
|
|
2050
|
+
if token in {"intent_gate_state", "session_health_state", "council_verdicts"}:
|
|
2051
|
+
metadata_missing = _missing_context_metadata(matched_payload)
|
|
2052
|
+
if metadata_missing:
|
|
2053
|
+
invalid.append(f"{token}:missing_context_metadata")
|
|
2054
|
+
blockers.append(
|
|
2055
|
+
f"invalid_execution_primitive: {token}: "
|
|
2056
|
+
f"missing_context_metadata={','.join(sorted(metadata_missing))}"
|
|
2057
|
+
)
|
|
2058
|
+
|
|
2059
|
+
profile_path = output_root / ".omg" / "state" / "profile.yaml"
|
|
2060
|
+
if not profile_path.exists():
|
|
2061
|
+
missing.append("profile_digest")
|
|
2062
|
+
blockers.append("missing_execution_primitive: profile_digest")
|
|
2063
|
+
else:
|
|
2064
|
+
evidence_paths["profile_digest"] = str(profile_path.relative_to(output_root)).replace("\\", "/")
|
|
2065
|
+
try:
|
|
2066
|
+
profile_payload = yaml.safe_load(profile_path.read_text(encoding="utf-8"))
|
|
2067
|
+
except Exception:
|
|
2068
|
+
profile_payload = None
|
|
2069
|
+
profile_version = ""
|
|
2070
|
+
if isinstance(profile_payload, dict):
|
|
2071
|
+
profile_version = str(
|
|
2072
|
+
profile_payload.get("profile_version")
|
|
2073
|
+
or profile_payload.get("version")
|
|
2074
|
+
or ""
|
|
2075
|
+
).strip()
|
|
2076
|
+
if not profile_version:
|
|
2077
|
+
provenance = profile_payload.get("profile_provenance")
|
|
2078
|
+
if isinstance(provenance, dict):
|
|
2079
|
+
profile_version = str(
|
|
2080
|
+
provenance.get("checksum")
|
|
2081
|
+
or provenance.get("version")
|
|
2082
|
+
or ""
|
|
2083
|
+
).strip()
|
|
2084
|
+
if not profile_version:
|
|
2085
|
+
invalid.append("profile_digest:missing_profile_version")
|
|
2086
|
+
blockers.append("invalid_execution_primitive: profile_digest: missing_profile_version")
|
|
2087
|
+
|
|
2088
|
+
lock_path, lock_payload = _find_test_intent_lock(output_root=output_root, run_id=run_id, evidence_payload=evidence_payload)
|
|
2089
|
+
if lock_path is None or lock_payload is None:
|
|
2090
|
+
missing.append("tdd_proof_chain_lock")
|
|
2091
|
+
blockers.append("missing_execution_primitive: tdd_proof_chain_lock")
|
|
2092
|
+
else:
|
|
2093
|
+
evidence_paths["tdd_proof_chain_lock"] = str(lock_path.relative_to(output_root)).replace("\\", "/")
|
|
2094
|
+
lock_status = str(lock_payload.get("status", "")).strip().lower()
|
|
2095
|
+
if lock_status in {"", "error", "blocked"}:
|
|
2096
|
+
invalid.append("tdd_proof_chain_lock:status_invalid")
|
|
2097
|
+
blockers.append("invalid_execution_primitive: tdd_proof_chain_lock: status_invalid")
|
|
2098
|
+
|
|
2099
|
+
forge_path, forge_payload = _find_forge_starter_proof(output_root=output_root, run_id=run_id)
|
|
2100
|
+
if forge_path is None or forge_payload is None:
|
|
2101
|
+
missing.append("forge_starter_proof")
|
|
2102
|
+
blockers.append("missing_execution_primitive: forge_starter_proof")
|
|
2103
|
+
else:
|
|
2104
|
+
evidence_paths["forge_starter_proof"] = str(forge_path.relative_to(output_root)).replace("\\", "/")
|
|
2105
|
+
forge_schema = str(forge_payload.get("schema", "")).strip()
|
|
2106
|
+
if forge_schema != "ForgeSpecialistDispatchEvidence":
|
|
2107
|
+
invalid.append("forge_starter_proof:schema_mismatch")
|
|
2108
|
+
blockers.append("invalid_execution_primitive: forge_starter_proof: schema_mismatch")
|
|
2109
|
+
if forge_payload.get("proof_backed") is not True:
|
|
2110
|
+
invalid.append("forge_starter_proof:not_proof_backed")
|
|
2111
|
+
blockers.append("invalid_execution_primitive: forge_starter_proof: proof_backed_false")
|
|
2112
|
+
forge_metadata_missing = _missing_context_metadata(forge_payload)
|
|
2113
|
+
if forge_metadata_missing:
|
|
2114
|
+
invalid.append("forge_starter_proof:missing_context_metadata")
|
|
2115
|
+
blockers.append(
|
|
2116
|
+
"invalid_execution_primitive: forge_starter_proof: "
|
|
2117
|
+
f"missing_context_metadata={','.join(sorted(forge_metadata_missing))}"
|
|
2118
|
+
)
|
|
2119
|
+
|
|
2120
|
+
return {
|
|
2121
|
+
"status": "ok" if not blockers else "error",
|
|
2122
|
+
"run_id": run_id,
|
|
2123
|
+
"evidence_profile": resolved_profile,
|
|
2124
|
+
"required_evidence_requirements": list(required_evidence_requirements),
|
|
2125
|
+
"evidence_pack": str(evidence_path.relative_to(output_root)).replace("\\", "/"),
|
|
2126
|
+
"required": list(_REQUIRED_EXECUTION_PRIMITIVES),
|
|
2127
|
+
"missing": sorted(set(missing)),
|
|
2128
|
+
"invalid": sorted(set(invalid)),
|
|
2129
|
+
"evidence_paths": evidence_paths,
|
|
2130
|
+
"blockers": blockers,
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
def _find_state_for_run(
|
|
2135
|
+
*,
|
|
2136
|
+
output_root: Path,
|
|
2137
|
+
module: str,
|
|
2138
|
+
run_id: str,
|
|
2139
|
+
) -> tuple[Path | None, dict[str, Any] | None]:
|
|
2140
|
+
state_dir = output_root / ".omg" / "state" / module
|
|
2141
|
+
if not state_dir.exists():
|
|
2142
|
+
return None, None
|
|
2143
|
+
|
|
2144
|
+
preferred = state_dir / f"{run_id}.json"
|
|
2145
|
+
if run_id and preferred.exists():
|
|
2146
|
+
try:
|
|
2147
|
+
payload = _load_json(preferred)
|
|
2148
|
+
except Exception:
|
|
2149
|
+
payload = {}
|
|
2150
|
+
if isinstance(payload, dict):
|
|
2151
|
+
return preferred, payload
|
|
2152
|
+
|
|
2153
|
+
for path in sorted(state_dir.glob("*.json")):
|
|
2154
|
+
try:
|
|
2155
|
+
payload = _load_json(path)
|
|
2156
|
+
except Exception:
|
|
2157
|
+
continue
|
|
2158
|
+
if not isinstance(payload, dict):
|
|
2159
|
+
continue
|
|
2160
|
+
if run_id and str(payload.get("run_id", "")).strip() != run_id:
|
|
2161
|
+
continue
|
|
2162
|
+
return path, payload
|
|
2163
|
+
return None, None
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
def _find_test_intent_lock(
|
|
2167
|
+
*,
|
|
2168
|
+
output_root: Path,
|
|
2169
|
+
run_id: str,
|
|
2170
|
+
evidence_payload: dict[str, Any],
|
|
2171
|
+
) -> tuple[Path | None, dict[str, Any] | None]:
|
|
2172
|
+
lock_dir = output_root / ".omg" / "state" / "test-intent-lock"
|
|
2173
|
+
if not lock_dir.exists():
|
|
2174
|
+
return None, None
|
|
2175
|
+
|
|
2176
|
+
lock_id = ""
|
|
2177
|
+
test_delta = evidence_payload.get("test_delta")
|
|
2178
|
+
if isinstance(test_delta, dict):
|
|
2179
|
+
lock_id = str(test_delta.get("lock_id", "")).strip()
|
|
2180
|
+
|
|
2181
|
+
for path in sorted(lock_dir.glob("*.json")):
|
|
2182
|
+
try:
|
|
2183
|
+
payload = _load_json(path)
|
|
2184
|
+
except Exception:
|
|
2185
|
+
continue
|
|
2186
|
+
if not isinstance(payload, dict):
|
|
2187
|
+
continue
|
|
2188
|
+
payload_lock_id = str(payload.get("lock_id", "")).strip()
|
|
2189
|
+
if lock_id and payload_lock_id == lock_id:
|
|
2190
|
+
return path, payload
|
|
2191
|
+
intent = payload.get("intent")
|
|
2192
|
+
if isinstance(intent, dict):
|
|
2193
|
+
intent_run = str(intent.get("run_id", "")).strip()
|
|
2194
|
+
if run_id and intent_run == run_id:
|
|
2195
|
+
return path, payload
|
|
2196
|
+
payload_run = str(payload.get("run_id", "")).strip()
|
|
2197
|
+
if run_id and payload_run == run_id:
|
|
2198
|
+
return path, payload
|
|
2199
|
+
return None, None
|
|
2200
|
+
|
|
2201
|
+
|
|
2202
|
+
def _find_forge_starter_proof(*, output_root: Path, run_id: str) -> tuple[Path | None, dict[str, Any] | None]:
|
|
2203
|
+
evidence_dir = output_root / ".omg" / "evidence"
|
|
2204
|
+
if not evidence_dir.exists():
|
|
2205
|
+
return None, None
|
|
2206
|
+
for path in sorted(evidence_dir.glob("forge-specialists-*.json")):
|
|
2207
|
+
try:
|
|
2208
|
+
payload = _load_json(path)
|
|
2209
|
+
except Exception:
|
|
2210
|
+
continue
|
|
2211
|
+
if not isinstance(payload, dict):
|
|
2212
|
+
continue
|
|
2213
|
+
payload_run = str(payload.get("run_id", "")).strip()
|
|
2214
|
+
if run_id and payload_run and payload_run != run_id:
|
|
2215
|
+
continue
|
|
2216
|
+
return path, payload
|
|
2217
|
+
return None, None
|
|
2218
|
+
|
|
2219
|
+
|
|
1943
2220
|
def _check_test_intent_claims(payload: dict[str, Any]) -> list[str]:
|
|
1944
2221
|
test_delta = payload.get("test_delta")
|
|
1945
2222
|
claims = payload.get("claims", [])
|
|
@@ -10,19 +10,23 @@ from typing import Any
|
|
|
10
10
|
_DEFENSE_STATE_REL_PATH = Path(".omg") / "state" / "defense_state" / "current.json"
|
|
11
11
|
_CONTEXT_PRESSURE_REL_PATH = Path(".omg") / "state" / ".context-pressure.json"
|
|
12
12
|
_UNTRUSTED_STATE_REL_PATH = Path(".omg") / "state" / "untrusted-content.json"
|
|
13
|
+
_ACTIVE_RUN_REL_PATH = Path(".omg") / "shadow" / "active-run"
|
|
14
|
+
_INTENT_GATE_REL_PATH = Path(".omg") / "state" / "intent_gate"
|
|
13
15
|
|
|
14
16
|
_SAFE_STATE: dict[str, Any] = {
|
|
15
17
|
"risk_level": "low",
|
|
16
18
|
"injection_hits": 0,
|
|
17
19
|
"contamination_score": 0.0,
|
|
18
20
|
"overthinking_score": 0.0,
|
|
21
|
+
"premature_fixer_score": 0.0,
|
|
22
|
+
"clarification_sensitive": False,
|
|
19
23
|
"actions": [],
|
|
20
24
|
"updated_at": "",
|
|
21
25
|
"reasons": [],
|
|
22
26
|
"thresholds": {
|
|
23
27
|
"critical": {"injection_hits": 3, "contamination_score": 0.7},
|
|
24
28
|
"high": {"injection_hits": 1, "contamination_score": 0.4},
|
|
25
|
-
"medium": {"overthinking_score": 0.5},
|
|
29
|
+
"medium": {"overthinking_score": 0.5, "premature_fixer_score": 0.5},
|
|
26
30
|
},
|
|
27
31
|
"context_pressure": {
|
|
28
32
|
"tool_count": 0,
|
|
@@ -44,6 +48,7 @@ class DefenseState:
|
|
|
44
48
|
injection_hits: int = 0,
|
|
45
49
|
contamination_score: float = 0.0,
|
|
46
50
|
overthinking_score: float = 0.0,
|
|
51
|
+
premature_fixer_score: float | None = None,
|
|
47
52
|
) -> dict[str, Any]:
|
|
48
53
|
pressure = self._read_json(self.project_dir / _CONTEXT_PRESSURE_REL_PATH)
|
|
49
54
|
pressure_tool_count = self._to_int(pressure.get("tool_count"), default=0)
|
|
@@ -52,28 +57,49 @@ class DefenseState:
|
|
|
52
57
|
if pressure_threshold > 0:
|
|
53
58
|
pressure_ratio = pressure_tool_count / pressure_threshold
|
|
54
59
|
combined_overthinking = max(float(overthinking_score), pressure_ratio)
|
|
60
|
+
normalized_injection_hits = max(0, int(injection_hits))
|
|
61
|
+
normalized_contamination = self._clamp_score(contamination_score)
|
|
62
|
+
normalized_overthinking = self._clamp_score(combined_overthinking)
|
|
63
|
+
|
|
64
|
+
clarification = self._read_clarification_signal()
|
|
65
|
+
clarification_sensitive = bool(
|
|
66
|
+
clarification["requires_clarification"]
|
|
67
|
+
or clarification["intent_class"] == "ambiguous_config"
|
|
68
|
+
)
|
|
69
|
+
premature_fixer_score = self._compute_premature_fixer_score(
|
|
70
|
+
clarification_sensitive=clarification_sensitive,
|
|
71
|
+
requires_clarification=bool(clarification["requires_clarification"]),
|
|
72
|
+
confidence=self._to_float(clarification.get("confidence"), default=0.0),
|
|
73
|
+
injection_hits=normalized_injection_hits,
|
|
74
|
+
contamination_score=normalized_contamination,
|
|
75
|
+
overthinking_score=normalized_overthinking,
|
|
76
|
+
)
|
|
77
|
+
scanner_premature_fixer = self._clamp_score(premature_fixer_score)
|
|
78
|
+
premature_fixer_score = max(premature_fixer_score, scanner_premature_fixer)
|
|
55
79
|
|
|
56
80
|
trust_posture = self._read_trust_posture()
|
|
57
81
|
level, actions, reasons = self._score(
|
|
58
|
-
injection_hits=
|
|
59
|
-
contamination_score=
|
|
60
|
-
overthinking_score=
|
|
82
|
+
injection_hits=normalized_injection_hits,
|
|
83
|
+
contamination_score=normalized_contamination,
|
|
84
|
+
overthinking_score=normalized_overthinking,
|
|
61
85
|
)
|
|
62
86
|
if pressure_ratio >= 1.0:
|
|
63
87
|
reasons.append("context pressure is above configured threshold")
|
|
64
88
|
|
|
65
89
|
state: dict[str, Any] = {
|
|
66
90
|
"risk_level": level,
|
|
67
|
-
"injection_hits":
|
|
68
|
-
"contamination_score":
|
|
69
|
-
"overthinking_score":
|
|
91
|
+
"injection_hits": normalized_injection_hits,
|
|
92
|
+
"contamination_score": normalized_contamination,
|
|
93
|
+
"overthinking_score": normalized_overthinking,
|
|
94
|
+
"premature_fixer_score": round(premature_fixer_score, 4),
|
|
95
|
+
"clarification_sensitive": clarification_sensitive,
|
|
70
96
|
"actions": actions,
|
|
71
97
|
"updated_at": datetime.now(timezone.utc).isoformat(),
|
|
72
98
|
"reasons": reasons,
|
|
73
99
|
"thresholds": {
|
|
74
100
|
"critical": {"injection_hits": 3, "contamination_score": 0.7},
|
|
75
101
|
"high": {"injection_hits": 1, "contamination_score": 0.4},
|
|
76
|
-
"medium": {"overthinking_score": 0.5},
|
|
102
|
+
"medium": {"overthinking_score": 0.5, "premature_fixer_score": 0.5},
|
|
77
103
|
},
|
|
78
104
|
"context_pressure": {
|
|
79
105
|
"tool_count": pressure_tool_count,
|
|
@@ -96,6 +122,8 @@ class DefenseState:
|
|
|
96
122
|
"injection_hits": self._to_int(payload.get("injection_hits"), default=0),
|
|
97
123
|
"contamination_score": self._clamp_score(payload.get("contamination_score", 0.0)),
|
|
98
124
|
"overthinking_score": self._clamp_score(payload.get("overthinking_score", 0.0)),
|
|
125
|
+
"premature_fixer_score": self._clamp_score(payload.get("premature_fixer_score", 0.0)),
|
|
126
|
+
"clarification_sensitive": bool(payload.get("clarification_sensitive", False)),
|
|
99
127
|
"actions": self._to_str_list(payload.get("actions")),
|
|
100
128
|
"updated_at": str(payload.get("updated_at", "")),
|
|
101
129
|
"reasons": self._to_str_list(payload.get("reasons")),
|
|
@@ -105,6 +133,49 @@ class DefenseState:
|
|
|
105
133
|
"action_recommendations": self._to_str_list(payload.get("action_recommendations")),
|
|
106
134
|
}
|
|
107
135
|
|
|
136
|
+
def _read_clarification_signal(self) -> dict[str, Any]:
|
|
137
|
+
active_run_path = self.project_dir / _ACTIVE_RUN_REL_PATH
|
|
138
|
+
if not active_run_path.exists():
|
|
139
|
+
return {"requires_clarification": False, "intent_class": "", "confidence": 0.0}
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
run_id = active_run_path.read_text(encoding="utf-8").strip()
|
|
143
|
+
except OSError:
|
|
144
|
+
run_id = ""
|
|
145
|
+
if not run_id:
|
|
146
|
+
return {"requires_clarification": False, "intent_class": "", "confidence": 0.0}
|
|
147
|
+
|
|
148
|
+
intent_gate_path = self.project_dir / _INTENT_GATE_REL_PATH / f"{run_id}.json"
|
|
149
|
+
payload = self._read_json(intent_gate_path)
|
|
150
|
+
confidence = self._clamp_score(self._to_float(payload.get("confidence"), default=0.0))
|
|
151
|
+
return {
|
|
152
|
+
"requires_clarification": bool(payload.get("requires_clarification") is True),
|
|
153
|
+
"intent_class": str(payload.get("intent_class", "")).strip(),
|
|
154
|
+
"confidence": confidence,
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
def _compute_premature_fixer_score(
|
|
158
|
+
self,
|
|
159
|
+
*,
|
|
160
|
+
clarification_sensitive: bool,
|
|
161
|
+
requires_clarification: bool,
|
|
162
|
+
confidence: float,
|
|
163
|
+
injection_hits: int,
|
|
164
|
+
contamination_score: float,
|
|
165
|
+
overthinking_score: float,
|
|
166
|
+
) -> float:
|
|
167
|
+
if not clarification_sensitive:
|
|
168
|
+
return 0.0
|
|
169
|
+
|
|
170
|
+
score = 0.0
|
|
171
|
+
if requires_clarification:
|
|
172
|
+
score += 0.2
|
|
173
|
+
score += min(0.2, self._clamp_score(confidence) * 0.2)
|
|
174
|
+
score += min(0.2, max(0, injection_hits) * 0.1)
|
|
175
|
+
score += min(0.2, self._clamp_score(contamination_score) * 0.25)
|
|
176
|
+
score += min(0.2, self._clamp_score(overthinking_score) * 0.25)
|
|
177
|
+
return self._clamp_score(score)
|
|
178
|
+
|
|
108
179
|
def _read_trust_posture(self) -> str:
|
|
109
180
|
payload = self._read_json(self.project_dir / _UNTRUSTED_STATE_REL_PATH)
|
|
110
181
|
scores = payload.get("trust_scores") if isinstance(payload, dict) else {}
|