@trac3r/oh-my-god 2.2.11
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/CHANGELOG.md +188 -0
- package/INSTALL-VERIFICATION-INDEX.md +51 -0
- package/LICENSE +21 -0
- package/OMG-setup.sh +2549 -0
- package/QUICK-REFERENCE.md +58 -0
- package/README.md +207 -0
- package/agents/__init__.py +1 -0
- package/agents/__pycache__/model_roles.cpython-313.pyc +0 -0
- package/agents/_model_roles.yaml +26 -0
- package/agents/designer.md +67 -0
- package/agents/explore.md +60 -0
- package/agents/model_roles.py +196 -0
- package/agents/omg-api-builder.md +23 -0
- package/agents/omg-architect-mode.md +41 -0
- package/agents/omg-architect.md +13 -0
- package/agents/omg-backend-engineer.md +41 -0
- package/agents/omg-critic.md +16 -0
- package/agents/omg-database-engineer.md +41 -0
- package/agents/omg-escalation-router.md +17 -0
- package/agents/omg-executor.md +12 -0
- package/agents/omg-frontend-designer.md +41 -0
- package/agents/omg-implement-mode.md +49 -0
- package/agents/omg-infra-engineer.md +41 -0
- package/agents/omg-qa-tester.md +16 -0
- package/agents/omg-research-mode.md +41 -0
- package/agents/omg-security-auditor.md +41 -0
- package/agents/omg-testing-engineer.md +41 -0
- package/agents/plan.md +80 -0
- package/agents/quick_task.md +64 -0
- package/agents/reviewer.md +83 -0
- package/agents/task.md +71 -0
- package/bin/omg +41 -0
- package/commands/OMG:ai-commit.md +113 -0
- package/commands/OMG:api-twin.md +22 -0
- package/commands/OMG:arch.md +313 -0
- package/commands/OMG:browser.md +29 -0
- package/commands/OMG:ccg.md +22 -0
- package/commands/OMG:compat.md +57 -0
- package/commands/OMG:cost.md +181 -0
- package/commands/OMG:crazy.md +125 -0
- package/commands/OMG:create-agent.md +183 -0
- package/commands/OMG:deep-plan.md +18 -0
- package/commands/OMG:deps.md +248 -0
- package/commands/OMG:diagnose-plugins.md +33 -0
- package/commands/OMG:doctor.md +37 -0
- package/commands/OMG:domain-init.md +11 -0
- package/commands/OMG:escalate.md +52 -0
- package/commands/OMG:forge.md +103 -0
- package/commands/OMG:health-check.md +48 -0
- package/commands/OMG:init.md +134 -0
- package/commands/OMG:issue.md +56 -0
- package/commands/OMG:mode.md +44 -0
- package/commands/OMG:playwright.md +17 -0
- package/commands/OMG:preflight.md +26 -0
- package/commands/OMG:preset.md +49 -0
- package/commands/OMG:profile-review.md +58 -0
- package/commands/OMG:project-init.md +11 -0
- package/commands/OMG:ralph-start.md +43 -0
- package/commands/OMG:ralph-stop.md +23 -0
- package/commands/OMG:security-check.md +28 -0
- package/commands/OMG:session-branch.md +101 -0
- package/commands/OMG:session-fork.md +57 -0
- package/commands/OMG:session-merge.md +138 -0
- package/commands/OMG:setup.md +82 -0
- package/commands/OMG:ship.md +18 -0
- package/commands/OMG:stats.md +225 -0
- package/commands/OMG:teams.md +54 -0
- package/commands/OMG:theme.md +44 -0
- package/commands/OMG:validate.md +59 -0
- package/commands/__init__.py +1 -0
- package/docs/command-surface.md +55 -0
- package/docs/install/claude-code.md +53 -0
- package/docs/install/codex.md +45 -0
- package/docs/install/gemini.md +43 -0
- package/docs/install/github-action.md +81 -0
- package/docs/install/github-app-required-checks.md +107 -0
- package/docs/install/github-app.md +161 -0
- package/docs/install/kimi.md +43 -0
- package/docs/install/opencode.md +38 -0
- package/docs/proof.md +182 -0
- package/hooks/__init__.py +0 -0
- package/hooks/__pycache__/__init__.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_agent_registry.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_analytics.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_budget.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_common.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_compression_optimizer.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_cost_ledger.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_learnings.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_memory.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_post_write.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_protected_context.cpython-313.pyc +0 -0
- package/hooks/__pycache__/_token_counter.cpython-313.pyc +0 -0
- package/hooks/__pycache__/branch_manager.cpython-313.pyc +0 -0
- package/hooks/__pycache__/budget_governor.cpython-313.pyc +0 -0
- package/hooks/__pycache__/circuit-breaker.cpython-313.pyc +0 -0
- package/hooks/__pycache__/compression_feedback.cpython-313.pyc +0 -0
- package/hooks/__pycache__/config-guard.cpython-313.pyc +0 -0
- package/hooks/__pycache__/context_pressure.cpython-313.pyc +0 -0
- package/hooks/__pycache__/credential_store.cpython-313.pyc +0 -0
- package/hooks/__pycache__/fetch-rate-limits.cpython-313.pyc +0 -0
- package/hooks/__pycache__/firewall.cpython-313.pyc +0 -0
- package/hooks/__pycache__/hashline-formatter-bridge.cpython-313.pyc +0 -0
- package/hooks/__pycache__/hashline-injector.cpython-313.pyc +0 -0
- package/hooks/__pycache__/hashline-validator.cpython-313.pyc +0 -0
- package/hooks/__pycache__/idle-detector.cpython-313.pyc +0 -0
- package/hooks/__pycache__/instructions-loaded.cpython-313.pyc +0 -0
- package/hooks/__pycache__/intentgate-keyword-detector.cpython-313.pyc +0 -0
- package/hooks/__pycache__/magic-keyword-router.cpython-313.pyc +0 -0
- package/hooks/__pycache__/policy_engine.cpython-313.pyc +0 -0
- package/hooks/__pycache__/post-tool-failure.cpython-313.pyc +0 -0
- package/hooks/__pycache__/post-write.cpython-313.pyc +0 -0
- package/hooks/__pycache__/post_write.cpython-313.pyc +0 -0
- package/hooks/__pycache__/pre-compact.cpython-313.pyc +0 -0
- package/hooks/__pycache__/pre-tool-inject.cpython-313.pyc +0 -0
- package/hooks/__pycache__/prompt-enhancer.cpython-313.pyc +0 -0
- package/hooks/__pycache__/quality-runner.cpython-313.pyc +0 -0
- package/hooks/__pycache__/query.cpython-313.pyc +0 -0
- package/hooks/__pycache__/secret-guard.cpython-313.pyc +0 -0
- package/hooks/__pycache__/secret_audit.cpython-313.pyc +0 -0
- package/hooks/__pycache__/security_validators.cpython-313.pyc +0 -0
- package/hooks/__pycache__/session-end-capture.cpython-313.pyc +0 -0
- package/hooks/__pycache__/session-start.cpython-313.pyc +0 -0
- package/hooks/__pycache__/setup_wizard.cpython-313.pyc +0 -0
- package/hooks/__pycache__/shadow_manager.cpython-313.pyc +0 -0
- package/hooks/__pycache__/state_migration.cpython-313.pyc +0 -0
- package/hooks/__pycache__/stop-gate.cpython-313.pyc +0 -0
- package/hooks/__pycache__/stop_dispatcher.cpython-313.pyc +0 -0
- package/hooks/__pycache__/tdd-gate.cpython-313.pyc +0 -0
- package/hooks/__pycache__/terms-guard.cpython-313.pyc +0 -0
- package/hooks/__pycache__/test-validator.cpython-313.pyc +0 -0
- package/hooks/__pycache__/test_generator_hook.cpython-313.pyc +0 -0
- package/hooks/__pycache__/todo-state-tracker.cpython-313.pyc +0 -0
- package/hooks/__pycache__/tool-ledger.cpython-313.pyc +0 -0
- package/hooks/__pycache__/trust_review.cpython-313.pyc +0 -0
- package/hooks/__pycache__/user-prompt-submit.cpython-313.pyc +0 -0
- package/hooks/_agent_registry.py +481 -0
- package/hooks/_analytics.py +291 -0
- package/hooks/_budget.py +31 -0
- package/hooks/_common.py +761 -0
- package/hooks/_compression_optimizer.py +119 -0
- package/hooks/_cost_ledger.py +176 -0
- package/hooks/_learnings.py +126 -0
- package/hooks/_memory.py +103 -0
- package/hooks/_post_write.py +46 -0
- package/hooks/_protected_context.py +150 -0
- package/hooks/_token_counter.py +221 -0
- package/hooks/branch_manager.py +255 -0
- package/hooks/budget_governor.py +326 -0
- package/hooks/circuit-breaker.py +270 -0
- package/hooks/compression_feedback.py +254 -0
- package/hooks/config-guard.py +193 -0
- package/hooks/context_pressure.py +119 -0
- package/hooks/credential_store.py +970 -0
- package/hooks/fetch-rate-limits.py +212 -0
- package/hooks/firewall.py +323 -0
- package/hooks/hashline-formatter-bridge.py +224 -0
- package/hooks/hashline-injector.py +273 -0
- package/hooks/hashline-validator.py +216 -0
- package/hooks/idle-detector.py +97 -0
- package/hooks/instructions-loaded.py +26 -0
- package/hooks/intentgate-keyword-detector.py +200 -0
- package/hooks/magic-keyword-router.py +195 -0
- package/hooks/policy_engine.py +767 -0
- package/hooks/post-tool-failure.py +19 -0
- package/hooks/post-write.py +233 -0
- package/hooks/pre-compact.py +470 -0
- package/hooks/pre-tool-inject.py +98 -0
- package/hooks/prompt-enhancer.py +879 -0
- package/hooks/quality-runner.py +191 -0
- package/hooks/query.py +512 -0
- package/hooks/secret-guard.py +120 -0
- package/hooks/secret_audit.py +144 -0
- package/hooks/security_validators.py +93 -0
- package/hooks/session-end-capture.py +505 -0
- package/hooks/session-start.py +261 -0
- package/hooks/setup_wizard.py +1101 -0
- package/hooks/shadow_manager.py +476 -0
- package/hooks/state_migration.py +228 -0
- package/hooks/stop-gate.py +7 -0
- package/hooks/stop_dispatcher.py +1259 -0
- package/hooks/tdd-gate.py +10 -0
- package/hooks/terms-guard.py +98 -0
- package/hooks/test-validator.py +462 -0
- package/hooks/test_generator_hook.py +123 -0
- package/hooks/todo-state-tracker.py +114 -0
- package/hooks/tool-ledger.py +165 -0
- package/hooks/trust_review.py +662 -0
- package/hooks/user-prompt-submit.py +12 -0
- package/hud/omg-hud.mjs +1571 -0
- package/lab/__init__.py +1 -0
- package/lab/__pycache__/__init__.cpython-313.pyc +0 -0
- package/lab/__pycache__/axolotl_adapter.cpython-313.pyc +0 -0
- package/lab/__pycache__/forge_runner.cpython-313.pyc +0 -0
- package/lab/__pycache__/gazebo_adapter.cpython-313.pyc +0 -0
- package/lab/__pycache__/isaac_gym_adapter.cpython-313.pyc +0 -0
- package/lab/__pycache__/mock_isaac_env.cpython-313.pyc +0 -0
- package/lab/__pycache__/pipeline.cpython-313.pyc +0 -0
- package/lab/__pycache__/policies.cpython-313.pyc +0 -0
- package/lab/__pycache__/pybullet_adapter.cpython-313.pyc +0 -0
- package/lab/axolotl_adapter.py +531 -0
- package/lab/forge_runner.py +103 -0
- package/lab/gazebo_adapter.py +168 -0
- package/lab/isaac_gym_adapter.py +190 -0
- package/lab/mock_isaac_env.py +47 -0
- package/lab/pipeline.py +712 -0
- package/lab/policies.py +52 -0
- package/lab/pybullet_adapter.py +192 -0
- package/package.json +61 -0
- package/plugins/README.md +78 -0
- package/plugins/__init__.py +1 -0
- package/plugins/__pycache__/__init__.cpython-313.pyc +0 -0
- package/plugins/advanced/commands/OMG-code-review.md +114 -0
- package/plugins/advanced/commands/OMG-deep-plan.md +266 -0
- package/plugins/advanced/commands/OMG-handoff.md +115 -0
- package/plugins/advanced/commands/OMG-learn.md +110 -0
- package/plugins/advanced/commands/OMG-maintainer.md +31 -0
- package/plugins/advanced/commands/OMG-ralph-start.md +43 -0
- package/plugins/advanced/commands/OMG-ralph-stop.md +23 -0
- package/plugins/advanced/commands/OMG-security-review.md +16 -0
- package/plugins/advanced/commands/OMG-sequential-thinking.md +20 -0
- package/plugins/advanced/commands/OMG-ship.md +46 -0
- package/plugins/advanced/commands/OMG:code-review.md +114 -0
- package/plugins/advanced/commands/OMG:deep-plan.md +266 -0
- package/plugins/advanced/commands/OMG:handoff.md +115 -0
- package/plugins/advanced/commands/OMG:learn.md +110 -0
- package/plugins/advanced/commands/OMG:maintainer.md +31 -0
- package/plugins/advanced/commands/OMG:ralph-start.md +43 -0
- package/plugins/advanced/commands/OMG:ralph-stop.md +23 -0
- package/plugins/advanced/commands/OMG:security-review.md +16 -0
- package/plugins/advanced/commands/OMG:sequential-thinking.md +20 -0
- package/plugins/advanced/commands/OMG:ship.md +46 -0
- package/plugins/advanced/plugin.json +104 -0
- package/plugins/core/plugin.json +204 -0
- package/plugins/dephealth/__init__.py +0 -0
- package/plugins/dephealth/__pycache__/__init__.cpython-313.pyc +0 -0
- package/plugins/dephealth/__pycache__/cve_scanner.cpython-313.pyc +0 -0
- package/plugins/dephealth/__pycache__/license_checker.cpython-313.pyc +0 -0
- package/plugins/dephealth/__pycache__/manifest_detector.cpython-313.pyc +0 -0
- package/plugins/dephealth/__pycache__/vuln_analyzer.cpython-313.pyc +0 -0
- package/plugins/dephealth/cve_scanner.py +279 -0
- package/plugins/dephealth/license_checker.py +135 -0
- package/plugins/dephealth/manifest_detector.py +423 -0
- package/plugins/dephealth/vuln_analyzer.py +176 -0
- package/plugins/testgen/__init__.py +0 -0
- package/plugins/testgen/__pycache__/__init__.cpython-313.pyc +0 -0
- package/plugins/testgen/__pycache__/codamosa_engine.cpython-313.pyc +0 -0
- package/plugins/testgen/__pycache__/edge_case_synthesizer.cpython-313.pyc +0 -0
- package/plugins/testgen/__pycache__/framework_detector.cpython-313.pyc +0 -0
- package/plugins/testgen/__pycache__/skeleton_generator.cpython-313.pyc +0 -0
- package/plugins/testgen/codamosa_engine.py +402 -0
- package/plugins/testgen/edge_case_synthesizer.py +184 -0
- package/plugins/testgen/framework_detector.py +271 -0
- package/plugins/testgen/skeleton_generator.py +219 -0
- package/plugins/viz/__init__.py +0 -0
- package/plugins/viz/__pycache__/__init__.cpython-313.pyc +0 -0
- package/plugins/viz/__pycache__/ast_parser.cpython-313.pyc +0 -0
- package/plugins/viz/__pycache__/diagram_generator.cpython-313.pyc +0 -0
- package/plugins/viz/__pycache__/graph_builder.cpython-313.pyc +0 -0
- package/plugins/viz/__pycache__/native_parsers.cpython-313.pyc +0 -0
- package/plugins/viz/__pycache__/regex_parser.cpython-313.pyc +0 -0
- package/plugins/viz/ast_parser.py +139 -0
- package/plugins/viz/diagram_generator.py +192 -0
- package/plugins/viz/graph_builder.py +444 -0
- package/plugins/viz/native_parsers.py +259 -0
- package/plugins/viz/regex_parser.py +112 -0
- package/pyproject.toml +143 -0
- package/registry/__init__.py +1 -0
- package/registry/__pycache__/__init__.cpython-313.pyc +0 -0
- package/registry/__pycache__/approval_artifact.cpython-313.pyc +0 -0
- package/registry/__pycache__/verify_artifact.cpython-313.pyc +0 -0
- package/registry/approval_artifact.py +236 -0
- package/registry/bundles/algorithms.yaml +45 -0
- package/registry/bundles/api-twin.yaml +48 -0
- package/registry/bundles/ast-pack.yaml +80 -0
- package/registry/bundles/claim-judge.yaml +49 -0
- package/registry/bundles/control-plane.yaml +192 -0
- package/registry/bundles/data-lineage.yaml +47 -0
- package/registry/bundles/delta-classifier.yaml +47 -0
- package/registry/bundles/eval-gate.yaml +47 -0
- package/registry/bundles/hash-edit.yaml +73 -0
- package/registry/bundles/health.yaml +45 -0
- package/registry/bundles/hook-governor.yaml +101 -0
- package/registry/bundles/incident-replay.yaml +47 -0
- package/registry/bundles/lsp-pack.yaml +80 -0
- package/registry/bundles/mcp-fabric.yaml +53 -0
- package/registry/bundles/plan-council.yaml +56 -0
- package/registry/bundles/preflight.yaml +48 -0
- package/registry/bundles/proof-gate.yaml +49 -0
- package/registry/bundles/remote-supervisor.yaml +49 -0
- package/registry/bundles/robotics.yaml +45 -0
- package/registry/bundles/secure-worktree-pipeline.yaml +69 -0
- package/registry/bundles/security-check.yaml +50 -0
- package/registry/bundles/terminal-lane.yaml +61 -0
- package/registry/bundles/test-intent-lock.yaml +49 -0
- package/registry/bundles/tracebank.yaml +47 -0
- package/registry/bundles/vision.yaml +45 -0
- package/registry/omg-capability.schema.json +378 -0
- package/registry/policy-packs/airgapped.lock.json +11 -0
- package/registry/policy-packs/airgapped.signature.json +10 -0
- package/registry/policy-packs/airgapped.yaml +16 -0
- package/registry/policy-packs/fintech.lock.json +11 -0
- package/registry/policy-packs/fintech.signature.json +10 -0
- package/registry/policy-packs/fintech.yaml +15 -0
- package/registry/policy-packs/locked-prod.lock.json +11 -0
- package/registry/policy-packs/locked-prod.signature.json +10 -0
- package/registry/policy-packs/locked-prod.yaml +18 -0
- package/registry/trusted_signers.json +44 -0
- package/registry/verify_artifact.py +493 -0
- package/runtime/__init__.py +36 -0
- package/runtime/__pycache__/__init__.cpython-313.pyc +0 -0
- package/runtime/__pycache__/adoption.cpython-313.pyc +0 -0
- package/runtime/__pycache__/agent_selector.cpython-313.pyc +0 -0
- package/runtime/__pycache__/api_twin.cpython-313.pyc +0 -0
- package/runtime/__pycache__/architecture_signal.cpython-313.pyc +0 -0
- package/runtime/__pycache__/artifact_parsers.cpython-313.pyc +0 -0
- package/runtime/__pycache__/asset_loader.cpython-313.pyc +0 -0
- package/runtime/__pycache__/background_verification.cpython-313.pyc +0 -0
- package/runtime/__pycache__/budget_envelopes.cpython-313.pyc +0 -0
- package/runtime/__pycache__/business_workflow.cpython-313.pyc +0 -0
- package/runtime/__pycache__/canonical_surface.cpython-313.pyc +0 -0
- package/runtime/__pycache__/canonical_taxonomy.cpython-313.pyc +0 -0
- package/runtime/__pycache__/claim_judge.cpython-313.pyc +0 -0
- package/runtime/__pycache__/cli_provider.cpython-313.pyc +0 -0
- package/runtime/__pycache__/compat.cpython-313.pyc +0 -0
- package/runtime/__pycache__/complexity_scorer.cpython-313.pyc +0 -0
- package/runtime/__pycache__/compliance_governor.cpython-313.pyc +0 -0
- package/runtime/__pycache__/config_transaction.cpython-313.pyc +0 -0
- package/runtime/__pycache__/context_compiler.cpython-313.pyc +0 -0
- package/runtime/__pycache__/context_engine.cpython-313.pyc +0 -0
- package/runtime/__pycache__/context_limits.cpython-313.pyc +0 -0
- package/runtime/__pycache__/contract_compiler.cpython-313.pyc +0 -0
- package/runtime/__pycache__/custom_agent_loader.cpython-313.pyc +0 -0
- package/runtime/__pycache__/data_lineage.cpython-313.pyc +0 -0
- package/runtime/__pycache__/defense_state.cpython-313.pyc +0 -0
- package/runtime/__pycache__/delta_classifier.cpython-313.pyc +0 -0
- package/runtime/__pycache__/dispatcher.cpython-313.pyc +0 -0
- package/runtime/__pycache__/doc_generator.cpython-313.pyc +0 -0
- package/runtime/__pycache__/domain_packs.cpython-313.pyc +0 -0
- package/runtime/__pycache__/ecosystem.cpython-313.pyc +0 -0
- package/runtime/__pycache__/equalizer.cpython-313.pyc +0 -0
- package/runtime/__pycache__/eval_gate.cpython-313.pyc +0 -0
- package/runtime/__pycache__/evidence_narrator.cpython-313.pyc +0 -0
- package/runtime/__pycache__/evidence_query.cpython-313.pyc +0 -0
- package/runtime/__pycache__/evidence_registry.cpython-313.pyc +0 -0
- package/runtime/__pycache__/evidence_requirements.cpython-313.pyc +0 -0
- package/runtime/__pycache__/exec_kernel.cpython-313.pyc +0 -0
- package/runtime/__pycache__/explainer_formatter.cpython-313.pyc +0 -0
- package/runtime/__pycache__/feature_registry.cpython-313.pyc +0 -0
- package/runtime/__pycache__/forge_agents.cpython-313.pyc +0 -0
- package/runtime/__pycache__/forge_contracts.cpython-313.pyc +0 -0
- package/runtime/__pycache__/forge_domains.cpython-313.pyc +0 -0
- package/runtime/__pycache__/forge_run_id.cpython-313.pyc +0 -0
- package/runtime/__pycache__/github_integration.cpython-313.pyc +0 -0
- package/runtime/__pycache__/github_review_bot.cpython-313.pyc +0 -0
- package/runtime/__pycache__/github_review_contract.cpython-313.pyc +0 -0
- package/runtime/__pycache__/github_review_formatter.cpython-313.pyc +0 -0
- package/runtime/__pycache__/guide_assert.cpython-313.pyc +0 -0
- package/runtime/__pycache__/hook_governor.cpython-313.pyc +0 -0
- package/runtime/__pycache__/host_parity.cpython-313.pyc +0 -0
- package/runtime/__pycache__/incident_replay.cpython-313.pyc +0 -0
- package/runtime/__pycache__/install_planner.cpython-313.pyc +0 -0
- package/runtime/__pycache__/interaction_journal.cpython-313.pyc +0 -0
- package/runtime/__pycache__/issue_surface.cpython-313.pyc +0 -0
- package/runtime/__pycache__/legacy_compat.cpython-313.pyc +0 -0
- package/runtime/__pycache__/mcp_config_writers.cpython-313.pyc +0 -0
- package/runtime/__pycache__/mcp_lifecycle.cpython-313.pyc +0 -0
- package/runtime/__pycache__/mcp_memory_server.cpython-313.pyc +0 -0
- package/runtime/__pycache__/memory_store.cpython-313.pyc +0 -0
- package/runtime/__pycache__/merge_writer.cpython-313.pyc +0 -0
- package/runtime/__pycache__/music_omr_testbed.cpython-313.pyc +0 -0
- package/runtime/__pycache__/mutation_gate.cpython-313.pyc +0 -0
- package/runtime/__pycache__/omc_compat.cpython-313.pyc +0 -0
- package/runtime/__pycache__/omg_browser_cli.cpython-313.pyc +0 -0
- package/runtime/__pycache__/omg_mcp_server.cpython-313.pyc +0 -0
- package/runtime/__pycache__/opus_plan.cpython-313.pyc +0 -0
- package/runtime/__pycache__/playwright_adapter.cpython-313.pyc +0 -0
- package/runtime/__pycache__/playwright_pack.cpython-313.pyc +0 -0
- package/runtime/__pycache__/plugin_diagnostics.cpython-313.pyc +0 -0
- package/runtime/__pycache__/plugin_interop.cpython-313.pyc +0 -0
- package/runtime/__pycache__/policy_pack_loader.cpython-313.pyc +0 -0
- package/runtime/__pycache__/preflight.cpython-313.pyc +0 -0
- package/runtime/__pycache__/profile_io.cpython-313.pyc +0 -0
- package/runtime/__pycache__/prompt_compiler.cpython-313.pyc +0 -0
- package/runtime/__pycache__/proof_chain.cpython-313.pyc +0 -0
- package/runtime/__pycache__/proof_gate.cpython-313.pyc +0 -0
- package/runtime/__pycache__/provider_parity_eval.cpython-313.pyc +0 -0
- package/runtime/__pycache__/release_artifact_audit.cpython-313.pyc +0 -0
- package/runtime/__pycache__/release_run_coordinator.cpython-313.pyc +0 -0
- package/runtime/__pycache__/release_surface_compiler.cpython-313.pyc +0 -0
- package/runtime/__pycache__/release_surface_registry.cpython-313.pyc +0 -0
- package/runtime/__pycache__/release_surfaces.cpython-313.pyc +0 -0
- package/runtime/__pycache__/remote_supervisor.cpython-313.pyc +0 -0
- package/runtime/__pycache__/repro_pack.cpython-313.pyc +0 -0
- package/runtime/__pycache__/rollback_manifest.cpython-313.pyc +0 -0
- package/runtime/__pycache__/router_critics.cpython-313.pyc +0 -0
- package/runtime/__pycache__/router_executor.cpython-313.pyc +0 -0
- package/runtime/__pycache__/router_selector.cpython-313.pyc +0 -0
- package/runtime/__pycache__/runtime_contracts.cpython-313.pyc +0 -0
- package/runtime/__pycache__/runtime_profile.cpython-313.pyc +0 -0
- package/runtime/__pycache__/security_check.cpython-313.pyc +0 -0
- package/runtime/__pycache__/session_health.cpython-313.pyc +0 -0
- package/runtime/__pycache__/skill_evolution.cpython-313.pyc +0 -0
- package/runtime/__pycache__/skill_registry.cpython-313.pyc +0 -0
- package/runtime/__pycache__/subagent_dispatcher.cpython-313.pyc +0 -0
- package/runtime/__pycache__/subscription_tiers.cpython-313.pyc +0 -0
- package/runtime/__pycache__/team_router.cpython-313.pyc +0 -0
- package/runtime/__pycache__/test_intent_lock.cpython-313-pytest-9.0.2.pyc +0 -0
- package/runtime/__pycache__/test_intent_lock.cpython-313.pyc +0 -0
- package/runtime/__pycache__/tmux_session_manager.cpython-313.pyc +0 -0
- package/runtime/__pycache__/tool_fabric.cpython-313.pyc +0 -0
- package/runtime/__pycache__/tool_plan_gate.cpython-313.pyc +0 -0
- package/runtime/__pycache__/tool_relevance.cpython-313.pyc +0 -0
- package/runtime/__pycache__/tracebank.cpython-313.pyc +0 -0
- package/runtime/__pycache__/untrusted_content.cpython-313.pyc +0 -0
- package/runtime/__pycache__/validate.cpython-313.pyc +0 -0
- package/runtime/__pycache__/verdict_schema.cpython-313.pyc +0 -0
- package/runtime/__pycache__/verification_controller.cpython-313.pyc +0 -0
- package/runtime/__pycache__/verification_loop.cpython-313.pyc +0 -0
- package/runtime/__pycache__/vision_artifacts.cpython-313.pyc +0 -0
- package/runtime/__pycache__/vision_cache.cpython-313.pyc +0 -0
- package/runtime/__pycache__/vision_jobs.cpython-313.pyc +0 -0
- package/runtime/__pycache__/worker_watchdog.cpython-313.pyc +0 -0
- package/runtime/adapters/__init__.py +13 -0
- package/runtime/adapters/__pycache__/__init__.cpython-313.pyc +0 -0
- package/runtime/adapters/__pycache__/claude.cpython-313.pyc +0 -0
- package/runtime/adapters/__pycache__/gpt.cpython-313.pyc +0 -0
- package/runtime/adapters/__pycache__/local.cpython-313.pyc +0 -0
- package/runtime/adapters/claude.py +63 -0
- package/runtime/adapters/gpt.py +56 -0
- package/runtime/adapters/local.py +56 -0
- package/runtime/adoption.py +280 -0
- package/runtime/api_twin.py +450 -0
- package/runtime/architecture_signal.py +226 -0
- package/runtime/artifact_parsers.py +161 -0
- package/runtime/asset_loader.py +62 -0
- package/runtime/background_verification.py +178 -0
- package/runtime/budget_envelopes.py +398 -0
- package/runtime/business_workflow.py +234 -0
- package/runtime/canonical_surface.py +53 -0
- package/runtime/canonical_taxonomy.py +27 -0
- package/runtime/claim_judge.py +648 -0
- package/runtime/cli_provider.py +105 -0
- package/runtime/compat.py +2222 -0
- package/runtime/complexity_scorer.py +148 -0
- package/runtime/compliance_governor.py +505 -0
- package/runtime/config_transaction.py +304 -0
- package/runtime/context_compiler.py +131 -0
- package/runtime/context_engine.py +708 -0
- package/runtime/context_limits.py +363 -0
- package/runtime/contract_compiler.py +3664 -0
- package/runtime/custom_agent_loader.py +366 -0
- package/runtime/data_lineage.py +244 -0
- package/runtime/defense_state.py +261 -0
- package/runtime/delta_classifier.py +231 -0
- package/runtime/dispatcher.py +47 -0
- package/runtime/doc_generator.py +319 -0
- package/runtime/domain_packs.py +75 -0
- package/runtime/ecosystem.py +371 -0
- package/runtime/equalizer.py +268 -0
- package/runtime/eval_gate.py +96 -0
- package/runtime/evidence_narrator.py +147 -0
- package/runtime/evidence_query.py +303 -0
- package/runtime/evidence_registry.py +16 -0
- package/runtime/evidence_requirements.py +157 -0
- package/runtime/exec_kernel.py +267 -0
- package/runtime/explainer_formatter.py +82 -0
- package/runtime/feature_registry.py +109 -0
- package/runtime/forge_agents.py +915 -0
- package/runtime/forge_contracts.py +519 -0
- package/runtime/forge_domains.py +68 -0
- package/runtime/forge_run_id.py +86 -0
- package/runtime/guide_assert.py +135 -0
- package/runtime/hook_governor.py +156 -0
- package/runtime/host_parity.py +373 -0
- package/runtime/incident_replay.py +310 -0
- package/runtime/install_planner.py +617 -0
- package/runtime/interaction_journal.py +566 -0
- package/runtime/issue_surface.py +472 -0
- package/runtime/legacy_compat.py +7 -0
- package/runtime/mcp_config_writers.py +360 -0
- package/runtime/mcp_lifecycle.py +175 -0
- package/runtime/mcp_memory_server.py +220 -0
- package/runtime/memory_parsers/__init__.py +0 -0
- package/runtime/memory_parsers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/runtime/memory_parsers/__pycache__/chatgpt_parser.cpython-313.pyc +0 -0
- package/runtime/memory_parsers/__pycache__/claude_import.cpython-313.pyc +0 -0
- package/runtime/memory_parsers/__pycache__/export.cpython-313.pyc +0 -0
- package/runtime/memory_parsers/__pycache__/gemini_import.cpython-313.pyc +0 -0
- package/runtime/memory_parsers/__pycache__/kimi_import.cpython-313.pyc +0 -0
- package/runtime/memory_parsers/chatgpt_parser.py +257 -0
- package/runtime/memory_parsers/claude_import.py +107 -0
- package/runtime/memory_parsers/export.py +97 -0
- package/runtime/memory_parsers/gemini_import.py +91 -0
- package/runtime/memory_parsers/kimi_import.py +91 -0
- package/runtime/memory_store.py +1182 -0
- package/runtime/merge_writer.py +445 -0
- package/runtime/music_omr_testbed.py +336 -0
- package/runtime/mutation_gate.py +320 -0
- package/runtime/omc_compat.py +7 -0
- package/runtime/omg_browser_cli.py +95 -0
- package/runtime/omg_compat_contract_snapshot.json +936 -0
- package/runtime/omg_contract_snapshot.json +936 -0
- package/runtime/omg_mcp_server.py +306 -0
- package/runtime/playwright_adapter.py +39 -0
- package/runtime/playwright_pack.py +253 -0
- package/runtime/plugin_diagnostics.py +308 -0
- package/runtime/plugin_interop.py +1060 -0
- package/runtime/policy_pack_loader.py +147 -0
- package/runtime/preflight.py +135 -0
- package/runtime/profile_io.py +328 -0
- package/runtime/proof_chain.py +472 -0
- package/runtime/proof_gate.py +442 -0
- package/runtime/provider_parity_eval.py +109 -0
- package/runtime/providers/__init__.py +0 -0
- package/runtime/providers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/runtime/providers/__pycache__/codex_provider.cpython-313.pyc +0 -0
- package/runtime/providers/__pycache__/gemini_provider.cpython-313.pyc +0 -0
- package/runtime/providers/__pycache__/kimi_provider.cpython-313.pyc +0 -0
- package/runtime/providers/__pycache__/opencode_provider.cpython-313.pyc +0 -0
- package/runtime/providers/codex_provider.py +129 -0
- package/runtime/providers/gemini_provider.py +143 -0
- package/runtime/providers/kimi_provider.py +167 -0
- package/runtime/providers/opencode_provider.py +99 -0
- package/runtime/release_artifact_audit.py +556 -0
- package/runtime/release_run_coordinator.py +574 -0
- package/runtime/release_surface_compiler.py +643 -0
- package/runtime/release_surface_registry.py +283 -0
- package/runtime/release_surfaces.py +320 -0
- package/runtime/remote_supervisor.py +79 -0
- package/runtime/repro_pack.py +398 -0
- package/runtime/rollback_manifest.py +143 -0
- package/runtime/router_critics.py +229 -0
- package/runtime/router_executor.py +142 -0
- package/runtime/router_selector.py +99 -0
- package/runtime/runtime_contracts.py +292 -0
- package/runtime/runtime_profile.py +133 -0
- package/runtime/security_check.py +1094 -0
- package/runtime/session_health.py +546 -0
- package/runtime/skill_evolution.py +221 -0
- package/runtime/skill_registry.py +53 -0
- package/runtime/subagent_dispatcher.py +604 -0
- package/runtime/subscription_tiers.py +258 -0
- package/runtime/team_router.py +1399 -0
- package/runtime/test_intent_lock.py +543 -0
- package/runtime/tmux_session_manager.py +172 -0
- package/runtime/tool_fabric.py +570 -0
- package/runtime/tool_plan_gate.py +460 -0
- package/runtime/tracebank.py +125 -0
- package/runtime/untrusted_content.py +360 -0
- package/runtime/validate.py +293 -0
- package/runtime/verdict_schema.py +198 -0
- package/runtime/verification_controller.py +235 -0
- package/runtime/verification_loop.py +73 -0
- package/runtime/vision_artifacts.py +31 -0
- package/runtime/vision_cache.py +38 -0
- package/runtime/vision_jobs.py +92 -0
- package/runtime/worker_watchdog.py +526 -0
- package/scripts/__pycache__/audit-published-artifact.cpython-313.pyc +0 -0
- package/scripts/__pycache__/check-doc-parity.cpython-313.pyc +0 -0
- package/scripts/__pycache__/check-omg-standalone-clean.cpython-313.pyc +0 -0
- package/scripts/__pycache__/github_review_helpers.cpython-313.pyc +0 -0
- package/scripts/__pycache__/omg.cpython-313.pyc +0 -0
- package/scripts/__pycache__/prepare-release-proof-fixtures.cpython-313.pyc +0 -0
- package/scripts/__pycache__/sync-release-identity.cpython-313.pyc +0 -0
- package/scripts/__pycache__/validate-release-identity.cpython-313.pyc +0 -0
- package/scripts/audit-published-artifact.py +59 -0
- package/scripts/check-omg-compat-contract-snapshot.py +137 -0
- package/scripts/check-omg-contract-snapshot.py +12 -0
- package/scripts/check-omg-public-ready.py +273 -0
- package/scripts/check-omg-standalone-clean.py +133 -0
- package/scripts/emit_host_parity.py +72 -0
- package/scripts/legacy_to_omg_migrate.py +29 -0
- package/scripts/migrate-legacy.py +464 -0
- package/scripts/omc_to_omg_migrate.py +12 -0
- package/scripts/omg.py +2962 -0
- package/scripts/pre-release-check.sh +38 -0
- package/scripts/prepare-release-proof-fixtures.py +602 -0
- package/scripts/print-canonical-version.py +80 -0
- package/scripts/settings-merge.py +289 -0
- package/scripts/sync-release-identity.py +481 -0
- package/scripts/validate-release-identity.py +632 -0
- package/scripts/verify-no-omc.sh +5 -0
- package/scripts/verify-standalone.sh +35 -0
- package/settings.json +751 -0
- package/tools/__init__.py +2 -0
- package/tools/__pycache__/__init__.cpython-313.pyc +0 -0
- package/tools/__pycache__/browser_consent.cpython-313.pyc +0 -0
- package/tools/__pycache__/browser_stealth.cpython-313.pyc +0 -0
- package/tools/__pycache__/browser_tool.cpython-313.pyc +0 -0
- package/tools/__pycache__/changelog_generator.cpython-313.pyc +0 -0
- package/tools/__pycache__/commit_splitter.cpython-313.pyc +0 -0
- package/tools/__pycache__/config_discovery.cpython-313.pyc +0 -0
- package/tools/__pycache__/config_merger.cpython-313.pyc +0 -0
- package/tools/__pycache__/dashboard_generator.cpython-313.pyc +0 -0
- package/tools/__pycache__/git_inspector.cpython-313.pyc +0 -0
- package/tools/__pycache__/lsp_client.cpython-313.pyc +0 -0
- package/tools/__pycache__/lsp_operations.cpython-313.pyc +0 -0
- package/tools/__pycache__/pr_generator.cpython-313.pyc +0 -0
- package/tools/__pycache__/python_repl.cpython-313.pyc +0 -0
- package/tools/__pycache__/python_sandbox.cpython-313.pyc +0 -0
- package/tools/__pycache__/session_snapshot.cpython-313.pyc +0 -0
- package/tools/__pycache__/ssh_manager.cpython-313.pyc +0 -0
- package/tools/__pycache__/theme_engine.cpython-313.pyc +0 -0
- package/tools/__pycache__/theme_selector.cpython-313.pyc +0 -0
- package/tools/__pycache__/web_search.cpython-313.pyc +0 -0
- package/tools/browser_consent.py +289 -0
- package/tools/browser_stealth.py +481 -0
- package/tools/browser_tool.py +448 -0
- package/tools/changelog_generator.py +347 -0
- package/tools/commit_splitter.py +749 -0
- package/tools/config_discovery.py +151 -0
- package/tools/config_merger.py +449 -0
- package/tools/dashboard_generator.py +300 -0
- package/tools/git_inspector.py +298 -0
- package/tools/lsp_client.py +275 -0
- package/tools/lsp_discovery.py +231 -0
- package/tools/lsp_operations.py +392 -0
- package/tools/pr_generator.py +404 -0
- package/tools/python_repl.py +712 -0
- package/tools/python_sandbox.py +768 -0
- package/tools/search_providers/__init__.py +77 -0
- package/tools/search_providers/__pycache__/__init__.cpython-313.pyc +0 -0
- package/tools/search_providers/__pycache__/brave.cpython-313.pyc +0 -0
- package/tools/search_providers/__pycache__/exa.cpython-313.pyc +0 -0
- package/tools/search_providers/__pycache__/jina.cpython-313.pyc +0 -0
- package/tools/search_providers/__pycache__/perplexity.cpython-313.pyc +0 -0
- package/tools/search_providers/__pycache__/synthetic.cpython-313.pyc +0 -0
- package/tools/search_providers/brave.py +115 -0
- package/tools/search_providers/exa.py +116 -0
- package/tools/search_providers/jina.py +104 -0
- package/tools/search_providers/perplexity.py +139 -0
- package/tools/search_providers/synthetic.py +74 -0
- package/tools/session_snapshot.py +851 -0
- package/tools/ssh_manager.py +912 -0
- package/tools/theme_engine.py +296 -0
- package/tools/theme_selector.py +137 -0
- package/tools/web_search.py +675 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
"""Multi-dimensional budget envelopes — CPU, memory, wall time, tokens, and network.
|
|
2
|
+
|
|
3
|
+
Tracks per-run and per-worker resource usage against configurable limits.
|
|
4
|
+
Persists envelope state to `.omg/state/budget-envelopes/<run_id>.json`.
|
|
5
|
+
Feeds into session health, worker watchdogs, and governed tool decisions.
|
|
6
|
+
|
|
7
|
+
Governance actions:
|
|
8
|
+
- warn: log only, no execution impact
|
|
9
|
+
- reflect: pause and report to supervisor
|
|
10
|
+
- block: terminate / reject further work
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import json
|
|
16
|
+
import os
|
|
17
|
+
import time
|
|
18
|
+
from dataclasses import asdict, dataclass, field
|
|
19
|
+
from datetime import datetime, timezone
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import Any
|
|
22
|
+
|
|
23
|
+
from hooks.security_validators import sanitize_run_id
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# ═══════════════════════════════════════════════════════════
|
|
27
|
+
# Dataclasses
|
|
28
|
+
# ═══════════════════════════════════════════════════════════
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass
|
|
32
|
+
class BudgetEnvelope:
|
|
33
|
+
"""Declared resource limits for a run or worker."""
|
|
34
|
+
|
|
35
|
+
run_id: str
|
|
36
|
+
cpu_seconds_limit: float = 0.0
|
|
37
|
+
memory_mb_limit: float = 0.0
|
|
38
|
+
wall_time_seconds_limit: float = 0.0
|
|
39
|
+
token_limit: int = 0
|
|
40
|
+
network_bytes_limit: int = 0
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass
|
|
44
|
+
class BudgetEnvelopeState:
|
|
45
|
+
"""Current resource usage tracking for a run or worker."""
|
|
46
|
+
|
|
47
|
+
run_id: str
|
|
48
|
+
cpu_seconds_used: float = 0.0
|
|
49
|
+
memory_mb_peak: float = 0.0
|
|
50
|
+
wall_time_seconds_elapsed: float = 0.0
|
|
51
|
+
tokens_used: int = 0
|
|
52
|
+
network_bytes_used: int = 0
|
|
53
|
+
started_at: str = ""
|
|
54
|
+
updated_at: str = ""
|
|
55
|
+
status: str = "active" # "active" or "closed"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass
|
|
59
|
+
class EnvelopeCheckResult:
|
|
60
|
+
"""Result of checking a run against its envelope limits."""
|
|
61
|
+
|
|
62
|
+
status: str # "ok", "warn", "breach"
|
|
63
|
+
breached_dimensions: list[str] = field(default_factory=list)
|
|
64
|
+
governance_action: str = "warn" # "warn", "reflect", "block"
|
|
65
|
+
reason: str = ""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# ═══════════════════════════════════════════════════════════
|
|
69
|
+
# Constants
|
|
70
|
+
# ═══════════════════════════════════════════════════════════
|
|
71
|
+
|
|
72
|
+
_GOVERNANCE_ACTIONS = frozenset({"warn", "reflect", "block"})
|
|
73
|
+
|
|
74
|
+
# Warn at 80%, block at 100% by default
|
|
75
|
+
_DEFAULT_WARN_RATIO = 0.80
|
|
76
|
+
_DEFAULT_BLOCK_RATIO = 1.00
|
|
77
|
+
|
|
78
|
+
_ENVELOPE_STATE_REL = Path(".omg") / "state" / "budget-envelopes"
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# ═══════════════════════════════════════════════════════════
|
|
82
|
+
# Manager
|
|
83
|
+
# ═══════════════════════════════════════════════════════════
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class BudgetEnvelopeManager:
|
|
87
|
+
"""Create, track, and enforce multi-dimensional budget envelopes.
|
|
88
|
+
|
|
89
|
+
Envelopes are persisted as JSON to `.omg/state/budget-envelopes/<run_id>.json`.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
def __init__(self, project_dir: str | None = None):
|
|
93
|
+
if project_dir:
|
|
94
|
+
self.project_dir = Path(project_dir)
|
|
95
|
+
else:
|
|
96
|
+
self.project_dir = Path(os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd()))
|
|
97
|
+
|
|
98
|
+
# --- Paths ---
|
|
99
|
+
|
|
100
|
+
def _envelope_dir(self) -> Path:
|
|
101
|
+
return self.project_dir / _ENVELOPE_STATE_REL
|
|
102
|
+
|
|
103
|
+
def _envelope_path(self, run_id: str) -> Path:
|
|
104
|
+
return self._envelope_dir() / f"{sanitize_run_id(run_id)}.json"
|
|
105
|
+
|
|
106
|
+
# --- CRUD ---
|
|
107
|
+
|
|
108
|
+
def create_envelope(
|
|
109
|
+
self,
|
|
110
|
+
run_id: str,
|
|
111
|
+
*,
|
|
112
|
+
cpu_seconds_limit: float = 0.0,
|
|
113
|
+
memory_mb_limit: float = 0.0,
|
|
114
|
+
wall_time_seconds_limit: float = 0.0,
|
|
115
|
+
token_limit: int = 0,
|
|
116
|
+
network_bytes_limit: int = 0,
|
|
117
|
+
) -> dict[str, Any]:
|
|
118
|
+
"""Create and persist a new budget envelope for *run_id*.
|
|
119
|
+
|
|
120
|
+
Returns the full persisted state dict.
|
|
121
|
+
"""
|
|
122
|
+
now = _now_iso()
|
|
123
|
+
envelope = BudgetEnvelope(
|
|
124
|
+
run_id=run_id,
|
|
125
|
+
cpu_seconds_limit=cpu_seconds_limit,
|
|
126
|
+
memory_mb_limit=memory_mb_limit,
|
|
127
|
+
wall_time_seconds_limit=wall_time_seconds_limit,
|
|
128
|
+
token_limit=token_limit,
|
|
129
|
+
network_bytes_limit=network_bytes_limit,
|
|
130
|
+
)
|
|
131
|
+
state = BudgetEnvelopeState(
|
|
132
|
+
run_id=run_id,
|
|
133
|
+
started_at=now,
|
|
134
|
+
updated_at=now,
|
|
135
|
+
)
|
|
136
|
+
payload: dict[str, Any] = {
|
|
137
|
+
"schema": "BudgetEnvelopeState",
|
|
138
|
+
"schema_version": "1.0.0",
|
|
139
|
+
"status": "active",
|
|
140
|
+
"envelope": asdict(envelope),
|
|
141
|
+
"usage": asdict(state),
|
|
142
|
+
"checks": [],
|
|
143
|
+
}
|
|
144
|
+
_write_atomic_json(self._envelope_path(run_id), payload)
|
|
145
|
+
return payload
|
|
146
|
+
|
|
147
|
+
def record_usage(
|
|
148
|
+
self,
|
|
149
|
+
run_id: str,
|
|
150
|
+
*,
|
|
151
|
+
cpu_seconds: float = 0.0,
|
|
152
|
+
memory_mb: float = 0.0,
|
|
153
|
+
wall_time_seconds: float = 0.0,
|
|
154
|
+
tokens: int = 0,
|
|
155
|
+
network_bytes: int = 0,
|
|
156
|
+
) -> dict[str, Any]:
|
|
157
|
+
"""Increment usage counters for *run_id*.
|
|
158
|
+
|
|
159
|
+
Memory is tracked as peak (max), all others are additive.
|
|
160
|
+
Returns the updated state dict.
|
|
161
|
+
"""
|
|
162
|
+
payload = self._read_state(run_id)
|
|
163
|
+
if not payload:
|
|
164
|
+
# Auto-create a zero-limit envelope (uncapped) so usage is still tracked
|
|
165
|
+
payload = self.create_envelope(run_id)
|
|
166
|
+
|
|
167
|
+
usage = payload.get("usage", {})
|
|
168
|
+
usage["cpu_seconds_used"] = _to_float(usage.get("cpu_seconds_used"), 0.0) + cpu_seconds
|
|
169
|
+
usage["memory_mb_peak"] = max(
|
|
170
|
+
_to_float(usage.get("memory_mb_peak"), 0.0),
|
|
171
|
+
memory_mb,
|
|
172
|
+
)
|
|
173
|
+
usage["wall_time_seconds_elapsed"] = (
|
|
174
|
+
_to_float(usage.get("wall_time_seconds_elapsed"), 0.0) + wall_time_seconds
|
|
175
|
+
)
|
|
176
|
+
usage["tokens_used"] = _to_int(usage.get("tokens_used"), 0) + tokens
|
|
177
|
+
usage["network_bytes_used"] = _to_int(usage.get("network_bytes_used"), 0) + network_bytes
|
|
178
|
+
usage["updated_at"] = _now_iso()
|
|
179
|
+
payload["usage"] = usage
|
|
180
|
+
|
|
181
|
+
_write_atomic_json(self._envelope_path(run_id), payload)
|
|
182
|
+
return payload
|
|
183
|
+
|
|
184
|
+
def check_envelope(self, run_id: str) -> EnvelopeCheckResult:
|
|
185
|
+
"""Compare current usage against envelope limits.
|
|
186
|
+
|
|
187
|
+
Returns an ``EnvelopeCheckResult`` with status, breached dimensions, and
|
|
188
|
+
the appropriate governance action.
|
|
189
|
+
|
|
190
|
+
Governance escalation logic:
|
|
191
|
+
- No limit set (0) → dimension is uncapped, never breaches.
|
|
192
|
+
- Usage >= 100% of limit → status=breach, action=block.
|
|
193
|
+
- Usage >= 80% of limit → status=warn, action=warn (first time) or reflect (repeated).
|
|
194
|
+
- Otherwise → status=ok, action=warn (no-op).
|
|
195
|
+
"""
|
|
196
|
+
payload = self._read_state(run_id)
|
|
197
|
+
if not payload:
|
|
198
|
+
return EnvelopeCheckResult(status="ok", reason="no envelope found")
|
|
199
|
+
if payload.get("status", "active") == "closed":
|
|
200
|
+
return EnvelopeCheckResult(status="ok", reason="envelope closed")
|
|
201
|
+
|
|
202
|
+
envelope = payload.get("envelope", {})
|
|
203
|
+
usage = payload.get("usage", {})
|
|
204
|
+
checks_history: list[dict[str, Any]] = payload.get("checks", [])
|
|
205
|
+
|
|
206
|
+
breached: list[str] = []
|
|
207
|
+
warned: list[str] = []
|
|
208
|
+
|
|
209
|
+
_DIMS: list[tuple[str, str, str]] = [
|
|
210
|
+
("cpu_seconds_limit", "cpu_seconds_used", "cpu"),
|
|
211
|
+
("memory_mb_limit", "memory_mb_peak", "memory"),
|
|
212
|
+
("wall_time_seconds_limit", "wall_time_seconds_elapsed", "wall_time"),
|
|
213
|
+
("token_limit", "tokens_used", "tokens"),
|
|
214
|
+
("network_bytes_limit", "network_bytes_used", "network"),
|
|
215
|
+
]
|
|
216
|
+
|
|
217
|
+
for limit_key, used_key, dim_name in _DIMS:
|
|
218
|
+
limit_val = _to_float(envelope.get(limit_key), 0.0)
|
|
219
|
+
if limit_val <= 0:
|
|
220
|
+
continue # uncapped
|
|
221
|
+
used_val = _to_float(usage.get(used_key), 0.0)
|
|
222
|
+
ratio = used_val / limit_val
|
|
223
|
+
|
|
224
|
+
if ratio >= _DEFAULT_BLOCK_RATIO:
|
|
225
|
+
breached.append(dim_name)
|
|
226
|
+
elif ratio >= _DEFAULT_WARN_RATIO:
|
|
227
|
+
warned.append(dim_name)
|
|
228
|
+
|
|
229
|
+
# Determine governance action
|
|
230
|
+
if breached:
|
|
231
|
+
status = "breach"
|
|
232
|
+
governance_action = "block"
|
|
233
|
+
reason = f"envelope breached on: {', '.join(breached)}"
|
|
234
|
+
elif warned:
|
|
235
|
+
# Escalate to reflect if we warned before on the same dimensions
|
|
236
|
+
prior_warned = set()
|
|
237
|
+
for chk in checks_history:
|
|
238
|
+
if chk.get("status") == "warn":
|
|
239
|
+
prior_warned.update(chk.get("breached_dimensions", []))
|
|
240
|
+
repeat_warns = set(warned) & prior_warned
|
|
241
|
+
if repeat_warns:
|
|
242
|
+
status = "warn"
|
|
243
|
+
governance_action = "reflect"
|
|
244
|
+
reason = f"repeated warning on: {', '.join(sorted(repeat_warns))}"
|
|
245
|
+
else:
|
|
246
|
+
status = "warn"
|
|
247
|
+
governance_action = "warn"
|
|
248
|
+
reason = f"approaching limits on: {', '.join(warned)}"
|
|
249
|
+
else:
|
|
250
|
+
status = "ok"
|
|
251
|
+
governance_action = "warn" # no-op sentinel
|
|
252
|
+
reason = "all dimensions within limits"
|
|
253
|
+
|
|
254
|
+
result = EnvelopeCheckResult(
|
|
255
|
+
status=status,
|
|
256
|
+
breached_dimensions=breached or warned,
|
|
257
|
+
governance_action=governance_action,
|
|
258
|
+
reason=reason,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
# Persist check result in history
|
|
262
|
+
check_record = {
|
|
263
|
+
"checked_at": _now_iso(),
|
|
264
|
+
"status": result.status,
|
|
265
|
+
"breached_dimensions": list(result.breached_dimensions),
|
|
266
|
+
"governance_action": result.governance_action,
|
|
267
|
+
"reason": result.reason,
|
|
268
|
+
}
|
|
269
|
+
checks_history.append(check_record)
|
|
270
|
+
if len(checks_history) > 50:
|
|
271
|
+
checks_history = checks_history[-50:]
|
|
272
|
+
payload["checks"] = checks_history
|
|
273
|
+
_write_atomic_json(self._envelope_path(run_id), payload)
|
|
274
|
+
|
|
275
|
+
return result
|
|
276
|
+
|
|
277
|
+
def close_envelope(self, run_id: str, reason: str) -> None:
|
|
278
|
+
payload = self._read_state(run_id)
|
|
279
|
+
if not payload:
|
|
280
|
+
return
|
|
281
|
+
payload["status"] = "closed"
|
|
282
|
+
payload["closed_at"] = _now_iso()
|
|
283
|
+
payload["close_reason"] = reason
|
|
284
|
+
_write_atomic_json(self._envelope_path(run_id), payload)
|
|
285
|
+
|
|
286
|
+
def list_envelopes(self) -> list[dict[str, Any]]:
|
|
287
|
+
env_dir = self._envelope_dir()
|
|
288
|
+
if not env_dir.exists():
|
|
289
|
+
return []
|
|
290
|
+
result: list[dict[str, Any]] = []
|
|
291
|
+
for path in sorted(env_dir.glob("*.json")):
|
|
292
|
+
if path.name.endswith(".tmp"):
|
|
293
|
+
continue
|
|
294
|
+
payload = _read_json(path)
|
|
295
|
+
if not payload:
|
|
296
|
+
continue
|
|
297
|
+
result.append({
|
|
298
|
+
"run_id": payload.get("usage", {}).get("run_id", path.stem),
|
|
299
|
+
"status": payload.get("status", "active"),
|
|
300
|
+
"envelope": payload.get("envelope", {}),
|
|
301
|
+
"usage": payload.get("usage", {}),
|
|
302
|
+
"checks_count": len(payload.get("checks", [])),
|
|
303
|
+
})
|
|
304
|
+
return result
|
|
305
|
+
|
|
306
|
+
def prune_check_history(self, run_id: str, max_entries: int = 50) -> None:
|
|
307
|
+
payload = self._read_state(run_id)
|
|
308
|
+
if not payload:
|
|
309
|
+
return
|
|
310
|
+
checks = payload.get("checks", [])
|
|
311
|
+
if len(checks) > max_entries:
|
|
312
|
+
payload["checks"] = checks[-max_entries:]
|
|
313
|
+
_write_atomic_json(self._envelope_path(run_id), payload)
|
|
314
|
+
|
|
315
|
+
def get_envelope_state(self, run_id: str) -> dict[str, Any] | None:
|
|
316
|
+
payload = self._read_state(run_id)
|
|
317
|
+
return payload if payload else None
|
|
318
|
+
|
|
319
|
+
def get_envelope_pressure(self, run_id: str) -> dict[str, float]:
|
|
320
|
+
payload = self._read_state(run_id)
|
|
321
|
+
if not payload:
|
|
322
|
+
return {}
|
|
323
|
+
if payload.get("status", "active") == "closed":
|
|
324
|
+
return {}
|
|
325
|
+
|
|
326
|
+
envelope = payload.get("envelope", {})
|
|
327
|
+
usage = payload.get("usage", {})
|
|
328
|
+
pressure: dict[str, float] = {}
|
|
329
|
+
|
|
330
|
+
_DIMS: list[tuple[str, str, str]] = [
|
|
331
|
+
("cpu_seconds_limit", "cpu_seconds_used", "cpu"),
|
|
332
|
+
("memory_mb_limit", "memory_mb_peak", "memory"),
|
|
333
|
+
("wall_time_seconds_limit", "wall_time_seconds_elapsed", "wall_time"),
|
|
334
|
+
("token_limit", "tokens_used", "tokens"),
|
|
335
|
+
("network_bytes_limit", "network_bytes_used", "network"),
|
|
336
|
+
]
|
|
337
|
+
|
|
338
|
+
for limit_key, used_key, dim_name in _DIMS:
|
|
339
|
+
limit_val = _to_float(envelope.get(limit_key), 0.0)
|
|
340
|
+
if limit_val <= 0:
|
|
341
|
+
continue
|
|
342
|
+
used_val = _to_float(usage.get(used_key), 0.0)
|
|
343
|
+
pressure[dim_name] = round(used_val / limit_val, 4)
|
|
344
|
+
|
|
345
|
+
return pressure
|
|
346
|
+
|
|
347
|
+
# --- Internal ---
|
|
348
|
+
|
|
349
|
+
def _read_state(self, run_id: str) -> dict[str, Any]:
|
|
350
|
+
return _read_json(self._envelope_path(run_id))
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
# ═══════════════════════════════════════════════════════════
|
|
354
|
+
# Helpers
|
|
355
|
+
# ═══════════════════════════════════════════════════════════
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def _now_iso() -> str:
|
|
359
|
+
return datetime.now(timezone.utc).isoformat()
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def _write_atomic_json(path: Path, payload: dict[str, Any]) -> None:
|
|
363
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
364
|
+
tmp_path = path.with_name(f"{path.name}.tmp")
|
|
365
|
+
tmp_path.write_text(
|
|
366
|
+
json.dumps(payload, indent=2, ensure_ascii=True) + "\n",
|
|
367
|
+
encoding="utf-8",
|
|
368
|
+
)
|
|
369
|
+
os.replace(tmp_path, path)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def _read_json(path: Path) -> dict[str, Any]:
|
|
373
|
+
if not path.exists():
|
|
374
|
+
return {}
|
|
375
|
+
try:
|
|
376
|
+
payload = json.loads(path.read_text(encoding="utf-8"))
|
|
377
|
+
except (OSError, json.JSONDecodeError):
|
|
378
|
+
return {}
|
|
379
|
+
return payload if isinstance(payload, dict) else {}
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
def _to_float(value: Any, default: float) -> float:
|
|
383
|
+
try:
|
|
384
|
+
return float(value)
|
|
385
|
+
except (TypeError, ValueError):
|
|
386
|
+
return default
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
def _to_int(value: Any, default: int) -> int:
|
|
390
|
+
try:
|
|
391
|
+
return int(value)
|
|
392
|
+
except (TypeError, ValueError):
|
|
393
|
+
return default
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def get_budget_envelope_manager(project_dir: str | None = None) -> BudgetEnvelopeManager:
|
|
397
|
+
"""Factory for BudgetEnvelopeManager instances."""
|
|
398
|
+
return BudgetEnvelopeManager(project_dir)
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterable
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
DEFAULT_WORKFLOW_PATH: tuple[str, ...] = (
|
|
7
|
+
"plan",
|
|
8
|
+
"implement",
|
|
9
|
+
"qa",
|
|
10
|
+
"simulate",
|
|
11
|
+
"final_test",
|
|
12
|
+
"production",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
_STAGE_ALIASES = {
|
|
16
|
+
"plan": "plan",
|
|
17
|
+
"planning": "plan",
|
|
18
|
+
"implement": "implement",
|
|
19
|
+
"implementation": "implement",
|
|
20
|
+
"build": "implement",
|
|
21
|
+
"qa": "qa",
|
|
22
|
+
"quality": "qa",
|
|
23
|
+
"quality_assurance": "qa",
|
|
24
|
+
"test": "final_test",
|
|
25
|
+
"testing": "final_test",
|
|
26
|
+
"final_test": "final_test",
|
|
27
|
+
"final-testing": "final_test",
|
|
28
|
+
"simulate": "simulate",
|
|
29
|
+
"simulation": "simulate",
|
|
30
|
+
"prod": "production",
|
|
31
|
+
"production": "production",
|
|
32
|
+
"deploy": "production",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _as_string_list(value: Any) -> list[str]:
|
|
37
|
+
if isinstance(value, str):
|
|
38
|
+
text = value.strip()
|
|
39
|
+
return [text] if text else []
|
|
40
|
+
if isinstance(value, Iterable):
|
|
41
|
+
items: list[str] = []
|
|
42
|
+
for raw in value:
|
|
43
|
+
if isinstance(raw, str):
|
|
44
|
+
text = raw.strip()
|
|
45
|
+
if text:
|
|
46
|
+
items.append(text)
|
|
47
|
+
return items
|
|
48
|
+
return []
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _resolve_workflow_path(idea: dict[str, Any]) -> list[str]:
|
|
52
|
+
raw_path = idea.get("workflow") or idea.get("path") or idea.get("delivery_path") or idea.get("workflow_path")
|
|
53
|
+
requested = _as_string_list(raw_path)
|
|
54
|
+
resolved: list[str] = []
|
|
55
|
+
for stage in requested:
|
|
56
|
+
key = _STAGE_ALIASES.get(stage.strip().lower())
|
|
57
|
+
if key and key not in resolved:
|
|
58
|
+
resolved.append(key)
|
|
59
|
+
if not resolved:
|
|
60
|
+
return list(DEFAULT_WORKFLOW_PATH)
|
|
61
|
+
for required in DEFAULT_WORKFLOW_PATH:
|
|
62
|
+
if required not in resolved:
|
|
63
|
+
resolved.append(required)
|
|
64
|
+
return resolved
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def build_business_task_plan(idea: dict[str, Any]) -> dict[str, Any]:
|
|
68
|
+
goal = str(idea.get("goal", "")).strip() or "unspecified-goal"
|
|
69
|
+
constraints = _as_string_list(idea.get("constraints", []))
|
|
70
|
+
acceptance = _as_string_list(idea.get("acceptance", []))
|
|
71
|
+
user_instructions = _as_string_list(idea.get("user_instructions", []))
|
|
72
|
+
workflow_path = _resolve_workflow_path(idea)
|
|
73
|
+
|
|
74
|
+
# Plan Council extensions
|
|
75
|
+
assumptions = _as_string_list(idea.get("assumptions", []))
|
|
76
|
+
objections = _as_string_list(idea.get("objections", []) or idea.get("dissent", []))
|
|
77
|
+
rollback_plan = _as_string_list(idea.get("rollback_plan", []))
|
|
78
|
+
verification_commands = _as_string_list(idea.get("verification_commands", []))
|
|
79
|
+
evidence_requirements = _as_string_list(idea.get("evidence_requirements", []))
|
|
80
|
+
falsifiability = _as_string_list(idea.get("falsifiability", []))
|
|
81
|
+
|
|
82
|
+
tasks: list[dict[str, Any]] = []
|
|
83
|
+
task_id = 1
|
|
84
|
+
|
|
85
|
+
if user_instructions:
|
|
86
|
+
for instruction in user_instructions:
|
|
87
|
+
tasks.append(
|
|
88
|
+
{
|
|
89
|
+
"id": f"T{task_id}",
|
|
90
|
+
"stage": "plan",
|
|
91
|
+
"title": "Capture user instruction",
|
|
92
|
+
"detail": instruction,
|
|
93
|
+
"source": "user_instructions",
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
task_id += 1
|
|
97
|
+
|
|
98
|
+
for item in constraints:
|
|
99
|
+
tasks.append(
|
|
100
|
+
{
|
|
101
|
+
"id": f"T{task_id}",
|
|
102
|
+
"stage": "plan",
|
|
103
|
+
"title": "Capture delivery constraint",
|
|
104
|
+
"detail": item,
|
|
105
|
+
"source": "constraints",
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
task_id += 1
|
|
109
|
+
|
|
110
|
+
if "implement" in workflow_path:
|
|
111
|
+
tasks.append(
|
|
112
|
+
{
|
|
113
|
+
"id": f"T{task_id}",
|
|
114
|
+
"stage": "implement",
|
|
115
|
+
"title": "Implement scoped changes",
|
|
116
|
+
"detail": "Apply changes that satisfy user instructions and follow repository patterns.",
|
|
117
|
+
"source": "workflow",
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
task_id += 1
|
|
121
|
+
|
|
122
|
+
if "qa" in workflow_path:
|
|
123
|
+
tasks.append(
|
|
124
|
+
{
|
|
125
|
+
"id": f"T{task_id}",
|
|
126
|
+
"stage": "qa",
|
|
127
|
+
"title": "Run QA checks",
|
|
128
|
+
"detail": "Validate behavior against constraints and acceptance criteria.",
|
|
129
|
+
"source": "workflow",
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
task_id += 1
|
|
133
|
+
|
|
134
|
+
if "simulate" in workflow_path:
|
|
135
|
+
tasks.append(
|
|
136
|
+
{
|
|
137
|
+
"id": f"T{task_id}",
|
|
138
|
+
"stage": "simulate",
|
|
139
|
+
"title": "Simulate delivery scenarios",
|
|
140
|
+
"detail": "Exercise expected paths and edge cases before final testing.",
|
|
141
|
+
"source": "workflow",
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
task_id += 1
|
|
145
|
+
|
|
146
|
+
for item in acceptance:
|
|
147
|
+
tasks.append(
|
|
148
|
+
{
|
|
149
|
+
"id": f"T{task_id}",
|
|
150
|
+
"stage": "final_test",
|
|
151
|
+
"title": "Validate acceptance criterion",
|
|
152
|
+
"detail": item,
|
|
153
|
+
"source": "acceptance",
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
task_id += 1
|
|
157
|
+
|
|
158
|
+
if "production" in workflow_path:
|
|
159
|
+
tasks.append(
|
|
160
|
+
{
|
|
161
|
+
"id": f"T{task_id}",
|
|
162
|
+
"stage": "production",
|
|
163
|
+
"title": "Prepare production handoff",
|
|
164
|
+
"detail": "Confirm release readiness, residual risks, and deployment checks.",
|
|
165
|
+
"source": "workflow",
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
stage_summaries = []
|
|
170
|
+
for stage in workflow_path:
|
|
171
|
+
stage_tasks = [task for task in tasks if task["stage"] == stage]
|
|
172
|
+
stage_summaries.append(
|
|
173
|
+
{
|
|
174
|
+
"stage": stage,
|
|
175
|
+
"task_count": len(stage_tasks),
|
|
176
|
+
"tasks": stage_tasks,
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
"goal": goal,
|
|
182
|
+
"requested_path": _as_string_list(
|
|
183
|
+
idea.get("workflow") or idea.get("path") or idea.get("delivery_path") or idea.get("workflow_path")
|
|
184
|
+
),
|
|
185
|
+
"resolved_path": workflow_path,
|
|
186
|
+
"constraints": constraints,
|
|
187
|
+
"acceptance": acceptance,
|
|
188
|
+
"user_instructions": user_instructions,
|
|
189
|
+
"assumptions": assumptions,
|
|
190
|
+
"objections": objections,
|
|
191
|
+
"rollback_plan": rollback_plan,
|
|
192
|
+
"verification_commands": verification_commands,
|
|
193
|
+
"evidence_requirements": evidence_requirements,
|
|
194
|
+
"falsifiability": falsifiability,
|
|
195
|
+
"stages": stage_summaries,
|
|
196
|
+
"task_count": len(tasks),
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def build_business_workflow_result(
|
|
201
|
+
*,
|
|
202
|
+
idea: dict[str, Any],
|
|
203
|
+
plan: dict[str, Any],
|
|
204
|
+
execution: dict[str, Any],
|
|
205
|
+
verification: dict[str, Any],
|
|
206
|
+
) -> dict[str, Any]:
|
|
207
|
+
plan_payload = build_business_task_plan(idea)
|
|
208
|
+
checks_value = verification.get("checks") if isinstance(verification, dict) else None
|
|
209
|
+
checks = checks_value if isinstance(checks_value, list) else []
|
|
210
|
+
checks_ok = bool(checks) and all(isinstance(check, dict) and check.get("passed") is True for check in checks)
|
|
211
|
+
|
|
212
|
+
stage_status = {
|
|
213
|
+
"plan": "completed" if plan.get("status") == "planned" else "failed",
|
|
214
|
+
"implement": "completed" if execution.get("status") == "executed" else "failed",
|
|
215
|
+
"qa": "completed" if checks_ok else "failed",
|
|
216
|
+
"simulate": "completed" if checks_ok else "failed",
|
|
217
|
+
"final_test": "completed" if checks_ok else "failed",
|
|
218
|
+
"production": "ready" if checks_ok else "blocked",
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
"goal": plan_payload["goal"],
|
|
223
|
+
"workflow_path": plan_payload["resolved_path"],
|
|
224
|
+
"requested_workflow_path": plan_payload["requested_path"],
|
|
225
|
+
"task_plan": plan_payload,
|
|
226
|
+
"stage_status": [
|
|
227
|
+
{
|
|
228
|
+
"stage": stage,
|
|
229
|
+
"status": stage_status.get(stage, "pending"),
|
|
230
|
+
}
|
|
231
|
+
for stage in plan_payload["resolved_path"]
|
|
232
|
+
],
|
|
233
|
+
"ready_for_production": checks_ok,
|
|
234
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Final
|
|
4
|
+
|
|
5
|
+
from runtime.evidence_requirements import EVIDENCE_REQUIREMENTS_BY_PROFILE, normalize_profile
|
|
6
|
+
|
|
7
|
+
CANONICAL_PARITY_HOSTS: Final[list[str]] = ["claude", "codex", "gemini", "kimi"]
|
|
8
|
+
COMPATIBILITY_ONLY_HOSTS: Final[list[str]] = ["opencode"]
|
|
9
|
+
|
|
10
|
+
DOMAIN_DEFAULTS: Final[dict[str, tuple[str, ...]]] = {
|
|
11
|
+
"preflight_domain_packs": ("robotics", "vision", "algorithms", "health"),
|
|
12
|
+
"all_domain_packs": ("robotics", "vision", "algorithms", "health", "cybersecurity"),
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
def _release_evidence_profile_labels() -> dict[str, str]:
|
|
16
|
+
"""Generate release labels synchronized with the normalized profile registry."""
|
|
17
|
+
return {
|
|
18
|
+
normalize_profile(profile).replace("-", "_"): profile
|
|
19
|
+
for profile in EVIDENCE_REQUIREMENTS_BY_PROFILE
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
RELEASE_SURFACE_LABELS: Final[dict[str, dict[str, str]]] = {
|
|
24
|
+
"evidence_profiles": {
|
|
25
|
+
**_release_evidence_profile_labels(),
|
|
26
|
+
},
|
|
27
|
+
"routes": {
|
|
28
|
+
"teams": "teams",
|
|
29
|
+
"security_check": "security-check",
|
|
30
|
+
"api_twin": "api-twin",
|
|
31
|
+
"crazy": "crazy",
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_canonical_hosts() -> list[str]:
|
|
37
|
+
return list(CANONICAL_PARITY_HOSTS)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def get_compat_hosts() -> list[str]:
|
|
41
|
+
return list(COMPATIBILITY_ONLY_HOSTS)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def get_all_supported_hosts() -> list[str]:
|
|
45
|
+
return [*CANONICAL_PARITY_HOSTS, *COMPATIBILITY_ONLY_HOSTS]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def is_canonical_parity_host(host: str) -> bool:
|
|
49
|
+
return str(host).strip().lower() in CANONICAL_PARITY_HOSTS
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def is_compat_only_host(host: str) -> bool:
|
|
53
|
+
return str(host).strip().lower() in COMPATIBILITY_ONLY_HOSTS
|