pi-openai-codex-compat 0.0.19 → 0.0.20

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
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.0.20 - 2026-10-02
6
+
7
+ ### Fixed
8
+
9
+ - Omit incompatible response-item IDs when replaying grammar-tool calls that came
10
+ from another provider or were recorded as function calls.
11
+ Call/result pairing and valid same-model item IDs remain unchanged.
12
+
13
+ ### Changed
14
+
15
+ - Require Pi `>=1.0.0 <1.1.0`. Restart Pi after upgrading its runtime.
16
+
5
17
  ## 0.0.19 - 2026-10-01
6
18
 
7
19
  ### 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.99.1 <0.100.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.99.1. It
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
- `<0.100.0` bound is the package's peer range, which Pi does not enforce when it
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 cover that case.
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.99.1 resources even when a
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,14 @@ 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.99.1 CLI. Ordinary Responses and Responses Lite tests exercise tool calls,
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
+ Six additional CLI cases replay grammar-tool history with `gpt-5.6-luna` in both
697
+ response formats. They cover foreign-provider history, different-model history,
698
+ and calls previously recorded as function calls.
695
699
  Test credentials stay in memory and child-process environments. Test sessions
696
700
  and configuration are isolated from the user's agent directory.
697
701
 
@@ -703,9 +707,9 @@ The packaged-CLI test selects its archive and executable as follows:
703
707
  existing regular file that `tar` can list, and an empty, missing, directory,
704
708
  or invalid value fails the test instead of falling back to a fresh pack.
705
709
  - `PI_CODEX_CLI_PATH` selects another Pi `cli.js`; the default is this
706
- repository's Pi 0.99.1 dependency. The test asserts that the selected
707
- executable reports version 0.99.1, the only Pi version the packaged CLI test
708
- is run against. The supported range is `>=0.99.1 <0.100.0`.
710
+ repository's Pi 1.0.0 dependency. The test asserts that the selected
711
+ executable reports version 1.0.0, the only Pi version the packaged CLI test
712
+ is run against. The supported range is `>=1.0.0 <1.1.0`.
709
713
  - Each Pi child process receives `PI_PACKAGE_DIR` bound to the selected
710
714
  executable's package directory, so the runtime under test reads its own
711
715
  metadata.
@@ -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 prove the loaded runtime is 0.99 even when
30
- * `PI_PACKAGE_DIR` points package metadata at another installation.
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.99.1";
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.99.1. The version comes
66
- * from package metadata, so the API checks also run to catch an older executable whose
67
- * `PI_PACKAGE_DIR` names a newer package.
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
- if (
830
- (isDifferentModel && itemId?.startsWith("fc_")) ||
831
- (customInputProperty === undefined && !itemId?.startsWith("fc_"))
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.19",
3
+ "version": "0.0.20",
4
4
  "description": "OpenAI Codex compatibility for Pi with native compaction, fast mode, and Codex-optimized capabilities",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -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.99.1",
55
- "@earendil-works/pi-coding-agent": "0.99.1",
56
- "@earendil-works/pi-tui": "0.99.1",
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.99.1 <0.100.0",
66
- "@earendil-works/pi-coding-agent": ">=0.99.1 <0.100.0",
67
- "@earendil-works/pi-tui": ">=0.99.1 <0.100.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": {