clacky 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.
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clacky
4
+ class AgentConfig
5
+ PERMISSION_MODES = [:auto_approve, :confirm_safes, :confirm_edits, :plan_only].freeze
6
+ EDITING_TOOLS = %w[write edit].freeze
7
+
8
+ attr_accessor :model, :max_iterations, :max_cost_usd, :timeout_seconds,
9
+ :permission_mode, :allowed_tools, :disallowed_tools,
10
+ :max_tokens, :verbose, :enable_compression, :keep_recent_messages
11
+
12
+ def initialize(options = {})
13
+ @model = options[:model] || "gpt-3.5-turbo"
14
+ @max_iterations = options[:max_iterations] || 200
15
+ @max_cost_usd = options[:max_cost_usd] || 5.0
16
+ @timeout_seconds = options[:timeout_seconds] # nil means no timeout
17
+ @permission_mode = validate_permission_mode(options[:permission_mode])
18
+ @allowed_tools = options[:allowed_tools]
19
+ @disallowed_tools = options[:disallowed_tools] || []
20
+ @max_tokens = options[:max_tokens] || 8192
21
+ @verbose = options[:verbose] || false
22
+ @enable_compression = options[:enable_compression].nil? ? true : options[:enable_compression]
23
+ @keep_recent_messages = options[:keep_recent_messages] || 10
24
+ end
25
+
26
+
27
+
28
+ def is_plan_only?
29
+ @permission_mode == :plan_only
30
+ end
31
+
32
+ private
33
+
34
+ def validate_permission_mode(mode)
35
+ mode ||= :confirm_safes
36
+ mode = mode.to_sym
37
+
38
+ unless PERMISSION_MODES.include?(mode)
39
+ raise ArgumentError, "Invalid permission mode: #{mode}. Must be one of #{PERMISSION_MODES.join(', ')}"
40
+ end
41
+
42
+ mode
43
+ end
44
+
45
+
46
+ end
47
+ end