pi-openai-toolkit 0.24.1 → 0.24.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.
- package/LICENSE +21 -21
- package/NOTICE +83 -83
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/config.schema.json +264 -264
- package/docs/configuration.md +304 -304
- package/docs/internals.md +3 -1
- package/package.json +123 -123
- package/src/codex-fast/extension.ts +1 -1
- package/src/compact-client.ts +412 -412
- package/src/compaction-projection.ts +35 -35
- package/src/config/legacy.ts +469 -469
- package/src/config/migration.ts +115 -115
- package/src/config/notifications.ts +46 -46
- package/src/config/policy.ts +115 -115
- package/src/config/v2.ts +1128 -1128
- package/src/config.ts +320 -320
- 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 -1095
- 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 -140
- 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 -35
- package/src/runtime.ts +875 -875
- package/src/serializer.ts +883 -882
- package/src/supported-environment.ts +27 -27
- package/src/types.ts +541 -541
- 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/docs/internals.md
CHANGED
|
@@ -31,7 +31,7 @@ Selected invalid policy blocks dependent operations; unrelated model errors rema
|
|
|
31
31
|
|
|
32
32
|
Native openai-codex-responses routes qualify. Non-official HTTP(S) openai-responses gateways qualify for recognizable GPT/Codex IDs or an exact Codex gateway identity, including a resolved virtual route. Unknown opaque aliases without that identity, Azure, other APIs and ordinary api.openai.com API-key routes remain untouched. Capability does not establish entitlement.
|
|
33
33
|
|
|
34
|
-
Version-1 pi-openai-toolkit:codex-fast entries contain only the owning Pi sessionId and enabled boolean and stay outside model context. Reload/resume and active-branch navigation restore the latest valid owned preference; malformed latest metadata defaults OFF. New/forked sessions ignore foreign preferences and start OFF.
|
|
34
|
+
Version-1 pi-openai-toolkit:codex-fast entries contain only the owning Pi sessionId and enabled boolean and stay outside model context. Reload/resume and active-branch navigation restore the latest valid owned preference; malformed latest metadata defaults OFF. New/forked sessions ignore foreign preferences and start OFF. Ineligible routes have no Fast status item; switching back to an eligible model restores Fast ON/OFF from the saved preference. Pending status refreshes cannot overwrite newer model/session state or restore the status after shutdown. Missing identity or a failed append cannot report success.
|
|
35
35
|
|
|
36
36
|
The payload hook snapshots selection and returns a new object only when an eligible ordinary request needs a tier change. Explicit OFF overrides existing Fast/Flex preferences to Standard. Compaction shapes and malformed/foreign payloads stay unchanged. Fast loads after Web Search/images and before Astra; it cannot change pre-search extras cached for separate clients. Native and Toolkit gateway WebSocket adapters compare non-input body fields, so a tier change invalidates an incompatible previous_response_id delta. Offline actual-encoder fixtures live in [test/pi-codex-fast.test.ts](../test/pi-codex-fast.test.ts), not live Fast availability evidence.
|
|
37
37
|
|
|
@@ -57,6 +57,8 @@ The selected model is the checkpoint **consumer**. An optional configured model
|
|
|
57
57
|
|
|
58
58
|
A compaction_trigger item appended to a separate synthetic streaming Responses request yields one output item of type compaction with nonempty encrypted_content, stored in CompactionEntry.details.compactedWindow. The request retains the current conversation identity; the selected model/thinking never changes and no new session or synthetic continuation is created. On later requests the opaque checkpoint replaces Pi's verified summary anchor ahead of live turns. Missing anchors abort with a notification and content-free failure artifact; sentinel-only payloads are never sent.
|
|
59
59
|
|
|
60
|
+
Historical tool calls are serialized as function_call items. Only compatible fc_* item IDs are retained; other optional IDs, including ctc_* custom-tool IDs, are omitted without changing call_id, tool arguments, result pairing or persisted history.
|
|
61
|
+
|
|
60
62
|
The incremental SSE consumer validates the first terminal event and reconciles its checkpoint with prior item evidence. A valid completed frame ends the operation even if the body stays open; best-effort reader cancellation is not awaited. Incomplete EOF, conflicting evidence and terminal errors cannot become successful checkpoints. Astra-only configuration_update items and injected native Web Search are excluded from synthetic compaction.
|
|
61
63
|
|
|
62
64
|
Missing/invalid checkpoints are not stored. Ordinary compaction may try the gated standalone protocol below; exhausted remote attempts warn once before native text summary. A failed remote attempt selects remoteCompactModel for the configured native tier; remote-ineligible resolution selects nativeFallback.model. Disabled/unset/same-model native selections keep Pi's default, including when nativeFallback.enabled is false. Explicit summary failures, aborts and projection/provenance/context-edit failures cancel; an invalid producer does not silently retry Remote V2 using the consumer.
|
package/package.json
CHANGED
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pi-openai-toolkit",
|
|
3
|
-
"version": "0.24.
|
|
4
|
-
"private": false,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"engines": {
|
|
7
|
-
"node": ">=22.19.0"
|
|
8
|
-
},
|
|
9
|
-
"description": "OpenAI toolkit for Pi: remote compaction v2, routed Web Search, image generation and Codex utilities.",
|
|
10
|
-
"author": "awoaCrim and contributors",
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/awoaCrim/pi-openai-toolkit.git"
|
|
15
|
-
},
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/awoaCrim/pi-openai-toolkit/issues"
|
|
18
|
-
},
|
|
19
|
-
"homepage": "https://github.com/awoaCrim/pi-openai-toolkit#readme",
|
|
20
|
-
"publishConfig": {
|
|
21
|
-
"access": "public",
|
|
22
|
-
"registry": "https://registry.npmjs.org/"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"pi-package",
|
|
26
|
-
"pi-extension",
|
|
27
|
-
"openai",
|
|
28
|
-
"compaction",
|
|
29
|
-
"web-search",
|
|
30
|
-
"image-generation",
|
|
31
|
-
"codex",
|
|
32
|
-
"responses"
|
|
33
|
-
],
|
|
34
|
-
"pi": {
|
|
35
|
-
"extensions": [
|
|
36
|
-
"./src/extension-runtime.ts",
|
|
37
|
-
"./src/web-search/extension.ts",
|
|
38
|
-
"./src/image-generation/extension.ts",
|
|
39
|
-
"./src/codex-fast/extension.ts",
|
|
40
|
-
"./src/codex-astra/extension.ts",
|
|
41
|
-
"./src/responses-websocket/extension.ts"
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
"files": [
|
|
45
|
-
"src/compact-client.ts",
|
|
46
|
-
"src/compaction-errors.ts",
|
|
47
|
-
"src/compaction-projection.ts",
|
|
48
|
-
"src/pi-context-hook.ts",
|
|
49
|
-
"src/config.ts",
|
|
50
|
-
"src/config-command.ts",
|
|
51
|
-
"src/config/policy.ts",
|
|
52
|
-
"src/config/legacy.ts",
|
|
53
|
-
"src/config/v2.ts",
|
|
54
|
-
"src/config/migration.ts",
|
|
55
|
-
"src/config/notifications.ts",
|
|
56
|
-
"config.schema.json",
|
|
57
|
-
"src/debug.ts",
|
|
58
|
-
"src/details-store.ts",
|
|
59
|
-
"src/deferred-tool-carryover.ts",
|
|
60
|
-
"src/extension-runtime.ts",
|
|
61
|
-
"src/retired-remote-windows.ts",
|
|
62
|
-
"src/image-generation/artifacts.ts",
|
|
63
|
-
"src/image-generation/client.ts",
|
|
64
|
-
"src/image-generation/eligibility.ts",
|
|
65
|
-
"src/image-generation/extension.ts",
|
|
66
|
-
"src/image-generation/protocol.ts",
|
|
67
|
-
"src/image-generation/references.ts",
|
|
68
|
-
"src/image-generation/render.ts",
|
|
69
|
-
"src/image-generation/service.ts",
|
|
70
|
-
"src/image-generation/types.ts",
|
|
71
|
-
"src/codex-fast/extension.ts",
|
|
72
|
-
"src/codex-fast/payload.ts",
|
|
73
|
-
"src/codex-fast/state.ts",
|
|
74
|
-
"src/codex-astra/effort-planner.ts",
|
|
75
|
-
"src/codex-astra/extension.ts",
|
|
76
|
-
"src/responses-websocket/extension.ts",
|
|
77
|
-
"src/responses-websocket/transport.ts",
|
|
78
|
-
"src/model-scope.ts",
|
|
79
|
-
"src/native-fallback.ts",
|
|
80
|
-
"src/payload-rewrite.ts",
|
|
81
|
-
"src/provider-headers.ts",
|
|
82
|
-
"src/responses-headers.ts",
|
|
83
|
-
"src/remote-v2-client.ts",
|
|
84
|
-
"src/request-context-cache.ts",
|
|
85
|
-
"src/runtime.ts",
|
|
86
|
-
"src/serializer.ts",
|
|
87
|
-
"src/supported-environment.ts",
|
|
88
|
-
"src/types.ts",
|
|
89
|
-
"src/web-search/alpha-client.ts",
|
|
90
|
-
"src/web-search/extension.ts",
|
|
91
|
-
"src/web-search/payload.ts",
|
|
92
|
-
"src/web-search/prompt.ts",
|
|
93
|
-
"src/web-search/types.ts",
|
|
94
|
-
"docs/internals.md",
|
|
95
|
-
"docs/configuration.md",
|
|
96
|
-
"README.md",
|
|
97
|
-
"README.zh.md",
|
|
98
|
-
"LICENSE",
|
|
99
|
-
"NOTICE",
|
|
100
|
-
"tsconfig.check.json"
|
|
101
|
-
],
|
|
102
|
-
"scripts": {
|
|
103
|
-
"test": "bun test",
|
|
104
|
-
"test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov && node ./scripts/check-lcov.mjs ./coverage/lcov.info",
|
|
105
|
-
"test:pi": "bun test ./test/pi-smoke.test.ts",
|
|
106
|
-
"typecheck": "tsc -p tsconfig.check.json"
|
|
107
|
-
},
|
|
108
|
-
"peerDependencies": {
|
|
109
|
-
"@earendil-works/pi-agent-core": ">=0.87.0",
|
|
110
|
-
"@earendil-works/pi-ai": ">=0.87.0",
|
|
111
|
-
"@earendil-works/pi-coding-agent": ">=0.87.0",
|
|
112
|
-
"@earendil-works/pi-tui": ">=0.87.0"
|
|
113
|
-
},
|
|
114
|
-
"devDependencies": {
|
|
115
|
-
"@earendil-works/pi-agent-core": "1.0.0",
|
|
116
|
-
"@earendil-works/pi-ai": "1.0.0",
|
|
117
|
-
"@earendil-works/pi-coding-agent": "1.0.0",
|
|
118
|
-
"@earendil-works/pi-tui": "1.0.0",
|
|
119
|
-
"@types/node": "24.12.4",
|
|
120
|
-
"bun": "1.2.23",
|
|
121
|
-
"typescript": "5.9.3"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-openai-toolkit",
|
|
3
|
+
"version": "0.24.2",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22.19.0"
|
|
8
|
+
},
|
|
9
|
+
"description": "OpenAI toolkit for Pi: remote compaction v2, routed Web Search, image generation and Codex utilities.",
|
|
10
|
+
"author": "awoaCrim and contributors",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/awoaCrim/pi-openai-toolkit.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/awoaCrim/pi-openai-toolkit/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/awoaCrim/pi-openai-toolkit#readme",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"registry": "https://registry.npmjs.org/"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"pi-package",
|
|
26
|
+
"pi-extension",
|
|
27
|
+
"openai",
|
|
28
|
+
"compaction",
|
|
29
|
+
"web-search",
|
|
30
|
+
"image-generation",
|
|
31
|
+
"codex",
|
|
32
|
+
"responses"
|
|
33
|
+
],
|
|
34
|
+
"pi": {
|
|
35
|
+
"extensions": [
|
|
36
|
+
"./src/extension-runtime.ts",
|
|
37
|
+
"./src/web-search/extension.ts",
|
|
38
|
+
"./src/image-generation/extension.ts",
|
|
39
|
+
"./src/codex-fast/extension.ts",
|
|
40
|
+
"./src/codex-astra/extension.ts",
|
|
41
|
+
"./src/responses-websocket/extension.ts"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"src/compact-client.ts",
|
|
46
|
+
"src/compaction-errors.ts",
|
|
47
|
+
"src/compaction-projection.ts",
|
|
48
|
+
"src/pi-context-hook.ts",
|
|
49
|
+
"src/config.ts",
|
|
50
|
+
"src/config-command.ts",
|
|
51
|
+
"src/config/policy.ts",
|
|
52
|
+
"src/config/legacy.ts",
|
|
53
|
+
"src/config/v2.ts",
|
|
54
|
+
"src/config/migration.ts",
|
|
55
|
+
"src/config/notifications.ts",
|
|
56
|
+
"config.schema.json",
|
|
57
|
+
"src/debug.ts",
|
|
58
|
+
"src/details-store.ts",
|
|
59
|
+
"src/deferred-tool-carryover.ts",
|
|
60
|
+
"src/extension-runtime.ts",
|
|
61
|
+
"src/retired-remote-windows.ts",
|
|
62
|
+
"src/image-generation/artifacts.ts",
|
|
63
|
+
"src/image-generation/client.ts",
|
|
64
|
+
"src/image-generation/eligibility.ts",
|
|
65
|
+
"src/image-generation/extension.ts",
|
|
66
|
+
"src/image-generation/protocol.ts",
|
|
67
|
+
"src/image-generation/references.ts",
|
|
68
|
+
"src/image-generation/render.ts",
|
|
69
|
+
"src/image-generation/service.ts",
|
|
70
|
+
"src/image-generation/types.ts",
|
|
71
|
+
"src/codex-fast/extension.ts",
|
|
72
|
+
"src/codex-fast/payload.ts",
|
|
73
|
+
"src/codex-fast/state.ts",
|
|
74
|
+
"src/codex-astra/effort-planner.ts",
|
|
75
|
+
"src/codex-astra/extension.ts",
|
|
76
|
+
"src/responses-websocket/extension.ts",
|
|
77
|
+
"src/responses-websocket/transport.ts",
|
|
78
|
+
"src/model-scope.ts",
|
|
79
|
+
"src/native-fallback.ts",
|
|
80
|
+
"src/payload-rewrite.ts",
|
|
81
|
+
"src/provider-headers.ts",
|
|
82
|
+
"src/responses-headers.ts",
|
|
83
|
+
"src/remote-v2-client.ts",
|
|
84
|
+
"src/request-context-cache.ts",
|
|
85
|
+
"src/runtime.ts",
|
|
86
|
+
"src/serializer.ts",
|
|
87
|
+
"src/supported-environment.ts",
|
|
88
|
+
"src/types.ts",
|
|
89
|
+
"src/web-search/alpha-client.ts",
|
|
90
|
+
"src/web-search/extension.ts",
|
|
91
|
+
"src/web-search/payload.ts",
|
|
92
|
+
"src/web-search/prompt.ts",
|
|
93
|
+
"src/web-search/types.ts",
|
|
94
|
+
"docs/internals.md",
|
|
95
|
+
"docs/configuration.md",
|
|
96
|
+
"README.md",
|
|
97
|
+
"README.zh.md",
|
|
98
|
+
"LICENSE",
|
|
99
|
+
"NOTICE",
|
|
100
|
+
"tsconfig.check.json"
|
|
101
|
+
],
|
|
102
|
+
"scripts": {
|
|
103
|
+
"test": "bun test",
|
|
104
|
+
"test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov && node ./scripts/check-lcov.mjs ./coverage/lcov.info",
|
|
105
|
+
"test:pi": "bun test ./test/pi-smoke.test.ts",
|
|
106
|
+
"typecheck": "tsc -p tsconfig.check.json"
|
|
107
|
+
},
|
|
108
|
+
"peerDependencies": {
|
|
109
|
+
"@earendil-works/pi-agent-core": ">=0.87.0",
|
|
110
|
+
"@earendil-works/pi-ai": ">=0.87.0",
|
|
111
|
+
"@earendil-works/pi-coding-agent": ">=0.87.0",
|
|
112
|
+
"@earendil-works/pi-tui": ">=0.87.0"
|
|
113
|
+
},
|
|
114
|
+
"devDependencies": {
|
|
115
|
+
"@earendil-works/pi-agent-core": "1.0.0",
|
|
116
|
+
"@earendil-works/pi-ai": "1.0.0",
|
|
117
|
+
"@earendil-works/pi-coding-agent": "1.0.0",
|
|
118
|
+
"@earendil-works/pi-tui": "1.0.0",
|
|
119
|
+
"@types/node": "24.12.4",
|
|
120
|
+
"bun": "1.2.23",
|
|
121
|
+
"typescript": "5.9.3"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -59,7 +59,7 @@ export function registerCodexFastExtension(
|
|
|
59
59
|
const id = currentSessionId;
|
|
60
60
|
const eligible = id && await eligibleModel(ctx, model);
|
|
61
61
|
if (epoch !== statusEpoch || sessionId(ctx) !== id) return;
|
|
62
|
-
if (ctx.hasUI) ctx.ui.setStatus(CODEX_FAST_STATUS_KEY, eligible ? "Fast " + (enabled ? "ON" : "OFF") :
|
|
62
|
+
if (ctx.hasUI) ctx.ui.setStatus(CODEX_FAST_STATUS_KEY, eligible ? "Fast " + (enabled ? "ON" : "OFF") : undefined);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
pi.on("session_start", async (_event, ctx) => { restore(ctx); await refreshStatus(ctx); });
|