openclacky 0.9.22 → 0.9.23

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: 636621284dfcd7f7329f793bc80f2364f16a2777dedacd2fdf310b2a7f3be58a
4
- data.tar.gz: 5f3a12e563e36445d3aa32ae050f5b759b204325323cac119b8692bea7d3657b
3
+ metadata.gz: e1add81a8b60017ed8ed70e090af57bd68d0dce5670124fab1c13b878e57d21d
4
+ data.tar.gz: 1607062100acf56326e62d75a2fa0599d4eee61686785fceed1e16578c025c6c
5
5
  SHA512:
6
- metadata.gz: 23e59f8ae883ded129b4fee900c0ffdf6cec3ada4bd019e9a0243a3942abc70f5bbc8b9cc4830a34d7e66e22e4c663988295eed972ad1df63247c6f0bdbf1a68
7
- data.tar.gz: 218bd984151af6f087c6ac44f3aa213e19ee30981a1a69484344cdbd00774611465fc3847ecfc0933243e2ae6277792116d96d0aed04b9148a9cfed14f09e14e
6
+ metadata.gz: 3d499b6484f327b0cdcdaaba21019c9a5b314ba73910c03fde7d64be880e365dea1d1a5bd82cdf993647b11e5b749cd667567265897b99d4e5f98678651ea464
7
+ data.tar.gz: f02f3b6317c4971152d055a4b6861d53bf719e8278bc65dd3031a80f718937f93c92add6b589b3c3396589e85d1dca4cf1100a440c65691352b0ab4e273c7f43
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.23] - 2026-04-01
11
+
12
+ ### Improved
13
+ - **API client model parameter propagation**: the Client class now accepts and uses an explicit model parameter, enabling better model detection and API routing across all client instantiation points (CLI, agent, subagent)
14
+ - **Bedrock API detection**: improved detection of Bedrock Converse API usage by checking both API key prefix (ABSK) and model prefix (abs-), providing more robust handling of Bedrock models
15
+
16
+ ### Fixed
17
+ - **CLI -c option model initialization**: fixed a bug where the CLI command with -c option was not passing the model name to the client, causing routing failures for certain providers
18
+
19
+ ### More
20
+ - Rename provider display name to "ClackyAI" for consistency
21
+
10
22
  ## [0.9.22] - 2026-03-31
11
23
 
12
24
  ### Added
data/lib/clacky/agent.rb CHANGED
@@ -131,6 +131,7 @@ module Clacky
131
131
  @client = Clacky::Client.new(
132
132
  @config.api_key,
133
133
  base_url: @config.base_url,
134
+ model: @config.model_name,
134
135
  anthropic_format: @config.anthropic_format?
135
136
  )
136
137
  # Update message compressor with new client and model
@@ -923,6 +924,7 @@ module Clacky
923
924
  subagent_client = Clacky::Client.new(
924
925
  subagent_config.api_key,
925
926
  base_url: subagent_config.base_url,
927
+ model: subagent_config.model_name,
926
928
  anthropic_format: subagent_config.anthropic_format?
927
929
  )
928
930
 
@@ -325,9 +325,9 @@ module Clacky
325
325
  current_model&.dig("anthropic_format") || false
326
326
  end
327
327
 
328
- # Check if current model uses AWS Bedrock API key (ABSK prefix)
328
+ # Check if current model uses Bedrock Converse API (ABSK key prefix or abs- model prefix)
329
329
  def bedrock?
330
- Clacky::MessageFormat::Bedrock.bedrock_api_key?(api_key.to_s)
330
+ Clacky::MessageFormat::Bedrock.bedrock_api_key?(api_key.to_s, model_name.to_s)
331
331
  end
332
332
 
333
333
  # Add a new model configuration
@@ -434,6 +434,8 @@ module Clacky
434
434
  if data.is_a?(Array)
435
435
  # New format: top-level array of model configurations
436
436
  models = data.map do |m|
437
+ # Deep copy to avoid shared references between models
438
+ m = m.dup.transform_values { |v| v.is_a?(String) ? v.dup : v }
437
439
  # Convert old name-based format to new model-based format if needed
438
440
  if m["name"] && !m["model"]
439
441
  m["model"] = m["name"]
data/lib/clacky/cli.rb CHANGED
@@ -84,7 +84,7 @@ module Clacky
84
84
  agent_config.verbose = options[:verbose] if options[:verbose]
85
85
 
86
86
  # Create client for current model
87
- client = Clacky::Client.new(agent_config.api_key, base_url: agent_config.base_url, anthropic_format: agent_config.anthropic_format?)
87
+ client = Clacky::Client.new(agent_config.api_key, base_url: agent_config.base_url, model: agent_config.model_name, anthropic_format: agent_config.anthropic_format?)
88
88
 
89
89
  # Resolve agent profile name from --agent option
90
90
  agent_profile = options[:agent] || "coding"
@@ -137,6 +137,7 @@ module Clacky
137
137
  test_client = Clacky::Client.new(
138
138
  test_config.api_key,
139
139
  base_url: test_config.base_url,
140
+ model: test_config.model_name,
140
141
  anthropic_format: test_config.anthropic_format?
141
142
  )
142
143
 
@@ -162,6 +163,7 @@ module Clacky
162
163
  agent.instance_variable_set(:@client, Clacky::Client.new(
163
164
  config.api_key,
164
165
  base_url: config.base_url,
166
+ model: config.model_name,
165
167
  anthropic_format: config.anthropic_format?
166
168
  ))
167
169
 
@@ -829,6 +831,7 @@ module Clacky
829
831
  Clacky::Client.new(
830
832
  agent_config.api_key,
831
833
  base_url: agent_config.base_url,
834
+ model: agent_config.model_name,
832
835
  anthropic_format: agent_config.anthropic_format?
833
836
  )
834
837
  end
data/lib/clacky/client.rb CHANGED
@@ -8,13 +8,13 @@ module Clacky
8
8
  MAX_RETRIES = 10
9
9
  RETRY_DELAY = 5 # seconds
10
10
 
11
- def initialize(api_key, base_url:, model: nil, anthropic_format: false)
11
+ def initialize(api_key, base_url:, model:, anthropic_format: false)
12
12
  @api_key = api_key
13
13
  @base_url = base_url
14
14
  @model = model
15
15
  @use_anthropic_format = anthropic_format
16
- # Detect Bedrock API key by ABSK prefix overrides anthropic_format routing
17
- @use_bedrock = MessageFormat::Bedrock.bedrock_api_key?(api_key)
16
+ # Detect Bedrock: ABSK key prefix (native AWS) or abs- model prefix (Clacky AI proxy)
17
+ @use_bedrock = MessageFormat::Bedrock.bedrock_api_key?(api_key, model)
18
18
  end
19
19
 
20
20
  # Returns true when the client is using the AWS Bedrock Converse API.
@@ -16,9 +16,12 @@ module Clacky
16
16
  #
17
17
  # This module converts canonical format ↔ Bedrock Converse API format.
18
18
  module Bedrock
19
- # Detect if the API key is an AWS Bedrock API key (ABSK prefix)
20
- def self.bedrock_api_key?(api_key)
21
- api_key.to_s.start_with?("ABSK")
19
+ # Detect if the request should use the Bedrock Converse API.
20
+ # Matches either:
21
+ # - API key with "ABSK" prefix (native AWS Bedrock)
22
+ # - Model ID with "abs-" prefix (Clacky AI proxy that speaks Bedrock Converse)
23
+ def self.bedrock_api_key?(api_key, model)
24
+ api_key.to_s.start_with?("ABSK") || model.to_s.start_with?("abs-")
22
25
  end
23
26
 
24
27
  module_function
@@ -49,13 +49,14 @@ module Clacky
49
49
  }.freeze,
50
50
 
51
51
  "clackyai" => {
52
- "name" => "Clacky AI",
52
+ "name" => "ClackyAI",
53
53
  "base_url" => "https://api.clacky.ai",
54
54
  "api" => "bedrock",
55
- "default_model" => "jp.anthropic.claude-sonnet-4-6",
55
+ "default_model" => "abs-claude-sonnet-4-6",
56
56
  "models" => [
57
- "jp.anthropic.claude-sonnet-4-6",
58
- "jp.anthropic.claude-haiku-4-6"
57
+ "abs-claude-opus-4-6",
58
+ "abs-claude-sonnet-4-6",
59
+ "abs-claude-haiku-4-5"
59
60
  ],
60
61
  "website_url" => "https://clacky.ai"
61
62
  }.freeze
@@ -1571,12 +1571,13 @@ module Clacky
1571
1571
  end
1572
1572
 
1573
1573
  begin
1574
+ model = body["model"].to_s
1574
1575
  test_client = Clacky::Client.new(
1575
1576
  api_key,
1576
1577
  base_url: body["base_url"].to_s,
1578
+ model: model,
1577
1579
  anthropic_format: body["anthropic_format"] || false
1578
1580
  )
1579
- model = body["model"].to_s
1580
1581
  result = test_client.test_connection(model: model)
1581
1582
  if result[:success]
1582
1583
  json_response(res, 200, { ok: true, message: "Connected successfully" })
@@ -80,6 +80,11 @@ module Clacky
80
80
  limit ? sessions.first(limit) : sessions
81
81
  end
82
82
 
83
+ # Return the most recent session for a given working directory, or nil.
84
+ def latest_for_directory(working_dir)
85
+ all_sessions(current_dir: working_dir).first
86
+ end
87
+
83
88
  # Delete sessions not accessed within the given number of days (default: 90).
84
89
  # Returns count of deleted sessions.
85
90
  def cleanup(days: 90)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clacky
4
- VERSION = "0.9.22"
4
+ VERSION = "0.9.23"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openclacky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.22
4
+ version: 0.9.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - windy