composable_agents 3.4.2 → 3.4.3
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/composable_agents/cline/agent.rb +26 -25
- data/lib/composable_agents/prompt_driven_agent.rb +19 -0
- data/lib/composable_agents/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 61425b41148921b109e692bb5041b8fab82e7c9634b5c28eaa19060ab493de0e
|
|
4
|
+
data.tar.gz: 12193ed0af4694ac9eefa92a6344e3f5dc5bb03e439627e404f045488f261544
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50a08e9ed84f873f7ea53aff8ee173aa4489b316432607bdd3d85e5a335f64eb210f04638b883e81af5a8af31b48e10e54b29cb5300f634ac7188b644804a421
|
|
7
|
+
data.tar.gz: 0a3022f2ce296337e0b9837115c2d92700f2c3db4aca81a8adb713bf6ee291ab02d213da85a4b2351bbce019f27f455c935a258ff25a63adaf2e0f1d77b0f9d0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
# [v3.4.3](https://github.com/Muriel-Salvan/composable_agents/compare/v3.4.2...v3.4.3) (2026-11-05 09:18:36)
|
|
2
|
+
|
|
3
|
+
### Patches
|
|
4
|
+
|
|
5
|
+
* [fix: normalize Cline session context with recursive JSON-safe conversion](https://github.com/Muriel-Salvan/composable_agents/commit/179334f05dbb758161c11c1d9b8d016c24d46909)
|
|
6
|
+
|
|
1
7
|
# [v3.4.2](https://github.com/Muriel-Salvan/composable_agents/compare/v3.4.1...v3.4.2) (2026-11-04 16:45:13)
|
|
2
8
|
|
|
3
9
|
## Global changes
|
|
@@ -169,32 +169,33 @@ module ComposableAgents
|
|
|
169
169
|
# Keep the context in case we need to resume it
|
|
170
170
|
if cline_cli.session&.messages
|
|
171
171
|
@context.concat(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
172
|
+
deep_json_safe(
|
|
173
|
+
cline_cli.session.messages.map.with_index do |message, idx_message|
|
|
174
|
+
curated_content = message.content.map.with_index do |content, idx_content|
|
|
175
|
+
curated_message = {
|
|
176
|
+
type: content.type,
|
|
177
|
+
text: (
|
|
178
|
+
if idx_message.zero? && idx_content.zero?
|
|
179
|
+
# First message is the user prompt, but we don't want to include the context from it
|
|
180
|
+
user_prompt
|
|
181
|
+
else
|
|
182
|
+
content.thinking || content.text
|
|
183
|
+
end
|
|
184
|
+
),
|
|
185
|
+
input:
|
|
186
|
+
if content.input&.question
|
|
187
|
+
{
|
|
188
|
+
question: content.input.question,
|
|
189
|
+
options: content.input.options
|
|
190
|
+
}.compact
|
|
191
|
+
end,
|
|
192
|
+
content: content.content
|
|
193
|
+
}.compact
|
|
194
|
+
curated_message.keys == [:type] ? nil : curated_message
|
|
195
|
+
end.compact
|
|
196
|
+
curated_content.empty? ? nil : { role: message.role, content: curated_content }
|
|
195
197
|
end.compact
|
|
196
|
-
|
|
197
|
-
end.compact
|
|
198
|
+
)
|
|
198
199
|
)
|
|
199
200
|
end
|
|
200
201
|
|
|
@@ -241,5 +241,24 @@ module ComposableAgents
|
|
|
241
241
|
obj
|
|
242
242
|
end
|
|
243
243
|
end
|
|
244
|
+
|
|
245
|
+
# Recursively convert any value into a plain, JSON-serializable Ruby object.
|
|
246
|
+
# Some agent states contain Shale objects (e.g. Cline session messages from the cline-rb Rubygem).
|
|
247
|
+
# Shale's to_json accepts no positional argument, while the JSON gem calls to_json with the generator state,
|
|
248
|
+
# so JSON.dump raises ArgumentError on them. Their to_hash (and the to_hash of their collections and maps)
|
|
249
|
+
# returns the equivalent plain structure, so we recurse into it to normalize nested schemas, collections and maps.
|
|
250
|
+
#
|
|
251
|
+
# @param value [Object] Value to normalize
|
|
252
|
+
# @return [Object] Equivalent JSON-serializable value
|
|
253
|
+
def deep_json_safe(value)
|
|
254
|
+
case value
|
|
255
|
+
when Array
|
|
256
|
+
value.map { |element| deep_json_safe(element) }
|
|
257
|
+
when Hash
|
|
258
|
+
value.to_h { |key, element| [key, deep_json_safe(element)] }
|
|
259
|
+
else
|
|
260
|
+
value.respond_to?(:to_hash) ? deep_json_safe(value.to_hash) : value
|
|
261
|
+
end
|
|
262
|
+
end
|
|
244
263
|
end
|
|
245
264
|
end
|