alysis-code 0.13.0__py3-none-any.whl
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.
- alysis_code/__init__.py +3 -0
- alysis_code/__main__.py +4 -0
- alysis_code/_build_info.py +14 -0
- alysis_code/account_login.py +468 -0
- alysis_code/agent/README.md +35 -0
- alysis_code/agent/__init__.py +11 -0
- alysis_code/agent/acceptance_contract.py +2217 -0
- alysis_code/agent/blast_radius.py +1403 -0
- alysis_code/agent/cache_keepalive.py +227 -0
- alysis_code/agent/completion_certificate.py +366 -0
- alysis_code/agent/completion_gate.py +306 -0
- alysis_code/agent/empty_response_stall.py +403 -0
- alysis_code/agent/errors.py +28 -0
- alysis_code/agent/llm_calls.py +475 -0
- alysis_code/agent/mutation_classification.py +227 -0
- alysis_code/agent/prompt_context.py +2508 -0
- alysis_code/agent/read_ledger.py +253 -0
- alysis_code/agent/regression_baseline.py +642 -0
- alysis_code/agent/reproduction_first.py +610 -0
- alysis_code/agent/sensitive_output.py +629 -0
- alysis_code/agent/session.py +3218 -0
- alysis_code/agent/steering.py +191 -0
- alysis_code/agent/subagent_execution.py +5177 -0
- alysis_code/agent/subagent_workspace.py +666 -0
- alysis_code/agent/tools_assembly.py +4728 -0
- alysis_code/agent/turn/__init__.py +101 -0
- alysis_code/agent/turn/core.py +8483 -0
- alysis_code/agent/turn/events.py +113 -0
- alysis_code/agent/turn/exploration.py +590 -0
- alysis_code/agent/turn/interventions.py +65 -0
- alysis_code/agent/turn/read_cache.py +420 -0
- alysis_code/agent/turn/snapshot.py +179 -0
- alysis_code/agent/turn_contract.py +661 -0
- alysis_code/agent/turn_path.py +129 -0
- alysis_code/agent/verification.py +2885 -0
- alysis_code/agent/verification_commands.py +512 -0
- alysis_code/agent/verification_evidence.py +738 -0
- alysis_code/agent_loop.py +693 -0
- alysis_code/agent_runtimes/__init__.py +51 -0
- alysis_code/agent_runtimes/base.py +114 -0
- alysis_code/agent_runtimes/builtins.py +129 -0
- alysis_code/agent_runtimes/codex_cli.py +664 -0
- alysis_code/agent_runtimes/host.py +263 -0
- alysis_code/agent_runtimes/registry.py +64 -0
- alysis_code/agent_runtimes/service.py +150 -0
- alysis_code/agentbox_client.py +416 -0
- alysis_code/agentbox_integration.py +310 -0
- alysis_code/alysis_cloud.py +152 -0
- alysis_code/approval_scope.py +276 -0
- alysis_code/assets/README.md +33 -0
- alysis_code/assets/__init__.py +126 -0
- alysis_code/assets/asset_read_core.py +281 -0
- alysis_code/assets/budget_allocator.py +456 -0
- alysis_code/assets/comprehender.py +759 -0
- alysis_code/assets/index.py +654 -0
- alysis_code/assets/ingestion.py +275 -0
- alysis_code/assets/legacy_migration.py +413 -0
- alysis_code/assets/models.py +263 -0
- alysis_code/assets/ocr.py +239 -0
- alysis_code/assets/owl/ascii/f-000.txt +13 -0
- alysis_code/assets/owl/ascii/f-001.txt +13 -0
- alysis_code/assets/owl/ascii/f-002.txt +13 -0
- alysis_code/assets/owl/ascii/f-003.txt +13 -0
- alysis_code/assets/owl/ascii/f-004.txt +13 -0
- alysis_code/assets/owl/ascii/f-005.txt +13 -0
- alysis_code/assets/owl/ascii/f-006.txt +13 -0
- alysis_code/assets/owl/ascii/f-007.txt +13 -0
- alysis_code/assets/owl/ascii/f-008.txt +13 -0
- alysis_code/assets/owl/ascii/f-009.txt +13 -0
- alysis_code/assets/owl/ascii/f-010.txt +13 -0
- alysis_code/assets/owl/ascii/f-011.txt +13 -0
- alysis_code/assets/owl/ascii/f-012.txt +13 -0
- alysis_code/assets/owl/ascii/f-013.txt +13 -0
- alysis_code/assets/owl/ascii/f-014.txt +13 -0
- alysis_code/assets/owl/ascii/f-015.txt +13 -0
- alysis_code/assets/owl/ascii/f-016.txt +13 -0
- alysis_code/assets/owl/ascii/f-017.txt +13 -0
- alysis_code/assets/owl/ascii/f-018.txt +13 -0
- alysis_code/assets/owl/ascii/f-019.txt +13 -0
- alysis_code/assets/owl/ascii/f-020.txt +13 -0
- alysis_code/assets/owl/index.html +98 -0
- alysis_code/assets/owl/show-owl.sh +761 -0
- alysis_code/assets/paths.py +49 -0
- alysis_code/assets/plan_binding.py +326 -0
- alysis_code/assets/planner_context.py +466 -0
- alysis_code/assets/planner_tools.py +184 -0
- alysis_code/assets/prompts.py +101 -0
- alysis_code/assets/replanner_context.py +239 -0
- alysis_code/assets/surface.py +521 -0
- alysis_code/assets/untrusted_content.py +48 -0
- alysis_code/assets/usage_logger.py +94 -0
- alysis_code/assets/worker_mirror.py +428 -0
- alysis_code/assets/worker_section.py +303 -0
- alysis_code/assets/worker_tools.py +468 -0
- alysis_code/atomic_io.py +83 -0
- alysis_code/auth_diagnostics.py +272 -0
- alysis_code/background_runner.py +366 -0
- alysis_code/branding.py +270 -0
- alysis_code/budget_policy.py +390 -0
- alysis_code/build_identity.py +465 -0
- alysis_code/builtin_hooks/__init__.py +7 -0
- alysis_code/builtin_hooks/notify_done_windows.py +65 -0
- alysis_code/bwrap_etc.py +76 -0
- alysis_code/cancellation.py +41 -0
- alysis_code/capabilities.py +137 -0
- alysis_code/chatgpt_codex_static_provider.py +133 -0
- alysis_code/cli.py +51 -0
- alysis_code/cli_impl/__init__.py +1 -0
- alysis_code/cli_impl/assets_cli.py +537 -0
- alysis_code/cli_impl/assets_modal.py +412 -0
- alysis_code/cli_impl/chat/__init__.py +156 -0
- alysis_code/cli_impl/chat/commands.py +2616 -0
- alysis_code/cli_impl/chat/loop.py +4508 -0
- alysis_code/cli_impl/chat/mid_turn_policy.py +125 -0
- alysis_code/cli_impl/chat/rendering.py +444 -0
- alysis_code/cli_impl/chat/state.py +124 -0
- alysis_code/cli_impl/chat_resume.py +830 -0
- alysis_code/cli_impl/chat_slash_completer.py +258 -0
- alysis_code/cli_impl/commands/__init__.py +11 -0
- alysis_code/cli_impl/commands/_shared.py +89 -0
- alysis_code/cli_impl/commands/auth.py +623 -0
- alysis_code/cli_impl/commands/chat_resume_helpers.py +1531 -0
- alysis_code/cli_impl/commands/chat_state.py +158 -0
- alysis_code/cli_impl/commands/chat_status.py +1248 -0
- alysis_code/cli_impl/commands/chat_terminal.py +942 -0
- alysis_code/cli_impl/commands/chat_tui_panels.py +1018 -0
- alysis_code/cli_impl/commands/cli_common.py +1223 -0
- alysis_code/cli_impl/commands/cli_surface.py +77 -0
- alysis_code/cli_impl/commands/config.py +131 -0
- alysis_code/cli_impl/commands/conventions.py +85 -0
- alysis_code/cli_impl/commands/execution_helpers.py +350 -0
- alysis_code/cli_impl/commands/extensions.py +401 -0
- alysis_code/cli_impl/commands/forge.py +1282 -0
- alysis_code/cli_impl/commands/forge_asset_view.py +121 -0
- alysis_code/cli_impl/commands/forge_helpers.py +1215 -0
- alysis_code/cli_impl/commands/hooks.py +737 -0
- alysis_code/cli_impl/commands/ide_bridge.py +31 -0
- alysis_code/cli_impl/commands/mcp.py +700 -0
- alysis_code/cli_impl/commands/profile.py +453 -0
- alysis_code/cli_impl/commands/prompt_helpers.py +307 -0
- alysis_code/cli_impl/commands/report.py +88 -0
- alysis_code/cli_impl/commands/root.py +1118 -0
- alysis_code/cli_impl/commands/sandbox.py +184 -0
- alysis_code/cli_impl/commands/server.py +54 -0
- alysis_code/cli_impl/commands/sessions.py +252 -0
- alysis_code/cli_impl/commands/skills.py +404 -0
- alysis_code/cli_impl/commands/startup.py +946 -0
- alysis_code/cli_impl/commands/tools.py +335 -0
- alysis_code/cli_impl/commands/update.py +364 -0
- alysis_code/cli_impl/commands/welcome.py +972 -0
- alysis_code/cli_impl/config_menu.py +3882 -0
- alysis_code/cli_impl/forge.py +4509 -0
- alysis_code/cli_impl/forge_recovery.py +485 -0
- alysis_code/cli_impl/setup_wizard.py +2409 -0
- alysis_code/cli_impl/tui/__init__.py +58 -0
- alysis_code/cli_impl/tui/app.py +4551 -0
- alysis_code/cli_impl/tui/config.py +32 -0
- alysis_code/cli_impl/tui/config_flow.py +2754 -0
- alysis_code/cli_impl/tui/config_overlay.py +566 -0
- alysis_code/cli_impl/tui/content.py +78 -0
- alysis_code/cli_impl/tui/footer.py +218 -0
- alysis_code/cli_impl/tui/forge_status.py +136 -0
- alysis_code/cli_impl/tui/markdown.py +244 -0
- alysis_code/cli_impl/tui/owl.py +109 -0
- alysis_code/cli_impl/tui/plan_meta.py +477 -0
- alysis_code/cli_impl/tui/setup_app.py +519 -0
- alysis_code/cli_impl/tui/setup_flow.py +1622 -0
- alysis_code/cli_impl/tui/state.py +101 -0
- alysis_code/cli_impl/tui/subagent_identity.py +66 -0
- alysis_code/cli_impl/tui/subagent_panel.py +186 -0
- alysis_code/cli_impl/tui/surface.py +796 -0
- alysis_code/cli_impl/tui/transcript.py +514 -0
- alysis_code/cli_impl/tui/update_prompt.py +79 -0
- alysis_code/cli_impl/tui/workspace_guard.py +384 -0
- alysis_code/clipboard.py +172 -0
- alysis_code/code_review.py +1211 -0
- alysis_code/compaction/__init__.py +28 -0
- alysis_code/compaction/conversation_compactor.py +2932 -0
- alysis_code/compaction/importance.py +177 -0
- alysis_code/compaction/settings.py +297 -0
- alysis_code/compaction/tool_output_offload.py +447 -0
- alysis_code/config.py +3509 -0
- alysis_code/conflict_auto_resolver.py +895 -0
- alysis_code/context/__init__.py +1 -0
- alysis_code/context/tool_schema_budgeter.py +220 -0
- alysis_code/crash_diagnostics.py +282 -0
- alysis_code/custom_tools/README.md +34 -0
- alysis_code/custom_tools/__init__.py +43 -0
- alysis_code/custom_tools/discovery.py +903 -0
- alysis_code/custom_tools/runtime.py +1516 -0
- alysis_code/custom_tools/session.py +227 -0
- alysis_code/custom_tools/trust.py +232 -0
- alysis_code/diff_paths.py +113 -0
- alysis_code/direction_change.py +293 -0
- alysis_code/dispatch_timing.py +306 -0
- alysis_code/durable_service_manager.py +1236 -0
- alysis_code/edit_discipline.py +659 -0
- alysis_code/error_text.py +73 -0
- alysis_code/execution_budget.py +411 -0
- alysis_code/execution_context.py +915 -0
- alysis_code/execution_deadline.py +1065 -0
- alysis_code/execution_shared.py +1904 -0
- alysis_code/extensions/README.md +30 -0
- alysis_code/extensions/__init__.py +93 -0
- alysis_code/extensions/activation.py +138 -0
- alysis_code/extensions/install.py +1436 -0
- alysis_code/extensions/manifest.py +487 -0
- alysis_code/extensions/models.py +74 -0
- alysis_code/extensions/paths.py +56 -0
- alysis_code/extensions/registry.json +4 -0
- alysis_code/extensions/registry.py +52 -0
- alysis_code/extensions/state.py +83 -0
- alysis_code/extensions/workspace_trust.py +101 -0
- alysis_code/failed_task_evidence.py +369 -0
- alysis_code/failure_category.py +315 -0
- alysis_code/feedback_report.py +1647 -0
- alysis_code/file_classification.py +485 -0
- alysis_code/forge.py +2064 -0
- alysis_code/forge_completion.py +362 -0
- alysis_code/forge_events.py +475 -0
- alysis_code/frontmatter_utils.py +95 -0
- alysis_code/git_evidence.py +1181 -0
- alysis_code/git_ops.py +560 -0
- alysis_code/git_safe.py +62 -0
- alysis_code/git_worktrees.py +190 -0
- alysis_code/hooks/README.md +33 -0
- alysis_code/hooks/__init__.py +67 -0
- alysis_code/hooks/audit.py +171 -0
- alysis_code/hooks/config.py +225 -0
- alysis_code/hooks/dispatcher.py +1110 -0
- alysis_code/hooks/models.py +447 -0
- alysis_code/hooks/trust.py +202 -0
- alysis_code/host_actions.py +543 -0
- alysis_code/host_browser.py +103 -0
- alysis_code/ide/__init__.py +5 -0
- alysis_code/ide/activity_events.py +399 -0
- alysis_code/ide/approvals.py +337 -0
- alysis_code/ide/artifacts.py +153 -0
- alysis_code/ide/browser_egress_proxy.py +1076 -0
- alysis_code/ide/cdp_websocket_transport.py +1192 -0
- alysis_code/ide/change_ledger.py +1721 -0
- alysis_code/ide/context_blocks.py +979 -0
- alysis_code/ide/event_stream.py +531 -0
- alysis_code/ide/forge_protocol.py +3112 -0
- alysis_code/ide/forge_request_ledger.py +737 -0
- alysis_code/ide/health.py +965 -0
- alysis_code/ide/managed_browser.py +2251 -0
- alysis_code/ide/management_protocol.py +3414 -0
- alysis_code/ide/mcp_oauth_coordinator.py +744 -0
- alysis_code/ide/mcp_oauth_lifecycle.py +1504 -0
- alysis_code/ide/prompt_queue.py +1070 -0
- alysis_code/ide/protocol.py +191 -0
- alysis_code/ide/resumable_swarm.py +1543 -0
- alysis_code/ide/session_search.py +295 -0
- alysis_code/ide/stdio_bridge.py +9935 -0
- alysis_code/ide/structured_state.py +1579 -0
- alysis_code/ide/swarm_protocol.py +816 -0
- alysis_code/integration_gate.py +506 -0
- alysis_code/interactive_input_guard.py +39 -0
- alysis_code/interactive_plan_mode.py +26 -0
- alysis_code/internal_artifacts.py +179 -0
- alysis_code/knowledge_base.py +1409 -0
- alysis_code/knowledge_capture.py +1190 -0
- alysis_code/knowledge_librarian.py +605 -0
- alysis_code/language_policy.py +34 -0
- alysis_code/litellm_static_provider.py +535 -0
- alysis_code/llm/__init__.py +1 -0
- alysis_code/llm/anthropic_messages.py +2288 -0
- alysis_code/llm/base.py +71 -0
- alysis_code/llm/cache_capabilities.py +985 -0
- alysis_code/llm/cache_control_blocks.py +244 -0
- alysis_code/llm/cache_policy.py +388 -0
- alysis_code/llm/factory.py +373 -0
- alysis_code/llm/gemini_generate_content.py +2652 -0
- alysis_code/llm/gemini_interactions.py +739 -0
- alysis_code/llm/metadata.py +450 -0
- alysis_code/llm/openai_compat.py +2947 -0
- alysis_code/llm/openai_responses.py +2604 -0
- alysis_code/llm/protocols.py +609 -0
- alysis_code/llm/provider_limits.py +525 -0
- alysis_code/llm/request_plan.py +389 -0
- alysis_code/llm/request_shape.py +238 -0
- alysis_code/llm/streaming.py +108 -0
- alysis_code/llm/temperature_compat.py +78 -0
- alysis_code/llm/types.py +195 -0
- alysis_code/llm/usage_normalization.py +222 -0
- alysis_code/llm_error_display.py +315 -0
- alysis_code/logging_redaction.py +326 -0
- alysis_code/managed_host_deadline.py +196 -0
- alysis_code/mcp/README.md +33 -0
- alysis_code/mcp/__init__.py +24 -0
- alysis_code/mcp/client.py +1137 -0
- alysis_code/mcp/config.py +597 -0
- alysis_code/mcp/errors.py +113 -0
- alysis_code/mcp/forge_scope.py +154 -0
- alysis_code/mcp/jsonrpc.py +214 -0
- alysis_code/mcp/manager.py +2308 -0
- alysis_code/mcp/models.py +666 -0
- alysis_code/mcp/oauth.py +972 -0
- alysis_code/mcp/oauth_runtime.py +310 -0
- alysis_code/mcp/oauth_store.py +276 -0
- alysis_code/mcp/prompts.py +329 -0
- alysis_code/mcp/resources.py +295 -0
- alysis_code/mcp/roots.py +106 -0
- alysis_code/mcp/server_requests.py +75 -0
- alysis_code/mcp/token_store.py +859 -0
- alysis_code/mcp/transport_http.py +1338 -0
- alysis_code/mcp/transport_stdio.py +1267 -0
- alysis_code/mcp/untrusted_content.py +119 -0
- alysis_code/merge_conflict_reviewer.py +729 -0
- alysis_code/model_catalog/__init__.py +1 -0
- alysis_code/model_catalog/chatgpt_codex_subscription_snapshot.json +186 -0
- alysis_code/model_catalog/litellm_model_prices_snapshot.json +44715 -0
- alysis_code/model_catalog/litellm_model_prices_snapshot.meta.json +17 -0
- alysis_code/model_metadata_policy.py +223 -0
- alysis_code/model_metadata_utils.py +103 -0
- alysis_code/model_registry.py +1420 -0
- alysis_code/model_router.py +147 -0
- alysis_code/permission_policy.py +1016 -0
- alysis_code/personas.py +451 -0
- alysis_code/pipeline_facts.py +233 -0
- alysis_code/plan_assistant.py +4763 -0
- alysis_code/plan_mode.py +393 -0
- alysis_code/plan_reconciliation.py +1228 -0
- alysis_code/plan_repair.py +652 -0
- alysis_code/plan_validation.py +1099 -0
- alysis_code/planning_constraints.py +904 -0
- alysis_code/policy.py +95 -0
- alysis_code/preview_server.py +457 -0
- alysis_code/process_reaping.py +566 -0
- alysis_code/profile_presets.py +1834 -0
- alysis_code/profiles.py +666 -0
- alysis_code/provider_auth/__init__.py +29 -0
- alysis_code/provider_auth/base.py +99 -0
- alysis_code/provider_auth/openai_codex.py +951 -0
- alysis_code/provider_auth/registry.py +76 -0
- alysis_code/provider_auth/store.py +125 -0
- alysis_code/provider_diagnostics.py +1209 -0
- alysis_code/provider_model_catalog.py +685 -0
- alysis_code/provider_telemetry.py +1699 -0
- alysis_code/provider_url.py +75 -0
- alysis_code/reasoning_contracts.py +911 -0
- alysis_code/remote_sync.py +350 -0
- alysis_code/replanning.py +1195 -0
- alysis_code/repo_scan.py +1152 -0
- alysis_code/request_estimation.py +296 -0
- alysis_code/review_gate.py +617 -0
- alysis_code/run_lock.py +1141 -0
- alysis_code/run_outcome.py +58 -0
- alysis_code/run_provenance.py +774 -0
- alysis_code/run_state.py +445 -0
- alysis_code/runtime_artifacts.py +116 -0
- alysis_code/runtime_context_features.py +78 -0
- alysis_code/runtime_kind.py +52 -0
- alysis_code/safety/__init__.py +11 -0
- alysis_code/safety/mcp_sanitize.py +29 -0
- alysis_code/safety/safe_http.py +297 -0
- alysis_code/safety/subagent_report.py +184 -0
- alysis_code/sandbox_doctor.py +682 -0
- alysis_code/sandbox_runner.py +1025 -0
- alysis_code/sandbox_settings.py +423 -0
- alysis_code/serialized_paths.py +355 -0
- alysis_code/server/__init__.py +3 -0
- alysis_code/server/app.py +367 -0
- alysis_code/server/auth.py +34 -0
- alysis_code/server/job_config.py +30 -0
- alysis_code/server/settings.py +215 -0
- alysis_code/server/store.py +193 -0
- alysis_code/server/worker_runner.py +657 -0
- alysis_code/service_persistence.py +355 -0
- alysis_code/session_artifacts.py +108 -0
- alysis_code/session_metrics.py +331 -0
- alysis_code/session_store.py +624 -0
- alysis_code/skills/README.md +34 -0
- alysis_code/skills/__init__.py +104 -0
- alysis_code/skills/conventions.py +84 -0
- alysis_code/skills/discovery.py +176 -0
- alysis_code/skills/eval_models.py +232 -0
- alysis_code/skills/eval_runner.py +372 -0
- alysis_code/skills/evals.py +1344 -0
- alysis_code/skills/install.py +293 -0
- alysis_code/skills/loader.py +118 -0
- alysis_code/skills/matching.py +103 -0
- alysis_code/skills/models.py +71 -0
- alysis_code/skills/paths.py +56 -0
- alysis_code/skills/prompting.py +500 -0
- alysis_code/skills/scaffold.py +142 -0
- alysis_code/skills/state.py +441 -0
- alysis_code/skills/transactions.py +125 -0
- alysis_code/skills/validation.py +304 -0
- alysis_code/step_budget.py +238 -0
- alysis_code/subagent_labels.py +49 -0
- alysis_code/subagents.py +1072 -0
- alysis_code/surface/__init__.py +80 -0
- alysis_code/surface/base.py +305 -0
- alysis_code/surface/console.py +387 -0
- alysis_code/surface/events.py +372 -0
- alysis_code/surface/hidden_surface.py +529 -0
- alysis_code/surface/noop_surface.py +219 -0
- alysis_code/surface/rich_surface.py +1555 -0
- alysis_code/surface/styles.py +67 -0
- alysis_code/surface/theme.py +455 -0
- alysis_code/surface/types.py +100 -0
- alysis_code/swarm_backend.py +926 -0
- alysis_code/swarm_orchestrator.py +4020 -0
- alysis_code/swarm_scheduler.py +441 -0
- alysis_code/swarm_trace.py +429 -0
- alysis_code/swarm_worker.py +2119 -0
- alysis_code/swarm_write_guard.py +348 -0
- alysis_code/task_dependencies.py +170 -0
- alysis_code/task_readiness.py +992 -0
- alysis_code/task_scope.py +2148 -0
- alysis_code/terminal_manager.py +762 -0
- alysis_code/terminal_ownership.py +460 -0
- alysis_code/text_normalization.py +30 -0
- alysis_code/token_budget.py +97 -0
- alysis_code/tools/README.md +34 -0
- alysis_code/tools/__init__.py +1 -0
- alysis_code/tools/artifacts.py +127 -0
- alysis_code/tools/availability.py +188 -0
- alysis_code/tools/fs.py +1456 -0
- alysis_code/tools/git.py +461 -0
- alysis_code/tools/history.py +229 -0
- alysis_code/tools/http_timeout.py +78 -0
- alysis_code/tools/image_generation.py +552 -0
- alysis_code/tools/registry.py +2936 -0
- alysis_code/tools/repo_map.py +476 -0
- alysis_code/tools/search.py +563 -0
- alysis_code/tools/shell.py +135 -0
- alysis_code/tools/symbols.py +1350 -0
- alysis_code/tools/test_discovery.py +643 -0
- alysis_code/tools/web.py +482 -0
- alysis_code/tools/web_search.py +2012 -0
- alysis_code/tools/web_search_dashscope.py +557 -0
- alysis_code/tools/web_search_ddgs.py +221 -0
- alysis_code/tools/web_search_provider_adapters.py +1429 -0
- alysis_code/tools/web_search_tavily.py +194 -0
- alysis_code/updates.py +933 -0
- alysis_code/usage_tracker.py +1990 -0
- alysis_code/verification_command_analysis.py +1004 -0
- alysis_code/verification_contract.py +574 -0
- alysis_code/verification_failure_summary.py +273 -0
- alysis_code/verification_repair.py +385 -0
- alysis_code/verify_gate.py +3129 -0
- alysis_code/web_research.py +1872 -0
- alysis_code/web_search_adapters.py +66 -0
- alysis_code/web_search_policy.py +27 -0
- alysis_code/workspace_binding.py +389 -0
- alysis_code/workspace_binding_ui.py +408 -0
- alysis_code/workspace_context.py +273 -0
- alysis_code/workspace_isolation.py +138 -0
- alysis_code/workspace_provisioning.py +455 -0
- alysis_code-0.13.0.dist-info/METADATA +507 -0
- alysis_code-0.13.0.dist-info/RECORD +458 -0
- alysis_code-0.13.0.dist-info/WHEEL +4 -0
- alysis_code-0.13.0.dist-info/entry_points.txt +3 -0
- alysis_code-0.13.0.dist-info/licenses/LICENSE +176 -0
- alysis_code-0.13.0.dist-info/licenses/NOTICE +4 -0
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
5
|
+
|
|
6
|
+
from .config import ConfigError, resolve_run_deadline
|
|
7
|
+
from .execution_deadline import ExecutionDeadline
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from .config import AppConfig
|
|
11
|
+
from .crash_diagnostics import CrashDiagnosticLogger
|
|
12
|
+
from .mcp.manager import ForgeTaskScopedMcpManager, McpManager
|
|
13
|
+
from .runtime_kind import RuntimeKind
|
|
14
|
+
from .surface.base import Surface
|
|
15
|
+
from .workspace_binding import WorkspaceBinding
|
|
16
|
+
|
|
17
|
+
# isort: off
|
|
18
|
+
# errors re-exports
|
|
19
|
+
from .agent.errors import ( # noqa: F401
|
|
20
|
+
AgentRuntimeError,
|
|
21
|
+
ApprovalDeclinedError,
|
|
22
|
+
SessionWorkdirError,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
# prompt_context re-exports
|
|
26
|
+
from .agent.prompt_context import ( # noqa: F401
|
|
27
|
+
_IMAGE_ATTACHMENT_TURN_SYSTEM_HINT,
|
|
28
|
+
_INLINE_CODE_SPAN_RE,
|
|
29
|
+
_MAX_ROUTE_CONTEXT_ANCHORS,
|
|
30
|
+
_MAX_ROUTE_CONTEXT_HINTS,
|
|
31
|
+
_MAX_ROUTE_CONTEXT_VERIFY_COMMANDS,
|
|
32
|
+
_MODE_FULLACCESS,
|
|
33
|
+
_NON_REPO_MAX_RECENT_VISIBLE_HISTORY_CHARS,
|
|
34
|
+
_NON_REPO_MAX_RECENT_VISIBLE_HISTORY_MESSAGES,
|
|
35
|
+
_NON_REPO_MAX_RECENT_VISIBLE_HISTORY_TOTAL_CHARS,
|
|
36
|
+
_REPO_REL_PATH_TOKEN_RE,
|
|
37
|
+
_SYSTEM_PROMPT_ONE_SHOT_SECTION,
|
|
38
|
+
_SYSTEM_PROMPT_SKILL_DISCOVERY_SECTION,
|
|
39
|
+
_SYSTEM_PROMPT_SKILL_LIFECYCLE_SECTION,
|
|
40
|
+
_SYSTEM_PROMPT_SUBAGENT_SECTION,
|
|
41
|
+
_SYSTEM_PROMPT_WRITE_SECTION,
|
|
42
|
+
_TASK_BRIEF_EMPTY_STATUS,
|
|
43
|
+
_TASK_BRIEF_MARKER,
|
|
44
|
+
_TASK_BRIEF_MAX_CURRENT_LINES,
|
|
45
|
+
_TASK_BRIEF_MAX_LINE_CHARS,
|
|
46
|
+
_TASK_BRIEF_MAX_PRIOR_LINES,
|
|
47
|
+
ALWAYS_PROTECTED_WRITE_PREFIXES,
|
|
48
|
+
CONVENTIONS_FILENAME,
|
|
49
|
+
MAX_CONVENTIONS_CHARS,
|
|
50
|
+
MAX_IMAGE_BYTES,
|
|
51
|
+
MAX_POST_EXPLORE_ANCHOR_PATHS,
|
|
52
|
+
MAX_SUBAGENT_CONTEXT_CHARS,
|
|
53
|
+
MAX_SUBAGENT_CONTEXT_ITEMS,
|
|
54
|
+
SYSTEM_PROMPT,
|
|
55
|
+
PreparedSessionPromptContext,
|
|
56
|
+
_build_plugin_activation_index,
|
|
57
|
+
_build_repo_task_brief_message,
|
|
58
|
+
_build_user_message,
|
|
59
|
+
_build_workspace_grounding_descriptor,
|
|
60
|
+
_clean_workspace_hint,
|
|
61
|
+
_component_plugin_allowed,
|
|
62
|
+
_compose_session_system_prompt,
|
|
63
|
+
_empty_task_brief_message,
|
|
64
|
+
_environment_context_message,
|
|
65
|
+
_extract_repo_relative_paths_from_text,
|
|
66
|
+
_extract_workspace_relation_paths_from_text,
|
|
67
|
+
_filter_discovered_skills_for_plugins,
|
|
68
|
+
_image_attachment_instruction_text,
|
|
69
|
+
_is_host_managed_user_context_message,
|
|
70
|
+
_merge_dropped_counts,
|
|
71
|
+
_message_text_content,
|
|
72
|
+
_normalize_rel_match_path,
|
|
73
|
+
_normalize_repo_relative_hint_path,
|
|
74
|
+
_normalize_scope_list,
|
|
75
|
+
_normalize_task_brief_key,
|
|
76
|
+
_normalize_task_brief_line,
|
|
77
|
+
_normalize_workspace_relpath,
|
|
78
|
+
_normalized_authoritative_verify_commands,
|
|
79
|
+
_normalized_verify_commands,
|
|
80
|
+
_paths_require_verification,
|
|
81
|
+
_PluginActivationIndex,
|
|
82
|
+
_read_workspace_hint_text,
|
|
83
|
+
_recent_visible_non_repo_history,
|
|
84
|
+
_render_task_brief_message,
|
|
85
|
+
_repo_conventions_context,
|
|
86
|
+
_repo_summary_data,
|
|
87
|
+
_RepoSummaryData,
|
|
88
|
+
_resolve_effective_verification_selection,
|
|
89
|
+
_resolve_one_shot_repo_bootstrap_context,
|
|
90
|
+
_resolve_requested_workdir_within_workspace,
|
|
91
|
+
_resolve_session_pinned_prefix_len,
|
|
92
|
+
_session_focus_dir_path,
|
|
93
|
+
_session_focus_relpath,
|
|
94
|
+
_session_has_active_workspace_task,
|
|
95
|
+
_session_repo_scan,
|
|
96
|
+
_session_task_brief_content,
|
|
97
|
+
_session_verify_command_selection,
|
|
98
|
+
_session_workspace_binding_context_message,
|
|
99
|
+
_session_workspace_grounding,
|
|
100
|
+
_set_session_pinned_prefix_len,
|
|
101
|
+
_should_prepare_repo_scan,
|
|
102
|
+
_skill_plugin_id,
|
|
103
|
+
_subagent_context_message,
|
|
104
|
+
_task_brief_content_is_placeholder,
|
|
105
|
+
_task_brief_lines_from_text,
|
|
106
|
+
_truncate_non_repo_history_content,
|
|
107
|
+
_untrusted_prompt_prelude_message,
|
|
108
|
+
_workspace_binding_context_message,
|
|
109
|
+
_workspace_hint_from_manifest_path,
|
|
110
|
+
_workspace_hint_from_repo_scan,
|
|
111
|
+
_workspace_hint_from_text,
|
|
112
|
+
_workspace_hint_from_top_level_metadata,
|
|
113
|
+
_workspace_kind_is_plain_dir,
|
|
114
|
+
_workspace_kind_is_repo_backed,
|
|
115
|
+
_workspace_kind_supports_task_brief,
|
|
116
|
+
_workspace_relpath_for_path,
|
|
117
|
+
_WorkspaceGroundingDescriptor,
|
|
118
|
+
prepare_session_prompt_context,
|
|
119
|
+
refresh_session_environment_context_message,
|
|
120
|
+
refresh_session_task_brief_message,
|
|
121
|
+
refresh_session_workspace_binding_context_message,
|
|
122
|
+
resolve_session_active_workdir_path,
|
|
123
|
+
resolve_session_active_workdir_relpath,
|
|
124
|
+
resolve_workdir_relpath_within_workspace,
|
|
125
|
+
set_session_active_workdir,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# turn_path re-exports
|
|
129
|
+
from .agent.turn_path import ( # noqa: F401
|
|
130
|
+
_ROUTER_EXECUTION_POSTURES,
|
|
131
|
+
_build_turn_language_system_message,
|
|
132
|
+
_normalize_turn_language_name,
|
|
133
|
+
_normalize_turn_script_name,
|
|
134
|
+
_OneShotRepoTurnIntent,
|
|
135
|
+
_resolve_repo_turn_execution_intent,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# turn event helper re-exports
|
|
139
|
+
from .agent.turn.events import ( # noqa: F401
|
|
140
|
+
_emit_assistant_message_events,
|
|
141
|
+
_emit_message_delta_event,
|
|
142
|
+
_emit_message_end_event,
|
|
143
|
+
_emit_tool_call_completed_event,
|
|
144
|
+
_emit_tool_call_progress_event,
|
|
145
|
+
_emit_tool_call_started_event,
|
|
146
|
+
_event_preview,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# provider-call helper re-exports
|
|
150
|
+
from .agent.llm_calls import ( # noqa: F401
|
|
151
|
+
_FENCED_CODE_BLOCK_RE,
|
|
152
|
+
_FINAL_SUMMARY_REWRITE_SYSTEM_PROMPT,
|
|
153
|
+
_REWRITE_PROTECTED_TOKEN_RE,
|
|
154
|
+
_extract_rewrite_protected_fragments,
|
|
155
|
+
_is_fatal_non_repo_llm_error,
|
|
156
|
+
_is_stream_unsupported_error,
|
|
157
|
+
_llm_error_status_code,
|
|
158
|
+
_main_agent_chat,
|
|
159
|
+
_non_repo_chat,
|
|
160
|
+
_registered_tool_schema_list,
|
|
161
|
+
_request_messages_with_ephemeral_system_prompt_suffixes,
|
|
162
|
+
_request_messages_with_ephemeral_system_prompts,
|
|
163
|
+
_request_messages_with_ephemeral_user_messages,
|
|
164
|
+
_rewrite_final_summary_for_language,
|
|
165
|
+
_rewritten_text_preserves_technical_tokens,
|
|
166
|
+
_safe_forced_tool_choice_for_recovery,
|
|
167
|
+
_tool_schema_function_name,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
# session re-exports
|
|
171
|
+
from .agent.session import ( # noqa: F401
|
|
172
|
+
_DEFAULT_CREATE_MCP_MANAGER,
|
|
173
|
+
AgentSession,
|
|
174
|
+
NoopSurface,
|
|
175
|
+
OpenAICompatClient,
|
|
176
|
+
_build_workspace_trust_prompt,
|
|
177
|
+
_filter_hooks_config_for_plugins,
|
|
178
|
+
_git_branch,
|
|
179
|
+
_git_is_dirty,
|
|
180
|
+
_hook_plugin_id,
|
|
181
|
+
_make_session_llm_client,
|
|
182
|
+
_meaningful_surface_legacy_warning_handler,
|
|
183
|
+
_meaningful_surface_warning_handler,
|
|
184
|
+
_repo_summary,
|
|
185
|
+
_surface_needs_startup_git_status,
|
|
186
|
+
build_shell_runner,
|
|
187
|
+
build_shell_runner_from_settings,
|
|
188
|
+
build_background_shell_runner_from_settings,
|
|
189
|
+
create_mcp_manager,
|
|
190
|
+
create_session,
|
|
191
|
+
scan_workspace,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
# tools_assembly re-exports
|
|
195
|
+
from .agent.tools_assembly import ( # noqa: F401
|
|
196
|
+
_BUILTIN_MODEL_DESCRIPTIONS,
|
|
197
|
+
_MODE_PERMISSIVENESS_ORDER,
|
|
198
|
+
_MODE_PERMISSIVENESS_RANK,
|
|
199
|
+
_READONLY_MAIN_SESSION_BUILTIN_TOOL_NAMES,
|
|
200
|
+
_READONLY_TOP_LEVEL_WEB_TOOL_NAMES,
|
|
201
|
+
_ROUTING_MODE_CODE_ONLY,
|
|
202
|
+
_SHELL_MUTATION_SNAPSHOT_METADATA_PREFIX,
|
|
203
|
+
ToolDef,
|
|
204
|
+
_built_in_tool_exposed_in_mode,
|
|
205
|
+
_custom_tool_capability_summary,
|
|
206
|
+
_custom_tool_plugin_id,
|
|
207
|
+
_custom_tools_write_scope_restricted,
|
|
208
|
+
_detect_command_mutation_paths,
|
|
209
|
+
_drop_schema_descriptions,
|
|
210
|
+
_filter_custom_tool_session_state_for_plugins,
|
|
211
|
+
_filter_mcp_config_for_plugins,
|
|
212
|
+
_list_git_workspace_snapshot_paths,
|
|
213
|
+
_mcp_server_plugin_id,
|
|
214
|
+
_mcp_tool_exposed_in_mode,
|
|
215
|
+
_normalize_snapshot_ignore_paths,
|
|
216
|
+
_path_matches_snapshot_ignore,
|
|
217
|
+
_run_with_command_mutation_detection,
|
|
218
|
+
_snapshot_workspace_for_command_mutation_detection,
|
|
219
|
+
_tool_event_metadata,
|
|
220
|
+
_unified_diff,
|
|
221
|
+
_walk_workspace_snapshot_paths,
|
|
222
|
+
_workspace_snapshot_signature,
|
|
223
|
+
build_tools,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
# mutation classification re-exports
|
|
227
|
+
from .agent.mutation_classification import ( # noqa: F401
|
|
228
|
+
MutationPathCategory,
|
|
229
|
+
MutationPathClassification,
|
|
230
|
+
benign_runtime_mutation_paths,
|
|
231
|
+
classify_mutation_path,
|
|
232
|
+
classify_mutation_paths,
|
|
233
|
+
material_mutation_paths,
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
# run budget policy re-exports
|
|
237
|
+
from .budget_policy import ( # noqa: F401
|
|
238
|
+
STOP_REASON_RUN_BUDGET_EXHAUSTED,
|
|
239
|
+
BudgetCancellationToken,
|
|
240
|
+
BudgetWatchdog,
|
|
241
|
+
resolve_budget_grace_seconds,
|
|
242
|
+
resolve_run_budget_seconds,
|
|
243
|
+
)
|
|
244
|
+
from .cancellation import CooperativeCancellationError
|
|
245
|
+
|
|
246
|
+
# execution deadline re-exports
|
|
247
|
+
from .execution_deadline import ( # noqa: F401
|
|
248
|
+
DEFAULT_DEADLINE_CLEANUP_RESERVE_SECONDS,
|
|
249
|
+
DEFAULT_RUN_DEADLINE_SECONDS,
|
|
250
|
+
MINIMUM_FORCED_SUMMARY_SECONDS,
|
|
251
|
+
MINIMUM_LLM_START_SECONDS,
|
|
252
|
+
MINIMUM_OPERATION_TIMEOUT_SECONDS,
|
|
253
|
+
MINIMUM_SUBAGENT_START_SECONDS,
|
|
254
|
+
MINIMUM_TOOL_START_SECONDS,
|
|
255
|
+
DeadlineExhausted,
|
|
256
|
+
deadline_timeout_or_raise,
|
|
257
|
+
resolve_deadline_degradation_policy,
|
|
258
|
+
temporarily_clamp_client_timeout,
|
|
259
|
+
validate_deadline_seconds,
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
# completion gate controller re-exports
|
|
263
|
+
from .agent.completion_gate import ( # noqa: F401
|
|
264
|
+
NON_FINAL_PROGRESS_PROBLEM,
|
|
265
|
+
NON_FINAL_PROGRESS_STAGE,
|
|
266
|
+
CompletionGateControllerState,
|
|
267
|
+
CompletionGateDecision,
|
|
268
|
+
CompletionGateDecisionKind,
|
|
269
|
+
CompletionGateEvidenceSnapshot,
|
|
270
|
+
build_completion_gate_snapshot,
|
|
271
|
+
completion_gate_decision_payload,
|
|
272
|
+
decide_completion_gate,
|
|
273
|
+
normalize_completion_gate_failure_signature,
|
|
274
|
+
record_completion_gate_decision,
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
# turn re-exports
|
|
278
|
+
from .agent.turn import ( # noqa: F401
|
|
279
|
+
_ACTION_PROGRESS_FALLBACK_TOOL_NAMES,
|
|
280
|
+
_ACTION_PROGRESS_TOOL_CATEGORIES,
|
|
281
|
+
_EXPLORATION_FALLBACK_TOOL_NAMES,
|
|
282
|
+
_EXPLORATION_TOOL_CATEGORIES,
|
|
283
|
+
_FAILED_EDIT_STAGNATION_TOOL_NAMES,
|
|
284
|
+
_FINAL_TOOL_ENABLED_STEP_SYSTEM_PROMPT,
|
|
285
|
+
_FORCED_FINAL_SUMMARY_SYSTEM_PROMPT_TEMPLATE,
|
|
286
|
+
_LOW_STEP_BUDGET_SYSTEM_PROMPT_TEMPLATE,
|
|
287
|
+
_PHASE_BUDGET_EXPLORATION_SYSTEM_PROMPT_TEMPLATE,
|
|
288
|
+
_PHASE_BUDGET_VERIFICATION_SYSTEM_PROMPT_TEMPLATE,
|
|
289
|
+
_SUBAGENT_REQUIRED_NUDGE_TEMPLATE,
|
|
290
|
+
_SAME_BATCH_FS_READ_DEFAULT_MAX_BYTES,
|
|
291
|
+
_SAME_BATCH_FS_READ_LINES_DEFAULT_MAX_LINES,
|
|
292
|
+
_SAME_BATCH_READ_CACHE_SAFE_TOOL_NAMES,
|
|
293
|
+
_UNEXECUTED_TOOL_CALL_MARKUP_MARKERS,
|
|
294
|
+
MAX_EDIT_NUDGES_PER_TURN,
|
|
295
|
+
MAX_EXPLORATION_NUDGES_PER_TURN,
|
|
296
|
+
MAX_EXPLORATION_ONLY_STEPS_BEFORE_NUDGE,
|
|
297
|
+
MAX_FAILED_EDIT_STEPS_BEFORE_NUDGE,
|
|
298
|
+
MAX_IDENTICAL_EXPLORATION_ATTEMPTS,
|
|
299
|
+
MAX_IDENTICAL_FAILED_EDIT_ATTEMPTS,
|
|
300
|
+
MAX_IDENTICAL_TOOL_CALL_FAILURES,
|
|
301
|
+
MAX_NON_FINAL_CONTINUATIONS_PER_TURN,
|
|
302
|
+
MAX_POST_EXPLORE_BOOTSTRAP_NUDGES_PER_TURN,
|
|
303
|
+
MAX_RECENT_EXPLORATION_PATHS,
|
|
304
|
+
MAX_SUBAGENT_REQUIRED_NUDGES_PER_TURN,
|
|
305
|
+
_append_recent_exploration_path,
|
|
306
|
+
_build_fs_read_lines_result_from_cached_range,
|
|
307
|
+
_build_fs_read_lines_result_from_full_fs_read,
|
|
308
|
+
_build_post_explore_bootstrap_nudge,
|
|
309
|
+
_coerce_fs_read_lines_request,
|
|
310
|
+
_coerce_fs_read_request,
|
|
311
|
+
_edit_similarity_key,
|
|
312
|
+
_emit_surface_error,
|
|
313
|
+
_exploration_attempt_outcome,
|
|
314
|
+
_exploration_similarity_key,
|
|
315
|
+
_extract_successful_exploration_paths,
|
|
316
|
+
_has_invalid_tool_call_json,
|
|
317
|
+
_is_action_progress_tool,
|
|
318
|
+
_is_exploration_only_tool,
|
|
319
|
+
_is_failed_edit_stagnation_tool,
|
|
320
|
+
_is_successful_subagent_run,
|
|
321
|
+
_looks_like_unexecuted_tool_call_markup,
|
|
322
|
+
_maybe_reuse_same_batch_read_result,
|
|
323
|
+
_one_shot_progress_fingerprint,
|
|
324
|
+
_remember_same_batch_read_result,
|
|
325
|
+
_same_batch_read_cache_should_invalidate,
|
|
326
|
+
_same_batch_read_path_key,
|
|
327
|
+
_SameBatchFsReadLinesRecord,
|
|
328
|
+
_SameBatchFsReadRecord,
|
|
329
|
+
_SameBatchReadReuseCache,
|
|
330
|
+
_SubagentTurnPolicy,
|
|
331
|
+
_SubagentTurnPolicyLevel,
|
|
332
|
+
_split_text_preserving_lines,
|
|
333
|
+
_tool_call_retry_key,
|
|
334
|
+
_tool_categories,
|
|
335
|
+
_resolve_subagent_turn_policy,
|
|
336
|
+
_subagent_names_preview,
|
|
337
|
+
_subagent_required_nudge_message,
|
|
338
|
+
_subagent_turn_context_message,
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
# verification re-exports
|
|
342
|
+
from .agent.verification import ( # noqa: F401
|
|
343
|
+
_COMMAND_LIKE_MUTATION_TOOL_NAMES,
|
|
344
|
+
_COMPLETION_GATE_PROBLEM_LABELS,
|
|
345
|
+
_MATERIAL_EDIT_TOOL_NAMES,
|
|
346
|
+
_ONE_SHOT_COMPLETION_GATE_NUDGE_PREFIX,
|
|
347
|
+
_RUNTIME_DEFAULT_LANGUAGE,
|
|
348
|
+
_RUNTIME_MESSAGE_CATALOG,
|
|
349
|
+
_VERIFICATION_SHELL_MARKERS,
|
|
350
|
+
TurnExecutionState,
|
|
351
|
+
_build_interactive_turn_verify_task,
|
|
352
|
+
_completion_gate_blocker_allows_final,
|
|
353
|
+
_completion_gate_nudge_message,
|
|
354
|
+
_completion_gate_problem_summary,
|
|
355
|
+
_completion_gate_problems,
|
|
356
|
+
_completion_gate_repair_stage,
|
|
357
|
+
_extract_touched_repo_paths,
|
|
358
|
+
_fresh_executed_evidence_for_claim,
|
|
359
|
+
_record_shell_verification_command_outcome,
|
|
360
|
+
_record_tool_effect,
|
|
361
|
+
_record_verify_run_command_outcomes,
|
|
362
|
+
_refresh_execute_turn_verification_selection,
|
|
363
|
+
_refresh_interactive_turn_verification_selection,
|
|
364
|
+
_runtime_message,
|
|
365
|
+
_runtime_message_locale,
|
|
366
|
+
_sorted_missing_verification_commands,
|
|
367
|
+
_successful_verification_claim_kind,
|
|
368
|
+
_verification_attempt_passed,
|
|
369
|
+
_verification_command_result_passed,
|
|
370
|
+
_verification_command_result_snippet,
|
|
371
|
+
_verification_expected_for_turn,
|
|
372
|
+
_verification_failure_category_for_tool_result,
|
|
373
|
+
extract_verification_failure_snippet,
|
|
374
|
+
run_task_verification,
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
# verification evidence re-exports
|
|
378
|
+
from .agent.verification_evidence import ( # noqa: F401
|
|
379
|
+
VerificationEvidence,
|
|
380
|
+
VerificationEvidenceCategory,
|
|
381
|
+
classify_verification_evidence,
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
# verification_commands re-exports
|
|
385
|
+
from .agent.verification_commands import ( # noqa: F401
|
|
386
|
+
_CARGO_TEST_NON_EXECUTING_OPTIONS,
|
|
387
|
+
_DISALLOWED_VERIFICATION_SHELL_TOKENS,
|
|
388
|
+
_GO_TEST_NON_EXECUTING_OPTIONS,
|
|
389
|
+
_MYPY_NON_EXECUTING_OPTIONS,
|
|
390
|
+
_NON_VERIFICATION_META_OPTIONS,
|
|
391
|
+
_PYTEST_NON_EXECUTING_OPTIONS,
|
|
392
|
+
_PYTEST_NON_VERIFICATION_OPTIONS,
|
|
393
|
+
_PYTEST_REPORTER_OPTIONS,
|
|
394
|
+
_RUFF_CHECK_NON_EXECUTING_OPTIONS,
|
|
395
|
+
_VERIFICATION_ENV_ASSIGNMENT_RE,
|
|
396
|
+
VerificationCommandShape,
|
|
397
|
+
_canonicalize_verification_command_for_match,
|
|
398
|
+
_command_options_include,
|
|
399
|
+
_effective_verification_command_matches,
|
|
400
|
+
_has_disallowed_shell_control_flow,
|
|
401
|
+
_looks_like_env_assignment_token,
|
|
402
|
+
_looks_like_verification_entrypoint,
|
|
403
|
+
_marker_fallback_is_verification_attempt,
|
|
404
|
+
_matching_effective_verification_commands,
|
|
405
|
+
_normalize_and_unwrap_verification_command,
|
|
406
|
+
_normalize_shell_command_for_match,
|
|
407
|
+
_parse_verification_command_shape,
|
|
408
|
+
_pytest_option_is_reporter_variant,
|
|
409
|
+
_shell_command_is_verification_attempt,
|
|
410
|
+
_split_verification_shape_args,
|
|
411
|
+
_strip_verification_env_prefix,
|
|
412
|
+
_strip_verification_runner_prefix,
|
|
413
|
+
_unwrap_shell_wrapper_command,
|
|
414
|
+
_verification_command_shapes_match,
|
|
415
|
+
_verification_shape_is_real_execution_mode,
|
|
416
|
+
_verify_run_commands_match_effective_contract,
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
# tools.availability re-exports
|
|
420
|
+
from .tools.availability import ( # noqa: F401
|
|
421
|
+
is_tool_unavailable_result,
|
|
422
|
+
mark_available,
|
|
423
|
+
mark_unavailable,
|
|
424
|
+
register_tool_availability,
|
|
425
|
+
unavailable_tool_result,
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
# tools.fs re-exports
|
|
429
|
+
from .tools.fs import fs_list, fs_read, fs_read_lines # noqa: F401
|
|
430
|
+
|
|
431
|
+
# tools.search re-exports
|
|
432
|
+
from .tools.search import search_rg # noqa: F401
|
|
433
|
+
|
|
434
|
+
# tools.shell re-exports
|
|
435
|
+
from .tools.shell import shell_run # noqa: F401
|
|
436
|
+
|
|
437
|
+
# tools.symbols re-exports
|
|
438
|
+
from .tools.symbols import symbol_search # noqa: F401
|
|
439
|
+
|
|
440
|
+
# tools.web re-exports
|
|
441
|
+
from .tools.web import web_fetch # noqa: F401
|
|
442
|
+
|
|
443
|
+
# isort: on
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
def _emit_required_run_deadline_missing(
|
|
447
|
+
*,
|
|
448
|
+
crash_diagnostic_log_path: str | Path | None,
|
|
449
|
+
crash_diagnostic_logger: CrashDiagnosticLogger | None,
|
|
450
|
+
runtime_kind_text: str,
|
|
451
|
+
deadline_config_source: str,
|
|
452
|
+
) -> None:
|
|
453
|
+
logger = crash_diagnostic_logger
|
|
454
|
+
if logger is None:
|
|
455
|
+
from .crash_diagnostics import build_crash_diagnostic_logger
|
|
456
|
+
|
|
457
|
+
logger = build_crash_diagnostic_logger(
|
|
458
|
+
path=crash_diagnostic_log_path,
|
|
459
|
+
run_id="pre_session",
|
|
460
|
+
session_id="pre_session",
|
|
461
|
+
runtime_kind=runtime_kind_text,
|
|
462
|
+
)
|
|
463
|
+
logger.event(
|
|
464
|
+
"required_run_deadline_missing",
|
|
465
|
+
{
|
|
466
|
+
"status": "blocked",
|
|
467
|
+
"reason": "required_deadline_absent",
|
|
468
|
+
"deadline_config_source": deadline_config_source,
|
|
469
|
+
"runtime_kind": runtime_kind_text,
|
|
470
|
+
},
|
|
471
|
+
durable=True,
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
def run_agent(
|
|
476
|
+
*,
|
|
477
|
+
cfg: AppConfig,
|
|
478
|
+
root: Path,
|
|
479
|
+
instruction: str,
|
|
480
|
+
image_paths: list[str] | None = None,
|
|
481
|
+
mode: str,
|
|
482
|
+
yes: bool,
|
|
483
|
+
max_steps: int | None,
|
|
484
|
+
no_log: bool,
|
|
485
|
+
api_key_override: str | None = None,
|
|
486
|
+
console: Any | None = None,
|
|
487
|
+
deny_write_prefixes: list[str] | None = None,
|
|
488
|
+
allow_write_globs: list[str] | None = None,
|
|
489
|
+
persona_allow_write_globs: list[str] | None = None,
|
|
490
|
+
non_interactive: bool = False,
|
|
491
|
+
one_shot_execution: bool = False,
|
|
492
|
+
ephemeral_system_messages: list[str] | tuple[str, ...] | None = None,
|
|
493
|
+
ephemeral_user_messages: list[str] | tuple[str, ...] | None = None,
|
|
494
|
+
enable_chat_turn_step_budget: bool = False,
|
|
495
|
+
chat_turn_fixed_override: int | None = None,
|
|
496
|
+
session_log_dir_override: Path | None = None,
|
|
497
|
+
session_id_override: str | None = None,
|
|
498
|
+
surface: Surface | None = None,
|
|
499
|
+
usage_role: str = "main",
|
|
500
|
+
trusted_system_prompt_override: str | None = None,
|
|
501
|
+
trusted_system_prompt_append: str | None = None,
|
|
502
|
+
untrusted_prompt_prelude: str | None = None,
|
|
503
|
+
enable_compaction: bool = True,
|
|
504
|
+
enable_tool_output_offload: bool | None = None,
|
|
505
|
+
enable_conversation_summarization: bool | None = None,
|
|
506
|
+
compaction_profile: str = "chat",
|
|
507
|
+
verification_enabled: bool = True,
|
|
508
|
+
authoritative_verification_commands: list[str] | None = None,
|
|
509
|
+
verify_cmd: list[str] | None = None,
|
|
510
|
+
subagents_enabled: bool | None = None,
|
|
511
|
+
enforce_explicit_subagent_requests: bool = True,
|
|
512
|
+
workspace_binding: WorkspaceBinding | None = None,
|
|
513
|
+
runtime_kind: RuntimeKind | str | None = None,
|
|
514
|
+
mcp_manager: McpManager | ForgeTaskScopedMcpManager | None = None,
|
|
515
|
+
execution_deadline: ExecutionDeadline | None = None,
|
|
516
|
+
run_deadline_seconds: float | None = None,
|
|
517
|
+
no_run_deadline: bool = False,
|
|
518
|
+
require_run_deadline: bool = False,
|
|
519
|
+
crash_diagnostic_log_path: str | Path | None = None,
|
|
520
|
+
crash_diagnostic_logger: CrashDiagnosticLogger | None = None,
|
|
521
|
+
cancellation_token: Any | None = None,
|
|
522
|
+
session_source: str = "startup",
|
|
523
|
+
session_source_metadata: dict[str, Any] | None = None,
|
|
524
|
+
tool_dispatch_guard: Any | None = None,
|
|
525
|
+
) -> int:
|
|
526
|
+
runtime_kind_text = str(getattr(runtime_kind, "value", runtime_kind) or "").strip()
|
|
527
|
+
if execution_deadline is not None and run_deadline_seconds is not None:
|
|
528
|
+
raise ConfigError("run_deadline_seconds cannot be combined with execution_deadline")
|
|
529
|
+
|
|
530
|
+
if execution_deadline is None:
|
|
531
|
+
deadline_has_one_shot_semantics = (
|
|
532
|
+
one_shot_execution
|
|
533
|
+
or runtime_kind_text in {"one_shot", "forge_exec", "swarm_worker"}
|
|
534
|
+
or run_deadline_seconds is not None
|
|
535
|
+
or no_run_deadline
|
|
536
|
+
)
|
|
537
|
+
if deadline_has_one_shot_semantics or require_run_deadline:
|
|
538
|
+
# A non-interactive run gets a generous default budget so it cannot
|
|
539
|
+
# grind for hours unattended. Two exclusions: a managed host that
|
|
540
|
+
# asked to fail closed (silently defaulting would defeat the check
|
|
541
|
+
# it opted into), and an explicit --no-deadline. Interactive chat
|
|
542
|
+
# never reaches here.
|
|
543
|
+
default_run_deadline_seconds = (
|
|
544
|
+
# Sized by ALYSIS_RUN_BUDGET_SECONDS, defaulting to the same
|
|
545
|
+
# 3600 this replaced. Only the default rung moves: an explicit
|
|
546
|
+
# --deadline-seconds, ALYSIS_RUN_DEADLINE_SECONDS, or a
|
|
547
|
+
# configured run_deadline_seconds still wins, as before.
|
|
548
|
+
resolve_run_budget_seconds()
|
|
549
|
+
if (
|
|
550
|
+
deadline_has_one_shot_semantics
|
|
551
|
+
and not require_run_deadline
|
|
552
|
+
and not no_run_deadline
|
|
553
|
+
)
|
|
554
|
+
else None
|
|
555
|
+
)
|
|
556
|
+
resolved_deadline = resolve_run_deadline(
|
|
557
|
+
cfg,
|
|
558
|
+
cli_deadline_seconds=run_deadline_seconds,
|
|
559
|
+
cli_no_deadline=no_run_deadline,
|
|
560
|
+
default_seconds=default_run_deadline_seconds,
|
|
561
|
+
)
|
|
562
|
+
if resolved_deadline.seconds is None:
|
|
563
|
+
if require_run_deadline:
|
|
564
|
+
_emit_required_run_deadline_missing(
|
|
565
|
+
crash_diagnostic_log_path=crash_diagnostic_log_path,
|
|
566
|
+
crash_diagnostic_logger=crash_diagnostic_logger,
|
|
567
|
+
runtime_kind_text=runtime_kind_text,
|
|
568
|
+
deadline_config_source=resolved_deadline.source,
|
|
569
|
+
)
|
|
570
|
+
raise ConfigError(
|
|
571
|
+
"Managed-host run requires a finite run deadline. "
|
|
572
|
+
"Pass --deadline-seconds, set ALYSIS_RUN_DEADLINE_SECONDS, "
|
|
573
|
+
"or configure run_deadline_seconds."
|
|
574
|
+
)
|
|
575
|
+
else:
|
|
576
|
+
execution_deadline = ExecutionDeadline.from_duration(
|
|
577
|
+
resolved_deadline.seconds,
|
|
578
|
+
source=resolved_deadline.source,
|
|
579
|
+
degradation_policy=resolve_deadline_degradation_policy(cfg),
|
|
580
|
+
)
|
|
581
|
+
elif require_run_deadline and not execution_deadline.enabled:
|
|
582
|
+
_emit_required_run_deadline_missing(
|
|
583
|
+
crash_diagnostic_log_path=crash_diagnostic_log_path,
|
|
584
|
+
crash_diagnostic_logger=crash_diagnostic_logger,
|
|
585
|
+
runtime_kind_text=runtime_kind_text,
|
|
586
|
+
deadline_config_source=str(getattr(execution_deadline, "source", "execution_deadline")),
|
|
587
|
+
)
|
|
588
|
+
raise ConfigError(
|
|
589
|
+
"Managed-host run requires a finite run deadline. "
|
|
590
|
+
"Pass --deadline-seconds, set ALYSIS_RUN_DEADLINE_SECONDS, "
|
|
591
|
+
"or configure run_deadline_seconds."
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
session = create_session(
|
|
595
|
+
cfg=cfg,
|
|
596
|
+
root=root,
|
|
597
|
+
mode=mode,
|
|
598
|
+
runtime_kind=runtime_kind,
|
|
599
|
+
yes=yes,
|
|
600
|
+
max_steps=max_steps,
|
|
601
|
+
no_log=no_log,
|
|
602
|
+
api_key_override=api_key_override,
|
|
603
|
+
console=console,
|
|
604
|
+
deny_write_prefixes=deny_write_prefixes,
|
|
605
|
+
allow_write_globs=allow_write_globs,
|
|
606
|
+
persona_allow_write_globs=persona_allow_write_globs,
|
|
607
|
+
non_interactive=non_interactive,
|
|
608
|
+
one_shot_execution=one_shot_execution,
|
|
609
|
+
enable_chat_turn_step_budget=enable_chat_turn_step_budget,
|
|
610
|
+
chat_turn_fixed_override=chat_turn_fixed_override,
|
|
611
|
+
session_log_dir_override=session_log_dir_override,
|
|
612
|
+
session_id_override=session_id_override,
|
|
613
|
+
surface=surface,
|
|
614
|
+
usage_role=usage_role,
|
|
615
|
+
trusted_system_prompt_override=trusted_system_prompt_override,
|
|
616
|
+
trusted_system_prompt_append=trusted_system_prompt_append,
|
|
617
|
+
untrusted_prompt_prelude=untrusted_prompt_prelude,
|
|
618
|
+
enable_compaction=enable_compaction,
|
|
619
|
+
enable_tool_output_offload=enable_tool_output_offload,
|
|
620
|
+
enable_conversation_summarization=enable_conversation_summarization,
|
|
621
|
+
compaction_profile=compaction_profile,
|
|
622
|
+
verification_enabled=verification_enabled,
|
|
623
|
+
authoritative_verification_commands=authoritative_verification_commands,
|
|
624
|
+
verify_cmd=verify_cmd,
|
|
625
|
+
subagents_enabled=subagents_enabled,
|
|
626
|
+
enforce_explicit_subagent_requests=enforce_explicit_subagent_requests,
|
|
627
|
+
workspace_binding=workspace_binding,
|
|
628
|
+
mcp_manager=mcp_manager,
|
|
629
|
+
execution_deadline=execution_deadline,
|
|
630
|
+
crash_diagnostic_log_path=crash_diagnostic_log_path,
|
|
631
|
+
crash_diagnostic_logger=crash_diagnostic_logger,
|
|
632
|
+
session_source=session_source,
|
|
633
|
+
session_source_metadata=session_source_metadata,
|
|
634
|
+
tool_dispatch_guard=tool_dispatch_guard,
|
|
635
|
+
)
|
|
636
|
+
# Arm the run-budget stop gate. Every deadline check inside the engine is a
|
|
637
|
+
# *start* gate evaluated between operations; nothing re-reads the clock
|
|
638
|
+
# while an operation is in flight, so a blocking call that does not bound
|
|
639
|
+
# itself by the deadline can outlive the budget indefinitely -- which is
|
|
640
|
+
# how runs that had already recorded exhausted:true kept going for hours.
|
|
641
|
+
# This daemon timer trips a cancellation event at deadline + grace, which
|
|
642
|
+
# unblocks the cooperative checkpoints (step loop, mid-stream LLM read,
|
|
643
|
+
# subagent joins) no matter where the run is parked. Skipped when a caller
|
|
644
|
+
# already supplied a token, because that surface owns its own cancellation.
|
|
645
|
+
watchdog: BudgetWatchdog | None = None
|
|
646
|
+
if cancellation_token is None and execution_deadline is not None and execution_deadline.enabled:
|
|
647
|
+
|
|
648
|
+
def _record_budget_watchdog_fired() -> None:
|
|
649
|
+
payload = {
|
|
650
|
+
"reason": STOP_REASON_RUN_BUDGET_EXHAUSTED,
|
|
651
|
+
"grace_seconds": resolve_budget_grace_seconds(),
|
|
652
|
+
"deadline": execution_deadline.telemetry_snapshot(),
|
|
653
|
+
}
|
|
654
|
+
session.store.append("run_budget_watchdog_fired", payload)
|
|
655
|
+
if session.crash_diagnostics is not None:
|
|
656
|
+
session.crash_diagnostics.event(
|
|
657
|
+
"run_budget_watchdog_fired",
|
|
658
|
+
payload,
|
|
659
|
+
durable=True,
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
watchdog = BudgetWatchdog(
|
|
663
|
+
# Remaining, not configured: session construction happens after the
|
|
664
|
+
# clock starts, so this fires at the real deadline plus the grace.
|
|
665
|
+
budget_seconds=float(execution_deadline.remaining_seconds() or 0.0),
|
|
666
|
+
grace_seconds=resolve_budget_grace_seconds(),
|
|
667
|
+
on_fire=_record_budget_watchdog_fired,
|
|
668
|
+
)
|
|
669
|
+
cancellation_token = BudgetCancellationToken(
|
|
670
|
+
watchdog.event,
|
|
671
|
+
# The engine's existing handlers catch CooperativeCancellationError;
|
|
672
|
+
# the token attributes the stop to the budget via its reason, which
|
|
673
|
+
# is what makes it finalize as a clean exit instead of an abort.
|
|
674
|
+
error_class=CooperativeCancellationError,
|
|
675
|
+
)
|
|
676
|
+
watchdog.arm()
|
|
677
|
+
try:
|
|
678
|
+
turn_kwargs: dict[str, Any] = {
|
|
679
|
+
"image_paths": image_paths,
|
|
680
|
+
"cancellation_token": cancellation_token,
|
|
681
|
+
}
|
|
682
|
+
if ephemeral_system_messages:
|
|
683
|
+
turn_kwargs["ephemeral_system_messages"] = list(ephemeral_system_messages)
|
|
684
|
+
if ephemeral_user_messages:
|
|
685
|
+
turn_kwargs["ephemeral_user_messages"] = list(ephemeral_user_messages)
|
|
686
|
+
return session.run_turn(instruction, **turn_kwargs)
|
|
687
|
+
finally:
|
|
688
|
+
if watchdog is not None:
|
|
689
|
+
watchdog.disarm()
|
|
690
|
+
# close() is left with its default reason on purpose: `status` feeds
|
|
691
|
+
# the agentbox error flag, and a budget stop is not an error. The
|
|
692
|
+
# machine-readable marker travels as session.stop_reason instead.
|
|
693
|
+
session.close()
|