pi-openai-toolkit 0.23.1 → 0.23.2

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 (42) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +83 -83
  3. package/README.md +6 -2
  4. package/README.zh.md +6 -2
  5. package/config.schema.json +278 -278
  6. package/docs/configuration.md +306 -298
  7. package/docs/internals.md +184 -181
  8. package/package.json +136 -135
  9. package/src/compact-client.ts +412 -412
  10. package/src/compaction-projection.ts +35 -35
  11. package/src/config/migration.ts +103 -103
  12. package/src/config.ts +310 -310
  13. package/src/context-management/codex-provider.ts +270 -270
  14. package/src/context-management/history-notes.ts +357 -357
  15. package/src/context-management/manual-compact.ts +247 -599
  16. package/src/context-management/scoped-compaction.ts +89 -0
  17. package/src/context-management/tools.ts +371 -371
  18. package/src/context-management/types.ts +168 -168
  19. package/src/context-management/window-manager.ts +912 -905
  20. package/src/debug.ts +238 -238
  21. package/src/deferred-tool-carryover.ts +282 -282
  22. package/src/details-store.ts +151 -151
  23. package/src/extension-runtime.ts +1919 -1986
  24. package/src/image-generation/extension.ts +189 -189
  25. package/src/image-generation/protocol.ts +579 -579
  26. package/src/image-generation/types.ts +300 -300
  27. package/src/native-fallback.ts +32 -29
  28. package/src/payload-rewrite.ts +515 -515
  29. package/src/pi-context-hook.ts +117 -117
  30. package/src/remote-v2-client.ts +811 -811
  31. package/src/request-context-cache.ts +155 -155
  32. package/src/responses-headers.ts +180 -180
  33. package/src/runtime.ts +865 -865
  34. package/src/serializer.ts +882 -882
  35. package/src/supported-environment.ts +27 -27
  36. package/src/types.ts +565 -565
  37. package/src/web-search/alpha-client.ts +876 -876
  38. package/src/web-search/extension.ts +530 -530
  39. package/src/web-search/payload.ts +299 -299
  40. package/src/web-search/prompt.ts +60 -60
  41. package/src/web-search/types.ts +166 -166
  42. package/tsconfig.check.json +50 -50
@@ -1,278 +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
- "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
- }
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
+ }