Commit 0f5e8a3

mo khan <mo@mokhan.ca>
2026-01-17 05:57:50
refactor: rename :output to :content
1 parent 9788712
Changed files (3)
lib/elelem/agent.rb
@@ -91,16 +91,18 @@ module Elelem
     end
 
     def format_tool_result(name, result)
-      text = result[:output] || result[:content] || result[:error] || ""
+      return nil if result[:exit_status]
+
+      text = result[:content] || result[:error] || ""
       return nil if text.strip.empty?
 
       result[:error] ? "  ! #{text.lines.first&.strip}" : text
     end
 
     def truncate(result)
-      return result unless result[:output].is_a?(String) && result[:output].lines.size > MAX_LINES
+      return result unless result[:content].is_a?(String) && result[:content].lines.size > MAX_LINES
 
-      result[:output] = result[:output].lines.first(MAX_LINES).join + "… (truncated)"
+      result[:content] = result[:content].lines.first(MAX_LINES).join + "… (truncated)"
       result
     end
 
lib/elelem/terminal.rb
@@ -74,7 +74,7 @@ module Elelem
 
     def complete_files(target)
       result = Elelem.sh("bash", args: ["-c", "compgen -f #{target}"])
-      result[:output].lines.map(&:strip).first(20)
+      result[:content].lines.map(&:strip).first(20)
     end
   end
 end
lib/elelem.rb
@@ -22,7 +22,7 @@ module Elelem
         yield l if block_given?
         output.write(l)
       end
-      { exit_status: wait_thr.value.exitstatus, output: output.string }
+      { exit_status: wait_thr.value.exitstatus, content: output.string }
     end
   end