ask-agent 0.40.0 → 0.40.1

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: 969e484bfb85499a953c458a677564c9e0419066dcb931d12f451d0297b1c355
4
- data.tar.gz: 3f13c4c60d09bfe2918f2bd974cb90c82f06224f492575e52a0e8f8aea1ebac4
3
+ metadata.gz: fc746aec7332db80fcb221115ccfd9500e08732e06c3f259a03071f3205acec7
4
+ data.tar.gz: f8df48168f2c426e33a4aa551c42f6873ca8b8c1be71e068f92dc52ef57fd71f
5
5
  SHA512:
6
- metadata.gz: 3ee591ac269d606a3b8c07e1ea8dee3407174351efcf7fe45fd2972318382feac61be8175bd9110d4307fcef67bade241fd991ebb121711dae569bd831c08e60
7
- data.tar.gz: debc87ce3557c9e40883078958fa2614b1c136ae7bd703512f8faa052b865586ccba4d69aab0eed9cb6e4ebc27537724d4bf95a6d5f0bcbb785b92f91861f676
6
+ metadata.gz: 69ece3fa1915a561bf49e9f02add16f3ed3213891b0278b43a6e30637993b7a9a55bef076a21ba6ff70b31a58d96a2f60af17f2838a7c0cded0f6cbe0838834c
7
+ data.tar.gz: 52b2e66cfa2f1fbf7f21028fdb82d38555668e9e4f0517d84884943d304fc7bf0622f4117853e6bed8d7191a98a86c272540a6bfab2883a4c5424d4ba370c267
@@ -32,18 +32,24 @@ module Ask
32
32
  # @param tools [Array<Object>]
33
33
  # @return [String, nil] why the call is repairable, or nil when it is
34
34
  # well-formed and executable
35
+ # Why a call is invalid, in a form the model can act on. This is
36
+ # schema-aware: the tool's own validation names what was expected
37
+ # ("unknown parameters: :titile — expected: :project_id, :title"),
38
+ # so the model corrects the call instead of guessing.
35
39
  def self.repair_info(tool_call, tools)
36
- unless tools.any? { |t| t.respond_to?(:name) && t.name == tool_call.name }
37
- return "unknown tool '#{tool_call.name}'"
38
- end
39
-
40
- args = tool_call.arguments
41
- return nil if args.is_a?(Hash)
42
-
43
- parsed = JSON.parse(args.to_s)
44
- return nil if parsed.is_a?(Hash)
45
-
46
- "arguments must be a JSON object, got #{parsed.class}"
40
+ tool = tools.find { |t| t.respond_to?(:name) && t.name == tool_call.name }
41
+ return "unknown tool '#{tool_call.name}'" unless tool
42
+
43
+ parsed =
44
+ if tool_call.arguments.is_a?(Hash)
45
+ tool_call.arguments
46
+ else
47
+ JSON.parse(tool_call.arguments.to_s)
48
+ end
49
+ return "arguments must be a JSON object, got #{parsed.class}" unless parsed.is_a?(Hash)
50
+ return nil unless tool.respond_to?(:validate)
51
+
52
+ tool.validate(parsed.transform_keys(&:to_sym))
47
53
  rescue JSON::ParserError => e
48
54
  "arguments are not valid JSON: #{e.message}"
49
55
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- VERSION = "0.40.0"
5
+ VERSION = "0.40.1"
6
6
  end
7
7
  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.40.0
4
+ version: 0.40.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: '0.1'
60
+ version: 0.6.1
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: '0.1'
67
+ version: 0.6.1
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: ask-skills
70
70
  requirement: !ruby/object:Gem::Requirement
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  - !ruby/object:Gem::Version
241
241
  version: '0'
242
242
  requirements: []
243
- rubygems_version: 4.0.3
243
+ rubygems_version: 4.0.18
244
244
  specification_version: 4
245
245
  summary: Agent runtime for the ask-rb ecosystem
246
246
  test_files: []