imagegen-smarto 0.1.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 ADDED
@@ -0,0 +1,63 @@
1
+ # imagegen-smarto
2
+
3
+ Codex skill for sending natural-language image generation and editing requests
4
+ through a custom SmartO OpenAI-compatible VPS relay.
5
+
6
+ The skill does not call Codex's built-in `image_gen` tool. It places a private
7
+ routing marker in the Responses instructions; the relay adds its
8
+ `image_generation` tool only for requests that load this skill. Ordinary
9
+ non-image requests remain unchanged.
10
+
11
+ ## Install with npm
12
+
13
+ The recommended installation is the same on Windows, Linux, and macOS:
14
+
15
+ ```bash
16
+ npm install --global imagegen-smarto
17
+ ```
18
+
19
+ The npm postinstall step copies the skill to `CODEX_HOME/skills/imagegen-smarto`
20
+ or, when `CODEX_HOME` is not set, `~/.codex/skills/imagegen-smarto`.
21
+
22
+ To reinstall or update the skill without reinstalling the npm package:
23
+
24
+ ```bash
25
+ imagegen-smarto install
26
+ ```
27
+
28
+ To print the target directory:
29
+
30
+ ```bash
31
+ imagegen-smarto path
32
+ ```
33
+
34
+ If npm lifecycle scripts are disabled, run `imagegen-smarto install` once after
35
+ the global npm installation.
36
+
37
+ ## Install with the Codex installer
38
+
39
+ The preinstalled Codex skill installer remains available as a fallback:
40
+
41
+ ```bash
42
+ python3 ~/.codex/skills/.system/skill-installer/scripts/install-skill-from-github.py \
43
+ --repo 24kmojito763/imagegen-smarto \
44
+ --path imagegen-smarto \
45
+ --method git
46
+ ```
47
+
48
+ After installation, use a profile that enables `imagegen-smarto` and disables
49
+ the official `imagegen` skill. The skill is configured for implicit invocation,
50
+ so an image request can be written in natural language without first typing
51
+ `$imagegen-smarto`.
52
+
53
+ ## Local profile switch
54
+
55
+ The two profiles used by the author are:
56
+
57
+ ```bash
58
+ codex --profile smarto
59
+ codex --profile official
60
+ ```
61
+
62
+ `smarto` selects the custom relay and enables this skill. `official` selects
63
+ the built-in OpenAI provider and enables Codex's original `imagegen` skill.
package/bin/cli.js ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict'
4
+
5
+ const fs = require('node:fs')
6
+ const os = require('node:os')
7
+ const path = require('node:path')
8
+
9
+ const packageRoot = path.resolve(__dirname, '..')
10
+ const bundledSkillPath = path.join(packageRoot, 'imagegen-smarto')
11
+
12
+ function printHelp() {
13
+ console.log(`imagegen-smarto - install the Codex SmartO image skill
14
+
15
+ Usage:
16
+ imagegen-smarto install [--codex-home <path>]
17
+ imagegen-smarto path [--codex-home <path>]
18
+ imagegen-smarto --help
19
+
20
+ The default Codex home is CODEX_HOME or ~/.codex.`)
21
+ }
22
+
23
+ function parseArgs(argv) {
24
+ const args = [...argv]
25
+ let command = 'install'
26
+ let codexHome
27
+ let quiet = false
28
+
29
+ if (args[0] && !args[0].startsWith('-')) {
30
+ command = args.shift()
31
+ }
32
+
33
+ while (args.length > 0) {
34
+ const arg = args.shift()
35
+ if (arg === '--codex-home') {
36
+ codexHome = args.shift()
37
+ if (!codexHome) {
38
+ throw new Error('--codex-home requires a path')
39
+ }
40
+ } else if (arg === '--quiet' || arg === '--postinstall') {
41
+ quiet = true
42
+ } else if (arg === '--help' || arg === '-h') {
43
+ command = 'help'
44
+ } else {
45
+ throw new Error(`unknown option: ${arg}`)
46
+ }
47
+ }
48
+
49
+ return { command, codexHome, quiet }
50
+ }
51
+
52
+ function resolveCodexHome(explicitPath) {
53
+ const configuredPath = explicitPath || process.env.CODEX_HOME
54
+ if (configuredPath && configuredPath.trim()) {
55
+ return path.resolve(configuredPath)
56
+ }
57
+ return path.join(os.homedir(), '.codex')
58
+ }
59
+
60
+ function getSkillTarget(codexHome) {
61
+ return path.join(codexHome, 'skills', 'imagegen-smarto')
62
+ }
63
+
64
+ function installSkill(codexHome) {
65
+ const sourceSkillFile = path.join(bundledSkillPath, 'SKILL.md')
66
+ if (!fs.existsSync(sourceSkillFile)) {
67
+ throw new Error(`bundled skill is missing: ${sourceSkillFile}`)
68
+ }
69
+
70
+ const target = getSkillTarget(codexHome)
71
+ fs.mkdirSync(path.dirname(target), { recursive: true })
72
+ fs.cpSync(bundledSkillPath, target, { recursive: true, force: true })
73
+ return target
74
+ }
75
+
76
+ function main() {
77
+ const { command, codexHome: explicitCodexHome, quiet } = parseArgs(process.argv.slice(2))
78
+
79
+ if (command === 'help') {
80
+ printHelp()
81
+ return
82
+ }
83
+
84
+ const codexHome = resolveCodexHome(explicitCodexHome)
85
+ if (command === 'path') {
86
+ console.log(getSkillTarget(codexHome))
87
+ return
88
+ }
89
+
90
+ if (command !== 'install') {
91
+ throw new Error(`unknown command: ${command}`)
92
+ }
93
+
94
+ const target = installSkill(codexHome)
95
+ if (!quiet) {
96
+ console.log(`Installed imagegen-smarto to ${target}`)
97
+ }
98
+ }
99
+
100
+ try {
101
+ main()
102
+ } catch (error) {
103
+ console.error(`imagegen-smarto: ${error.message}`)
104
+ process.exitCode = 1
105
+ }
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: imagegen-smarto
3
+ description: Generate or edit raster images through the user's SmartO OpenAI-compatible VPS relay. Automatically use this skill for natural-language requests to create, draw, generate, or edit an image when the SmartO relay profile is active; do not use it for image analysis or coding tasks, official OpenAI/ChatGPT providers, or the built-in image_gen tool.
4
+ ---
5
+
6
+ # SmartO relay image generation
7
+
8
+ Use this skill for actual raster-image generation or editing requests when the
9
+ SmartO relay profile is active. It is implicitly invokable, so the user should
10
+ be able to ask for an image in natural language without first writing
11
+ `$imagegen-smarto`.
12
+
13
+ This skill is a routing signal, not a local image-generation tool:
14
+
15
+ - Never call the built-in `image_gen` tool or any other native image tool.
16
+ - Never use the CLI/API fallback or ask for `OPENAI_API_KEY`.
17
+ - Keep the user's natural-language image prompt, reference images, and edit
18
+ constraints in the normal Responses request.
19
+ - Do not add a tool to ordinary non-image requests.
20
+ - Do not expose the routing marker in the user-visible answer.
21
+
22
+ The relay recognizes the marker below in the active skill instructions. Keep
23
+ this marker stable because it is the relay-side routing contract. Only image
24
+ requests that load this skill should cause the relay to add the Responses
25
+ built-in image tool:
26
+
27
+ `__CODEX_VPS_IMAGEGEN__`
28
+
29
+ The relay-side rule should apply only to `/v1/responses` requests whose
30
+ `instructions` contain that marker. It should add this tool when the request
31
+ does not already declare tools:
32
+
33
+ ```json
34
+ {"type":"image_generation","action":"auto"}
35
+ ```
36
+
37
+ It may set `tool_choice` to `auto` only when the client did not provide one.
38
+ Do not force image generation for every turn. The upstream model decides from
39
+ the natural-language request whether to generate a new image or edit an image
40
+ in context.
41
+
42
+ The relay must forward `image_generation_call` output items unchanged. A
43
+ completed item contains a base64 image in `result`; do not turn it into a text
44
+ description or replace it with the built-in tool protocol.
45
+
46
+ When the active provider is the official OpenAI/ChatGPT provider, leave this
47
+ skill unused so the original `imagegen` skill remains available there.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "SmartO VPS Image Generation"
3
+ short_description: "Generate images through the SmartO VPS relay"
4
+ default_prompt: "Use $imagegen-smarto to generate or edit an image through my SmartO VPS relay."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "imagegen-smarto",
3
+ "version": "0.1.0",
4
+ "description": "Install the imagegen-smarto Codex skill on Windows and Linux.",
5
+ "bin": {
6
+ "imagegen-smarto": "bin/cli.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "imagegen-smarto/",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "postinstall": "node bin/cli.js install --postinstall"
15
+ },
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/24kmojito763/imagegen-smarto.git"
22
+ },
23
+ "homepage": "https://github.com/24kmojito763/imagegen-smarto",
24
+ "keywords": [
25
+ "codex",
26
+ "openai",
27
+ "image-generation",
28
+ "skill"
29
+ ],
30
+ "license": "MIT"
31
+ }