pi-openai-codex-compat 0.0.19 → 0.0.21
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 +19 -0
- package/README.md +17 -10
- package/extensions/openai-codex-compat/command-tools.ts +4 -2
- package/extensions/openai-codex-compat/pi-runtime.ts +6 -6
- package/extensions/openai-codex-compat/vendor/pi-ai/README.md +4 -0
- package/extensions/openai-codex-compat/vendor/pi-ai/openai-responses-serialization.ts +5 -4
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.0.21 - 2026-10-02
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Keep `exec_command` errors inside the tool box when a provider failure,
|
|
10
|
+
cancellation, or execution error supplies no result metadata.
|
|
11
|
+
|
|
12
|
+
## 0.0.20 - 2026-10-02
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Omit incompatible response-item IDs when replaying grammar-tool calls that came
|
|
17
|
+
from another provider or were recorded as function calls.
|
|
18
|
+
Call/result pairing and valid same-model item IDs remain unchanged.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- Require Pi `>=1.0.0 <1.1.0`. Restart Pi after upgrading its runtime.
|
|
23
|
+
|
|
5
24
|
## 0.0.19 - 2026-10-01
|
|
6
25
|
|
|
7
26
|
### Removed
|
package/README.md
CHANGED
|
@@ -22,18 +22,20 @@ 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.
|
|
25
|
+
- Pi `>=1.0.0 <1.1.0`
|
|
26
26
|
- An OpenAI Codex login in Pi
|
|
27
27
|
|
|
28
28
|
Restart Pi after upgrading its runtime. `/reload` reloads extensions but cannot
|
|
29
29
|
upgrade the running Pi process. At load time, the extension requires the host's
|
|
30
30
|
transcript APIs, the Pi 0.99 APIs `SessionManager.getEntryCount()` and
|
|
31
|
-
`ExtensionAPI.getSettings()`, and a reported Pi version of at least 0.
|
|
31
|
+
`ExtensionAPI.getSettings()`, and a reported Pi version of at least 1.0.0. It
|
|
32
32
|
refuses to load otherwise. The load check does not reject newer releases: the
|
|
33
|
-
`<
|
|
33
|
+
`<1.1.0` bound is the package's peer range, which Pi does not enforce when it
|
|
34
34
|
installs packages. `PI_PACKAGE_DIR` can point an older executable at
|
|
35
35
|
newer package metadata, so the reported version alone does not establish
|
|
36
|
-
compatibility. The API checks
|
|
36
|
+
compatibility. The API checks detect missing capabilities from before Pi 0.99.
|
|
37
|
+
They do not distinguish a Pi 0.99 executable from Pi 1.0.0 when its metadata
|
|
38
|
+
points at the newer installation.
|
|
37
39
|
|
|
38
40
|
Authenticate through Pi if needed:
|
|
39
41
|
|
|
@@ -288,7 +290,6 @@ Defaults:
|
|
|
288
290
|
|
|
289
291
|
Responses Lite supports exactly `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`,
|
|
290
292
|
`gpt-6-astra`, `gpt-6-sol`, `gpt-6-luna`, and `gpt-6.1-sol`. It remains opt-in.
|
|
291
|
-
GPT-6.1 Sol requires Pi 0.99.1's model catalog.
|
|
292
293
|
|
|
293
294
|
Invalid JSON setting values are ignored and invalid JSON does not prevent Pi from
|
|
294
295
|
starting. The settings pane reports malformed JSON instead of overwriting it.
|
|
@@ -669,7 +670,7 @@ npm run pack:dry
|
|
|
669
670
|
`mise run check` runs the linters, formatters, type checks, and the offline
|
|
670
671
|
test suite; `mise run test` runs only the offline suite. Both tasks bind
|
|
671
672
|
`PI_PACKAGE_DIR` to `node_modules/@earendil-works/pi-coding-agent`, so tests
|
|
672
|
-
that load Pi in-process read this repository's Pi 0.
|
|
673
|
+
that load Pi in-process read this repository's Pi 1.0.0 resources even when a
|
|
673
674
|
global `PI_PACKAGE_DIR` points at another installation. Ordinary `pi` launches
|
|
674
675
|
outside these tasks are unaffected. Offline tests also exercise
|
|
675
676
|
`scripts/release.ts` with every child process mocked: they never run Git, npm,
|
|
@@ -687,11 +688,17 @@ mise run test:live:codex
|
|
|
687
688
|
The task obtains the local Codex bearer token and runs the tests with
|
|
688
689
|
`gpt-5.6-luna`, `gpt-6-sol`, `gpt-6-luna`, and `gpt-6.1-sol` at medium reasoning
|
|
689
690
|
effort. It also packs the extension and loads that archive through the shipped Pi
|
|
690
|
-
0.
|
|
691
|
+
1.0.0 CLI. Ordinary Responses and Responses Lite tests exercise tool calls,
|
|
691
692
|
prompt reload, native compaction, and persisted-session resume against Codex.
|
|
692
693
|
SDK tests verify Responses Lite
|
|
693
694
|
WebSocket history, prewarming, continuation, and the built-in read tool.
|
|
694
695
|
CLI tests also execute the built-in read tool after resume.
|
|
696
|
+
Terminal tests check interrupted `exec_command` error framing in regular and
|
|
697
|
+
fullscreen mode. A live terminal case blocks a real Codex command call before
|
|
698
|
+
execution and checks that Pi's metadata-free error retains its tool box.
|
|
699
|
+
Six additional CLI cases replay grammar-tool history with `gpt-5.6-luna` in both
|
|
700
|
+
response formats. They cover foreign-provider history, different-model history,
|
|
701
|
+
and calls previously recorded as function calls.
|
|
695
702
|
Test credentials stay in memory and child-process environments. Test sessions
|
|
696
703
|
and configuration are isolated from the user's agent directory.
|
|
697
704
|
|
|
@@ -703,9 +710,9 @@ The packaged-CLI test selects its archive and executable as follows:
|
|
|
703
710
|
existing regular file that `tar` can list, and an empty, missing, directory,
|
|
704
711
|
or invalid value fails the test instead of falling back to a fresh pack.
|
|
705
712
|
- `PI_CODEX_CLI_PATH` selects another Pi `cli.js`; the default is this
|
|
706
|
-
repository's Pi 0.
|
|
707
|
-
executable reports version 0.
|
|
708
|
-
is run against. The supported range is `>=0.
|
|
713
|
+
repository's Pi 1.0.0 dependency. The test asserts that the selected
|
|
714
|
+
executable reports version 1.0.0, the only Pi version the packaged CLI test
|
|
715
|
+
is run against. The supported range is `>=1.0.0 <1.1.0`.
|
|
709
716
|
- Each Pi child process receives `PI_PACKAGE_DIR` bound to the selected
|
|
710
717
|
executable's package directory, so the runtime under test reads its own
|
|
711
718
|
metadata.
|
|
@@ -278,10 +278,12 @@ export default function registerCommandTools(
|
|
|
278
278
|
},
|
|
279
279
|
renderResult(result, options, theme, context) {
|
|
280
280
|
if (!options.isPartial) {
|
|
281
|
-
|
|
281
|
+
// Pi's provider, abort, and execution errors can omit tool-owned details.
|
|
282
|
+
const sessionId = result.details?.sessionId;
|
|
283
|
+
if (sessionId === undefined) {
|
|
282
284
|
Reflect.deleteProperty(context.state, "sessionId");
|
|
283
285
|
} else {
|
|
284
|
-
context.state.sessionId =
|
|
286
|
+
context.state.sessionId = sessionId;
|
|
285
287
|
}
|
|
286
288
|
}
|
|
287
289
|
return renderCommandResult(result, options, theme, context, resolveToolBackground);
|
|
@@ -26,12 +26,12 @@ export const SESSION_APIS = ["buildSessionProjection"] as const;
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Host APIs that first shipped in Pi 0.99: the footer's `SessionManager.getEntryCount()`
|
|
29
|
-
* and the extension API's `getSettings()`. They
|
|
30
|
-
*
|
|
29
|
+
* and the extension API's `getSettings()`. They detect missing pre-0.99 capabilities,
|
|
30
|
+
* not every mismatch between an executable and `PI_PACKAGE_DIR` metadata.
|
|
31
31
|
*/
|
|
32
32
|
export const PI_099_APIS = ["SessionManager.getEntryCount", "ExtensionAPI.getSettings"] as const;
|
|
33
33
|
|
|
34
|
-
export const MINIMUM_PI_VERSION = "0.
|
|
34
|
+
export const MINIMUM_PI_VERSION = "1.0.0";
|
|
35
35
|
export const REQUIRED_PI = `Pi ${MINIMUM_PI_VERSION} or later`;
|
|
36
36
|
|
|
37
37
|
function isFunction(value: unknown): boolean {
|
|
@@ -62,9 +62,9 @@ export function atLeastVersion(version: unknown, minimum: string): boolean {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Require the Pi 0.99 host surface and a reported version of at least 0.
|
|
66
|
-
* from package metadata
|
|
67
|
-
*
|
|
65
|
+
* Require the Pi 0.99 host surface and a reported version of at least 1.0.0. The version comes
|
|
66
|
+
* from package metadata. The API checks detect missing capabilities, but cannot distinguish
|
|
67
|
+
* a Pi 0.99 executable pointed at Pi 1.0.0 metadata through `PI_PACKAGE_DIR`.
|
|
68
68
|
*/
|
|
69
69
|
export function requirePiRuntime(
|
|
70
70
|
transcriptApi: Record<string, unknown>,
|
|
@@ -4,6 +4,10 @@ This directory intentionally contains only the Pi AI methods needed to serialize
|
|
|
4
4
|
|
|
5
5
|
[`openai-responses-serialization.ts`](openai-responses-serialization.ts) adapts the relevant methods from `@earendil-works/pi-ai@0.86.0`. Its header lists the upstream source files. It also carries the strict JSON-schema conversion from `src/api/constrained-sampling.ts`; Pi's built-in tools request strict sampling, and Codex rejects `strict: true` without that subset. Keep the wire-equivalence tests in [`test/pi-ai-serialization.test.ts`](../../../../test/pi-ai-serialization.test.ts) passing when updating the Pi dependencies.
|
|
6
6
|
|
|
7
|
+
The copy also includes Pi 1.0.0's tool-call item-ID guard: same-model replay
|
|
8
|
+
preserves valid `fc_` function IDs and `ctc_` grammar IDs, while incompatible
|
|
9
|
+
item IDs are omitted without changing the `call_id` that pairs calls with results.
|
|
10
|
+
|
|
7
11
|
Pi AI's transcript helpers replay system sections and tool declarations.
|
|
8
12
|
`supportsAdditionalTools` and `supportsToolSearch` select the dynamic tool
|
|
9
13
|
history representation for additive `toolsAdded` system messages:
|
|
@@ -826,10 +826,11 @@ export function convertResponsesMessages(
|
|
|
826
826
|
const customInputProperty = options?.grammarToolInputProperties?.get(block.name);
|
|
827
827
|
const namespaced = splitNamespacedToolName(block.name, options?.namespacedToolNames);
|
|
828
828
|
let itemId = itemIdRaw;
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
829
|
+
// Preserve item IDs only when they match the replayed tool type.
|
|
830
|
+
// Item IDs from another model of the same provider and API are always omitted.
|
|
831
|
+
// call_id still pairs every call with its result when an item ID is omitted.
|
|
832
|
+
const itemIdPrefix = customInputProperty === undefined ? "fc_" : "ctc_";
|
|
833
|
+
if (isDifferentModel || !itemId?.startsWith(itemIdPrefix)) {
|
|
833
834
|
itemId = undefined;
|
|
834
835
|
}
|
|
835
836
|
if (customInputProperty !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-openai-codex-compat",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "OpenAI Codex compatibility for Pi with native compaction, fast mode, and Codex-optimized capabilities",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"check": "hk check --all --check",
|
|
38
38
|
"test": "node --test --test-concurrency=4 test/*.test.ts",
|
|
39
|
-
"test:live:codex": "PI_CODEX_LIVE_TEST=1 node --test --test-concurrency=1 test/codex-host.live.test.ts test/codex-cli.live.test.ts",
|
|
39
|
+
"test:live:codex": "PI_CODEX_LIVE_TEST=1 node --test --test-concurrency=1 test/codex-host.live.test.ts test/codex-cli.live.test.ts test/command-render-cli.test.ts",
|
|
40
40
|
"pack:dry": "npm pack --dry-run --allow-directory=all",
|
|
41
41
|
"release": "node scripts/release.ts",
|
|
42
42
|
"fmt": "oxfmt",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@2h2d/oxlint-config": "0.1.1",
|
|
53
53
|
"@2h2d/ts-config": "0.0.1",
|
|
54
|
-
"@earendil-works/pi-ai": "0.
|
|
55
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
56
|
-
"@earendil-works/pi-tui": "0.
|
|
54
|
+
"@earendil-works/pi-ai": "1.0.0",
|
|
55
|
+
"@earendil-works/pi-coding-agent": "1.0.0",
|
|
56
|
+
"@earendil-works/pi-tui": "1.0.0",
|
|
57
57
|
"@types/node": "22.20.1",
|
|
58
58
|
"oxfmt": "0.64.0",
|
|
59
59
|
"oxlint": "1.79.0",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"typescript": "7.0.2"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@earendil-works/pi-ai": ">=0.
|
|
66
|
-
"@earendil-works/pi-coding-agent": ">=0.
|
|
67
|
-
"@earendil-works/pi-tui": ">=0.
|
|
65
|
+
"@earendil-works/pi-ai": ">=1.0.0 <1.1.0",
|
|
66
|
+
"@earendil-works/pi-coding-agent": ">=1.0.0 <1.1.0",
|
|
67
|
+
"@earendil-works/pi-tui": ">=1.0.0 <1.1.0",
|
|
68
68
|
"typebox": "*"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|