ask-tools 0.2.0 → 0.2.2

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: 7672f4d067288ae4d37530eb3884b818355d6a3aeaaefc14594224e7c4794b9d
4
- data.tar.gz: fe3d5ba56939e98775c4e80edec495d40d14fb8bd6d71b2d594d9a3484fc0d13
3
+ metadata.gz: fddd3e7a3998f538e21fddf3f9323ec7b969a897db7ecee939f5e5c19fef7531
4
+ data.tar.gz: 4646d45de5d280fc9679d2d0602e5d0ba1af40e5b130e65746c9cf119ab12010
5
5
  SHA512:
6
- metadata.gz: '08a09910d9ace8bbdb32640e3049e30bbefb8fd6a18ea4594f000441b71029815ad0bf9ef22e2ef0c9da727de29f2f1ee3d3aa99f6ac1162a6a7987270384b2e'
7
- data.tar.gz: dc70926d230847a1a6d114986c8042cc8a91fc7f9ce448b0354d19f6d613906287ff0fd777d0dd737ade6e5fcf693376a8ab4125e6b7102c703bc681a24ede35
6
+ metadata.gz: a6193699fc8993e5c3d9ba529af162744237b16234ea5ffb8aa3e35563b3b8ad605b01ba1b223c4ceb8ffb4a7ba500addad2efc6a817e787506c54dd4b7ebf75
7
+ data.tar.gz: 8352c90b852053fd97e5470d9e1d207c1ddbdc2d3f7b4b1db42ac399ec530aed51a5baedc35503dabcf0a7452ee27a6267900c4d34f251e25f2f481f803c5b87
data/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ ## [0.2.2] - 2026-06-23
2
+
3
+ ### Fixed
4
+
5
+ - Added `ask-schema` as a runtime dependency in gemspec. The `tool.rb` already
6
+ required `ask-schema` but it wasn't declared, causing `LoadError` for consumers
7
+ installing from Rubygems without local path resolution.
8
+
9
+ ## [0.2.0] - 2026-06-21
10
+
11
+ ### Added
12
+
13
+ - Gemspec metadata for Rubygems discovery
14
+ - CHANGELOG.md included in gem files list
15
+
16
+ # Changelog
17
+
18
+ All notable changes to this project will be documented in this file.
19
+
20
+ ## [0.1.0] - 2026-06-09
21
+
22
+ ### Added
23
+
24
+ - `Ask::Tool` base class with DSL for declaring `description` and `param`
25
+ - Auto-derived tool names from class names (CamelCase → snake_case, strips `_tool`)
26
+ - `Ask::Result` value object with `ok?`, `output`, `error`, `metadata` and factory methods `ok(data:)`, `error(message:)`
27
+ - JSON Schema generation via `params_schema` and `tool_definition` for LLM function-calling APIs
28
+ - `Ask::Tools` module for tool registration, auto-discovery via `ObjectSpace`, and name-based lookup
29
+ - `Ask::Tool::Halt` for stopping conversation loops
30
+ - `Ask::Tool::Parameter` value object for parameter metadata
31
+ - Comprehensive test suite with 54+ tests using Minitest and Mocha
32
+
33
+ ## [0.1.3] - 2026-06-18
34
+
35
+ ### Added
36
+
37
+ - Class-level `params_schema` method mirroring the instance method. `ToolDef.from_tool`
38
+ calls `tool.params_schema` on the object it receives, which may be a Class (not an
39
+ instance). The instance method existed but there was no class-level equivalent,
40
+ causing `NoMethodError: undefined method 'params_schema' for class` when dynamic
41
+ tool classes were passed directly to `ToolDef.from_tool`.
42
+
43
+ ### Tests
44
+
45
+ - Added `tool_schema_test.rb` (8 tests, 27 assertions) covering class-level
46
+ `params_schema` for the params DSL, hash schema, empty schema, instance/class
47
+ equivalence, dynamic tool classes, and parameter metadata.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ask-tools
2
2
 
3
- The foundational gem for the ask-rb ecosystem. Defines `Ask::Tool` — the base class every tool inherits from — along with `Ask::Result` (standardized return value), tool discovery/registration, and a scaffold generator. **Zero external dependencies.**
3
+ The foundational gem for the ask-rb ecosystem. Defines `Ask::Tool` — the base class every tool inherits from — along with `Ask::Result` (standardized return value), tool discovery/registration, and a scaffold generator.
4
4
 
5
5
  This gem does **not** ship any executable tools. It only provides the contract that tool gems (e.g., `ask-tools-shell`, `ask-tools-filesystem`) implement.
6
6
 
@@ -40,6 +40,15 @@ module Ask
40
40
  new(ok: true, output: data, error: nil, metadata: metadata)
41
41
  end
42
42
 
43
+ # Create a failed result (positional message form, used by Tool#call).
44
+ #
45
+ # @param message [String] description of the failure
46
+ # @param metadata [Hash] optional metadata
47
+ # @return [Ask::Result]
48
+ def self.failure(message, metadata: {})
49
+ new(ok: false, output: nil, error: message, metadata: metadata)
50
+ end
51
+
43
52
  # Create a failed result.
44
53
  #
45
54
  # @param message [String] description of the failure
@@ -114,7 +114,7 @@ module Ask
114
114
  end
115
115
 
116
116
  def name
117
- klass_name = self.class.name.to_s || ""
117
+ klass_name = self.class.name.to_s.split("::").last || ""
118
118
  normalized = klass_name.dup.force_encoding("UTF-8").unicode_normalize(:nfkd)
119
119
  normalized.encode("ASCII", replace: "")
120
120
  .gsub(/[^a-zA-Z0-9_-]/, "-")
@@ -138,15 +138,15 @@ module Ask
138
138
  return Ask::Result.failure(validation) if validation
139
139
  normalized[:_abort_controller] = abort_controller if abort_controller
140
140
  execute(**normalized)
141
- rescue Halt => e
142
- Ask::Result.ok(data: e.content, metadata: { halted: true })
143
- rescue StandardError => e
144
- Ask::Result.failure("#{self.class.name.split('::').last} raised #{e.class}: #{e.message}")
145
- end
141
+ rescue Halt => e
142
+ Ask::Result.ok(data: e.content, metadata: { halted: true })
143
+ rescue StandardError => e
144
+ Ask::Result.failure("#{self.class.name.split('::').last} raised #{e.class}: #{e.message}")
145
+ end
146
146
 
147
147
  def execute(**args)
148
- raise NotImplementedError, "#{self.class} must implement #execute(**args)"
149
- end
148
+ raise NotImplementedError, "#{self.class} must implement #execute(**args)"
149
+ end
150
150
 
151
151
  def params_schema
152
152
  return @params_schema if defined?(@params_schema)
data/lib/ask/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Tools
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.2"
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.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -9,6 +9,20 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ask-schema
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0.1'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0.1'
12
26
  - !ruby/object:Gem::Dependency
13
27
  name: minitest
14
28
  requirement: !ruby/object:Gem::Requirement
@@ -51,14 +65,14 @@ dependencies:
51
65
  - - "~>"
52
66
  - !ruby/object:Gem::Version
53
67
  version: '13.0'
54
- description: Defines Ask::Tool (base class), Ask::Result, and tool discovery. Zero
55
- dependencies.
68
+ description: Defines Ask::Tool (base class), Ask::Result, and tool discovery.
56
69
  email:
57
70
  - kaka@myrrlabs.com
58
71
  executables: []
59
72
  extensions: []
60
73
  extra_rdoc_files: []
61
74
  files:
75
+ - CHANGELOG.md
62
76
  - LICENSE
63
77
  - README.md
64
78
  - lib/ask-tools.rb
@@ -69,7 +83,10 @@ files:
69
83
  homepage: https://github.com/ask-rb/ask-tools
70
84
  licenses:
71
85
  - MIT
72
- metadata: {}
86
+ metadata:
87
+ homepage_uri: https://github.com/ask-rb/ask-tools
88
+ source_code_uri: https://github.com/ask-rb/ask-tools
89
+ changelog_uri: https://github.com/ask-rb/ask-tools/blob/master/CHANGELOG.md
73
90
  rdoc_options: []
74
91
  require_paths:
75
92
  - lib