ruboty-ai_agent 0.1.0 → 0.3.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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +19 -0
  3. data/AGENTS.md +8 -0
  4. data/CHANGELOG.md +14 -2
  5. data/Gemfile +10 -3
  6. data/README.md +2 -0
  7. data/Rakefile +4 -0
  8. data/Steepfile +1 -0
  9. data/lib/ruboty/ai_agent/actions/add_ai_command.rb +16 -1
  10. data/lib/ruboty/ai_agent/actions/add_mcp.rb +7 -2
  11. data/lib/ruboty/ai_agent/actions/base.rb +11 -1
  12. data/lib/ruboty/ai_agent/actions/chat.rb +56 -19
  13. data/lib/ruboty/ai_agent/actions/list_ai_commands.rb +20 -4
  14. data/lib/ruboty/ai_agent/actions/list_mcp.rb +50 -3
  15. data/lib/ruboty/ai_agent/actions/remove_ai_command.rb +7 -1
  16. data/lib/ruboty/ai_agent/actions/show_system_prompt.rb +1 -1
  17. data/lib/ruboty/ai_agent/agent.rb +3 -3
  18. data/lib/ruboty/ai_agent/chat_message.rb +7 -2
  19. data/lib/ruboty/ai_agent/chat_thread_messages.rb +40 -0
  20. data/lib/ruboty/ai_agent/commands/base.rb +16 -14
  21. data/lib/ruboty/ai_agent/commands/builtin_base.rb +39 -0
  22. data/lib/ruboty/ai_agent/commands/clear.rb +2 -14
  23. data/lib/ruboty/ai_agent/commands/compact.rb +4 -47
  24. data/lib/ruboty/ai_agent/commands/prompt_command.rb +60 -0
  25. data/lib/ruboty/ai_agent/commands/usage.rb +2 -14
  26. data/lib/ruboty/ai_agent/commands.rb +9 -17
  27. data/lib/ruboty/ai_agent/database/query_methods.rb +31 -6
  28. data/lib/ruboty/ai_agent/database.rb +2 -1
  29. data/lib/ruboty/ai_agent/http_mcp_client.rb +5 -2
  30. data/lib/ruboty/ai_agent/llm/openai.rb +6 -6
  31. data/lib/ruboty/ai_agent/mcp_clients.rb +5 -12
  32. data/lib/ruboty/ai_agent/mcp_configuration.rb +3 -2
  33. data/lib/ruboty/ai_agent/prompt_command_definition.rb +17 -0
  34. data/lib/ruboty/ai_agent/record_set.rb +9 -5
  35. data/lib/ruboty/ai_agent/recordable.rb +11 -9
  36. data/lib/ruboty/ai_agent/request.rb +17 -0
  37. data/lib/ruboty/ai_agent/token_usage.rb +10 -0
  38. data/lib/ruboty/ai_agent/tool.rb +11 -3
  39. data/lib/ruboty/ai_agent/tool_definitions/base.rb +84 -0
  40. data/lib/ruboty/ai_agent/tool_definitions/think.rb +41 -0
  41. data/lib/ruboty/ai_agent/tool_definitions.rb +19 -0
  42. data/lib/ruboty/ai_agent/user.rb +5 -0
  43. data/lib/ruboty/ai_agent/user_mcp_caches.rb +2 -2
  44. data/lib/ruboty/ai_agent/user_mcp_client.rb +5 -4
  45. data/lib/ruboty/ai_agent/user_prompt_command_definitions.rb +17 -0
  46. data/lib/ruboty/ai_agent/version.rb +1 -1
  47. data/lib/ruboty/ai_agent.rb +13 -0
  48. data/lib/ruboty/handlers/ai_agent.rb +28 -16
  49. data/rbs_collection.yaml +1 -0
  50. data/ruboty-ai_agent.gemspec +2 -6
  51. data/script/clean-orphaned-rbs.rb +105 -0
  52. data/script/generate-concern-rbs.rb +5 -5
  53. data/script/generate-data-rbs.rb +3 -5
  54. data/script/generate-memorized-ivar-rbs.rb +6 -11
  55. data/sig/generated/ruboty/ai_agent/actions/add_ai_command.rbs +4 -0
  56. data/sig/generated/ruboty/ai_agent/actions/base.rbs +4 -0
  57. data/sig/generated/ruboty/ai_agent/actions/chat.rbs +10 -0
  58. data/sig/generated/ruboty/ai_agent/actions/list_mcp.rbs +11 -0
  59. data/sig/generated/ruboty/ai_agent/agent.rbs +1 -1
  60. data/sig/generated/ruboty/ai_agent/chat_message.rbs +5 -2
  61. data/sig/generated/ruboty/ai_agent/chat_thread_messages.rbs +14 -0
  62. data/sig/generated/ruboty/ai_agent/commands/base.rbs +8 -19
  63. data/sig/generated/ruboty/ai_agent/commands/builtin_base.rbs +40 -0
  64. data/sig/generated/ruboty/ai_agent/commands/clear.rbs +2 -10
  65. data/sig/generated/ruboty/ai_agent/commands/compact.rbs +2 -20
  66. data/sig/generated/ruboty/ai_agent/commands/prompt_command.rbs +26 -0
  67. data/sig/generated/ruboty/ai_agent/commands/usage.rbs +2 -10
  68. data/sig/generated/ruboty/ai_agent/commands.rbs +3 -4
  69. data/sig/generated/ruboty/ai_agent/database/query_methods.rbs +18 -12
  70. data/sig/generated/ruboty/ai_agent/database.rbs +3 -1
  71. data/sig/generated/ruboty/ai_agent/llm/openai.rbs +3 -3
  72. data/sig/generated/ruboty/ai_agent/mcp_clients.rbs +0 -5
  73. data/sig/generated/ruboty/ai_agent/mcp_configuration.rbs +4 -2
  74. data/sig/generated/ruboty/ai_agent/prompt_command_definition.rbs +23 -0
  75. data/sig/generated/ruboty/ai_agent/record_set.rbs +11 -9
  76. data/sig/generated/ruboty/ai_agent/recordable.rbs +6 -6
  77. data/sig/generated/ruboty/ai_agent/request.rbs +23 -0
  78. data/sig/generated/ruboty/ai_agent/token_usage.rbs +4 -0
  79. data/sig/generated/ruboty/ai_agent/tool.rbs +9 -3
  80. data/sig/generated/ruboty/ai_agent/tool_definitions/base.rbs +52 -0
  81. data/sig/generated/ruboty/ai_agent/tool_definitions/think.rbs +17 -0
  82. data/sig/generated/ruboty/ai_agent/tool_definitions.rbs +12 -0
  83. data/sig/generated/ruboty/ai_agent/user.rbs +4 -0
  84. data/sig/generated/ruboty/ai_agent/user_mcp_client.rbs +4 -2
  85. data/sig/generated/ruboty/ai_agent/user_prompt_command_definitions.rbs +12 -0
  86. data/sig/generated/ruboty/handlers/ai_agent.rbs +12 -12
  87. data/sig/generated-by-scripts/concerns.rbs +5 -0
  88. data/sig/generated-by-scripts/memorized_ivars.rbs +19 -0
  89. metadata +19 -57
@@ -18,16 +18,19 @@ module Ruboty
18
18
 
19
19
  attr_reader token_usage: TokenUsage?
20
20
 
21
- # @rbs role: Symbol
21
+ # @rbs role: Symbol | String
22
22
  # @rbs content: String
23
23
  # @rbs ?tool_call_id: String?
24
24
  # @rbs ?tool_name: String?
25
25
  # @rbs ?tool_arguments: Hash[Symbol | String, untyped]?
26
26
  # @rbs ?token_usage: TokenUsage?
27
- def initialize: (role: Symbol, content: String, ?tool_call_id: untyped, ?tool_name: untyped, ?tool_arguments: untyped, ?token_usage: untyped) -> untyped
27
+ def initialize: (role: Symbol | String, content: String, ?tool_call_id: untyped, ?tool_name: untyped, ?tool_arguments: untyped, ?token_usage: untyped) -> untyped
28
28
 
29
29
  def to_h: () -> Hash[Symbol, untyped]
30
30
 
31
+ # @rbs return: bool
32
+ def tool_call?: () -> bool
33
+
31
34
  def self.from_llm_response: (tool: untyped, tool_call_id: untyped, tool_arguments: untyped, tool_response: untyped) -> ChatMessage
32
35
  end
33
36
  end
@@ -8,6 +8,20 @@ module Ruboty
8
8
  def add: (ChatMessage message) -> void
9
9
 
10
10
  alias << add
11
+
12
+ # Check if any message's token usage exceeds auto compact threshold
13
+ # @rbs return: bool
14
+ def over_auto_compact_threshold?: () -> bool
15
+
16
+ # Compact chat messages by summarizing them
17
+ # @rbs llm: LLM::OpenAI
18
+ # @rbs return: void
19
+ def compact: (llm: LLM::OpenAI) -> void
20
+
21
+ # Generate summary of chat messages
22
+ # @rbs llm: LLM::OpenAI
23
+ # @rbs return: String
24
+ def summarize: (llm: LLM::OpenAI) -> String
11
25
  end
12
26
  end
13
27
  end
@@ -6,34 +6,23 @@ module Ruboty
6
6
  # Base class for commands.
7
7
  # @abstract
8
8
  class Base
9
- class Matcher < Data
10
- attr_reader pattern(): untyped
9
+ attr_reader request: Request
11
10
 
12
- attr_reader description(): untyped
11
+ # @rbs request: Request
12
+ def initialize: (request: Request) -> untyped
13
13
 
14
- attr_reader name(): untyped
14
+ def message: () -> Ruboty::Message
15
15
 
16
- def self.new: (untyped pattern, untyped description, untyped name) -> instance
17
- | (pattern: untyped, description: untyped, name: untyped) -> instance
18
-
19
- def self.members: () -> [ :pattern, :description, :name ]
20
-
21
- def members: () -> [ :pattern, :description, :name ]
22
- end
23
-
24
- def self.matchers: () -> Array[Matcher]
25
-
26
- def self.on: (untyped pattern, name: untyped, description: untyped) -> untyped
16
+ def chat_thread: () -> Ruboty::AiAgent::ChatThread
27
17
 
28
18
  # @rbs *args: untyped
29
- # @rbs return: void
30
- def call: (*untyped args) -> void
19
+ # @rbs return: untyped
20
+ def call: (*untyped args) -> untyped
31
21
 
32
22
  # @rbs commandline: String
33
23
  # @rbs return: boolish
24
+ # @abstract
34
25
  def match?: (String commandline) -> boolish
35
-
36
- def matchers: () -> Array[Matcher]
37
26
  end
38
27
  end
39
28
  end
@@ -0,0 +1,40 @@
1
+ # Generated from lib/ruboty/ai_agent/commands/builtin_base.rb with RBS::Inline
2
+
3
+ module Ruboty
4
+ module AiAgent
5
+ module Commands
6
+ # Base class for commands.
7
+ # @abstract
8
+ class BuiltinBase < Base
9
+ class Matcher < Data
10
+ attr_reader pattern(): untyped
11
+
12
+ attr_reader description(): untyped
13
+
14
+ attr_reader name(): untyped
15
+
16
+ def self.new: (untyped pattern, untyped description, untyped name) -> instance
17
+ | (pattern: untyped, description: untyped, name: untyped) -> instance
18
+
19
+ def self.members: () -> [ :pattern, :description, :name ]
20
+
21
+ def members: () -> [ :pattern, :description, :name ]
22
+ end
23
+
24
+ def self.matchers: () -> Array[Matcher]
25
+
26
+ def self.on: (untyped pattern, name: untyped, description: untyped) -> untyped
27
+
28
+ # @rbs *args: untyped
29
+ # @rbs return: void
30
+ def call: (*untyped args) -> void
31
+
32
+ # @rbs commandline: String
33
+ # @rbs return: boolish
34
+ def match?: (String commandline) -> boolish
35
+
36
+ def matchers: () -> Array[Matcher]
37
+ end
38
+ end
39
+ end
40
+ end
@@ -4,16 +4,8 @@ module Ruboty
4
4
  module AiAgent
5
5
  module Commands
6
6
  # Clear histories of the chat thread.
7
- class Clear < Base
8
- attr_reader message: Ruboty::Message
9
-
10
- attr_reader chat_thread: Ruboty::AiAgent::ChatThread
11
-
12
- # @rbs message: Ruboty::Message
13
- # @rbs chat_thread: Ruboty::AiAgent::ChatThread
14
- def initialize: (message: Ruboty::Message, chat_thread: Ruboty::AiAgent::ChatThread) -> untyped
15
-
16
- def call: () -> void
7
+ class Clear < BuiltinBase
8
+ def call: (*untyped) -> void
17
9
  end
18
10
  end
19
11
  end
@@ -4,26 +4,8 @@ module Ruboty
4
4
  module AiAgent
5
5
  module Commands
6
6
  # Compact chat history by summarizing it
7
- class Compact < Base
8
- attr_reader message: Ruboty::Message
9
-
10
- attr_reader chat_thread: Ruboty::AiAgent::ChatThread
11
-
12
- # @rbs message: Ruboty::Message
13
- # @rbs chat_thread: Ruboty::AiAgent::ChatThread
14
- def initialize: (message: Ruboty::Message, chat_thread: Ruboty::AiAgent::ChatThread) -> untyped
15
-
16
- def call: () -> void
17
-
18
- private
19
-
20
- # @rbs messages: Array[ChatMessage]
21
- # @rbs return: String
22
- def generate_summary: (Array[ChatMessage] messages) -> String
23
-
24
- # @rbs messages: Array[ChatMessage]
25
- # @rbs return: String
26
- def format_messages_for_summary: (Array[ChatMessage] messages) -> String
7
+ class Compact < BuiltinBase
8
+ def call: (*untyped) -> void
27
9
  end
28
10
  end
29
11
  end
@@ -0,0 +1,26 @@
1
+ # Generated from lib/ruboty/ai_agent/commands/prompt_command.rb with RBS::Inline
2
+
3
+ module Ruboty
4
+ module AiAgent
5
+ module Commands
6
+ # Compact chat history by summarizing it
7
+ class PromptCommand < Base
8
+ attr_reader definition: Ruboty::AiAgent::PromptCommandDefinition
9
+
10
+ # @rbs definition: Ruboty::AiAgent::PromptCommandDefinition
11
+ # @rbs request: Ruboty::AiAgent::Request
12
+ def initialize: (definition: Ruboty::AiAgent::PromptCommandDefinition, request: Ruboty::AiAgent::Request) -> untyped
13
+
14
+ # @rbs commandline: String
15
+ # @rbs return: boolish
16
+ def match?: (String commandline) -> boolish
17
+
18
+ def pattern: () -> Regexp
19
+
20
+ # @rbs commandline: String
21
+ # @rbs return: String
22
+ def call: (commandline: String) -> String
23
+ end
24
+ end
25
+ end
26
+ end
@@ -4,16 +4,8 @@ module Ruboty
4
4
  module AiAgent
5
5
  module Commands
6
6
  # Show token usage information for the latest AI response
7
- class Usage < Base
8
- attr_reader message: Ruboty::Message
9
-
10
- attr_reader chat_thread: Ruboty::AiAgent::ChatThread
11
-
12
- # @rbs message: Ruboty::Message
13
- # @rbs chat_thread: Ruboty::AiAgent::ChatThread
14
- def initialize: (message: Ruboty::Message, chat_thread: Ruboty::AiAgent::ChatThread) -> untyped
15
-
16
- def call: () -> void
7
+ class Usage < BuiltinBase
8
+ def call: (*untyped) -> void
17
9
 
18
10
  private
19
11
 
@@ -4,10 +4,9 @@ module Ruboty
4
4
  module AiAgent
5
5
  # Interaction commands (a.k.a. Slash commands, Prompts, etc)
6
6
  module Commands
7
- # @rbs message: Ruboty::Message
8
- # @rbs chat_thread: ChatThread
9
- # @rbs return: Array[Commands::Base]
10
- def self.builtins: (message: Ruboty::Message, chat_thread: ChatThread) -> Array[Commands::Base]
7
+ # @rbs request: Request
8
+ # @rbs return: Array[Commands::BuiltinBase]
9
+ def self.builtins: (request: Request) -> Array[Commands::BuiltinBase]
11
10
  end
12
11
  end
13
12
  end
@@ -7,32 +7,38 @@ module Ruboty
7
7
  def data: () -> Hash[keynable, untyped]
8
8
  end
9
9
 
10
+ type query_key = keynable | Symbol | nil
11
+
10
12
  # @rbs module-self _WithData
11
13
  module QueryMethods : _WithData
12
- # @rbs *keys: keynable
14
+ # @rbs keys: Array[query_key]
15
+ # @rbs return: Array[keynable]
16
+ def self.keys_to_keynable: (Array[query_key] keys) -> Array[keynable]
17
+
18
+ # @rbs *keys: query_key
13
19
  # @rbs return: untyped
14
- def fetch: (*keynable keys) -> untyped
20
+ def fetch: (*query_key keys) -> untyped
15
21
 
16
- # @rbs *keys: keynable
22
+ # @rbs *keys: query_key
17
23
  # @rbs return: Integer
18
- def len: (*keynable keys) -> Integer
24
+ def len: (*query_key keys) -> Integer
19
25
 
20
- # @rbs *keys: keynable
26
+ # @rbs *keys: query_key
21
27
  # @rbs return: void
22
- def delete: (*keynable keys) -> void
28
+ def delete: (*query_key keys) -> void
23
29
 
24
- # @rbs *keys: keynable
30
+ # @rbs *keys: query_key
25
31
  # @rbs return: Array[keynable]
26
- def keys: (*keynable keys) -> Array[keynable]
32
+ def keys: (*query_key keys) -> Array[keynable]
27
33
 
28
- # @rbs *keys: keynable
34
+ # @rbs *keys: query_key
29
35
  # @rbs return: boolish
30
- def key?: (*keynable keys) -> boolish
36
+ def key?: (*query_key keys) -> boolish
31
37
 
32
- # @rbs at: Array[keynable]
38
+ # @rbs at: Array[query_key]
33
39
  # @rbs value: untyped
34
40
  # @rbs return: void
35
- def store: (untyped value, at: Array[keynable]) -> void
41
+ def store: (untyped value, at: Array[query_key]) -> void
36
42
  end
37
43
  end
38
44
  end
@@ -4,7 +4,7 @@ module Ruboty
4
4
  module AiAgent
5
5
  # Memorize and retrieve information using Ruboty's brain.
6
6
  class Database
7
- type keynable = Symbol | String | Integer
7
+ type keynable = String | Integer
8
8
 
9
9
  include QueryMethods
10
10
 
@@ -21,6 +21,8 @@ module Ruboty
21
21
 
22
22
  def chat_thread: (untyped id) -> ChatThread
23
23
 
24
+ # @rbs %a{memorized}
25
+ %a{memorized}
24
26
  def global_settings: () -> GlobalSettings
25
27
  end
26
28
  end
@@ -9,9 +9,9 @@ module Ruboty
9
9
 
10
10
  attr_reader model: String
11
11
 
12
- # @rbs client: OpenAI::Client
13
- # @rbs model: String
14
- def initialize: (client: OpenAI::Client, model: String) -> untyped
12
+ # @rbs ?client: OpenAI::Client
13
+ # @rbs ?model: String
14
+ def initialize: (?client: untyped, ?model: untyped) -> untyped
15
15
 
16
16
  # @rbs %a{memorized}
17
17
  %a{memorized}
@@ -12,11 +12,6 @@ module Ruboty
12
12
  # @rbs return: Array[Tool]
13
13
  def available_tools: () -> Array[Tool]
14
14
 
15
- # @rbs function_name: String
16
- # @rbs arguments: Hash[String, untyped]
17
- # @rbs return: untyped
18
- def execute_tool: (String function_name, Hash[String, untyped] arguments) -> untyped
19
-
20
15
  # @rbs return: bool
21
16
  def any?: () -> bool
22
17
  end
@@ -4,6 +4,8 @@ module Ruboty
4
4
  module AiAgent
5
5
  type transports = :http | :websocket
6
6
 
7
+ type transports_str = "http" | "websocket"
8
+
7
9
  class McpConfiguration < Data
8
10
  attr_reader name(): String
9
11
 
@@ -26,10 +28,10 @@ module Ruboty
26
28
  include Recordable
27
29
 
28
30
  # @rbs name: String
29
- # @rbs transport: transports
31
+ # @rbs transport: transports | transports_str
30
32
  # @rbs url: String
31
33
  # @rbs headers: Hash[String, String]?
32
- def initialize: (name: String, transport: transports, url: String, ?headers: Hash[String, String]?) -> untyped
34
+ def initialize: (name: String, transport: transports | transports_str, url: String, ?headers: Hash[String, String]?) -> untyped
33
35
  end
34
36
  end
35
37
  end
@@ -0,0 +1,23 @@
1
+ # Generated from lib/ruboty/ai_agent/prompt_command_definition.rb with RBS::Inline
2
+
3
+ module Ruboty
4
+ module AiAgent
5
+ class PromptCommandDefinition < Data
6
+ attr_reader name(): String
7
+
8
+ attr_reader prompt(): String
9
+
10
+ def self.new: (String name, String prompt) -> instance
11
+ | (name: String, prompt: String) -> instance
12
+
13
+ def self.members: () -> [ :name, :prompt ]
14
+
15
+ def members: () -> [ :name, :prompt ]
16
+ end
17
+
18
+ # User-defined command model
19
+ class PromptCommandDefinition
20
+ include Recordable
21
+ end
22
+ end
23
+ end
@@ -9,7 +9,9 @@ module Ruboty
9
9
 
10
10
  def initialize: (database: untyped) -> untyped
11
11
 
12
- def namespace_keys: () -> Array[Database::keynable]
12
+ def namespace_keys: () -> Array[Database::query_key]
13
+
14
+ def empty?: () -> boolish
13
15
 
14
16
  def length: () -> Integer
15
17
 
@@ -19,22 +21,22 @@ module Ruboty
19
21
 
20
22
  def keys: () -> Array[Database::keynable]
21
23
 
22
- # @rbs key: Database::keynable
24
+ # @rbs key: Database::query_key
23
25
  # @rbs return: Record | nil
24
- def fetch: (Database::keynable key) -> (Record | nil)
26
+ def fetch: (Database::query_key key) -> (Record | nil)
25
27
 
26
- # @rbs key: Database::keynable
28
+ # @rbs key: Database::query_key
27
29
  # @rbs record: Record
28
30
  # @rbs return: void
29
- def store: (Record record, key: Database::keynable) -> void
31
+ def store: (Record record, key: Database::query_key) -> void
30
32
 
31
- # @rbs key: Database::keynable
33
+ # @rbs key: Database::query_key
32
34
  # @rbs return: void
33
- def remove: (Database::keynable key) -> void
35
+ def remove: (Database::query_key key) -> void
34
36
 
35
- # @rbs key: Database::keynable
37
+ # @rbs key: Database::query_key
36
38
  # @rbs return: boolish
37
- def key?: (Database::keynable key) -> boolish
39
+ def key?: (Database::query_key key) -> boolish
38
40
 
39
41
  def clear: () -> void
40
42
  end
@@ -3,7 +3,7 @@
3
3
  module Ruboty
4
4
  module AiAgent
5
5
  interface _WithToH
6
- def to_h: () -> Hash[Database::keynable, untyped]
6
+ def to_h: () -> Hash[Symbol, untyped]
7
7
  end
8
8
 
9
9
  # Convertable between Hash and Recordable bidirectionally.
@@ -15,9 +15,9 @@ module Ruboty
15
15
 
16
16
  def self.record_types: () -> Hash[Symbol, Class]
17
17
 
18
- # @rbs hash: Hash[Symbol, untyped]?
18
+ # @rbs hash: Hash[Symbol | String, untyped]?
19
19
  # @rbs return: bool
20
- def self.convertable?: (Hash[Symbol, untyped]? hash) -> bool
20
+ def self.convertable?: (Hash[Symbol | String, untyped]? hash) -> bool
21
21
 
22
22
  # @rbs value: untyped
23
23
  # @rbs return: untyped
@@ -31,9 +31,9 @@ module Ruboty
31
31
  # @rbs return: Hash[Database::keynable, untyped]
32
32
  def self.record_to_hash: (Recordable record) -> Hash[Database::keynable, untyped]
33
33
 
34
- # @rbs hash: Hash[Symbol, untyped]
34
+ # @rbs hash: Hash[Symbol | String, untyped]
35
35
  # @rbs return: Recordable
36
- def self.record_from_hash: (Hash[Symbol, untyped] hash) -> Recordable
36
+ def self.record_from_hash: (Hash[Symbol | String, untyped] hash) -> Recordable
37
37
 
38
38
  # @rbs module-self Class
39
39
  module ClassMethods : Class
@@ -45,7 +45,7 @@ module Ruboty
45
45
 
46
46
  # @rbs module-self Recordable::ClassMethods.instance
47
47
  module PrependMethods : Recordable::ClassMethods
48
- def to_h: () -> Hash[Database::keynable, untyped]
48
+ def to_h: () -> Hash[Symbol, untyped]
49
49
  end
50
50
 
51
51
  # @rbs %a{pure}
@@ -0,0 +1,23 @@
1
+ # Generated from lib/ruboty/ai_agent/request.rb with RBS::Inline
2
+
3
+ module Ruboty
4
+ module AiAgent
5
+ class Request < Data
6
+ attr_reader message(): Ruboty::Message
7
+
8
+ attr_reader chat_thread(): Ruboty::AiAgent::ChatThread
9
+
10
+ def self.new: (Ruboty::Message message, Ruboty::AiAgent::ChatThread chat_thread) -> instance
11
+ | (message: Ruboty::Message, chat_thread: Ruboty::AiAgent::ChatThread) -> instance
12
+
13
+ def self.members: () -> [ :message, :chat_thread ]
14
+
15
+ def members: () -> [ :message, :chat_thread ]
16
+ end
17
+
18
+ # Request for chat action from user.
19
+ class Request
20
+ def message_body: () -> String
21
+ end
22
+ end
23
+ end
@@ -24,6 +24,10 @@ module Ruboty
24
24
  # @rbs return: (Float | nil)
25
25
  def usage_percentage: () -> (Float | nil)
26
26
 
27
+ # Check if usage percentage exceeds auto compact threshold
28
+ # @rbs return: bool
29
+ def over_auto_compact_threshold?: () -> bool
30
+
27
31
  def to_h: () -> Hash[Symbol, untyped]
28
32
  end
29
33
  end
@@ -12,14 +12,20 @@ module Ruboty
12
12
 
13
13
  attr_reader input_schema: Hash[untyped, untyped]?
14
14
 
15
- attr_reader on_call: (^(Hash[String, untyped]) -> String)?
15
+ attr_reader silent: boolish
16
+
17
+ attr_reader on_call: (^(Hash[String, untyped]) -> String?)?
16
18
 
17
19
  # @rbs name: String
18
20
  # @rbs title: String
19
21
  # @rbs description: String
20
22
  # @rbs input_schema: Hash[untyped, untyped]?
21
- # @rbs &on_call: ? (Hash[String, untyped]) -> String
22
- def initialize: (name: String, title: String, description: String, input_schema: Hash[untyped, untyped]?) ?{ (Hash[String, untyped]) -> String } -> void
23
+ # @rbs ?silent: boolish?
24
+ # @rbs &on_call: ? (Hash[String, untyped]) -> String?
25
+ def initialize: (name: String, title: String, description: String, input_schema: Hash[untyped, untyped]?, ?silent: untyped) ?{ (Hash[String, untyped]) -> String? } -> void
26
+
27
+ # Returns true if the tool should be called silently (without notifying the user).
28
+ def silent?: () -> boolish
23
29
 
24
30
  def call: (untyped params) -> String?
25
31
  end
@@ -0,0 +1,52 @@
1
+ # Generated from lib/ruboty/ai_agent/tool_definitions/base.rb with RBS::Inline
2
+
3
+ module Ruboty
4
+ module AiAgent
5
+ module ToolDefinitions
6
+ # Base class for tool definitions
7
+ # @abstract
8
+ class Base
9
+ type input_schema = Hash[String | Symbol, untyped]
10
+
11
+ def self.tool_name: () -> String?
12
+
13
+ def self.tool_name=: (String) -> String
14
+
15
+ def self.tool_title: () -> String?
16
+
17
+ def self.tool_title=: (String) -> String
18
+
19
+ def self.tool_description: () -> String?
20
+
21
+ def self.tool_description=: (String) -> String
22
+
23
+ def self.tool_input_schema: () -> input_schema?
24
+
25
+ def self.tool_input_schema=: (input_schema) -> input_schema
26
+
27
+ def tool_name: () -> String
28
+
29
+ def tool_title: () -> String
30
+
31
+ def tool_description: () -> String
32
+
33
+ def tool_input_schema: () -> input_schema
34
+
35
+ # Return true if you want the tool not to produce call logs in the chat.
36
+ def silent?: () -> boolish
37
+
38
+ attr_reader request: Request
39
+
40
+ # @rbs request: Request
41
+ def initialize: (request: Request) -> untyped
42
+
43
+ # @abstract
44
+ # @rbs arguments: Hash[String, untyped]
45
+ # @rbs return: String?
46
+ def call: (Hash[String, untyped] arguments) -> String?
47
+
48
+ def to_tool: () -> Tool
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,17 @@
1
+ # Generated from lib/ruboty/ai_agent/tool_definitions/think.rb with RBS::Inline
2
+
3
+ module Ruboty
4
+ module AiAgent
5
+ module ToolDefinitions
6
+ # Tool
7
+ class Think < Base
8
+ # @rbs arguments: Hash[String, untyped]
9
+ # @rbs return: String?
10
+ def call: (Hash[String, untyped] arguments) -> String?
11
+
12
+ # @rbs override
13
+ def silent?: ...
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # Generated from lib/ruboty/ai_agent/tool_definitions.rb with RBS::Inline
2
+
3
+ module Ruboty
4
+ module AiAgent
5
+ # Tool Definitions for AI Agent
6
+ module ToolDefinitions
7
+ # @rbs request: Request
8
+ # @rbs return: Array[Base]
9
+ def self.builtins: (request: Request) -> Array[Base]
10
+ end
11
+ end
12
+ end
@@ -30,6 +30,10 @@ module Ruboty
30
30
  # @rbs %a{memorized}
31
31
  %a{memorized}
32
32
  def mcp_tools_caches: () -> UserMcpToolsCaches
33
+
34
+ # @rbs %a{memorized}
35
+ %a{memorized}
36
+ def prompt_command_definitions: () -> UserPromptCommandDefinitions
33
37
  end
34
38
  end
35
39
  end
@@ -46,12 +46,14 @@ module Ruboty
46
46
  # @rbs return: untyped
47
47
  def cleanup_session: () -> untyped
48
48
 
49
- private
50
-
51
49
  # @rbs return: McpConfiguration
52
50
  def configuration: () -> McpConfiguration
53
51
 
52
+ private
53
+
54
+ # @rbs %a{memorized}
54
55
  # @rbs return: HttpMcpClient
56
+ %a{memorized}
55
57
  def mcp_client: () -> HttpMcpClient
56
58
  end
57
59
  end
@@ -0,0 +1,12 @@
1
+ # Generated from lib/ruboty/ai_agent/user_prompt_command_definitions.rb with RBS::Inline
2
+
3
+ module Ruboty
4
+ module AiAgent
5
+ # User-defined commands record set
6
+ class UserPromptCommandDefinitions < UserAssociations[PromptCommandDefinition]
7
+ # @rbs command: PromptCommandDefinition
8
+ # @rbs return: PromptCommandDefinition
9
+ def add: (PromptCommandDefinition command) -> PromptCommandDefinition
10
+ end
11
+ end
12
+ end