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.
- package/LICENSE +21 -21
- package/NOTICE +83 -83
- package/README.md +8 -26
- package/README.zh.md +8 -26
- package/config.schema.json +278 -366
- package/docs/configuration.md +294 -310
- package/docs/internals.md +166 -175
- package/package.json +3 -13
- package/src/compact-client.ts +412 -389
- package/src/compaction-errors.ts +96 -0
- package/src/compaction-projection.ts +35 -35
- package/src/config/legacy.ts +519 -717
- package/src/config/migration.ts +103 -100
- package/src/config/notifications.ts +36 -28
- package/src/config/policy.ts +10 -18
- package/src/config/v2.ts +1167 -1380
- package/src/config.ts +310 -319
- package/src/context-management/codex-provider.ts +270 -270
- package/src/context-management/history-notes.ts +357 -357
- package/src/context-management/manual-compact.ts +0 -11
- package/src/context-management/tools.ts +371 -371
- package/src/context-management/types.ts +168 -168
- package/src/context-management/window-manager.ts +801 -801
- package/src/debug.ts +238 -237
- package/src/deferred-tool-carryover.ts +282 -282
- package/src/details-store.ts +151 -151
- package/src/extension-runtime.ts +1662 -1623
- package/src/image-generation/extension.ts +189 -189
- package/src/image-generation/protocol.ts +579 -579
- package/src/image-generation/types.ts +300 -300
- package/src/native-fallback.ts +4 -132
- package/src/payload-rewrite.ts +515 -518
- package/src/pi-context-hook.ts +117 -117
- package/src/remote-v2-client.ts +811 -814
- package/src/request-context-cache.ts +155 -155
- package/src/responses-headers.ts +180 -180
- package/src/runtime.ts +865 -832
- package/src/serializer.ts +882 -882
- package/src/supported-environment.ts +27 -27
- package/src/types.ts +565 -648
- package/src/web-search/alpha-client.ts +876 -876
- package/src/web-search/extension.ts +530 -530
- package/src/web-search/payload.ts +299 -299
- package/src/web-search/prompt.ts +60 -60
- package/src/web-search/types.ts +166 -166
- package/tsconfig.check.json +50 -54
- package/src/auto-mode/classifier.ts +0 -161
- package/src/auto-mode/extension.ts +0 -691
- package/src/auto-mode/model-selection-guard.ts +0 -52
- package/src/auto-mode/policy.ts +0 -146
- package/src/auto-mode/prompt.ts +0 -279
- package/src/auto-mode/reviewer.ts +0 -325
- package/src/auto-mode/tool-review-tui.ts +0 -211
- package/src/auto-mode/transcript.ts +0 -135
- package/src/auto-mode/types.ts +0 -137
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 lll9p
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lll9p
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
pi-openai-toolkit
|
|
2
|
-
Copyright (c) 2026 awoaCrim and contributors
|
|
3
|
-
|
|
4
|
-
The native OpenAI Web Search behavior in this package was adapted from
|
|
5
|
-
code-yeongyu/pi-openai-web-search at commit
|
|
6
|
-
39643380682f02f306b0de2673ff136c45ccc2a2.
|
|
7
|
-
|
|
8
|
-
Upstream copyright and license notice:
|
|
9
|
-
|
|
10
|
-
Copyright (c) 2026 Yeongyu Kim
|
|
11
|
-
|
|
12
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
in the Software without restriction, including without limitation the rights
|
|
15
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
furnished to do so, subject to the following conditions:
|
|
18
|
-
|
|
19
|
-
The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
copies or substantial portions of the Software.
|
|
21
|
-
|
|
22
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
SOFTWARE.
|
|
29
|
-
|
|
30
|
-
The adapted implementation targets the @earendil-works Pi interfaces and is
|
|
31
|
-
integrated with pi-openai-toolkit's independent compaction and Web Search
|
|
32
|
-
extension entry points. The upstream NOTICE also identifies the behavior as a
|
|
33
|
-
standalone port of the senpi-mono built-in openai-web-search extension.
|
|
34
|
-
|
|
35
|
-
The stable reasoning-effort planner in src/codex-astra/effort-planner.ts was
|
|
36
|
-
ported from Oh My Pi (@oh-my-pi/pi-ai, providers/openai-configuration-update.ts)
|
|
37
|
-
at version 18.1.8.
|
|
38
|
-
|
|
39
|
-
Upstream copyright and license notice:
|
|
40
|
-
|
|
41
|
-
MIT License
|
|
42
|
-
|
|
43
|
-
Copyright (c) 2025 Mario Zechner
|
|
44
|
-
Copyright (c) 2025-2026 Can Bölük
|
|
45
|
-
Copyright (c) 2026 Stencil Labs, Inc.
|
|
46
|
-
|
|
47
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
48
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
49
|
-
in the Software without restriction, including without limitation the rights
|
|
50
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
51
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
52
|
-
furnished to do so, subject to the following conditions:
|
|
53
|
-
|
|
54
|
-
The above copyright notice and this permission notice shall be included in all
|
|
55
|
-
copies or substantial portions of the Software.
|
|
56
|
-
|
|
57
|
-
The Remote Context management implementation in src/context-management/ was
|
|
58
|
-
adapted from @howaboua/pi-codex-conversion@3.0.29 at source commit
|
|
59
|
-
7021ae48e8efe36a3becc5830d529696ff798e5e.
|
|
60
|
-
|
|
61
|
-
Upstream copyright and license notice:
|
|
62
|
-
|
|
63
|
-
MIT License
|
|
64
|
-
|
|
65
|
-
Copyright (c) 2026 Igor Warzocha
|
|
66
|
-
|
|
67
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
68
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
69
|
-
in the Software without restriction, including without limitation the rights
|
|
70
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
71
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
72
|
-
furnished to do so, subject to the following conditions:
|
|
73
|
-
|
|
74
|
-
The above copyright notice and this permission notice shall be included in all
|
|
75
|
-
copies or substantial portions of the Software.
|
|
76
|
-
|
|
77
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
78
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
79
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
80
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
81
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
82
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
83
|
-
SOFTWARE.
|
|
1
|
+
pi-openai-toolkit
|
|
2
|
+
Copyright (c) 2026 awoaCrim and contributors
|
|
3
|
+
|
|
4
|
+
The native OpenAI Web Search behavior in this package was adapted from
|
|
5
|
+
code-yeongyu/pi-openai-web-search at commit
|
|
6
|
+
39643380682f02f306b0de2673ff136c45ccc2a2.
|
|
7
|
+
|
|
8
|
+
Upstream copyright and license notice:
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2026 Yeongyu Kim
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
|
|
30
|
+
The adapted implementation targets the @earendil-works Pi interfaces and is
|
|
31
|
+
integrated with pi-openai-toolkit's independent compaction and Web Search
|
|
32
|
+
extension entry points. The upstream NOTICE also identifies the behavior as a
|
|
33
|
+
standalone port of the senpi-mono built-in openai-web-search extension.
|
|
34
|
+
|
|
35
|
+
The stable reasoning-effort planner in src/codex-astra/effort-planner.ts was
|
|
36
|
+
ported from Oh My Pi (@oh-my-pi/pi-ai, providers/openai-configuration-update.ts)
|
|
37
|
+
at version 18.1.8.
|
|
38
|
+
|
|
39
|
+
Upstream copyright and license notice:
|
|
40
|
+
|
|
41
|
+
MIT License
|
|
42
|
+
|
|
43
|
+
Copyright (c) 2025 Mario Zechner
|
|
44
|
+
Copyright (c) 2025-2026 Can Bölük
|
|
45
|
+
Copyright (c) 2026 Stencil Labs, Inc.
|
|
46
|
+
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
48
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
49
|
+
in the Software without restriction, including without limitation the rights
|
|
50
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
51
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
52
|
+
furnished to do so, subject to the following conditions:
|
|
53
|
+
|
|
54
|
+
The above copyright notice and this permission notice shall be included in all
|
|
55
|
+
copies or substantial portions of the Software.
|
|
56
|
+
|
|
57
|
+
The Remote Context management implementation in src/context-management/ was
|
|
58
|
+
adapted from @howaboua/pi-codex-conversion@3.0.29 at source commit
|
|
59
|
+
7021ae48e8efe36a3becc5830d529696ff798e5e.
|
|
60
|
+
|
|
61
|
+
Upstream copyright and license notice:
|
|
62
|
+
|
|
63
|
+
MIT License
|
|
64
|
+
|
|
65
|
+
Copyright (c) 2026 Igor Warzocha
|
|
66
|
+
|
|
67
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
68
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
69
|
+
in the Software without restriction, including without limitation the rights
|
|
70
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
71
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
72
|
+
furnished to do so, subject to the following conditions:
|
|
73
|
+
|
|
74
|
+
The above copyright notice and this permission notice shall be included in all
|
|
75
|
+
copies or substantial portions of the Software.
|
|
76
|
+
|
|
77
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
78
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
79
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
80
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
81
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
82
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
83
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-openai-toolkit
|
|
2
2
|
|
|
3
|
-
Remote context windows, Responses compaction, web search, image generation
|
|
3
|
+
Remote context windows, Responses compaction, web search, and image generation for Pi. Uses Pi's existing models, endpoints, authentication, and sessions without registering another provider or model.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/pi-openai-toolkit)
|
|
6
6
|
[](LICENSE)
|
|
@@ -15,7 +15,7 @@ Requires Node.js **22.19.0+** and Pi **0.87.0+**. Current development dependenci
|
|
|
15
15
|
pi install npm:pi-openai-toolkit
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Configure your model and credentials in Pi, then start Pi normally. Without a Toolkit config file, eligible models use remote compaction by default. Search remains managed by Pi and other extensions; image generation
|
|
18
|
+
Configure your model and credentials in Pi, then start Pi normally. Without a Toolkit config file, eligible models use remote compaction by default. Search remains managed by Pi and other extensions; image generation is off.
|
|
19
19
|
|
|
20
20
|
Toolkit reads one global configuration file, even for a project-local installation:
|
|
21
21
|
|
|
@@ -50,7 +50,9 @@ Set `defaults.context.mode` or an individual model's `context.mode`:
|
|
|
50
50
|
- `remote-windows`: use Codex remote context windows, retrieve earlier work with `history`, and save handoff notes with `notes`
|
|
51
51
|
- `pi`: leave context management to Pi
|
|
52
52
|
|
|
53
|
-
**Remote compaction** accepts
|
|
53
|
+
**Remote compaction** accepts `openai-responses`, `openai-codex-responses`, and `azure-openai-responses`. It tries V2 first. On the official OpenAI API-key route, a qualifying protocol failure can trigger one standalone `/v1/responses/compact` request; its complete encrypted replacement window is preserved for replay. OpenAI OAuth, native Codex, Azure, and gateways keep their existing V2 route. OpenAI subscription-sharing OAuth and native Codex login are separate grants, not interchangeable credentials. Backend/model access is still required.
|
|
54
|
+
|
|
55
|
+
Set `context.remoteCompaction.model` to use a separate producer on the same effective base URL without changing the active model. Exhausted remote attempts warn before continuing with a native text summary. `nativeFallback.enabled: false` disables only Toolkit's configured-model tier, not Pi's default summary. Aborts, incompatible provenance, and edits to sealed history still cancel rather than bypassing checkpoint safety. See [context settings](docs/configuration.md#context) and [checkpoint rules](docs/internals.md#remote-compaction-v2-wire-contract).
|
|
54
56
|
|
|
55
57
|
**Remote windows** require the native `openai-codex` provider with `openai-codex-responses`, or an `openai-responses` gateway implementing the protocol. Gateways require `compatibility.transport: "codex-gateway"` on the exact model entry. This setting does not add the capability to an ordinary compatible endpoint.
|
|
56
58
|
|
|
@@ -58,7 +60,7 @@ Change `mode` in the example above to `remote-windows`. Eligible sessions expose
|
|
|
58
60
|
|
|
59
61
|
Remote windows use alpha endpoints that may change upstream. When switching models, the remote window remains persisted and reusable; see the [window lifecycle](docs/internals.md#rollover-lifecycle).
|
|
60
62
|
|
|
61
|
-
## Search, images, and
|
|
63
|
+
## Search, images, and transport
|
|
62
64
|
|
|
63
65
|
### Web search
|
|
64
66
|
|
|
@@ -107,30 +109,10 @@ The Toolkit WebSocket adapter is disabled by default. Enable it globally for GPT
|
|
|
107
109
|
|
|
108
110
|
It reuses the selected model's provider, base URL, credentials, headers, and model ID without registering another provider. Pi's `transport: "auto"` tries WebSocket first and falls back to SSE before streaming starts; with a stable session it also reuses the socket and sends only the new continuation input when the transcript matches. Use `transport: "websocket-cached"` to require that cached path, or `transport: "sse"` to keep the original HTTP/SSE path. Restart or reload Pi after changing the Toolkit setting. See [WebSocket configuration](docs/configuration.md#responses-websocket-transport).
|
|
109
111
|
|
|
110
|
-
### Auto Mode
|
|
111
|
-
|
|
112
|
-
Auto Mode uses model-based review before tool execution. Permit it and select a reviewer registered and authenticated in Pi, then engage it explicitly:
|
|
113
|
-
|
|
114
|
-
```json
|
|
115
|
-
{
|
|
116
|
-
"schemaVersion": 2,
|
|
117
|
-
"defaults": {
|
|
118
|
-
"autoMode": {
|
|
119
|
-
"available": true,
|
|
120
|
-
"reviewerModel": "provider/reviewer-model-id"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Replace `provider/reviewer-model-id` with a real model reference. Use `/auto on` or the `--auto` startup flag to engage, and `/auto off` to disengage. Setting `available: true` alone does not engage the gate.
|
|
127
|
-
|
|
128
|
-
The default `gate: "side-effect"` reviews `bash`, `write`, `edit`, and `extraTools`. Use `gate: "all"` to cover every tool. Read-only evidence gathering, denial circuit breakers, and optional background classifier pre-scoring are supported. With the classifier enabled, some calls can pass based on a pre-score.
|
|
129
|
-
|
|
130
|
-
A timeout or unavailable review is never approval: interactive sessions ask for confirmation, while headless sessions block the call. This is not a sandbox or a guarantee of correct decisions. Selecting an ineligible model disengages Auto Mode. See [Auto Mode settings](docs/configuration.md#auto-mode).
|
|
131
|
-
|
|
132
112
|
## Compatibility and troubleshooting
|
|
133
113
|
|
|
114
|
+
Auto Mode, `/auto`, and `--auto` have been removed. Toolkit no longer reviews tool calls through this feature. Existing `autoMode` configuration is ignored with a warning and can be deleted; other valid settings keep working. See [removal guidance](docs/configuration.md#removed-auto-mode).
|
|
115
|
+
|
|
134
116
|
- Keep providers, endpoints, and credentials in Pi, not Toolkit configuration. See [provider setup](docs/configuration.md#provider-specific-responses-endpoints) for Azure deployment mapping, `api-version`, and authentication
|
|
135
117
|
- `pi-virtual` capability checks use the physical provider/model resolved by Pi, without inferring support from the virtual model's name
|
|
136
118
|
- Compaction and replay honor `inputLimits.images` resizing and count limits from Pi model metadata without changing the persisted session or original request object
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-openai-toolkit
|
|
2
2
|
|
|
3
|
-
为 Pi 添加远程上下文窗口、Responses
|
|
3
|
+
为 Pi 添加远程上下文窗口、Responses 压缩、联网搜索和图像生成。沿用 Pi 的模型、端点、认证和会话配置,不另行注册提供商或模型。
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/pi-openai-toolkit)
|
|
6
6
|
[](LICENSE)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
pi install npm:pi-openai-toolkit
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
在 Pi 中配置好模型和凭据后,照常启动。没有 Toolkit 配置文件时,符合条件的模型默认使用远程压缩;搜索由 Pi
|
|
18
|
+
在 Pi 中配置好模型和凭据后,照常启动。没有 Toolkit 配置文件时,符合条件的模型默认使用远程压缩;搜索由 Pi 和其他扩展管理,生图默认关闭。
|
|
19
19
|
|
|
20
20
|
Toolkit 只读取一个全局配置文件,即使扩展安装在项目内也一样:
|
|
21
21
|
|
|
@@ -50,7 +50,9 @@ Toolkit 只读取一个全局配置文件,即使扩展安装在项目内也一
|
|
|
50
50
|
- `remote-windows`:使用 Codex 远程上下文窗口,通过 `history` 检索较早内容、`notes` 保存交接信息
|
|
51
51
|
- `pi`:交给 Pi 管理上下文
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
**远程压缩**支持 `openai-responses`、`openai-codex-responses` 和 `azure-openai-responses`,先尝试 V2。官方 OpenAI API-key 路由遇到符合条件的协议失败时,可再尝试一次独立的 `/v1/responses/compact`,并完整保存返回的加密替换窗口用于重放。OpenAI OAuth、原生 Codex、Azure 和网关保持原有 V2 路由。OpenAI subscription-sharing OAuth 与原生 Codex 登录是两种独立授权,凭据不能互换;模型和后端仍须具备相应权限。
|
|
54
|
+
|
|
55
|
+
可用 `context.remoteCompaction.model` 指定同一有效 base URL 下的独立压缩模型,不改变当前模型。远程尝试全部失败后,会明确提示并继续普通文本摘要。`nativeFallback.enabled: false` 只关闭 Toolkit 的指定模型回退层,不关闭 Pi 默认摘要。取消操作、来源不匹配或已封存历史被修改时,仍会取消,不能绕过检查点安全检查。详见[上下文配置](docs/configuration.md#context)和[检查点规则](docs/internals.md#remote-compaction-v2-wire-contract)。
|
|
54
56
|
|
|
55
57
|
**远程窗口**需要原生 `openai-codex` 提供商的 `openai-codex-responses` API,或支持相应协议的 `openai-responses` 网关。网关必须在精确模型下设置 `compatibility.transport: "codex-gateway"`;这一设置不会让普通兼容端点自动获得该能力。
|
|
56
58
|
|
|
@@ -58,7 +60,7 @@ Toolkit 只读取一个全局配置文件,即使扩展安装在项目内也一
|
|
|
58
60
|
|
|
59
61
|
远程窗口依赖 alpha 接口,上游可能随时调整。切换模型时远程窗口状态仍会持久化并可复用,详见[窗口生命周期](docs/internals.md#rollover-lifecycle)。
|
|
60
62
|
|
|
61
|
-
##
|
|
63
|
+
## 搜索、生图与传输
|
|
62
64
|
|
|
63
65
|
### 联网搜索
|
|
64
66
|
|
|
@@ -107,30 +109,10 @@ Toolkit 的 WebSocket adapter 默认关闭。对使用 Pi `openai-responses` API
|
|
|
107
109
|
|
|
108
110
|
它沿用当前模型的 provider、base URL、凭据、headers 和 model ID,不注册新的 provider。Pi 的 `transport: "auto"` 会先尝试 WebSocket,并在开始流式输出前回退到 SSE;会话 ID 稳定时还会复用连接,并在历史匹配时只发送新的 continuation 输入。使用 `transport: "websocket-cached"` 可强制要求缓存连接路径,使用 `transport: "sse"` 则保持原有 HTTP/SSE 路径。修改 Toolkit 配置后请重启或 reload Pi。详见[WebSocket 配置](docs/configuration.md#responses-websocket-transport)。
|
|
109
111
|
|
|
110
|
-
### Auto Mode
|
|
111
|
-
|
|
112
|
-
Auto Mode 在工具执行前进行模型审查。先允许使用并指定 Pi 中已注册、可认证的审查模型,再手动开启:
|
|
113
|
-
|
|
114
|
-
```json
|
|
115
|
-
{
|
|
116
|
-
"schemaVersion": 2,
|
|
117
|
-
"defaults": {
|
|
118
|
-
"autoMode": {
|
|
119
|
-
"available": true,
|
|
120
|
-
"reviewerModel": "provider/reviewer-model-id"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
将 `provider/reviewer-model-id` 替换为实际模型。用 `/auto on` 或启动参数 `--auto` 开启,`/auto off` 关闭;只设置 `available: true` 不会自动开启。
|
|
127
|
-
|
|
128
|
-
默认 `gate: "side-effect"` 审查 `bash`、`write`、`edit` 和 `extraTools` 中的工具,`gate: "all"` 审查所有工具。支持只读取证、拒绝次数熔断和可选的后台分类器预评分;开启分类器后,部分调用可依据预评分放行。
|
|
129
|
-
|
|
130
|
-
审查超时或不可用不算批准:交互模式会请求用户确认,无界面模式会阻止调用。它不是沙箱,也不保证每次判断正确;选择不符合条件的模型会关闭 Auto Mode。完整配置见[Auto Mode](docs/configuration.md#auto-mode)。
|
|
131
|
-
|
|
132
112
|
## 兼容性与排查
|
|
133
113
|
|
|
114
|
+
Auto Mode、`/auto` 和 `--auto` 已移除,Toolkit 不再通过此功能审查工具调用。旧 `autoMode` 配置会被忽略并提示警告,可手动删除;其他有效设置继续正常工作。详见[移除说明](docs/configuration.md#removed-auto-mode)。
|
|
115
|
+
|
|
134
116
|
- 提供商、端点和凭据仍由 Pi 管理,不写进 Toolkit 配置。Azure 的部署映射、`api-version` 和认证说明见[提供商配置](docs/configuration.md#provider-specific-responses-endpoints)
|
|
135
117
|
- `pi-virtual` 使用 Pi 解析出的实际提供商和模型检查能力,不按虚拟模型名称推断支持情况
|
|
136
118
|
- 压缩和重放时遵守 Pi 模型元数据中的 `inputLimits.images` 缩放与数量限制,不修改持久化会话或原始请求对象
|