phronomy 0.12.0 → 0.14.0

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +115 -0
  3. data/README.md +54 -5
  4. data/docs/mcp-client.md +75 -0
  5. data/gemfiles/mcp_1_0.gemfile +9 -0
  6. data/lib/phronomy/agent/base.rb +17 -17
  7. data/lib/phronomy/agent/context/capability/base.rb +9 -2
  8. data/lib/phronomy/agent/invocation_session.rb +11 -5
  9. data/lib/phronomy/agent/phase_machine_builder.rb +5 -4
  10. data/lib/phronomy/agent/tool_executor.rb +9 -2
  11. data/lib/phronomy/configuration.rb +15 -46
  12. data/lib/phronomy/diagnostics.rb +1 -1
  13. data/lib/phronomy/engine/concurrency/blocking_adapter_pool.rb +230 -118
  14. data/lib/phronomy/engine/concurrency/cancellation_token.rb +5 -1
  15. data/lib/phronomy/engine/concurrency/pool_registry.rb +8 -3
  16. data/lib/phronomy/engine/event_loop.rb +319 -272
  17. data/lib/phronomy/engine/fsm_session.rb +17 -14
  18. data/lib/phronomy/engine/runtime/deterministic_scheduler.rb +1 -1
  19. data/lib/phronomy/engine/runtime/shutdown_result.rb +62 -0
  20. data/lib/phronomy/engine/runtime/task_registry.rb +62 -15
  21. data/lib/phronomy/engine/runtime.rb +247 -57
  22. data/lib/phronomy/metrics.rb +4 -3
  23. data/lib/phronomy/testing/scheduler_helpers.rb +12 -3
  24. data/lib/phronomy/tools/mcp.rb +361 -321
  25. data/lib/phronomy/version.rb +1 -1
  26. data/lib/phronomy/workflow/phase_machine_builder.rb +13 -9
  27. data/lib/phronomy/workflow_context.rb +1 -2
  28. data/lib/phronomy/workflow_runner.rb +22 -12
  29. data/lib/phronomy.rb +24 -19
  30. metadata +59 -4
  31. data/lib/phronomy/engine/concurrency/concurrency_gate.rb +0 -157
  32. data/lib/phronomy/engine/concurrency/gate_registry.rb +0 -51
@@ -46,12 +46,21 @@ module Phronomy
46
46
  scheduler = Phronomy::Runtime::FakeScheduler.new
47
47
  scheduler.clock = clock if clock
48
48
  runtime = Phronomy::Runtime.new(scheduler: scheduler)
49
- original = Phronomy::Runtime.instance
50
- Phronomy::Runtime.instance = runtime
49
+ original = Phronomy::Runtime.default_if_initialized_for_test
50
+ Phronomy::Runtime.replace_default_for_test(runtime)
51
51
  begin
52
52
  yield scheduler, clock
53
53
  ensure
54
- Phronomy::Runtime.instance = original
54
+ result = nil
55
+ begin
56
+ result = runtime.shutdown
57
+ ensure
58
+ Phronomy::Runtime.restore_default_for_test(original)
59
+ end
60
+ unless result&.cleanup_complete?
61
+ raise Phronomy::RuntimeShutdownError,
62
+ "Temporary test Runtime did not shut down completely"
63
+ end
55
64
  end
56
65
  end
57
66
  end