pi-openai-codex-compat 0.0.6 → 0.0.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.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Max Brunsfeld
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -42,6 +42,7 @@ The compatibility baseline is official Codex CLI `0.146.0`, released July 29, 20
42
42
  | Standalone `web.run` | Disabled by default; when enabled, preferred over hosted `web_search` and sent with the complete reserved schema and description. | Enabled by default for `gpt-5.6-sol` through Responses Lite; otherwise subject to standalone-search feature and runtime gates. | `webRun`: boolean. |
43
43
  | Hosted web search | Disabled by default; when enabled, injected only for ordinary Responses while `web.run` is inactive. Responses Lite omits hosted tools. | Omitted for `gpt-5.6-sol` while standalone `web.run` is available; otherwise defaults to cached mode when hosted search is supported. | `webRun` and `webSearch`: `disabled`, `cached`, `indexed`, or `live`. |
44
44
  | Coding mutation tools | Enables `apply_patch` and suppresses Pi's active `edit` and `write` tools. | Chooses its tool surface from model metadata and runtime capabilities; there are no Pi `edit` or `write` tools to suppress. | `applyPatch`: boolean. |
45
+ | `apply_patch` debug output | Disabled; collapsed results show the normal visual summary and instruction rows. | Not applicable to Pi's tool-result renderer. | `applyPatchDebug`: boolean. |
45
46
  | Codex tool background | Uses a subtle theme-derived surface for extension-owned Codex tools. | Uses Codex's own TUI activity cells rather than Pi tool rows. | `toolBackground`: `subtle`, `status`, or `none`. |
46
47
  | Auto-compaction trigger | Relies on Pi's reserve-token threshold unless a percentage is configured. | Tracks Codex's model/token-budget state before and between sampling steps. | `autoCompactAtPercent`: percentage or unset. Pi's own compaction settings remain separate. |
47
48
  | Fast mode | Uses the normal tier. | Uses the configured Codex service tier. | `fastMode`: boolean; `true` requests the priority tier. |
@@ -173,6 +174,7 @@ Example:
173
174
  "responsesLite": true,
174
175
  "toolBackground": "subtle",
175
176
  "applyPatch": true,
177
+ "applyPatchDebug": false,
176
178
  "imageGeneration": true,
177
179
  "imageDetail": "auto",
178
180
  "webRun": false,
@@ -192,6 +194,7 @@ Defaults:
192
194
  | `responsesLite` | boolean | `false` | Uses Codex's Responses Lite input envelope on supported GPT-5.6 models when enabled. By default, those models use ordinary Responses instructions and tools. |
193
195
  | `toolBackground` | `subtle`, `status`, `none` | `subtle` | Controls the shared self-rendered background for `apply_patch`, `image_gen.imagegen`, and `web.run`. `status` uses Pi's pending/success/error backgrounds; `none` keeps the custom layout transparent. |
194
196
  | `applyPatch` | boolean | `true` | On selected `openai-codex` models, uses the extension's `apply_patch` tool instead of Pi's active `edit` and `write` tools. Other providers always use their normal Pi tool set. |
197
+ | `applyPatchDebug` | boolean | `false` | Shows the exact model-facing tool result while a completed `apply_patch` result is collapsed. Expanded results continue to show the normal visual summary and complete diffs. |
195
198
  | `imageGeneration` | boolean | `true` | Enables the extension-owned `image_gen.imagegen` tool on selected `openai-codex` models. |
196
199
  | `imageDetail` | `auto`, `low`, `high`, `original` | `auto` | Sets `input_image.detail` when an image tool result is sent back to the model. It does not change `gpt-image-2` generation quality. |
197
200
  | `webRun` | boolean | `false` | Enables the extension-owned `web.run` tool on selected `openai-codex` models. When active, it replaces hosted `web_search` in the Responses tool list. |
@@ -211,6 +214,7 @@ Every setting can also be overridden for one Pi process with an environment vari
211
214
  | `responsesLite` | `PI_OPENAI_CODEX_COMPAT_RESPONSES_LITE` |
212
215
  | `toolBackground` | `PI_OPENAI_CODEX_COMPAT_TOOL_BACKGROUND` |
213
216
  | `applyPatch` | `PI_OPENAI_CODEX_COMPAT_APPLY_PATCH` |
217
+ | `applyPatchDebug` | `PI_OPENAI_CODEX_COMPAT_APPLY_PATCH_DEBUG` |
214
218
  | `imageGeneration` | `PI_OPENAI_CODEX_COMPAT_IMAGE_GENERATION` |
215
219
  | `imageDetail` | `PI_OPENAI_CODEX_COMPAT_IMAGE_DETAIL` |
216
220
  | `webRun` | `PI_OPENAI_CODEX_COMPAT_WEB_RUN` |
@@ -283,7 +287,9 @@ Supported operations:
283
287
  - add files;
284
288
  - update files with ordered context chunks;
285
289
  - delete files;
286
- - move an updated file;
290
+ - update and move a file in one instruction;
291
+ - move regular files or symlink entries without content changes;
292
+ - evaluate repeated and aliased paths sequentially;
287
293
  - anchor updates at the end of a file.
288
294
 
289
295
  Compatibility behavior:
@@ -291,21 +297,37 @@ Compatibility behavior:
291
297
  - `*** Add File` overwrites an existing file, matching Codex.
292
298
  - `*** Move to` overwrites an existing destination, matching Codex.
293
299
  - Hunk matching retries exact text, trailing-whitespace-insensitive text, fully trimmed text, and Codex's Unicode punctuation normalization.
300
+ - After strict matching fails, uniquely determined formatter-only line reflow can recover through exact Tree-sitter tokens for JavaScript, JSX, TypeScript, TSX, Python, Go, Java, and Scala. Requested replacement lines remain opaque and exact.
301
+ - Markdown recovery is limited to exact-cell tables and supported code inside typed fences. Plain prose reflow, optional punctuation differences, single-token structural recovery, and partial-line structural recovery reject.
294
302
  - The parser accepts Codex's lenient marker whitespace, blank update-context lines, and direct heredoc wrappers.
295
- - Successful model-facing results use Codex's exit-code, wall-time, and `Success. Updated the following files:` format.
296
- - Tool-result history stores per-file old/new content, display diffs, move destinations, overwrite information, and committed-prefix details after runtime failures.
297
- - The TUI renders Codex-style `Added`, `Edited`, and `Deleted` diff blocks instead of the raw model-facing result.
298
- - The collapsed view shows aggregate and per-file counts; `Ctrl+O` reveals complete hunks.
303
+ - Empty and identity updates, identical adds, absent deletes, self-moves, and same-patch fulfilled moves succeed with concise `NO CHANGE` results. Inapplicable operations are `SKIPPED` only when later operations deterministically make every effect unobservable.
304
+ - Model-facing results retain the aggregate A/M/D summary. When any instruction is not applied or an applied instruction has feedback, they list every source-ordered instruction under `Patch instruction results:` as `N. [STATUS] operation`, without an instruction limit; ordinary all-applied results omit the ledger.
305
+ - Combined text updates and moves are labeled `Update & Move`; move-only operations remain `Move`.
306
+ - Replacement feedback always identifies the verified previous and resulting entry types. Symlink feedback also uses the raw target pathname stored in the symlink.
307
+ - Tool-result history stores per-file old/new content, display diffs, move destinations, overwrite information, per-instruction filesystem effects, and deterministic final-path inspection after runtime failures.
308
+ - Opaque moves and symlink deletions use path-only history, so binary bytes and link-target bytes are not serialized as textual deletions.
309
+ - The TUI retains Codex-style changed-file summaries and uses the same conditional instruction ledger; when present, `Ctrl+O` nests complete diffs beneath the instruction that produced them.
310
+ - With `applyPatchDebug` enabled, the tool title becomes `apply_patch (debug)` and a completed collapsed result shows the exact text returned to the model without an extra renderer-only heading; expanding it with `Ctrl+O` still shows the normal visual summary and complete diffs.
311
+ - Failed instruction feedback colocates its error, completed effects, final path states, and concise matcher evidence without repeating patch text or using speculative language. Matcher failures include direct guidance for retrying with updated, source-ordered, non-overlapping, or more specific instructions.
299
312
 
300
313
  Filesystem behavior:
301
314
 
302
315
  - Relative paths resolve from Pi's current working directory; absolute paths and `..` traversal are honored.
303
- - `.git` paths and symlinks follow normal host filesystem semantics.
316
+ - `.git` paths are unrestricted.
317
+ - Text updates follow live symlinks; adds replace live or dangling symlinks without writing through them; deletes remove only the symlink; pure moves move the source symlink; and state-changing moves create a regular file at the destination without writing updated text through a source or destination symlink.
318
+ - Entry-only operations and no-op updates do not dereference cyclic or inaccessible symlink targets during mutation-queue acquisition.
319
+ - Same-filesystem pure moves use native rename topology. Cross-filesystem moves copy through a temporary entry, create or replace the destination, and then unlink the source, producing an inode independent from remaining source hard links.
320
+ - Strict and formatter-recovered edits preserve the matched region's local CRLF or mixed line endings.
304
321
  - The extension does not add path filtering, sandboxing, or approval prompts.
305
322
  - Every hunk is parsed and validated before filesystem writes begin.
306
- - Mutations participate in Pi's per-file mutation queue and `apply_patch` calls execute sequentially.
323
+ - Mutations participate in Pi's per-file mutation queue and an extension-local logical queue for case, Unicode, symlink-parent, and hard-link aliases. Both queues coordinate only concurrent `apply_patch` calls in the same Pi process and module instance; they do not coordinate separate Pi sessions, other processes, or unrelated edit/write tools.
307
324
 
308
- A low-level I/O failure can still leave a multi-file patch partially applied. The failed tool result records the known committed prefix, but inspect the working tree before retrying when that record is marked inexact.
325
+ A low-level I/O failure can still complete part of an instruction. The failed
326
+ instruction reports every confirmed effect and final path state; when a path
327
+ cannot be inspected, it says that the final state was not verified.
328
+
329
+ The complete feedback and rendering contract is documented in
330
+ [`APPLY_PATCH_INSTRUCTION_FEEDBACK.md`](APPLY_PATCH_INSTRUCTION_FEEDBACK.md).
309
331
 
310
332
  ## `image_gen.imagegen`
311
333
 
@@ -404,7 +426,13 @@ search, and compaction continuation.
404
426
 
405
427
  ## Release staging
406
428
 
407
- The GitHub Actions workflow stages npm releases when a `v*` tag is pushed. The tag must match the `package.json` version, point at a commit whose subject is `release: v<version>`, and be a lightweight tag. Create it with `git tag v<version>`; do not use `git tag -a`, `git tag -s`, `git tag -m`, or `cog bump --annotated`.
429
+ 1. Run `npm run release -- X.Y.Z` from a clean, synchronized `main`.
430
+ 2. The command builds the exact package locally, records its SHA-256 in an SSH-signed release commit, proves a clean rebuild is reproducible, and creates a lightweight tag.
431
+ 3. Inspect the result, then push atomically with `git push --atomic origin main vX.Y.Z`.
432
+ 4. A read-only GitHub Actions job validates and packs the package. After approval in the tag-restricted `npm-publish` environment, a separate GitHub-owned job verifies the signature and signed digest before attesting and staging that exact archive through npm trusted publishing.
433
+ 5. Approve the staged package on npmjs.com, or with `npm stage approve <stage-id>`.
434
+
435
+ Stable releases use `latest`; prereleases derive their npm dist-tag from the first prerelease identifier.
408
436
 
409
437
  ## Acknowledgements
410
438
 
@@ -19,3 +19,29 @@ Pi AI, Copyright (c) 2025 Mario Zechner
19
19
  Pi AI is licensed under the MIT License. A copy is included at [`LICENSES/pi-ai-MIT.txt`](LICENSES/pi-ai-MIT.txt).
20
20
 
21
21
  Source: <https://github.com/earendil-works/pi/tree/main/packages/ai>
22
+
23
+ ## Tree-sitter WASMs
24
+
25
+ `@2h2d/tree-sitter-wasms` supplies lifecycle-free grammar WASM assets used for
26
+ formatter-tolerant `apply_patch` matching.
27
+
28
+ Tree-sitter WASMs, Copyright (c) 2026 Kaan Ozdokmeci
29
+
30
+ Tree-sitter WASMs is licensed under the MIT License. A copy is included at
31
+ [`LICENSES/tree-sitter-wasms-MIT.txt`](LICENSES/tree-sitter-wasms-MIT.txt).
32
+ The dependency package includes the exact upstream license for each bundled
33
+ grammar under its own `LICENSES` directory.
34
+
35
+ Source: <https://github.com/2h2d-co/tree-sitter-wasms>
36
+
37
+ ## Web Tree-sitter
38
+
39
+ `web-tree-sitter` supplies the official Tree-sitter WASM runtime used to load
40
+ and execute the packaged grammars.
41
+
42
+ Web Tree-sitter, Copyright (c) 2018 Max Brunsfeld
43
+
44
+ Web Tree-sitter is licensed under the MIT License. A copy is included at
45
+ [`LICENSES/web-tree-sitter-MIT.txt`](LICENSES/web-tree-sitter-MIT.txt).
46
+
47
+ Source: <https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_web>