pi-openai-toolkit 0.14.3 → 0.14.5
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/README.md +135 -175
- package/README.zh.md +135 -175
- package/docs/internals.md +73 -0
- package/extensions/auto-mode.ts +1 -1
- package/extensions/codex-astra.ts +1 -1
- package/extensions/compaction.ts +1 -1
- package/extensions/image-generation.ts +1 -1
- package/extensions/web-search.ts +1 -1
- package/package.json +127 -126
- package/src/config.ts +621 -582
- package/src/context-management/codex-provider.ts +260 -262
- package/src/context-management/history-notes.ts +325 -319
- package/src/context-management/tools.ts +5 -3
- package/src/context-management/types.ts +161 -160
- package/src/extension-runtime.ts +9 -5
- package/src/image-generation/extension.ts +19 -2
- package/src/image-generation/protocol.ts +473 -405
- package/src/image-generation/service.ts +249 -243
- package/src/image-generation/types.ts +189 -184
- package/src/responses-headers.ts +108 -108
- package/src/runtime.ts +477 -477
- package/src/types.ts +18 -0
- package/src/web-search/prompt.ts +1 -1
package/README.md
CHANGED
|
@@ -1,251 +1,211 @@
|
|
|
1
1
|
# pi-openai-toolkit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](./LICENSE)
|
|
5
|
-
|
|
6
|
-
[简体中文](./README.zh.md)
|
|
7
|
-
|
|
8
|
-
OpenAI toolkit for Pi: Codex Remote Context windows, remote compaction v2, hosted Web Search, image gen, auto mode.
|
|
9
|
-
|
|
10
|
-
`pi-openai-toolkit` bundles five Pi extensions for the OpenAI Responses wire family (`openai-responses` and `openai-codex-responses`):
|
|
11
|
-
|
|
12
|
-
1. **Compaction & Remote Context** (`extensions/compaction.ts`): two long-context strategies. [Codex Remote Context management](#codex-remote-context-management) ports Codex's native window lifecycle to Pi — no-summary `new_context` rollover with a hard notes-checkpoint gate, cross-window `history` / `notes` tools with encrypted argument transport, and budgeted checkpoint reminders. With it off, the extension runs **Remote Compaction v2**: server-side opaque encrypted compaction that never re-summarizes your conversation into lossy text.
|
|
13
|
-
2. **Web Search** (`extensions/web-search.ts`): hosted `web_search` injection for an exact `provider/model-id` allowlist, reusing the live model connection.
|
|
14
|
-
3. **Image Generation** (`extensions/image-generation.ts`): a local `openai_generate_image` tool backed by the hosted `image_generation` tool, for text-to-image and explicit local-reference edits without putting image bytes into session history.
|
|
15
|
-
4. **Auto Mode** (`extensions/auto-mode.ts`): a reviewer-model approval gate on state-changing tool calls so the agent keeps working without interrupting you.
|
|
16
|
-
5. **Codex Astra** (`extensions/codex-astra.ts`): Codex backend version-gate headers and cache-preserving `configuration_update` effort changes for `gpt-6-astra`. Activated silently by model id; no configuration section.
|
|
3
|
+
Add Codex context windows, Responses compaction, hosted tools, and reviewed tool calls to Pi.
|
|
17
4
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Table of Contents
|
|
21
|
-
- [Security](#security)
|
|
22
|
-
- [Background](#background)
|
|
23
|
-
- [Install](#install)
|
|
24
|
-
- [Usage](#usage)
|
|
25
|
-
- [Configuration](#configuration)
|
|
26
|
-
- [Feature guides](#feature-guides)
|
|
27
|
-
- [Development](#development)
|
|
28
|
-
- [API](#api)
|
|
29
|
-
- [Remote Context tools](#remote-context-tools)
|
|
30
|
-
- [HTTP protocol reference](#http-protocol-reference)
|
|
31
|
-
- [Maintainers](#maintainers)
|
|
32
|
-
- [Contributing](#contributing)
|
|
33
|
-
- [License](#license)
|
|
34
|
-
- [Thanks](#thanks)
|
|
5
|
+
[](https://www.npmjs.com/package/pi-openai-toolkit)
|
|
6
|
+
[](LICENSE)
|
|
35
7
|
|
|
36
|
-
|
|
8
|
+
[简体中文](README.zh.md)
|
|
37
9
|
|
|
38
|
-
|
|
39
|
-
- **Gateway isolation.** Gateway-mode Remote Context forwards only the configured data-plane key; OAuth tokens, account cookies, and account ids are stripped, and artifacts always redact credentials, account ids, and opaque encrypted payloads.
|
|
40
|
-
- **Checkpoint gate.** `new_context` cannot discard unsaved working state without either a successful notes write in the window or an explicit `force` the user authorized — the failure mode reported against Codex's own experimental rollout is blocked here.
|
|
41
|
-
- **Billing and review boundaries.** Image generation is opt-in and may incur charges; auto mode reviews run with caching disabled, grant the reviewer read-only tools only, and fail closed in headless sessions.
|
|
10
|
+
## Features
|
|
42
11
|
|
|
43
|
-
|
|
12
|
+
| Feature | Use it to |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| Codex Remote Context | Start a new context window and retrieve earlier windows with `history`. |
|
|
15
|
+
| Remote Compaction v2 | Continue an eligible Responses session with an encrypted server checkpoint. |
|
|
16
|
+
| Hosted Web Search | Give selected models OpenAI's hosted search tool. |
|
|
17
|
+
| Image generation | Generate images or edit explicitly supplied local reference images. |
|
|
18
|
+
| Tool-call review | Ask a reviewer model whether selected tool calls may run. |
|
|
44
19
|
|
|
45
|
-
Pi's
|
|
20
|
+
The package uses Pi's existing model, authentication, and session configuration. It does not add a provider or model.
|
|
46
21
|
|
|
47
|
-
|
|
22
|
+
## Install
|
|
48
23
|
|
|
49
|
-
Requires
|
|
24
|
+
Requires Pi 0.85.1 or newer and Node.js 22.19.0 or newer.
|
|
50
25
|
|
|
51
|
-
|
|
26
|
+
Install the extension:
|
|
52
27
|
|
|
53
28
|
```bash
|
|
54
29
|
pi install npm:pi-openai-toolkit
|
|
55
30
|
```
|
|
56
31
|
|
|
57
|
-
|
|
32
|
+
Use `--local` to install it in the current project.
|
|
58
33
|
|
|
59
|
-
|
|
60
|
-
pi install npm:pi-openai-toolkit --local
|
|
61
|
-
```
|
|
34
|
+
Installing the package alone does not enable every feature. With no extension config, compaction is enabled but Remote Context is off, the Web Search model list is empty, image generation is disabled, and Auto Mode has no allowed models or reviewer.
|
|
62
35
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
pi install git:github.com/awoaCrim/pi-openai-toolkit
|
|
67
|
-
```
|
|
36
|
+
The extension config file is:
|
|
68
37
|
|
|
69
|
-
|
|
38
|
+
`~/.pi/agent/extensions/pi-openai-toolkit/config.json`
|
|
70
39
|
|
|
71
|
-
|
|
40
|
+
All JSON configuration examples below, except the `models.json` example, go in this file. If it does not exist, create the file and its parent directory. If it already exists, merge fields into the matching objects and keep the other settings.
|
|
72
41
|
|
|
73
|
-
|
|
42
|
+
## Quick start: enable Remote Context
|
|
74
43
|
|
|
75
|
-
|
|
44
|
+
This section is for users who want Codex-style context windows. If you only want Web Search, image generation, or tool-call review, skip to [Common tasks](#common-tasks).
|
|
76
45
|
|
|
77
|
-
|
|
46
|
+
### Use Pi's built-in Codex provider
|
|
78
47
|
|
|
79
|
-
|
|
48
|
+
You must already be signed in to Pi's built-in `openai-codex` provider.
|
|
80
49
|
|
|
81
|
-
Create
|
|
50
|
+
Create or merge this extension config:
|
|
82
51
|
|
|
83
52
|
```json
|
|
84
53
|
{
|
|
85
54
|
"compaction": {
|
|
86
|
-
"
|
|
87
|
-
"contextManagement": "remote",
|
|
88
|
-
"contextReminderThresholdPercent": 10,
|
|
89
|
-
"allowCompactionContinuityBreak": false,
|
|
90
|
-
"remoteCompactModel": "uwoacrimson/gpt-5.6-luna",
|
|
91
|
-
"nativeFallback": { "enabled": true, "model": null, "thinkingLevel": "off" },
|
|
92
|
-
"responsesApis": ["openai-responses", "openai-codex-responses"],
|
|
93
|
-
"notifyOnLoad": false,
|
|
94
|
-
"debug": false,
|
|
95
|
-
"logProviderPayloads": false,
|
|
96
|
-
"logCompactResponses": false,
|
|
97
|
-
"redactSensitiveData": true,
|
|
98
|
-
"artifactRoot": "~/.pi/agent/artifacts/pi-openai-toolkit/compaction"
|
|
99
|
-
},
|
|
100
|
-
"webSearch": { "enabled": true, "models": ["uwoacrimson/gpt-5.6-luna"] },
|
|
101
|
-
"imageGeneration": { "enabled": false },
|
|
102
|
-
"autoMode": {
|
|
103
|
-
"enabled": true,
|
|
104
|
-
"models": ["uwoacrimson/gpt-5.6-luna"],
|
|
105
|
-
"reviewerModel": "uwoacrimson/gpt-5.6-luna",
|
|
106
|
-
"gate": "side-effect"
|
|
55
|
+
"contextManagement": "remote"
|
|
107
56
|
}
|
|
108
57
|
}
|
|
109
58
|
```
|
|
110
59
|
|
|
111
|
-
|
|
60
|
+
Start Pi with a model from your existing Codex catalog:
|
|
112
61
|
|
|
113
62
|
```bash
|
|
114
|
-
pi --model
|
|
63
|
+
pi --model openai-codex/<model-id>
|
|
115
64
|
```
|
|
116
65
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
Every key is optional; unknown keys are ignored with a warning rather than written back to your file. `models`-style keys are exact `provider/model-id` allowlists — trimming only, no globbing — so each feature is off until you list a model for it.
|
|
66
|
+
Replace `<model-id>` with the model ID shown by your Pi setup. The session is activated when `new_context`, `get_context_remaining`, `history`, and `notes` appear as available tools.
|
|
120
67
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
| Key | Type / default | Meaning |
|
|
124
|
-
| --- | --- | --- |
|
|
125
|
-
| `enabled` | *boolean*, `true` | Master switch for the compaction extension's hooks. |
|
|
126
|
-
| `contextManagement` | `"off"` \| `"remote"`, `"off"` | Opt into Codex Remote Context management. Covered models are native Codex models plus `gpt-6-astra` on a Codex-compatible gateway (`openai-responses`); the match is built in, there is no allowlist. While it owns a covered model, `remote_compaction_v2` is never sent and Pi-native compaction is cancelled (see [Security](#security)). Set back to `"off"` to roll back. |
|
|
127
|
-
| `contextReminderThresholdPercent` | *integer* `0`-`100`, `5` | Remote Context: inject the once-per-window checkpoint reminder when remaining tokens fall below this percentage of the context window. `0` disables reminders; the exhausted-window fallback still fires. Set it comfortably above Pi's native reserve band (default 16384 tokens ≈ 6% of a 272k window) so the model can roll over before the native threshold. |
|
|
128
|
-
| `allowCompactionContinuityBreak` | *boolean*, `false` | v2 path: restart a fresh opaque chain from current session text when the latest compaction was made by another strategy (e.g. a text summary). |
|
|
129
|
-
| `remoteCompactModel` | *string \| null*, `null` | v2 path: `provider/model-id` used only for the synthetic `remote_compaction_v2` request; the session model never switches. Must resolve to the same effective base URL as the active model. |
|
|
130
|
-
| `nativeFallback.enabled` | *boolean*, `true` | Toolkit-driven native compaction with an explicit summary model when the remote request was attempted and failed. Never touches a successful remote chain. |
|
|
131
|
-
| `nativeFallback.model` | *string \| null*, `null` | Summary model for models that cannot use v2 at all (non-Responses API, or excluded via `responsesApis`). `null` keeps the active model. |
|
|
132
|
-
| `nativeFallback.thinkingLevel` | *string*, `"off"` | Thinking level passed to Pi's `compact()` when this extension supplies the model (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`). |
|
|
133
|
-
| `responsesApis` | *string[]*, both APIs | Narrow which Responses API identifiers may use remote compaction. Applies only when `contextManagement` is `"off"`. |
|
|
134
|
-
| `notifyOnLoad` | *boolean*, `false` | Startup notification banner. |
|
|
135
|
-
| `debug` | *boolean*, `false` | Write lifecycle and compaction artifacts under `artifactRoot`, including the Remote Context activation reason per `session_start`. |
|
|
136
|
-
| `logProviderPayloads` / `logCompactResponses` | *boolean*, `false` | Additionally write raw provider request payloads and compact SSE bodies to artifacts. Keep off unless inspecting a specific request. |
|
|
137
|
-
| `redactSensitiveData` | *boolean*, `true` | Full artifact redaction. Authorization credentials, API keys/tokens, Codex account ids, and opaque `encrypted_content` / `encrypted_output` are always redacted even when this is `false`. |
|
|
138
|
-
| `artifactRoot` | *string*, `~/.pi/agent/artifacts/pi-openai-toolkit/compaction` | Artifact directory root; relative paths resolve against the config directory. |
|
|
139
|
-
|
|
140
|
-
#### `webSearch`
|
|
141
|
-
|
|
142
|
-
| Key | Type / default | Meaning |
|
|
143
|
-
| --- | --- | --- |
|
|
144
|
-
| `enabled` | *boolean*, `true` | Master switch. |
|
|
145
|
-
| `models` | *string[]*, `[]` | Exact allowlist of `provider/model-id` sessions that receive hosted `web_search` injection on `openai-responses` / `openai-codex-responses`. For a listed model the local `web_search` function tool is removed from the payload so native search is the only path; switching away restores it. |
|
|
68
|
+
### Use a compatible gateway
|
|
146
69
|
|
|
147
|
-
|
|
70
|
+
This route requires the `openai-responses` API and a gateway that preserves the Codex protocol fields used by Remote Context. A successful ordinary chat request does not prove Remote Context compatibility.
|
|
148
71
|
|
|
149
|
-
|
|
150
|
-
| --- | --- | --- |
|
|
151
|
-
| `enabled` | *boolean*, `false` | Single opt-in switch for the `openai_generate_image` tool. Off by default because every successful request may incur a charge. No model allowlist: the hosted tool is a capability of the Responses API, so it is exposed to every active model on a Responses wire and hidden elsewhere. |
|
|
72
|
+
If `~/.pi/agent/models.json` already contains a gateway model that meets these conditions, skip model configuration and set the extension allowlist directly. Otherwise, add or merge the provider entry below. Replace `my-gateway`, the URL, the environment variable name, and the model values with values from your setup. The numeric values shown are examples, not project defaults; they must match the actual model and gateway.
|
|
152
73
|
|
|
153
|
-
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"providers": {
|
|
77
|
+
"my-gateway": {
|
|
78
|
+
"baseUrl": "https://your-gateway.example/v1",
|
|
79
|
+
"api": "openai-responses",
|
|
80
|
+
"apiKey": "$MY_GATEWAY_KEY",
|
|
81
|
+
"models": [{
|
|
82
|
+
"id": "gpt-5.6-luna",
|
|
83
|
+
"name": "GPT-5.6 Luna",
|
|
84
|
+
"reasoning": true,
|
|
85
|
+
"input": ["text"],
|
|
86
|
+
"contextWindow": 272000,
|
|
87
|
+
"maxTokens": 128000
|
|
88
|
+
}]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
154
93
|
|
|
155
|
-
|
|
156
|
-
| --- | --- | --- |
|
|
157
|
-
| `enabled` | *boolean*, `true` | Master switch; the mode still cannot engage until a model is allowlisted and `reviewerModel` is set. |
|
|
158
|
-
| `models` | *string[]*, `[]` | Allowlist of active session models permitted to run in auto mode. |
|
|
159
|
-
| `reviewerModel` | *string \| null*, `null` | Approving model (`provider/model-id`, resolved through Pi's registry). Used only for one-off reviews; never becomes the conversation model. |
|
|
160
|
-
| `gate` | `"side-effect"` \| `"all"`, `"side-effect"` | Which tool calls are reviewed. `/auto all` flips the session scope to everything. |
|
|
161
|
-
| `extraTools` | *string[]*, `[]` | Additional reviewed names on top of the side-effect set (`bash`, `write`, `edit`). |
|
|
162
|
-
| `timeoutMs` | *integer* 1000-120000, `30000` | Reviewer deadline across all rounds. Expiry is never approval. |
|
|
163
|
-
| `transcript` | *boolean*, `true` | Give the reviewer a bounded view of the conversation so it can judge authorization, not just intrinsic risk. |
|
|
164
|
-
| `evidenceTools` | *boolean*, `true` | Let the reviewer run Pi's read-only tools (`read`, `grep`, `find`, `ls`) to establish facts. It never receives `bash`, write tools, or network access. |
|
|
165
|
-
| `maxEvidenceRounds` | *integer* 0-8, `3` | Investigation rounds before the reviewer must answer; `0` is a single completion. |
|
|
166
|
-
| `classifier.*` | see code comments | Optional non-blocking low-risk pre-scorer (`enabled` `false`, `model`, `timeoutMs` `15000`, `maxLag` `2`). Can only fast-path ordinary calls, never deny. |
|
|
167
|
-
| `circuitBreaker.*` | — | Denials that end the turn instead of letting agent and reviewer negotiate forever (`consecutiveDenials` `3`, `recentDenials` `10` within `windowSize` `50`; `0` disables). |
|
|
94
|
+
Set the referenced key before starting Pi. In PowerShell:
|
|
168
95
|
|
|
169
|
-
|
|
96
|
+
```powershell
|
|
97
|
+
$env:MY_GATEWAY_KEY = "replace-with-your-gateway-key"
|
|
98
|
+
```
|
|
170
99
|
|
|
171
|
-
|
|
100
|
+
In a POSIX shell:
|
|
172
101
|
|
|
173
|
-
|
|
102
|
+
```bash
|
|
103
|
+
export MY_GATEWAY_KEY="replace-with-your-gateway-key"
|
|
104
|
+
```
|
|
174
105
|
|
|
175
|
-
|
|
106
|
+
Use the same terminal session to start Pi. Create or merge the extension config, and make the allowlist entry exactly match the provider and model ID:
|
|
176
107
|
|
|
177
|
-
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"compaction": {
|
|
111
|
+
"contextManagement": "remote",
|
|
112
|
+
"gatewayContextModels": ["my-gateway/gpt-5.6-luna"]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
178
116
|
|
|
179
|
-
|
|
117
|
+
Start Pi with the same model specification:
|
|
180
118
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
- **Budget.** `get_context_remaining` reports the live window budget; `contextReminderThresholdPercent` controls the once-per-window checkpoint reminder.
|
|
185
|
-
- **Ownership.** For covered models the toolkit owns every compaction event: `remote_compaction_v2` is not sent, and Pi-native compaction is cancelled on all paths — including while the remote runtime is temporarily inactive, so no lossy summary can slip in behind its back. The inactive reason is surfaced as a notification (and in the `session_start` lifecycle artifact when `debug` is on); fix that cause rather than expecting compaction.
|
|
119
|
+
```bash
|
|
120
|
+
pi --model my-gateway/gpt-5.6-luna
|
|
121
|
+
```
|
|
186
122
|
|
|
187
|
-
The
|
|
123
|
+
The enablement check is the same: the session should expose `new_context`, `get_context_remaining`, `history`, and `notes`. If they do not appear, read the toolkit notification and check the exact provider/model string, API, key, base URL, and allowlist entry.
|
|
188
124
|
|
|
189
|
-
|
|
125
|
+
Earlier windows remain available through `history`, but they are not all automatically added to the current context.
|
|
190
126
|
|
|
191
|
-
|
|
127
|
+
## Common tasks
|
|
192
128
|
|
|
193
|
-
|
|
129
|
+
### Continue a session with server-side compaction
|
|
194
130
|
|
|
195
|
-
|
|
131
|
+
Leave Remote Context off when you want the Responses compaction path instead. Remote Compaction v2 stores and replays an encrypted checkpoint for eligible Responses models. Set `compaction.remoteCompactModel` only when the compaction request should use a separate model.
|
|
196
132
|
|
|
197
|
-
|
|
133
|
+
### Enable hosted Web Search
|
|
198
134
|
|
|
199
|
-
|
|
135
|
+
List exact model specifications under `webSearch.models`:
|
|
200
136
|
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"webSearch": {
|
|
140
|
+
"models": ["my-gateway/gpt-5.6-luna"]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
206
143
|
```
|
|
207
144
|
|
|
208
|
-
|
|
145
|
+
For those models, the extension replaces Pi's local `web_search` tool with OpenAI's hosted Responses search tool.
|
|
209
146
|
|
|
210
|
-
|
|
147
|
+
### Generate an image
|
|
211
148
|
|
|
212
|
-
|
|
149
|
+
Image generation requires a Responses session and may incur provider charges. Enable it with:
|
|
213
150
|
|
|
214
|
-
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"imageGeneration": {
|
|
154
|
+
"enabled": true,
|
|
155
|
+
"models": ["gpt-image-2.5", "grok-imagine-image-2.0"]
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
215
159
|
|
|
216
|
-
|
|
217
|
-
| --- | --- | --- |
|
|
218
|
-
| `new_context` | `{ force?: boolean }` | Rolls to the next window without summarizing. Refuses unless a successful notes checkpoint exists in the current window (`force` overrides). Reports "already scheduled" if a rollover is pending. |
|
|
219
|
-
| `get_context_remaining` | none | Remaining tokens and window identity for the current budget; `unknown` when no usage source exists yet. |
|
|
220
|
-
| `history` | `{ action: "list_windows" \| "list_items" \| "read_item" \| "search_contents", ... }` | Reads prior windows. Pass returned `item_id` / window ids **unchanged**. Search text is sent under the encrypted-argument policy. |
|
|
221
|
-
| `notes` | `{ action: "list_files_by_prefix" \| "read_file" \| "search_contents" \| "append_to_file" \| "write_file", path, text, ... }` | Cross-window working memory. Paths resolve under the session agent (e.g. `/root/notes/<file>` or a relative note path); an invalid path is rejected by the backend. Successful append/write is what satisfies the `new_context` gate. |
|
|
160
|
+
`models` contains the bare model IDs used by the nested Responses `image_generation` tool. The first entry is the default; `openai_generate_image` also accepts an optional `model` argument for a one-call override, but it must match a configured entry exactly. If `models` is omitted, the default is `gpt-image-2.5`. Empty or invalid lists are ignored with a warning and fall back to that default; set `enabled` to `false` to disable the tool. The provider or gateway must support the configured image model.
|
|
222
161
|
|
|
223
|
-
|
|
162
|
+
The `openai_generate_image` tool supports text-to-image requests and edits using explicitly supplied local reference images.
|
|
224
163
|
|
|
225
|
-
###
|
|
164
|
+
### Review tool calls automatically
|
|
226
165
|
|
|
227
|
-
|
|
166
|
+
Allow a model and reviewer in `autoMode`:
|
|
228
167
|
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"autoMode": {
|
|
171
|
+
"models": ["my-gateway/gpt-5.6-luna"],
|
|
172
|
+
"reviewerModel": "my-gateway/gpt-5.6-luna"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
233
175
|
```
|
|
234
176
|
|
|
235
|
-
|
|
177
|
+
Use `/auto on` in the session. The default `side-effect` gate reviews `bash`, `write`, `edit`, and configured extra tools. Set `gate` to `"all"` when every tool call needs review. A reviewer timeout does not approve a call.
|
|
236
178
|
|
|
237
|
-
##
|
|
179
|
+
## Common configuration
|
|
238
180
|
|
|
239
|
-
|
|
181
|
+
The config file is `~/.pi/agent/extensions/pi-openai-toolkit/config.json`. Unknown keys are ignored with a warning. Most model lists use exact `provider/model-id` strings, not globs; `imageGeneration.models` is an exception and contains bare nested image-generation model IDs.
|
|
240
182
|
|
|
241
|
-
|
|
183
|
+
| Key | Default | Use |
|
|
184
|
+
| --- | --- | --- |
|
|
185
|
+
| `compaction.enabled` | `true` | Master switch for compaction. |
|
|
186
|
+
| `compaction.contextManagement` | `"off"` | Enables Codex Remote Context when set to `"remote"`. |
|
|
187
|
+
| `compaction.gatewayContextModels` | `[]` | Gateway models allowed to use Remote Context. |
|
|
188
|
+
| `compaction.remoteCompactModel` | unset | Optional model used only for a v2 compaction request. |
|
|
189
|
+
| `compaction.contextReminderThresholdPercent` | `5` | Remaining budget percentage for the once-per-window reminder. `0` disables the reminder and exhausted-window fallback. |
|
|
190
|
+
| `webSearch.models` | `[]` | Models that receive hosted Web Search. |
|
|
191
|
+
| `imageGeneration.enabled` | `false` | Enables `openai_generate_image`. |
|
|
192
|
+
| `imageGeneration.models` | `["gpt-image-2.5"]` | Bare image-generation model IDs; the first entry is the default. |
|
|
193
|
+
| `autoMode.models` | `[]` | Models allowed to use Auto Mode. |
|
|
194
|
+
| `autoMode.reviewerModel` | unset | Model that reviews Auto Mode calls. |
|
|
195
|
+
| `autoMode.gate` | `"side-effect"` | Use `"all"` to review every tool call. |
|
|
196
|
+
| `autoMode.timeoutMs` | `30000` | Review timeout in milliseconds. |
|
|
242
197
|
|
|
243
|
-
|
|
198
|
+
## Development
|
|
244
199
|
|
|
245
|
-
|
|
200
|
+
From the repository root, after dependencies are installed:
|
|
246
201
|
|
|
247
|
-
|
|
202
|
+
```bash
|
|
203
|
+
npm run typecheck # Type-check
|
|
204
|
+
bun test # Run tests
|
|
205
|
+
npm run test:pi # Run the Pi smoke test
|
|
206
|
+
npm pack --dry-run # Inspect the package contents
|
|
207
|
+
```
|
|
248
208
|
|
|
249
|
-
##
|
|
209
|
+
## License
|
|
250
210
|
|
|
251
|
-
|
|
211
|
+
MIT © awoaCrim and contributors. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|