ace-llm-providers-cli 0.36.2 → 0.36.3

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: 31bd7e17459ce8d8e8c1bc358819d49fbd919fa5c5fefbfab977d1a4993983c6
4
- data.tar.gz: 47a14679feaea4018e4a437a36ddfb176a9392909db2c4eb68a49e7773927348
3
+ metadata.gz: 4733c90d061027e704b596ac1ac9f3caab0d9288d751b1ce2ff4325d5d6eb1a8
4
+ data.tar.gz: 0b78287affb5166f6c147de66f11c69d1fb73723122204dff8c3570539a60664
5
5
  SHA512:
6
- metadata.gz: 8368b8e11eb5e0afa9e9e4fef56696bd16024b0ded23fca5e54689d86694a1aa045f6df1d701b1cadbe8281ccb04b992d861884bf5b4c1805da8d551979ecb48
7
- data.tar.gz: e5353cb3b9734d28b9003d6017b3a31fbd61c8dd36d781c97b211f6e795323551b1ec0226ae527c4ca788df873983b001850afe0f159131605475700566901fe
6
+ metadata.gz: b3e91d89aae045a8e2c41268fc5b55969ca7bfeb9d4fa2f9dd1ef0acfa4631ae3d4427206f878942fa4a10476b1b3afc5eaaa024134b542d6fa2a1dbbf6b4a0a
7
+ data.tar.gz: 80553056699ad4df1fcd1bd41e13df629b29e1a16a571cf499273089d1d48e8d81dd994b09520d38ce60fa391612f89e7097cc6c4b818560a179f7f956cd5677
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.36.3] - 2026-11-10
11
+
12
+ ### Fixed
13
+
14
+ - Send Pi prompts through stdin instead of process arguments; drain streams while writing input and retain timeout/no-response evidence.
15
+
10
16
  ## [0.36.2] - 2026-10-16
11
17
 
12
18
  ### Fixed
@@ -145,19 +145,19 @@ module Ace
145
145
  pgid = safe_getpgid(pid)
146
146
  debug_log(provider_name, "spawn pid=#{pid} pgid=#{pgid || "n/a"} invocation=#{invocation_id}")
147
147
 
148
- begin
149
- stdin.write(stdin_data) if stdin_data
150
- rescue Errno::EPIPE
151
- # Subprocess exited before consuming stdin — continue to capture stderr for the real error
152
- end
153
- stdin.close
154
-
155
148
  partial_stdout = +""
156
149
  partial_stderr = +""
157
150
  out_reader = Thread.new { safe_read_stream(stdout, partial_stdout) }
158
151
  err_reader = Thread.new { safe_read_stream(stderr, partial_stderr) }
159
152
  out_reader.report_on_exception = false
160
153
  err_reader.report_on_exception = false
154
+ input_writer = Thread.new do
155
+ stdin.write(stdin_data) if stdin_data
156
+ rescue Errno::EPIPE, IOError
157
+ # The child exited or capture closed its input during cleanup.
158
+ ensure
159
+ stdin.close unless stdin.closed?
160
+ end
161
161
 
162
162
  unless wait_thr.join(normalized_timeout)
163
163
  # Deadline exceeded: kill subprocess group (and descendants), retain partial streams
@@ -218,7 +218,7 @@ module Ace
218
218
  end
219
219
  end
220
220
  [stdin, stdout, stderr].each { |stream| stream.close unless stream.closed? }
221
- [out_reader, err_reader].compact.each { |reader| reader.join(1) }
221
+ [input_writer, out_reader, err_reader].compact.each { |thread| thread.join(1) }
222
222
  end
223
223
  end
224
224
 
@@ -56,8 +56,8 @@ module Ace
56
56
  )
57
57
  full_prompt = rewrite_skill_commands(full_prompt, working_dir: working_dir)
58
58
 
59
- cmd = build_pi_command(full_prompt, options, system_prompt: system_prompt)
60
- capture = execute_pi_command(cmd, working_dir: working_dir, options: options)
59
+ cmd = build_pi_command(options, system_prompt: system_prompt)
60
+ capture = execute_pi_command(cmd, stdin_data: full_prompt, working_dir: working_dir, options: options)
61
61
  begin
62
62
  capture.raise_unless_success
63
63
  rescue Ace::LLM::ProviderError
@@ -181,15 +181,14 @@ module Ace
181
181
 
182
182
  # Build the pi command array
183
183
  #
184
- # @param full_prompt [String] The complete prompt
185
184
  # @param options [Hash] Generation options
186
185
  # @param system_prompt [String, nil] System prompt for --system-prompt flag
187
186
  # @return [Array<String>] Command array
188
- def build_pi_command(full_prompt, options, system_prompt: nil)
187
+ def build_pi_command(options, system_prompt: nil)
189
188
  cmd = ["pi"]
190
189
 
191
190
  # Print mode (non-interactive, one-shot)
192
- cmd << "-p" << full_prompt.to_s
191
+ cmd << "-p"
193
192
 
194
193
  # No session (stateless)
195
194
  cmd << "--no-session"
@@ -273,12 +272,12 @@ module Ace
273
272
  [parts[0], parts[1]]
274
273
  end
275
274
 
276
- def execute_pi_command(cmd, timeout: nil, working_dir: nil, options: {})
275
+ def execute_pi_command(cmd, stdin_data:, timeout: nil, working_dir: nil, options: {})
277
276
  timeout_val = timeout || @options[:timeout] || 120
278
277
  Molecules::SafeCapture.call(
279
278
  cmd,
280
279
  timeout: timeout_val,
281
- stdin_data: "",
280
+ stdin_data: stdin_data,
282
281
  chdir: working_dir,
283
282
  env: options[:subprocess_env],
284
283
  command_prefix: options[:subprocess_command_prefix],
@@ -310,13 +309,10 @@ module Ace
310
309
  raise capture.provider_error("Pi CLI failed: #{error_msg}")
311
310
  end
312
311
 
313
- text, usage, finish_reason = parse_ndjson(capture.stdout)
314
- if text.to_s.strip.empty?
315
- # Clean exit without a final response: an incomplete session,
316
- # not a completed answer.
317
- raise capture.with_no_response_evidence(
318
- Ace::LLM::ProviderError.new("Pi CLI produced no final message")
319
- )
312
+ begin
313
+ text, usage, finish_reason = parse_ndjson(capture.stdout)
314
+ rescue Ace::LLM::ProviderError => error
315
+ raise capture.with_no_response_evidence(error)
320
316
  end
321
317
  response = {"usage" => normalize_usage(usage), "finish_reason" => finish_reason}
322
318
 
@@ -4,7 +4,7 @@ module Ace
4
4
  module LLM
5
5
  module Providers
6
6
  module CLI
7
- VERSION = "0.36.2"
7
+ VERSION = "0.36.3"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace-llm-providers-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.36.2
4
+ version: 0.36.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-10-16 00:00:00.000000000 Z
10
+ date: 2026-11-10 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ace-llm