steerable-agent-runtime 0.12.7__tar.gz → 0.13.0__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.
Files changed (194) hide show
  1. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/PKG-INFO +2 -2
  2. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/pyproject.toml +2 -2
  3. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/__init__.py +18 -0
  4. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/approval.py +391 -20
  5. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/approval_policy.py +4 -0
  6. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/loop.py +23 -0
  7. steerable_agent_runtime-0.13.0/src/steerable_agent_runtime/sidecall.py +418 -0
  8. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/tools.py +27 -0
  9. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime.egg-info/PKG-INFO +2 -2
  10. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime.egg-info/SOURCES.txt +3 -0
  11. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime.egg-info/requires.txt +1 -1
  12. steerable_agent_runtime-0.13.0/tests/test_phase9_outward_unknown.py +285 -0
  13. steerable_agent_runtime-0.13.0/tests/test_phase9_sidecall.py +144 -0
  14. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/README.md +0 -0
  15. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/setup.cfg +0 -0
  16. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/antihallucination.py +0 -0
  17. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/ask_user.py +0 -0
  18. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/branch.py +0 -0
  19. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/cache_control.py +0 -0
  20. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/calibration.py +0 -0
  21. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/child_notice.py +0 -0
  22. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/child_record.py +0 -0
  23. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/compaction.py +0 -0
  24. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/compaction_policy.py +0 -0
  25. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/config.py +0 -0
  26. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/default.harness.json +0 -0
  27. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/default.harness.yaml +0 -0
  28. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/delegation_gate.py +0 -0
  29. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/engines.py +0 -0
  30. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/errors.py +0 -0
  31. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/gateway_catalog.py +0 -0
  32. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/handoff.py +0 -0
  33. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/harness.py +0 -0
  34. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/harness_spec.py +0 -0
  35. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/history.py +0 -0
  36. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/hooks.py +0 -0
  37. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/__init__.py +0 -0
  38. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/anthropic_native.py +0 -0
  39. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/compat.py +0 -0
  40. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/errors.py +0 -0
  41. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/google_genai.py +0 -0
  42. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/openai_compat.py +0 -0
  43. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/openai_responses.py +0 -0
  44. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/parts.py +0 -0
  45. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/presets.py +0 -0
  46. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/llm/system_proxy.py +0 -0
  47. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/maintenance.py +0 -0
  48. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/mcp.py +0 -0
  49. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/mcp_server.py +0 -0
  50. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/model_catalog.py +0 -0
  51. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/model_info.py +0 -0
  52. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/model_resolve.py +0 -0
  53. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/native_bridge.py +0 -0
  54. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/observation_aging.py +0 -0
  55. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/orchestration.py +0 -0
  56. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/otel.py +0 -0
  57. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/peer.py +0 -0
  58. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/plugins.py +0 -0
  59. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/pool.py +0 -0
  60. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/pricing.py +0 -0
  61. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/pseudo.py +0 -0
  62. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/recording.py +0 -0
  63. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/registry.py +0 -0
  64. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/reminders.py +0 -0
  65. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/replay.py +0 -0
  66. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/resume.py +0 -0
  67. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/retry.py +0 -0
  68. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/sandboxed.py +0 -0
  69. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/skills.py +0 -0
  70. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/spend.py +0 -0
  71. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/spill.py +0 -0
  72. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/storage/__init__.py +0 -0
  73. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/storage/in_memory.py +0 -0
  74. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/storage/sqlalchemy_store.py +0 -0
  75. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/storage/sqlite_store.py +0 -0
  76. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/storage/write_lease.py +0 -0
  77. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/subagent.py +0 -0
  78. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/team_board.py +0 -0
  79. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/todo.py +0 -0
  80. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/tokens.py +0 -0
  81. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/tool_presentation.py +0 -0
  82. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/tool_schema.py +0 -0
  83. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/tool_search.py +0 -0
  84. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/tracing.py +0 -0
  85. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/transport/__init__.py +0 -0
  86. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/transport/fastapi_sse.py +0 -0
  87. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/transport/stdio_jsonrpc.py +0 -0
  88. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/tree.py +0 -0
  89. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime/world_state.py +0 -0
  90. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime.egg-info/dependency_links.txt +0 -0
  91. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/src/steerable_agent_runtime.egg-info/top_level.txt +0 -0
  92. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_antihallucination.py +0 -0
  93. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_approval.py +0 -0
  94. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_approval_policy.py +0 -0
  95. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_ask_user.py +0 -0
  96. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_branch.py +0 -0
  97. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_cache_control.py +0 -0
  98. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_cache_instrumentation.py +0 -0
  99. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_calibration.py +0 -0
  100. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_child_notice.py +0 -0
  101. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_children_schema.py +0 -0
  102. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_children_usage.py +0 -0
  103. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_compaction.py +0 -0
  104. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_compaction_policy.py +0 -0
  105. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_compaction_strategy.py +0 -0
  106. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_config.py +0 -0
  107. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_content_parts.py +0 -0
  108. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_cross_model_fork.py +0 -0
  109. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_delegation_fork.py +0 -0
  110. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_delegation_gate.py +0 -0
  111. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_engines.py +0 -0
  112. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_error_taxonomy.py +0 -0
  113. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_fanout.py +0 -0
  114. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_fork_prefix.py +0 -0
  115. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_fork_spawn.py +0 -0
  116. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_fragment_bounds.py +0 -0
  117. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_gateway_catalog.py +0 -0
  118. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_golden.py +0 -0
  119. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_handoff.py +0 -0
  120. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_harness.py +0 -0
  121. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_harness_spec.py +0 -0
  122. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_history.py +0 -0
  123. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_history_persistence.py +0 -0
  124. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_hooks.py +0 -0
  125. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_in_memory_storage.py +0 -0
  126. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_llm_gemini_wire.py +0 -0
  127. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_llm_responses_wire.py +0 -0
  128. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_llm_stream_e2e.py +0 -0
  129. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_llm_wire_helpers.py +0 -0
  130. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_long_session.py +0 -0
  131. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_loop.py +0 -0
  132. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_loop_cancellation.py +0 -0
  133. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_loop_replay.py +0 -0
  134. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_loop_sandbox_event.py +0 -0
  135. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_loop_terminal.py +0 -0
  136. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_maintenance.py +0 -0
  137. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_mcp.py +0 -0
  138. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_mcp_server.py +0 -0
  139. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_model_catalog.py +0 -0
  140. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_model_equivalence.py +0 -0
  141. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_model_info.py +0 -0
  142. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_model_resolve.py +0 -0
  143. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_native_default.py +0 -0
  144. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_observation_aging.py +0 -0
  145. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_orchestration.py +0 -0
  146. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_otel.py +0 -0
  147. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_parallel_tools.py +0 -0
  148. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_plugins.py +0 -0
  149. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_pool_acp.py +0 -0
  150. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_pool_registry.py +0 -0
  151. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_provider_compat.py +0 -0
  152. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_provider_presets.py +0 -0
  153. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_pseudo.py +0 -0
  154. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_pyo3_api_surface.py +0 -0
  155. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_recording.py +0 -0
  156. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_registry.py +0 -0
  157. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_reminders.py +0 -0
  158. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_replay_crosslang.py +0 -0
  159. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_resume.py +0 -0
  160. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_resume_child.py +0 -0
  161. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_resume_failed_turn.py +0 -0
  162. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_retry_hooks.py +0 -0
  163. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_safety_gate.py +0 -0
  164. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_sandboxed.py +0 -0
  165. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_skills.py +0 -0
  166. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_soft_timeout.py +0 -0
  167. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_spill.py +0 -0
  168. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_sqlite_storage.py +0 -0
  169. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_steer.py +0 -0
  170. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_storage_contract.py +0 -0
  171. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_stream_strip.py +0 -0
  172. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_subagent.py +0 -0
  173. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_system_proxy.py +0 -0
  174. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_team_board.py +0 -0
  175. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_team_collab.py +0 -0
  176. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_todo.py +0 -0
  177. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_todo_gate.py +0 -0
  178. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tokens.py +0 -0
  179. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tool_exposure.py +0 -0
  180. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tool_hygiene.py +0 -0
  181. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tool_presentation.py +0 -0
  182. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tool_router.py +0 -0
  183. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tool_schema.py +0 -0
  184. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tool_timeout.py +0 -0
  185. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_trace_recorder.py +0 -0
  186. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_transport_error_detail.py +0 -0
  187. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_transport_jsonrpc.py +0 -0
  188. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_transport_sse.py +0 -0
  189. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tree.py +0 -0
  190. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tree_spend.py +0 -0
  191. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_tree_spend_pool.py +0 -0
  192. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_usage_attribution.py +0 -0
  193. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_world_state.py +0 -0
  194. {steerable_agent_runtime-0.12.7 → steerable_agent_runtime-0.13.0}/tests/test_write_lease.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: steerable-agent-runtime
3
- Version: 0.12.7
3
+ Version: 0.13.0
4
4
  Summary: Steerable agent runtime: LLM, tool, storage, and transport adapters.
5
5
  License: Apache-2.0
6
6
  Requires-Python: >=3.10
@@ -10,7 +10,7 @@ Requires-Dist: mcp<2.0.0,>=1.13.0
10
10
  Requires-Dist: pydantic>=2.10.0
11
11
  Requires-Dist: steerable-agent-protocol<1.0.0,>=0.1.0
12
12
  Requires-Dist: steerable-agent-harness<1.0.0,>=0.1.0
13
- Requires-Dist: steerable-agent-runtime-native==1.0.10
13
+ Requires-Dist: steerable-agent-runtime-native==1.0.11
14
14
  Provides-Extra: sqlalchemy
15
15
  Requires-Dist: sqlalchemy>=2.0; extra == "sqlalchemy"
16
16
  Provides-Extra: fastapi
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "steerable-agent-runtime"
3
- version = "0.12.7"
3
+ version = "0.13.0"
4
4
  description = "Steerable agent runtime: LLM, tool, storage, and transport adapters."
5
5
  license = { text = "Apache-2.0" }
6
6
  readme = "README.md"
@@ -21,7 +21,7 @@ dependencies = [
21
21
  "pydantic>=2.10.0",
22
22
  "steerable-agent-protocol>=0.1.0,<1.0.0",
23
23
  "steerable-agent-harness>=0.1.0,<1.0.0",
24
- "steerable-agent-runtime-native==1.0.10",
24
+ "steerable-agent-runtime-native==1.0.11",
25
25
  ]
26
26
 
27
27
  [project.optional-dependencies]
@@ -19,6 +19,20 @@ from .antihallucination import (
19
19
  parse_turn_route,
20
20
  should_run_grounding_judge,
21
21
  )
22
+ from .sidecall import (
23
+ DEFAULT_HEAD_CHARS,
24
+ DEFAULT_TAIL_CHARS,
25
+ FAST_DECISION_TIMEOUT_S,
26
+ PROMISED_ACTION_NUDGE_MESSAGE,
27
+ SUMMARY_DECISION_TIMEOUT_S,
28
+ PromisedActionContinuationHooks,
29
+ SideCallOutcome,
30
+ SideCallPort,
31
+ SideCallSecretRedactor,
32
+ SideCallSpec,
33
+ SideCallUsage,
34
+ slice_head_tail,
35
+ )
22
36
  from .approval import (
23
37
  ApprovalDecision,
24
38
  ApprovalExecutor,
@@ -28,7 +42,9 @@ from .approval import (
28
42
  AutoApprover,
29
43
  InMemoryApprovalStore,
30
44
  JsonApprovalStore,
45
+ RejectedBeforeEffectError,
31
46
  SessionApprovalCache,
47
+ compute_policy_digest,
32
48
  )
33
49
  from .approval_policy import (
34
50
  ApprovalPolicy,
@@ -431,6 +447,8 @@ __all__ = [
431
447
  "InMemorySpillStore",
432
448
  "JsonApprovalPolicyStore",
433
449
  "JsonApprovalStore",
450
+ "RejectedBeforeEffectError",
451
+ "compute_policy_digest",
434
452
  "JsonlRequestSink",
435
453
  "LLMMessage",
436
454
  "LLMProvider",
@@ -25,11 +25,13 @@ from __future__ import annotations
25
25
 
26
26
  import asyncio
27
27
  import contextvars
28
+ import hashlib
28
29
  import json
29
30
  import logging
30
31
  import os
31
32
  import tempfile
32
33
  import time
34
+ import uuid
33
35
  from dataclasses import dataclass
34
36
  from pathlib import Path
35
37
  from typing import TYPE_CHECKING, Any, Literal, Protocol, cast, runtime_checkable
@@ -37,7 +39,7 @@ from typing import TYPE_CHECKING, Any, Literal, Protocol, cast, runtime_checkabl
37
39
  from steerable_agent_harness.policy import ToolMode, decide_tool_mode
38
40
  from steerable_agent_protocol.generated import ToolCall, ToolResult
39
41
 
40
- from .errors import ApprovalAborted
42
+ from .errors import ApprovalAborted, PolicyDeniedError
41
43
  from .sandboxed import DEFAULT_SHELL_TOOLS
42
44
 
43
45
  if TYPE_CHECKING:
@@ -54,13 +56,87 @@ __all__ = [
54
56
  "ApprovalStore",
55
57
  "Approver",
56
58
  "AutoApprover",
59
+ "CheckpointKind",
60
+ "RejectedBeforeEffectError",
57
61
  "WorkspaceAutoApprover",
62
+ "compute_policy_digest",
58
63
  "declared_resolver",
59
64
  "InMemoryApprovalStore",
60
65
  "JsonApprovalStore",
61
66
  "SessionApprovalCache",
62
67
  ]
63
68
 
69
+ CheckpointKind = Literal["standard", "outward"]
70
+
71
+ _REJECTED_BEFORE_EFFECT_SEAL = object()
72
+
73
+
74
+ class RejectedBeforeEffectError(Exception):
75
+ """Framework-sealed pre-dispatch rejection that settles as ``effect='none'``.
76
+
77
+ Tool/plugin handlers cannot construct this directly without the private
78
+ module token; any exception raised inside a handler for ``idempotent=False``
79
+ settles as ``outcome_unknown``.
80
+ """
81
+
82
+ def __init__(
83
+ self,
84
+ code: str,
85
+ message: str,
86
+ *,
87
+ retryable: bool = True,
88
+ _seal: object = None,
89
+ ) -> None:
90
+ if _seal is not _REJECTED_BEFORE_EFFECT_SEAL:
91
+ raise TypeError(
92
+ "RejectedBeforeEffectError is sealed to framework pre-dispatch ports"
93
+ )
94
+ super().__init__(message)
95
+ self.code = code
96
+ self.retryable = retryable
97
+ self._seal = _seal
98
+
99
+
100
+ def _reject_before_effect(
101
+ code: str, message: str, *, retryable: bool = True
102
+ ) -> RejectedBeforeEffectError:
103
+ return RejectedBeforeEffectError(
104
+ code, message, retryable=retryable, _seal=_REJECTED_BEFORE_EFFECT_SEAL
105
+ )
106
+
107
+
108
+ def _is_sealed_rejection(exc: BaseException) -> bool:
109
+ return (
110
+ isinstance(exc, RejectedBeforeEffectError)
111
+ and getattr(exc, "_seal", None) is _REJECTED_BEFORE_EFFECT_SEAL
112
+ )
113
+
114
+
115
+ def compute_policy_digest(
116
+ *,
117
+ approval_mode: str = "host",
118
+ sandbox_enforced: bool = False,
119
+ writable_roots: list[str] | tuple[str, ...] = (),
120
+ allowed_hosts: list[str] | tuple[str, ...] = (),
121
+ safety_rules: list[str] | tuple[str, ...] = (),
122
+ **_ignored: Any,
123
+ ) -> str:
124
+ """Compute a 16-byte (32-hex) SHA-256 digest over canonical security policy.
125
+
126
+ Model IDs, API endpoints, and UI theme fields are intentionally ignored so
127
+ non-security changes do not invalidate durable ``allow_always`` grants,
128
+ while any sandbox/root/egress/approval-mode change produces a distinct digest.
129
+ """
130
+ canonical = {
131
+ "allowedHosts": sorted({str(h).strip().lower() for h in allowed_hosts if str(h).strip()}),
132
+ "approvalMode": str(approval_mode or "host"),
133
+ "safetyRules": sorted({str(r).strip() for r in safety_rules if str(r).strip()}),
134
+ "sandboxEnforced": bool(sandbox_enforced),
135
+ "writableRoots": sorted({str(r).strip() for r in writable_roots if str(r).strip()}),
136
+ }
137
+ encoded = json.dumps(canonical, sort_keys=True, separators=(",", ":")).encode("utf-8")
138
+ return hashlib.sha256(encoded).hexdigest()[:32]
139
+
64
140
  #: The 8 decision variants. Codex's ``ApprovedExecpolicyAmendment`` /
65
141
  #: ``ApprovedMcpPolicyAmendment`` / ``NetworkPolicyAmendment`` are codex's
66
142
  #: policy machinery; the framework's durable scope covers their semantics
@@ -119,6 +195,9 @@ class ApprovalRequest:
119
195
  category: str
120
196
  round_index: int = 0
121
197
  call_id: str = ""
198
+ checkpoint: CheckpointKind = "standard"
199
+ idempotent: bool = True
200
+ input_schema: dict[str, Any] | None = None
122
201
 
123
202
 
124
203
  @runtime_checkable
@@ -300,6 +379,8 @@ class WorkspaceAutoApprover:
300
379
  self._sandbox_enforced = enforced
301
380
 
302
381
  async def approve(self, request: ApprovalRequest) -> ApprovalDecision:
382
+ if request.checkpoint == "outward":
383
+ return await self._inner.approve(request)
303
384
  if request.tool_name in self._auto_allow_tools:
304
385
  return ApprovalDecision("allow_once", "trusted host control tool")
305
386
  paths = declared_target_paths(request)
@@ -339,16 +420,22 @@ class AutoApprover:
339
420
  self._deny_reason = deny_reason
340
421
 
341
422
  async def approve(self, request: ApprovalRequest) -> ApprovalDecision:
423
+ if request.checkpoint == "outward":
424
+ return ApprovalDecision(
425
+ "deny_once",
426
+ "outward_confirmation_required: interactive confirmation required for outward checkpoint",
427
+ )
342
428
  if request.mode in self._allow_modes:
343
429
  return ApprovalDecision("allow_once")
344
430
  return ApprovalDecision("deny_once", self._deny_reason)
345
431
 
346
432
 
347
433
  class SessionApprovalCache:
348
- """Session scope: per-category decisions for the cache instance's lifetime."""
434
+ """Session scope: per-category decisions and pending reconciliations."""
349
435
 
350
436
  def __init__(self) -> None:
351
437
  self._decisions: dict[str, ApprovalKind] = {}
438
+ self._pending_reconciliations: dict[str, str] = {}
352
439
 
353
440
  def get(self, category: str) -> ApprovalKind | None:
354
441
  return self._decisions.get(category)
@@ -358,6 +445,23 @@ class SessionApprovalCache:
358
445
  raise ValueError(f"not a session-scope kind: {kind}")
359
446
  self._decisions[category] = kind
360
447
 
448
+ def mark_outcome_unknown(self, tool_name: str, reconciliation_id: str) -> None:
449
+ self._pending_reconciliations[tool_name] = reconciliation_id
450
+
451
+ def get_pending_reconciliation(self, tool_name: str) -> str | None:
452
+ return self._pending_reconciliations.get(tool_name)
453
+
454
+ def clear_reconciliation(self, tool_name: str) -> None:
455
+ self._pending_reconciliations.pop(tool_name, None)
456
+
457
+ def sync_pending_reconciliations(self, pending: dict[str, str]) -> None:
458
+ """Synchronize unresolved ``outcome_unknown`` locks from authoritative host state."""
459
+ self._pending_reconciliations = {
460
+ str(tool_name): str(rec_id)
461
+ for tool_name, rec_id in pending.items()
462
+ if tool_name and rec_id
463
+ }
464
+
361
465
 
362
466
  @runtime_checkable
363
467
  class ApprovalStore(Protocol):
@@ -388,27 +492,53 @@ class InMemoryApprovalStore:
388
492
 
389
493
 
390
494
  class JsonApprovalStore:
391
- """File-backed durable store: one JSON object ``{category: kind}``.
495
+ """File-backed durable store.
392
496
 
393
- Writes are atomic (tmp file + rename) so a crash mid-write cannot leave a
394
- truncated file that would fail every future load.
497
+ Without ``policy_digest``, stores ``{category: kind}``.
498
+ With ``policy_digest``, stores ``{"_by_policy": {policy_digest: {category: kind}}}``
499
+ so changing sandbox/network/policy rules invalidates prior ``allow_always``
500
+ decisions while keeping model/UI changes transparent.
501
+ Writes are atomic (tmp file + rename).
395
502
  """
396
503
 
397
- def __init__(self, path: str | Path) -> None:
504
+ def __init__(self, path: str | Path, *, policy_digest: str | None = None) -> None:
398
505
  self._path = Path(path)
506
+ self._policy_digest = (
507
+ policy_digest.strip()
508
+ if isinstance(policy_digest, str) and policy_digest.strip()
509
+ else None
510
+ )
399
511
 
400
- def load(self) -> dict[str, ApprovalKind]:
512
+ def _read_raw_dict(self) -> dict[str, Any]:
401
513
  try:
402
514
  raw = json.loads(self._path.read_text(encoding="utf-8"))
403
515
  except FileNotFoundError:
404
516
  return {}
405
517
  except (OSError, json.JSONDecodeError) as exc:
406
- # A corrupt store must fail closed, not crash the run: treating it
407
- # as empty re-asks the approver instead of auto-allowing.
408
518
  logger.warning("approval store %s unreadable (%s); ignoring", self._path, exc)
409
519
  return {}
520
+ return raw if isinstance(raw, dict) else {}
521
+
522
+ def load(self) -> dict[str, ApprovalKind]:
523
+ raw = self._read_raw_dict()
524
+ if not raw:
525
+ return {}
526
+ if self._policy_digest is not None:
527
+ by_policy = raw.get("_by_policy")
528
+ bucket = (
529
+ by_policy.get(self._policy_digest)
530
+ if isinstance(by_policy, dict)
531
+ else None
532
+ )
533
+ if not isinstance(bucket, dict):
534
+ return {}
535
+ return {
536
+ str(category): cast(ApprovalKind, kind)
537
+ for category, kind in bucket.items()
538
+ if kind in _DURABLE_KINDS
539
+ }
410
540
  return {
411
- str(category): kind
541
+ str(category): cast(ApprovalKind, kind)
412
542
  for category, kind in raw.items()
413
543
  if kind in _DURABLE_KINDS
414
544
  }
@@ -416,13 +546,27 @@ class JsonApprovalStore:
416
546
  def put(self, category: str, kind: ApprovalKind) -> None:
417
547
  if kind not in _DURABLE_KINDS:
418
548
  raise ValueError(f"not a durable-scope kind: {kind}")
419
- decisions = self.load()
420
- decisions[category] = kind
549
+ if self._policy_digest is not None:
550
+ full = self._read_raw_dict()
551
+ by_policy = full.get("_by_policy")
552
+ if not isinstance(by_policy, dict):
553
+ by_policy = {}
554
+ full["_by_policy"] = by_policy
555
+ bucket = by_policy.get(self._policy_digest)
556
+ if not isinstance(bucket, dict):
557
+ bucket = {}
558
+ by_policy[self._policy_digest] = bucket
559
+ bucket[category] = kind
560
+ payload_to_write: dict[str, Any] = full
561
+ else:
562
+ decisions = self.load()
563
+ decisions[category] = kind
564
+ payload_to_write = dict(decisions)
421
565
  self._path.parent.mkdir(parents=True, exist_ok=True)
422
566
  fd, tmp = tempfile.mkstemp(dir=self._path.parent, suffix=".tmp")
423
567
  try:
424
568
  with os.fdopen(fd, "w", encoding="utf-8") as handle:
425
- json.dump(decisions, handle, ensure_ascii=False, indent=1)
569
+ json.dump(payload_to_write, handle, ensure_ascii=False, indent=1)
426
570
  os.replace(tmp, self._path)
427
571
  except BaseException:
428
572
  os.unlink(tmp)
@@ -491,24 +635,49 @@ def declared_resolver(
491
635
  name as the category. Old hosts that omit the fields keep the previous
492
636
  behavior.
493
637
  """
494
- declared: dict[str, tuple[Any, Any]] = {}
638
+ declared: dict[str, tuple[Any, Any, Any, Any, Any]] = {}
495
639
  for tool in tools or []:
496
640
  if not isinstance(tool, dict):
641
+ reg_name = getattr(tool, "name", None)
642
+ if isinstance(reg_name, str) and reg_name:
643
+ reg_schema = getattr(tool, "schema", None)
644
+ reg_meta = getattr(tool, "metadata", None)
645
+ reg_cat = reg_meta.get("approvalCategory") if isinstance(reg_meta, dict) else None
646
+ declared[reg_name] = (
647
+ getattr(tool, "mode", None),
648
+ reg_cat,
649
+ getattr(tool, "checkpoint", None),
650
+ getattr(tool, "idempotent", None),
651
+ reg_schema if isinstance(reg_schema, dict) else None,
652
+ )
497
653
  continue
498
654
  name = _tool_declared_name(tool)
499
655
  if name is None:
500
656
  continue
657
+ schema = (
658
+ _tool_declared_field(tool, "inputSchema")
659
+ or _tool_declared_field(tool, "parameters")
660
+ )
501
661
  declared[name] = (
502
662
  _tool_declared_field(tool, "mode"),
503
663
  _tool_declared_field(tool, "approvalCategory"),
664
+ _tool_declared_field(tool, "checkpoint"),
665
+ _tool_declared_field(tool, "idempotent"),
666
+ schema if isinstance(schema, dict) else None,
504
667
  )
505
668
 
506
669
  def resolve(call: ToolCall, ctx: LoopContext) -> ApprovalRequest:
507
- mode, category = declared.get(call.name, (None, None))
670
+ mode, category, checkpoint, idempotent, schema = declared.get(
671
+ call.name, (None, None, None, None, None)
672
+ )
508
673
  resolved_mode = (
509
674
  mode if isinstance(mode, str) and mode in TOOL_MODES else decide_tool_mode(call.name)
510
675
  )
511
676
  resolved_category = category if isinstance(category, str) and category else call.name
677
+ resolved_checkpoint: CheckpointKind = (
678
+ "outward" if checkpoint == "outward" else "standard"
679
+ )
680
+ resolved_idempotent = False if idempotent is False else True
512
681
  return ApprovalRequest(
513
682
  tool_name=call.name,
514
683
  arguments=call.arguments or {},
@@ -516,11 +685,54 @@ def declared_resolver(
516
685
  category=resolved_category,
517
686
  round_index=ctx.round_index,
518
687
  call_id=call.id,
688
+ checkpoint=resolved_checkpoint,
689
+ idempotent=resolved_idempotent,
690
+ input_schema=schema,
519
691
  )
520
692
 
521
693
  return resolve
522
694
 
523
695
 
696
+ def _validate_tool_schema(request: ApprovalRequest) -> RejectedBeforeEffectError | None:
697
+ schema = request.input_schema
698
+ if not isinstance(schema, dict):
699
+ return None
700
+ args = request.arguments
701
+ required = schema.get("required")
702
+ if isinstance(required, list):
703
+ for key in required:
704
+ if isinstance(key, str) and args.get(key) is None:
705
+ return _reject_before_effect(
706
+ "schema_validation_failed",
707
+ f"missing required argument '{key}' for tool '{request.tool_name}'",
708
+ retryable=True,
709
+ )
710
+ props = schema.get("properties")
711
+ if isinstance(props, dict):
712
+ for key, spec in props.items():
713
+ if key not in args or not isinstance(spec, dict):
714
+ continue
715
+ expected = spec.get("type")
716
+ if not isinstance(expected, str):
717
+ continue
718
+ val = args[key]
719
+ ok = (
720
+ (expected == "string" and isinstance(val, str))
721
+ or (expected == "boolean" and isinstance(val, bool))
722
+ or (expected == "integer" and isinstance(val, int) and not isinstance(val, bool))
723
+ or (expected == "number" and isinstance(val, (int, float)) and not isinstance(val, bool))
724
+ or (expected == "array" and isinstance(val, list))
725
+ or (expected == "object" and isinstance(val, dict))
726
+ )
727
+ if not ok:
728
+ return _reject_before_effect(
729
+ "schema_validation_failed",
730
+ f"argument '{key}' for tool '{request.tool_name}' expected {expected}",
731
+ retryable=True,
732
+ )
733
+ return None
734
+
735
+
524
736
  class ToolTimeoutClock:
525
737
  """Pauses the loop's tool cap while an approval prompt is unanswered.
526
738
 
@@ -534,6 +746,8 @@ class ToolTimeoutClock:
534
746
  self.resumed = asyncio.Event()
535
747
  self.resumed.set()
536
748
  self.paused = asyncio.Event()
749
+ self.timed_out = False
750
+ self.outcome_unknown_reconciliation_id: str | None = None
537
751
 
538
752
  def suspend(self) -> None:
539
753
  self._depth += 1
@@ -586,17 +800,94 @@ class ApprovalExecutor:
586
800
  self._approver = approver
587
801
  self._session = session
588
802
  self._store = store
589
- self._resolve = resolve or _default_resolver
803
+ self._resolve = resolve or self._build_router_aware_resolver(inner)
590
804
  self._timeout_s = timeout_s
591
805
  self._durable: dict[str, ApprovalKind] | None = None
806
+ self._pending_reconciliations: dict[str, str] = {}
807
+
808
+ @staticmethod
809
+ def _build_router_aware_resolver(inner: ToolExecutor) -> Any:
810
+ router = getattr(inner, "_router", None)
811
+ if router is None or not hasattr(router, "get"):
812
+ return _default_resolver
813
+
814
+ def _resolve_from_router(call: ToolCall, ctx: LoopContext) -> ApprovalRequest:
815
+ reg = router.get(call.name)
816
+ if reg is None:
817
+ return _default_resolver(call, ctx)
818
+ meta = getattr(reg, "metadata", None)
819
+ cat = meta.get("approvalCategory") if isinstance(meta, dict) else None
820
+ schema = getattr(reg, "schema", None)
821
+ return ApprovalRequest(
822
+ tool_name=call.name,
823
+ arguments=call.arguments or {},
824
+ mode=getattr(reg, "mode", None) or decide_tool_mode(call.name),
825
+ category=cat if isinstance(cat, str) and cat else call.name,
826
+ round_index=ctx.round_index,
827
+ call_id=call.id,
828
+ checkpoint="outward" if getattr(reg, "checkpoint", None) == "outward" else "standard",
829
+ idempotent=False if getattr(reg, "idempotent", True) is False else True,
830
+ input_schema=schema if isinstance(schema, dict) else None,
831
+ )
832
+
833
+ return _resolve_from_router
592
834
 
593
835
  def concurrency_safe(self, call: ToolCall) -> bool:
594
836
  check = getattr(self._inner, "concurrency_safe", None)
595
837
  return bool(check is not None and check(call))
596
838
 
839
+ def _get_pending_reconciliation(self, tool_name: str) -> str | None:
840
+ if self._session is not None:
841
+ return self._session.get_pending_reconciliation(tool_name)
842
+ return self._pending_reconciliations.get(tool_name)
843
+
844
+ def _mark_outcome_unknown(self, tool_name: str, reconciliation_id: str) -> None:
845
+ if self._session is not None:
846
+ self._session.mark_outcome_unknown(tool_name, reconciliation_id)
847
+ self._pending_reconciliations[tool_name] = reconciliation_id
848
+
849
+ def clear_reconciliation(self, tool_name: str) -> None:
850
+ """Release a pending ``outcome_unknown`` lock after human reconciliation."""
851
+ if self._session is not None:
852
+ self._session.clear_reconciliation(tool_name)
853
+ self._pending_reconciliations.pop(tool_name, None)
854
+
597
855
  async def execute(self, call: ToolCall, ctx: LoopContext) -> ToolResult:
598
856
  request = self._resolve(call, ctx)
599
- stored = self._stored_decision(request)
857
+ pending_rec = self._get_pending_reconciliation(request.tool_name)
858
+ if pending_rec is not None:
859
+ return ToolResult(
860
+ success=False,
861
+ error="reconciliation_required",
862
+ effect="none",
863
+ retryable=False,
864
+ reconciliationId=pending_rec,
865
+ needsFollowup=False,
866
+ data={
867
+ "reconciliationId": pending_rec,
868
+ "message": (
869
+ f"reconciliation_required: previous call to '{request.tool_name}' "
870
+ f"ended with outcome_unknown ({pending_rec})"
871
+ ),
872
+ },
873
+ )
874
+
875
+ schema_err = _validate_tool_schema(request)
876
+ if schema_err is not None:
877
+ return ToolResult(
878
+ success=False,
879
+ error=schema_err.code,
880
+ effect="none",
881
+ retryable=schema_err.retryable,
882
+ needsFollowup=schema_err.retryable,
883
+ data={"message": str(schema_err)},
884
+ )
885
+
886
+ stored = (
887
+ None
888
+ if request.checkpoint == "outward"
889
+ else self._stored_decision(request)
890
+ )
600
891
  decision = stored
601
892
  # A fresh decision records the wait so the trace can show approval
602
893
  # latency. A session allow reused from the cache carries `cached`
@@ -606,7 +897,13 @@ class ApprovalExecutor:
606
897
  ask_started = time.monotonic()
607
898
  decision = await self._ask(request)
608
899
  waited_ms = int((time.monotonic() - ask_started) * 1000)
609
- self._persist(request, decision)
900
+ if request.checkpoint == "outward":
901
+ if decision.kind in _ALLOW_KINDS and decision.kind != "allow_once":
902
+ decision = ApprovalDecision("allow_once", decision.reason)
903
+ elif decision.kind in (_SESSION_KINDS | _DURABLE_KINDS):
904
+ decision = ApprovalDecision("deny_once", decision.reason)
905
+ else:
906
+ self._persist(request, decision)
610
907
 
611
908
  if stored is not None and stored.kind == "allow_for_session":
612
909
  approval_marker = {
@@ -634,9 +931,15 @@ class ApprovalExecutor:
634
931
  )
635
932
  if not decision.allowed:
636
933
  reason = decision.reason or "denied by approval policy"
934
+ is_outward_req = (
935
+ request.checkpoint == "outward"
936
+ and "outward_confirmation_required" in reason
937
+ )
637
938
  return ToolResult(
638
939
  success=False,
639
- error="approval_denied",
940
+ error="outward_confirmation_required" if is_outward_req else "approval_denied",
941
+ effect="none",
942
+ retryable=is_outward_req,
640
943
  needsFollowup=True,
641
944
  data={
642
945
  "approval": decision.kind,
@@ -650,7 +953,75 @@ class ApprovalExecutor:
650
953
  },
651
954
  )
652
955
  ctx.consent_granted = True
653
- result = await self._inner.execute(call, ctx)
956
+ try:
957
+ result = await self._inner.execute(call, ctx)
958
+ except asyncio.CancelledError:
959
+ clock = tool_timeout_clock.get()
960
+ if clock is not None and clock.timed_out and not request.idempotent:
961
+ rec_id = f"rec_{uuid.uuid4().hex[:12]}"
962
+ self._mark_outcome_unknown(request.tool_name, rec_id)
963
+ clock.outcome_unknown_reconciliation_id = rec_id
964
+ raise
965
+ except PolicyDeniedError as exc:
966
+ return ToolResult(
967
+ success=False,
968
+ error=str(exc),
969
+ effect="none",
970
+ retryable=False,
971
+ needsFollowup=True,
972
+ data={"message": str(exc)},
973
+ )
974
+ except Exception as exc: # noqa: BLE001 — classify sealed pre-dispatch vs unknown outcome
975
+ if _is_sealed_rejection(exc):
976
+ sealed = cast(RejectedBeforeEffectError, exc)
977
+ return ToolResult(
978
+ success=False,
979
+ error=sealed.code,
980
+ effect="none",
981
+ retryable=sealed.retryable,
982
+ needsFollowup=sealed.retryable,
983
+ data={"message": str(sealed)},
984
+ )
985
+ if not request.idempotent:
986
+ rec_id = f"rec_{uuid.uuid4().hex[:12]}"
987
+ self._mark_outcome_unknown(request.tool_name, rec_id)
988
+ return ToolResult(
989
+ success=False,
990
+ error=f"outcome_unknown: {exc}",
991
+ effect="unknown",
992
+ outcomeUnknown=True,
993
+ retryable=False,
994
+ reconciliationId=rec_id,
995
+ needsFollowup=True,
996
+ data={"reconciliationId": rec_id, "message": str(exc)},
997
+ )
998
+ raise
999
+
1000
+ if result.outcomeUnknown:
1001
+ rec_id = result.reconciliationId or f"rec_{uuid.uuid4().hex[:12]}"
1002
+ self._mark_outcome_unknown(request.tool_name, rec_id)
1003
+ result = result.model_copy(
1004
+ update={
1005
+ "effect": "unknown",
1006
+ "outcomeUnknown": True,
1007
+ "retryable": False,
1008
+ "reconciliationId": rec_id,
1009
+ }
1010
+ )
1011
+ elif not result.success and not request.idempotent and result.effect != "none":
1012
+ rec_id = result.reconciliationId or f"rec_{uuid.uuid4().hex[:12]}"
1013
+ self._mark_outcome_unknown(request.tool_name, rec_id)
1014
+ result = result.model_copy(
1015
+ update={
1016
+ "effect": "unknown",
1017
+ "outcomeUnknown": True,
1018
+ "retryable": False,
1019
+ "reconciliationId": rec_id,
1020
+ }
1021
+ )
1022
+ elif result.success and not request.idempotent and result.effect is None:
1023
+ result = result.model_copy(update={"effect": "committed"})
1024
+
654
1025
  data = result.data if isinstance(result.data, dict) else None
655
1026
  if approval_marker is not None or (data is not None and "_sandbox" in data):
656
1027
  result = result.model_copy(
@@ -201,6 +201,8 @@ class PolicyApprover:
201
201
  self._policy = policy
202
202
 
203
203
  async def approve(self, request: ApprovalRequest) -> ApprovalDecision:
204
+ if request.checkpoint == "outward":
205
+ return await self._inner.approve(request)
204
206
  decision = self._policy.decide(request)
205
207
  if decision is not None:
206
208
  return decision
@@ -221,6 +223,8 @@ def rule_from_amendment(
221
223
  return ``None`` (the decision itself still stands; only the persistence
222
224
  is dropped), never raise into the approval path.
223
225
  """
226
+ if request.checkpoint == "outward":
227
+ return None
224
228
  if not isinstance(amendment, dict):
225
229
  return None
226
230
  decision = amendment.get("decision")