@oai404iao/pi-codex-minimal-tools 1.3.0 → 1.4.1-alpha.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/README.md +38 -11
- package/THIRD_PARTY_NOTICES.md +10 -0
- package/package.json +13 -9
- package/src/activation.ts +1 -56
- package/src/adapter/compaction/checkpoint.ts +1 -0
- package/src/adapter/compaction/collect.ts +1 -0
- package/src/adapter/compaction/http.ts +1 -0
- package/src/adapter/compaction/request.ts +1 -0
- package/src/adapter/compaction/transport.ts +1 -0
- package/src/adapter/compaction/websocket.ts +1 -0
- package/src/background-image-generation.ts +1 -574
- package/src/capabilities.ts +1 -146
- package/src/codex-http.ts +1 -133
- package/src/codex-identity-extension.ts +1 -0
- package/src/codex-request-profile.ts +1 -45
- package/src/codex-reserved-tools.ts +1 -323
- package/src/codex-wire-identity.ts +1 -182
- package/src/extension/prewarm-snapshot.ts +1 -0
- package/src/extension/provider-presentation.ts +1 -0
- package/src/extension/provider-runtime.ts +1 -0
- package/src/extension/register.ts +36 -0
- package/src/extension/startup-prewarm.ts +1 -0
- package/src/fast-mode.ts +1 -124
- package/src/glyphs.ts +1 -70
- package/src/index.ts +8 -329
- package/src/model-catalog/catalog.ts +1 -636
- package/src/model-catalog/runtime.ts +1 -113
- package/src/model-catalog/types.ts +1 -95
- package/src/native-compaction.ts +1 -393
- package/src/patch/apply.ts +1 -338
- package/src/patch/parser.ts +1 -224
- package/src/patch/render.ts +1 -201
- package/src/provider-headers.ts +1 -54
- package/src/provider-native-tools.ts +1 -71
- package/src/provider-shim.ts +20 -4338
- package/src/providers/codex-apply-patch-tool.ts +1 -23
- package/src/providers/openai-codex/cache-key.ts +1 -0
- package/src/providers/openai-codex/captured-stream.ts +1 -0
- package/src/providers/openai-codex/constants.ts +1 -0
- package/src/providers/openai-codex/continuation.ts +1 -0
- package/src/providers/openai-codex/errors.ts +1 -0
- package/src/providers/openai-codex/events.ts +1 -0
- package/src/providers/openai-codex/headers.ts +1 -0
- package/src/providers/openai-codex/lite.ts +1 -0
- package/src/providers/openai-codex/message.ts +1 -0
- package/src/providers/openai-codex/prewarm.ts +1 -0
- package/src/providers/openai-codex/proxy.ts +1 -0
- package/src/providers/openai-codex/reasoning.ts +1 -0
- package/src/providers/openai-codex/request-body.ts +1 -0
- package/src/providers/openai-codex/request-context.ts +1 -0
- package/src/providers/openai-codex/request-metadata.ts +1 -0
- package/src/providers/openai-codex/retry.ts +1 -0
- package/src/providers/openai-codex/runtime.ts +1 -0
- package/src/providers/openai-codex/sse.ts +1 -0
- package/src/providers/openai-codex/stream-effects.ts +1 -0
- package/src/providers/openai-codex/stream.ts +1 -0
- package/src/providers/openai-codex/types.ts +1 -0
- package/src/providers/openai-codex/urls.ts +1 -0
- package/src/providers/openai-codex/usage.ts +1 -0
- package/src/providers/openai-codex/websocket-connection.ts +1 -0
- package/src/providers/openai-codex/websocket-events.ts +1 -0
- package/src/providers/openai-codex/websocket-session.ts +1 -0
- package/src/providers/openai-codex/websocket-socket.ts +1 -0
- package/src/providers/openai-codex/websocket-stream.ts +1 -0
- package/src/providers/openai-responses-shared.ts +7 -1463
- package/src/providers/responses/citations.ts +1 -0
- package/src/providers/responses/history.ts +1 -0
- package/src/providers/responses/items.ts +1 -0
- package/src/providers/responses/markdown.ts +1 -0
- package/src/providers/responses/messages.ts +1 -0
- package/src/providers/responses/signatures.ts +1 -0
- package/src/providers/responses/stream-state.ts +1 -0
- package/src/providers/responses/stream.ts +1 -0
- package/src/providers/responses/text-renderer.ts +1 -0
- package/src/providers/responses/text.ts +1 -0
- package/src/providers/responses/tool-identity.ts +1 -0
- package/src/providers/responses/tools.ts +1 -0
- package/src/providers/responses/types.ts +1 -0
- package/src/providers/responses/usage.ts +1 -0
- package/src/settings.ts +1 -247
- package/src/subagent-inline.ts +1 -0
- package/src/tools/apply-patch.ts +1 -84
- package/src/tools/image-generation/capture.ts +1 -0
- package/src/tools/image-generation/display.ts +1 -0
- package/src/tools/image-generation/preview.ts +1 -0
- package/src/tools/image-generation/storage.ts +1 -0
- package/src/tools/image-generation/types.ts +1 -0
- package/src/tools/image-generation.ts +1 -274
- package/src/tools/view-image.ts +1 -98
- package/src/tools/web-search/activity.ts +1 -0
- package/src/tools/web-search/capture.ts +1 -0
- package/src/tools/web-search/render.ts +1 -0
- package/src/tools/web-search.ts +1 -524
- package/src/utils/images.ts +1 -73
- package/src/utils/theme.ts +1 -0
package/README.md
CHANGED
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
Codex-specific Responses support for Pi, driven by an exact per-model JSON
|
|
4
4
|
catalog instead of model-name heuristics.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Peer floor: Pi 0.84.2; tested against 0.84.2 and 0.85.1.
|
|
7
7
|
|
|
8
|
-
> npm identity
|
|
9
|
-
>
|
|
10
|
-
>
|
|
8
|
+
> npm identity stays `@oai404iao/pi-codex-minimal-tools`. This checkout composes
|
|
9
|
+
> core, web-search and imagegen through a shared runtime. The four new packages
|
|
10
|
+
> are alpha bootstrap candidates. Guarded bundle publication remains blocked
|
|
11
|
+
> until those dependencies are bootstrapped and separately activated.
|
|
12
|
+
> Previously published tarballs are unchanged. See
|
|
13
|
+
> [package composition](../../docs/codex-packages.md) for local installation tests
|
|
14
|
+
> and version/lifecycle restrictions; this is not a new npm release.
|
|
11
15
|
|
|
12
16
|
> **Compatibility boundary:** Responses Lite uses an internal Codex request
|
|
13
17
|
> shape. This package pins and tests a compatibility serialization for exact
|
|
@@ -29,15 +33,38 @@ The extension adds:
|
|
|
29
33
|
Unknown models are not guessed. They keep Pi's native provider implementation
|
|
30
34
|
and do not receive package tools.
|
|
31
35
|
|
|
36
|
+
## Codex Identity
|
|
37
|
+
|
|
38
|
+
This package owns Codex wire identity independently from Pi's session-file id:
|
|
39
|
+
|
|
40
|
+
- a root has `SessionId === ThreadId`;
|
|
41
|
+
- subagents share the root `SessionId` and receive their own `ThreadId`;
|
|
42
|
+
- `prompt_cache_key` is the shared `SessionId`;
|
|
43
|
+
- `x-client-request-id` is the current `ThreadId`;
|
|
44
|
+
- TurnId and `x-codex-turn-state` are scoped to one logical agent turn;
|
|
45
|
+
- WindowId is thread-scoped and advances after successful compaction;
|
|
46
|
+
- the installation UUIDv4 is stored at
|
|
47
|
+
`<PI_CODING_AGENT_DIR>/pi-codex-minimal-tools/installation_id`.
|
|
48
|
+
|
|
49
|
+
SSE, Responses Lite, WebSocket, native compaction, and standalone `web.run`
|
|
50
|
+
are projections of the same request identity snapshot.
|
|
51
|
+
|
|
52
|
+
The package also exports
|
|
53
|
+
`@oai404iao/pi-codex-minimal-tools/subagent-inline`. Its named inline
|
|
54
|
+
extension installs only identity lifecycle hooks for SDK-created child
|
|
55
|
+
sessions; it does not register providers, tools, commands, or renderers.
|
|
56
|
+
|
|
32
57
|
## Install
|
|
33
58
|
|
|
34
|
-
After
|
|
59
|
+
After the reviewed split-package alpha and its dependencies are available on npm:
|
|
35
60
|
|
|
36
61
|
```bash
|
|
37
|
-
pi install npm:@oai404iao/pi-codex-minimal-tools@1.
|
|
62
|
+
pi install npm:@oai404iao/pi-codex-minimal-tools@1.4.1-alpha.0
|
|
38
63
|
```
|
|
39
64
|
|
|
40
|
-
|
|
65
|
+
Until then, test a complete repository checkout after running the root
|
|
66
|
+
`npm ci --ignore-scripts`; an isolated bundle source directory cannot supply
|
|
67
|
+
its unpublished workspace dependencies:
|
|
41
68
|
|
|
42
69
|
```bash
|
|
43
70
|
pi install /absolute/path/to/pi-codex-minimal-tools
|
|
@@ -403,8 +430,8 @@ Third-party material retains its own terms; see
|
|
|
403
430
|
[LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
404
431
|
|
|
405
432
|
The Codex namespace-tool source attribution is recorded in
|
|
406
|
-
`provenance/openai-codex-eb9dceba-reserved-tools.json`. The
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
433
|
+
`provenance/openai-codex-eb9dceba-reserved-tools.json`. The existing bundle has
|
|
434
|
+
configured trusted publishing, but the split-package alpha still requires
|
|
435
|
+
dependency-first bootstrap and activation of the four new packages before
|
|
436
|
+
guarded publication can proceed. Responses Lite remains an internal Codex compatibility path,
|
|
410
437
|
not an OpenAI-supported public API contract.
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
|
+
## Split ownership
|
|
4
|
+
|
|
5
|
+
The local implementation paths described below are retained as compatibility
|
|
6
|
+
forwards or verified asset mirrors. Their adaptations now live in
|
|
7
|
+
`@oai404iao/pi-codex-core`; namespace serialization lives in
|
|
8
|
+
`@oai404iao/pi-codex-runtime/src/reserved-tools/`. Those packages retain the
|
|
9
|
+
original modification notices, Apache snapshots and provenance. Search/image
|
|
10
|
+
clients live in their respective capability packages. No upstream revision or
|
|
11
|
+
reviewed fingerprint changed during this move.
|
|
12
|
+
|
|
3
13
|
## OpenAI Codex
|
|
4
14
|
|
|
5
15
|
This package includes and analyzes material from
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oai404iao/pi-codex-minimal-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1-alpha.0",
|
|
4
4
|
"description": "Model-profiled Codex Responses tools for Pi: WebSocket, Lite, web search, images, compaction, and apply_patch",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"url": "https://github.com/oai404iao/omp/issues"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./src/index.ts",
|
|
17
|
+
"./subagent-inline": "./src/subagent-inline.ts"
|
|
18
|
+
},
|
|
15
19
|
"keywords": [
|
|
16
20
|
"pi-package",
|
|
17
21
|
"pi",
|
|
@@ -39,15 +43,15 @@
|
|
|
39
43
|
"typebox": "*"
|
|
40
44
|
},
|
|
41
45
|
"dependencies": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
+
"@oai404iao/pi-codex-runtime": "0.1.0-alpha.1",
|
|
47
|
+
"@oai404iao/pi-codex-core": "0.1.0-alpha.1",
|
|
48
|
+
"@oai404iao/pi-codex-web-search": "0.1.0-alpha.1",
|
|
49
|
+
"@oai404iao/pi-codex-imagegen": "0.1.0-alpha.1"
|
|
46
50
|
},
|
|
47
51
|
"devDependencies": {
|
|
48
|
-
"@earendil-works/pi-ai": "
|
|
49
|
-
"@earendil-works/pi-coding-agent": "
|
|
50
|
-
"@earendil-works/pi-tui": "
|
|
52
|
+
"@earendil-works/pi-ai": "0.85.1",
|
|
53
|
+
"@earendil-works/pi-coding-agent": "0.85.1",
|
|
54
|
+
"@earendil-works/pi-tui": "0.85.1",
|
|
51
55
|
"@types/node": "^26.2.0",
|
|
52
56
|
"tsx": "^4.20.6",
|
|
53
57
|
"typebox": "^1.1.24",
|
|
@@ -83,5 +87,5 @@
|
|
|
83
87
|
"optional": true
|
|
84
88
|
}
|
|
85
89
|
},
|
|
86
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "53026bf9e3f6a1d16a9c990e6034b49041928eab"
|
|
87
91
|
}
|
package/src/activation.ts
CHANGED
|
@@ -1,56 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { listResolvedModelProfiles, resolveModelProfile } from "./model-catalog/catalog.js";
|
|
3
|
-
import type { CodexMinimalToolsSettings } from "./settings.js";
|
|
4
|
-
|
|
5
|
-
export interface ModelRegistryLike {
|
|
6
|
-
getAll?: () => unknown;
|
|
7
|
-
getAvailable?: () => unknown;
|
|
8
|
-
find?: (provider: string, id: string) => unknown;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ActivationContextLike {
|
|
12
|
-
model?: ModelLike;
|
|
13
|
-
modelRegistry?: ModelRegistryLike;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function registryModels(registry: ModelRegistryLike | undefined): ModelLike[] {
|
|
17
|
-
if (!registry) return [];
|
|
18
|
-
for (const method of [registry.getAll, registry.getAvailable]) {
|
|
19
|
-
if (typeof method !== "function") continue;
|
|
20
|
-
try {
|
|
21
|
-
const value = method.call(registry);
|
|
22
|
-
if (Array.isArray(value)) return value.filter((model): model is ModelLike => Boolean(model) && typeof model === "object");
|
|
23
|
-
} catch {
|
|
24
|
-
// Try the next registry shape.
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function hasConfiguredModelsLoaded(
|
|
31
|
-
ctx: ActivationContextLike,
|
|
32
|
-
settings?: CodexMinimalToolsSettings,
|
|
33
|
-
): boolean {
|
|
34
|
-
const current = resolveModelProfile(ctx.model, { settings });
|
|
35
|
-
if (current?.effective.enabled) return true;
|
|
36
|
-
const configured = new Set(
|
|
37
|
-
listResolvedModelProfiles({ settings })
|
|
38
|
-
.filter((profile) => profile.effective.enabled)
|
|
39
|
-
.map((profile) => profile.id.toLowerCase()),
|
|
40
|
-
);
|
|
41
|
-
if (registryModels(ctx.modelRegistry).some((model) => {
|
|
42
|
-
const provider = model.provider?.trim().toLowerCase();
|
|
43
|
-
const id = model.id?.trim().toLowerCase();
|
|
44
|
-
return Boolean(provider && id && configured.has(`${provider}/${id}`));
|
|
45
|
-
})) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
return [...configured].some((fullId) => {
|
|
50
|
-
const slash = fullId.indexOf("/");
|
|
51
|
-
return Boolean(ctx.modelRegistry?.find?.(fullId.slice(0, slash), fullId.slice(slash + 1)));
|
|
52
|
-
});
|
|
53
|
-
} catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
export * from "@oai404iao/pi-codex-runtime/internal/activation";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@oai404iao/pi-codex-core/internal/adapter/compaction/checkpoint";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@oai404iao/pi-codex-core/internal/adapter/compaction/collect";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@oai404iao/pi-codex-core/internal/adapter/compaction/http";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@oai404iao/pi-codex-core/internal/adapter/compaction/request";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@oai404iao/pi-codex-core/internal/adapter/compaction/transport";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@oai404iao/pi-codex-core/internal/adapter/compaction/websocket";
|