@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
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import datetime, timezone
|
|
4
|
+
import json
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _utc_now() -> str:
|
|
10
|
+
return datetime.now(timezone.utc).isoformat()
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def create_rollback_manifest(run_id: str, step_id: str) -> dict[str, Any]:
|
|
14
|
+
return {
|
|
15
|
+
"schema": "RollbackManifest",
|
|
16
|
+
"schema_version": "1.0.0",
|
|
17
|
+
"run_id": run_id,
|
|
18
|
+
"step_id": step_id,
|
|
19
|
+
"created_at": _utc_now(),
|
|
20
|
+
"updated_at": _utc_now(),
|
|
21
|
+
"local_restores": [],
|
|
22
|
+
"compensating_actions": [],
|
|
23
|
+
"side_effects": [],
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def classify_side_effect(tool: str, metadata: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
28
|
+
payload = metadata or {}
|
|
29
|
+
if tool in {"write", "edit", "multiedit"}:
|
|
30
|
+
return {
|
|
31
|
+
"category": "local_file",
|
|
32
|
+
"decision": "reversible",
|
|
33
|
+
"reversible": True,
|
|
34
|
+
"reason": "local file shadow restore",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
command = str(payload.get("command", "")).strip().lower()
|
|
38
|
+
if tool == "bash":
|
|
39
|
+
if any(token in command for token in ("rm -rf /", "mkfs", "fdisk", "wipefs", "dd if=")):
|
|
40
|
+
return {
|
|
41
|
+
"category": "irreversible",
|
|
42
|
+
"decision": "blocked",
|
|
43
|
+
"reversible": False,
|
|
44
|
+
"reason": "destructive side effect",
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if "git commit" in command:
|
|
48
|
+
return {
|
|
49
|
+
"category": "git_commit",
|
|
50
|
+
"decision": "reversible",
|
|
51
|
+
"reversible": True,
|
|
52
|
+
"reason": "compensate with git revert",
|
|
53
|
+
"default_compensation": "git revert --no-edit <commit>",
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if any(token in command for token in ("curl ", "wget ", "http ")):
|
|
57
|
+
compensation = payload.get("compensating_action")
|
|
58
|
+
if _has_compensating_action(compensation):
|
|
59
|
+
return {
|
|
60
|
+
"category": "network_request",
|
|
61
|
+
"decision": "reversible",
|
|
62
|
+
"reversible": True,
|
|
63
|
+
"reason": "declared compensating action",
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
"category": "irreversible",
|
|
67
|
+
"decision": "escalation_required",
|
|
68
|
+
"reversible": False,
|
|
69
|
+
"reason": "network request missing compensation",
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
"category": "irreversible",
|
|
74
|
+
"decision": "escalation_required",
|
|
75
|
+
"reversible": False,
|
|
76
|
+
"reason": "undeclared or unknown side effect",
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def record_local_restore(manifest: dict[str, Any], file_path: str, status: str, reason: str = "") -> None:
|
|
81
|
+
local_restores = manifest.setdefault("local_restores", [])
|
|
82
|
+
local_restores.append(
|
|
83
|
+
{
|
|
84
|
+
"file_path": file_path,
|
|
85
|
+
"status": status,
|
|
86
|
+
"reason": reason,
|
|
87
|
+
"recorded_at": _utc_now(),
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
manifest["updated_at"] = _utc_now()
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def record_compensating_action(
|
|
94
|
+
manifest: dict[str, Any],
|
|
95
|
+
effect_type: str,
|
|
96
|
+
action: str,
|
|
97
|
+
command: str,
|
|
98
|
+
status: str = "declared",
|
|
99
|
+
) -> None:
|
|
100
|
+
actions = manifest.setdefault("compensating_actions", [])
|
|
101
|
+
actions.append(
|
|
102
|
+
{
|
|
103
|
+
"effect_type": effect_type,
|
|
104
|
+
"action": action,
|
|
105
|
+
"command": command,
|
|
106
|
+
"status": status,
|
|
107
|
+
"recorded_at": _utc_now(),
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
manifest["updated_at"] = _utc_now()
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def record_side_effect(manifest: dict[str, Any], classification: dict[str, Any]) -> None:
|
|
114
|
+
effects = manifest.setdefault("side_effects", [])
|
|
115
|
+
effects.append(dict(classification))
|
|
116
|
+
manifest["updated_at"] = _utc_now()
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def write_rollback_manifest(project_dir: str, manifest: dict[str, Any]) -> str:
|
|
120
|
+
run_id = str(manifest.get("run_id", "unknown")).strip() or "unknown"
|
|
121
|
+
step_id = str(manifest.get("step_id", "unknown")).strip() or "unknown"
|
|
122
|
+
out_dir = Path(project_dir) / ".omg" / "state" / "rollback_manifest"
|
|
123
|
+
out_dir.mkdir(parents=True, exist_ok=True)
|
|
124
|
+
out_path = out_dir / f"{run_id}-{step_id}.json"
|
|
125
|
+
tmp_path = out_path.with_name(f"{out_path.name}.tmp")
|
|
126
|
+
tmp_path.write_text(json.dumps(manifest, indent=2, ensure_ascii=True) + "\n", encoding="utf-8")
|
|
127
|
+
tmp_path.replace(out_path)
|
|
128
|
+
return str(out_path)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _has_compensating_action(payload: Any) -> bool:
|
|
132
|
+
if not isinstance(payload, dict):
|
|
133
|
+
return False
|
|
134
|
+
action = str(payload.get("action", "")).strip()
|
|
135
|
+
command = str(payload.get("command", "")).strip()
|
|
136
|
+
return bool(action and command)
|
|
@@ -161,6 +161,54 @@ def _run_hallucination_auditor(
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
|
|
164
|
+
def _run_evidence_completeness(
|
|
165
|
+
candidate: dict[str, Any],
|
|
166
|
+
context_packet: dict[str, Any],
|
|
167
|
+
project_dir: str,
|
|
168
|
+
) -> dict[str, Any]:
|
|
169
|
+
output_text = _extract_output_text(candidate).lower()
|
|
170
|
+
artifact_pointers = context_packet.get("artifact_pointers")
|
|
171
|
+
pointers: list[str] = []
|
|
172
|
+
if isinstance(artifact_pointers, list):
|
|
173
|
+
pointers = [str(item).strip() for item in artifact_pointers if isinstance(item, str) and str(item).strip()]
|
|
174
|
+
|
|
175
|
+
required_claim_tokens = ("implemented", "fixed", "tested", "verified", "release")
|
|
176
|
+
expects_evidence = any(token in output_text for token in required_claim_tokens)
|
|
177
|
+
|
|
178
|
+
existing_pointers: list[str] = []
|
|
179
|
+
missing_pointers: list[str] = []
|
|
180
|
+
for pointer in pointers:
|
|
181
|
+
full_path = os.path.join(project_dir, pointer.lstrip("./"))
|
|
182
|
+
if os.path.exists(full_path):
|
|
183
|
+
existing_pointers.append(pointer)
|
|
184
|
+
else:
|
|
185
|
+
missing_pointers.append(pointer)
|
|
186
|
+
|
|
187
|
+
findings: list[str] = []
|
|
188
|
+
if missing_pointers:
|
|
189
|
+
findings.append("missing evidence artifacts: " + ", ".join(missing_pointers[:6]))
|
|
190
|
+
|
|
191
|
+
if expects_evidence and not existing_pointers:
|
|
192
|
+
findings.append("claim-like output requires evidence artifacts but none were present")
|
|
193
|
+
return {"verdict": "fail", "findings": findings, "confidence": 0.92}
|
|
194
|
+
|
|
195
|
+
if findings:
|
|
196
|
+
return {"verdict": "warn", "findings": findings, "confidence": 0.76}
|
|
197
|
+
|
|
198
|
+
if existing_pointers:
|
|
199
|
+
return {
|
|
200
|
+
"verdict": "pass",
|
|
201
|
+
"findings": ["required evidence artifacts are present in bounded context packet"],
|
|
202
|
+
"confidence": 0.84,
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return {
|
|
206
|
+
"verdict": "pass",
|
|
207
|
+
"findings": ["no evidence artifacts required for non-assertive output"],
|
|
208
|
+
"confidence": 0.78,
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|
|
164
212
|
def run_critics(candidate: dict[str, object], context_packet: dict[str, object], project_dir: str) -> dict[str, dict[str, Any]]:
|
|
165
213
|
bounded_context = {
|
|
166
214
|
"summary": context_packet.get("summary", ""),
|
|
@@ -173,7 +221,9 @@ def run_critics(candidate: dict[str, object], context_packet: dict[str, object],
|
|
|
173
221
|
|
|
174
222
|
skeptic = _run_skeptic(candidate, bounded_context)
|
|
175
223
|
hallucination_auditor = _run_hallucination_auditor(candidate, bounded_context, project_dir)
|
|
224
|
+
evidence_completeness = _run_evidence_completeness(candidate, bounded_context, project_dir)
|
|
176
225
|
return {
|
|
177
226
|
"skeptic": skeptic,
|
|
178
227
|
"hallucination_auditor": hallucination_auditor,
|
|
228
|
+
"evidence_completeness": evidence_completeness,
|
|
179
229
|
}
|
|
@@ -8,9 +8,14 @@ from typing import TypedDict, cast
|
|
|
8
8
|
|
|
9
9
|
_MODULES = (
|
|
10
10
|
"verification_controller",
|
|
11
|
+
"release_run_coordinator",
|
|
11
12
|
"interaction_journal",
|
|
12
13
|
"context_engine",
|
|
13
14
|
"defense_state",
|
|
15
|
+
"session_health",
|
|
16
|
+
"council_verdicts",
|
|
17
|
+
"rollback_manifest",
|
|
18
|
+
"release_run",
|
|
14
19
|
)
|
|
15
20
|
|
|
16
21
|
_STATUS_VALUES = frozenset({"pending", "running", "ok", "error", "blocked"})
|
|
@@ -43,6 +48,11 @@ def schema_versions() -> dict[str, SchemaVersion]:
|
|
|
43
48
|
"version": "1.0.0",
|
|
44
49
|
"required_fields": base_required + ["blockers", "evidence_links", "progress"],
|
|
45
50
|
},
|
|
51
|
+
"release_run_coordinator": {
|
|
52
|
+
"schema_name": "ReleaseRunCoordinatorState",
|
|
53
|
+
"version": "1.0.0",
|
|
54
|
+
"required_fields": base_required + ["phase", "resolution_source", "resolution_reason"],
|
|
55
|
+
},
|
|
46
56
|
"interaction_journal": {
|
|
47
57
|
"schema_name": "InteractionJournalState",
|
|
48
58
|
"version": "1.0.0",
|
|
@@ -58,6 +68,43 @@ def schema_versions() -> dict[str, SchemaVersion]:
|
|
|
58
68
|
"version": "1.0.0",
|
|
59
69
|
"required_fields": base_required + ["controls", "findings"],
|
|
60
70
|
},
|
|
71
|
+
"session_health": {
|
|
72
|
+
"schema_name": "SessionHealth",
|
|
73
|
+
"version": "1.0.0",
|
|
74
|
+
"required_fields": base_required + [
|
|
75
|
+
"contamination_risk",
|
|
76
|
+
"overthinking_score",
|
|
77
|
+
"context_health",
|
|
78
|
+
"verification_status",
|
|
79
|
+
"recommended_action",
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
"council_verdicts": {
|
|
83
|
+
"schema_name": "CouncilVerdicts",
|
|
84
|
+
"version": "1.0.0",
|
|
85
|
+
"required_fields": base_required + ["verdicts", "verification_status"],
|
|
86
|
+
},
|
|
87
|
+
"rollback_manifest": {
|
|
88
|
+
"schema_name": "RollbackManifest",
|
|
89
|
+
"version": "1.0.0",
|
|
90
|
+
"required_fields": base_required + [
|
|
91
|
+
"step_id",
|
|
92
|
+
"local_restores",
|
|
93
|
+
"compensating_actions",
|
|
94
|
+
"side_effects",
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
"release_run": {
|
|
98
|
+
"schema_name": "ReleaseRunState",
|
|
99
|
+
"version": "1.0.0",
|
|
100
|
+
"required_fields": base_required + [
|
|
101
|
+
"phase",
|
|
102
|
+
"resolution_source",
|
|
103
|
+
"resolution_reason",
|
|
104
|
+
"release_evidence",
|
|
105
|
+
"health_action",
|
|
106
|
+
],
|
|
107
|
+
},
|
|
61
108
|
}
|
|
62
109
|
|
|
63
110
|
|
|
@@ -88,6 +135,74 @@ def read_run_state(project_dir: str, module: str, run_id: str) -> JsonObject | N
|
|
|
88
135
|
return None
|
|
89
136
|
|
|
90
137
|
|
|
138
|
+
def read_defense_state(
|
|
139
|
+
project_dir: str,
|
|
140
|
+
run_id: str | None = None,
|
|
141
|
+
*,
|
|
142
|
+
compat: bool = False,
|
|
143
|
+
) -> JsonObject | None:
|
|
144
|
+
root = Path(project_dir)
|
|
145
|
+
active_run_id = _resolve_active_run_id(root, run_id)
|
|
146
|
+
if active_run_id:
|
|
147
|
+
payload = _read_payload(root / ".omg" / "state" / "defense_state" / f"{active_run_id}.json")
|
|
148
|
+
if payload is not None:
|
|
149
|
+
return payload
|
|
150
|
+
|
|
151
|
+
payload = _read_payload(root / ".omg" / "state" / "defense_state" / "current.json")
|
|
152
|
+
if payload is not None:
|
|
153
|
+
return payload
|
|
154
|
+
|
|
155
|
+
if compat or not active_run_id:
|
|
156
|
+
return _read_payload(root / ".omg" / "state" / "defense_state" / "latest.json")
|
|
157
|
+
return None
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def read_session_health(
|
|
161
|
+
project_dir: str,
|
|
162
|
+
run_id: str | None = None,
|
|
163
|
+
*,
|
|
164
|
+
compat: bool = False,
|
|
165
|
+
) -> JsonObject | None:
|
|
166
|
+
root = Path(project_dir)
|
|
167
|
+
active_run_id = _resolve_active_run_id(root, run_id)
|
|
168
|
+
if active_run_id:
|
|
169
|
+
payload = _read_payload(root / ".omg" / "state" / "session_health" / f"{active_run_id}.json")
|
|
170
|
+
if payload is not None:
|
|
171
|
+
return payload
|
|
172
|
+
|
|
173
|
+
if compat or not active_run_id:
|
|
174
|
+
return _read_payload(root / ".omg" / "state" / "session_health" / "latest.json")
|
|
175
|
+
return None
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def read_context_packet(project_dir: str, *, compat: bool = False) -> JsonObject | None:
|
|
179
|
+
root = Path(project_dir)
|
|
180
|
+
payload = _read_payload(root / ".omg" / "state" / "context_engine_packet.json")
|
|
181
|
+
if payload is not None:
|
|
182
|
+
return payload
|
|
183
|
+
if compat:
|
|
184
|
+
return _read_payload(root / ".omg" / "state" / "context_engine" / "latest.json")
|
|
185
|
+
return None
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def read_council_verdicts(
|
|
189
|
+
project_dir: str,
|
|
190
|
+
run_id: str | None = None,
|
|
191
|
+
*,
|
|
192
|
+
compat: bool = False,
|
|
193
|
+
) -> JsonObject | None:
|
|
194
|
+
root = Path(project_dir)
|
|
195
|
+
active_run_id = _resolve_active_run_id(root, run_id)
|
|
196
|
+
if active_run_id:
|
|
197
|
+
payload = _read_payload(root / ".omg" / "state" / "council_verdicts" / f"{active_run_id}.json")
|
|
198
|
+
if payload is not None:
|
|
199
|
+
return payload
|
|
200
|
+
|
|
201
|
+
if compat or not active_run_id:
|
|
202
|
+
return _read_payload(root / ".omg" / "state" / "council_verdicts" / "latest.json")
|
|
203
|
+
return None
|
|
204
|
+
|
|
205
|
+
|
|
91
206
|
def _normalize_payload(module: str, run_id: str, payload: JsonObject) -> JsonObject:
|
|
92
207
|
metadata = schema_versions()[module]
|
|
93
208
|
state = dict(payload)
|
|
@@ -101,6 +216,28 @@ def _normalize_payload(module: str, run_id: str, payload: JsonObject) -> JsonObj
|
|
|
101
216
|
return state
|
|
102
217
|
|
|
103
218
|
|
|
219
|
+
def _resolve_active_run_id(project_dir: Path, run_id: str | None) -> str:
|
|
220
|
+
candidate = _to_str(run_id, "").strip()
|
|
221
|
+
if candidate:
|
|
222
|
+
return candidate
|
|
223
|
+
|
|
224
|
+
candidate = os.environ.get("OMG_RUN_ID", "").strip()
|
|
225
|
+
if candidate:
|
|
226
|
+
return candidate
|
|
227
|
+
|
|
228
|
+
for path in (
|
|
229
|
+
project_dir / ".omg" / "state" / "defense_state" / "current.json",
|
|
230
|
+
project_dir / ".omg" / "state" / "context_engine_packet.json",
|
|
231
|
+
):
|
|
232
|
+
payload = _read_payload(path)
|
|
233
|
+
if payload is None:
|
|
234
|
+
continue
|
|
235
|
+
candidate = _to_str(payload.get("run_id"), "").strip()
|
|
236
|
+
if candidate:
|
|
237
|
+
return candidate
|
|
238
|
+
return ""
|
|
239
|
+
|
|
240
|
+
|
|
104
241
|
def _read_payload(path: Path) -> JsonObject | None:
|
|
105
242
|
if not path.exists():
|
|
106
243
|
return None
|
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
|
|
4
4
|
import ast
|
|
5
5
|
from collections import Counter
|
|
6
|
+
from importlib import import_module
|
|
6
7
|
from datetime import datetime, timezone
|
|
7
8
|
from hashlib import sha256
|
|
8
9
|
import json
|
|
@@ -102,6 +103,7 @@ def run_security_check(
|
|
|
102
103
|
source_counts = Counter(finding["source"] for finding in findings)
|
|
103
104
|
relative_scope = _display_scope(project_dir, scope_path)
|
|
104
105
|
delta = classify_project_changes(project_dir, touched_files=_delta_touched_files(project_dir, scope_path), goal="security check")
|
|
106
|
+
evidence_requirements = _requirements_for_profile(delta.get("evidence_profile"))
|
|
105
107
|
unresolved_high_risk = [
|
|
106
108
|
finding
|
|
107
109
|
for finding in findings
|
|
@@ -191,7 +193,10 @@ def run_security_check(
|
|
|
191
193
|
"scan_status": "completed",
|
|
192
194
|
"manifest_count": len(manifests.manifests),
|
|
193
195
|
"delta_categories": delta["categories"],
|
|
196
|
+
"delta_evidence_profile": delta.get("evidence_profile"),
|
|
197
|
+
"evidence_requirements": evidence_requirements,
|
|
194
198
|
},
|
|
199
|
+
"evidence_requirements": evidence_requirements,
|
|
195
200
|
"provenance": provenance,
|
|
196
201
|
"trust_scores": trust_scores,
|
|
197
202
|
"license": license_artifact,
|
|
@@ -207,6 +212,17 @@ def run_security_check(
|
|
|
207
212
|
}
|
|
208
213
|
|
|
209
214
|
|
|
215
|
+
def _requirements_for_profile(evidence_profile: str | None) -> list[str]:
|
|
216
|
+
module = import_module("runtime.evidence_requirements")
|
|
217
|
+
resolver = getattr(module, "requirements_for_profile", None)
|
|
218
|
+
if callable(resolver):
|
|
219
|
+
resolved = resolver(evidence_profile)
|
|
220
|
+
if isinstance(resolved, (list, tuple, set)):
|
|
221
|
+
return [str(item) for item in resolved]
|
|
222
|
+
full = getattr(module, "FULL_REQUIREMENTS", [])
|
|
223
|
+
return [str(item) for item in full]
|
|
224
|
+
|
|
225
|
+
|
|
210
226
|
def security_check(
|
|
211
227
|
*,
|
|
212
228
|
project_dir: str,
|
|
@@ -8,6 +8,8 @@ import os
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
from typing import Any
|
|
10
10
|
|
|
11
|
+
from runtime.runtime_contracts import write_run_state
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
_SESSION_HEALTH_REL = Path(".omg") / "state" / "session_health"
|
|
13
15
|
_DEFENSE_STATE_REL = Path(".omg") / "state" / "defense_state" / "current.json"
|
|
@@ -15,8 +17,9 @@ _CONTEXT_PRESSURE_REL = Path(".omg") / "state" / ".context-pressure.json"
|
|
|
15
17
|
_JOURNAL_REL = Path(".omg") / "state" / "interaction_journal"
|
|
16
18
|
|
|
17
19
|
_DEFAULT_THRESHOLDS: dict[str, Any] = {
|
|
18
|
-
"contamination_risk": {"
|
|
19
|
-
"overthinking_score": {"
|
|
20
|
+
"contamination_risk": {"reflect": 0.05, "block": 0.7},
|
|
21
|
+
"overthinking_score": {"reflect": 0.15, "block": 0.85},
|
|
22
|
+
"premature_fixer_score": {"reflect": 0.5},
|
|
20
23
|
"context_health": {"warn": 0.4, "critical": 0.2},
|
|
21
24
|
}
|
|
22
25
|
|
|
@@ -53,28 +56,52 @@ def compute_session_health(
|
|
|
53
56
|
pressure_ratio,
|
|
54
57
|
)
|
|
55
58
|
)
|
|
59
|
+
premature_fixer_score = _clamp(_to_float(defense.get("premature_fixer_score"), 0.0))
|
|
60
|
+
clarification_sensitive = bool(defense.get("clarification_sensitive") is True)
|
|
56
61
|
|
|
57
62
|
context_health = _compute_context_health(pressure_ratio, journal_count)
|
|
58
63
|
|
|
59
64
|
verification_status = str(verification.get("status", "unknown"))
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
action_recommendations = _recommend_actions(
|
|
62
67
|
contamination_risk=contamination_risk,
|
|
63
68
|
overthinking_score=overthinking_score,
|
|
69
|
+
premature_fixer_score=premature_fixer_score,
|
|
70
|
+
clarification_sensitive=clarification_sensitive,
|
|
64
71
|
context_health=context_health,
|
|
65
72
|
verification_status=verification_status,
|
|
66
73
|
)
|
|
74
|
+
recommended_action = action_recommendations[0] if action_recommendations else "continue"
|
|
75
|
+
reflect_triggers = {
|
|
76
|
+
"contamination": contamination_risk > _DEFAULT_THRESHOLDS["contamination_risk"]["reflect"],
|
|
77
|
+
"overthinking": overthinking_score > _DEFAULT_THRESHOLDS["overthinking_score"]["reflect"],
|
|
78
|
+
"premature_fixer": premature_fixer_score > _DEFAULT_THRESHOLDS["premature_fixer_score"]["reflect"],
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_ACTION_TO_STATUS = {
|
|
82
|
+
"continue": "ok",
|
|
83
|
+
"warn": "running",
|
|
84
|
+
"reflect": "running",
|
|
85
|
+
"block": "blocked",
|
|
86
|
+
}
|
|
87
|
+
status = _ACTION_TO_STATUS.get(recommended_action, "running")
|
|
67
88
|
|
|
68
89
|
result: dict[str, Any] = {
|
|
69
90
|
"schema": "SessionHealth",
|
|
70
91
|
"schema_version": "1.0.0",
|
|
71
92
|
"run_id": run_id,
|
|
93
|
+
"status": status,
|
|
72
94
|
"contamination_risk": round(contamination_risk, 4),
|
|
73
95
|
"overthinking_score": round(overthinking_score, 4),
|
|
96
|
+
"premature_fixer_score": round(premature_fixer_score, 4),
|
|
97
|
+
"clarification_sensitive": clarification_sensitive,
|
|
74
98
|
"context_health": round(context_health, 4),
|
|
75
99
|
"verification_status": verification_status,
|
|
76
100
|
"journal_steps": journal_count,
|
|
77
101
|
"recommended_action": recommended_action,
|
|
102
|
+
"action_recommendations": action_recommendations,
|
|
103
|
+
"defense_pause_required": bool(reflect_triggers["contamination"] or reflect_triggers["overthinking"]),
|
|
104
|
+
"reflect_triggers": reflect_triggers,
|
|
78
105
|
"thresholds": dict(_DEFAULT_THRESHOLDS),
|
|
79
106
|
"sources": {
|
|
80
107
|
"defense_state": bool(defense),
|
|
@@ -85,37 +112,54 @@ def compute_session_health(
|
|
|
85
112
|
"updated_at": datetime.now(timezone.utc).isoformat(),
|
|
86
113
|
}
|
|
87
114
|
|
|
88
|
-
|
|
115
|
+
write_run_state(project_dir, "session_health", run_id, result)
|
|
89
116
|
return result
|
|
90
117
|
|
|
91
118
|
|
|
92
|
-
def
|
|
119
|
+
def _recommend_actions(
|
|
93
120
|
*,
|
|
94
121
|
contamination_risk: float,
|
|
95
122
|
overthinking_score: float,
|
|
123
|
+
premature_fixer_score: float,
|
|
124
|
+
clarification_sensitive: bool,
|
|
96
125
|
context_health: float,
|
|
97
126
|
verification_status: str,
|
|
98
|
-
) -> str:
|
|
127
|
+
) -> list[str]:
|
|
99
128
|
thresholds = _DEFAULT_THRESHOLDS
|
|
129
|
+
actions: list[str] = []
|
|
100
130
|
|
|
101
131
|
if contamination_risk >= thresholds["contamination_risk"]["block"]:
|
|
102
|
-
|
|
132
|
+
actions.append("block")
|
|
103
133
|
if overthinking_score >= thresholds["overthinking_score"]["block"]:
|
|
104
|
-
|
|
134
|
+
actions.append("block")
|
|
135
|
+
|
|
136
|
+
if actions:
|
|
137
|
+
return ["block"]
|
|
138
|
+
|
|
139
|
+
if clarification_sensitive:
|
|
140
|
+
if contamination_risk > thresholds["contamination_risk"]["reflect"]:
|
|
141
|
+
actions.append("reflect")
|
|
142
|
+
if overthinking_score > thresholds["overthinking_score"]["reflect"]:
|
|
143
|
+
actions.append("reflect")
|
|
144
|
+
if premature_fixer_score > thresholds["premature_fixer_score"]["reflect"]:
|
|
145
|
+
actions.append("reflect")
|
|
105
146
|
|
|
106
|
-
if contamination_risk >= thresholds["contamination_risk"]["warn"]:
|
|
107
|
-
return "reflect"
|
|
108
|
-
if overthinking_score >= thresholds["overthinking_score"]["warn"]:
|
|
109
|
-
return "reflect"
|
|
110
147
|
if context_health <= thresholds["context_health"]["critical"]:
|
|
111
|
-
|
|
148
|
+
actions.append("reflect")
|
|
112
149
|
|
|
113
150
|
if verification_status in ("error", "blocked"):
|
|
114
|
-
|
|
151
|
+
actions.append("warn")
|
|
115
152
|
if context_health <= thresholds["context_health"]["warn"]:
|
|
116
|
-
|
|
153
|
+
actions.append("warn")
|
|
154
|
+
|
|
155
|
+
if actions:
|
|
156
|
+
deduped: list[str] = []
|
|
157
|
+
for action in actions:
|
|
158
|
+
if action not in deduped:
|
|
159
|
+
deduped.append(action)
|
|
160
|
+
return deduped
|
|
117
161
|
|
|
118
|
-
return "continue"
|
|
162
|
+
return ["continue"]
|
|
119
163
|
|
|
120
164
|
|
|
121
165
|
def _compute_context_health(pressure_ratio: float, journal_count: int) -> float:
|