composable_agents 3.5.0 → 3.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 132190ec03c57ad131b72ea3ec35026ec960df4afa592db2de817986ca52f716
4
- data.tar.gz: dd2f18c46f0b902002dba6dc1e00426723de74bab9311926440122ca810a6426
3
+ metadata.gz: a8beed86d59f68e57d0efe7b2d09ec966defeee15fce9affb654762a81eb737d
4
+ data.tar.gz: 11c7329165a29b9549e7e170a5c9e753b745bebca3d1d720c724106ed01ac9f1
5
5
  SHA512:
6
- metadata.gz: e008ab4e1124e9b2943af61bc31c1d7290f2b2cee575fb6469776e337a141e32a6c2978f156ff5d79cc49e7654663324e7eee91d7521f02ecfb775cac352f8ff
7
- data.tar.gz: 0f3cda8a0158bf4946a4a4392426dc670d095b6c607999928babb251f9fb6ebdefe12885a62f7d3b8e94566aa42eeaff34749ac6a6f6a744138c4527bd7a9ce1
6
+ metadata.gz: 2bba9c989b743c4319e2834aa6cc831b300b86931d19ecade706c8523bf5d86061b3ff70bdfedf3d3cc69e68f74cdadef867543f885dc248fcccf803f58975fd
7
+ data.tar.gz: 9ce20af1669b8be9c296d0b64ef3a318db2e675d8cdd42247cd88fabf1b9c56a83bc486f89c38505521f7d4e3a2b14e4abd1b7e5cbf68e77d2772d9ce9a8d49b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # [v3.6.1](https://github.com/Muriel-Salvan/composable_agents/compare/v3.6.0...v3.6.1) (2026-11-07 16:11:50)
2
+
3
+ ### Patches
4
+
5
+ * [test: add logger coverage and improve SimpleCov configuration](https://github.com/Muriel-Salvan/composable_agents/commit/68804370a2d54917eb3792ec4932db3fc4941b4a)
6
+
7
+ # [v3.6.0](https://github.com/Muriel-Salvan/composable_agents/compare/v3.5.0...v3.6.0) (2026-11-07 11:35:50)
8
+
9
+ ## Global changes
10
+ ### Patches
11
+
12
+ * [feat(prompt): serialize text and markdown artifacts as lines](https://github.com/Muriel-Salvan/composable_agents/commit/160facaf017dad0936997e3d787c17c359850493)
13
+
14
+ ## Changes for prompt
15
+ ### Features
16
+
17
+ * [feat(prompt): serialize text and markdown artifacts as lines](https://github.com/Muriel-Salvan/composable_agents/commit/160facaf017dad0936997e3d787c17c359850493)
18
+
1
19
  # [v3.5.0](https://github.com/Muriel-Salvan/composable_agents/compare/v3.4.3...v3.5.0) (2026-11-06 18:46:37)
2
20
 
3
21
  ## Global changes
@@ -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.pretty_generate(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.5.0'
5
+ VERSION = '3.6.1'
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.5.0
4
+ version: 3.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan