phronomy 0.5.1 → 0.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ca63f10e2d505005a6011a8755135e0dea1c3d8e8013ae3b2ea1d3b5ecf13d3
4
- data.tar.gz: 420ec691725b6450a0430cdce90372c13da4e73d7013a630b2aa33a7b72e496d
3
+ metadata.gz: f2129e4cbe20c3831530f0a8ef810abe272174195cbce5198207fec6bf255eff
4
+ data.tar.gz: f9a0152759518cb2d85126ee5fb7a57b96e00a0ed7b8acffd54c57de91ed0c18
5
5
  SHA512:
6
- metadata.gz: 300b155e482fe0b0015bba5d3985c8d37f2599828d9d87763cc5d9925c3bf399cbee46a658d48a79e152d9b410505609e35a89d3b02db632d51b85280938dc8c
7
- data.tar.gz: 88184d595d04eb1ed1be8c6ec145476a5e1f7e6e02e52658f9d80ad3893a29fbcfc377c736b7c0de10deb14e6105bd9594d6b950bd2fb3afda800e770a2219c4
6
+ metadata.gz: 0af940bc5279c64221d000e4c545c5e2696f2f14c405326785786b94cf9afc567619e94e79aefbfc68b0656d761ebe88b7604d1cbacf75e82ae3aca6d39b9e3f
7
+ data.tar.gz: 71d4ef2f73a4e914d4dd85fffef0643a1725857dc6bf51dce5c39e78f34a0bfdc69d2de59be574396175f3a2ea5841e502bde75d082ddb30f15ee30a1a598037
data/CHANGELOG.md CHANGED
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.5.2] - 2026-05-20
11
+
12
+ ### Bug Fixes
13
+
14
+ - **CHANGELOG correction for v0.5.1 MCP fix** (#90): The v0.5.1 entry
15
+ incorrectly stated that a `Mutex` was added to `StdioTransport#rpc_call`.
16
+ The actual fix was per-instance transport ownership (each `McpTool` instance
17
+ creates its own transport in `initialize`). Corrected the description.
18
+
19
+ ### Enhancements
20
+
21
+ - **Add `McpTool#close`** (#92): Tool instances now expose a `close` method
22
+ that shuts down the underlying stdio child process (`StdioTransport`) or
23
+ releases the HTTP connection (`HttpTransport`). This gives callers a
24
+ deterministic way to clean up resources instead of relying on GC.
25
+
26
+ ### Maintenance
27
+
28
+ - **Archive stale Rails integration design doc** (#91): Added an archived
29
+ notice to `spec/design/17_rails_integration.md` clarifying that Rails
30
+ integration was removed in v0.3.0–v0.5.1 and the document is for
31
+ historical reference only.
32
+
33
+ - **Remove zombie `register_workflow_context` API** (#93): The
34
+ `Phronomy.register_workflow_context`, `workflow_context_registry`, and
35
+ `reset_workflow_context_registry!` methods (along with the backing
36
+ `@workflow_context_registry` and `@registry_mutex` module-level variables)
37
+ were removed from `lib/phronomy.rb`. These existed to support the
38
+ `StateStore` deserialization guard, which was removed in a prior release.
39
+ The API had no remaining callers in the codebase and was not listed in
40
+ the README stability table.
41
+
42
+ ---
43
+
10
44
  ## [0.5.1] - 2026-05-21
11
45
 
12
46
  ### Bug Fixes
@@ -17,10 +51,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
51
  `lib/generators/`, `lib/phronomy/railtie.rb`, and all references in
18
52
  `lib/phronomy.rb`.
19
53
 
20
- - **Fix thread-safety of `StdioTransport#rpc_call`** (#86): Concurrent calls
21
- to the same `McpTool` instance could interleave JSON-RPC writes and reads,
22
- corrupting request/response pairing. A `Mutex` is now held around each
23
- write+read cycle. Also adds the missing `require "securerandom"`.
54
+ - **Fix MCP transport ownership** (#86): `McpTool` no longer stores a shared
55
+ transport at class level. `from_server` now uses a short-lived transport only
56
+ to fetch tool metadata and calls `close` immediately after. Each tool instance
57
+ creates its own `StdioTransport` or `HttpTransport` in `initialize`, so
58
+ concurrent callers (e.g. via `Orchestrator#dispatch_parallel`) never share
59
+ stdio streams. No `Mutex` is needed. Also adds missing
60
+ `require "securerandom"` and a no-op `HttpTransport#close` for interface
61
+ consistency.
24
62
 
25
63
  ### Documentation
26
64
 
data/README.md CHANGED
@@ -391,6 +391,13 @@ search_tool = Phronomy::Tool::McpTool.from_server(
391
391
  )
392
392
  ```
393
393
 
394
+ Call `close` when the tool is no longer needed to shut down the underlying
395
+ child process (stdio transport) or release the HTTP connection:
396
+
397
+ ```ruby
398
+ search_tool.close
399
+ ```
400
+
394
401
  ### Conversation History — passing prior messages
395
402
 
396
403
  Phronomy does not manage conversation history internally. The application owns the
@@ -82,6 +82,13 @@ module Phronomy
82
82
  @mcp_transport.call_tool(tool_name, args)
83
83
  end
84
84
 
85
+ # Allow callers to deterministically shut down the underlying child
86
+ # process (stdio) or release the HTTP connection. For HttpTransport
87
+ # this is a no-op. Calling execute after close raises an error.
88
+ klass.define_method(:close) do
89
+ @mcp_transport.close
90
+ end
91
+
85
92
  klass
86
93
  end
87
94
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Phronomy
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
5
5
  end
data/lib/phronomy.rb CHANGED
@@ -50,42 +50,7 @@ module Phronomy
50
50
  end
51
51
  end
52
52
 
53
- # Registry for WorkflowContext classes that may be serialized to external stores
54
- # (Redis, DB). Call +register_workflow_context+ at application startup so that
55
- # only known classes can be deserialized.
56
- @workflow_context_registry = nil
57
- @registry_mutex = Mutex.new
58
-
59
53
  class << self
60
- # Register one or more WorkflowContext classes that are allowed to be
61
- # deserialized by StateStore backends. When at least one class is registered,
62
- # only registered classes will be accepted by
63
- # +StateStore::Base#safe_state_class+.
64
- #
65
- # Call this once at application startup (e.g. in a Rails initializer).
66
- #
67
- # @param classes [Array<Class>] classes including Phronomy::WorkflowContext
68
- # @example
69
- # Phronomy.register_workflow_context(ScanContext, OtherContext)
70
- def register_workflow_context(*classes)
71
- @registry_mutex.synchronize do
72
- @workflow_context_registry ||= {}
73
- classes.each do |klass|
74
- raise ArgumentError, "#{klass.inspect} is not a Class" unless klass.is_a?(Class)
75
- @workflow_context_registry[klass.name] = klass
76
- end
77
- end
78
- end
79
-
80
- # Returns the current registry Hash, or nil when no class has been registered.
81
- # @return [Hash{String => Class}, nil]
82
- attr_reader :workflow_context_registry
83
-
84
- # Clears the registry. Primarily used in tests.
85
- def reset_workflow_context_registry!
86
- @registry_mutex.synchronize { @workflow_context_registry = nil }
87
- end
88
-
89
54
  def configuration
90
55
  @configuration ||= Configuration.new
91
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phronomy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raizo T.C.S