@oai404iao/pi-codex-minimal-tools 4.0.0 → 4.1.0

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.
Files changed (106) hide show
  1. package/LICENSE +1 -8
  2. package/README.md +85 -480
  3. package/THIRD_PARTY_NOTICES.md +13 -120
  4. package/index.ts +11 -2
  5. package/package.json +18 -23
  6. package/LICENSES/Apache-2.0.txt +0 -201
  7. package/LICENSES/OpenAI-Codex-NOTICE.txt +0 -6
  8. package/config.schema.json +0 -74
  9. package/models.schema.json +0 -217
  10. package/provenance/openai-codex-40eac3ce-sol-luna.json +0 -42
  11. package/provenance/openai-codex-ddea03ad-astra.json +0 -54
  12. package/provenance/openai-codex-eb9dceba-reserved-tools.json +0 -140
  13. package/src/activation.ts +0 -1
  14. package/src/adapter/compaction/checkpoint.ts +0 -1
  15. package/src/adapter/compaction/collect.ts +0 -1
  16. package/src/adapter/compaction/http.ts +0 -1
  17. package/src/adapter/compaction/request.ts +0 -1
  18. package/src/adapter/compaction/transport.ts +0 -1
  19. package/src/adapter/compaction/websocket.ts +0 -1
  20. package/src/background-image-generation.ts +0 -1
  21. package/src/capabilities.ts +0 -1
  22. package/src/codex-http.ts +0 -1
  23. package/src/codex-identity-extension.ts +0 -1
  24. package/src/codex-request-profile.ts +0 -1
  25. package/src/codex-reserved-tools.ts +0 -1
  26. package/src/codex-wire-identity.ts +0 -1
  27. package/src/extension/prewarm-snapshot.ts +0 -1
  28. package/src/extension/provider-presentation.ts +0 -1
  29. package/src/extension/provider-runtime.ts +0 -1
  30. package/src/extension/register.ts +0 -36
  31. package/src/extension/startup-prewarm.ts +0 -1
  32. package/src/fast-mode.ts +0 -1
  33. package/src/glyphs.ts +0 -1
  34. package/src/index.ts +0 -11
  35. package/src/model-catalog/catalog.ts +0 -1
  36. package/src/model-catalog/default-models.json +0 -289
  37. package/src/model-catalog/runtime.ts +0 -1
  38. package/src/model-catalog/types.ts +0 -1
  39. package/src/native-compaction.ts +0 -1
  40. package/src/patch/apply.ts +0 -1
  41. package/src/patch/parser.ts +0 -1
  42. package/src/patch/render.ts +0 -1
  43. package/src/provider-headers.ts +0 -1
  44. package/src/provider-native-tools.ts +0 -1
  45. package/src/provider-shim.ts +0 -20
  46. package/src/providers/codex-apply-patch-tool.ts +0 -1
  47. package/src/providers/codex-apply-patch.lark +0 -19
  48. package/src/providers/openai-codex/cache-key.ts +0 -1
  49. package/src/providers/openai-codex/captured-stream.ts +0 -1
  50. package/src/providers/openai-codex/constants.ts +0 -1
  51. package/src/providers/openai-codex/continuation.ts +0 -1
  52. package/src/providers/openai-codex/errors.ts +0 -1
  53. package/src/providers/openai-codex/events.ts +0 -1
  54. package/src/providers/openai-codex/headers.ts +0 -1
  55. package/src/providers/openai-codex/lite.ts +0 -1
  56. package/src/providers/openai-codex/message.ts +0 -1
  57. package/src/providers/openai-codex/prewarm.ts +0 -1
  58. package/src/providers/openai-codex/proxy.ts +0 -1
  59. package/src/providers/openai-codex/reasoning.ts +0 -1
  60. package/src/providers/openai-codex/request-body.ts +0 -1
  61. package/src/providers/openai-codex/request-context.ts +0 -1
  62. package/src/providers/openai-codex/request-metadata.ts +0 -1
  63. package/src/providers/openai-codex/retry.ts +0 -1
  64. package/src/providers/openai-codex/runtime.ts +0 -1
  65. package/src/providers/openai-codex/sse.ts +0 -1
  66. package/src/providers/openai-codex/stream-effects.ts +0 -1
  67. package/src/providers/openai-codex/stream.ts +0 -1
  68. package/src/providers/openai-codex/types.ts +0 -1
  69. package/src/providers/openai-codex/urls.ts +0 -1
  70. package/src/providers/openai-codex/usage.ts +0 -1
  71. package/src/providers/openai-codex/websocket-connection.ts +0 -1
  72. package/src/providers/openai-codex/websocket-events.ts +0 -1
  73. package/src/providers/openai-codex/websocket-session.ts +0 -1
  74. package/src/providers/openai-codex/websocket-socket.ts +0 -1
  75. package/src/providers/openai-codex/websocket-stream.ts +0 -1
  76. package/src/providers/openai-responses-shared.ts +0 -7
  77. package/src/providers/responses/citations.ts +0 -1
  78. package/src/providers/responses/history.ts +0 -1
  79. package/src/providers/responses/items.ts +0 -1
  80. package/src/providers/responses/markdown.ts +0 -1
  81. package/src/providers/responses/messages.ts +0 -1
  82. package/src/providers/responses/signatures.ts +0 -1
  83. package/src/providers/responses/stream-state.ts +0 -1
  84. package/src/providers/responses/stream.ts +0 -1
  85. package/src/providers/responses/text-renderer.ts +0 -1
  86. package/src/providers/responses/text.ts +0 -1
  87. package/src/providers/responses/tool-identity.ts +0 -1
  88. package/src/providers/responses/tools.ts +0 -1
  89. package/src/providers/responses/types.ts +0 -1
  90. package/src/providers/responses/usage.ts +0 -1
  91. package/src/settings.ts +0 -1
  92. package/src/tools/apply-patch.ts +0 -1
  93. package/src/tools/image-generation/capture.ts +0 -1
  94. package/src/tools/image-generation/display.ts +0 -1
  95. package/src/tools/image-generation/preview.ts +0 -1
  96. package/src/tools/image-generation/storage.ts +0 -1
  97. package/src/tools/image-generation/types.ts +0 -1
  98. package/src/tools/image-generation.ts +0 -1
  99. package/src/tools/view-image.ts +0 -1
  100. package/src/tools/web-search/activity.ts +0 -1
  101. package/src/tools/web-search/capture.ts +0 -1
  102. package/src/tools/web-search/render.ts +0 -1
  103. package/src/tools/web-search.ts +0 -1
  104. package/src/utils/images.ts +0 -1
  105. package/src/utils/theme.ts +0 -1
  106. /package/{src/subagent-inline.ts → subagent-inline.ts} +0 -0
package/LICENSE CHANGED
@@ -1,8 +1,4 @@
1
- Licensing for pi-codex-minimal-tools
2
-
3
- Except for the third-party materials identified in THIRD_PARTY_NOTICES.md,
4
- the project-authored portions of this package are available under the
5
- following MIT License:
1
+ MIT License
6
2
 
7
3
  Copyright (c) 2026 oai404iao
8
4
 
@@ -23,6 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
21
  SOFTWARE.
26
-
27
- Third-party materials remain under their respective terms. See
28
- THIRD_PARTY_NOTICES.md and the license texts under LICENSES/.
package/README.md CHANGED
@@ -1,482 +1,87 @@
1
1
  # @oai404iao/pi-codex-minimal-tools
2
2
 
3
- Codex-specific Responses support for Pi, driven by an exact per-model JSON
4
- catalog instead of model-name heuristics.
5
-
6
- Peer floor: Pi 0.87.0; development target: 0.87.1.
7
-
8
- > npm identity stays `@oai404iao/pi-codex-minimal-tools`. This checkout composes
9
- > core, web-search and imagegen through a shared runtime. The four new packages
10
- > are alpha bootstrap candidates. Guarded bundle publication remains blocked
11
- > until those dependencies are bootstrapped and separately activated.
12
- > Previously published tarballs are unchanged. See
13
- > [package composition](../../docs/codex-packages.md) for local installation tests
14
- > and version/lifecycle restrictions; this is not a new npm release.
15
-
16
- > **Compatibility boundary:** Responses Lite uses an internal Codex request
17
- > shape. This package pins and tests a compatibility serialization for exact
18
- > configured model profiles, but it is not an OpenAI-supported public API
19
- > contract and may stop working if that internal protocol changes.
20
-
21
- The extension adds:
22
-
23
- - Responses SSE, WebSocket, cached continuation, WebSocket retry, upgrade-only
24
- SSE fallback, and WebSocket prewarm.
25
- - Standard Responses and the internal Codex Responses Lite envelope.
26
- - Codex freeform `apply_patch`, including streaming preview and exact replay.
27
- - Hosted Responses web search or standalone Codex `web.run`.
28
- - Hosted Responses image generation or standalone Codex `image_gen.imagegen`.
29
- - Codex remote compaction v2 and legacy `/responses/compact`.
30
- - Per-model Fast service tiers.
31
- - User overrides and user-added provider/model profiles.
32
-
33
- Unknown models are not guessed. They keep Pi's native provider implementation
34
- and do not receive package tools.
35
-
36
- ## Codex Identity
37
-
38
- This package owns Codex wire identity independently from Pi's session-file id:
39
-
40
- - a root has `SessionId === ThreadId`;
41
- - subagents share the root `SessionId` and receive their own `ThreadId`;
42
- - `prompt_cache_key` is the shared `SessionId`;
43
- - `x-client-request-id` is the current `ThreadId`;
44
- - TurnId and `x-codex-turn-state` are scoped to one logical agent turn;
45
- - WindowId is thread-scoped and advances after successful compaction;
46
- - the installation UUIDv4 is stored at
47
- `<PI_CODING_AGENT_DIR>/pi-codex-minimal-tools/installation_id`.
48
-
49
- SSE, Responses Lite, WebSocket, native compaction, and standalone `web.run`
50
- are projections of the same request identity snapshot.
51
-
52
- The package also exports
53
- `@oai404iao/pi-codex-minimal-tools/subagent-inline`. Its named inline
54
- extension installs only identity lifecycle hooks for SDK-created child
55
- sessions; it does not register providers, tools, commands, or renderers.
56
-
57
- ## Install
58
-
59
- After the reviewed split-package alpha and its dependencies are available on npm:
60
-
61
- ```bash
62
- pi install npm:@oai404iao/pi-codex-minimal-tools@1.4.1-alpha.0
63
- ```
64
-
65
- Until then, test a complete repository checkout after running the root
66
- `npm ci --ignore-scripts`; an isolated bundle source directory cannot supply
67
- its unpublished workspace dependencies:
68
-
69
- ```bash
70
- pi install /absolute/path/to/pi-codex-minimal-tools
71
- ```
72
-
73
- Restart Pi or run `/reload`.
74
-
75
- ## Commands
76
-
77
- | Command | Action |
78
- | --- | --- |
79
- | `/codex-minimal-tools` | Show the active model profile and effective capabilities. |
80
- | `/codex-minimal-tools:doctor` | Show config/catalog diagnostics. |
81
- | `/fast [on\|off\|status]` | Toggle the active profile's Fast service tier. |
82
- | `/image-gen <prompt> [@reference.png]` | Run background image generation or editing. |
83
-
84
- ## Two Configuration Files
85
-
86
- There are two separate model-related files:
87
-
88
- 1. Pi's agent `models.json` defines providers and actual models: API type,
89
- base URL, authentication, headers, modalities, context window, and cost.
90
- 2. This extension's `models.json` defines Codex behavior for an exact
91
- `provider/model` ID: Responses mode, reasoning summary, transport, tools,
92
- compaction, and Fast.
93
-
94
- Typical paths:
95
-
96
- ```text
97
- <PI_CODING_AGENT_DIR>/models.json
98
- <PI_CODING_AGENT_DIR>/extensions/pi-codex-minimal-tools/models.json
99
- <PI_CODING_AGENT_DIR>/extensions/pi-codex-minimal-tools/config.json
100
- ```
101
-
102
- Without `PI_CODING_AGENT_DIR`, Pi normally uses `~/.config/pi/agent` or
103
- `~/.pi/agent`, depending on the installation.
104
-
105
- ### Extension Global Config
106
-
107
- `config.json` now contains only package-wide preferences:
108
-
109
- ```json
110
- {
111
- "$schema": "https://unpkg.com/@oai404iao/pi-codex-minimal-tools@1/config.schema.json",
112
- "enabled": true,
113
- "glyphStyle": "unicode",
114
- "autoEnable": true,
115
- "webSocketEnabled": true,
116
- "fastMode": false,
117
- "imageGeneration": true,
118
- "imageOutputDir": ".pi/openai-codex-images",
119
- "imageModel": "gpt-image-2",
120
- "directImageApiFallback": false,
121
- "viewImageWorkspaceOnly": false,
122
- "deferApplyPatchRendering": false
123
- }
124
- ```
125
-
126
- | Setting | Meaning |
127
- | --- | --- |
128
- | `enabled` | Enable all package behavior. |
129
- | `glyphStyle` | Use `unicode` or `ascii` UI glyphs. |
130
- | `autoEnable` | Add supported package tools automatically. |
131
- | `webSocketEnabled` | Global Responses WebSocket master switch. Set `false` to force SSE and disable WebSocket prewarm for every model profile. |
132
- | `fastMode` | Global user toggle; only profiles with `fast` are affected. |
133
- | `imageGeneration` | Global master switch. Set `false` to omit image tools, `/image-gen`, presentation, hosted injection, standalone requests, and direct fallback without changing other model behavior. |
134
- | `imageOutputDir` | Generated-image output directory. Relative paths resolve from the workspace root. |
135
- | `imageModel` | Image model used by standalone/hosted image requests and direct fallback. |
136
- | `directImageApiFallback` | Permit the separate `OPENAI_API_KEY` Images API fallback. |
137
- | `viewImageWorkspaceOnly` | Restrict `view_image` to the workspace. |
138
- | `deferApplyPatchRendering` | Use Pi's fallback renderer instead of the streaming patch preview. |
139
-
140
- The older model-level keys remain readable for one migration version, but are
141
- deprecated and no longer appear in `config.schema.json`. `imageGeneration` is
142
- the exception: it remains the supported global master switch. See
143
- [Legacy migration](#legacy-migration).
144
-
145
- ### Per-Model Catalog
146
-
147
- Create:
148
-
149
- ```text
150
- <PI_CODING_AGENT_DIR>/extensions/pi-codex-minimal-tools/models.json
151
- ```
152
-
153
- Example overriding a bundled model and adding a custom provider/model:
154
-
155
- ```json
156
- {
157
- "$schema": "https://unpkg.com/@oai404iao/pi-codex-minimal-tools@1/models.schema.json",
158
- "version": 1,
159
- "models": [
160
- {
161
- "id": "openai/gpt-5.5",
162
- "responses": {
163
- "reasoningSummary": "none",
164
- "transport": "sse",
165
- "websocketPrewarm": false
166
- },
167
- "tools": {
168
- "webSearch": false
169
- }
170
- },
171
- {
172
- "id": "my-provider/my-codex-model",
173
- "extends": "openai/gpt-5.5",
174
- "responses": {
175
- "endpoint": "openai",
176
- "transport": "websocket-cached"
177
- },
178
- "tools": {
179
- "imageGeneration": false
180
- }
181
- }
182
- ]
183
- }
184
- ```
185
-
186
- Resolution rules:
187
-
188
- - IDs are exact, case-insensitive `provider/model` matches.
189
- - A user entry with the same ID deep-overrides the bundled entry.
190
- - `extends` can inherit from a bundled or user profile.
191
- - Objects merge recursively; arrays replace the inherited array.
192
- - Duplicate IDs, malformed JSON, missing parents, cycles, and unknown fields
193
- are reported by `/codex-minimal-tools:doctor`.
194
- - Each effective profile has a stable hash. WebSocket continuation, sticky
195
- fallback, and native-compaction replay are isolated by that hash.
196
-
197
- Full field documentation is in
198
- [`reference/model-catalog.md`](https://github.com/oai404iao/omp/blob/main/pi-extensions/pi-codex-minimal-tools/reference/model-catalog.md), and editor
199
- validation is provided by [`models.schema.json`](models.schema.json).
200
-
201
- ## Custom Provider Example
202
-
203
- The custom model must exist in Pi's agent `models.json`. For provider-shim
204
- features, its Pi `api` must be `openai-responses` or
205
- `openai-codex-responses`:
206
-
207
- ```json
208
- {
209
- "providers": {
210
- "my-provider": {
211
- "baseUrl": "https://api.example.com/v1",
212
- "apiKey": "$MY_PROVIDER_API_KEY",
213
- "api": "openai-responses",
214
- "models": [
215
- {
216
- "id": "my-codex-model",
217
- "name": "My Codex Model",
218
- "reasoning": true,
219
- "input": ["text", "image"],
220
- "contextWindow": 272000,
221
- "maxTokens": 16384,
222
- "cost": {
223
- "input": 0,
224
- "output": 0,
225
- "cacheRead": 0,
226
- "cacheWrite": 0
227
- }
228
- }
229
- ]
230
- }
231
- }
232
- }
233
- ```
234
-
235
- The extension dynamically attaches only its stream handler to a selected
236
- custom provider. It does not replace the provider's URL, authentication,
237
- headers, or model definitions.
238
-
239
- If a profile requests the provider shim but the Pi model uses another API
240
- type, wire-only features are disabled:
241
-
242
- - hosted web/image tools;
243
- - custom/freeform `apply_patch`;
244
- - native Responses compaction;
245
- - Fast service tiers.
246
-
247
- Standalone web/image tools and function `apply_patch` can still be used when
248
- the profile enables them.
249
-
250
- ## Model Profile Fields
251
-
252
- ```json
253
- {
254
- "id": "provider/model",
255
- "extends": "provider/parent-model",
256
- "enabled": true,
257
- "responses": {
258
- "providerShim": true,
259
- "endpoint": "auto",
260
- "mode": "standard",
261
- "reasoningSummary": "auto",
262
- "systemPromptPlacement": "instructions",
263
- "transport": "auto",
264
- "websocketPrewarm": true
265
- },
266
- "tools": {
267
- "parallelCalls": true,
268
- "applyPatch": "custom",
269
- "webSearch": {
270
- "implementation": "hosted",
271
- "contentTypes": ["text", "image"]
272
- },
273
- "imageGeneration": "standalone",
274
- "viewImage": false
275
- },
276
- "compaction": "responses",
277
- "fast": {
278
- "serviceTier": "priority",
279
- "costMultiplier": 2
280
- }
281
- }
282
- ```
283
-
284
- Important constraints:
285
-
286
- - `responses.reasoningSummary` accepts `"auto"`, `"concise"`, `"detailed"`,
287
- or `"none"`. `"none"` omits `reasoning.summary`; when absent, Standard
288
- defaults to `"auto"` and Lite defaults to `"none"`.
289
- - `responses.mode:"lite"` always uses a developer message, namespace tools in
290
- `additional_tools`, `parallel_tool_calls:false`,
291
- `reasoning.context:"all_turns"`, and strips input-image `detail`.
292
- - Lite cannot use hosted `web_search` or hosted `image_generation`; choose
293
- `standalone` instead.
294
- - `tools.applyPatch:"custom"` uses the Codex freeform grammar and requires the
295
- provider shim. `"function"` works as a normal Pi tool.
296
- - `responses.endpoint:"openai"` uses API-key endpoint/auth semantics.
297
- `"codex"` uses ChatGPT/Codex endpoint/auth semantics. `"auto"` infers from
298
- the provider.
299
- - `compaction:"responses"` uses `compaction_trigger` through the selected
300
- SSE/WebSocket transport. `"responses-compact"` uses the legacy unary
301
- endpoint. `"pi"` keeps Pi summaries.
302
-
303
- ## Built-In Profiles
304
-
305
- The bundled catalog is based on local Codex commit
306
- `eb9dceba1a2e658142a456c5898836774835616b` from August 12, 2026, with the
307
- Astra profile updated from `ddea03ad049142943bdbf13e937b1d67e8c1ba0c`.
308
-
309
- | Models | Responses | Web | Image | Patch | Compaction |
310
- | --- | --- | --- | --- | --- | --- |
311
- | `openai-codex/gpt-6-astra` | Lite, auto WS/SSE | standalone text+image | standalone | custom | responses |
312
- | `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna` | Lite, auto WS/SSE | standalone text+image | standalone | custom | responses |
313
- | `gpt-5.5`, `gpt-5.4` | Standard, auto WS/SSE | hosted text+image | standalone | custom | responses |
314
- | `gpt-5.4-mini`, `codex-auto-review` | Standard, auto WS/SSE | hosted text+image | standalone | custom | responses |
315
- | `gpt-5.2` | Standard, auto WS/SSE | hosted text | standalone | custom | responses |
316
- | legacy GPT-5/Codex entries | inherited Standard profile | profile-specific | standalone | custom | responses |
317
- | `gpt-4.1` | Standard SSE | off | hosted | off | Pi |
318
- | `o4-mini` | Standard SSE | off | off | off | Pi |
319
-
320
- The pre-Astra entries include equivalent `openai/...` and
321
- `openai-codex/...` IDs; the latter switch only the endpoint/auth shape to
322
- `codex`. Astra is bundled only for `openai-codex`, matching the analyzed
323
- ChatGPT subscription route. A public-API or proxy Astra deployment requires an
324
- explicit user profile for that endpoint.
325
-
326
- Pi supplies the Astra model descriptor. The extension composes its stream shim over that provider and does not
327
- replace authentication, streams, or the model catalog.
328
- The descriptor keeps the production default at 272,000 context tokens and
329
- 128,000 output tokens. A backend-authorized larger context must be selected
330
- explicitly through Pi's provider `modelOverrides`; the extension does not infer
331
- that entitlement from the Astra slug.
332
-
333
- These entries are defaults, not claims that every proxy with the same model
334
- slug supports the protocol. Override or disable a profile for the endpoint
335
- actually in use.
336
-
337
- `openai-codex/gpt-6-sol` and `openai-codex/gpt-6-luna` use separately verified
338
- Lite profiles: developer placement, custom patch, standalone web/image,
339
- parallel calls disabled on the wire, and no reasoning summary. Pi 0.87.1 supplies
340
- their descriptors and `off -> none` mapping; no `ultra`, larger context,
341
- pricing multiplier or public-API cache TTL is inferred. Fast mode is disabled.
342
- See `provenance/openai-codex-40eac3ce-sol-luna.json`. Source/fixture verification
343
- does not establish that a particular account can access these endpoints.
344
-
345
- ## Web Search
346
-
347
- `tools.webSearch` supports two implementations:
348
-
349
- - `hosted`: rewrites the Pi placeholder to Responses
350
- `{"type":"web_search"}` and preserves progress, sources, results, and
351
- citation replay. Standard Responses only.
352
- - `standalone`: exposes `web.run` as a client-executed namespace tool and calls
353
- the provider's `alpha/search` endpoint. It supports search/image queries,
354
- open/click/find, PDF screenshots, finance, weather, sports, and time.
355
-
356
- Standalone search sends a bounded recent visible conversation tail, resolved
357
- Pi authentication, direct-caller/live-web settings, the active turn metadata,
358
- and the model's 10,000-token truncation budget. Search rows stay compact by
359
- default and show deduplicated source hosts; expand the tool row to inspect the
360
- raw result text.
361
-
362
- ## Image Generation
363
-
364
- Set global `config.json.imageGeneration` to `false` to disable the entire
365
- generation capability. Per-model `tools.imageGeneration:false` disables only
366
- that profile. Neither setting disables image input or historical image replay.
367
-
368
- `tools.imageGeneration` supports:
369
-
370
- - `hosted`: Responses `image_generation`.
371
- - `standalone`: `image_gen.imagegen`, backed by the provider's
372
- `images/generations` and `images/edits` endpoints.
373
-
374
- Standalone input follows current Codex:
375
-
376
- - required `prompt`;
377
- - up to five `referenced_image_paths`; or
378
- - `num_last_images_to_include` from 1 through 5.
379
-
380
- Generated PNGs are saved under `imageOutputDir`, mirrored to `latest.png`, and
381
- returned to the model before the saved-path text. `/image-gen` selects any
382
- loaded image-capable model with an enabled catalog profile.
383
-
384
- ## WebSocket And Compaction
385
-
386
- Global `config.json.webSocketEnabled:false` forces `sse` and disables
387
- WebSocket prewarm without changing the selected per-model profile. When it is
388
- `true` (the default), each profile's `responses.transport` and
389
- `responses.websocketPrewarm` values apply.
390
-
391
- `transport` values:
392
-
393
- - `sse`: HTTP streaming only.
394
- - `websocket`: reusable WebSocket; exact logical prefixes opportunistically use
395
- `previous_response_id` input deltas.
396
- - `websocket-cached`: compatibility alias with the same safe continuation
397
- behavior.
398
- - `auto`: retry transient WebSocket failures, but use sticky per-session SSE
399
- fallback only when the WebSocket upgrade is rejected with HTTP 426. Model,
400
- request, output-limit, context-limit, and post-upgrade connection errors do
401
- not change transports.
402
-
403
- Prewarm is scheduled once per session startup (including resume/fork), in the
404
- background without delaying session initialization. If the first WebSocket
405
- request starts while prewarm is pending, it consumes that one startup handle
406
- before sending. Prewarm sends a best-effort `response.create` with
407
- `generate:false` containing only the startup system/tool/request
408
- envelope—never conversation history or the pending user message. The first real
409
- request appends its full conversation input, and later turns continue from real
410
- response IDs. A failed or timed-out prewarm is not retried on every user
411
- message. Continuation reuse always requires the new request to extend the
412
- previous logical request exactly.
413
-
414
- Native compaction stores opaque encrypted state in the Pi session. Version 4
415
- keeps no preceding messages in model context; the raw session/UI history remains.
416
- It preserves other context handlers' changes and lets Pi restore current
417
- system/tool state. Replay requires the same provider, model, API and effective
418
- profile hash. If these change, restore the original configuration or navigate
419
- before compaction: an opaque checkpoint's placeholder is not a usable text summary.
420
-
421
- Legacy checkpoints still replay unchanged canonical contexts. If an earlier
422
- context handler transforms a legacy checkpoint, continuation stops rather than
423
- guessing its boundary or restoring filtered content. Run `/compact` on the
424
- original model to migrate it. Failed recompression preserves the old checkpoint.
425
- Treat sessions containing native compaction as sensitive data; older extension
426
- versions cannot replay v4 checkpoints.
427
-
428
- ## Apply Patch
429
-
430
- When `apply_patch` activates, the extension temporarily hides Pi's `edit` and
431
- `write` tools and restores their prior positions after switching away.
432
-
433
- The executor supports Codex `@@ class/function` contexts, ordered update
434
- chunks, `*** Move to:`, `*** End of File`, fuzzy matching, CRLF preservation,
435
- and atomic verification before writes. See
436
- [`reference/apply-patch-behavior.md`](https://github.com/oai404iao/omp/blob/main/pi-extensions/pi-codex-minimal-tools/reference/apply-patch-behavior.md).
437
-
438
- ## Legacy Migration
439
-
440
- These `config.json` keys are deprecated but still projected into an in-memory
441
- model override for compatibility:
442
-
443
- | Old key | New model-profile field |
444
- | --- | --- |
445
- | `nativeProviderTools` | `responses.providerShim` plus hosted/standalone tool selection |
446
- | `openaiTransport` | `responses.transport` |
447
- | `openaiWebSocketPrewarm` | `responses.websocketPrewarm` |
448
- | `compactionMode` | `compaction` |
449
- | `requestProfile.responsesMode` | `responses.mode` |
450
- | `requestProfile.reasoningSummary` | `responses.reasoningSummary` |
451
- | `requestProfile.systemPromptPlacement` | `responses.systemPromptPlacement` |
452
- | `requestProfile.patchTransport` | `tools.applyPatch` |
453
- | `apiKeyMode` | `responses.endpoint` |
454
- | `webSearchEnabled` | `tools.webSearch` |
455
- | `viewImage` | `tools.viewImage` |
456
- | `applyPatchEnabled` | `tools.applyPatch` |
457
- | `additionalModelIds` | one exact user catalog entry per model |
458
-
459
- Move these values to extension `models.json`; legacy projection is intended
460
- only as a transition path. `imageGeneration` is no longer a legacy projection:
461
- it is the supported global gate, while per-model selection stays in
462
- `tools.imageGeneration`.
463
-
464
- ## Protocol Reference
465
-
466
- [`reference/`](https://github.com/oai404iao/omp/tree/main/pi-extensions/pi-codex-minimal-tools/reference) documents the Codex snapshot, Responses
467
- Standard/Lite envelopes, namespace tools, WebSocket continuation, custom-tool
468
- streaming/replay, standalone web/image endpoints, compaction, and apply-patch
469
- protocol.
470
-
471
- ## License and publication status
472
-
473
- Project-authored portions are MIT-licensed, copyright 2026 oai404iao.
474
- Third-party material retains its own terms; see
475
- [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
476
-
477
- The Codex namespace-tool source attribution is recorded in
478
- `provenance/openai-codex-eb9dceba-reserved-tools.json`. The existing bundle has
479
- configured trusted publishing, but the split-package alpha still requires
480
- dependency-first bootstrap and activation of the four new packages before
481
- guarded publication can proceed. Responses Lite remains an internal Codex compatibility path,
482
- not an OpenAI-supported public API contract.
3
+ Composition-only entry for Pi's Codex extensions. It loads:
4
+
5
+ - [`pi-codex-core`](../pi-codex-core/README.md): Responses transport, compaction,
6
+ `apply_patch`, `view_image` and diagnostics.
7
+ - [`pi-codex-web-search`](../pi-codex-web-search/README.md): hosted/standalone search.
8
+ - [`pi-codex-imagegen`](../pi-codex-imagegen/README.md): image generation and display.
9
+
10
+ All three use [`pi-codex-runtime`](../pi-codex-runtime/README.md). Compatible
11
+ duplicate installations are deduplicated by the shared broker.
12
+ Peer floor and development target: Pi 0.99.1.
13
+
14
+ Use Pi's `openai` provider for API keys or ChatGPT OAuth (`/login openai`).
15
+ `openai-codex` remains deprecated compatibility only. No credentials, model
16
+ selection or session history are migrated automatically. New requests follow
17
+ Pi's API/base URL rather than plugin `apiKeyMode` or `responses.endpoint`
18
+ overrides outside the legacy provider.
19
+
20
+ `openai/gpt-6.1-sol` defaults to the same profile as `openai/gpt-5.6-sol`:
21
+ Lite, auto WS/SSE, prewarm, standalone web/image, custom patch, native compaction
22
+ and Fast availability (priority, 2x cost multiplier). `view_image` is off.
23
+ These defaults do not establish real-account endpoint access or Fast pricing.
24
+ Exact profiles for `openai/gpt-6-astra`, `gpt-6-sol` and
25
+ `gpt-6-luna` retain Standard SSE with local custom patch and image viewing.
26
+ Remote search/image generation, native compaction, prewarm and Fast default
27
+ off. Enable only the implementations you intend to use in the model profile,
28
+ and declare endpoint support separately; allowlists do not enable tools.
29
+
30
+ Native codemode may call active `apply_patch` and standalone web/image tools.
31
+ Hosted web/image tools and `view_image` remain model-only. The bundle does not
32
+ activate codemode or load MCP servers.
33
+ Script results are structured: patch `{ summary, files }`, search
34
+ `{ output, results }`, and image generation `{ path, latestPath?, image }`.
35
+ With native codemode/tool-search active, core skips speculative prewarm and
36
+ uses Pi text compaction only without an existing opaque native checkpoint;
37
+ otherwise it preserves the checkpoint and refuses recompaction.
38
+
39
+ The package name, default extension factory and
40
+ `@oai404iao/pi-codex-minimal-tools/subagent-inline` remain supported.
41
+ The latter re-exports runtime's identity-only SDK extension.
42
+
43
+ ## Configuration and installation
44
+
45
+ Existing configuration stays at
46
+ `<agentDir>/extensions/pi-codex-minimal-tools/{config,models}.json`.
47
+ The file locations are unchanged. Move nonlegacy endpoint overrides to Pi's
48
+ own `models.json`; `directImageApiFallback` now uses the selected provider's
49
+ Pi credentials and endpoint, not a separate `OPENAI_API_KEY` account.
50
+ Schemas belong only to runtime:
51
+
52
+ - [config.schema.json](https://unpkg.com/@oai404iao/pi-codex-runtime/config.schema.json)
53
+ - [models.schema.json](https://unpkg.com/@oai404iao/pi-codex-runtime/models.schema.json)
54
+
55
+ Global `codexRequestExtensions` defaults to `true`. Set it to `false` to stop
56
+ plugin-generated Codex wire metadata and enhancements while keeping Standard
57
+ tools and hosted result handling; Lite requests and incompatible opaque
58
+ checkpoint transitions are blocked rather than silently downgraded.
59
+
60
+ `endpoint_config` accepts exact `{ provider, baseUrl, webSearch?, imageGeneration?,
61
+ compaction? }` entries. Tool lists contain `"hosted"`/`"standalone"`; compaction
62
+ lists contain `"responses"`/`"responses-compact"`. Omitted lists inherit the
63
+ model profile, `[]` denies the capability, and lists never select a fallback.
64
+ Matching uses Pi's authenticated endpoint. Explicit unsupported responses warn
65
+ and disable that mode only for the current session/endpoint, without changing
66
+ credentials or writing config. See the configuration guide for an example and
67
+ error-classification limits; `/reload` clears transient rejections.
68
+
69
+ Old version-pinned `pi-codex-minimal-tools@1` schema URLs still refer to their
70
+ unchanged published artifacts. This checkout no longer duplicates schemas or
71
+ private `src/*` forwards in the bundle.
72
+
73
+ See the [configuration guide](https://github.com/oai404iao/omp/blob/main/pi-extensions/pi-codex-runtime/reference/configuration.md)
74
+ and [installation/composition guide](https://github.com/oai404iao/omp/blob/main/docs/codex-packages.md).
75
+ For local testing, run root `npm ci --ignore-scripts`, then
76
+ `pi install /absolute/path/to/omp/pi-extensions/pi-codex-minimal-tools`.
77
+ These source changes do not themselves publish a new npm release.
78
+
79
+ Tests live with their implementation owners; cross-package tests are in root
80
+ `tests/codex/`. Protocol references and provenance are indexed in runtime's
81
+ [source map](https://github.com/oai404iao/omp/blob/main/pi-extensions/pi-codex-runtime/reference/source-map.md).
82
+ Responses Lite is an internal compatibility path, not a supported public API.
83
+
84
+ ## License
85
+
86
+ The composition entry is [MIT](LICENSE). Dependencies retain their own licenses
87
+ and source notices; see [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).