pi-openai-toolkit 0.23.1 → 0.24.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 (53) hide show
  1. package/LICENSE +21 -21
  2. package/NOTICE +83 -83
  3. package/README.md +4 -11
  4. package/README.zh.md +4 -11
  5. package/config.schema.json +264 -278
  6. package/docs/configuration.md +304 -298
  7. package/docs/internals.md +98 -181
  8. package/package.json +123 -135
  9. package/src/compact-client.ts +412 -412
  10. package/src/compaction-projection.ts +35 -35
  11. package/src/config/legacy.ts +12 -62
  12. package/src/config/migration.ts +115 -103
  13. package/src/config/notifications.ts +10 -4
  14. package/src/config/policy.ts +9 -10
  15. package/src/config/v2.ts +12 -51
  16. package/src/config.ts +320 -310
  17. package/src/debug.ts +238 -238
  18. package/src/deferred-tool-carryover.ts +282 -282
  19. package/src/details-store.ts +151 -151
  20. package/src/extension-runtime.ts +1095 -1986
  21. package/src/image-generation/extension.ts +189 -189
  22. package/src/image-generation/protocol.ts +579 -579
  23. package/src/image-generation/types.ts +300 -300
  24. package/src/native-fallback.ts +14 -23
  25. package/src/payload-rewrite.ts +515 -515
  26. package/src/pi-context-hook.ts +117 -117
  27. package/src/remote-v2-client.ts +811 -811
  28. package/src/request-context-cache.ts +155 -155
  29. package/src/responses-headers.ts +180 -180
  30. package/src/retired-remote-windows.ts +35 -0
  31. package/src/runtime.ts +875 -865
  32. package/src/serializer.ts +882 -882
  33. package/src/supported-environment.ts +27 -27
  34. package/src/types.ts +541 -565
  35. package/src/web-search/alpha-client.ts +876 -876
  36. package/src/web-search/extension.ts +530 -530
  37. package/src/web-search/payload.ts +299 -299
  38. package/src/web-search/prompt.ts +60 -60
  39. package/src/web-search/types.ts +166 -166
  40. package/tsconfig.check.json +50 -50
  41. package/src/context-management/codex-provider.ts +0 -270
  42. package/src/context-management/history-notes.ts +0 -357
  43. package/src/context-management/manual-compact.ts +0 -599
  44. package/src/context-management/messages.ts +0 -238
  45. package/src/context-management/namespace-tools.ts +0 -426
  46. package/src/context-management/responses-tools.ts +0 -238
  47. package/src/context-management/tool-contract.ts +0 -62
  48. package/src/context-management/tools.ts +0 -371
  49. package/src/context-management/types.ts +0 -168
  50. package/src/context-management/window-budget.ts +0 -83
  51. package/src/context-management/window-bulk.ts +0 -155
  52. package/src/context-management/window-manager.ts +0 -905
  53. package/src/context-management/window-request.ts +0 -125
@@ -1,278 +1,264 @@
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
+ ]
68
+ },
69
+ "remoteCompaction": {
70
+ "$ref": "#/$defs/remoteCompaction"
71
+ },
72
+ "nativeFallback": {
73
+ "$ref": "#/$defs/nativeFallback"
74
+ },
75
+ "remoteWindows": {
76
+ "$ref": "#/$defs/retiredRemoteWindows"
77
+ }
78
+ }
79
+ },
80
+ "remoteCompaction": {
81
+ "type": "object",
82
+ "additionalProperties": false,
83
+ "properties": {
84
+ "model": {
85
+ "$ref": "#/$defs/modelRef"
86
+ },
87
+ "inputSource": {
88
+ "enum": [
89
+ "legacy",
90
+ "pi-context-hook"
91
+ ]
92
+ },
93
+ "allowContinuityBreak": {
94
+ "type": "boolean"
95
+ },
96
+ "apis": {
97
+ "$ref": "#/$defs/responsesApis"
98
+ }
99
+ }
100
+ },
101
+ "nativeFallback": {
102
+ "type": "object",
103
+ "additionalProperties": false,
104
+ "properties": {
105
+ "enabled": {
106
+ "type": "boolean"
107
+ },
108
+ "model": {
109
+ "$ref": "#/$defs/modelRef"
110
+ },
111
+ "thinkingLevel": {
112
+ "enum": [
113
+ "off",
114
+ "minimal",
115
+ "low",
116
+ "medium",
117
+ "high",
118
+ "xhigh",
119
+ "max"
120
+ ]
121
+ }
122
+ }
123
+ },
124
+ "retiredRemoteWindows": {
125
+ "deprecated": true,
126
+ "description": "Remote Windows has been removed. This opaque ancillary value is ignored with a warning; remove it from your configuration. Selecting the removed mode blocks context operations until pi or remote-compaction is explicitly selected."
127
+ },
128
+ "webSearch": {
129
+ "type": "object",
130
+ "additionalProperties": false,
131
+ "properties": {
132
+ "route": {
133
+ "enum": [
134
+ "unmanaged",
135
+ "local",
136
+ "hosted",
137
+ "standalone-alpha"
138
+ ]
139
+ }
140
+ }
141
+ },
142
+ "imageGeneration": {
143
+ "type": "object",
144
+ "additionalProperties": false,
145
+ "properties": {
146
+ "enabled": {
147
+ "type": "boolean"
148
+ },
149
+ "defaultModel": {
150
+ "type": "string",
151
+ "minLength": 1,
152
+ "maxLength": 256,
153
+ "pattern": "\\S"
154
+ },
155
+ "allowedModels": {
156
+ "type": "array",
157
+ "minItems": 1,
158
+ "items": {
159
+ "type": "string",
160
+ "minLength": 1,
161
+ "maxLength": 256,
162
+ "pattern": "\\S"
163
+ }
164
+ }
165
+ }
166
+ },
167
+ "responsesWebSocket": {
168
+ "type": "object",
169
+ "additionalProperties": false,
170
+ "properties": {
171
+ "enabled": {
172
+ "type": "boolean",
173
+ "default": false
174
+ }
175
+ }
176
+ },
177
+ "retiredAutoMode": {
178
+ "deprecated": true,
179
+ "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."
180
+ },
181
+ "compatibility": {
182
+ "type": "object",
183
+ "additionalProperties": false,
184
+ "properties": {
185
+ "transport": {
186
+ "enum": [
187
+ "standard",
188
+ "codex-gateway"
189
+ ]
190
+ }
191
+ }
192
+ },
193
+ "defaults": {
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "properties": {
197
+ "context": {
198
+ "$ref": "#/$defs/context"
199
+ },
200
+ "webSearch": {
201
+ "$ref": "#/$defs/webSearch"
202
+ },
203
+ "imageGeneration": {
204
+ "$ref": "#/$defs/imageGeneration"
205
+ },
206
+ "responsesWebSocket": {
207
+ "$ref": "#/$defs/responsesWebSocket"
208
+ },
209
+ "autoMode": {
210
+ "$ref": "#/$defs/retiredAutoMode"
211
+ }
212
+ }
213
+ },
214
+ "modelOverride": {
215
+ "type": "object",
216
+ "additionalProperties": false,
217
+ "properties": {
218
+ "context": {
219
+ "$ref": "#/$defs/context"
220
+ },
221
+ "webSearch": {
222
+ "$ref": "#/$defs/webSearch"
223
+ },
224
+ "autoMode": {
225
+ "$ref": "#/$defs/retiredAutoMode"
226
+ },
227
+ "compatibility": {
228
+ "$ref": "#/$defs/compatibility"
229
+ }
230
+ }
231
+ },
232
+ "diagnostics": {
233
+ "type": "object",
234
+ "additionalProperties": false,
235
+ "properties": {
236
+ "level": {
237
+ "enum": [
238
+ "error",
239
+ "warn",
240
+ "info",
241
+ "debug"
242
+ ]
243
+ },
244
+ "notifyOnLoad": {
245
+ "type": "boolean"
246
+ },
247
+ "captureRequests": {
248
+ "type": "boolean"
249
+ },
250
+ "captureResponses": {
251
+ "type": "boolean"
252
+ },
253
+ "redactSensitiveData": {
254
+ "type": "boolean"
255
+ },
256
+ "artifactRoot": {
257
+ "type": "string",
258
+ "minLength": 1,
259
+ "pattern": "\\S"
260
+ }
261
+ }
262
+ }
263
+ }
264
+ }