pi-openai-codex-compat 0.0.10-alpha.6 → 0.0.10-alpha.7

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.
package/CHANGELOG.md CHANGED
@@ -75,9 +75,12 @@
75
75
  - Validate complete apply-patch result details against schema-derived contracts before rendering, including integer metadata and nested instruction relationships.
76
76
  - Distinguish an unavailable Pi compaction append capability from a missing percentage-compaction retention boundary.
77
77
  - Validate supported Responses input, completed-output, content, and tool-definition variants with closed schema-derived unions, failing closed on unknown or malformed item types while preserving additional fields on known variants.
78
+ - Process a final Codex SSE event when the stream ends without a trailing blank
79
+ line, matching Pi 0.85's parser recovery.
78
80
 
79
81
  ### Changed
80
82
 
83
+ - Support Pi 0.85.x and update the development baseline to Pi 0.85.1.
81
84
  - Describe `shell_command`, `exec_command`, and `write_stdin` in Pi's tool list,
82
85
  guidelines, and detailed tool contracts using the actual resolved default
83
86
  shell. Document command working-directory and `PI_*` context behavior,
package/README.md CHANGED
@@ -22,7 +22,7 @@ Pi provides the Codex OAuth flow and model catalog. At session start, this packa
22
22
  ## Requirements
23
23
 
24
24
  - Node.js 22.19 or newer
25
- - Pi `>=0.84.0 <0.85.0`
25
+ - Pi `>=0.84.0 <0.86.0`
26
26
  - An OpenAI Codex login in Pi
27
27
 
28
28
  Authenticate through Pi if needed:
@@ -61,16 +61,20 @@ export async function* parseSse(
61
61
  const chunk = await reader.read();
62
62
  const { done } = chunk;
63
63
  if (signal?.aborted) throw new Error("Request was aborted");
64
- if (done) break;
65
- const value: unknown = chunk.value;
66
- if (!(value instanceof Uint8Array)) {
67
- throw new CodexProtocolError(
68
- "Codex returned a non-byte SSE stream chunk.",
69
- value,
70
- undefined,
71
- );
64
+ if (done) {
65
+ buffer += decoder.decode();
66
+ if (buffer.trim()) buffer += "\n\n";
67
+ } else {
68
+ const value: unknown = chunk.value;
69
+ if (!(value instanceof Uint8Array)) {
70
+ throw new CodexProtocolError(
71
+ "Codex returned a non-byte SSE stream chunk.",
72
+ value,
73
+ undefined,
74
+ );
75
+ }
76
+ buffer += decoder.decode(value, { stream: true }).replaceAll("\r\n", "\n");
72
77
  }
73
- buffer += decoder.decode(value, { stream: true }).replaceAll("\r\n", "\n");
74
78
  let boundary = buffer.indexOf("\n\n");
75
79
  while (boundary !== -1) {
76
80
  const block = buffer.slice(0, boundary);
@@ -97,6 +101,7 @@ export async function* parseSse(
97
101
  }
98
102
  boundary = buffer.indexOf("\n\n");
99
103
  }
104
+ if (done) break;
100
105
  }
101
106
  } finally {
102
107
  signal?.removeEventListener("abort", onAbort);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-openai-codex-compat",
3
- "version": "0.0.10-alpha.6",
3
+ "version": "0.0.10-alpha.7",
4
4
  "description": "OpenAI Codex compatibility for Pi with native compaction, fast mode, and Codex-optimized capabilities",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -47,9 +47,9 @@
47
47
  "devDependencies": {
48
48
  "@2h2d/oxlint-config": "0.1.1",
49
49
  "@2h2d/ts-config": "0.0.1",
50
- "@earendil-works/pi-ai": "0.84.3",
51
- "@earendil-works/pi-coding-agent": "0.84.3",
52
- "@earendil-works/pi-tui": "0.84.3",
50
+ "@earendil-works/pi-ai": "0.85.1",
51
+ "@earendil-works/pi-coding-agent": "0.85.1",
52
+ "@earendil-works/pi-tui": "0.85.1",
53
53
  "@types/node": "22.20.1",
54
54
  "oxfmt": "0.64.0",
55
55
  "oxlint": "1.79.0",
@@ -58,9 +58,9 @@
58
58
  "typescript": "7.0.2"
59
59
  },
60
60
  "peerDependencies": {
61
- "@earendil-works/pi-ai": ">=0.84.0 <0.85.0",
62
- "@earendil-works/pi-coding-agent": ">=0.84.0 <0.85.0",
63
- "@earendil-works/pi-tui": ">=0.84.0 <0.85.0",
61
+ "@earendil-works/pi-ai": ">=0.84.0 <0.86.0",
62
+ "@earendil-works/pi-coding-agent": ">=0.84.0 <0.86.0",
63
+ "@earendil-works/pi-tui": ">=0.84.0 <0.86.0",
64
64
  "typebox": "*"
65
65
  },
66
66
  "engines": {