steerable-agent-runtime 0.14.1__tar.gz → 0.14.3__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.
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/PKG-INFO +1 -1
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/pyproject.toml +1 -1
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/approval.py +17 -4
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/approval_policy.py +13 -4
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/anthropic_native.py +2 -1
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/google_genai.py +7 -1
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/openai_compat.py +23 -15
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/openai_responses.py +23 -13
- steerable_agent_runtime-0.14.3/src/steerable_agent_runtime/llm/tool_call_args.py +176 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/model_resolve.py +9 -1
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/tools.py +12 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime.egg-info/PKG-INFO +1 -1
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime.egg-info/SOURCES.txt +1 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_approval.py +49 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_llm_wire_helpers.py +125 -2
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_model_resolve.py +2 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/README.md +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/setup.cfg +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/__init__.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/antihallucination.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/ask_user.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/branch.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/cache_control.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/calibration.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/child_notice.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/child_record.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/compaction.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/compaction_policy.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/config.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/default.harness.json +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/default.harness.yaml +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/delegation_gate.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/engines.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/errors.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/gateway_catalog.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/handoff.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/harness.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/harness_spec.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/history.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/hooks.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/__init__.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/compat.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/errors.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/parts.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/presets.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/llm/system_proxy.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/loop.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/maintenance.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/mcp.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/mcp_server.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/model_catalog.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/model_info.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/native_bridge.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/observation_aging.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/orchestration.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/otel.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/peer.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/plugins.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/pool.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/pricing.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/pseudo.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/recording.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/registry.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/reminders.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/replay.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/resume.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/retry.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/sandboxed.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/sidecall.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/skills.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/spend.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/spill.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/storage/__init__.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/storage/in_memory.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/storage/sqlalchemy_store.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/storage/sqlite_store.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/storage/write_lease.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/subagent.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/team_board.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/todo.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/tokens.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/tool_presentation.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/tool_schema.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/tool_search.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/tracing.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/transport/__init__.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/transport/fastapi_sse.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/transport/stdio_jsonrpc.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/tree.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime/world_state.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime.egg-info/dependency_links.txt +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime.egg-info/requires.txt +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/src/steerable_agent_runtime.egg-info/top_level.txt +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_antihallucination.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_approval_policy.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_ask_user.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_branch.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_cache_control.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_cache_instrumentation.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_calibration.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_child_notice.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_children_schema.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_children_usage.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_compaction.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_compaction_phase10.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_compaction_policy.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_compaction_strategy.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_config.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_content_parts.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_cross_model_fork.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_delegation_fork.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_delegation_gate.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_engines.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_error_taxonomy.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_fanout.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_fork_prefix.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_fork_spawn.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_fragment_bounds.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_gateway_catalog.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_golden.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_handoff.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_harness.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_harness_spec.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_history.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_history_persistence.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_hooks.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_in_memory_storage.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_llm_gemini_wire.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_llm_responses_wire.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_llm_stream_e2e.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_long_session.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_loop.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_loop_cancellation.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_loop_replay.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_loop_sandbox_event.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_loop_terminal.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_maintenance.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_mcp.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_mcp_server.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_model_catalog.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_model_equivalence.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_model_info.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_native_default.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_observation_aging.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_orchestration.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_otel.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_parallel_tools.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_phase9_outward_unknown.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_phase9_sidecall.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_plugins.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_pool_acp.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_pool_registry.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_provider_compat.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_provider_presets.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_pseudo.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_pyo3_api_surface.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_recording.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_registry.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_reminders.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_replay_crosslang.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_resume.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_resume_child.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_resume_failed_turn.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_retry_hooks.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_safety_gate.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_sandboxed.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_skills.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_soft_timeout.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_spill.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_sqlite_storage.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_steer.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_storage_contract.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_stream_strip.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_subagent.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_system_proxy.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_team_board.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_team_collab.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_todo.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_todo_gate.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tokens.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tool_exposure.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tool_hygiene.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tool_presentation.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tool_router.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tool_schema.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tool_timeout.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_trace_recorder.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_transport_error_detail.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_transport_jsonrpc.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_transport_sse.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tree.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tree_spend.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_tree_spend_pool.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_usage_attribution.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_world_state.py +0 -0
- {steerable_agent_runtime-0.14.1 → steerable_agent_runtime-0.14.3}/tests/test_write_lease.py +0 -0
|
@@ -40,6 +40,7 @@ from steerable_agent_harness.policy import ToolMode, decide_tool_mode
|
|
|
40
40
|
from steerable_agent_protocol.generated import ToolCall, ToolResult
|
|
41
41
|
|
|
42
42
|
from .errors import ApprovalAborted, PolicyDeniedError
|
|
43
|
+
from .llm.tool_call_args import format_invalid_tool_arguments_error
|
|
43
44
|
from .sandboxed import DEFAULT_SHELL_TOOLS
|
|
44
45
|
|
|
45
46
|
if TYPE_CHECKING:
|
|
@@ -535,12 +536,14 @@ class JsonApprovalStore:
|
|
|
535
536
|
return {
|
|
536
537
|
str(category): cast(ApprovalKind, kind)
|
|
537
538
|
for category, kind in bucket.items()
|
|
538
|
-
if kind in _DURABLE_KINDS
|
|
539
|
+
if isinstance(kind, str) and kind in _DURABLE_KINDS
|
|
539
540
|
}
|
|
540
541
|
return {
|
|
541
542
|
str(category): cast(ApprovalKind, kind)
|
|
542
543
|
for category, kind in raw.items()
|
|
543
|
-
if
|
|
544
|
+
if category != "_by_policy"
|
|
545
|
+
and isinstance(kind, str)
|
|
546
|
+
and kind in _DURABLE_KINDS
|
|
544
547
|
}
|
|
545
548
|
|
|
546
549
|
def put(self, category: str, kind: ApprovalKind) -> None:
|
|
@@ -559,9 +562,13 @@ class JsonApprovalStore:
|
|
|
559
562
|
bucket[category] = kind
|
|
560
563
|
payload_to_write: dict[str, Any] = full
|
|
561
564
|
else:
|
|
562
|
-
|
|
565
|
+
full = self._read_raw_dict()
|
|
566
|
+
decisions: dict[str, Any] = dict(self.load())
|
|
563
567
|
decisions[category] = kind
|
|
564
|
-
|
|
568
|
+
by_policy = full.get("_by_policy")
|
|
569
|
+
if isinstance(by_policy, dict):
|
|
570
|
+
decisions["_by_policy"] = by_policy
|
|
571
|
+
payload_to_write = decisions
|
|
565
572
|
self._path.parent.mkdir(parents=True, exist_ok=True)
|
|
566
573
|
fd, tmp = tempfile.mkstemp(dir=self._path.parent, suffix=".tmp")
|
|
567
574
|
try:
|
|
@@ -694,6 +701,12 @@ def declared_resolver(
|
|
|
694
701
|
|
|
695
702
|
|
|
696
703
|
def _validate_tool_schema(request: ApprovalRequest) -> RejectedBeforeEffectError | None:
|
|
704
|
+
invalid_args = format_invalid_tool_arguments_error(
|
|
705
|
+
request.tool_name, request.arguments
|
|
706
|
+
)
|
|
707
|
+
if invalid_args is not None:
|
|
708
|
+
code, message = invalid_args
|
|
709
|
+
return _reject_before_effect(code, message, retryable=True)
|
|
697
710
|
schema = request.input_schema
|
|
698
711
|
if not isinstance(schema, dict):
|
|
699
712
|
return None
|
|
@@ -69,7 +69,7 @@ class ApprovalRule:
|
|
|
69
69
|
def __post_init__(self) -> None:
|
|
70
70
|
if not self.tool:
|
|
71
71
|
raise ValueError("rule tool must be non-empty")
|
|
72
|
-
if self.decision not in _RULE_DECISIONS:
|
|
72
|
+
if not isinstance(self.decision, str) or self.decision not in _RULE_DECISIONS:
|
|
73
73
|
raise ValueError(f"rule decision must be allow|deny, got {self.decision!r}")
|
|
74
74
|
|
|
75
75
|
def matches(self, request: ApprovalRequest) -> bool:
|
|
@@ -150,8 +150,17 @@ class JsonApprovalPolicyStore:
|
|
|
150
150
|
return ApprovalPolicy()
|
|
151
151
|
try:
|
|
152
152
|
data = json.loads(self._path.read_text(encoding="utf-8"))
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
if not isinstance(data, dict):
|
|
154
|
+
raise ValueError("approval policy root must be an object")
|
|
155
|
+
raw_rules = data.get("rules") or []
|
|
156
|
+
if not isinstance(raw_rules, list):
|
|
157
|
+
raise ValueError("approval policy rules must be a list")
|
|
158
|
+
rules = [
|
|
159
|
+
ApprovalRule.from_dict(r)
|
|
160
|
+
for r in raw_rules
|
|
161
|
+
if isinstance(r, dict)
|
|
162
|
+
]
|
|
163
|
+
except (ValueError, TypeError, KeyError, AttributeError, OSError) as exc:
|
|
155
164
|
# A corrupt policy fails closed: no rules, so every call falls
|
|
156
165
|
# through to the interactive approver — never an auto-allow.
|
|
157
166
|
logger.warning("ignoring unreadable approval policy %s: %s", self._path, exc)
|
|
@@ -228,7 +237,7 @@ def rule_from_amendment(
|
|
|
228
237
|
if not isinstance(amendment, dict):
|
|
229
238
|
return None
|
|
230
239
|
decision = amendment.get("decision")
|
|
231
|
-
if decision not in _RULE_DECISIONS:
|
|
240
|
+
if not isinstance(decision, str) or decision not in _RULE_DECISIONS:
|
|
232
241
|
logger.warning("ignoring approval amendment with bad decision: %r", amendment)
|
|
233
242
|
return None
|
|
234
243
|
prefix_raw = amendment.get("commandPrefix") or []
|
|
@@ -22,6 +22,7 @@ from steerable_agent_protocol.generated import ToolCall
|
|
|
22
22
|
from . import LLMMessage, LLMStreamChunk, LLMUsage
|
|
23
23
|
from .errors import LLMError, classify_http_status, describe_transport_error
|
|
24
24
|
from .parts import ImagePart, TextPart
|
|
25
|
+
from .tool_call_args import replay_tool_call_arguments
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
def _classify_anthropic_error(
|
|
@@ -293,7 +294,7 @@ def _split_system_and_messages(
|
|
|
293
294
|
"type": "tool_use",
|
|
294
295
|
"id": tc.id or "",
|
|
295
296
|
"name": tc.name,
|
|
296
|
-
"input": tc.arguments
|
|
297
|
+
"input": replay_tool_call_arguments(tc.arguments),
|
|
297
298
|
}
|
|
298
299
|
)
|
|
299
300
|
out.append({"role": "assistant", "content": blocks})
|
|
@@ -32,6 +32,7 @@ from .errors import (
|
|
|
32
32
|
from .parts import ImagePart, TextPart
|
|
33
33
|
from .presets import ProviderPreset, preset_for
|
|
34
34
|
from .system_proxy import client_env_kwargs, egress_path
|
|
35
|
+
from .tool_call_args import replay_tool_call_arguments
|
|
35
36
|
|
|
36
37
|
logger = logging.getLogger(__name__)
|
|
37
38
|
|
|
@@ -347,7 +348,12 @@ def _encode_contents(messages: Sequence[LLMMessage]) -> tuple[str, list[dict[str
|
|
|
347
348
|
parts = _encode_parts(message)
|
|
348
349
|
for call in message.tool_calls or []:
|
|
349
350
|
parts.append(
|
|
350
|
-
{
|
|
351
|
+
{
|
|
352
|
+
"functionCall": {
|
|
353
|
+
"name": call.name,
|
|
354
|
+
"args": replay_tool_call_arguments(call.arguments),
|
|
355
|
+
}
|
|
356
|
+
}
|
|
351
357
|
)
|
|
352
358
|
if parts:
|
|
353
359
|
contents.append({"role": "model", "parts": parts})
|
|
@@ -39,6 +39,7 @@ from .errors import (
|
|
|
39
39
|
from .parts import ImagePart, TextPart
|
|
40
40
|
from .presets import ProviderPreset, preset_for
|
|
41
41
|
from .system_proxy import client_env_kwargs, egress_path
|
|
42
|
+
from .tool_call_args import parse_tool_call_arguments, replay_tool_call_arguments
|
|
42
43
|
|
|
43
44
|
logger = logging.getLogger(__name__)
|
|
44
45
|
|
|
@@ -232,7 +233,10 @@ class OpenAICompatProvider:
|
|
|
232
233
|
out = LLMMessage.text_of(
|
|
233
234
|
"assistant",
|
|
234
235
|
message.get("content") or "",
|
|
235
|
-
tool_calls=_decode_tool_calls(
|
|
236
|
+
tool_calls=_decode_tool_calls(
|
|
237
|
+
message.get("tool_calls"),
|
|
238
|
+
finish_reason=choice.get("finish_reason"),
|
|
239
|
+
),
|
|
236
240
|
reasoning=_reasoning_text(message, ("reasoning_content", "reasoning")),
|
|
237
241
|
reasoning_details=_reasoning_details_list(message.get("reasoning_details")),
|
|
238
242
|
)
|
|
@@ -488,12 +492,17 @@ class _OpenAIToolCallAssembler:
|
|
|
488
492
|
|
|
489
493
|
def __init__(self) -> None:
|
|
490
494
|
self._buf: dict[int, dict[str, str]] = {}
|
|
495
|
+
self._finish_reason: str | None = None
|
|
491
496
|
|
|
492
497
|
def observe(self, chunk: dict[str, Any]) -> None:
|
|
493
498
|
choices = chunk.get("choices") or []
|
|
494
499
|
if not choices:
|
|
495
500
|
return
|
|
496
|
-
|
|
501
|
+
first_choice = choices[0] if isinstance(choices[0], dict) else {}
|
|
502
|
+
finish_reason = first_choice.get("finish_reason")
|
|
503
|
+
if isinstance(finish_reason, str) and finish_reason:
|
|
504
|
+
self._finish_reason = finish_reason
|
|
505
|
+
delta = first_choice.get("delta") or {}
|
|
497
506
|
for item in delta.get("tool_calls") or []:
|
|
498
507
|
if not isinstance(item, dict):
|
|
499
508
|
continue
|
|
@@ -514,20 +523,18 @@ class _OpenAIToolCallAssembler:
|
|
|
514
523
|
|
|
515
524
|
def flush(self) -> list[ToolCall]:
|
|
516
525
|
calls: list[ToolCall] = []
|
|
526
|
+
finish_reason = self._finish_reason
|
|
517
527
|
for idx in sorted(self._buf):
|
|
518
528
|
slot = self._buf[idx]
|
|
519
529
|
name = _sanitize_tool_name(slot["name"])
|
|
520
530
|
if not name:
|
|
521
531
|
continue
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
except json.JSONDecodeError:
|
|
526
|
-
arguments = {}
|
|
527
|
-
if not isinstance(arguments, dict):
|
|
528
|
-
arguments = {}
|
|
532
|
+
arguments = parse_tool_call_arguments(
|
|
533
|
+
slot["arguments"], finish_reason=finish_reason
|
|
534
|
+
)
|
|
529
535
|
calls.append(ToolCall(id=slot["id"], name=name, arguments=arguments))
|
|
530
536
|
self._buf.clear()
|
|
537
|
+
self._finish_reason = None
|
|
531
538
|
return calls
|
|
532
539
|
|
|
533
540
|
|
|
@@ -598,7 +605,7 @@ def _encode_message(
|
|
|
598
605
|
"type": "function",
|
|
599
606
|
"function": {
|
|
600
607
|
"name": tc.name,
|
|
601
|
-
"arguments": json.dumps(tc.arguments),
|
|
608
|
+
"arguments": json.dumps(replay_tool_call_arguments(tc.arguments)),
|
|
602
609
|
},
|
|
603
610
|
}
|
|
604
611
|
for tc in message.tool_calls
|
|
@@ -623,16 +630,17 @@ def _encode_message(
|
|
|
623
630
|
return out
|
|
624
631
|
|
|
625
632
|
|
|
626
|
-
def _decode_tool_calls(
|
|
633
|
+
def _decode_tool_calls(
|
|
634
|
+
value: Any, *, finish_reason: str | None = None
|
|
635
|
+
) -> list[ToolCall] | None:
|
|
627
636
|
if not value:
|
|
628
637
|
return None
|
|
629
638
|
out: list[ToolCall] = []
|
|
630
639
|
for item in value:
|
|
631
640
|
function = item.get("function") or {}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
arguments = {}
|
|
641
|
+
arguments = parse_tool_call_arguments(
|
|
642
|
+
function.get("arguments"), finish_reason=finish_reason
|
|
643
|
+
)
|
|
636
644
|
out.append(
|
|
637
645
|
ToolCall(
|
|
638
646
|
id=item.get("id") or "",
|
|
@@ -34,6 +34,7 @@ from .errors import (
|
|
|
34
34
|
from .parts import ImagePart, TextPart
|
|
35
35
|
from .presets import ProviderPreset, preset_for
|
|
36
36
|
from .system_proxy import client_env_kwargs, egress_path
|
|
37
|
+
from .tool_call_args import parse_tool_call_arguments, replay_tool_call_arguments
|
|
37
38
|
|
|
38
39
|
logger = logging.getLogger(__name__)
|
|
39
40
|
|
|
@@ -410,7 +411,7 @@ def _encode_message_items(message: LLMMessage) -> list[dict[str, Any]]:
|
|
|
410
411
|
"type": "function_call",
|
|
411
412
|
"call_id": call.id,
|
|
412
413
|
"name": call.name,
|
|
413
|
-
"arguments": json.dumps(call.arguments),
|
|
414
|
+
"arguments": json.dumps(replay_tool_call_arguments(call.arguments)),
|
|
414
415
|
}
|
|
415
416
|
)
|
|
416
417
|
return items
|
|
@@ -430,9 +431,17 @@ class _ResponsesToolCallAssembler:
|
|
|
430
431
|
|
|
431
432
|
def __init__(self) -> None:
|
|
432
433
|
self._buf: dict[int, dict[str, str]] = {}
|
|
434
|
+
self._finish_reason: str | None = None
|
|
433
435
|
|
|
434
436
|
def observe(self, event: dict[str, Any]) -> None:
|
|
435
437
|
event_type = event.get("type") or ""
|
|
438
|
+
if event_type in ("response.completed", "response.incomplete"):
|
|
439
|
+
response = event.get("response") or {}
|
|
440
|
+
if response.get("status") == "incomplete" or event_type == "response.incomplete":
|
|
441
|
+
details = response.get("incomplete_details") or {}
|
|
442
|
+
if details.get("reason") == "max_output_tokens":
|
|
443
|
+
self._finish_reason = "length"
|
|
444
|
+
return
|
|
436
445
|
if event_type == "response.output_item.added":
|
|
437
446
|
item = event.get("item") or {}
|
|
438
447
|
if item.get("type") != "function_call":
|
|
@@ -459,18 +468,17 @@ class _ResponsesToolCallAssembler:
|
|
|
459
468
|
|
|
460
469
|
def flush(self) -> list[ToolCall]:
|
|
461
470
|
calls: list[ToolCall] = []
|
|
471
|
+
finish_reason = self._finish_reason
|
|
462
472
|
for idx in sorted(self._buf):
|
|
463
473
|
slot = self._buf[idx]
|
|
464
474
|
if not slot["name"]:
|
|
465
475
|
continue
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
arguments = {}
|
|
470
|
-
if not isinstance(arguments, dict):
|
|
471
|
-
arguments = {}
|
|
476
|
+
arguments = parse_tool_call_arguments(
|
|
477
|
+
slot["arguments"], finish_reason=finish_reason
|
|
478
|
+
)
|
|
472
479
|
calls.append(ToolCall(id=slot["id"], name=slot["name"], arguments=arguments))
|
|
473
480
|
self._buf.clear()
|
|
481
|
+
self._finish_reason = None
|
|
474
482
|
return calls
|
|
475
483
|
|
|
476
484
|
|
|
@@ -521,6 +529,11 @@ def _decode_response(payload: dict[str, Any]) -> tuple[LLMMessage, LLMUsage]:
|
|
|
521
529
|
text_parts: list[str] = []
|
|
522
530
|
tool_calls: list[ToolCall] = []
|
|
523
531
|
reasoning_items: list[Any] = []
|
|
532
|
+
finish_reason: str | None = None
|
|
533
|
+
if payload.get("status") == "incomplete":
|
|
534
|
+
details = payload.get("incomplete_details") or {}
|
|
535
|
+
if details.get("reason") == "max_output_tokens":
|
|
536
|
+
finish_reason = "length"
|
|
524
537
|
for item in payload.get("output") or []:
|
|
525
538
|
if not isinstance(item, dict):
|
|
526
539
|
continue
|
|
@@ -530,12 +543,9 @@ def _decode_response(payload: dict[str, Any]) -> tuple[LLMMessage, LLMUsage]:
|
|
|
530
543
|
if isinstance(part, dict) and part.get("type") == "output_text":
|
|
531
544
|
text_parts.append(str(part.get("text") or ""))
|
|
532
545
|
elif item_type == "function_call":
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
arguments = {}
|
|
537
|
-
if not isinstance(arguments, dict):
|
|
538
|
-
arguments = {}
|
|
546
|
+
arguments = parse_tool_call_arguments(
|
|
547
|
+
item.get("arguments"), finish_reason=finish_reason
|
|
548
|
+
)
|
|
539
549
|
tool_calls.append(
|
|
540
550
|
ToolCall(
|
|
541
551
|
id=str(item.get("call_id") or item.get("id") or ""),
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""Parse, validate, and replay potentially truncated or malformed tool-call JSON arguments.
|
|
2
|
+
|
|
3
|
+
When an LLM hits ``max_tokens`` (``finish_reason == "length"``) mid-tool-call,
|
|
4
|
+
OpenAI-compatible and Responses SSE streams end with an incomplete JSON string
|
|
5
|
+
in ``function.arguments``. Coercing that decode failure to ``{}`` destroys all
|
|
6
|
+
truncation evidence: downstream schema validation then reports
|
|
7
|
+
``missing required argument 'path'``, and wire replay echoes ``"{}"`` back to
|
|
8
|
+
the model as its own prior call — causing an infinite 8k-token retry loop.
|
|
9
|
+
|
|
10
|
+
Instead, unparseable or non-object tool arguments are tagged under the reserved
|
|
11
|
+
key ``_steerable_invalid_arguments`` so:
|
|
12
|
+
1. Pre-dispatch validation rejects the call with ``effect='none'`` *before*
|
|
13
|
+
prompting the user for approval or invoking any handler, naming max-token
|
|
14
|
+
truncation explicitly when ``finish_reason == "length"``.
|
|
15
|
+
2. Next-round message encoders serialize a compact, valid JSON marker object
|
|
16
|
+
rather than ``"{}"`` or 30 KB of broken JSON.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import json
|
|
22
|
+
import re
|
|
23
|
+
from typing import Any
|
|
24
|
+
|
|
25
|
+
INVALID_TOOL_ARGUMENTS_KEY = "_steerable_invalid_arguments"
|
|
26
|
+
|
|
27
|
+
_TARGET_FIELD_RE = re.compile(r'"(?:path|file|target)"\s*:\s*"')
|
|
28
|
+
_PREVIEW_LIMIT = 240
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _extract_partial_target_hint(raw: str) -> str | None:
|
|
32
|
+
"""Best-effort extract ``path``/``file``/``target`` from a truncated JSON object."""
|
|
33
|
+
match = _TARGET_FIELD_RE.search(raw)
|
|
34
|
+
if match is None:
|
|
35
|
+
return None
|
|
36
|
+
idx = match.end()
|
|
37
|
+
chars: list[str] = []
|
|
38
|
+
while idx < len(raw) and len(chars) < _PREVIEW_LIMIT:
|
|
39
|
+
ch = raw[idx]
|
|
40
|
+
if ch == '"':
|
|
41
|
+
break
|
|
42
|
+
if ch == "\\":
|
|
43
|
+
if idx + 1 >= len(raw):
|
|
44
|
+
break
|
|
45
|
+
nxt = raw[idx + 1]
|
|
46
|
+
escape_map = {'"': '"', "\\": "\\", "/": "/", "n": "\n", "r": "\r", "t": "\t"}
|
|
47
|
+
chars.append(escape_map.get(nxt, nxt))
|
|
48
|
+
idx += 2
|
|
49
|
+
continue
|
|
50
|
+
chars.append(ch)
|
|
51
|
+
idx += 1
|
|
52
|
+
hint = "".join(chars).strip()
|
|
53
|
+
return hint or None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _looks_truncated_json(raw: str, exc: json.JSONDecodeError, finish_reason: str | None) -> bool:
|
|
57
|
+
if finish_reason in ("length", "max_tokens", "max_output_tokens"):
|
|
58
|
+
return True
|
|
59
|
+
stripped = raw.rstrip()
|
|
60
|
+
if not stripped:
|
|
61
|
+
return False
|
|
62
|
+
# Unterminated string or error at the very tail of a non-trivially sized payload.
|
|
63
|
+
if "Unterminated string" in exc.msg and len(stripped) >= 64:
|
|
64
|
+
return True
|
|
65
|
+
if exc.pos >= max(len(stripped) - 2, 1) and len(stripped) >= 256 and not stripped.endswith("}"):
|
|
66
|
+
return True
|
|
67
|
+
return False
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def parse_tool_call_arguments(
|
|
71
|
+
raw: Any,
|
|
72
|
+
*,
|
|
73
|
+
finish_reason: str | None = None,
|
|
74
|
+
) -> dict[str, Any]:
|
|
75
|
+
"""Decode wire tool-call ``arguments`` into a ``dict``, preserving parse/truncation metadata."""
|
|
76
|
+
if raw is None or raw == "":
|
|
77
|
+
return {}
|
|
78
|
+
if isinstance(raw, dict):
|
|
79
|
+
return raw
|
|
80
|
+
if not isinstance(raw, str):
|
|
81
|
+
return {
|
|
82
|
+
INVALID_TOOL_ARGUMENTS_KEY: {
|
|
83
|
+
"error": f"expected JSON object or string, got {type(raw).__name__}",
|
|
84
|
+
"truncated": finish_reason in ("length", "max_tokens", "max_output_tokens"),
|
|
85
|
+
"rawLength": 0,
|
|
86
|
+
"rawPreview": repr(raw)[:_PREVIEW_LIMIT],
|
|
87
|
+
**({"finishReason": finish_reason} if finish_reason else {}),
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if not raw.strip():
|
|
91
|
+
return {}
|
|
92
|
+
try:
|
|
93
|
+
parsed = json.loads(raw)
|
|
94
|
+
except json.JSONDecodeError as exc:
|
|
95
|
+
truncated = _looks_truncated_json(raw, exc, finish_reason)
|
|
96
|
+
meta: dict[str, Any] = {
|
|
97
|
+
"error": f"{exc.msg} (char {exc.pos})",
|
|
98
|
+
"truncated": truncated,
|
|
99
|
+
"rawLength": len(raw),
|
|
100
|
+
"rawPreview": raw[:_PREVIEW_LIMIT],
|
|
101
|
+
}
|
|
102
|
+
if finish_reason:
|
|
103
|
+
meta["finishReason"] = finish_reason
|
|
104
|
+
target_hint = _extract_partial_target_hint(raw)
|
|
105
|
+
if target_hint:
|
|
106
|
+
meta["targetHint"] = target_hint
|
|
107
|
+
return {INVALID_TOOL_ARGUMENTS_KEY: meta}
|
|
108
|
+
|
|
109
|
+
if isinstance(parsed, dict):
|
|
110
|
+
return parsed
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
INVALID_TOOL_ARGUMENTS_KEY: {
|
|
114
|
+
"error": f"expected JSON object, got {type(parsed).__name__}",
|
|
115
|
+
"truncated": finish_reason in ("length", "max_tokens", "max_output_tokens"),
|
|
116
|
+
"rawLength": len(raw),
|
|
117
|
+
"rawPreview": raw[:_PREVIEW_LIMIT],
|
|
118
|
+
**({"finishReason": finish_reason} if finish_reason else {}),
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def replay_tool_call_arguments(arguments: dict[str, Any] | None) -> dict[str, Any]:
|
|
124
|
+
"""Return valid, compact JSON-object arguments safe to echo in provider message history."""
|
|
125
|
+
if not arguments:
|
|
126
|
+
return {}
|
|
127
|
+
if INVALID_TOOL_ARGUMENTS_KEY not in arguments:
|
|
128
|
+
return arguments
|
|
129
|
+
meta = arguments.get(INVALID_TOOL_ARGUMENTS_KEY)
|
|
130
|
+
if not isinstance(meta, dict):
|
|
131
|
+
return {"_invalidArguments": True}
|
|
132
|
+
replay: dict[str, Any] = {
|
|
133
|
+
"_invalidArguments": True,
|
|
134
|
+
"_truncated": bool(meta.get("truncated")),
|
|
135
|
+
"rawChars": int(meta.get("rawLength") or 0),
|
|
136
|
+
}
|
|
137
|
+
target_hint = meta.get("targetHint")
|
|
138
|
+
if isinstance(target_hint, str) and target_hint:
|
|
139
|
+
replay["targetHint"] = target_hint
|
|
140
|
+
return replay
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def format_invalid_tool_arguments_error(
|
|
144
|
+
tool_name: str,
|
|
145
|
+
arguments: dict[str, Any] | None,
|
|
146
|
+
) -> tuple[str, str] | None:
|
|
147
|
+
"""Return ``(error_code, actionable_message)`` when ``arguments`` carries a parse/truncation marker."""
|
|
148
|
+
if not isinstance(arguments, dict) or INVALID_TOOL_ARGUMENTS_KEY not in arguments:
|
|
149
|
+
return None
|
|
150
|
+
meta = arguments.get(INVALID_TOOL_ARGUMENTS_KEY)
|
|
151
|
+
if not isinstance(meta, dict):
|
|
152
|
+
return (
|
|
153
|
+
"invalid_tool_arguments",
|
|
154
|
+
f"Tool call '{tool_name}' arguments could not be parsed as a JSON object.",
|
|
155
|
+
)
|
|
156
|
+
raw_len = int(meta.get("rawLength") or 0)
|
|
157
|
+
err_detail = str(meta.get("error") or "incomplete JSON")
|
|
158
|
+
finish_reason = str(meta.get("finishReason") or "length")
|
|
159
|
+
target_hint = meta.get("targetHint")
|
|
160
|
+
target_clause = f" (target: {target_hint!r})" if isinstance(target_hint, str) and target_hint else ""
|
|
161
|
+
if meta.get("truncated"):
|
|
162
|
+
return (
|
|
163
|
+
"tool_arguments_truncated",
|
|
164
|
+
f"Tool call '{tool_name}'{target_clause} arguments were cut off mid-JSON because "
|
|
165
|
+
f"this response reached the model output token limit "
|
|
166
|
+
f"(finish_reason={finish_reason!r}, {raw_len} chars; {err_detail}). "
|
|
167
|
+
f"Do NOT retry the same large tool call — split the output into smaller files/edits, "
|
|
168
|
+
f"or write a compact generator script instead of inlining a huge payload in one call.",
|
|
169
|
+
)
|
|
170
|
+
preview = str(meta.get("rawPreview") or "")
|
|
171
|
+
return (
|
|
172
|
+
"invalid_tool_arguments",
|
|
173
|
+
f"Tool call '{tool_name}'{target_clause} arguments were not valid JSON object "
|
|
174
|
+
f"({raw_len} chars; {err_detail}; preview={preview!r}). "
|
|
175
|
+
f"Emit well-formed JSON object arguments; if the payload is large, split it into smaller calls.",
|
|
176
|
+
)
|
|
@@ -195,6 +195,12 @@ _SDK_DEFAULT_BASE_URLS: dict[str, str] = {
|
|
|
195
195
|
"xai": "https://api.x.ai/v1",
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
#: First-party default model ids that lag in models.dev snapshots (DeepSeek's
|
|
199
|
+
#: live ``GET /models`` serves ``deepseek-flash`` as its default model).
|
|
200
|
+
_PROVIDER_PRIMARY_MODELS: dict[str, tuple[str, ...]] = {
|
|
201
|
+
"deepseek": ("deepseek-flash",),
|
|
202
|
+
}
|
|
203
|
+
|
|
198
204
|
|
|
199
205
|
def _wire_kind(provider_id: str, api: str | None, formats: set[str]) -> str:
|
|
200
206
|
mapped = _WIRE_KIND_BY_PROVIDER.get(provider_id)
|
|
@@ -237,13 +243,15 @@ def describe_catalog_providers() -> list[dict[str, Any]]:
|
|
|
237
243
|
if not models:
|
|
238
244
|
continue
|
|
239
245
|
formats = formats_by_provider.get(provider_id, set())
|
|
246
|
+
primary = _PROVIDER_PRIMARY_MODELS.get(provider_id, ())
|
|
247
|
+
ordered_models = [*primary, *(m for m in sorted(models) if m not in primary)]
|
|
240
248
|
described.append(
|
|
241
249
|
{
|
|
242
250
|
"id": provider_id,
|
|
243
251
|
"apiBaseUrl": api or _SDK_DEFAULT_BASE_URLS.get(provider_id),
|
|
244
252
|
"envVars": list(env_vars),
|
|
245
253
|
"wireKind": _wire_kind(provider_id, api, formats),
|
|
246
|
-
"models":
|
|
254
|
+
"models": ordered_models,
|
|
247
255
|
}
|
|
248
256
|
)
|
|
249
257
|
return described
|
|
@@ -29,6 +29,7 @@ from steerable_agent_harness.safety import CommandSafetyConfig, classify_shell_c
|
|
|
29
29
|
from steerable_agent_protocol.generated import ToolCall, ToolResult
|
|
30
30
|
|
|
31
31
|
from .errors import PolicyDeniedError, ToolDispatchError
|
|
32
|
+
from .llm.tool_call_args import format_invalid_tool_arguments_error
|
|
32
33
|
from .tool_presentation import builtin_presentation
|
|
33
34
|
from .tool_schema import derive_schema
|
|
34
35
|
|
|
@@ -265,6 +266,17 @@ class ToolRouter:
|
|
|
265
266
|
needsFollowup=True,
|
|
266
267
|
data={"unknownTool": call.name, "suggestions": suggestions},
|
|
267
268
|
)
|
|
269
|
+
invalid_args = format_invalid_tool_arguments_error(call.name, call.arguments)
|
|
270
|
+
if invalid_args is not None:
|
|
271
|
+
code, message = invalid_args
|
|
272
|
+
return ToolResult(
|
|
273
|
+
success=False,
|
|
274
|
+
error=f"{code}: {message}",
|
|
275
|
+
effect="none",
|
|
276
|
+
retryable=True,
|
|
277
|
+
terminal=False,
|
|
278
|
+
needsFollowup=True,
|
|
279
|
+
)
|
|
268
280
|
if tool.require_consent and not consent_granted:
|
|
269
281
|
raise PolicyDeniedError(
|
|
270
282
|
f"Tool '{tool.name}' requires explicit consent",
|
|
@@ -77,6 +77,7 @@ src/steerable_agent_runtime/llm/openai_responses.py
|
|
|
77
77
|
src/steerable_agent_runtime/llm/parts.py
|
|
78
78
|
src/steerable_agent_runtime/llm/presets.py
|
|
79
79
|
src/steerable_agent_runtime/llm/system_proxy.py
|
|
80
|
+
src/steerable_agent_runtime/llm/tool_call_args.py
|
|
80
81
|
src/steerable_agent_runtime/storage/__init__.py
|
|
81
82
|
src/steerable_agent_runtime/storage/in_memory.py
|
|
82
83
|
src/steerable_agent_runtime/storage/sqlalchemy_store.py
|
|
@@ -1004,3 +1004,52 @@ async def test_subagent_child_reuses_the_parent_approval_session() -> None:
|
|
|
1004
1004
|
assert click.success
|
|
1005
1005
|
assert [item.tool_name for item in inner.requests] == ["browser_navigate"]
|
|
1006
1006
|
assert click.data["_approval"]["cached"] is True
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
def test_json_approval_store_mixed_by_policy_and_nested_values_do_not_crash(tmp_path) -> None:
|
|
1010
|
+
"""Regression: `_by_policy` dict in approvals.json must not raise `unhashable type: 'dict'`."""
|
|
1011
|
+
import json
|
|
1012
|
+
from steerable_agent_runtime.approval_policy import (
|
|
1013
|
+
JsonApprovalPolicyStore,
|
|
1014
|
+
rule_from_amendment,
|
|
1015
|
+
)
|
|
1016
|
+
from steerable_agent_runtime.approval import ApprovalRequest
|
|
1017
|
+
|
|
1018
|
+
store_file = tmp_path / "approvals.json"
|
|
1019
|
+
store_file.write_text(
|
|
1020
|
+
json.dumps(
|
|
1021
|
+
{
|
|
1022
|
+
"local_exec_shell": "allow_always",
|
|
1023
|
+
"corrupt_nested": {"bad": True},
|
|
1024
|
+
"_by_policy": {
|
|
1025
|
+
"deadbeef" * 4: {
|
|
1026
|
+
"browser": "allow_always",
|
|
1027
|
+
"nested_obj": {"ignored": 1},
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
}
|
|
1031
|
+
),
|
|
1032
|
+
encoding="utf-8",
|
|
1033
|
+
)
|
|
1034
|
+
|
|
1035
|
+
legacy = JsonApprovalStore(store_file)
|
|
1036
|
+
assert legacy.load() == {"local_exec_shell": "allow_always"}
|
|
1037
|
+
|
|
1038
|
+
# Updating legacy store preserves `_by_policy` buckets written by digest-aware hosts.
|
|
1039
|
+
legacy.put("glob", "allow_always")
|
|
1040
|
+
scoped = JsonApprovalStore(store_file, policy_digest="deadbeef" * 4)
|
|
1041
|
+
assert scoped.load() == {"browser": "allow_always"}
|
|
1042
|
+
assert legacy.load() == {
|
|
1043
|
+
"local_exec_shell": "allow_always",
|
|
1044
|
+
"glob": "allow_always",
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
policy_file = tmp_path / "approval-policy.json"
|
|
1048
|
+
policy_file.write_text(
|
|
1049
|
+
json.dumps({"version": 1, "rules": [{"tool": "bash", "decision": {"bad": 1}}]}),
|
|
1050
|
+
encoding="utf-8",
|
|
1051
|
+
)
|
|
1052
|
+
assert JsonApprovalPolicyStore(policy_file).load().rules == []
|
|
1053
|
+
req = ApprovalRequest(tool_name="bash", arguments={}, mode="destructive", category="bash")
|
|
1054
|
+
assert rule_from_amendment(req, {"decision": {"bad": 1}}) is None
|
|
1055
|
+
|