codex-ruby 0.1.3 → 0.1.5
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 +10 -0
- data/lib/codex_sdk/exec.rb +33 -5
- data/lib/codex_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: e93f52960b3bb6893715a92cc506bb5f20cc3af6a7861580a730d52fae665e3e
|
|
4
|
+
data.tar.gz: 9a4e6d6eeeef6cfffd5dbef64913df0572eddd9e5e843cea8846f8a832a1c630
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2401fd6294a9500a42aefeaaf09702ef39fa36fb214abc1b3508a94ba4cb1a7556d7afdf8c6881f6a9bcf34307dae786a6167418ed0e4af292c0939b4f51ef5
|
|
7
|
+
data.tar.gz: 103c8026510f1e5e0b02afd5ba284a28093dcf83c19bf380f4fa29871eca156af67279c43d456bd22ceb75fae3efef64bc6cac59ff83c4d933091e2fe2241d6e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.5 (2026-06-17)
|
|
4
|
+
|
|
5
|
+
- Include structured Codex CLI error events in non-zero exit errors, so
|
|
6
|
+
API failures such as unsupported model names are visible to callers
|
|
7
|
+
|
|
8
|
+
## 0.1.4 (2026-06-16)
|
|
9
|
+
|
|
10
|
+
- Pass `web_search: true` to current Codex CLI versions as the global
|
|
11
|
+
`--search` flag instead of the rejected `web_search=true` config override
|
|
12
|
+
|
|
3
13
|
## 0.1.3 (2026-06-16)
|
|
4
14
|
|
|
5
15
|
- Add `AGENTS.md` with contributor and release rules for AI agents
|
data/lib/codex_sdk/exec.rb
CHANGED
|
@@ -30,6 +30,7 @@ module CodexSDK
|
|
|
30
30
|
sessions_root = codex_sessions_root(env)
|
|
31
31
|
started_at = Time.now
|
|
32
32
|
@context_snapshot = nil
|
|
33
|
+
diagnostics = []
|
|
33
34
|
|
|
34
35
|
@stdin, @stdout, @stderr, @wait_thread = Open3.popen3(env, *args)
|
|
35
36
|
|
|
@@ -56,6 +57,7 @@ module CodexSDK
|
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
event = Events.parse(data)
|
|
60
|
+
capture_diagnostic(event, diagnostics)
|
|
59
61
|
block.call(event)
|
|
60
62
|
end
|
|
61
63
|
|
|
@@ -64,9 +66,9 @@ module CodexSDK
|
|
|
64
66
|
|
|
65
67
|
unless status.success?
|
|
66
68
|
code = status.exitstatus || status.termsig
|
|
67
|
-
|
|
69
|
+
diagnostic = exit_diagnostic(diagnostics, stderr_buf)
|
|
68
70
|
raise ExecError.new(
|
|
69
|
-
"Codex exited with code #{code}: #{
|
|
71
|
+
"Codex exited with code #{code}: #{diagnostic}",
|
|
70
72
|
exit_code: code,
|
|
71
73
|
stderr: stderr_buf
|
|
72
74
|
)
|
|
@@ -104,9 +106,37 @@ module CodexSDK
|
|
|
104
106
|
|
|
105
107
|
private
|
|
106
108
|
|
|
109
|
+
def capture_diagnostic(event, diagnostics)
|
|
110
|
+
message =
|
|
111
|
+
case event
|
|
112
|
+
when Events::TurnFailed
|
|
113
|
+
event.error_message
|
|
114
|
+
when Events::Error
|
|
115
|
+
event.message
|
|
116
|
+
when Events::ItemStarted, Events::ItemUpdated, Events::ItemCompleted
|
|
117
|
+
event.item.message if event.item.is_a?(Items::Error)
|
|
118
|
+
end
|
|
119
|
+
diagnostics << readable_error_message(message) if message.to_s.strip != ""
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def exit_diagnostic(diagnostics, stderr)
|
|
123
|
+
diagnostic = diagnostics.compact.uniq.join("\n")
|
|
124
|
+
diagnostic = stderr.to_s if diagnostic == ""
|
|
125
|
+
diagnostic.length > 500 ? "#{diagnostic[0, 497]}..." : diagnostic
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def readable_error_message(message)
|
|
129
|
+
parsed = JSON.parse(message.to_s)
|
|
130
|
+
parsed.dig("error", "message") || parsed["message"] || message.to_s
|
|
131
|
+
rescue JSON::ParserError
|
|
132
|
+
message.to_s
|
|
133
|
+
end
|
|
134
|
+
|
|
107
135
|
def build_args(resume_thread_id: nil, images: [], output_schema_path: nil)
|
|
108
136
|
codex_path = @options.codex_path || find_codex_path
|
|
109
|
-
args = [codex_path
|
|
137
|
+
args = [codex_path]
|
|
138
|
+
args << "--search" if @thread_options.web_search
|
|
139
|
+
args.concat(["exec", "--experimental-json"])
|
|
110
140
|
|
|
111
141
|
# Global config overrides
|
|
112
142
|
args.concat(ConfigSerializer.to_flags(@options.config)) if @options.config.any?
|
|
@@ -134,8 +164,6 @@ module CodexSDK
|
|
|
134
164
|
args.concat(["--config", "sandbox_workspace_write.network_access=#{to.network_access}"])
|
|
135
165
|
end
|
|
136
166
|
|
|
137
|
-
args.concat(["--config", "web_search=#{ConfigSerializer.to_toml_value(to.web_search)}"]) if to.web_search
|
|
138
|
-
|
|
139
167
|
if to.approval_policy
|
|
140
168
|
args.concat(["--config", "approval_policy=#{ConfigSerializer.to_toml_value(to.approval_policy)}"])
|
|
141
169
|
end
|
data/lib/codex_sdk/version.rb
CHANGED