ask-agent 0.27.1 → 0.28.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: f1728d64a66438d1ff5ed51490420b7f9f87d806fc8a5bd98317d9c4de44e68e
4
- data.tar.gz: 2172947edba0c5a906ebdc01643eaa0adda23d1405d22dcb0dd5a662c71e4944
3
+ metadata.gz: 36e26d74ffa1c3e3e97b8e172f4fef2ada07c1c194488a8f550e8b77b7473ee1
4
+ data.tar.gz: 82568a4cc3ed19617293416d10f2f3194c1a18079a1426431a2d878afee75fa0
5
5
  SHA512:
6
- metadata.gz: cb6be0c48b35c3b7e68ba73edc98fbe9209ffcdc58ee2a7524dd12ea0d3202b0d62397f449579d4b8154b97876cfc57da1031eb004a02fb25c61765b11e764bd
7
- data.tar.gz: e2d4f5c8fa6808c0d1e73e9d237c56d8e48fb4bc8630b9bf0feb89309bab872a1bca8a42d603030dafadeeb30d203e35e413a533dded5d3a9086e8b8031ef3fc
6
+ metadata.gz: cfd202f83bb95e3349282c3771e591f93062976b58c964d65e928e09a6408818ef969200c10b68c4a307e0c0d9fabde112aaf20b9776110a5040590370ecd317
7
+ data.tar.gz: 7d3ae82b872659e9e27217bc98cf7dfffee28f5209ee5f351dcc944564a63a777888fdad780de218956019d38f223996ebd6372c7be84cf33fdbf9a1eeb4e5a7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## [0.28.0] — 2026-08-06
2
+
3
+ ### Changed (breaking)
4
+
5
+ - **`Ask::Agent::Extensions` is now `Ask::Agent::Policies`.** The
6
+ tool-lifecycle policy classes — `ApprovalPolicy`, `Permissions`,
7
+ `RateLimiter`, `AuditLog` — moved from `lib/ask/agent/extensions/` to
8
+ `lib/ask/agent/policies/` and are namespaced under `Ask::Agent::Policies`.
9
+ The folder is now named after its seam (like `middleware`,
10
+ `stream_transforms`, `persistence`) instead of "extra stuff".
11
+ `Ask::Agent.load_extensions` → `Ask::Agent.load_policies`.
12
+ Update references: `Ask::Agent::Extensions::X` → `Ask::Agent::Policies::X`.
13
+
14
+ **What this means for the taxonomy:** policies are opt-in, replaceable
15
+ implementations of the tool-lifecycle hook seam — the agent loop runs
16
+ without them, and users can swap in their own implementations. Core
17
+ mechanisms are unchanged and stay on `Session`: the approval queue, the
18
+ `:pending` result status, and the `approval: true` option are core;
19
+ `Policies::ApprovalPolicy` is the reference classification policy wired on
20
+ top of them.
21
+
22
+ ### Added
23
+
24
+ - **`Ask::Agent.load_policies`** — replaces `load_extensions` (same
25
+ behavior: eagerly requires every policy in the policies directory).
26
+
1
27
  ## [0.27.1] — 2026-08-06
2
28
 
3
29
  ### Fixed
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- module Extensions
5
+ module Policies
6
6
  # Approval policy hook: classifies tool calls as approval-required and
7
7
  # routes them into an {Ask::Agent::ApprovalQueue}.
8
8
  #
@@ -15,7 +15,7 @@ module Ask
15
15
  #
16
16
  # @example
17
17
  # queue = Ask::Agent::ApprovalQueue.new
18
- # policy = Ask::Agent::Extensions::ApprovalPolicy.new(queue: queue)
18
+ # policy = Ask::Agent::Policies::ApprovalPolicy.new(queue: queue)
19
19
  # session = Ask::Agent::Session.new(
20
20
  # model: "gpt-4o",
21
21
  # tools: [SendEmail],
@@ -3,7 +3,7 @@ require "time"
3
3
 
4
4
  module Ask
5
5
  module Agent
6
- module Extensions
6
+ module Policies
7
7
  class AuditLog
8
8
  # ActiveRecord adapter for the audit log.
9
9
  # Auto-creates the +ask_audit_logs+ table on first write using
@@ -5,7 +5,7 @@ require "time"
5
5
 
6
6
  module Ask
7
7
  module Agent
8
- module Extensions
8
+ module Policies
9
9
  # Event-driven audit log for agent sessions.
10
10
  #
11
11
  # Subscribes to all session events and writes them to a configurable
@@ -93,16 +93,16 @@ module Ask
93
93
 
94
94
  case adapter
95
95
  when :active_record
96
- require "ask/agent/extensions/audit_log/active_record_writer"
96
+ require "ask/agent/policies/audit_log/active_record_writer"
97
97
  AuditLog::ActiveRecordWriter.new
98
98
  when Hash
99
99
  resolve(adapter[:adapter] || adapter[:writer])
100
100
  when Symbol, String
101
101
  # Try to load adapter by convention:
102
- # :active_record → ask/agent/extensions/audit_log/active_record_writer
102
+ # :active_record → ask/agent/policies/audit_log/active_record_writer
103
103
  name = adapter.to_s
104
104
  begin
105
- require "ask/agent/extensions/audit_log/#{name}_writer"
105
+ require "ask/agent/policies/audit_log/#{name}_writer"
106
106
  klass_name = name.split("_").map(&:capitalize).join
107
107
  klass = AuditLog.const_get(klass_name)
108
108
  klass.new
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- module Extensions
5
+ module Policies
6
6
  class Permissions
7
7
  DEFAULT_TOOLS = %i[write edit bash destroy].freeze
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- module Extensions
5
+ module Policies
6
6
  class RateLimiter
7
7
  def initialize(max_calls_per_minute: 20, max_tool_calls_per_turn: 5)
8
8
  @max_calls_per_minute = max_calls_per_minute
@@ -421,7 +421,7 @@ module Ask
421
421
  def build_audit_log(config)
422
422
  config ||= Ask::Agent.configuration.audit_log
423
423
  return nil unless config
424
- Ask::Agent::Extensions::AuditLog.new(self, adapter: config)
424
+ Ask::Agent::Policies::AuditLog.new(self, adapter: config)
425
425
  end
426
426
 
427
427
  # Build the approval queue + policy when approval is enabled.
@@ -451,7 +451,7 @@ module Ask
451
451
  )
452
452
  end
453
453
 
454
- policy = Ask::Agent::Extensions::ApprovalPolicy.new(
454
+ policy = Ask::Agent::Policies::ApprovalPolicy.new(
455
455
  queue: queue,
456
456
  require_approval: policy_opts[:require_approval],
457
457
  tools: @tools
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- VERSION = "0.27.1"
5
+ VERSION = "0.28.0"
6
6
  end
7
7
  end
data/lib/ask/agent.rb CHANGED
@@ -21,11 +21,20 @@ module Ask
21
21
 
22
22
  class UnknownAgent < Error; end
23
23
 
24
- module Extensions
25
- autoload :Permissions, "ask/agent/extensions/permissions"
26
- autoload :RateLimiter, "ask/agent/extensions/rate_limiter"
27
- autoload :AuditLog, "ask/agent/extensions/audit_log"
28
- autoload :ApprovalPolicy, "ask/agent/extensions/approval_policy"
24
+ # Policies are opt-in, replaceable implementations of the tool-lifecycle
25
+ # hook seam (before_tool / after_tool). The agent loop runs without them
26
+ # and their semantics are unchanged by their absence; users compose and
27
+ # swap them freely (see Ask::Agent::Hooks for the seam).
28
+ #
29
+ # A policy is NOT core machinery. Core mechanisms live on Session — the
30
+ # approval queue, the :pending result status, and the `approval: true`
31
+ # option are core; Policies::ApprovalPolicy is the reference
32
+ # classification policy wired on top of them.
33
+ module Policies
34
+ autoload :Permissions, "ask/agent/policies/permissions"
35
+ autoload :RateLimiter, "ask/agent/policies/rate_limiter"
36
+ autoload :AuditLog, "ask/agent/policies/audit_log"
37
+ autoload :ApprovalPolicy, "ask/agent/policies/approval_policy"
29
38
  end
30
39
 
31
40
  module Middleware
@@ -236,8 +245,8 @@ module Ask
236
245
  yield configuration
237
246
  end
238
247
 
239
- def self.load_extensions
240
- Dir[File.expand_path("agent/extensions/*.rb", __dir__)].each { |f| require f }
248
+ def self.load_policies
249
+ Dir[File.expand_path("agent/policies/*.rb", __dir__)].each { |f| require f }
241
250
  rescue Errno::ENOENT
242
251
  end
243
252
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.27.1
4
+ version: 0.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -174,11 +174,6 @@ files:
174
174
  - lib/ask/agent/definition.rb
175
175
  - lib/ask/agent/evaluator.rb
176
176
  - lib/ask/agent/events.rb
177
- - lib/ask/agent/extensions/approval_policy.rb
178
- - lib/ask/agent/extensions/audit_log.rb
179
- - lib/ask/agent/extensions/audit_log/active_record_writer.rb
180
- - lib/ask/agent/extensions/permissions.rb
181
- - lib/ask/agent/extensions/rate_limiter.rb
182
177
  - lib/ask/agent/hooks.rb
183
178
  - lib/ask/agent/loop.rb
184
179
  - lib/ask/agent/meta_agent.rb
@@ -190,6 +185,11 @@ files:
190
185
  - lib/ask/agent/middleware/retry_on_failure.rb
191
186
  - lib/ask/agent/persistence/base.rb
192
187
  - lib/ask/agent/persistence/in_memory.rb
188
+ - lib/ask/agent/policies/approval_policy.rb
189
+ - lib/ask/agent/policies/audit_log.rb
190
+ - lib/ask/agent/policies/audit_log/active_record_writer.rb
191
+ - lib/ask/agent/policies/permissions.rb
192
+ - lib/ask/agent/policies/rate_limiter.rb
193
193
  - lib/ask/agent/reflector.rb
194
194
  - lib/ask/agent/scheduler.rb
195
195
  - lib/ask/agent/session.rb