@narumitw/pi-codex-imagegen 0.1.1 → 0.2.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/CHANGELOG.md +41 -0
- package/README.md +8 -8
- package/docs/architecture.md +2 -2
- package/docs/protocol.md +1 -1
- package/docs/verification.md +4 -4
- package/docs/workflows.md +4 -4
- package/package.json +4 -3
- package/src/codex-imagegen.ts +2 -2
- package/src/menu.ts +2 -2
- package/src/settings-screen.ts +3 -0
- package/src/settings.ts +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @narumitw/pi-codex-imagegen
|
|
2
|
+
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 54f2700: Preserve fullscreen viewport capture through custom list wrappers so default and configured paging keys reach the focused list. Keep native transcript search, unrelated overlays, free-text modes, paste, and hard cancellation unchanged. Filter Kit key hints according to each screen's capture policy.
|
|
8
|
+
|
|
9
|
+
Update Recall and File Context to the current Kit dependency range. The selected consumer releases require the fixed Kit patch through Changesets dependency-floor updates.
|
|
10
|
+
- e484010: Include the existing package-root CHANGELOG.md in extension tarballs so Pi can show native update notices. Keep Changesets version headings and Pi's first-observation and collapseChangelog behavior unchanged.
|
|
11
|
+
- Updated dependencies [54f2700]
|
|
12
|
+
- Updated dependencies [6c76ef1]
|
|
13
|
+
- @narumitw/pi-tui-kit@0.69.0
|
|
14
|
+
|
|
15
|
+
## 0.2.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 5e7658f: Enable the `codex_imagegen` model tool by default. Existing `toolEnabled: false` overrides remain disabled, and invalid or unreadable settings keep tool access disabled. Disable model access through `/codex-imagegen` Settings or the user settings file; manual generation remains available.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 33ace2b: Remove the experimental classification from package metadata, tool and command descriptions, menus, and documentation. The request contract is confirmed against OpenAI Codex source. Keep internal-endpoint, account-access, quota, and live-verification limits unchanged.
|
|
24
|
+
- Updated dependencies [a21d39b]
|
|
25
|
+
- Updated dependencies [f68aa54]
|
|
26
|
+
- Updated dependencies [b062d21]
|
|
27
|
+
- @narumitw/pi-tui-kit@0.68.0
|
|
28
|
+
|
|
29
|
+
## 0.1.1
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [57eeae7]
|
|
34
|
+
- @narumitw/pi-tui-kit@0.67.0
|
|
35
|
+
|
|
36
|
+
## 0.1.0
|
|
37
|
+
|
|
38
|
+
### Minor Changes
|
|
39
|
+
|
|
40
|
+
- 393c25e: Add experimental image generation through the Codex image endpoint with an `/codex-imagegen` menu, user settings, and an opt-in model tool. No Codex agent or plugins are started.
|
|
41
|
+
- afa50bc: Require an exact `path` for image generation and remove the output-directory setting. Use Pi-native path resolution, overwrite existing files, follow symlinks, and request a destination in the manual menu without adding extensions or generating filenames.
|
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
Generate images from Pi through the Codex image endpoint, without starting Codex CLI, an agent, or its plugins.
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> **Endpoint:** The request contract is confirmed against [OpenAI Codex source](./docs/protocol.md#source-mapping). This uses an internal ChatGPT endpoint, not the public OpenAI Images API. Real account access and transparent output have not been verified. The endpoint can change or reject third-party clients. Do not publish the initial package until the [live checks](./docs/verification.md) pass and publication is explicitly approved.
|
|
10
10
|
|
|
11
11
|
## ✨ Features
|
|
12
12
|
|
|
13
|
-
- Generate an image manually from a menu or through
|
|
13
|
+
- Generate an image manually from a menu or through a model tool.
|
|
14
14
|
- Write original image bytes to an explicit destination with Pi-native file handling.
|
|
15
15
|
- Cancel owned requests and prevent results from reaching a replaced session.
|
|
16
16
|
- Keep authentication with Pi rather than create another credential store.
|
|
@@ -51,7 +51,7 @@ The prompt dialog preserves Pi's native multiline editing and paste behavior. Ex
|
|
|
51
51
|
|
|
52
52
|
`codex_imagegen` requires `prompt` and `path`, with an optional `transparentBackground` override. It returns the absolute destination path, image content, and structured file details. Image content is handled by Pi's normal tool-result image policy.
|
|
53
53
|
|
|
54
|
-
The tool is **
|
|
54
|
+
The tool is **enabled by default**, including codemode and nested calls. Disable it in `/codex-imagegen` → Settings to hide it from the model, codemode, tool search, and nested calls. Existing `toolEnabled: false` settings remain disabled. The manual menu does not require tool enablement. The enabled tool also works in headless modes.
|
|
55
55
|
|
|
56
56
|
`path` uses the same resolution as Pi's `write`: relative paths use the session working directory; absolute paths, `~/`, leading `@`, and file URLs are supported. Shell variables and wildcards are literal, not expanded. There is no default destination or generated filename. No extension is added or changed; the extension does not select or convert the returned image format.
|
|
57
57
|
|
|
@@ -62,7 +62,7 @@ The tool is **disabled by default**, including codemode, tool search, and nested
|
|
|
62
62
|
}
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
Missing parent directories are created. Existing files are overwritten and symlinks are followed. See [Security and privacy](#-security-and-privacy) before
|
|
65
|
+
Missing parent directories are created. Existing files are overwritten and symlinks are followed. See [Security and privacy](#-security-and-privacy) before using model access.
|
|
66
66
|
|
|
67
67
|
## ⚙️ Settings
|
|
68
68
|
|
|
@@ -70,20 +70,20 @@ User settings live in `<getAgentDir()>/pi-codex-imagegen.json`, normally `~/.pi/
|
|
|
70
70
|
|
|
71
71
|
| Setting | Default | Accepted value |
|
|
72
72
|
| --- | --- | --- |
|
|
73
|
-
| `toolEnabled` | `
|
|
73
|
+
| `toolEnabled` | `true` | Boolean; permits model access. |
|
|
74
74
|
| `transparentBackground` | `false` | Boolean; requests transparency by default, with a per-call override. Actual alpha support is provider-dependent. |
|
|
75
75
|
|
|
76
|
-
For example, to
|
|
76
|
+
For example, to disable the tool:
|
|
77
77
|
|
|
78
78
|
```json
|
|
79
79
|
{
|
|
80
|
-
"toolEnabled":
|
|
80
|
+
"toolEnabled": false
|
|
81
81
|
}
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
Defaults and Status do not create files or directories. Each generation requires an explicit path and can create its parent directories even if generation later fails.
|
|
85
85
|
|
|
86
|
-
Missing settings mean defaults. Invalid files produce a warning or lifecycle error and block settings writes until repaired. Saves preserve unknown fields, use temporary-file-plus-rename publication, and keep the prior effective values after a failed save or application. Settings reads and writes are ordered within one Pi process, not locked across separate Pi processes.
|
|
86
|
+
Missing settings mean defaults. Invalid or unreadable files disable the tool, produce a warning or lifecycle error, and block settings writes until repaired. Saves preserve unknown fields, use temporary-file-plus-rename publication, and keep the prior effective values after a failed save or application. Settings reads and writes are ordered within one Pi process, not locked across separate Pi processes.
|
|
87
87
|
|
|
88
88
|
Changes require an idle session. Enabling or disabling the tool deliberately changes the model-visible tool set and can affect prompt caching. Ordinary turns do not change tools, prompts, or earlier messages. Manual results append at the conversation tail without starting a model turn.
|
|
89
89
|
|
package/docs/architecture.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`pi-codex-imagegen` generates images directly from Pi without starting Codex CLI, another agent, or Codex plugins. These diagrams describe the current implementation.
|
|
4
4
|
|
|
5
|
-
> **
|
|
5
|
+
> **Endpoint:** The request contract is confirmed against [OpenAI Codex source](./protocol.md#source-mapping). The extension uses an internal ChatGPT endpoint, not the public OpenAI Images API. Real account access and transparent output have not been verified. See the [verification guide](./verification.md) for the remaining live checks and publication restrictions.
|
|
6
6
|
|
|
7
7
|
## Component boundaries
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ The manual menu and the optional model tool share one generation pipeline. Pi su
|
|
|
11
11
|
```mermaid
|
|
12
12
|
flowchart LR
|
|
13
13
|
User["User"] --> Menu["/codex-imagegen<br/>Manual menu"]
|
|
14
|
-
Agent["Pi agent"] --> Tool["codex_imagegen tool<br/>
|
|
14
|
+
Agent["Pi agent"] --> Tool["codex_imagegen tool<br/>Enabled by default"]
|
|
15
15
|
Menu --> Extension["pi-codex-imagegen"]
|
|
16
16
|
Tool --> Extension
|
|
17
17
|
Auth["Pi ModelRegistry<br/>openai-codex OAuth"] -->|Authentication| Extension
|
package/docs/protocol.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Codex image protocol contract
|
|
2
2
|
|
|
3
|
-
This is an independent TypeScript implementation of the generation HTTP operation
|
|
3
|
+
This is an independent TypeScript implementation of the generation HTTP operation confirmed against the OpenAI Codex source mapped below. No Codex executable, library, agent, or plugin is bundled or started. The endpoint is internal; source review and offline tests do not establish real account access.
|
|
4
4
|
|
|
5
5
|
## Source mapping
|
|
6
6
|
|
package/docs/verification.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Verification and release handoff
|
|
2
2
|
|
|
3
|
-
Deterministic tests validate the TypeScript implementation, not the availability of the internal Codex endpoint for a real account. No live image request is part of the default tests, build, package load, or Status action.
|
|
3
|
+
The request contract is confirmed against [OpenAI Codex source](./protocol.md#source-mapping). Deterministic tests validate the TypeScript implementation, not the availability of the internal Codex endpoint for a real account. No live image request is part of the default tests, build, package load, or Status action.
|
|
4
4
|
|
|
5
5
|
## Deterministic coverage
|
|
6
6
|
|
|
7
7
|
Package tests cover synthetic OAuth metadata/resolution, golden HTTP payloads, fixed destination and header filtering, redaction, redirects, quota/status errors, deadlines, bounded/chunked streams, socket cancellation, image validation, path preflight, native-style binary writes, settings transactions, UI, and lifecycle cleanup.
|
|
8
8
|
|
|
9
|
-
Real Pi SDK fixtures exercise
|
|
9
|
+
Real Pi SDK fixtures exercise explicitly disabled tool behavior through direct activation, codemode, tool search, and nested execution; default-enabled generation; normalized model-visible prefixes and toggle transitions; command modes; direct SDK disposal; and the package entrypoint through Pi's Jiti loader. All credentials, model streams, and image responses in those tests are synthetic.
|
|
10
10
|
|
|
11
11
|
Regression coverage includes required exact paths, native `write` path equivalence, overwrites, symlink and permission branches, partial write behavior, destination input cancellation, release-then-click mouse dispatch without a render boundary, save failures after normal Settings closure, partial tool-application rollback, bounded filesystem error text, terminal-marker injection, and transport results returned after SDK invalidation.
|
|
12
12
|
|
|
@@ -38,7 +38,7 @@ Expected result: Pi owns credential storage and refresh. The extension creates n
|
|
|
38
38
|
|
|
39
39
|
Responsible role: maintainer/account owner. Prerequisites: explicit permission to consume quota, compatible OAuth, network access, and completion of deterministic checks. This procedure is not authorization to spend quota.
|
|
40
40
|
|
|
41
|
-
1.
|
|
41
|
+
1. Set `toolEnabled` to `false` in a temporary or controlled Pi configuration before loading only this extension; the tool is enabled by default.
|
|
42
42
|
2. Open `/codex-imagegen` and inspect Status without causing auth refresh or an image request.
|
|
43
43
|
3. Choose Generate Image, enter one simple prompt, then provide an explicit path in a disposable directory. Existing files and symlink targets can be overwritten. Submit once; do not retry automatically.
|
|
44
44
|
4. Confirm that a supported image exists at that exact path, inspect its actual bytes/dimensions, and confirm that the reported absolute path is correct. An extension does not request format conversion.
|
|
@@ -62,4 +62,4 @@ Expected result: Pi-native input behavior and bounded screens. Mocked frames do
|
|
|
62
62
|
|
|
63
63
|
Live account/endpoint compatibility, actual generated image bytes, transparent alpha, live tool use, physical terminal/IME behavior, and runtime-specific proxy setups remain unverified. The tests must not be described as proving those paths.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Do not publish the initial package until the supported live generation path is verified and publication is explicitly approved. Do not create version tags, change npm visibility, or dispatch release workflows as part of implementation verification.
|
package/docs/workflows.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Workflows
|
|
2
2
|
|
|
3
|
-
The manual menu and the optional model tool use the same image generation pipeline. These diagrams describe the current implementation. See [Architecture](./architecture.md) for component and data boundaries, including the
|
|
3
|
+
The manual menu and the optional model tool use the same image generation pipeline. These diagrams describe the current implementation. See [Architecture](./architecture.md) for component and data boundaries, including the internal endpoint limits.
|
|
4
4
|
|
|
5
5
|
## Manual and model-driven generation
|
|
6
6
|
|
|
7
|
-
Manual generation does not require tool enablement. Model-driven generation
|
|
7
|
+
Manual generation does not require tool enablement. Model-driven generation is enabled by default and can be disabled through Settings. Both routes require a prompt and an exact destination path.
|
|
8
8
|
|
|
9
9
|
```mermaid
|
|
10
10
|
flowchart TD
|
|
@@ -13,8 +13,8 @@ flowchart TD
|
|
|
13
13
|
Menu --> Action["Select Generate Image"]
|
|
14
14
|
Action --> Input["Enter prompt and destination path"]
|
|
15
15
|
Caller -->|Pi agent| Enabled{"Is toolEnabled true?"}
|
|
16
|
-
Enabled -->|No| Unavailable["Tool unavailable
|
|
17
|
-
Enabled -->|Yes| Tool["Call codex_imagegen<br/>prompt, path, optional<br/>transparentBackground"]
|
|
16
|
+
Enabled -->|No| Unavailable["Tool unavailable"]
|
|
17
|
+
Enabled -->|Yes, default| Tool["Call codex_imagegen<br/>prompt, path, optional<br/>transparentBackground"]
|
|
18
18
|
Input --> Pipeline["Shared generation pipeline"]
|
|
19
19
|
Tool --> Pipeline
|
|
20
20
|
Pipeline --> Saved["Save image"]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narumitw/pi-codex-imagegen",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Pi image generation through the Codex image endpoint, without a Codex agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"src",
|
|
18
18
|
"docs",
|
|
19
19
|
"README.md",
|
|
20
|
+
"CHANGELOG.md",
|
|
20
21
|
"LICENSE"
|
|
21
22
|
],
|
|
22
23
|
"pi": {
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"typecheck": "tsc --noEmit"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@narumitw/pi-tui-kit": "^0.
|
|
34
|
+
"@narumitw/pi-tui-kit": "^0.69.0"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
37
|
"@earendil-works/pi-coding-agent": "*",
|
package/src/codex-imagegen.ts
CHANGED
|
@@ -201,7 +201,7 @@ export function createImagegenExtension(overrides: Partial<Dependencies> = {}) {
|
|
|
201
201
|
name: TOOL_NAME,
|
|
202
202
|
label: "Codex Image Generation",
|
|
203
203
|
description:
|
|
204
|
-
"Generate one image through the
|
|
204
|
+
"Generate one image through the Codex image endpoint using Pi's OpenAI Codex OAuth login. Writes to the required exact path, overwrites existing files, and follows symlinks like write. Consumes account quota. No automatic retries. Image editing is unsupported.",
|
|
205
205
|
parameters: PARAMETERS,
|
|
206
206
|
outputSchema: OUTPUT_SCHEMA,
|
|
207
207
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
|
|
@@ -324,7 +324,7 @@ export function createImagegenExtension(overrides: Partial<Dependencies> = {}) {
|
|
|
324
324
|
});
|
|
325
325
|
|
|
326
326
|
pi.registerCommand("codex-imagegen", {
|
|
327
|
-
description: "Generate images and manage
|
|
327
|
+
description: "Generate images and manage Codex image settings",
|
|
328
328
|
handler: async (args, ctx) => {
|
|
329
329
|
if (args.trim()) throw new Error("/codex-imagegen accepts no arguments. Open its menu without arguments.");
|
|
330
330
|
if (ctx.mode !== "tui") {
|
package/src/menu.ts
CHANGED
|
@@ -31,7 +31,7 @@ export async function showImagegenMenu(ctx: ExtensionCommandContext, owner: Imag
|
|
|
31
31
|
main: () => ({
|
|
32
32
|
kind: "actions",
|
|
33
33
|
title: "Codex Image Generation",
|
|
34
|
-
lines: ["
|
|
34
|
+
lines: ["Codex internal image endpoint", `Activity: ${owner.isBusy() ? "Generating" : "Idle"}`],
|
|
35
35
|
items: [
|
|
36
36
|
{
|
|
37
37
|
id: "generate",
|
|
@@ -52,7 +52,7 @@ export async function showImagegenMenu(ctx: ExtensionCommandContext, owner: Imag
|
|
|
52
52
|
title: "Image Generation Status",
|
|
53
53
|
lines: [
|
|
54
54
|
`Authentication: ${sanitizeTerminalText(owner.getAuthStatus())}`,
|
|
55
|
-
"Endpoint:
|
|
55
|
+
"Endpoint: ChatGPT/Codex internal image API",
|
|
56
56
|
"Local metadata does not verify account entitlement or live readiness.",
|
|
57
57
|
`Tool access: ${owner.getSettings().toolEnabled ? "enabled" : "disabled"}`,
|
|
58
58
|
"Each generation requires an output path.",
|
package/src/settings-screen.ts
CHANGED
|
@@ -104,6 +104,9 @@ export async function showImagegenSettings(
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
return {
|
|
107
|
+
get capturesViewportInput() {
|
|
108
|
+
return list.capturesViewportInput;
|
|
109
|
+
},
|
|
107
110
|
render(availableWidth) {
|
|
108
111
|
const content = list.render(Math.max(1, availableWidth));
|
|
109
112
|
const focusedRow = Math.max(
|
package/src/settings.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface ImagegenSettings {
|
|
|
10
10
|
|
|
11
11
|
export function defaultSettings(): ImagegenSettings {
|
|
12
12
|
return {
|
|
13
|
-
toolEnabled:
|
|
13
|
+
toolEnabled: true,
|
|
14
14
|
transparentBackground: false,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
@@ -114,7 +114,8 @@ export class SettingsStore {
|
|
|
114
114
|
this.current = this.effective(document);
|
|
115
115
|
return { settings: this.settings };
|
|
116
116
|
} catch {
|
|
117
|
-
|
|
117
|
+
// Invalid or unreadable settings must not grant model access.
|
|
118
|
+
this.current = { ...this.defaults, toolEnabled: false };
|
|
118
119
|
return {
|
|
119
120
|
settings: this.settings,
|
|
120
121
|
warning: "Image generation settings could not be loaded. Repair the file before saving.",
|