pi-openai-toolkit 0.23.2 → 0.24.1
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 +4 -15
- package/README.zh.md +4 -15
- package/config.schema.json +264 -278
- package/docs/configuration.md +304 -306
- package/docs/internals.md +34 -120
- package/package.json +123 -136
- package/src/compact-client.ts +412 -412
- package/src/compaction-projection.ts +35 -35
- package/src/config/legacy.ts +469 -519
- package/src/config/migration.ts +115 -103
- package/src/config/notifications.ts +46 -36
- package/src/config/policy.ts +115 -116
- package/src/config/v2.ts +1128 -1167
- package/src/config.ts +320 -310
- package/src/debug.ts +238 -238
- package/src/deferred-tool-carryover.ts +282 -282
- package/src/details-store.ts +151 -151
- package/src/extension-runtime.ts +1095 -1919
- 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 +140 -152
- package/src/payload-rewrite.ts +515 -515
- package/src/pi-context-hook.ts +117 -117
- package/src/remote-v2-client.ts +811 -811
- package/src/request-context-cache.ts +155 -155
- package/src/responses-headers.ts +180 -180
- package/src/retired-remote-windows.ts +35 -0
- package/src/runtime.ts +875 -865
- package/src/serializer.ts +882 -882
- package/src/supported-environment.ts +27 -27
- package/src/types.ts +541 -565
- 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 -50
- package/src/context-management/codex-provider.ts +0 -270
- package/src/context-management/history-notes.ts +0 -357
- package/src/context-management/manual-compact.ts +0 -247
- package/src/context-management/messages.ts +0 -238
- package/src/context-management/namespace-tools.ts +0 -426
- package/src/context-management/responses-tools.ts +0 -238
- package/src/context-management/scoped-compaction.ts +0 -89
- package/src/context-management/tool-contract.ts +0 -62
- package/src/context-management/tools.ts +0 -371
- package/src/context-management/types.ts +0 -168
- package/src/context-management/window-budget.ts +0 -83
- package/src/context-management/window-bulk.ts +0 -155
- package/src/context-management/window-manager.ts +0 -912
- package/src/context-management/window-request.ts +0 -125
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
|
-
|
|
3
|
+
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)
|
|
@@ -47,30 +47,19 @@ Settings resolve in this order: built-in defaults → `defaults` → `models["pr
|
|
|
47
47
|
Set `defaults.context.mode` or an individual model's `context.mode`:
|
|
48
48
|
|
|
49
49
|
- `remote-compaction`: the default; continue with encrypted checkpoints returned by the server
|
|
50
|
-
- `remote-windows`: use Codex remote context windows, retrieve earlier work with `history`, and save handoff notes with `notes`
|
|
51
50
|
- `pi`: leave context management to Pi
|
|
52
51
|
|
|
53
52
|
**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
53
|
|
|
55
|
-
Set `context.remoteCompaction.model` to use a separate producer on the same effective base URL without changing the active model. For ordinary remote compaction, 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
|
+
Set `context.remoteCompaction.model` to use a separate producer on the same effective base URL without changing the active model. When its full `provider/model-id` matches the current model, Toolkit directly reuses the current runtime, authentication snapshot, and session; it does not select the model again or switch to native summarization merely because the models match. For ordinary remote compaction, 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).
|
|
56
55
|
|
|
57
|
-
**Remote
|
|
58
|
-
|
|
59
|
-
Change `mode` in the example above to `remote-windows`. Eligible sessions expose `new_context`, `get_context_remaining`, `history`, and `notes`. Manual `/compact [instructions]` uses Pi's native text compression of **only the current window**. It does not use the Toolkit remote producer or configured fallback, switch the active model, open another window, or send an automatic continuation. `remote-compaction` is the mode that selects Toolkit's remote/fallback compression chain.
|
|
60
|
-
|
|
61
|
-
An existing effective window boundary survives model changes and switches to `remote-compaction` or `pi`: retired history stays outside live requests and every compaction tier. Historical boundaries constrain input; they cannot replace a requested compression with no-summary cleanup. Window identity is preserved for switching back. An unsafe current-window view cancels rather than reopening archived windows. The legacy `leaveManagedMode` setting remains compatible but does not trigger bulk close-out compaction.
|
|
62
|
-
|
|
63
|
-
Native text compression cannot read an existing encrypted checkpoint. If that checkpoint owns the current context, native compression/fallback cancels and preserves it instead of summarizing its placeholder and losing information. Compatible remote compression can still reuse it.
|
|
64
|
-
|
|
65
|
-
Raw history remains in the local Pi session JSONL; remote `history`/`notes` are separate backend APIs. Window markers alone are not native Pi cutoffs, so request-time isolation requires the extension to be loaded. An old session already ending in a no-summary cleanup may report `Already compacted` before any extension hook; continue with a genuine user message before retrying. Toolkit does not rewrite those logs or bypass Pi's eligibility checks.
|
|
66
|
-
|
|
67
|
-
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).
|
|
56
|
+
**Remote Windows has been removed**, including its four tools and model-selection recovery. Old window sessions are not continuable: Toolkit refuses branches containing their markers instead of resending retired history. Start a new session; existing files are not rewritten or deleted. Dormant window settings are ignored with a warning, but a selected `remote-windows` mode must be changed explicitly. See [retirement guidance](docs/configuration.md#removed-remote-windows). Shared Codex gateway transport remains available to compaction and images.
|
|
68
57
|
|
|
69
58
|
## Codex Fast
|
|
70
59
|
|
|
71
60
|
Fast is OFF by default. Run `/fast` in Pi's terminal or a UI-backed RPC client such as pi-web to turn it ON, then run it again to turn it OFF. Notifications confirm changes; the status is `Fast ON`, `Fast OFF`, or `Fast N/A` for an ineligible route, with display placement controlled by the client. Print/JSON and headless commands cannot toggle Fast. No Fast configuration is needed.
|
|
72
61
|
|
|
73
|
-
Supports native Codex and recognizable GPT/Codex models on compatible Responses gateways. The selection is saved only in the current session: reload/resume
|
|
62
|
+
Supports native Codex and recognizable GPT/Codex models on compatible Responses gateways. The selection is saved only in the current session: reload/resume retain it; new or forked sessions start OFF. ON requests Fast, while OFF requests Standard, overriding an existing service-tier preference on eligible conversation requests without changing reasoning effort or configuration files.
|
|
74
63
|
|
|
75
64
|
Fast may increase usage/cost. The indicator shows the requested mode, not confirmed backend acceleration; a gateway may reject, ignore, or downgrade it. Opaque gateway model aliases need an existing Codex gateway identity. See the [Fast contract](docs/internals.md#codex-fast-session-control) for scope and lifecycle details.
|
|
76
65
|
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-openai-toolkit
|
|
2
2
|
|
|
3
|
-
为 Pi
|
|
3
|
+
为 Pi 添加 Responses 压缩、联网搜索和图像生成。沿用 Pi 的模型、端点、认证和会话配置,不另行注册提供商或模型。
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/pi-openai-toolkit)
|
|
6
6
|
[](LICENSE)
|
|
@@ -47,30 +47,19 @@ Toolkit 只读取一个全局配置文件,即使扩展安装在项目内也一
|
|
|
47
47
|
通过 `defaults.context.mode` 或单个模型的 `context.mode` 选择:
|
|
48
48
|
|
|
49
49
|
- `remote-compaction`:默认模式,使用服务端返回的加密检查点继续会话
|
|
50
|
-
- `remote-windows`:使用 Codex 远程上下文窗口,通过 `history` 检索较早内容、`notes` 保存交接信息
|
|
51
50
|
- `pi`:交给 Pi 管理上下文
|
|
52
51
|
|
|
53
52
|
**远程压缩**支持 `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
53
|
|
|
55
|
-
可用 `context.remoteCompaction.model` 指定同一有效 base URL
|
|
54
|
+
可用 `context.remoteCompaction.model` 指定同一有效 base URL 下的独立压缩模型,不改变当前模型。指定模型的完整 `provider/model-id` 与当前模型相同时,直接复用当前运行信息、鉴权快照和 session,不重复选择模型,也不会仅因模型相同就改用原生文本摘要。普通远程压缩的远程尝试全部失败后,会明确提示并继续文本摘要。`nativeFallback.enabled: false` 只关闭 Toolkit 的指定模型回退层,不关闭 Pi 默认摘要。取消操作、来源不匹配或已封存历史被修改时,仍会取消,不能绕过检查点安全检查。详见[上下文配置](docs/configuration.md#context)和[检查点规则](docs/internals.md#remote-compaction-v2-wire-contract)。
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
将上例的 `mode` 改为 `remote-windows` 后,符合条件的会话会提供 `new_context`、`get_context_remaining`、`history` 和 `notes`。手动 `/compact [instructions]` 使用 Pi 原生文本压缩,**只处理当前窗口**。它不调用 Toolkit 的远程 producer 或指定回退模型,不切换当前模型、打开新窗口,也不自动发送续跑提示。只有 `remote-compaction` 模式选择 Toolkit 的远程压缩及回退链路。
|
|
60
|
-
|
|
61
|
-
切换模型或改用 `remote-compaction`、`pi` 模式后,已有的有效窗口边界仍然生效:旧历史不会进入普通请求或任何压缩层。历史边界只限定输入,不能把实际压缩替换成一次无摘要清理。窗口身份仍会保留,便于切回;无法安全重建当前窗口时取消操作,不退回全部归档历史。旧配置中的 `leaveManagedMode` 仍会解析,但不再触发批量 close-out 压缩。
|
|
62
|
-
|
|
63
|
-
原生文本压缩无法读取已有的加密检查点。如果当前上下文由该检查点承接,原生压缩或回退会取消并保留现状,避免把占位文本当作摘要、丢失信息;兼容的远程压缩仍可复用它。
|
|
64
|
-
|
|
65
|
-
完整历史仍保存在本地 Pi 会话 JSONL,远端 `history`、`notes` 则是独立的后端 API。窗口标记本身不是 Pi 原生截断点,运行时隔离仍依赖扩展正常加载。旧会话若恰好以无摘要清理记录结尾,Pi 可能在进入扩展钩子前提示 `Already compacted`;先发送一条正常用户消息再重试。Toolkit 不改写原日志,也不绕过 Pi 的压缩资格检查。
|
|
66
|
-
|
|
67
|
-
远程窗口依赖 alpha 接口,上游可能随时调整。切换模型时远程窗口状态仍会持久化并可复用,详见[窗口生命周期](docs/internals.md#rollover-lifecycle)。
|
|
56
|
+
**Remote Windows 已完整移除**,包括四个工具和旧模型选择恢复逻辑。旧窗口会话不能续跑:Toolkit 会拒绝包含旧标记的分支,避免把已退休历史重新发送给模型。请新建会话;原文件不会被改写或删除。闲置窗口配置只提示退役,仍选择 `remote-windows` 的配置则必须明确改用受支持模式。详见[退役说明](docs/configuration.md#removed-remote-windows)。压缩与生图共用的 Codex gateway 传输支持仍然保留。
|
|
68
57
|
|
|
69
58
|
## Codex Fast
|
|
70
59
|
|
|
71
60
|
Fast 默认关闭。在 Pi 终端或 pi-web 等支持 UI 的 RPC 客户端中输入 `/fast` 开启,再输入一次关闭。切换结果通过通知确认;状态为 `Fast ON`、`Fast OFF`,不适用的路由为 `Fast N/A`,显示位置由客户端决定。print/JSON 和无 UI 模式不能切换 Fast。无需添加 Fast 配置。
|
|
72
61
|
|
|
73
|
-
支持原生 Codex,以及兼容 Responses 网关中可识别的 GPT/Codex 模型。开关只保存在当前会话:reload
|
|
62
|
+
支持原生 Codex,以及兼容 Responses 网关中可识别的 GPT/Codex 模型。开关只保存在当前会话:reload 和续聊保留状态,新建或 fork 的会话默认关闭。开启时请求 Fast,关闭时请求标准档,会覆盖符合条件的对话请求中原有的服务档位,但不改变 reasoning effort 或配置文件。
|
|
74
63
|
|
|
75
64
|
Fast 可能增加额度消耗或费用。状态栏表示请求模式,不代表后端已确认加速;网关可能拒绝、忽略或降级请求。无法识别的网关模型别名需要已有的 Codex 网关路由标识。适用范围和生命周期见 [Fast 规则](docs/internals.md#codex-fast-session-control)。
|
|
76
65
|
|