claude-agent-sdk 0.1.0 → 0.1.2

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: c64664d64c01dd3a8eaaf3acb9f9710088c063403430f9ca9d974c91a14f5c33
4
- data.tar.gz: edc92a78c207df18290335002c68c443ca398127c22979b5e97e6c3838052381
3
+ metadata.gz: d5f1881eb9fa20f805736f864736977c80f839d88042b3ba6e36ac23f7550548
4
+ data.tar.gz: 2ccee5ba2a1d59d312737eac4a36464cd15a160c3989b4a5d663ef49c7962b9e
5
5
  SHA512:
6
- metadata.gz: b6ae823488c9e208461a630d844fa270b84d1cc34ae98ef87f0893b4b302bcacbddc98644d4d29d49c65388e0b6ed2f91afa79a964eae58415435c2607fb0dde
7
- data.tar.gz: e3fe5655912e84519af489f2391e9d81c913e256fe49ae1522e0eced2dcb31f8d4443d757c154530b23d94b677c8526bdfe10623055aa305e742f407eea17bb3
6
+ metadata.gz: 23cb7eff0c9f6a48ba1599c793cdabef7f8f98524c0a6eaf07abbb62407e4363a6e0d63f5764b1383ae8297b389a7db042ed9670a5e43c6d5e263321a42f9361
7
+ data.tar.gz: fa7e760167ff757870f54c6f0175f25bb3d9480843053ae82d9a95c82c6dd29ad478f3901496c72a2bc74cdca1d596db25ddaef09a724df3743005fec907ca94
data/CHANGELOG.md CHANGED
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.1.2] - 2025-10-14
9
+
10
+ ### Fixed
11
+ - **Critical:** Replaced `Async::Process` with Ruby's built-in `Open3` for subprocess management
12
+ - Fixed "uninitialized constant Async::Process" error that prevented the gem from working
13
+ - Process management now uses standard Ruby threads instead of async tasks
14
+ - All 86 tests passing
15
+
16
+ ## [0.1.1] - 2025-10-14
17
+
18
+ ### Fixed
19
+ - Added `~/.claude/local/claude` to CLI search paths to detect Claude Code in its default installation location
20
+ - Fixed issue where SDK couldn't find Claude Code when accessed via shell alias
21
+
22
+ ### Added
23
+ - Comprehensive test suite with 86 passing tests
24
+ - Test documentation in spec/README.md
25
+
26
+ ### Changed
27
+ - Marked as unofficial SDK in README and gemspec
28
+ - Updated repository URLs to reflect community-maintained status
29
+
8
30
  ## [0.1.0] - 2025-10-14
9
31
 
10
32
  ### Added
@@ -35,6 +35,7 @@ module ClaudeAgentSDK
35
35
 
36
36
  # Try common locations
37
37
  locations = [
38
+ File.join(Dir.home, '.claude/local/claude'), # Claude Code default install location
38
39
  File.join(Dir.home, '.npm-global/bin/claude'),
39
40
  '/usr/local/bin/claude',
40
41
  File.join(Dir.home, '.local/bin/claude'),
@@ -161,23 +162,14 @@ module ClaudeAgentSDK
161
162
  should_pipe_stderr = @options.stderr || @options.extra_args.key?('debug-to-stderr')
162
163
 
163
164
  begin
164
- # Start process
165
- @process = Async::Process::Child.new(
166
- *cmd,
167
- stdin: :pipe,
168
- stdout: :pipe,
169
- stderr: should_pipe_stderr ? :pipe : nil,
170
- chdir: @cwd&.to_s,
171
- env: process_env
172
- )
165
+ # Start process using Open3
166
+ opts = { chdir: @cwd&.to_s }.compact
173
167
 
174
- @stdout = @process.stdout
175
- @stdin = @process.stdin if @is_streaming
168
+ @stdin, @stdout, @stderr, @process = Open3.popen3(process_env, *cmd, opts)
176
169
 
177
170
  # Handle stderr if piped
178
- if should_pipe_stderr && @process.stderr
179
- @stderr = @process.stderr
180
- @stderr_task = Async do
171
+ if should_pipe_stderr && @stderr
172
+ @stderr_task = Thread.new do
181
173
  handle_stderr
182
174
  rescue StandardError
183
175
  # Ignore errors during stderr reading
@@ -185,7 +177,8 @@ module ClaudeAgentSDK
185
177
  end
186
178
 
187
179
  # Close stdin for non-streaming mode
188
- @process.stdin.close unless @is_streaming
180
+ @stdin.close unless @is_streaming
181
+ @stdin = nil unless @is_streaming
189
182
 
190
183
  @ready = true
191
184
  rescue Errno::ENOENT => e
@@ -222,8 +215,11 @@ module ClaudeAgentSDK
222
215
  @ready = false
223
216
  return unless @process
224
217
 
225
- # Cancel stderr task
226
- @stderr_task&.stop
218
+ # Kill stderr thread
219
+ if @stderr_task&.alive?
220
+ @stderr_task.kill
221
+ @stderr_task.join(1) rescue nil
222
+ end
227
223
 
228
224
  # Close streams
229
225
  begin
@@ -231,6 +227,11 @@ module ClaudeAgentSDK
231
227
  rescue StandardError
232
228
  # Ignore
233
229
  end
230
+ begin
231
+ @stdout&.close
232
+ rescue StandardError
233
+ # Ignore
234
+ end
234
235
  begin
235
236
  @stderr&.close
236
237
  rescue StandardError
@@ -239,8 +240,8 @@ module ClaudeAgentSDK
239
240
 
240
241
  # Terminate process
241
242
  begin
242
- @process.terminate
243
- @process.wait
243
+ Process.kill('TERM', @process.pid) if @process.alive?
244
+ @process.value
244
245
  rescue StandardError
245
246
  # Ignore
246
247
  end
@@ -249,12 +250,13 @@ module ClaudeAgentSDK
249
250
  @stdout = nil
250
251
  @stdin = nil
251
252
  @stderr = nil
253
+ @stderr_task = nil
252
254
  @exit_error = nil
253
255
  end
254
256
 
255
257
  def write(data)
256
258
  raise CLIConnectionError, 'ProcessTransport is not ready for writing' unless @ready && @stdin
257
- raise CLIConnectionError, "Cannot write to terminated process" if @process && @process.status
259
+ raise CLIConnectionError, "Cannot write to terminated process" if @process && !@process.alive?
258
260
 
259
261
  raise CLIConnectionError, "Cannot write to process that exited with error: #{@exit_error}" if @exit_error
260
262
 
@@ -325,7 +327,7 @@ module ClaudeAgentSDK
325
327
  end
326
328
 
327
329
  # Check process completion
328
- status = @process.wait
330
+ status = @process.value
329
331
  returncode = status.exitstatus
330
332
 
331
333
  if returncode && returncode != 0
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeAgentSDK
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-agent-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Community Contributors