composable_agents 3.5.0 → 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 +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/composable_agents/prompt_rendering_strategy/markdown_heavy.rb +54 -12
- 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: 491a6d82dbce4b508dc8d83cda6d067b1ad13db47c0099e682beb900bf7964de
|
|
4
|
+
data.tar.gz: 1b488811d68e2d2233621111cf053df6e1b55fd15d7a686502b8eded4a4a04e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 50c6da2263939742f55d9f8e324e5ffc78ab266c053b5831918520cb2c1cbb0377e7980b9a979984446260abfec1f2fe05e9b27e72ba9276594b49106ae0d071
|
|
7
|
+
data.tar.gz: dad24a674070a0dc75c0c9b7eb3c04fd70140b521a12ff8058c86b16856150d828cf08934bd9506ab8af9df4f4065e6ebf615e626cd75ed94a73133e756944eb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
|
|
1
13
|
# [v3.5.0](https://github.com/Muriel-Salvan/composable_agents/compare/v3.4.3...v3.5.0) (2026-11-06 18:46:37)
|
|
2
14
|
|
|
3
15
|
## 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
|