roast-ai 0.4.9 → 0.5.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/.claude/commands/docs/write-comments.md +36 -0
- data/.github/CODEOWNERS +1 -1
- data/.github/workflows/ci.yaml +10 -6
- data/.gitignore +0 -1
- data/.rubocop.yml +7 -1
- data/CLAUDE.md +2 -2
- data/CONTRIBUTING.md +2 -0
- data/Gemfile +18 -18
- data/Gemfile.lock +46 -57
- data/README.md +118 -1432
- data/README_LEGACY.md +1464 -0
- data/Rakefile +39 -4
- data/dev.yml +29 -0
- data/dsl/agent_sessions.rb +20 -0
- data/dsl/async_cogs.rb +49 -0
- data/dsl/async_cogs_complex.rb +67 -0
- data/dsl/call.rb +44 -0
- data/dsl/collect_from.rb +72 -0
- data/dsl/demo/Gemfile +4 -0
- data/dsl/demo/Gemfile.lock +120 -0
- data/dsl/demo/cogs/local.rb +15 -0
- data/dsl/demo/simple_external_cog.rb +17 -0
- data/dsl/json_output.rb +28 -0
- data/dsl/map.rb +55 -0
- data/dsl/map_reduce.rb +37 -0
- data/dsl/map_with_index.rb +49 -0
- data/dsl/next_break.rb +40 -0
- data/dsl/next_break_parallel.rb +44 -0
- data/dsl/outputs.rb +39 -0
- data/dsl/outputs_bang.rb +36 -0
- data/dsl/parallel_map.rb +37 -0
- data/dsl/plugin-gem-example/.gitignore +8 -0
- data/dsl/plugin-gem-example/Gemfile +13 -0
- data/dsl/plugin-gem-example/Gemfile.lock +178 -0
- data/dsl/plugin-gem-example/lib/other.rb +17 -0
- data/dsl/plugin-gem-example/lib/plugin_gem_example.rb +5 -0
- data/dsl/plugin-gem-example/lib/simple.rb +15 -0
- data/dsl/plugin-gem-example/lib/version.rb +10 -0
- data/dsl/plugin-gem-example/plugin-gem-example.gemspec +28 -0
- data/dsl/prompts/simple_prompt.md.erb +3 -0
- data/dsl/prototype.rb +10 -4
- data/dsl/repeat_loop_results.rb +53 -0
- data/dsl/ruby_cog.rb +72 -0
- data/dsl/simple_agent.rb +18 -0
- data/dsl/simple_chat.rb +26 -0
- data/dsl/simple_repeat.rb +29 -0
- data/dsl/skip.rb +36 -0
- data/dsl/step_communication.rb +10 -5
- data/dsl/targets_and_params.rb +57 -0
- data/dsl/temperature.rb +17 -0
- data/dsl/temporary_directory.rb +22 -0
- data/dsl/tutorial/01_your_first_workflow/README.md +179 -0
- data/dsl/tutorial/01_your_first_workflow/configured_chat.rb +33 -0
- data/dsl/tutorial/01_your_first_workflow/hello.rb +23 -0
- data/dsl/tutorial/02_chaining_cogs/README.md +310 -0
- data/dsl/tutorial/02_chaining_cogs/code_review.rb +104 -0
- data/dsl/tutorial/02_chaining_cogs/session_resumption.rb +92 -0
- data/dsl/tutorial/02_chaining_cogs/simple_chain.rb +84 -0
- data/dsl/tutorial/03_targets_and_params/README.md +230 -0
- data/dsl/tutorial/03_targets_and_params/multiple_targets.rb +65 -0
- data/dsl/tutorial/03_targets_and_params/single_target.rb +65 -0
- data/dsl/tutorial/04_configuration_options/README.md +209 -0
- data/dsl/tutorial/04_configuration_options/control_display_and_temperature.rb +104 -0
- data/dsl/tutorial/04_configuration_options/simple_config.rb +68 -0
- data/dsl/tutorial/05_control_flow/README.md +156 -0
- data/dsl/tutorial/05_control_flow/conditional_execution.rb +62 -0
- data/dsl/tutorial/05_control_flow/handling_failures.rb +77 -0
- data/dsl/tutorial/06_reusable_scopes/README.md +172 -0
- data/dsl/tutorial/06_reusable_scopes/accessing_scope_outputs.rb +126 -0
- data/dsl/tutorial/06_reusable_scopes/basic_scope.rb +63 -0
- data/dsl/tutorial/06_reusable_scopes/parameterized_scope.rb +78 -0
- data/dsl/tutorial/07_processing_collections/README.md +152 -0
- data/dsl/tutorial/07_processing_collections/basic_map.rb +70 -0
- data/dsl/tutorial/07_processing_collections/parallel_map.rb +74 -0
- data/dsl/tutorial/08_iterative_workflows/README.md +231 -0
- data/dsl/tutorial/08_iterative_workflows/basic_repeat.rb +57 -0
- data/dsl/tutorial/08_iterative_workflows/conditional_break.rb +57 -0
- data/dsl/tutorial/09_async_cogs/README.md +197 -0
- data/dsl/tutorial/09_async_cogs/basic_async.rb +38 -0
- data/dsl/tutorial/README.md +222 -0
- data/dsl/working_directory.rb +16 -0
- data/exe/roast +1 -1
- data/internal/documentation/architectural-notes.md +115 -0
- data/internal/documentation/doc-comments-external.md +686 -0
- data/internal/documentation/doc-comments-internal.md +342 -0
- data/internal/documentation/doc-comments.md +211 -0
- data/lib/roast/dsl/cog/config.rb +280 -4
- data/lib/roast/dsl/cog/input.rb +73 -0
- data/lib/roast/dsl/cog/output.rb +313 -0
- data/lib/roast/dsl/cog/registry.rb +71 -0
- data/lib/roast/dsl/cog/stack.rb +3 -2
- data/lib/roast/dsl/cog/store.rb +11 -8
- data/lib/roast/dsl/cog.rb +108 -31
- data/lib/roast/dsl/cog_input_context.rb +44 -0
- data/lib/roast/dsl/cog_input_manager.rb +156 -0
- data/lib/roast/dsl/cogs/agent/config.rb +465 -0
- data/lib/roast/dsl/cogs/agent/input.rb +81 -0
- data/lib/roast/dsl/cogs/agent/output.rb +59 -0
- data/lib/roast/dsl/cogs/agent/provider.rb +51 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/claude_invocation.rb +185 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/message.rb +73 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/assistant_message.rb +36 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/result_message.rb +61 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/system_message.rb +47 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/text_message.rb +36 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/tool_result_message.rb +47 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/tool_use_message.rb +46 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/unknown_message.rb +27 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/messages/user_message.rb +37 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/tool_result.rb +51 -0
- data/lib/roast/dsl/cogs/agent/providers/claude/tool_use.rb +48 -0
- data/lib/roast/dsl/cogs/agent/providers/claude.rb +31 -0
- data/lib/roast/dsl/cogs/agent/stats.rb +92 -0
- data/lib/roast/dsl/cogs/agent/usage.rb +62 -0
- data/lib/roast/dsl/cogs/agent.rb +75 -0
- data/lib/roast/dsl/cogs/chat/config.rb +453 -0
- data/lib/roast/dsl/cogs/chat/input.rb +92 -0
- data/lib/roast/dsl/cogs/chat/output.rb +64 -0
- data/lib/roast/dsl/cogs/chat/session.rb +68 -0
- data/lib/roast/dsl/cogs/chat.rb +81 -0
- data/lib/roast/dsl/cogs/cmd.rb +291 -27
- data/lib/roast/dsl/cogs/ruby.rb +171 -0
- data/lib/roast/dsl/command_runner.rb +191 -0
- data/lib/roast/dsl/config_context.rb +2 -47
- data/lib/roast/dsl/config_manager.rb +143 -0
- data/lib/roast/dsl/control_flow.rb +41 -0
- data/lib/roast/dsl/execution_context.rb +9 -0
- data/lib/roast/dsl/execution_manager.rb +267 -0
- data/lib/roast/dsl/nil_assertions.rb +23 -0
- data/lib/roast/dsl/system_cog/params.rb +32 -0
- data/lib/roast/dsl/system_cog.rb +36 -0
- data/lib/roast/dsl/system_cogs/call.rb +162 -0
- data/lib/roast/dsl/system_cogs/map.rb +448 -0
- data/lib/roast/dsl/system_cogs/repeat.rb +242 -0
- data/lib/roast/dsl/workflow.rb +123 -0
- data/lib/roast/dsl/workflow_context.rb +20 -0
- data/lib/roast/dsl/workflow_params.rb +24 -0
- data/lib/roast/sorbet_runtime_stub.rb +154 -0
- data/lib/roast/tools/apply_diff.rb +1 -3
- data/lib/roast/tools/cmd.rb +4 -3
- data/lib/roast/tools/read_file.rb +1 -1
- data/lib/roast/tools/update_files.rb +1 -1
- data/lib/roast/tools/write_file.rb +1 -1
- data/lib/roast/version.rb +1 -1
- data/lib/roast/workflow/base_workflow.rb +4 -0
- data/lib/roast/workflow/step_loader.rb +14 -2
- data/lib/roast-ai.rb +4 -0
- data/lib/roast.rb +60 -22
- data/{roast.gemspec → roast-ai.gemspec} +10 -13
- data/sorbet/config +1 -0
- data/sorbet/rbi/gems/async@2.34.0.rbi +1577 -0
- data/sorbet/rbi/gems/cli-kit@5.2.0.rbi +2063 -0
- data/sorbet/rbi/gems/{cli-ui@2.3.0.rbi → cli-ui@2.7.0-6bdefd1d06305e5d6ae312ac76f9c88f88658dda.rbi} +1418 -1013
- data/sorbet/rbi/gems/console@1.34.2.rbi +1193 -0
- data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +50 -0
- data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +35 -0
- data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +41 -0
- data/sorbet/rbi/gems/io-event@1.14.0.rbi +724 -0
- data/sorbet/rbi/gems/marcel@1.1.0.rbi +239 -0
- data/sorbet/rbi/gems/metrics@0.15.0.rbi +9 -0
- data/sorbet/rbi/gems/ruby_llm@1.8.2.rbi +5703 -0
- data/sorbet/rbi/gems/traces@0.18.2.rbi +9 -0
- data/sorbet/rbi/shims/lib/roast/dsl/cog_input_context.rbi +1197 -0
- data/sorbet/rbi/shims/lib/roast/dsl/config_context.rbi +314 -2
- data/sorbet/rbi/shims/lib/roast/dsl/execution_context.rbi +498 -0
- data/sorbet/tapioca/config.yml +6 -0
- data/sorbet/tapioca/require.rb +2 -0
- metadata +198 -34
- data/dsl/less_simple.rb +0 -112
- data/dsl/simple.rb +0 -8
- data/lib/roast/dsl/cog_execution_context.rb +0 -29
- data/lib/roast/dsl/cogs/graph.rb +0 -53
- data/lib/roast/dsl/cogs.rb +0 -65
- data/lib/roast/dsl/executor.rb +0 -82
- data/lib/roast/dsl/workflow_execution_context.rb +0 -47
- data/sorbet/rbi/gems/cgi@0.5.0.rbi +0 -2961
- data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +0 -568
- data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +0 -1991
- data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +0 -672
- data/sorbet/rbi/gems/dry-core@1.1.0.rbi +0 -1894
- data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +0 -659
- data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +0 -781
- data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +0 -1127
- data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +0 -3727
- data/sorbet/rbi/gems/dry-types@1.8.3.rbi +0 -3969
- data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +0 -1588
- data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +0 -136
- data/sorbet/rbi/gems/mime-types@3.7.0.rbi +0 -1342
- data/sorbet/rbi/gems/rack@2.2.18.rbi +0 -5659
- data/sorbet/rbi/gems/rbs-inline@0.12.0.rbi +0 -2170
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
- data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18492
- data/sorbet/rbi/shims/lib/roast/dsl/workflow_execution_context.rbi +0 -11
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Architectural Notes
|
|
2
|
+
|
|
3
|
+
This document captures architectural decisions and key distinctions that should guide how we talk about cogs and their functionality in documentation comments.
|
|
4
|
+
|
|
5
|
+
## Execution Scope Invocation Pattern
|
|
6
|
+
|
|
7
|
+
The `call`, `map`, and `repeat` cogs all share a common architectural pattern: they invoke named execution scopes (defined with `execute(:name)`). Understanding this pattern is essential for correctly documenting how users access outputs from these cogs.
|
|
8
|
+
|
|
9
|
+
### The Three Scope Invocation Cogs
|
|
10
|
+
|
|
11
|
+
#### `call` - Single Scope Invocation
|
|
12
|
+
|
|
13
|
+
The `call` cog invokes an execution scope **once** with a provided value:
|
|
14
|
+
|
|
15
|
+
- Invokes a named scope with a single input value
|
|
16
|
+
- Returns output from that single invocation
|
|
17
|
+
- Use case: Reusable workflow segments that need to run once
|
|
18
|
+
|
|
19
|
+
#### `map` - Multiple Scope Invocations (Collection)
|
|
20
|
+
|
|
21
|
+
The `map` cog invokes an execution scope **multiple times**, once for each item in a collection:
|
|
22
|
+
|
|
23
|
+
- Invokes a named scope for each item in an iterable
|
|
24
|
+
- Each invocation receives one item as its value
|
|
25
|
+
- Returns outputs from all invocations
|
|
26
|
+
- Use case: Processing collections where each item gets the same treatment
|
|
27
|
+
|
|
28
|
+
#### `repeat` - Multiple Scope Invocations (Loop)
|
|
29
|
+
|
|
30
|
+
The `repeat` cog invokes an execution scope **multiple times** in a loop until `break!` is called:
|
|
31
|
+
|
|
32
|
+
- Invokes a named scope repeatedly with evolving input
|
|
33
|
+
- Each iteration's output becomes the next iteration's input
|
|
34
|
+
- Returns outputs from all iterations
|
|
35
|
+
- Use case: Iterative refinement or loops with dynamic exit conditions
|
|
36
|
+
|
|
37
|
+
### Output Access Methods
|
|
38
|
+
|
|
39
|
+
The output access methods (`from`, `collect`, `reduce`) are designed around this scope invocation pattern:
|
|
40
|
+
|
|
41
|
+
#### `from` - Access a Single Scope Invocation
|
|
42
|
+
|
|
43
|
+
The `from` method retrieves output from a **single** execution scope invocation:
|
|
44
|
+
|
|
45
|
+
- Works with `call` cogs (access the one invocation)
|
|
46
|
+
- Works with `map` or `repeat` cogs via `.iteration(n)` (access a specific iteration's invocation)
|
|
47
|
+
- Returns the final output from that scope's `outputs!` or `outputs` block
|
|
48
|
+
- With a block, executes in the context of that scope, allowing access to intermediate cog outputs
|
|
49
|
+
|
|
50
|
+
#### `collect` - Access All Scope Invocations (as Array)
|
|
51
|
+
|
|
52
|
+
The `collect` method retrieves outputs from **all** execution scope invocations:
|
|
53
|
+
|
|
54
|
+
- Works with `map` or `repeat` cogs (via `.results` for `repeat`)
|
|
55
|
+
- Returns an array of final outputs from all iterations
|
|
56
|
+
- With a block, executes in each scope's context, allowing access to intermediate cog outputs
|
|
57
|
+
- Iterations that didn't run (due to `break!`) are represented as `nil`
|
|
58
|
+
|
|
59
|
+
#### `reduce` - Access All Scope Invocations (as Single Value)
|
|
60
|
+
|
|
61
|
+
The `reduce` method combines outputs from **all** execution scope invocations into a single value:
|
|
62
|
+
|
|
63
|
+
- Works with `map` or `repeat` cogs (via `.results` for `repeat`)
|
|
64
|
+
- Processes each iteration sequentially with an accumulator
|
|
65
|
+
- With a block, executes in each scope's context, allowing access to intermediate cog outputs
|
|
66
|
+
- Skips iterations that didn't run (due to `break!`)
|
|
67
|
+
|
|
68
|
+
### Documentation Guidelines
|
|
69
|
+
|
|
70
|
+
When documenting these methods:
|
|
71
|
+
|
|
72
|
+
- **Do** emphasize that `call`, `map`, and `repeat` all invoke execution scopes
|
|
73
|
+
- **Do** explain that `from` is for accessing a single scope invocation
|
|
74
|
+
- **Do** explain that `collect` and `reduce` are for accessing all scope invocations from `map` or `repeat`
|
|
75
|
+
- **Don't** characterize `from` as only for `call` cogs - it works with any single scope invocation
|
|
76
|
+
- **Don't** characterize `collect`/`reduce` as only for `map` - they work with both `map` and `repeat` (via `.results`)
|
|
77
|
+
- **Do** clarify that blocks passed to these methods execute in the context of the invoked scope, not the current scope
|
|
78
|
+
|
|
79
|
+
## Agent Cog vs Chat Cog
|
|
80
|
+
|
|
81
|
+
The `agent` cog and `chat` cog are both LLM-powered cogs, but they serve different purposes based on their execution environment and capabilities.
|
|
82
|
+
|
|
83
|
+
### Agent Cog
|
|
84
|
+
|
|
85
|
+
The `agent` cog runs a coding agent on the local machine with access to local resources:
|
|
86
|
+
|
|
87
|
+
- **Local filesystem access**: Can read and write files on the local machine
|
|
88
|
+
- **Local tool execution**: Can run tools and commands locally
|
|
89
|
+
- **Local MCP servers**: Has access to user's locally configured MCP servers
|
|
90
|
+
- **Primary purpose**: Coding tasks and any work requiring local filesystem access
|
|
91
|
+
- **Session management**: Supports automatic session resumption across invocations
|
|
92
|
+
|
|
93
|
+
### Chat Cog
|
|
94
|
+
|
|
95
|
+
The `chat` cog provides "pure" LLM interaction without local system access:
|
|
96
|
+
|
|
97
|
+
- **No local filesystem access**: Cannot read or write local files
|
|
98
|
+
- **No local tool execution**: Cannot run tools or commands on the local machine
|
|
99
|
+
- **Cloud-based capabilities**: Can access cloud-based tools and MCP servers provided by the LLM provider
|
|
100
|
+
- **Primary purpose**: LLM reasoning tasks that don't require local filesystem access
|
|
101
|
+
- **Session management**: Does not currently provide automatic conversation resume or memory capability (not yet implemented, not a design limitation)
|
|
102
|
+
|
|
103
|
+
### Key Distinction
|
|
104
|
+
|
|
105
|
+
**Neither cog is more or less capable in terms of deep thinking or reasoning.** Both can perform complex reasoning tasks. The primary distinction is **local filesystem access and the ability to run locally-configured tools and MCP servers**.
|
|
106
|
+
|
|
107
|
+
### Documentation Guidelines
|
|
108
|
+
|
|
109
|
+
When documenting these cogs:
|
|
110
|
+
|
|
111
|
+
- **Don't** characterize `chat` as "simple" or `agent` as more capable of reasoning
|
|
112
|
+
- **Do** emphasize the environmental differences (local vs cloud-based execution)
|
|
113
|
+
- **Do** explain that `agent` is designed for tasks requiring local filesystem access
|
|
114
|
+
- **Do** explain that `chat` is designed for pure LLM reasoning without local system interaction
|
|
115
|
+
- **Don't** imply that `chat` is limited in reasoning capability - it's just limited in local system access
|