ask-rails 0.14.0 → 0.15.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d91e3a8bca91cc21042906a20c68483a38ee90c2cf56fb7f5bf93904471b115
4
- data.tar.gz: '09dc7e9f9321381de7152d5757111385dcaf89c66fb70c59de997dae488bc1f0'
3
+ metadata.gz: 59ba33037208fef8912b1943bc2da59f8a726f89d5d06b5a489128e66ab0068d
4
+ data.tar.gz: 2ed8a54baec5bb27c79892430643e1fd035791970c5f784e6af2b9c83c4f5b4a
5
5
  SHA512:
6
- metadata.gz: 68a5ebfc02cb60e684099dab18081fdcff952e764ed10ec96af0121aab8934206a44438f7ab072a66d51ed1d788fa2b2ffe7aea958c3d65200361d245a6e401a
7
- data.tar.gz: f5a34df2706d15ec288790e5861708446b974f94e6985167a9a8d292ea0a29aac6e46ce2c446ae5d305a3598e9d7ac590fc771cdf45febb67b5158e87724f3d5
6
+ metadata.gz: c86ae3b8971c9a7844a89945bd57f87d4cf94af230dbc05ba58163035a1ff99c75b6ae9c36bcd52b48613ee0f702d913262ca4cf90d357d09eb27c6abcca7398
7
+ data.tar.gz: 03bbfcdad570a35fbe36e53e8cf3f91174001f23d30d87fe98e8ee6ab01c7c409064ef019d6baf352397a4ec816e58556258859065145c9056cdfd26a18442ac
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [0.15.0] — 2026-07-30
2
+
3
+ ### Added
4
+
5
+ - **Zeitwerk integration — agent directories are ignored by the autoloader.**
6
+ ask-agent discovers agents, tools, and skills via direct `require`
7
+ (`app/agents/<name>/agent.rb`, `shared/tools/*.rb`, ...). Their class
8
+ names (`SupportBot::Agent`) don't match Zeitwerk's constant mapping
9
+ (`SupportBot::Agent` from `app/agents/support_bot/agent.rb` would be
10
+ expected as `SupportBot::Agent` — ambiguous), so the railtie now tells
11
+ Zeitwerk to ignore every directory under `app/agents/`. Prevents
12
+ `NameError` at eager load in production while keeping development
13
+ discovery intact.
14
+
1
15
  ## [0.14.0] — 2026-07-30
2
16
 
3
17
  ### Notes
data/README.md CHANGED
@@ -45,15 +45,15 @@ Creates the agent directory convention used by ask-agent discovery:
45
45
 
46
46
  ```
47
47
  app/agents/support_bot/
48
- ├── agent.rb # class Agents::SupportBot < ApplicationAgent
48
+ ├── agent.rb # module SupportBot; class Agent < ApplicationAgent
49
49
  ├── instructions.md # auto-loaded as the system prompt
50
50
  └── tools/ # per-agent tools (referenced with `tools :tool_name`)
51
51
  ```
52
52
 
53
53
  ```ruby
54
54
  # app/agents/support_bot/agent.rb
55
- module Agents
56
- class SupportBot < ApplicationAgent
55
+ module SupportBot
56
+ class Agent < ApplicationAgent
57
57
  model "gpt-4o"
58
58
  # tools :search_knowledge_base
59
59
  end
@@ -3,6 +3,20 @@
3
3
  module Ask
4
4
  module Rails
5
5
  class Railtie < ::Rails::Railtie
6
+ # ask-agent discovers agents, tools, and skills itself via direct
7
+ # `require` (app/agents/<name>/agent.rb, shared/tools/*.rb, ...).
8
+ # Zeitwerk must not try to autoload those directories — the class
9
+ # names inside (e.g. `NlOperatorAgent`) don't match the Zeitwerk
10
+ # constant mapping (e.g. `NlOperator::Agent`) and eager loading
11
+ # would raise. Keep the directories out of Zeitwerk entirely.
12
+ initializer "ask_rails.zeitwerk" do |app|
13
+ agents_path = app.root.join("app/agents")
14
+ next unless agents_path.directory?
15
+
16
+ Dir.glob(agents_path.join("*")).each do |entry|
17
+ Rails.autoloaders.main.ignore(entry) if File.directory?(entry)
18
+ end
19
+ end
6
20
  end
7
21
  end
8
22
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Rails
5
- VERSION = "0.14.0"
5
+ VERSION = "0.15.0"
6
6
  end
7
7
  end
@@ -9,8 +9,8 @@
9
9
  # Instructions load automatically from instructions.md next to this file.
10
10
  # Per-agent tools live in tools/ — reference them with `tools :tool_name`.
11
11
  #
12
- module Agents
13
- class <%= class_name %> < ApplicationAgent
12
+ module <%= class_name %>
13
+ class Agent < ApplicationAgent
14
14
  # model "gpt-4o"
15
15
  # provider :openai
16
16
  # max_turns 25
@@ -5,9 +5,11 @@
5
5
  # Subclass this to define agents:
6
6
  #
7
7
  # # app/agents/support_bot/agent.rb
8
- # class SupportBotAgent < ApplicationAgent
9
- # model "gpt-4o"
10
- # tools :search_knowledge_base
8
+ # module SupportBot
9
+ # class Agent < ApplicationAgent
10
+ # model "gpt-4o"
11
+ # tools :search_knowledge_base
12
+ # end
11
13
  # end
12
14
  #
13
15
  # # app/agents/support_bot/instructions.md — auto-loaded as the system prompt
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto