@oai404iao/pi-codex-minimal-tools 3.0.1 → 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 (105) hide show
  1. package/LICENSE +1 -8
  2. package/README.md +85 -464
  3. package/THIRD_PARTY_NOTICES.md +13 -113
  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-ddea03ad-astra.json +0 -54
  11. package/provenance/openai-codex-eb9dceba-reserved-tools.json +0 -140
  12. package/src/activation.ts +0 -1
  13. package/src/adapter/compaction/checkpoint.ts +0 -1
  14. package/src/adapter/compaction/collect.ts +0 -1
  15. package/src/adapter/compaction/http.ts +0 -1
  16. package/src/adapter/compaction/request.ts +0 -1
  17. package/src/adapter/compaction/transport.ts +0 -1
  18. package/src/adapter/compaction/websocket.ts +0 -1
  19. package/src/background-image-generation.ts +0 -1
  20. package/src/capabilities.ts +0 -1
  21. package/src/codex-http.ts +0 -1
  22. package/src/codex-identity-extension.ts +0 -1
  23. package/src/codex-request-profile.ts +0 -1
  24. package/src/codex-reserved-tools.ts +0 -1
  25. package/src/codex-wire-identity.ts +0 -1
  26. package/src/extension/prewarm-snapshot.ts +0 -1
  27. package/src/extension/provider-presentation.ts +0 -1
  28. package/src/extension/provider-runtime.ts +0 -1
  29. package/src/extension/register.ts +0 -36
  30. package/src/extension/startup-prewarm.ts +0 -1
  31. package/src/fast-mode.ts +0 -1
  32. package/src/glyphs.ts +0 -1
  33. package/src/index.ts +0 -11
  34. package/src/model-catalog/catalog.ts +0 -1
  35. package/src/model-catalog/default-models.json +0 -260
  36. package/src/model-catalog/runtime.ts +0 -1
  37. package/src/model-catalog/types.ts +0 -1
  38. package/src/native-compaction.ts +0 -1
  39. package/src/patch/apply.ts +0 -1
  40. package/src/patch/parser.ts +0 -1
  41. package/src/patch/render.ts +0 -1
  42. package/src/provider-headers.ts +0 -1
  43. package/src/provider-native-tools.ts +0 -1
  44. package/src/provider-shim.ts +0 -20
  45. package/src/providers/codex-apply-patch-tool.ts +0 -1
  46. package/src/providers/codex-apply-patch.lark +0 -19
  47. package/src/providers/openai-codex/cache-key.ts +0 -1
  48. package/src/providers/openai-codex/captured-stream.ts +0 -1
  49. package/src/providers/openai-codex/constants.ts +0 -1
  50. package/src/providers/openai-codex/continuation.ts +0 -1
  51. package/src/providers/openai-codex/errors.ts +0 -1
  52. package/src/providers/openai-codex/events.ts +0 -1
  53. package/src/providers/openai-codex/headers.ts +0 -1
  54. package/src/providers/openai-codex/lite.ts +0 -1
  55. package/src/providers/openai-codex/message.ts +0 -1
  56. package/src/providers/openai-codex/prewarm.ts +0 -1
  57. package/src/providers/openai-codex/proxy.ts +0 -1
  58. package/src/providers/openai-codex/reasoning.ts +0 -1
  59. package/src/providers/openai-codex/request-body.ts +0 -1
  60. package/src/providers/openai-codex/request-context.ts +0 -1
  61. package/src/providers/openai-codex/request-metadata.ts +0 -1
  62. package/src/providers/openai-codex/retry.ts +0 -1
  63. package/src/providers/openai-codex/runtime.ts +0 -1
  64. package/src/providers/openai-codex/sse.ts +0 -1
  65. package/src/providers/openai-codex/stream-effects.ts +0 -1
  66. package/src/providers/openai-codex/stream.ts +0 -1
  67. package/src/providers/openai-codex/types.ts +0 -1
  68. package/src/providers/openai-codex/urls.ts +0 -1
  69. package/src/providers/openai-codex/usage.ts +0 -1
  70. package/src/providers/openai-codex/websocket-connection.ts +0 -1
  71. package/src/providers/openai-codex/websocket-events.ts +0 -1
  72. package/src/providers/openai-codex/websocket-session.ts +0 -1
  73. package/src/providers/openai-codex/websocket-socket.ts +0 -1
  74. package/src/providers/openai-codex/websocket-stream.ts +0 -1
  75. package/src/providers/openai-responses-shared.ts +0 -7
  76. package/src/providers/responses/citations.ts +0 -1
  77. package/src/providers/responses/history.ts +0 -1
  78. package/src/providers/responses/items.ts +0 -1
  79. package/src/providers/responses/markdown.ts +0 -1
  80. package/src/providers/responses/messages.ts +0 -1
  81. package/src/providers/responses/signatures.ts +0 -1
  82. package/src/providers/responses/stream-state.ts +0 -1
  83. package/src/providers/responses/stream.ts +0 -1
  84. package/src/providers/responses/text-renderer.ts +0 -1
  85. package/src/providers/responses/text.ts +0 -1
  86. package/src/providers/responses/tool-identity.ts +0 -1
  87. package/src/providers/responses/tools.ts +0 -1
  88. package/src/providers/responses/types.ts +0 -1
  89. package/src/providers/responses/usage.ts +0 -1
  90. package/src/settings.ts +0 -1
  91. package/src/tools/apply-patch.ts +0 -1
  92. package/src/tools/image-generation/capture.ts +0 -1
  93. package/src/tools/image-generation/display.ts +0 -1
  94. package/src/tools/image-generation/preview.ts +0 -1
  95. package/src/tools/image-generation/storage.ts +0 -1
  96. package/src/tools/image-generation/types.ts +0 -1
  97. package/src/tools/image-generation.ts +0 -1
  98. package/src/tools/view-image.ts +0 -1
  99. package/src/tools/web-search/activity.ts +0 -1
  100. package/src/tools/web-search/capture.ts +0 -1
  101. package/src/tools/web-search/render.ts +0 -1
  102. package/src/tools/web-search.ts +0 -1
  103. package/src/utils/images.ts +0 -1
  104. package/src/utils/theme.ts +0 -1
  105. /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,466 +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.86.1; tested against 0.86.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 0.86.1 provides the Astra model descriptor; it is now the package peer
327
- floor. The extension composes its stream shim over that provider and does not
328
- replace authentication, streams, or the model catalog.
329
- The descriptor keeps the production default at 272,000 context tokens and
330
- 128,000 output tokens. A backend-authorized larger context must be selected
331
- explicitly through Pi's provider `modelOverrides`; the extension does not infer
332
- that entitlement from the Astra slug.
333
-
334
- These entries are defaults, not claims that every proxy with the same model
335
- slug supports the protocol. Override or disable a profile for the endpoint
336
- actually in use.
337
-
338
- ## Web Search
339
-
340
- `tools.webSearch` supports two implementations:
341
-
342
- - `hosted`: rewrites the Pi placeholder to Responses
343
- `{"type":"web_search"}` and preserves progress, sources, results, and
344
- citation replay. Standard Responses only.
345
- - `standalone`: exposes `web.run` as a client-executed namespace tool and calls
346
- the provider's `alpha/search` endpoint. It supports search/image queries,
347
- open/click/find, PDF screenshots, finance, weather, sports, and time.
348
-
349
- Standalone search sends a bounded recent visible conversation tail, resolved
350
- Pi authentication, direct-caller/live-web settings, the active turn metadata,
351
- and the model's 10,000-token truncation budget. Search rows stay compact by
352
- default and show deduplicated source hosts; expand the tool row to inspect the
353
- raw result text.
354
-
355
- ## Image Generation
356
-
357
- Set global `config.json.imageGeneration` to `false` to disable the entire
358
- generation capability. Per-model `tools.imageGeneration:false` disables only
359
- that profile. Neither setting disables image input or historical image replay.
360
-
361
- `tools.imageGeneration` supports:
362
-
363
- - `hosted`: Responses `image_generation`.
364
- - `standalone`: `image_gen.imagegen`, backed by the provider's
365
- `images/generations` and `images/edits` endpoints.
366
-
367
- Standalone input follows current Codex:
368
-
369
- - required `prompt`;
370
- - up to five `referenced_image_paths`; or
371
- - `num_last_images_to_include` from 1 through 5.
372
-
373
- Generated PNGs are saved under `imageOutputDir`, mirrored to `latest.png`, and
374
- returned to the model before the saved-path text. `/image-gen` selects any
375
- loaded image-capable model with an enabled catalog profile.
376
-
377
- ## WebSocket And Compaction
378
-
379
- Global `config.json.webSocketEnabled:false` forces `sse` and disables
380
- WebSocket prewarm without changing the selected per-model profile. When it is
381
- `true` (the default), each profile's `responses.transport` and
382
- `responses.websocketPrewarm` values apply.
383
-
384
- `transport` values:
385
-
386
- - `sse`: HTTP streaming only.
387
- - `websocket`: reusable WebSocket; exact logical prefixes opportunistically use
388
- `previous_response_id` input deltas.
389
- - `websocket-cached`: compatibility alias with the same safe continuation
390
- behavior.
391
- - `auto`: retry transient WebSocket failures, but use sticky per-session SSE
392
- fallback only when the WebSocket upgrade is rejected with HTTP 426. Model,
393
- request, output-limit, context-limit, and post-upgrade connection errors do
394
- not change transports.
395
-
396
- Prewarm is scheduled once per session startup (including resume/fork), in the
397
- background without delaying session initialization. If the first WebSocket
398
- request starts while prewarm is pending, it consumes that one startup handle
399
- before sending. Prewarm sends a best-effort `response.create` with
400
- `generate:false` containing only the startup system/tool/request
401
- envelope—never conversation history or the pending user message. The first real
402
- request appends its full conversation input, and later turns continue from real
403
- response IDs. A failed or timed-out prewarm is not retried on every user
404
- message. Continuation reuse always requires the new request to extend the
405
- previous logical request exactly.
406
-
407
- Native compaction stores opaque encrypted state in the Pi session. New
408
- checkpoints replay only to the same provider, model, API, and effective
409
- profile hash. Switching any of those falls back to Pi's retained local
410
- context. Treat session files containing native compaction as sensitive data.
411
-
412
- ## Apply Patch
413
-
414
- When `apply_patch` activates, the extension temporarily hides Pi's `edit` and
415
- `write` tools and restores their prior positions after switching away.
416
-
417
- The executor supports Codex `@@ class/function` contexts, ordered update
418
- chunks, `*** Move to:`, `*** End of File`, fuzzy matching, CRLF preservation,
419
- and atomic verification before writes. See
420
- [`reference/apply-patch-behavior.md`](https://github.com/oai404iao/omp/blob/main/pi-extensions/pi-codex-minimal-tools/reference/apply-patch-behavior.md).
421
-
422
- ## Legacy Migration
423
-
424
- These `config.json` keys are deprecated but still projected into an in-memory
425
- model override for compatibility:
426
-
427
- | Old key | New model-profile field |
428
- | --- | --- |
429
- | `nativeProviderTools` | `responses.providerShim` plus hosted/standalone tool selection |
430
- | `openaiTransport` | `responses.transport` |
431
- | `openaiWebSocketPrewarm` | `responses.websocketPrewarm` |
432
- | `compactionMode` | `compaction` |
433
- | `requestProfile.responsesMode` | `responses.mode` |
434
- | `requestProfile.reasoningSummary` | `responses.reasoningSummary` |
435
- | `requestProfile.systemPromptPlacement` | `responses.systemPromptPlacement` |
436
- | `requestProfile.patchTransport` | `tools.applyPatch` |
437
- | `apiKeyMode` | `responses.endpoint` |
438
- | `webSearchEnabled` | `tools.webSearch` |
439
- | `viewImage` | `tools.viewImage` |
440
- | `applyPatchEnabled` | `tools.applyPatch` |
441
- | `additionalModelIds` | one exact user catalog entry per model |
442
-
443
- Move these values to extension `models.json`; legacy projection is intended
444
- only as a transition path. `imageGeneration` is no longer a legacy projection:
445
- it is the supported global gate, while per-model selection stays in
446
- `tools.imageGeneration`.
447
-
448
- ## Protocol Reference
449
-
450
- [`reference/`](https://github.com/oai404iao/omp/tree/main/pi-extensions/pi-codex-minimal-tools/reference) documents the Codex snapshot, Responses
451
- Standard/Lite envelopes, namespace tools, WebSocket continuation, custom-tool
452
- streaming/replay, standalone web/image endpoints, compaction, and apply-patch
453
- protocol.
454
-
455
- ## License and publication status
456
-
457
- Project-authored portions are MIT-licensed, copyright 2026 oai404iao.
458
- Third-party material retains its own terms; see
459
- [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
460
-
461
- The Codex namespace-tool source attribution is recorded in
462
- `provenance/openai-codex-eb9dceba-reserved-tools.json`. The existing bundle has
463
- configured trusted publishing, but the split-package alpha still requires
464
- dependency-first bootstrap and activation of the four new packages before
465
- guarded publication can proceed. Responses Lite remains an internal Codex compatibility path,
466
- 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).