composable_agents 3.4.3 → 3.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61425b41148921b109e692bb5041b8fab82e7c9634b5c28eaa19060ab493de0e
4
- data.tar.gz: 12193ed0af4694ac9eefa92a6344e3f5dc5bb03e439627e404f045488f261544
3
+ metadata.gz: 491a6d82dbce4b508dc8d83cda6d067b1ad13db47c0099e682beb900bf7964de
4
+ data.tar.gz: 1b488811d68e2d2233621111cf053df6e1b55fd15d7a686502b8eded4a4a04e7
5
5
  SHA512:
6
- metadata.gz: 50a08e9ed84f873f7ea53aff8ee173aa4489b316432607bdd3d85e5a335f64eb210f04638b883e81af5a8af31b48e10e54b29cb5300f634ac7188b644804a421
7
- data.tar.gz: 0a3022f2ce296337e0b9837115c2d92700f2c3db4aca81a8adb713bf6ee291ab02d213da85a4b2351bbce019f27f455c935a258ff25a63adaf2e0f1d77b0f9d0
6
+ metadata.gz: 50c6da2263939742f55d9f8e324e5ffc78ab266c053b5831918520cb2c1cbb0377e7980b9a979984446260abfec1f2fe05e9b27e72ba9276594b49106ae0d071
7
+ data.tar.gz: dad24a674070a0dc75c0c9b7eb3c04fd70140b521a12ff8058c86b16856150d828cf08934bd9506ab8af9df4f4065e6ebf615e626cd75ed94a73133e756944eb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # [v3.6.0](https://github.com/Muriel-Salvan/composable_agents/compare/v3.5.0...v3.6.0) (2026-11-07 11:35:50)
2
+
3
+ ## Global changes
4
+ ### Patches
5
+
6
+ * [feat(prompt): serialize text and markdown artifacts as lines](https://github.com/Muriel-Salvan/composable_agents/commit/160facaf017dad0936997e3d787c17c359850493)
7
+
8
+ ## Changes for prompt
9
+ ### Features
10
+
11
+ * [feat(prompt): serialize text and markdown artifacts as lines](https://github.com/Muriel-Salvan/composable_agents/commit/160facaf017dad0936997e3d787c17c359850493)
12
+
13
+ # [v3.5.0](https://github.com/Muriel-Salvan/composable_agents/compare/v3.4.3...v3.5.0) (2026-11-06 18:46:37)
14
+
15
+ ## Global changes
16
+ ### Patches
17
+
18
+ * [feat(prompts): pretty-print JSON context and artifacts](https://github.com/Muriel-Salvan/composable_agents/commit/2c32832997d33431a5af0ec931627faa4a87a7a7)
19
+
20
+ ## Changes for prompts
21
+ ### Features
22
+
23
+ * [feat(prompts): pretty-print JSON context and artifacts](https://github.com/Muriel-Salvan/composable_agents/commit/2c32832997d33431a5af0ec931627faa4a87a7a7)
24
+
1
25
  # [v3.4.3](https://github.com/Muriel-Salvan/composable_agents/compare/v3.4.2...v3.4.3) (2026-11-05 09:18:36)
2
26
 
3
27
  ### Patches
data/TODO.md CHANGED
@@ -1,3 +1,5 @@
1
+ * Add a new Breakable/Interruptable mixin for Cline::Agent with proper methods or config to define conditions to interrupt a run (could be based on timeouts, costs, tokens, infinite loops...).
2
+ * Use a ContextSummarizer agent to shrink the context given in retries.
1
3
  * Add a new mixin for Cline::Agent with proper methods or config to define retries in case of errors, with exponential waits.
2
4
  * Add a new retry mixin for Cline::Agent with proper methods or config to define retries in case of errors and 429 issues to define fallback models in case of errors, with exponential waits (reuse code from the RetriableCline mixin).
3
5
  * Add a way to detect infinite loops in agents and act on it (maybe a mixin looking at prompts/messages).
@@ -122,7 +122,7 @@ module ComposableAgents
122
122
  Here is the conversation from a previous session for context:
123
123
 
124
124
  ```json
125
- #{JSON.dump(@context)}
125
+ #{JSON.pretty_generate(@context)}
126
126
  ```
127
127
 
128
128
  Continue with the task, building on the work from the session above.
@@ -136,21 +136,38 @@ module ComposableAgents
136
136
  def render_user_prompt(rendered_instructions, input_artifacts:)
137
137
  sections = []
138
138
  unless input_artifacts.empty?
139
+ artifacts_sections = input_artifacts.map do |artifact_name, artifact_content|
140
+ art_ref = artifact_ref(artifact_name)
141
+ <<~EO_ARTIFACT_SECTION.strip
142
+ ## `#{art_ref}`
143
+
144
+ ```json input_artifact=#{art_ref}
145
+ #{JSON.pretty_generate(input_artifact_to_json(artifact_name, artifact_content))}
146
+ ```
147
+ EO_ARTIFACT_SECTION
148
+ end
149
+ serialization_format_section =
150
+ if input_artifacts.keys.any? do |artifact_name|
151
+ %i[text markdown].include?(normalized_input_artifacts_contracts.dig(artifact_name, :type))
152
+ end
153
+ <<~'EO_SERIALIZATION'.strip
154
+ Artifact serialization format:
155
+
156
+ An artifact with type "markdown" represents exactly one Markdown document.
157
+ Its "lines" property is an ordered array of strings representing the
158
+ document's lines.
159
+
160
+ Reconstruct the document by joining the elements with LF (\n).
161
+ Empty strings represent empty lines.
162
+
163
+ Preserve all content exactly, including whitespace and indentation.
164
+ Treat the reconstructed document as a single artifact.
165
+ EO_SERIALIZATION
166
+ end
139
167
  sections << <<~EO_SECTION.strip
140
168
  # Input artifacts
141
169
 
142
- #{
143
- input_artifacts.map do |artifact_name, artifact_content|
144
- art_ref = artifact_ref(artifact_name)
145
- <<~EO_ARTIFACT_SECTION.strip
146
- ## `#{art_ref}`
147
-
148
- ```json input_artifact=#{art_ref}
149
- #{JSON.dump(artifact_content)}
150
- ```
151
- EO_ARTIFACT_SECTION
152
- end.join("\n\n")
153
- }
170
+ #{[serialization_format_section, *artifacts_sections].compact.join("\n\n")}
154
171
  EO_SECTION
155
172
  end
156
173
  sections << <<~EO_SECTION if rendered_instructions && !rendered_instructions.empty?
@@ -297,6 +314,31 @@ module ComposableAgents
297
314
  ```
298
315
  EO_MARKDOWN
299
316
  end
317
+
318
+ # Get the JSON-serializable representation of an input artifact.
319
+ #
320
+ # The representation depends on the artifact type declared in the input artifacts contracts:
321
+ # - `json` (the default) artifacts are kept as-is.
322
+ # - `text` and `markdown` artifacts are wrapped into a Hash exposing their type and their lines,
323
+ # so that their content can be reconstructed exactly by joining the lines with LF (\n).
324
+ #
325
+ # @param artifact_name [Symbol] The input artifact name
326
+ # @param artifact_content [Object] The input artifact content
327
+ # @return [Object] The JSON-serializable representation of the input artifact
328
+ def input_artifact_to_json(artifact_name, artifact_content)
329
+ artifact_type = normalized_input_artifacts_contracts.dig(artifact_name, :type)
330
+ case artifact_type
331
+ when nil, :json
332
+ artifact_content
333
+ when :text, :markdown
334
+ {
335
+ type: artifact_type.to_s,
336
+ lines: artifact_content.split("\n")
337
+ }
338
+ else
339
+ raise "Unknown artifact type: #{artifact_type}"
340
+ end
341
+ end
300
342
  end
301
343
  end
302
344
  end
@@ -2,5 +2,5 @@ module ComposableAgents
2
2
  # @!group Public API
3
3
 
4
4
  # Gem version
5
- VERSION = '3.4.3'
5
+ VERSION = '3.6.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: composable_agents
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan