pi-openai-toolkit 0.20.7 → 0.21.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 (55) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +83 -83
  3. package/README.md +8 -26
  4. package/README.zh.md +8 -26
  5. package/config.schema.json +278 -366
  6. package/docs/configuration.md +294 -310
  7. package/docs/internals.md +166 -175
  8. package/package.json +3 -13
  9. package/src/compact-client.ts +412 -389
  10. package/src/compaction-errors.ts +96 -0
  11. package/src/compaction-projection.ts +35 -35
  12. package/src/config/legacy.ts +519 -717
  13. package/src/config/migration.ts +103 -100
  14. package/src/config/notifications.ts +36 -28
  15. package/src/config/policy.ts +10 -18
  16. package/src/config/v2.ts +1167 -1380
  17. package/src/config.ts +310 -319
  18. package/src/context-management/codex-provider.ts +270 -270
  19. package/src/context-management/history-notes.ts +357 -357
  20. package/src/context-management/manual-compact.ts +0 -11
  21. package/src/context-management/tools.ts +371 -371
  22. package/src/context-management/types.ts +168 -168
  23. package/src/context-management/window-manager.ts +801 -801
  24. package/src/debug.ts +238 -237
  25. package/src/deferred-tool-carryover.ts +282 -282
  26. package/src/details-store.ts +151 -151
  27. package/src/extension-runtime.ts +1662 -1623
  28. package/src/image-generation/extension.ts +189 -189
  29. package/src/image-generation/protocol.ts +579 -579
  30. package/src/image-generation/types.ts +300 -300
  31. package/src/native-fallback.ts +4 -132
  32. package/src/payload-rewrite.ts +515 -518
  33. package/src/pi-context-hook.ts +117 -117
  34. package/src/remote-v2-client.ts +811 -814
  35. package/src/request-context-cache.ts +155 -155
  36. package/src/responses-headers.ts +180 -180
  37. package/src/runtime.ts +865 -832
  38. package/src/serializer.ts +882 -882
  39. package/src/supported-environment.ts +27 -27
  40. package/src/types.ts +565 -648
  41. package/src/web-search/alpha-client.ts +876 -876
  42. package/src/web-search/extension.ts +530 -530
  43. package/src/web-search/payload.ts +299 -299
  44. package/src/web-search/prompt.ts +60 -60
  45. package/src/web-search/types.ts +166 -166
  46. package/tsconfig.check.json +50 -54
  47. package/src/auto-mode/classifier.ts +0 -161
  48. package/src/auto-mode/extension.ts +0 -691
  49. package/src/auto-mode/model-selection-guard.ts +0 -52
  50. package/src/auto-mode/policy.ts +0 -146
  51. package/src/auto-mode/prompt.ts +0 -279
  52. package/src/auto-mode/reviewer.ts +0 -325
  53. package/src/auto-mode/tool-review-tui.ts +0 -211
  54. package/src/auto-mode/transcript.ts +0 -135
  55. package/src/auto-mode/types.ts +0 -137
@@ -1,366 +1,278 @@
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
- "azure-openai-responses"
62
- ]
63
- }
64
- },
65
- "context": {
66
- "type": "object",
67
- "additionalProperties": false,
68
- "properties": {
69
- "mode": {
70
- "enum": [
71
- "pi",
72
- "remote-compaction",
73
- "remote-windows"
74
- ]
75
- },
76
- "remoteCompaction": {
77
- "$ref": "#/$defs/remoteCompaction"
78
- },
79
- "nativeFallback": {
80
- "$ref": "#/$defs/nativeFallback"
81
- },
82
- "remoteWindows": {
83
- "$ref": "#/$defs/remoteWindows"
84
- }
85
- }
86
- },
87
- "remoteCompaction": {
88
- "type": "object",
89
- "additionalProperties": false,
90
- "properties": {
91
- "model": {
92
- "$ref": "#/$defs/modelRef"
93
- },
94
- "inputSource": {
95
- "enum": [
96
- "legacy",
97
- "pi-context-hook"
98
- ]
99
- },
100
- "allowContinuityBreak": {
101
- "type": "boolean"
102
- },
103
- "apis": {
104
- "$ref": "#/$defs/responsesApis"
105
- }
106
- }
107
- },
108
- "nativeFallback": {
109
- "type": "object",
110
- "additionalProperties": false,
111
- "properties": {
112
- "enabled": {
113
- "type": "boolean"
114
- },
115
- "model": {
116
- "$ref": "#/$defs/modelRef"
117
- },
118
- "thinkingLevel": {
119
- "enum": [
120
- "off",
121
- "minimal",
122
- "low",
123
- "medium",
124
- "high",
125
- "xhigh",
126
- "max"
127
- ]
128
- }
129
- }
130
- },
131
- "remoteWindows": {
132
- "type": "object",
133
- "additionalProperties": false,
134
- "properties": {
135
- "leaveManagedMode": {
136
- "enum": [
137
- "warn",
138
- "compact"
139
- ]
140
- },
141
- "reminderThresholdPercent": {
142
- "type": "integer",
143
- "minimum": 0,
144
- "maximum": 100
145
- }
146
- }
147
- },
148
- "webSearch": {
149
- "type": "object",
150
- "additionalProperties": false,
151
- "properties": {
152
- "route": {
153
- "enum": [
154
- "unmanaged",
155
- "local",
156
- "hosted",
157
- "standalone-alpha"
158
- ]
159
- }
160
- }
161
- },
162
- "imageGeneration": {
163
- "type": "object",
164
- "additionalProperties": false,
165
- "properties": {
166
- "enabled": {
167
- "type": "boolean"
168
- },
169
- "defaultModel": {
170
- "type": "string",
171
- "minLength": 1,
172
- "maxLength": 256,
173
- "pattern": "\\S"
174
- },
175
- "allowedModels": {
176
- "type": "array",
177
- "minItems": 1,
178
- "items": {
179
- "type": "string",
180
- "minLength": 1,
181
- "maxLength": 256,
182
- "pattern": "\\S"
183
- }
184
- }
185
- }
186
- },
187
- "responsesWebSocket": {
188
- "type": "object",
189
- "additionalProperties": false,
190
- "properties": {
191
- "enabled": {
192
- "type": "boolean",
193
- "default": false
194
- }
195
- }
196
- },
197
- "autoMode": {
198
- "type": "object",
199
- "additionalProperties": false,
200
- "properties": {
201
- "available": {
202
- "type": "boolean"
203
- },
204
- "reviewerModel": {
205
- "$ref": "#/$defs/modelRef"
206
- },
207
- "gate": {
208
- "enum": [
209
- "side-effect",
210
- "all"
211
- ]
212
- },
213
- "extraTools": {
214
- "$ref": "#/$defs/stringList"
215
- },
216
- "timeoutMs": {
217
- "type": "integer",
218
- "minimum": 1000,
219
- "maximum": 120000
220
- },
221
- "transcript": {
222
- "type": "boolean"
223
- },
224
- "evidenceTools": {
225
- "type": "boolean"
226
- },
227
- "maxEvidenceRounds": {
228
- "type": "integer",
229
- "minimum": 0,
230
- "maximum": 8
231
- },
232
- "classifier": {
233
- "$ref": "#/$defs/classifier"
234
- },
235
- "circuitBreaker": {
236
- "$ref": "#/$defs/circuitBreaker"
237
- }
238
- }
239
- },
240
- "classifier": {
241
- "type": "object",
242
- "additionalProperties": false,
243
- "properties": {
244
- "enabled": {
245
- "type": "boolean"
246
- },
247
- "model": {
248
- "$ref": "#/$defs/modelRef"
249
- },
250
- "timeoutMs": {
251
- "type": "integer",
252
- "minimum": 1000,
253
- "maximum": 120000
254
- },
255
- "maxLag": {
256
- "type": "integer",
257
- "minimum": 0,
258
- "maximum": 20
259
- }
260
- }
261
- },
262
- "circuitBreaker": {
263
- "type": "object",
264
- "additionalProperties": false,
265
- "properties": {
266
- "consecutiveDenials": {
267
- "type": "integer",
268
- "minimum": 0,
269
- "maximum": 100
270
- },
271
- "recentDenials": {
272
- "type": "integer",
273
- "minimum": 0,
274
- "maximum": 100
275
- },
276
- "windowSize": {
277
- "type": "integer",
278
- "minimum": 1,
279
- "maximum": 200
280
- }
281
- }
282
- },
283
- "compatibility": {
284
- "type": "object",
285
- "additionalProperties": false,
286
- "properties": {
287
- "transport": {
288
- "enum": [
289
- "standard",
290
- "codex-gateway"
291
- ]
292
- }
293
- }
294
- },
295
- "defaults": {
296
- "type": "object",
297
- "additionalProperties": false,
298
- "properties": {
299
- "context": {
300
- "$ref": "#/$defs/context"
301
- },
302
- "webSearch": {
303
- "$ref": "#/$defs/webSearch"
304
- },
305
- "imageGeneration": {
306
- "$ref": "#/$defs/imageGeneration"
307
- },
308
- "responsesWebSocket": {
309
- "$ref": "#/$defs/responsesWebSocket"
310
- },
311
- "autoMode": {
312
- "$ref": "#/$defs/autoMode"
313
- }
314
- }
315
- },
316
- "modelOverride": {
317
- "type": "object",
318
- "additionalProperties": false,
319
- "properties": {
320
- "context": {
321
- "$ref": "#/$defs/context"
322
- },
323
- "webSearch": {
324
- "$ref": "#/$defs/webSearch"
325
- },
326
- "autoMode": {
327
- "$ref": "#/$defs/autoMode"
328
- },
329
- "compatibility": {
330
- "$ref": "#/$defs/compatibility"
331
- }
332
- }
333
- },
334
- "diagnostics": {
335
- "type": "object",
336
- "additionalProperties": false,
337
- "properties": {
338
- "level": {
339
- "enum": [
340
- "error",
341
- "warn",
342
- "info",
343
- "debug"
344
- ]
345
- },
346
- "notifyOnLoad": {
347
- "type": "boolean"
348
- },
349
- "captureRequests": {
350
- "type": "boolean"
351
- },
352
- "captureResponses": {
353
- "type": "boolean"
354
- },
355
- "redactSensitiveData": {
356
- "type": "boolean"
357
- },
358
- "artifactRoot": {
359
- "type": "string",
360
- "minLength": 1,
361
- "pattern": "\\S"
362
- }
363
- }
364
- }
365
- }
366
- }
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
+ "responsesApis": {
50
+ "type": "array",
51
+ "items": {
52
+ "enum": [
53
+ "openai-responses",
54
+ "openai-codex-responses",
55
+ "azure-openai-responses"
56
+ ]
57
+ }
58
+ },
59
+ "context": {
60
+ "type": "object",
61
+ "additionalProperties": false,
62
+ "properties": {
63
+ "mode": {
64
+ "enum": [
65
+ "pi",
66
+ "remote-compaction",
67
+ "remote-windows"
68
+ ]
69
+ },
70
+ "remoteCompaction": {
71
+ "$ref": "#/$defs/remoteCompaction"
72
+ },
73
+ "nativeFallback": {
74
+ "$ref": "#/$defs/nativeFallback"
75
+ },
76
+ "remoteWindows": {
77
+ "$ref": "#/$defs/remoteWindows"
78
+ }
79
+ }
80
+ },
81
+ "remoteCompaction": {
82
+ "type": "object",
83
+ "additionalProperties": false,
84
+ "properties": {
85
+ "model": {
86
+ "$ref": "#/$defs/modelRef"
87
+ },
88
+ "inputSource": {
89
+ "enum": [
90
+ "legacy",
91
+ "pi-context-hook"
92
+ ]
93
+ },
94
+ "allowContinuityBreak": {
95
+ "type": "boolean"
96
+ },
97
+ "apis": {
98
+ "$ref": "#/$defs/responsesApis"
99
+ }
100
+ }
101
+ },
102
+ "nativeFallback": {
103
+ "type": "object",
104
+ "additionalProperties": false,
105
+ "properties": {
106
+ "enabled": {
107
+ "type": "boolean"
108
+ },
109
+ "model": {
110
+ "$ref": "#/$defs/modelRef"
111
+ },
112
+ "thinkingLevel": {
113
+ "enum": [
114
+ "off",
115
+ "minimal",
116
+ "low",
117
+ "medium",
118
+ "high",
119
+ "xhigh",
120
+ "max"
121
+ ]
122
+ }
123
+ }
124
+ },
125
+ "remoteWindows": {
126
+ "type": "object",
127
+ "additionalProperties": false,
128
+ "properties": {
129
+ "leaveManagedMode": {
130
+ "enum": [
131
+ "warn",
132
+ "compact"
133
+ ]
134
+ },
135
+ "reminderThresholdPercent": {
136
+ "type": "integer",
137
+ "minimum": 0,
138
+ "maximum": 100
139
+ }
140
+ }
141
+ },
142
+ "webSearch": {
143
+ "type": "object",
144
+ "additionalProperties": false,
145
+ "properties": {
146
+ "route": {
147
+ "enum": [
148
+ "unmanaged",
149
+ "local",
150
+ "hosted",
151
+ "standalone-alpha"
152
+ ]
153
+ }
154
+ }
155
+ },
156
+ "imageGeneration": {
157
+ "type": "object",
158
+ "additionalProperties": false,
159
+ "properties": {
160
+ "enabled": {
161
+ "type": "boolean"
162
+ },
163
+ "defaultModel": {
164
+ "type": "string",
165
+ "minLength": 1,
166
+ "maxLength": 256,
167
+ "pattern": "\\S"
168
+ },
169
+ "allowedModels": {
170
+ "type": "array",
171
+ "minItems": 1,
172
+ "items": {
173
+ "type": "string",
174
+ "minLength": 1,
175
+ "maxLength": 256,
176
+ "pattern": "\\S"
177
+ }
178
+ }
179
+ }
180
+ },
181
+ "responsesWebSocket": {
182
+ "type": "object",
183
+ "additionalProperties": false,
184
+ "properties": {
185
+ "enabled": {
186
+ "type": "boolean",
187
+ "default": false
188
+ }
189
+ }
190
+ },
191
+ "retiredAutoMode": {
192
+ "deprecated": true,
193
+ "description": "Auto Mode has been removed. This value is ignored with a warning; tool calls are no longer reviewed by it. Remove this section from your configuration."
194
+ },
195
+ "compatibility": {
196
+ "type": "object",
197
+ "additionalProperties": false,
198
+ "properties": {
199
+ "transport": {
200
+ "enum": [
201
+ "standard",
202
+ "codex-gateway"
203
+ ]
204
+ }
205
+ }
206
+ },
207
+ "defaults": {
208
+ "type": "object",
209
+ "additionalProperties": false,
210
+ "properties": {
211
+ "context": {
212
+ "$ref": "#/$defs/context"
213
+ },
214
+ "webSearch": {
215
+ "$ref": "#/$defs/webSearch"
216
+ },
217
+ "imageGeneration": {
218
+ "$ref": "#/$defs/imageGeneration"
219
+ },
220
+ "responsesWebSocket": {
221
+ "$ref": "#/$defs/responsesWebSocket"
222
+ },
223
+ "autoMode": {
224
+ "$ref": "#/$defs/retiredAutoMode"
225
+ }
226
+ }
227
+ },
228
+ "modelOverride": {
229
+ "type": "object",
230
+ "additionalProperties": false,
231
+ "properties": {
232
+ "context": {
233
+ "$ref": "#/$defs/context"
234
+ },
235
+ "webSearch": {
236
+ "$ref": "#/$defs/webSearch"
237
+ },
238
+ "autoMode": {
239
+ "$ref": "#/$defs/retiredAutoMode"
240
+ },
241
+ "compatibility": {
242
+ "$ref": "#/$defs/compatibility"
243
+ }
244
+ }
245
+ },
246
+ "diagnostics": {
247
+ "type": "object",
248
+ "additionalProperties": false,
249
+ "properties": {
250
+ "level": {
251
+ "enum": [
252
+ "error",
253
+ "warn",
254
+ "info",
255
+ "debug"
256
+ ]
257
+ },
258
+ "notifyOnLoad": {
259
+ "type": "boolean"
260
+ },
261
+ "captureRequests": {
262
+ "type": "boolean"
263
+ },
264
+ "captureResponses": {
265
+ "type": "boolean"
266
+ },
267
+ "redactSensitiveData": {
268
+ "type": "boolean"
269
+ },
270
+ "artifactRoot": {
271
+ "type": "string",
272
+ "minLength": 1,
273
+ "pattern": "\\S"
274
+ }
275
+ }
276
+ }
277
+ }
278
+ }