ollama_chat 0.0.140 → 0.0.141

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: c1cff963a5116fbe9c1a4a94fff41df7128c5f31c4daaaf96e2a4334c97d77d5
4
- data.tar.gz: 97ec4d9f4f90c71b4bc2eee13f2000bb4f8fb7ad6b9fe308c82342734e3d1629
3
+ metadata.gz: 2e928fba1669bde0639cbaba045d872c71f3630dc5ca2b00fec128dfe1217836
4
+ data.tar.gz: e781850be5059fd1bc79ba476557c49841177ce1965106d538f689b80a7fba70
5
5
  SHA512:
6
- metadata.gz: f1abfdfaab1002d8503a7a72b204ee247f2375df5e6b3de417c483826ad88208ceca28c73921afcdd0b8ec2575e15c4cf9ade009fd7aab99b18a707a9451891f
7
- data.tar.gz: ddd78c34605c7035c0d24e9ba76e59a28edd8a85f2116478b97474e4233fb47077b297134814a3e829abd4af43d343a6ce5ca191a33cc46e174d46664186dbce
6
+ metadata.gz: 2adcab92a8314bf93d0e322e63413321c49a85f1ecd8d6df63a70b32ed5a98bd1df6c5996302c1e2cdd4eed74d4bde4c6213596f3d16ab543c7803b29f94726f
7
+ data.tar.gz: 289d236ebec4be3474931ca20eeeebb8161f57260638cd19f366145fd08eb0be24b261cf1c1037b2c064c5133ca5cf209df39d937125b92903877878865c4cbe
data/CHANGES.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-11-06 v0.0.141
4
+
5
+ ### Improvements
6
+
7
+ - Replaced `Tins::Duration#to_s` with `to_human(style: :abbrev)` in
8
+ `follow_chat.rb`, `session_management.rb`, `tool_call_processor.rb`, and
9
+ `generate_image.rb` to produce compact duration strings (e.g., `45s`,
10
+ `1m30s`) for terminal stats and JSON results.
11
+ - Replaced hand-rolled duration formatting in `compaction.rb` with
12
+ `Tins::Duration#to_human` for compaction TTS reports.
13
+ - Updated `execute_shell` tool description to instruct the LLM to separate
14
+ multi-command scripts with newlines and indentation rather than semicolons
15
+ for improved readability in the review editor.
16
+ - Added an early-return guard in `ToolCallProcessor#handle` to skip tool
17
+ execution when `chat.tools_support.off?`, emitting a `tools_disabled` JSON
18
+ result per tool call to provide proper error feedback to the LLM.
19
+
20
+ ### Fixes
21
+
22
+ - Set `default: false` for `get_time` and `get_location` tools in
23
+ `default_config.yml`, as these values are already injected into runtime info
24
+ each turn, making default enablement redundant.
25
+
26
+ ### Build & CI
27
+
28
+ - Bumped `tins` dependency to **~> 1.62** in `Rakefile` and
29
+ `ollama_chat.gemspec`.
30
+
31
+ ### Testing
32
+
33
+ - Added a spec example in `tool_call_processor_spec.rb` verifying that
34
+ `#handle` returns the expected `tools_disabled` error and message when tool
35
+ support is disabled.
36
+
3
37
  ## 2026-11-02 v0.0.140
4
38
 
5
39
  ### Improvements
data/Rakefile CHANGED
@@ -49,7 +49,7 @@ GemHadar do
49
49
  dependency 'reverse_markdown', '~> 3.0'
50
50
  dependency 'kramdown-ansi', '~> 0.9'
51
51
  dependency 'complex_config', '~> 0.22', '>= 0.22.2'
52
- dependency 'tins', '~> 1.61'
52
+ dependency 'tins', '~> 1.62'
53
53
  dependency 'search_ui', '>= 0.2'
54
54
  dependency 'amatch', '~> 0.4'
55
55
  dependency 'pdf-reader', '~> 2.0'
@@ -322,10 +322,7 @@ module OllamaChat::Compaction
322
322
  Context: #{result.context_before} → #{result.context_after}
323
323
  Stored total: #{result.stored_total}
324
324
  EOT
325
- duration = Tins::Duration.new(duration)
326
- duration_string = duration.format(
327
- duration.minutes? ? '%M minutes and %u seconds' : '%u seconds'
328
- )
325
+ duration_string = Tins::Duration.new(duration).to_human
329
326
  speak(
330
327
  'Compressed conversation context from %.0f percent to %.0f percent in %s.' % [
331
328
  100 * result.context_filled_before,
@@ -245,14 +245,14 @@ class OllamaChat::FollowChat
245
245
  eval_duration = response.eval_duration.to_f / 1e9
246
246
  prompt_eval_duration = response.prompt_eval_duration.to_f / 1e9
247
247
  {
248
- eval_duration: Tins::Duration.new(eval_duration).to_s,
248
+ eval_duration: Tins::Duration.new(eval_duration).to_human(style: :abbrev),
249
249
  eval_count: response.eval_count.to_i,
250
250
  eval_rate: "%.2f t/s" % (response.eval_count.to_i / eval_duration),
251
- prompt_eval_duration: Tins::Duration.new(prompt_eval_duration).to_s,
251
+ prompt_eval_duration: Tins::Duration.new(prompt_eval_duration).to_human(style: :abbrev),
252
252
  prompt_eval_count: response.prompt_eval_count.to_i,
253
253
  prompt_eval_rate: "%.2f t/s" % (response.prompt_eval_count.to_i / prompt_eval_duration),
254
- total_duration: Tins::Duration.new(response.total_duration / 1e9).to_s,
255
- load_duration: Tins::Duration.new(response.load_duration / 1e9).to_s,
254
+ total_duration: Tins::Duration.new(response.total_duration / 1e9).to_human(style: :abbrev),
255
+ load_duration: Tins::Duration.new(response.load_duration / 1e9).to_human(style: :abbrev),
256
256
  }
257
257
  end
258
258
 
@@ -582,10 +582,10 @@ tools:
582
582
  require_confirmation: true
583
583
  get_time:
584
584
  result_display_timeout: 3
585
- default: true
585
+ default: false
586
586
  get_location:
587
587
  result_display_timeout: 3
588
- default: true
588
+ default: false
589
589
  list_directory:
590
590
  default: true
591
591
  require_confirmation: false
@@ -737,7 +737,7 @@ module OllamaChat::SessionManagement
737
737
  elsif selector
738
738
  now = Time.now
739
739
  sessions = session_query.order(Sequel.desc(:updated_at)).map { |session|
740
- duration = session.age(now:)
740
+ duration = session.age(now:).to_human(style: :abbrev)
741
741
  es = session.estimate_tokens
742
742
  count = session.count_messages
743
743
  locked = if pid = session.locked?
@@ -33,6 +33,19 @@ class OllamaChat::ToolCallProcessor
33
33
  def handle(response)
34
34
  return unless response.message.ask_and_send(:tool_calls)
35
35
 
36
+ if chat.tools_support.off?
37
+ response.message.tool_calls.each do |tool_call|
38
+ name = tool_call.function.name
39
+ @results[name] << JSON(
40
+ error: 'tools_disabled',
41
+ message: 'Tool support is disabled. ' \
42
+ 'Ask the user to re-enable with `/tools on`.'
43
+ )
44
+ chat.log(:warn, 'Tool call ignored: tools disabled',
45
+ data: { tool: name })
46
+ end
47
+ return
48
+ end
36
49
  tools_used = {}
37
50
 
38
51
  response.message.tool_calls.each do |tool_call|
@@ -108,7 +121,7 @@ class OllamaChat::ToolCallProcessor
108
121
  warn: ,
109
122
  size: es.bytes_formatted,
110
123
  tokens: es.tokens_formatted,
111
- duration: Tins::Duration.new(Time.now - start).to_s,
124
+ duration: Tins::Duration.new(Time.now - start).to_human(style: :abbrev),
112
125
  }
113
126
  end
114
127
 
@@ -45,6 +45,9 @@ class OllamaChat::Tools::ExecuteShell
45
45
  then a mandatory y/n/i/a confirm prompt gates execution.
46
46
  Answering a remembers the command for the session
47
47
  (skips editor and confirm on repeat).
48
+ For multi-command scripts, separate commands with newlines
49
+ and proper intendation rather than `;` for readability
50
+ in the review editor.
48
51
  Last resort: use ONLY when no dedicated tool covers
49
52
  the task (e.g. `git commit`, `bundle install`, `make`).
50
53
  Prefer `execute_grep`, `list_directory`, `read_file`,
@@ -101,7 +101,7 @@ class OllamaChat::Tools::GenerateImage
101
101
  message: ,
102
102
  url: view_url,
103
103
  prompt: ,
104
- duration: Tins::Duration.new(Time.now - started).to_s,
104
+ duration: Tins::Duration.new(Time.now - started).to_human(style: :abbrev),
105
105
  }.to_json
106
106
  rescue => e
107
107
  chat.log(:error, e, data: { tool: name, prompt: })
@@ -5,7 +5,7 @@
5
5
  # by hand; it is rewritten on every `rake version` invocation.
6
6
  module OllamaChat
7
7
  # The current version of the OllamaChat gem as a String.
8
- VERSION = '0.0.140'
8
+ VERSION = '0.0.141'
9
9
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
10
10
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
11
11
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/ollama_chat.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama_chat 0.0.140 ruby lib
2
+ # stub: ollama_chat 0.0.141 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.140".freeze
6
+ s.version = "0.0.141".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  s.add_runtime_dependency(%q<reverse_markdown>.freeze, ["~> 3.0".freeze])
44
44
  s.add_runtime_dependency(%q<kramdown-ansi>.freeze, ["~> 0.9".freeze])
45
45
  s.add_runtime_dependency(%q<complex_config>.freeze, ["~> 0.22".freeze, ">= 0.22.2".freeze])
46
- s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.61".freeze])
46
+ s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.62".freeze])
47
47
  s.add_runtime_dependency(%q<search_ui>.freeze, [">= 0.2".freeze])
48
48
  s.add_runtime_dependency(%q<amatch>.freeze, ["~> 0.4".freeze])
49
49
  s.add_runtime_dependency(%q<pdf-reader>.freeze, ["~> 2.0".freeze])
@@ -48,4 +48,31 @@ describe OllamaChat::ToolCallProcessor do
48
48
  expect(processor.results).to be_empty
49
49
  end
50
50
  end
51
+
52
+ describe '#handle' do
53
+ let :tool_call do
54
+ double('tool_call', function: double('function', name: 'roll_dice'))
55
+ end
56
+
57
+ let :message do
58
+ double('message', ask_and_send: true, tool_calls: [tool_call])
59
+ end
60
+
61
+ let :response do
62
+ double('response', message:)
63
+ end
64
+
65
+ context 'when tools support is disabled' do
66
+ before do
67
+ allow(chat.tools_support).to receive(:off?).and_return(true)
68
+ end
69
+
70
+ it 'returns a tools_disabled result per tool call without executing' do
71
+ processor.handle(response)
72
+ data = JSON.parse(processor.results['roll_dice'].first)
73
+ expect(data['error']).to eq('tools_disabled')
74
+ expect(data['message']).to include('/tools on')
75
+ end
76
+ end
77
+ end
51
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ollama_chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.140
4
+ version: 0.0.141
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -287,14 +287,14 @@ dependencies:
287
287
  requirements:
288
288
  - - "~>"
289
289
  - !ruby/object:Gem::Version
290
- version: '1.61'
290
+ version: '1.62'
291
291
  type: :runtime
292
292
  prerelease: false
293
293
  version_requirements: !ruby/object:Gem::Requirement
294
294
  requirements:
295
295
  - - "~>"
296
296
  - !ruby/object:Gem::Version
297
- version: '1.61'
297
+ version: '1.62'
298
298
  - !ruby/object:Gem::Dependency
299
299
  name: search_ui
300
300
  requirement: !ruby/object:Gem::Requirement