ask-tools 0.2.6 → 0.4.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: 10504b125a562dba192ed5c432608b54e3140ea5f38822e5e045a1f8546f7609
4
- data.tar.gz: afd13e8a2a242e095ac71bc7c9f02cac14931e3966664dd6e3a88995869f6840
3
+ metadata.gz: 0e0b16a246eee9282788e5ec82210cacc6a507d83591645aca2ce87d17e0e129
4
+ data.tar.gz: 546cf192269daacbbf48e7e1fe4a188ad42d3e5f8e9e50ccaeb3d96ca24803be
5
5
  SHA512:
6
- metadata.gz: 1bdeed01d810365cb450ec8548ee6815718e51df479de5f8ef9ea6105cfd97ce31e872eaec98b93e4be36ac67368dcaf726b96b343fa7d393d42dcb73cb5c9cd
7
- data.tar.gz: b9ed6b94f72cd3ec96a18faac67ae85e9f4593859069f216632d8a8f78111b432680ca8bbc19f736f4ed5c0976b913d9b2afdeb6ec2ed46e88516e859db9b57e
6
+ metadata.gz: 9b6cab4332f8f76e36ccfe1024976578d739258125cdad49567cc9eb0ab21334bff1b28a5c61aee3bdaf21d375e9ac5d78ae2f248f717b1d6c942a0d75b8a51c
7
+ data.tar.gz: 9a08ac4432817ceb9917f1490a2e1b5c0905609feac8181b9de4404097c1b366b185cd653315e116cf658a655ee48089dec662ce1e5b611024feb0fcde4f2660
data/CHANGELOG.md CHANGED
@@ -1,3 +1,61 @@
1
+ ## [0.4.0] — 2026-07-26
2
+
3
+ ### Added
4
+
5
+ - **`name` class DSL for custom tool names** — tools can now declare a
6
+ custom name with `name "my_tool"` at the class level instead of
7
+ overriding `def name`. The class method safely shadows `Module#name`
8
+ by detecting arguments: `ClassName.name` returns the Ruby class path,
9
+ `name "foo"` sets the tool name. Instance `#name` returns the custom
10
+ name if set, otherwise auto-derives from the class name.
11
+
12
+ ### Removed
13
+
14
+ - **`Ask::Tools::SubAgent`** — removed in favor of `Ask::Agent::SubAgent`
15
+ in ask-agent v0.18.0. Sub-agent delegation now lives in the agent
16
+ runtime where it can automatically build sessions.
17
+
18
+ ## [0.3.0] — 2026-07-26
19
+
20
+ ### Added
21
+
22
+ - **`Ask::Tools::SubAgent` — delegate tasks to a specialized sub-agent tool**.
23
+ An `Ask::Tool` subclass that wraps a runner callable. When the LLM calls it,
24
+ the sub-agent runs independently with its own model, tools, and instructions.
25
+
26
+ The tool supports per-instance `name:` and `description:` overrides so that
27
+ multiple sub-agents can coexist in the same tool list with distinct identities.
28
+
29
+ ```ruby
30
+ search = Ask::Tools::SubAgent.new(
31
+ name: "web_search",
32
+ description: "Search the web for current information",
33
+ runner: ->(task) {
34
+ Ask::Agent::Session.new(model: "gpt-4o-mini", tools: [Search])
35
+ .run(task).to_s
36
+ }
37
+ )
38
+ ```
39
+
40
+ ### Fixed
41
+
42
+ - **Tool discovery no longer breaks on tools with required constructor args**.
43
+ `Ask::Tools::SubAgent` makes its `runner:` parameter optional so that tool
44
+ discovery (which instantiates via `klass.new`) works without error. An
45
+ unconfigured SubAgent returns a clear error message at call time.
46
+
47
+ ## [0.2.6] — 2026-07-18
48
+
49
+ ### Fixed
50
+
51
+ - **`Tool#call` filters `_abort_controller` before passing to `execute`** — The internal `_abort_controller` key was being passed as a keyword argument to tool `execute` methods. Tools with explicit keyword arguments (e.g., `def execute(title:, extraction_scope:)`) crashed with `ArgumentError: unknown keyword` because they didn't accept `_abort_controller`. Now filtered before the `execute(**kwargs)` call.
52
+
53
+ ## [0.2.5] — 2026-07-18
54
+
55
+ ### Fixed
56
+
57
+ - **`Tool#normalize_args` parses JSON string arguments from LLMs** — Tool call arguments arrive as JSON strings from the LLM, but `normalize_args` only handled Hash arguments. JSON strings were silently ignored, returning an empty args hash and causing "missing required parameters" errors. Now parses JSON strings before normalizing keys to symbols.
58
+
1
59
  ## [0.2.4] - 2026-06-25
2
60
 
3
61
  ### Changed
@@ -20,6 +20,7 @@ module Ask
20
20
  subclass.instance_variable_set(:@description, nil)
21
21
  subclass.instance_variable_set(:@parameters, {})
22
22
  subclass.instance_variable_set(:@params_schema_definition, nil)
23
+ subclass.instance_variable_set(:@tool_name, nil)
23
24
  end
24
25
 
25
26
  def description(text = nil)
@@ -28,6 +29,18 @@ module Ask
28
29
  end
29
30
  alias desc description
30
31
 
32
+ # Declare a custom tool name.
33
+ # Called with no argument returns the class name (via Module#name).
34
+ # Called with a string stores a custom name for the instance.
35
+ # Example: name "my_custom_tool"
36
+ def name(custom = :_no_arg_given)
37
+ if custom == :_no_arg_given
38
+ super() # Module#name, returns the Ruby class path
39
+ else
40
+ @tool_name = custom
41
+ end
42
+ end
43
+
31
44
  def param(name, type:, desc: nil, description: nil, required: true)
32
45
  type = type.to_s.downcase.to_sym
33
46
  validate_param_type!(type, name)
@@ -115,6 +128,9 @@ module Ask
115
128
  end
116
129
 
117
130
  def name
131
+ custom = self.class.instance_variable_get(:@tool_name)
132
+ return custom if custom
133
+
118
134
  klass_name = self.class.name.to_s.split("::").last || ""
119
135
  normalized = klass_name.dup.force_encoding("UTF-8").unicode_normalize(:nfkd)
120
136
  normalized.encode("ASCII", replace: "")
data/lib/ask/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Tools
5
- VERSION = "0.2.6"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto