miniswen 0.1.0 → 0.1.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: 99de907d5cc25cf759dbb852524640a483d0309a3888280610fc7b00f9458276
4
- data.tar.gz: de18cbf7498073d325c3662995246413c0bb31c7179aae5387ad14182468ecf6
3
+ metadata.gz: bb5fbfedca4b31172aef07b9e91d33d61e7e8ca474cd9be98d16a31a5efba2e4
4
+ data.tar.gz: '0613596bc140445d84d4ceea5a64ed68cfbcbf9d7fffd8bcdbe762f9dddf4c71'
5
5
  SHA512:
6
- metadata.gz: fbb77f636def6357cc32cc15a054b5e7b055efe05c628724f81666c11e4ba6c58fe1e7a22e425711557c92ff194126503f903350acaca77ae785228ca9098fe5
7
- data.tar.gz: 0f10cfd67e29ee14350e0a2251bb16d187ce8fbc724a18ca469565cdf3a408b89b30a0d8daabf1bfceed9340ba26419e8ada78f05530e3bf9b283d692d68846a
6
+ metadata.gz: b2c9e9653f84eeaad53ff560b4396511be725126933370f440c10df2bad4c628c4a246e5d1ad8155dad6aa0ee8004a45b0ca2cadfa13d89555ca872da4a5dfb8
7
+ data.tar.gz: 3712d6ba7f8b4db262d31b9a19c12ee650dab10494dc72a13bc282d008eb47757482bab2bc8a95ab1be46f14055ce1599ec5b6967c9795a17eabd4284f38685e
@@ -400,7 +400,14 @@ module Miniswen
400
400
  error = +""
401
401
  error << "Unknown tool '#{call[:name]}'." if call[:name] != "bash"
402
402
  arguments = call[:arguments]
403
- error << "Missing 'command' argument in bash tool call." unless arguments.is_a?(Hash) && arguments["command"]
403
+ if !arguments.is_a?(Hash) || !arguments["command"]
404
+ error << "Missing 'command' argument in bash tool call."
405
+ elsif arguments["command"].to_s.include?("\0")
406
+ # Process.spawn rejects strings with NUL bytes, so the command could
407
+ # never reach a shell.
408
+ error << "The 'command' argument contains a null byte (\\x00) and cannot be executed. " \
409
+ "Resend the command without null bytes."
410
+ end
404
411
  return error unless error.empty?
405
412
  end
406
413
  nil
@@ -497,7 +504,9 @@ module Miniswen
497
504
  )
498
505
  payload(response)
499
506
  rescue RubyLLM::Error => e
500
- raise InfrastructureError, "miniswen: the model call failed: #{e.message}"
507
+ body = e.response&.body.to_s
508
+ detail = body.empty? ? e.message : "#{e.message}: #{body[0, 1000]}"
509
+ raise InfrastructureError, "miniswen: the model call failed: #{detail}"
501
510
  rescue Faraday::SSLError, Faraday::ConnectionFailed, Faraday::TimeoutError => e
502
511
  raise InfrastructureError, "miniswen: the model call failed: #{e.class}: #{e.message}"
503
512
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Miniswen
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miniswen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Svyatoslav Kryukov