pi-openai-toolkit 0.14.13 → 0.15.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.
- package/README.md +250 -241
- package/README.zh.md +250 -241
- package/config.schema.json +352 -0
- package/docs/configuration.md +176 -0
- package/docs/internals.md +139 -128
- package/package.json +135 -127
- package/src/auto-mode/extension.ts +35 -13
- package/src/config/legacy.ts +717 -0
- package/src/config/migration.ts +100 -0
- package/src/config/notifications.ts +28 -0
- package/src/config/policy.ts +122 -0
- package/src/config/v2.ts +1347 -0
- package/src/config-command.ts +73 -0
- package/src/config.ts +318 -739
- package/src/context-management/tools.ts +353 -347
- package/src/context-management/window-manager.ts +696 -693
- package/src/debug.ts +5 -5
- package/src/deferred-tool-carryover.ts +3 -1
- package/src/extension-runtime.ts +1375 -1329
- package/src/image-generation/extension.ts +14 -18
- package/src/image-generation/protocol.ts +10 -4
- package/src/image-generation/service.ts +9 -3
- package/src/request-context-cache.ts +2 -1
- package/src/types.ts +641 -628
- package/src/web-search/alpha-client.ts +876 -875
- package/src/web-search/extension.ts +518 -523
- package/src/web-search/payload.ts +295 -295
- package/src/web-search/prompt.ts +60 -59
- package/src/web-search/types.ts +144 -144
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/awoaCrim/pi-openai-toolkit/blob/main/config.schema.json",
|
|
4
|
+
"title": "Pi OpenAI Toolkit global configuration v2",
|
|
5
|
+
"description": "Strict schema for the canonical global Toolkit configuration. Runtime validation additionally enforces normalized exact keys and image default membership.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"schemaVersion"
|
|
10
|
+
],
|
|
11
|
+
"properties": {
|
|
12
|
+
"$schema": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Optional schema metadata URI. It does not select a runtime schema."
|
|
15
|
+
},
|
|
16
|
+
"schemaVersion": {
|
|
17
|
+
"const": 2
|
|
18
|
+
},
|
|
19
|
+
"defaults": {
|
|
20
|
+
"$ref": "#/$defs/defaults"
|
|
21
|
+
},
|
|
22
|
+
"models": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"propertyNames": {
|
|
25
|
+
"pattern": "^[^\\s*?\\[\\]{}\\u0000-\\u001f\\u007f]+/[^\\s*?\\[\\]{}\\u0000-\\u001f\\u007f]+$"
|
|
26
|
+
},
|
|
27
|
+
"additionalProperties": {
|
|
28
|
+
"$ref": "#/$defs/modelOverride"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"diagnostics": {
|
|
32
|
+
"$ref": "#/$defs/diagnostics"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"$defs": {
|
|
36
|
+
"modelRef": {
|
|
37
|
+
"description": "Exact provider/model reference; model ids may contain additional slashes.",
|
|
38
|
+
"anyOf": [
|
|
39
|
+
{
|
|
40
|
+
"type": "null"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1,
|
|
45
|
+
"pattern": "^[^\\s*?\\[\\]{}\\u0000-\\u001f\\u007f]+/[^\\s*?\\[\\]{}\\u0000-\\u001f\\u007f]+$"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"stringList": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"responsesApis": {
|
|
56
|
+
"type": "array",
|
|
57
|
+
"items": {
|
|
58
|
+
"enum": [
|
|
59
|
+
"openai-responses",
|
|
60
|
+
"openai-codex-responses"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"context": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"properties": {
|
|
68
|
+
"mode": {
|
|
69
|
+
"enum": [
|
|
70
|
+
"pi",
|
|
71
|
+
"remote-compaction",
|
|
72
|
+
"remote-windows"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"remoteCompaction": {
|
|
76
|
+
"$ref": "#/$defs/remoteCompaction"
|
|
77
|
+
},
|
|
78
|
+
"nativeFallback": {
|
|
79
|
+
"$ref": "#/$defs/nativeFallback"
|
|
80
|
+
},
|
|
81
|
+
"remoteWindows": {
|
|
82
|
+
"$ref": "#/$defs/remoteWindows"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"remoteCompaction": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"properties": {
|
|
90
|
+
"model": {
|
|
91
|
+
"$ref": "#/$defs/modelRef"
|
|
92
|
+
},
|
|
93
|
+
"inputSource": {
|
|
94
|
+
"enum": [
|
|
95
|
+
"legacy",
|
|
96
|
+
"pi-context-hook"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"allowContinuityBreak": {
|
|
100
|
+
"type": "boolean"
|
|
101
|
+
},
|
|
102
|
+
"apis": {
|
|
103
|
+
"$ref": "#/$defs/responsesApis"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"nativeFallback": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"additionalProperties": false,
|
|
110
|
+
"properties": {
|
|
111
|
+
"enabled": {
|
|
112
|
+
"type": "boolean"
|
|
113
|
+
},
|
|
114
|
+
"model": {
|
|
115
|
+
"$ref": "#/$defs/modelRef"
|
|
116
|
+
},
|
|
117
|
+
"thinkingLevel": {
|
|
118
|
+
"enum": [
|
|
119
|
+
"off",
|
|
120
|
+
"minimal",
|
|
121
|
+
"low",
|
|
122
|
+
"medium",
|
|
123
|
+
"high",
|
|
124
|
+
"xhigh",
|
|
125
|
+
"max"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"remoteWindows": {
|
|
131
|
+
"type": "object",
|
|
132
|
+
"additionalProperties": false,
|
|
133
|
+
"properties": {
|
|
134
|
+
"leaveManagedMode": {
|
|
135
|
+
"enum": [
|
|
136
|
+
"warn",
|
|
137
|
+
"compact"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"reminderThresholdPercent": {
|
|
141
|
+
"type": "integer",
|
|
142
|
+
"minimum": 0,
|
|
143
|
+
"maximum": 100
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"webSearch": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"additionalProperties": false,
|
|
150
|
+
"properties": {
|
|
151
|
+
"route": {
|
|
152
|
+
"enum": [
|
|
153
|
+
"unmanaged",
|
|
154
|
+
"local",
|
|
155
|
+
"hosted",
|
|
156
|
+
"standalone-alpha"
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"imageGeneration": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"additionalProperties": false,
|
|
164
|
+
"properties": {
|
|
165
|
+
"enabled": {
|
|
166
|
+
"type": "boolean"
|
|
167
|
+
},
|
|
168
|
+
"defaultModel": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"minLength": 1,
|
|
171
|
+
"maxLength": 256,
|
|
172
|
+
"pattern": "\\S"
|
|
173
|
+
},
|
|
174
|
+
"allowedModels": {
|
|
175
|
+
"type": "array",
|
|
176
|
+
"minItems": 1,
|
|
177
|
+
"items": {
|
|
178
|
+
"type": "string",
|
|
179
|
+
"minLength": 1,
|
|
180
|
+
"maxLength": 256,
|
|
181
|
+
"pattern": "\\S"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"autoMode": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"additionalProperties": false,
|
|
189
|
+
"properties": {
|
|
190
|
+
"available": {
|
|
191
|
+
"type": "boolean"
|
|
192
|
+
},
|
|
193
|
+
"reviewerModel": {
|
|
194
|
+
"$ref": "#/$defs/modelRef"
|
|
195
|
+
},
|
|
196
|
+
"gate": {
|
|
197
|
+
"enum": [
|
|
198
|
+
"side-effect",
|
|
199
|
+
"all"
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
"extraTools": {
|
|
203
|
+
"$ref": "#/$defs/stringList"
|
|
204
|
+
},
|
|
205
|
+
"timeoutMs": {
|
|
206
|
+
"type": "integer",
|
|
207
|
+
"minimum": 1000,
|
|
208
|
+
"maximum": 120000
|
|
209
|
+
},
|
|
210
|
+
"transcript": {
|
|
211
|
+
"type": "boolean"
|
|
212
|
+
},
|
|
213
|
+
"evidenceTools": {
|
|
214
|
+
"type": "boolean"
|
|
215
|
+
},
|
|
216
|
+
"maxEvidenceRounds": {
|
|
217
|
+
"type": "integer",
|
|
218
|
+
"minimum": 0,
|
|
219
|
+
"maximum": 8
|
|
220
|
+
},
|
|
221
|
+
"classifier": {
|
|
222
|
+
"$ref": "#/$defs/classifier"
|
|
223
|
+
},
|
|
224
|
+
"circuitBreaker": {
|
|
225
|
+
"$ref": "#/$defs/circuitBreaker"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"classifier": {
|
|
230
|
+
"type": "object",
|
|
231
|
+
"additionalProperties": false,
|
|
232
|
+
"properties": {
|
|
233
|
+
"enabled": {
|
|
234
|
+
"type": "boolean"
|
|
235
|
+
},
|
|
236
|
+
"model": {
|
|
237
|
+
"$ref": "#/$defs/modelRef"
|
|
238
|
+
},
|
|
239
|
+
"timeoutMs": {
|
|
240
|
+
"type": "integer",
|
|
241
|
+
"minimum": 1000,
|
|
242
|
+
"maximum": 120000
|
|
243
|
+
},
|
|
244
|
+
"maxLag": {
|
|
245
|
+
"type": "integer",
|
|
246
|
+
"minimum": 0,
|
|
247
|
+
"maximum": 20
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
"circuitBreaker": {
|
|
252
|
+
"type": "object",
|
|
253
|
+
"additionalProperties": false,
|
|
254
|
+
"properties": {
|
|
255
|
+
"consecutiveDenials": {
|
|
256
|
+
"type": "integer",
|
|
257
|
+
"minimum": 0,
|
|
258
|
+
"maximum": 100
|
|
259
|
+
},
|
|
260
|
+
"recentDenials": {
|
|
261
|
+
"type": "integer",
|
|
262
|
+
"minimum": 0,
|
|
263
|
+
"maximum": 100
|
|
264
|
+
},
|
|
265
|
+
"windowSize": {
|
|
266
|
+
"type": "integer",
|
|
267
|
+
"minimum": 1,
|
|
268
|
+
"maximum": 200
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
"compatibility": {
|
|
273
|
+
"type": "object",
|
|
274
|
+
"additionalProperties": false,
|
|
275
|
+
"properties": {
|
|
276
|
+
"transport": {
|
|
277
|
+
"enum": [
|
|
278
|
+
"standard",
|
|
279
|
+
"codex-gateway"
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"defaults": {
|
|
285
|
+
"type": "object",
|
|
286
|
+
"additionalProperties": false,
|
|
287
|
+
"properties": {
|
|
288
|
+
"context": {
|
|
289
|
+
"$ref": "#/$defs/context"
|
|
290
|
+
},
|
|
291
|
+
"webSearch": {
|
|
292
|
+
"$ref": "#/$defs/webSearch"
|
|
293
|
+
},
|
|
294
|
+
"imageGeneration": {
|
|
295
|
+
"$ref": "#/$defs/imageGeneration"
|
|
296
|
+
},
|
|
297
|
+
"autoMode": {
|
|
298
|
+
"$ref": "#/$defs/autoMode"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
"modelOverride": {
|
|
303
|
+
"type": "object",
|
|
304
|
+
"additionalProperties": false,
|
|
305
|
+
"properties": {
|
|
306
|
+
"context": {
|
|
307
|
+
"$ref": "#/$defs/context"
|
|
308
|
+
},
|
|
309
|
+
"webSearch": {
|
|
310
|
+
"$ref": "#/$defs/webSearch"
|
|
311
|
+
},
|
|
312
|
+
"autoMode": {
|
|
313
|
+
"$ref": "#/$defs/autoMode"
|
|
314
|
+
},
|
|
315
|
+
"compatibility": {
|
|
316
|
+
"$ref": "#/$defs/compatibility"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
"diagnostics": {
|
|
321
|
+
"type": "object",
|
|
322
|
+
"additionalProperties": false,
|
|
323
|
+
"properties": {
|
|
324
|
+
"level": {
|
|
325
|
+
"enum": [
|
|
326
|
+
"error",
|
|
327
|
+
"warn",
|
|
328
|
+
"info",
|
|
329
|
+
"debug"
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
"notifyOnLoad": {
|
|
333
|
+
"type": "boolean"
|
|
334
|
+
},
|
|
335
|
+
"captureRequests": {
|
|
336
|
+
"type": "boolean"
|
|
337
|
+
},
|
|
338
|
+
"captureResponses": {
|
|
339
|
+
"type": "boolean"
|
|
340
|
+
},
|
|
341
|
+
"redactSensitiveData": {
|
|
342
|
+
"type": "boolean"
|
|
343
|
+
},
|
|
344
|
+
"artifactRoot": {
|
|
345
|
+
"type": "string",
|
|
346
|
+
"minLength": 1,
|
|
347
|
+
"pattern": "\\S"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Toolkit configuration
|
|
2
|
+
|
|
3
|
+
Toolkit reads only `~/.pi/agent/extensions/pi-openai-toolkit/config.json`. There are no project overrides, environment policy overlays, profiles, `extends`, or wildcard rules. Pi still owns extension loading, provider endpoints, model registration, and credentials. A project-local extension installation does not create project-local Toolkit policy.
|
|
4
|
+
|
|
5
|
+
This reference describes schema v2. Unversioned legacy configuration remains supported. Configuration schema v2 and Remote Compaction v2 are separate version numbers.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### Start with a small document
|
|
10
|
+
|
|
11
|
+
Create the file and parent directory if absent. This example states the shipped feature defaults; it is not a conversion of an existing legacy file:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"schemaVersion": 2,
|
|
16
|
+
"defaults": {
|
|
17
|
+
"context": { "mode": "remote-compaction" },
|
|
18
|
+
"webSearch": { "route": "unmanaged" },
|
|
19
|
+
"imageGeneration": {
|
|
20
|
+
"enabled": false,
|
|
21
|
+
"defaultModel": "gpt-image-2.5",
|
|
22
|
+
"allowedModels": ["gpt-image-2.5"]
|
|
23
|
+
},
|
|
24
|
+
"autoMode": { "available": false }
|
|
25
|
+
},
|
|
26
|
+
"models": {},
|
|
27
|
+
"diagnostics": {
|
|
28
|
+
"level": "info",
|
|
29
|
+
"notifyOnLoad": false,
|
|
30
|
+
"captureRequests": false,
|
|
31
|
+
"captureResponses": false,
|
|
32
|
+
"redactSensitiveData": true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`$schema` is optional editor metadata pointing to the shipped [config.schema.json](../config.schema.json). It does not change runtime schema selection. The editor schema describes canonical spelling; runtime also trims surrounding whitespace in supported strings and deduplicates lists. Runtime validation checks normalized key collisions and image-default membership that the editor schema cannot express.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Resolution and errors
|
|
42
|
+
|
|
43
|
+
Precedence is built-ins, then `defaults`, then `models["provider/model-id"]`. Keys are exact and case-sensitive. Leading/trailing whitespace is trimmed; conflicting normalized keys are rejected. Model IDs may contain further slashes. No pattern matching or endpoint/capability guessing occurs.
|
|
44
|
+
|
|
45
|
+
Known nested objects merge by field. Missing fields inherit, arrays replace instead of append, and `false`/`0` retain their meanings. Only optional model references accept `null`: context producer, native-fallback model, auto reviewer, and classifier model. `null` elsewhere is invalid. Defaults do not prohibit exact overrides; an exact model can set `available: true` over a default of `false`.
|
|
46
|
+
|
|
47
|
+
A missing file uses independent built-in defaults. Invalid JSON, an unreadable file, missing/unsupported `schemaVersion` on a v2-shaped document, or mixed legacy/v2 fields are reported distinctly. Unknown v2 policy keys are errors in their owning scope. Invalid selected settings block dependent operations; they never silently pick a more permissive route. Errors in other models remain visible without replacing a valid current model's policy. A valid exact leaf may shadow an invalid default leaf, but cannot hide a malformed containing object or unknown field in that feature scope.
|
|
48
|
+
|
|
49
|
+
Each public callback, tool execution, compaction, reviewer/classifier operation, or config command uses an immutable snapshot across its awaited helpers. The next operation reads again. This does not make separate Pi headers, payload, and tool events one atomic transaction. Engagement, overrides, scores, windows, and results stay out of the config file.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### Context
|
|
54
|
+
|
|
55
|
+
Place `context` under `defaults` or an exact `models` entry.
|
|
56
|
+
|
|
57
|
+
| Relative field | Default | Contract |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `mode` | `"remote-compaction"` | `"pi"` relinquishes Toolkit context management; `"remote-compaction"` uses the eligible Responses checkpoint path; `"remote-windows"` selects Codex windows where supported. |
|
|
60
|
+
| `remoteCompaction.model` | `null` | Exact producer reference; `null` uses the active model. It must share the effective base URL required by the existing compaction path. |
|
|
61
|
+
| `remoteCompaction.inputSource` | `"legacy"` | `"legacy"` preserves session/raw-branch input; `"pi-context-hook"` opts into Pi's ordered context projection. Checkpoint provenance must match. |
|
|
62
|
+
| `remoteCompaction.allowContinuityBreak` | `false` | Allow restarting from Pi context after a foreign compaction entry. It does not make malformed opaque checkpoints replayable. |
|
|
63
|
+
| `remoteCompaction.apis` | `["openai-responses", "openai-codex-responses"]` | May narrow this set; `[]` permits no remote-compaction API. Unsupported entries are errors. |
|
|
64
|
+
| `nativeFallback.enabled` | `true` | Enable the existing native-method fallback tier. |
|
|
65
|
+
| `nativeFallback.model` | `null` | Optional summary-model reference on the remote-ineligible path. After a remote attempt fails, the existing producer-first fallback order is retained. |
|
|
66
|
+
| `nativeFallback.thinkingLevel` | `"off"` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`; actual model support still applies. |
|
|
67
|
+
| `remoteWindows.leaveManagedMode` | `"warn"` | `"compact"` also requests a close-out when retired history exceeds 80% of the next model's window and compaction can finish. Print mode remains warning-only; turn-end close-out requires a queued trim. |
|
|
68
|
+
| `remoteWindows.reminderThresholdPercent` | `5` | Integer 0-100. `0` disables both the once-per-window reminder and exhausted-window fallback. |
|
|
69
|
+
|
|
70
|
+
Native Codex eligibility derives from the actual Pi provider/API. Gateways additionally need the exact transport opt-in below. `remote-windows` retains the compaction chain for models outside window capability. A configured window model whose activation fails does not silently receive a summary fallback. The rollover notes gate, durable history, producer/consumer identities, and checkpoint provenance are unchanged. See [Toolkit internals](internals.md).
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### Compatibility transport
|
|
75
|
+
|
|
76
|
+
Only `models["provider/model-id"].compatibility.transport` is configurable: `"standard"` is the internal baseline and `"codex-gateway"` is an exact opt-in. There is no global `defaults.compatibility` and no built-in gateway model list.
|
|
77
|
+
|
|
78
|
+
This selects an existing Toolkit protocol profile, independently of context mode. It does not change Pi's provider, API, endpoint, or model. The same decoded document supplies compatibility for search, image generation, and a separately named compaction producer. A successful config resolution is not a backend capability test.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Web Search
|
|
83
|
+
|
|
84
|
+
`defaults.webSearch.route` and `models[exact].webSearch.route` accept:
|
|
85
|
+
|
|
86
|
+
| Route | Behavior |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| `unmanaged` | Default. Release Toolkit ownership and remove Toolkit-owned standalone exposure. Third-party search and unrelated network tools remain possible. |
|
|
89
|
+
| `local` | Restore the original local tool state and remove native/standalone search conflicts from provider payloads. Never activate a previously inactive local tool. |
|
|
90
|
+
| `hosted` | Use native Responses search with source annotations; suppress conflicting local and standalone tools. |
|
|
91
|
+
| `standalone-alpha` | Experimental, explicit opt-in. Expose sequential `web_run` and call the provider-relative `/alpha/search` endpoint once per execution. |
|
|
92
|
+
|
|
93
|
+
There is no v2 search master switch. `local` and `unmanaged` differ in payload cleanup and ownership. Missing auth, an unavailable route, a tool conflict, or invalid selected policy does not trigger another route. Standalone supports `search_query`, `image_query`, `open`, `click`, `find`, `screenshot`, `finance`, `weather`, `sports`, and `time`, with `response_length`. It sends a bounded command envelope rather than the full transcript; follow-up references depend on the provider's session/reference handling. The gateway must expose the endpoint and its standalone-search capability.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### Images
|
|
98
|
+
|
|
99
|
+
Image settings are global-only under `defaults.imageGeneration`. `enabled` defaults to `false`. `defaultModel` defaults to `"gpt-image-2.5"`; `allowedModels` defaults to `["gpt-image-2.5"]`.
|
|
100
|
+
|
|
101
|
+
These are bare output-model IDs, not active-session model keys. Each normalized ID must contain 1-256 characters. The allowed list must remain nonempty after normalization and contain the explicit default. Order has no default-selection meaning. A caller's one-call `model` must be a member; policy and membership are checked before auth, local-reference preparation/upload, and paid dispatch. The active session remains the Responses routing model. Config does not grant permission to upload arbitrary local files or imply that a provider supports a particular image model.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### Auto Mode
|
|
106
|
+
|
|
107
|
+
Place `autoMode` under `defaults` or an exact model. `available` permits engagement; it does not engage the runtime. Use `/auto on` or `--auto`, and `/auto off` to disengage. If an engaged session encounters invalid policy, calls remain blocked until policy is corrected or the user explicitly turns the gate off. A review timeout never means approval.
|
|
108
|
+
|
|
109
|
+
| Relative field | Default | Contract |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| `available` | `false` | Model eligibility for engagement. |
|
|
112
|
+
| `reviewerModel` | `null` | Exact review-model reference; required for useful engagement. |
|
|
113
|
+
| `gate` | `"side-effect"` | Reviews `bash`, `write`, `edit`, and `extraTools`; `"all"` reviews every tool. Session gate overrides remain runtime state. |
|
|
114
|
+
| `extraTools` | `[]` | Additional names for the side-effect gate. |
|
|
115
|
+
| `timeoutMs` | `30000` | Integer 1000-120000 milliseconds. |
|
|
116
|
+
| `transcript` | `true` | Include transcript context in the blocking review. |
|
|
117
|
+
| `evidenceTools` | `true` | Permit the reviewer's existing read-only evidence tools. |
|
|
118
|
+
| `maxEvidenceRounds` | `3` | Integer 0-8. |
|
|
119
|
+
| `classifier.enabled` | `false` | Enable nonblocking trajectory pre-scoring. |
|
|
120
|
+
| `classifier.model` | `null` | Exact reference; `null` uses the reviewer. |
|
|
121
|
+
| `classifier.timeoutMs` | `15000` | Integer 1000-120000 milliseconds. |
|
|
122
|
+
| `classifier.maxLag` | `2` | Integer 0-20. |
|
|
123
|
+
| `circuitBreaker.consecutiveDenials` | `3` | Integer 0-100; `0` disables this limit. |
|
|
124
|
+
| `circuitBreaker.recentDenials` | `10` | Integer 0-100; `0` disables this limit. |
|
|
125
|
+
| `circuitBreaker.windowSize` | `50` | Integer 1-200, recent-verdict window size. |
|
|
126
|
+
|
|
127
|
+
Reviewer and classifier references are not active-session overrides. Classifier scores, denial history, and human decisions never become config entries.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### Diagnostics and inspection
|
|
132
|
+
|
|
133
|
+
Diagnostics are plugin-wide, not model-scoped.
|
|
134
|
+
|
|
135
|
+
| Field | Default | Contract |
|
|
136
|
+
| --- | --- | --- |
|
|
137
|
+
| `level` | `"info"` | `error`, `warn`, `info`, or `debug`. Debug enables lifecycle/compaction debug artifacts. Configuration issues and operation-blocking failures remain visible at every level. |
|
|
138
|
+
| `notifyOnLoad` | `false` | Optional informational load notification. |
|
|
139
|
+
| `captureRequests` | `false` | Independently opt into provider request artifacts. |
|
|
140
|
+
| `captureResponses` | `false` | Independently capture compact responses; this is not an ordinary chat-response logger. |
|
|
141
|
+
| `redactSensitiveData` | `true` | Optional additional redaction. Critical credentials, account IDs, and opaque encrypted data are always redacted. |
|
|
142
|
+
| `artifactRoot` | `"~/.pi/agent/artifacts/pi-openai-toolkit/compaction"` | Relative paths resolve against the canonical config directory, not the current project. |
|
|
143
|
+
|
|
144
|
+
`/toolkit-config` (or `show`) displays effective values with built-in/default/exact/legacy origins. `/toolkit-config validate` reports document issues, including unrelated model entries. Reports are bounded and redacted; unknown field names are masked. Repeated issue notifications are deduplicated within a session and do not depend on compaction enablement or debug mode.
|
|
145
|
+
|
|
146
|
+
`/toolkit-config migration-preview` analyzes a legacy file without changing it. These are human commands using Pi's UI; no model tool, new headless stdout protocol, network probe, auth lookup, tool mutation, or persistent state write is added. Headless operation failures and typed resolution issues remain observable. A truncated candidate is not usable JSON.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### Legacy compatibility and migration
|
|
151
|
+
|
|
152
|
+
Do not combine unversioned roots (`compaction`, `webSearch`, `imageGeneration`, `autoMode`) with `schemaVersion: 2`. Valid legacy behavior is retained through a compatibility adapter, including nullable model clears, legacy image-list defaults, and source-dependent hosted-search failure handling. Invalid selected legacy route values are now blocked instead of disappearing into another selection.
|
|
153
|
+
|
|
154
|
+
The preview maps recognized fields into a candidate, supplies leaf origins, lists unmapped/dormant paths, and reports `ready`, `needs-review`, `already-v2`, or `unavailable`. `ready` means no known semantic difference was found in recognized active policy; it is not authorization to apply or proof of provider support. Unknown names are masked and their values are never copied into the report. The original source bytes remain the authoritative copy of unknown and dormant content.
|
|
155
|
+
|
|
156
|
+
| Legacy input | v2 destination |
|
|
157
|
+
| --- | --- |
|
|
158
|
+
| `compaction.enabled` / `contextManagement` | `defaults.context.mode` |
|
|
159
|
+
| `compaction.remoteCompactModel`, `remoteV2ContextSource`, `allowCompactionContinuityBreak`, `responsesApis` | `defaults.context.remoteCompaction` fields |
|
|
160
|
+
| `compaction.nativeFallback` | `defaults.context.nativeFallback` |
|
|
161
|
+
| `compaction.leaveManagedMode`, `contextReminderThresholdPercent` | `defaults.context.remoteWindows` fields |
|
|
162
|
+
| `compaction.gatewayContextModels` | Exact `models[key].compatibility.transport` |
|
|
163
|
+
| `webSearch.defaultRoute`, `routes`, `models` | Default/exact search route candidates, subject to review below |
|
|
164
|
+
| `imageGeneration.models` | `allowedModels` plus an explicit default taken from the legacy first entry |
|
|
165
|
+
| `autoMode.enabled` / `models` | Default/exact `autoMode.available` |
|
|
166
|
+
| Legacy auto reviewer/classifier/breaker controls | Corresponding `autoMode` controls |
|
|
167
|
+
| Legacy compaction debug/capture/path settings | `diagnostics` |
|
|
168
|
+
|
|
169
|
+
The preview cannot claim universal lossless conversion:
|
|
170
|
+
|
|
171
|
+
- A legacy hosted allowlist ignores unsupported APIs and malformed payloads; explicit v2 hosted selection fails closed. Moving a list entry to an exact hosted route changes those failure paths.
|
|
172
|
+
- Disabled legacy features can retain dormant model lists/routes. A simplified v2 policy cannot preserve enable-later intent without review.
|
|
173
|
+
- Gateway compatibility is now shared independently of context mode; review effects on compaction and image affinity.
|
|
174
|
+
- Unknown fields, invalid normalization, or candidate validation failures require review. `remoteV2ContextSource: "legacy"` remains `inputSource: "legacy"`; preview does not upgrade checkpoint provenance or opt any model into standalone search.
|
|
175
|
+
|
|
176
|
+
There is no automatic migration, writer, or `--write` option. Before a separately approved manual cutover, back up the original bytes and verify that every installed Toolkit copy supports v2. Older copies, including 0.14.13, do not support this format. Updating source in a checkout does not update an installed package. Keep the legacy file until that cutover is ready.
|