sanityops-cli 2.0.1__tar.gz → 2.0.2__tar.gz
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.
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/PKG-INFO +1 -1
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/pyproject.toml +1 -1
- sanityops_cli-2.0.2/src/sanityops_cli/__init__.py +1 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/extract_agent/tools/store_artifacts_tool.py +6 -4
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/progress_hook.py +24 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/repair_agent/agent.py +10 -8
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/rules/qc3_pattern.py +7 -2
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/commands/config.py +25 -8
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/commands/init.py +13 -4
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/commands/inspect.py +41 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/context_guard.py +6 -4
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/report_parser.py +11 -2
- sanityops_cli-2.0.2/src/sanityops_cli/inspect_pipeline/token_estimator.py +75 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/main.py +12 -9
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/utils/config_loader.py +4 -4
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/utils/config_resolver.py +125 -28
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/integration/test_two_agent_pipeline.py +8 -1
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/extract_agent/test_extract_agent.py +4 -6
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/extract_agent/test_store_artifacts_tool.py +3 -3
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/inspect_agent/test_inspect_agent.py +11 -5
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/repair_agent/test_agent.py +3 -1
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/repair_agent/test_store_repairs_tool.py +23 -8
- sanityops_cli-2.0.1/src/sanityops_cli/__init__.py +0 -1
- sanityops_cli-2.0.1/src/sanityops_cli/inspect_pipeline/token_estimator.py +0 -34
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/dependabot.yml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/scripts/pr_review_bot.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/workflows/ai-review.yml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/workflows/ci.yml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/workflows/release.yml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.github/workflows/sync-skills.yml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/.gitignore +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/CHANGELOG.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/CODE_OF_CONDUCT.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/CONTRIBUTING.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/LICENSE +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/NOTICE +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/README.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/SECURITY.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/plans/2026-08-13-model-config-comments-in-init-template.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/plans/2026-08-14-loading-animations.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/plans/2026-08-14-skills-files-banner-readme.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/plans/2026-08-28-copyright-compliance.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/plans/2026-09-08-config-command.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/plans/2026-09-20-cross-artifact-rendering.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/plans/2026-09-20-help-panel-migration.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/plans/2026-09-20-repair-feature.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/specs/2026-08-13-model-config-comments-in-init-template-design.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/specs/2026-08-14-loading-animations-design.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/specs/2026-08-14-skills-files-banner-readme-design.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/specs/2026-08-28-copyright-compliance-design.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/specs/2026-09-08-config-command-design.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/specs/2026-09-20-cross-artifact-rendering-design.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/specs/2026-09-20-help-panel-migration-design.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/docs/superpowers/specs/2026-09-20-repair-feature-design.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/entry.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/release.sh +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/scripts/ci_sync_skills.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/scripts/generate-checksums.ps1 +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/scripts/install.ps1 +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/scripts/install.sh +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/scripts/sync_skills.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/__main__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/extract_agent/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/extract_agent/agent.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/extract_agent/prompts.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/extract_agent/tools/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/extract_agent/tools/read_file_tool.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/extract_agent/tools/tool_registry.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/inspect_agent/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/inspect_agent/agent.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/inspect_agent/prompts.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/inspect_agent/tools/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/inspect_agent/tools/write_report_tool.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/repair_agent/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/repair_agent/prompts.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/repair_agent/tools/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/repair_agent/tools/store_repairs_tool.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/termination.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/tools/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/agents/tools/readfile_tool.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/api/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/api/client.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/checker.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/markdown_reporter.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/models.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/renderer.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/rules/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/rules/qc0_baseline.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/rules/qc0_fence.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/rules/qc1_imports.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/rules/qc1_syntax.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/rules/qc2_resource.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/code_contract_checker/rules/qc4_drift.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/commands/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/commands/project.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/constants/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/constants/config_defaults.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/constants/exit_codes.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/exceptions/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/exceptions/api_exceptions.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/exceptions/base_exceptions.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/help_panel.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/ir_writer.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/markdown_reporter.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/models.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/renderer.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/skill_runtime.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/logging/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/logging/config.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/logging/logger.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/logging/manager.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/progress/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/progress/tracker.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/renderers/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/renderers/command_renderer/inspect_command_renderer.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/VERSION.json +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/code-contract-checklist.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/pre-inspect-extract/SKILL.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/SKILL.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/_meta.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/code-contract-checklist.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/cross-checklist.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/explicit-checklist.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/permission-checklist.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/prompt-checklist.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/relevance-map.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/skill-checklist.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/skills/sanityops-inspect-lite/references/tool-checklist.v2.md +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/templates/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/templates/inspect_config.yaml +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/utils/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/utils/artifact_packer.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/utils/llm_config.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/utils/thinking_config.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/utils/validators.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/commands/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/commands/test_config.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/commands/test_init.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/commands/test_inspect_repair.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/integration/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/test_help_panel.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/extract_agent/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/extract_agent/test_read_file_tool.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/inspect_agent/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/inspect_agent/test_write_report_tool.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/agents/repair_agent/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/api/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/api/test_client.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/ci/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/ci/test_ci_sync_skills.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/code_contract_checker/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/code_contract_checker/test_checker.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/code_contract_checker/test_qc_rules_v2.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/code_contract_checker/test_registry_meta.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/code_contract_checker/test_renderer.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/code_contract_checker/test_rules.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/commands/test_inspect.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/commands/test_version.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/inspect_pipeline/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/inspect_pipeline/test_context_guard.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/inspect_pipeline/test_ir_writer.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/inspect_pipeline/test_models.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/inspect_pipeline/test_renderer_reporter.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/inspect_pipeline/test_report_parser.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/inspect_pipeline/test_skill_runtime.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/inspect_pipeline/test_token_estimator.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/logging/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/logging/test_logger.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/progress/__init__.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/progress/test_tracker.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/utils/test_artifact_packer.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/utils/test_artifact_packer_extracted.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/utils/test_config_loader.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/utils/test_config_resolver.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/utils/test_llm_config.py +0 -0
- {sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/tests/unit/utils/test_thinking_config.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.2"
|
|
@@ -346,10 +346,12 @@ class StoreArtifactsTool(Tool):
|
|
|
346
346
|
f"{total}; set final=true on it"
|
|
347
347
|
)
|
|
348
348
|
if not is_last and artifact.get("final"):
|
|
349
|
-
#
|
|
350
|
-
#
|
|
351
|
-
|
|
352
|
-
|
|
349
|
+
# Guard content integrity: accepting an early `final` would silently
|
|
350
|
+
# truncate the artifact, so reject it with a corrective message.
|
|
351
|
+
return self._error(
|
|
352
|
+
f"artifact {a_type}/{name}: final=true on chunk {seq} but "
|
|
353
|
+
f"total_chunks={total} (final must be seq={total - 1})"
|
|
354
|
+
)
|
|
353
355
|
|
|
354
356
|
record = None
|
|
355
357
|
if is_last:
|
|
@@ -27,6 +27,12 @@ LLM_WAIT_UPDATE_SECONDS = 30
|
|
|
27
27
|
class LoggingProgressHook:
|
|
28
28
|
"""Hook to report agent progress to console and log manager."""
|
|
29
29
|
|
|
30
|
+
#: Consecutive LLM turns without any tool call after which the hook
|
|
31
|
+
#: blocks the loop. A healthy agent loop calls a tool every turn; a run
|
|
32
|
+
#: of bare-text turns means the model is ignoring the tool protocol and
|
|
33
|
+
#: burning the timeout without producing anything auditable.
|
|
34
|
+
MAX_IDLE_TURNS = 5
|
|
35
|
+
|
|
30
36
|
def __init__(
|
|
31
37
|
self,
|
|
32
38
|
console: Console,
|
|
@@ -58,6 +64,8 @@ class LoggingProgressHook:
|
|
|
58
64
|
self._llm_started_at: float | None = None
|
|
59
65
|
self._llm_wait_task: asyncio.Task[None] | None = None
|
|
60
66
|
self._events = None
|
|
67
|
+
self._idle_turns = 0
|
|
68
|
+
self._tool_calls_at_last_llm = 0
|
|
61
69
|
|
|
62
70
|
self._active_tools: dict[str, tuple[float, dict[str, Any]]] = {}
|
|
63
71
|
|
|
@@ -117,6 +125,22 @@ class LoggingProgressHook:
|
|
|
117
125
|
elif event == events.BEFORE_LLM_CALL:
|
|
118
126
|
iteration = data.get("iteration", self._iteration)
|
|
119
127
|
self._iteration = iteration
|
|
128
|
+
# A turn with no tool calls since the last LLM response means the
|
|
129
|
+
# model answered in bare text and the loop will re-prompt with an
|
|
130
|
+
# unchanged context. Block after MAX_IDLE_TURNS such turns.
|
|
131
|
+
if self._tool_calls == self._tool_calls_at_last_llm:
|
|
132
|
+
self._idle_turns += 1
|
|
133
|
+
else:
|
|
134
|
+
self._idle_turns = 0
|
|
135
|
+
self._tool_calls_at_last_llm = self._tool_calls
|
|
136
|
+
if self._idle_turns >= self.MAX_IDLE_TURNS:
|
|
137
|
+
if self.log_manager:
|
|
138
|
+
self.log_manager.error(
|
|
139
|
+
"agent",
|
|
140
|
+
f"Agent idle: {self._idle_turns} consecutive LLM turns "
|
|
141
|
+
"without any tool call",
|
|
142
|
+
)
|
|
143
|
+
ctx.blocked = True
|
|
120
144
|
self._on_loop_start()
|
|
121
145
|
self.stop_waiting()
|
|
122
146
|
self._llm_started_at = perf_counter()
|
|
@@ -32,8 +32,8 @@ class RepairAgent:
|
|
|
32
32
|
provider,
|
|
33
33
|
max_loops: int = 30,
|
|
34
34
|
timeout: int = 1800,
|
|
35
|
-
token_budget: int =
|
|
36
|
-
llm_retries: int =
|
|
35
|
+
token_budget: int | None = None,
|
|
36
|
+
llm_retries: int = 3,
|
|
37
37
|
retry_delay: float = 65.0,
|
|
38
38
|
verbose: bool = False,
|
|
39
39
|
console: Console | None = None,
|
|
@@ -133,12 +133,14 @@ class RepairAgent:
|
|
|
133
133
|
artifact_list="\n".join(artifact_lines),
|
|
134
134
|
)
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
max_loops
|
|
138
|
-
total_timeout
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
config_kwargs: dict = {
|
|
137
|
+
"max_loops": self.max_loops,
|
|
138
|
+
"total_timeout": self.timeout,
|
|
139
|
+
"system_prompt": system_prompt,
|
|
140
|
+
}
|
|
141
|
+
if self.token_budget:
|
|
142
|
+
config_kwargs["token_budget"] = self.token_budget
|
|
143
|
+
config = AgentConfig(**config_kwargs)
|
|
142
144
|
|
|
143
145
|
hook_executor = HookExecutor()
|
|
144
146
|
if self.verbose or self.log_manager:
|
|
@@ -14,8 +14,8 @@ if TYPE_CHECKING:
|
|
|
14
14
|
|
|
15
15
|
# Weak credential patterns
|
|
16
16
|
WEAK_CREDENTIAL_PATTERNS = [
|
|
17
|
-
(re.compile(r'password\s*=\s*["\'](\d{4,6})["\']'), "
|
|
18
|
-
(re.compile(r'password\s*=\s*["\']123{2,}["\']'), "
|
|
17
|
+
(re.compile(r'password\s*=\s*["\'](\d{4,6})["\']'), "short numeric password"),
|
|
18
|
+
(re.compile(r'password\s*=\s*["\']123{2,}["\']'), "repeated digits"),
|
|
19
19
|
(re.compile(r'password\s*=\s*["\'](password|passwd|pwd)["\']', re.I), "common password"),
|
|
20
20
|
(re.compile(r'api_key\s*=\s*["\']xxx["\']'), "placeholder value"),
|
|
21
21
|
(re.compile(r'api_key\s*=\s*["\']your[_-]?api[_-]?key["\']', re.I), "placeholder value"),
|
|
@@ -321,6 +321,11 @@ def check_qc_3_3_hardcoded_demo_value(
|
|
|
321
321
|
lines = code.split("\n")
|
|
322
322
|
|
|
323
323
|
for i, line in enumerate(lines):
|
|
324
|
+
# Skip comment-only lines to avoid flagging documentation examples
|
|
325
|
+
# like "# password = 'password'".
|
|
326
|
+
stripped = line.strip()
|
|
327
|
+
if stripped.startswith("#"):
|
|
328
|
+
continue
|
|
324
329
|
for pattern, pattern_type in WEAK_CREDENTIAL_PATTERNS:
|
|
325
330
|
match = pattern.search(line)
|
|
326
331
|
if match:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Config keys use dot notation, e.g. ``server.base_url``. They correspond to
|
|
4
4
|
the sanityops SaaS backend (NOT the LLM model config, which lives under
|
|
5
|
-
``model.*``). Precedence: project-level > global >
|
|
5
|
+
``model.*``). Precedence: environment variable > project-level > global > default.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
@@ -26,6 +26,8 @@ config_app = typer.Typer(
|
|
|
26
26
|
name="config",
|
|
27
27
|
help="Get and set sanityops configuration (server base URL, API key, etc.)",
|
|
28
28
|
no_args_is_help=False, # We handle help ourselves to add usage panel
|
|
29
|
+
add_help_option=False, # We handle --help ourselves to add usage panel
|
|
30
|
+
context_settings={"allow_interspersed_args": True},
|
|
29
31
|
)
|
|
30
32
|
|
|
31
33
|
# Registry of known config keys: metadata for reading defaults / masking.
|
|
@@ -87,6 +89,12 @@ def _flatten_config(data: dict[str, Any], prefix: str = "") -> list[tuple[str, A
|
|
|
87
89
|
return result
|
|
88
90
|
|
|
89
91
|
|
|
92
|
+
def _help_callback(help_requested: bool) -> None:
|
|
93
|
+
"""Custom help callback placeholder - actual handling in callback body."""
|
|
94
|
+
# This is a placeholder to enable -h flag; the actual help display is in config_callback
|
|
95
|
+
pass
|
|
96
|
+
|
|
97
|
+
|
|
90
98
|
@config_app.callback(invoke_without_command=True)
|
|
91
99
|
def config_callback(
|
|
92
100
|
ctx: typer.Context,
|
|
@@ -95,7 +103,8 @@ def config_callback(
|
|
|
95
103
|
"--help",
|
|
96
104
|
"-h",
|
|
97
105
|
is_eager=True,
|
|
98
|
-
callback=
|
|
106
|
+
callback=_help_callback,
|
|
107
|
+
help="Show this message and exit",
|
|
99
108
|
),
|
|
100
109
|
key: str = typer.Argument(None, help="Config key, e.g. server.base_url"),
|
|
101
110
|
value: str = typer.Argument(None, help="Config value (omit to read)"),
|
|
@@ -113,16 +122,26 @@ def config_callback(
|
|
|
113
122
|
),
|
|
114
123
|
) -> None:
|
|
115
124
|
"""Get, set, or list sanityops configuration values."""
|
|
116
|
-
#
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
# --global and --local are mutually exclusive scope selectors.
|
|
126
|
+
# --global is the default (and is explicit); --local targets project config.
|
|
127
|
+
if global_config and local_config:
|
|
128
|
+
console.print("[red]Error: --global and --local are mutually exclusive[/red]")
|
|
129
|
+
raise typer.Exit(code=EXIT_FAILURE)
|
|
130
|
+
|
|
131
|
+
use_local = local_config # --local overrides; default is global
|
|
132
|
+
|
|
133
|
+
# Handle --help/-h
|
|
134
|
+
if help_flag:
|
|
135
|
+
console.print(ctx.get_help())
|
|
136
|
+
console.print(_get_config_usage_panel())
|
|
137
|
+
raise typer.Exit()
|
|
119
138
|
|
|
120
139
|
if list_all:
|
|
121
140
|
_list_config()
|
|
122
141
|
return
|
|
123
142
|
|
|
124
143
|
if unset:
|
|
125
|
-
_unset_config(unset, local=
|
|
144
|
+
_unset_config(unset, local=use_local)
|
|
126
145
|
return
|
|
127
146
|
|
|
128
147
|
if not key:
|
|
@@ -131,8 +150,6 @@ def config_callback(
|
|
|
131
150
|
console.print(_get_config_usage_panel())
|
|
132
151
|
raise typer.Exit()
|
|
133
152
|
|
|
134
|
-
use_local = local_config # --local overrides; default is global
|
|
135
|
-
|
|
136
153
|
if value is None:
|
|
137
154
|
# Interactive masked input for sensitive keys on a TTY.
|
|
138
155
|
if _is_sensitive_key(key) and sys.stdin.isatty():
|
|
@@ -71,16 +71,25 @@ def init_config() -> None:
|
|
|
71
71
|
console.print(f"[red]✗ Cannot write config file: {e}[/red]")
|
|
72
72
|
raise typer.Exit(code=EXIT_FAILURE) from None
|
|
73
73
|
|
|
74
|
+
# Keep secrets out of git: the config file holds the API key and the
|
|
75
|
+
# results directory holds scanned source artifacts. A nested .gitignore
|
|
76
|
+
# inside the generated directory covers both without touching the
|
|
77
|
+
# user's repository root .gitignore.
|
|
78
|
+
try:
|
|
79
|
+
(config_dir / ".gitignore").write_text("*\n", encoding="utf-8")
|
|
80
|
+
except OSError as e:
|
|
81
|
+
console.print(f"[yellow]⚠ Could not write {config_dir / '.gitignore'}: {e}[/yellow]")
|
|
82
|
+
|
|
74
83
|
console.print("[green]✓[/green] Created .sanityops/inspect_config.yaml")
|
|
75
84
|
console.print("Before running inspect, you need:")
|
|
76
|
-
console.print("-Edit this file to add your prompts, tools, and skills.")
|
|
85
|
+
console.print("- Edit this file to add your prompts, tools, and skills.")
|
|
77
86
|
console.print(
|
|
78
|
-
"-Edit this file to add your provider, api_key, model_id and base_url "
|
|
87
|
+
"- Edit this file to add your provider, api_key, model_id and base_url "
|
|
79
88
|
"(optional. If omitted, the CLI uses LLM_* environment variables)."
|
|
80
89
|
)
|
|
81
|
-
console.print("-To connect to the Sanityops service, configure the server URL and API key:")
|
|
90
|
+
console.print("- To connect to the Sanityops service, configure the server URL and API key:")
|
|
82
91
|
console.print('sanityops-cli config server.base_url "<your-server-url>"')
|
|
83
|
-
console.print(
|
|
92
|
+
console.print('sanityops-cli config server.api_key "<your-api-key>"')
|
|
84
93
|
|
|
85
94
|
|
|
86
95
|
def _load_template() -> str:
|
|
@@ -11,6 +11,8 @@ from __future__ import annotations
|
|
|
11
11
|
|
|
12
12
|
import inspect as inspect_mod
|
|
13
13
|
import os
|
|
14
|
+
import platform
|
|
15
|
+
import sys
|
|
14
16
|
from contextlib import nullcontext
|
|
15
17
|
from datetime import datetime
|
|
16
18
|
from importlib.metadata import PackageNotFoundError, version
|
|
@@ -53,6 +55,16 @@ EXTRACT_TOKEN_BUDGET_FLOOR = 200_000
|
|
|
53
55
|
INSPECT_TOKEN_BUDGET_FLOOR = 300_000
|
|
54
56
|
|
|
55
57
|
|
|
58
|
+
def _banner_line() -> str:
|
|
59
|
+
"""Return a one-line run banner: program version, Python version, platform."""
|
|
60
|
+
from sanityops_cli import __version__
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
f"sanityops-cli v{__version__} | Python {platform.python_version()} "
|
|
64
|
+
f"| {sys.platform}/{platform.machine()}"
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
56
68
|
def _count_label(count: int, singular: str) -> str:
|
|
57
69
|
"""按数量生成简单英文单复数标签。"""
|
|
58
70
|
suffix = "" if count == 1 else "s"
|
|
@@ -961,6 +973,7 @@ def inspect(
|
|
|
961
973
|
input_counts = _format_artifact_counts(
|
|
962
974
|
prompts=len(prompt_files), tools=len(tool_files), skills=len(skill_files)
|
|
963
975
|
)
|
|
976
|
+
console.print(f"[dim]{_banner_line()}[/dim]")
|
|
964
977
|
console.print(f"[dim]Configured sources: {input_counts}[/dim]")
|
|
965
978
|
|
|
966
979
|
log_manager.info(
|
|
@@ -1253,6 +1266,10 @@ def inspect(
|
|
|
1253
1266
|
InspectionFailedError,
|
|
1254
1267
|
)
|
|
1255
1268
|
from sanityops_cli.inspect_pipeline.ir_writer import render_injection_payload
|
|
1269
|
+
from sanityops_cli.inspect_pipeline.token_estimator import (
|
|
1270
|
+
derive_injection_budget,
|
|
1271
|
+
estimate_skill_reserve,
|
|
1272
|
+
)
|
|
1256
1273
|
|
|
1257
1274
|
injection_payload = render_injection_payload(extraction_result)
|
|
1258
1275
|
injection_payload += "\n\n" + _qc_payload_block(qc_result, qc_skipped=qc_result is None)
|
|
@@ -1264,6 +1281,30 @@ def inspect(
|
|
|
1264
1281
|
)
|
|
1265
1282
|
_ = qc_findings # program-channel findings merge into the summary later
|
|
1266
1283
|
|
|
1284
|
+
inspectable_types = {
|
|
1285
|
+
a.type for a in extraction_result.artifacts if a.completeness != "not inspectable"
|
|
1286
|
+
}
|
|
1287
|
+
skill_reserve = estimate_skill_reserve(inspectable_types)
|
|
1288
|
+
injection_budget = derive_injection_budget(
|
|
1289
|
+
context_window=settings["context_window"],
|
|
1290
|
+
system_prompt="a" * 12_000, # ≈3k-token appendix + skills list allowance
|
|
1291
|
+
skill_reserve=skill_reserve,
|
|
1292
|
+
)
|
|
1293
|
+
payload_tokens = estimate_tokens(injection_payload)
|
|
1294
|
+
if payload_tokens > injection_budget:
|
|
1295
|
+
_print_user_error(
|
|
1296
|
+
"Injection Budget Exceeded",
|
|
1297
|
+
f"Extraction payload needs ≈{payload_tokens} tokens but only "
|
|
1298
|
+
f"≈{injection_budget} fit (context window {settings['context_window']}, "
|
|
1299
|
+
f"skill reserve ≈{skill_reserve}).",
|
|
1300
|
+
hint="Split inspect_config.yaml into smaller runs, or raise "
|
|
1301
|
+
"context_window in the config",
|
|
1302
|
+
log_path=log_manager.log_file,
|
|
1303
|
+
)
|
|
1304
|
+
flow_status.stop()
|
|
1305
|
+
log_manager.end_session("failed", {"error": "injection_budget"})
|
|
1306
|
+
raise typer.Exit(code=EXIT_FAILURE)
|
|
1307
|
+
|
|
1267
1308
|
inspect_budget = max(effective_budget, INSPECT_TOKEN_BUDGET_FLOOR)
|
|
1268
1309
|
if effective_budget < INSPECT_TOKEN_BUDGET_FLOOR:
|
|
1269
1310
|
console.print(
|
{sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/context_guard.py
RENAMED
|
@@ -139,10 +139,12 @@ class _DelegatingLLMProvider(LLMProvider):
|
|
|
139
139
|
"""Base wrapper delegating connection metadata and ``extra_body`` to an inner provider."""
|
|
140
140
|
|
|
141
141
|
def __init__(self, provider: LLMProvider) -> None:
|
|
142
|
-
# LLMProvider is an ABC without its own __init__
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
self.
|
|
142
|
+
# LLMProvider is an ABC without its own __init__ and does not declare
|
|
143
|
+
# connection metadata, so delegate it only when the wrapped provider
|
|
144
|
+
# exposes it (test doubles legitimately do not).
|
|
145
|
+
self.api_key = getattr(provider, "api_key", None)
|
|
146
|
+
self.base_url = getattr(provider, "base_url", None)
|
|
147
|
+
self.model = getattr(provider, "model", None)
|
|
146
148
|
self._provider = provider
|
|
147
149
|
|
|
148
150
|
@property
|
{sanityops_cli-2.0.1 → sanityops_cli-2.0.2}/src/sanityops_cli/inspect_pipeline/report_parser.py
RENAMED
|
@@ -35,6 +35,10 @@ KNOWN_MODULES = set(MODULE_STAGE)
|
|
|
35
35
|
|
|
36
36
|
_MAX_DESCRIPTION = 120
|
|
37
37
|
|
|
38
|
+
#: Cap for the best-effort section scan; the structured tail/parts carry the
|
|
39
|
+
#: authoritative list.
|
|
40
|
+
_MAX_FINDINGS = 20
|
|
41
|
+
|
|
38
42
|
#: Best-effort line pattern when the tail JSON is missing: a severity next to
|
|
39
43
|
#: a module/rule id in a report section line.
|
|
40
44
|
_MODULE_PATTERN = "|".join(re.escape(module) for module in sorted(KNOWN_MODULES))
|
|
@@ -122,7 +126,7 @@ def parse_summary(
|
|
|
122
126
|
elif section_parts:
|
|
123
127
|
source = "sections"
|
|
124
128
|
warnings.append("structured findings unavailable; counts estimated from report sections")
|
|
125
|
-
findings = _findings_from_sections(section_parts)
|
|
129
|
+
findings = _findings_from_sections(section_parts, warnings)
|
|
126
130
|
else:
|
|
127
131
|
source = "none"
|
|
128
132
|
findings = []
|
|
@@ -243,7 +247,9 @@ def _normalize_findings(findings: list, warnings: list[str]) -> list[dict]:
|
|
|
243
247
|
return normalized
|
|
244
248
|
|
|
245
249
|
|
|
246
|
-
def _findings_from_sections(
|
|
250
|
+
def _findings_from_sections(
|
|
251
|
+
section_parts: dict[str, list[str]], warnings: list[str]
|
|
252
|
+
) -> list[dict]:
|
|
247
253
|
"""Best-effort severity/module scan over the section markdown."""
|
|
248
254
|
findings: list[dict] = []
|
|
249
255
|
for section in sorted(section_parts):
|
|
@@ -265,6 +271,9 @@ def _findings_from_sections(section_parts: dict[str, list[str]]) -> list[dict]:
|
|
|
265
271
|
"description": re.sub(r"[*_`|]", "", line)[:_MAX_DESCRIPTION],
|
|
266
272
|
}
|
|
267
273
|
)
|
|
274
|
+
if len(findings) >= _MAX_FINDINGS:
|
|
275
|
+
warnings.append(f"section scan capped at {_MAX_FINDINGS} findings")
|
|
276
|
+
return findings
|
|
268
277
|
return findings
|
|
269
278
|
|
|
270
279
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Estimate input size locally and normalize the provider's reported usage."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import unicodedata
|
|
6
|
+
|
|
7
|
+
DEFAULT_CONTEXT_WINDOW = 200_000
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _is_cjk(char: str) -> bool:
|
|
11
|
+
return unicodedata.east_asian_width(char) in ("F", "W")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def estimate_tokens(text: str) -> int:
|
|
15
|
+
"""CJK chars ≈ 1 token; everything else ≈ chars/4."""
|
|
16
|
+
if not text:
|
|
17
|
+
return 0
|
|
18
|
+
cjk = sum(1 for char in text if _is_cjk(char))
|
|
19
|
+
other = len(text) - cjk
|
|
20
|
+
return cjk + other // 4
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def derive_injection_budget(
|
|
24
|
+
context_window: int,
|
|
25
|
+
system_prompt: str,
|
|
26
|
+
skill_reserve: int,
|
|
27
|
+
output_reserve: int = 8192,
|
|
28
|
+
work_margin: int = 16384,
|
|
29
|
+
) -> int:
|
|
30
|
+
"""Tokens available for the injected payload (task message).
|
|
31
|
+
|
|
32
|
+
skill_reserve: expected lazy skill loads for this run (design §6.6 table);
|
|
33
|
+
the caller estimates it from the artifact-type combination.
|
|
34
|
+
"""
|
|
35
|
+
return max(
|
|
36
|
+
0,
|
|
37
|
+
context_window
|
|
38
|
+
- estimate_tokens(system_prompt)
|
|
39
|
+
- skill_reserve
|
|
40
|
+
- output_reserve
|
|
41
|
+
- work_margin,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def estimate_skill_reserve(artifact_types: set[str]) -> int:
|
|
46
|
+
"""Expected lazy-load reserve per the §6.6 table (approximate, CJK-aware).
|
|
47
|
+
|
|
48
|
+
Only the SKILL.md (~42k) plus the domain checklists the artifact
|
|
49
|
+
combination requires. Values measured on the vendored skill.
|
|
50
|
+
"""
|
|
51
|
+
reserve = 42_000 # SKILL.md
|
|
52
|
+
if "prompt" in artifact_types:
|
|
53
|
+
reserve += 16_000 # prompt-checklist
|
|
54
|
+
if "tool" in artifact_types:
|
|
55
|
+
reserve += 11_000 # tool-checklist
|
|
56
|
+
if len(artifact_types & {"prompt", "skill", "tool"}) >= 2:
|
|
57
|
+
reserve += 12_000 # cross-checklist
|
|
58
|
+
reserve += 5_000 # _meta guidance
|
|
59
|
+
if "skill" in artifact_types:
|
|
60
|
+
reserve += 16_000 # skill-checklist
|
|
61
|
+
return reserve
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def usage_breakdown(usage) -> dict[str, int]:
|
|
65
|
+
"""Use the provider's total when available, deriving it for Anthropic."""
|
|
66
|
+
|
|
67
|
+
def value(key: str) -> int:
|
|
68
|
+
raw = usage.get(key, 0) if isinstance(usage, dict) else getattr(usage, key, 0)
|
|
69
|
+
return int(raw or 0)
|
|
70
|
+
|
|
71
|
+
inp = value("input_tokens") or value("prompt_tokens")
|
|
72
|
+
out = value("output_tokens") or value("completion_tokens")
|
|
73
|
+
cache = value("cache_read_input_tokens") + value("cache_creation_input_tokens")
|
|
74
|
+
total = value("total_tokens") or (inp + out + cache)
|
|
75
|
+
return {"input": inp, "output": out, "cache": cache, "total": total}
|
|
@@ -36,7 +36,9 @@ app = typer.Typer(
|
|
|
36
36
|
|
|
37
37
|
def version_callback(value: bool) -> None:
|
|
38
38
|
if value:
|
|
39
|
-
typer.echo(f"sanityops-cli
|
|
39
|
+
typer.echo(f"sanityops-cli v{__version__}")
|
|
40
|
+
typer.echo("Copyright (C) 2026 zipsonken / Sanity AI Labs")
|
|
41
|
+
typer.echo("License: Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0)")
|
|
40
42
|
raise typer.Exit()
|
|
41
43
|
|
|
42
44
|
|
|
@@ -76,16 +78,17 @@ app.command("init")(init_config)
|
|
|
76
78
|
|
|
77
79
|
def main():
|
|
78
80
|
"""Entrance function for the sanityops CLI application."""
|
|
79
|
-
#
|
|
80
|
-
# This
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
#
|
|
84
|
-
|
|
85
|
-
#
|
|
81
|
+
# Show panels only when --help is the sole flag or there are no args.
|
|
82
|
+
# This narrow trigger avoids showing panels on usage errors (-h, --bogus).
|
|
83
|
+
#
|
|
84
|
+
# Note: --version/-V doesn't need explicit handling here because:
|
|
85
|
+
# - `--version` won't match the exact `["--help"]` check
|
|
86
|
+
# - Single-arg `--version` has len > 1, so is_no_args_help is False
|
|
87
|
+
# - It falls through to the normal app() path, which prints version and exits.
|
|
88
|
+
is_only_help = sys.argv[1:] == ["--help"]
|
|
86
89
|
is_no_args_help = len(sys.argv) == 1
|
|
87
90
|
|
|
88
|
-
if
|
|
91
|
+
if is_only_help or is_no_args_help:
|
|
89
92
|
# Use a custom console to capture and extend help output
|
|
90
93
|
console = Console()
|
|
91
94
|
try:
|
|
@@ -76,7 +76,7 @@ def read_file_with_encoding_fallback(path: Path) -> str | None:
|
|
|
76
76
|
class InspectConfigLoader:
|
|
77
77
|
"""Load and validate inspect_config.yaml, resolve all artifact paths to absolute."""
|
|
78
78
|
|
|
79
|
-
def __init__(self, config_path: str | None = None, require_project_id: bool =
|
|
79
|
+
def __init__(self, config_path: str | None = None, require_project_id: bool = False):
|
|
80
80
|
"""Initialize the config loader.
|
|
81
81
|
|
|
82
82
|
Args:
|
|
@@ -129,7 +129,7 @@ class InspectConfigLoader:
|
|
|
129
129
|
|
|
130
130
|
# project_id may be None/placeholder if not bound
|
|
131
131
|
project_id = self._config.get("project", {}).get("id")
|
|
132
|
-
if project_id ==
|
|
132
|
+
if project_id == PROJECT_ID_PLACEHOLDER:
|
|
133
133
|
project_id = None
|
|
134
134
|
|
|
135
135
|
return {
|
|
@@ -204,7 +204,7 @@ class InspectConfigLoader:
|
|
|
204
204
|
if not _UUID_RE.match(str(project_id)):
|
|
205
205
|
raise ValidationError(f"'project.id' is not a valid UUID: {project_id}")
|
|
206
206
|
# Check it's not the placeholder UUID
|
|
207
|
-
if str(project_id) ==
|
|
207
|
+
if str(project_id) == PROJECT_ID_PLACEHOLDER:
|
|
208
208
|
raise ValidationError(
|
|
209
209
|
"'project.id' is still a placeholder. "
|
|
210
210
|
"Run 'sanityops-cli project create <name>' or 'sanityops-cli project bind <id>'"
|
|
@@ -212,7 +212,7 @@ class InspectConfigLoader:
|
|
|
212
212
|
else:
|
|
213
213
|
# When not requiring project_id, just check the format if it's set
|
|
214
214
|
project_id = project.get("id")
|
|
215
|
-
if project_id and str(project_id) !=
|
|
215
|
+
if project_id and str(project_id) != PROJECT_ID_PLACEHOLDER:
|
|
216
216
|
if not _UUID_RE.match(str(project_id)):
|
|
217
217
|
raise ValidationError(f"'project.id' is not a valid UUID: {project_id}")
|
|
218
218
|
|