smith-agents 0.12.7 → 0.13.1

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +126 -0
  3. data/README.md +6 -2
  4. data/docs/AGENTS.md +9 -5
  5. data/docs/ERRORS_AND_RETRIES.md +20 -4
  6. data/docs/PATTERNS.md +5 -3
  7. data/docs/PERSISTENCE.md +14 -1
  8. data/docs/TOOLS_AND_GUARDRAILS.md +86 -6
  9. data/lib/smith/agent/attempt_captures.rb +62 -0
  10. data/lib/smith/agent/lifecycle.rb +7 -3
  11. data/lib/smith/agent/output_integrity.rb +7 -6
  12. data/lib/smith/agent/output_recovery.rb +6 -4
  13. data/lib/smith/agent/provider_attempt.rb +3 -0
  14. data/lib/smith/agent/provider_completion.rb +18 -16
  15. data/lib/smith/agent/provider_failure_handling.rb +5 -3
  16. data/lib/smith/agent/provider_streaming.rb +3 -1
  17. data/lib/smith/errors.rb +6 -3
  18. data/lib/smith/response_memo.rb +2 -1
  19. data/lib/smith/tool/budget_enforcement.rb +1 -1
  20. data/lib/smith/tool/capability_builder.rb +14 -1
  21. data/lib/smith/tool/capability_declaration.rb +45 -0
  22. data/lib/smith/tool/capture_configuration.rb +5 -2
  23. data/lib/smith/tool/declarations.rb +73 -0
  24. data/lib/smith/tool/execution_tracker.rb +13 -2
  25. data/lib/smith/tool.rb +8 -38
  26. data/lib/smith/version.rb +1 -1
  27. data/lib/smith/workflow/budget_pause.rb +8 -1
  28. data/lib/smith/workflow/failure_record_restore.rb +7 -1
  29. data/lib/smith/workflow/failure_record_text.rb +20 -12
  30. data/lib/smith/workflow/guarded_step_execution.rb +8 -8
  31. data/lib/smith/workflow/nested_execution.rb +3 -3
  32. data/lib/smith/workflow/remembered_calls.rb +14 -2
  33. data/lib/smith/workflow/retry_execution.rb +24 -3
  34. data/lib/smith/workflow/retry_wait.rb +2 -0
  35. data/lib/smith/workflow/split_step_persistence/preparation.rb +1 -3
  36. data/lib/smith/workflow/split_step_persistence/unsupported_steps.rb +29 -0
  37. data/lib/smith/workflow/split_step_persistence.rb +2 -0
  38. data/lib/smith/workflow.rb +11 -0
  39. metadata +5 -1
@@ -25,6 +25,7 @@ require_relative "split_step_persistence/state_snapshot"
25
25
  require_relative "split_step_persistence/preparation_claim"
26
26
  require_relative "split_step_persistence/preparation_recovery"
27
27
  require_relative "split_step_persistence/preparation"
28
+ require_relative "split_step_persistence/unsupported_steps"
28
29
  require_relative "split_step_persistence/restart_safe_adapter"
29
30
  require_relative "split_step_persistence/recovery"
30
31
  require_relative "split_step_persistence/recovery_boundary"
@@ -66,6 +67,7 @@ module Smith
66
67
  include PreparationClaim
67
68
  include PreparationRecovery
68
69
  include Preparation
70
+ include UnsupportedSteps
69
71
  include RestartSafeAdapter
70
72
  include Recovery
71
73
  include RecoveryBoundary
@@ -465,6 +465,17 @@ module Smith
465
465
  ->(entry) { @tool_results_mutex.synchronize { @tool_results << entry } }
466
466
  end
467
467
 
468
+ # Takes out what an attempt the step set aside had captured
469
+ # (Agent::AttemptCaptures), by identity, so an equal entry of another
470
+ # attempt or branch stays. `O(N + K)`.
471
+ def drop_tool_results(entries)
472
+ return if entries.empty?
473
+
474
+ dropped = {}.compare_by_identity
475
+ entries.each { dropped[_1] = true }
476
+ @tool_results_mutex.synchronize { @tool_results.reject! { dropped.key?(_1) } }
477
+ end
478
+
468
479
  def initialize_tool_result_state
469
480
  @tool_results = []
470
481
  @tool_results_mutex = Mutex.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smith-agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.7
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Ralak
@@ -161,6 +161,7 @@ files:
161
161
  - lib/generators/smith/install/templates/workflow_state.rb.tt
162
162
  - lib/smith.rb
163
163
  - lib/smith/agent.rb
164
+ - lib/smith/agent/attempt_captures.rb
164
165
  - lib/smith/agent/attempt_chat.rb
165
166
  - lib/smith/agent/chat_construction.rb
166
167
  - lib/smith/agent/completion.rb
@@ -348,11 +349,13 @@ files:
348
349
  - lib/smith/tool/call_budget.rb
349
350
  - lib/smith/tool/call_reservation.rb
350
351
  - lib/smith/tool/capability_builder.rb
352
+ - lib/smith/tool/capability_declaration.rb
351
353
  - lib/smith/tool/capture.rb
352
354
  - lib/smith/tool/capture_configuration.rb
353
355
  - lib/smith/tool/chat_execution_callbacks.rb
354
356
  - lib/smith/tool/chat_execution_context.rb
355
357
  - lib/smith/tool/compatibility.rb
358
+ - lib/smith/tool/declarations.rb
356
359
  - lib/smith/tool/execution_authority.rb
357
360
  - lib/smith/tool/execution_authorization.rb
358
361
  - lib/smith/tool/execution_batch.rb
@@ -589,6 +592,7 @@ files:
589
592
  - lib/smith/workflow/split_step_persistence/transition_contract_freezer.rb
590
593
  - lib/smith/workflow/split_step_persistence/transition_contract_signature.rb
591
594
  - lib/smith/workflow/split_step_persistence/transition_contract_structured_values.rb
595
+ - lib/smith/workflow/split_step_persistence/unsupported_steps.rb
592
596
  - lib/smith/workflow/step_completion.rb
593
597
  - lib/smith/workflow/step_context.rb
594
598
  - lib/smith/workflow/step_io.rb