claude-agent-sdk 0.1.1 → 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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/claude_agent_sdk/subprocess_cli_transport.rb +22 -21
- data/lib/claude_agent_sdk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5f1881eb9fa20f805736f864736977c80f839d88042b3ba6e36ac23f7550548
|
|
4
|
+
data.tar.gz: 2ccee5ba2a1d59d312737eac4a36464cd15a160c3989b4a5d663ef49c7962b9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23cb7eff0c9f6a48ba1599c793cdabef7f8f98524c0a6eaf07abbb62407e4363a6e0d63f5764b1383ae8297b389a7db042ed9670a5e43c6d5e263321a42f9361
|
|
7
|
+
data.tar.gz: fa7e760167ff757870f54c6f0175f25bb3d9480843053ae82d9a95c82c6dd29ad478f3901496c72a2bc74cdca1d596db25ddaef09a724df3743005fec907ca94
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ 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
|
+
|
|
8
16
|
## [0.1.1] - 2025-10-14
|
|
9
17
|
|
|
10
18
|
### Fixed
|
|
@@ -162,23 +162,14 @@ module ClaudeAgentSDK
|
|
|
162
162
|
should_pipe_stderr = @options.stderr || @options.extra_args.key?('debug-to-stderr')
|
|
163
163
|
|
|
164
164
|
begin
|
|
165
|
-
# Start process
|
|
166
|
-
|
|
167
|
-
*cmd,
|
|
168
|
-
stdin: :pipe,
|
|
169
|
-
stdout: :pipe,
|
|
170
|
-
stderr: should_pipe_stderr ? :pipe : nil,
|
|
171
|
-
chdir: @cwd&.to_s,
|
|
172
|
-
env: process_env
|
|
173
|
-
)
|
|
165
|
+
# Start process using Open3
|
|
166
|
+
opts = { chdir: @cwd&.to_s }.compact
|
|
174
167
|
|
|
175
|
-
@stdout
|
|
176
|
-
@stdin = @process.stdin if @is_streaming
|
|
168
|
+
@stdin, @stdout, @stderr, @process = Open3.popen3(process_env, *cmd, opts)
|
|
177
169
|
|
|
178
170
|
# Handle stderr if piped
|
|
179
|
-
if should_pipe_stderr && @
|
|
180
|
-
@
|
|
181
|
-
@stderr_task = Async do
|
|
171
|
+
if should_pipe_stderr && @stderr
|
|
172
|
+
@stderr_task = Thread.new do
|
|
182
173
|
handle_stderr
|
|
183
174
|
rescue StandardError
|
|
184
175
|
# Ignore errors during stderr reading
|
|
@@ -186,7 +177,8 @@ module ClaudeAgentSDK
|
|
|
186
177
|
end
|
|
187
178
|
|
|
188
179
|
# Close stdin for non-streaming mode
|
|
189
|
-
@
|
|
180
|
+
@stdin.close unless @is_streaming
|
|
181
|
+
@stdin = nil unless @is_streaming
|
|
190
182
|
|
|
191
183
|
@ready = true
|
|
192
184
|
rescue Errno::ENOENT => e
|
|
@@ -223,8 +215,11 @@ module ClaudeAgentSDK
|
|
|
223
215
|
@ready = false
|
|
224
216
|
return unless @process
|
|
225
217
|
|
|
226
|
-
#
|
|
227
|
-
@stderr_task&.
|
|
218
|
+
# Kill stderr thread
|
|
219
|
+
if @stderr_task&.alive?
|
|
220
|
+
@stderr_task.kill
|
|
221
|
+
@stderr_task.join(1) rescue nil
|
|
222
|
+
end
|
|
228
223
|
|
|
229
224
|
# Close streams
|
|
230
225
|
begin
|
|
@@ -232,6 +227,11 @@ module ClaudeAgentSDK
|
|
|
232
227
|
rescue StandardError
|
|
233
228
|
# Ignore
|
|
234
229
|
end
|
|
230
|
+
begin
|
|
231
|
+
@stdout&.close
|
|
232
|
+
rescue StandardError
|
|
233
|
+
# Ignore
|
|
234
|
+
end
|
|
235
235
|
begin
|
|
236
236
|
@stderr&.close
|
|
237
237
|
rescue StandardError
|
|
@@ -240,8 +240,8 @@ module ClaudeAgentSDK
|
|
|
240
240
|
|
|
241
241
|
# Terminate process
|
|
242
242
|
begin
|
|
243
|
-
@process.
|
|
244
|
-
@process.
|
|
243
|
+
Process.kill('TERM', @process.pid) if @process.alive?
|
|
244
|
+
@process.value
|
|
245
245
|
rescue StandardError
|
|
246
246
|
# Ignore
|
|
247
247
|
end
|
|
@@ -250,12 +250,13 @@ module ClaudeAgentSDK
|
|
|
250
250
|
@stdout = nil
|
|
251
251
|
@stdin = nil
|
|
252
252
|
@stderr = nil
|
|
253
|
+
@stderr_task = nil
|
|
253
254
|
@exit_error = nil
|
|
254
255
|
end
|
|
255
256
|
|
|
256
257
|
def write(data)
|
|
257
258
|
raise CLIConnectionError, 'ProcessTransport is not ready for writing' unless @ready && @stdin
|
|
258
|
-
raise CLIConnectionError, "Cannot write to terminated process" if @process &&
|
|
259
|
+
raise CLIConnectionError, "Cannot write to terminated process" if @process && !@process.alive?
|
|
259
260
|
|
|
260
261
|
raise CLIConnectionError, "Cannot write to process that exited with error: #{@exit_error}" if @exit_error
|
|
261
262
|
|
|
@@ -326,7 +327,7 @@ module ClaudeAgentSDK
|
|
|
326
327
|
end
|
|
327
328
|
|
|
328
329
|
# Check process completion
|
|
329
|
-
status = @process.
|
|
330
|
+
status = @process.value
|
|
330
331
|
returncode = status.exitstatus
|
|
331
332
|
|
|
332
333
|
if returncode && returncode != 0
|