harnex 0.6.2 → 0.6.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: d7c3f452ed6de7b0468cbafff82c603beb7f880458168a9acf433d4f2747bbd9
4
- data.tar.gz: 24ff11cfd9f02d509e7f0720589dc4658c7acff5eefea78029146f292b3010e7
3
+ metadata.gz: f547957cf6589b1d153e4cf7e462482902ea71e7e1291281524e867596ea4730
4
+ data.tar.gz: 4f01e84be1c31692f2b68fa09850dd781116398ab45f3e6f0b2ad76c7f52846c
5
5
  SHA512:
6
- metadata.gz: 7d401086cf7cc01a563a34901076175c769ceb06165ef5d875dc5f1ebb722b241ec02b43d7d086575ef2fb78186f30ba3f427fc8dcd0984d44c8ce5accf13527
7
- data.tar.gz: 10927dc8202b920ef3cdd5dd0a9e728c56e6673bc19cf5fac58f3aea85a52a6ac4b5cabd8a11f856152c3f492241c17e11e1b7a155809283554894784eb301a5
6
+ metadata.gz: eb7cd143d32da68e674bbc620d6ac6c56cb4388009e5f074ab54958288e6a02a0a31df38dae9a1713881ce0ea6315f2f8c01147a1b9b071056439bc8e3734518
7
+ data.tar.gz: a3c17557910b63e987cad3497c54599044417484710b8cd7cc2f152bfb9aa43b6231ba99c11efc93c0c9788bdc7f41077d22dda30e4a13b6be724f109e0eabbf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.3] — 2026-05-06
4
+
5
+ ### Fixed
6
+
7
+ - JSON-RPC adapter (`codex app-server`): `--context` boot injection now
8
+ succeeds against real Codex CLI. Three schema mismatches in
9
+ `Adapters::CodexAppServer` caused 100% session disconnect on boot
10
+ with `"Invalid request: invalid type: null, expected a string"`:
11
+ - `ensure_thread!` and the `thread/started` notification handler read
12
+ `result["threadId"]`, but Codex's actual `thread/start` response is
13
+ `{"thread": {"id": "..."}}`. With `@thread_id = nil`, the subsequent
14
+ `turn/start` sent `threadId: null` and Codex's serde rejected it.
15
+ - `dispatch` sent `input: { content: [{type, text}] }`, but
16
+ `TurnStartParams.input` is an **array** of `UserInput`. Now sends
17
+ `input: [{type: "text", text: "..."}]`.
18
+ - `initialize` joined ALL `extra_args` into `@initial_prompt`, which
19
+ prepended Codex CLI flags (e.g. `-m gpt-5.5-mini -c
20
+ model_reasoning_effort=low`) into the prompt content. Now extracts
21
+ only the harnex-prefixed context element.
22
+
23
+ Re-opens and properly closes #29. The 0.6.2 fix shipped clean tests
24
+ but the test stubs mirrored harnex's wrong assumptions instead of
25
+ Codex's actual JSON-RPC schema, so production was 100% broken on the
26
+ default JSON-RPC path.
27
+
28
+ ### Notes
29
+
30
+ - Test stubs in `codex_appserver_lifecycle_test.rb` and
31
+ `session_jsonrpc_test.rb` still mirror harnex's old assumptions.
32
+ Tracked as a follow-up (test rewrite using `codex app-server
33
+ generate-json-schema` as the source of truth, plus a contract-test
34
+ gate). Existing tests remain green; the structural improvement does
35
+ not block this release.
36
+ - `--legacy-pty` remains as the documented fallback. Removal still
37
+ scheduled for 0.7.0 once test-rewrite + contract gate land.
38
+
3
39
  ## [0.6.2] — 2026-05-06
4
40
 
5
41
  ### Fixed
@@ -38,8 +38,7 @@ module Harnex
38
38
 
39
39
  def initialize(extra_args = [])
40
40
  super("codex", extra_args)
41
- @initial_prompt = extra_args.join(" ").strip
42
- @initial_prompt = nil if @initial_prompt.empty?
41
+ @initial_prompt = extract_initial_prompt(extra_args)
43
42
  @client = nil
44
43
  @thread_id = nil
45
44
  @current_turn_id = nil
@@ -133,7 +132,7 @@ module Harnex
133
132
  ensure_thread!
134
133
  params = {
135
134
  threadId: @thread_id,
136
- input: { content: [{ type: "text", text: prompt.to_s }] }
135
+ input: [{ type: "text", text: prompt.to_s }]
137
136
  }
138
137
  params[:model] = model if model
139
138
  params[:effort] = effort if effort
@@ -183,7 +182,22 @@ module Harnex
183
182
  return if @thread_id
184
183
 
185
184
  result = @client.request("thread/start", {})
186
- @thread_id = result["threadId"] || result["thread_id"]
185
+ @thread_id = extract_thread_id(result)
186
+ end
187
+
188
+ def extract_thread_id(payload)
189
+ return nil unless payload.is_a?(Hash)
190
+
191
+ payload.dig("thread", "id") || payload["threadId"] || payload["thread_id"]
192
+ end
193
+
194
+ def extract_initial_prompt(extra_args)
195
+ return nil unless extra_args.is_a?(Array)
196
+
197
+ prefixed = extra_args.find { |a| a.is_a?(String) && a.start_with?("[harnex session id=") }
198
+ return prefixed if prefixed && !prefixed.empty?
199
+
200
+ nil
187
201
  end
188
202
 
189
203
  def perform_handshake
@@ -207,7 +221,7 @@ module Harnex
207
221
 
208
222
  case method
209
223
  when "thread/started"
210
- @thread_id ||= params["threadId"] || params["thread_id"]
224
+ @thread_id ||= extract_thread_id(params)
211
225
  when "turn/started"
212
226
  @current_turn_id = params["turnId"] || params["turn_id"]
213
227
  @state = :busy
@@ -1,4 +1,4 @@
1
1
  module Harnex
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  RELEASE_DATE = "2026-05-06"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harnex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jikku Jose