diff --git a/skills/baoyu-article-illustrator/SKILL.md b/skills/baoyu-article-illustrator/SKILL.md index 44c4af4..34ed7e6 100644 --- a/skills/baoyu-article-illustrator/SKILL.md +++ b/skills/baoyu-article-illustrator/SKILL.md @@ -1,7 +1,7 @@ --- name: baoyu-article-illustrator description: Analyzes article structure, identifies positions requiring visual aids, generates illustrations with Type × Style × Palette three-dimension approach. Use when user asks to "illustrate article", "add images", "generate images for article", or "为文章配图". -version: 1.117.3 +version: 1.117.4 metadata: openclaw: homepage: https://github.com/JimLiu/baoyu-skills#baoyu-article-illustrator @@ -29,6 +29,7 @@ When this skill needs to render an image, resolve the backend in this order: 2. **Saved preference** — if `EXTEND.md` sets `preferred_image_backend` to a backend available right now, use it. 3. **Auto-select** (when the preference is `auto`, unset, or the pinned backend isn't available): - **Codex (`imagegen`)** — first, inspect your available-skills / tool inventory. If a skill named `imagegen` is listed, you are running inside Codex and MUST use it: invoke via the `Skill` tool with `skill: "imagegen"`, passing the saved prompt file's content (plus output path and aspect ratio per Codex `imagegen`'s own args). Codex `imagegen` is the official raster backend in that runtime and outranks any non-native skill (e.g., `baoyu-image-gen`) unless the user has explicitly pinned a different `preferred_image_backend`. + - **Codex via `codex exec` (`codex-imagegen`)** — if the current runtime exposes no native `imagegen` skill but the `codex` CLI is on `PATH` with an active `codex login`, route through `baoyu-image-gen --provider codex-cli` (preferred), or — if baoyu-image-gen is unavailable — invoke the bundled wrapper directly. Details, parameters, and the runtime-discovery procedure live in [references/codex-imagegen.md](references/codex-imagegen.md) — load that file only when this branch is selected. - **Other runtime-native tools** — if the runtime exposes a different native image tool (e.g., Hermes `image_generate`), use it the same way. - Otherwise, if exactly one non-native backend is installed (e.g., `baoyu-image-gen`), use it. - Otherwise (multiple non-native backends with no runtime-native tool), ask the user once — batch with any other initial questions. @@ -185,6 +186,7 @@ Full template: [references/workflow.md](references/workflow.md#step-4-generate-o 4. LABELS **MUST** include article-specific data: actual numbers, terms, metrics, quotes 5. **DO NOT** pass ad-hoc inline prompts to `--prompt` without saving prompt files first 6. Select the backend via the `## Image Generation Tools` rule at the top: use whatever is available; if multiple, ask the user once. Do this once per session before any generation. + - **`codex-imagegen` invocation**: when the rule resolves to `codex-imagegen`, see [references/codex-imagegen.md](references/codex-imagegen.md) for the invocation contract (preferred `baoyu-image-gen --provider codex-cli` path, runtime wrapper discovery, parameter notes, stdout schema, batch semantics). 7. **Execution strategy**: Generate in batches per the `## Batch Generation Policy`: backend native batch first, runtime parallel tool calls second, sequential only as fallback. Default batch size is 4 unless EXTEND.md or the current request overrides it. 8. Process references (`direct`/`style`/`palette`) per prompt frontmatter 9. Apply watermark if EXTEND.md enabled diff --git a/skills/baoyu-article-illustrator/references/codex-imagegen.md b/skills/baoyu-article-illustrator/references/codex-imagegen.md new file mode 100644 index 0000000..8ab615b --- /dev/null +++ b/skills/baoyu-article-illustrator/references/codex-imagegen.md @@ -0,0 +1,65 @@ +# `codex-imagegen` Wrapper Invocation + +Load this reference only when the [Image Generation Tools](../SKILL.md#image-generation-tools) rule has resolved to `codex-imagegen` — i.e., the current runtime exposes no native `imagegen` skill but `codex` CLI is on `PATH` with an active `codex login`. + +## Preferred path: route through `baoyu-image-gen` + +If the `baoyu-image-gen` skill is available in this runtime, **always** invoke through it rather than calling the wrapper directly. It handles retry/cache/batch/EXTEND.md preferences uniformly with every other provider. + +```bash +${BUN_X} /scripts/main.ts \ + --provider codex-cli \ + --image \ + --promptfiles \ + --ar \ + [--ref ]... +``` + +Resolve `` the same way you resolve any sibling skill — through your runtime's skill registry (`Skill` tool, plugin marketplace, or `$HOME/.baoyu-skills/baoyu-image-gen/`). + +## Fallback: spawn the wrapper directly + +Only when `baoyu-image-gen` is NOT installed in the current runtime. Discover the wrapper's location at runtime — do NOT hard-code `../../packages/...` from this skill: + +1. **Honor explicit override**: if `$BAOYU_CODEX_IMAGEGEN_BIN` is set and points to a real file, use that path. It may be `.ts` (spawn `bun `) or `.sh`/binary (spawn directly). +2. **Search the plugin root**: walk up from this skill's directory looking for `packages/baoyu-codex-imagegen/src/main.ts`. If found, that is the wrapper. Spawn it with `bun`. +3. **Last resort**: tell the user that `codex-imagegen` is not available in this runtime and ask whether to install the `baoyu-skills` plugin (or set `BAOYU_CODEX_IMAGEGEN_BIN`) or pick another backend. + +Once located, the invocation shape is: + +```bash +bun /main.ts \ + --image \ + --prompt-file \ + --aspect \ + [--ref ]... \ + [--timeout ] \ + [--cache-dir ~/.cache/baoyu-codex-imagegen] \ + [--log-file ] +``` + +If `bun` is missing, `npx -y bun /main.ts ...` works as a fallback. + +## Parameter notes + +- **All filesystem inputs** are auto-resolved against `process.cwd()` when relative, but agents should pass absolute paths to be robust against cwd drift. +- **`--timeout`** defaults to `300000` (5 min) per `codex exec` attempt. Raise (e.g. `--timeout 600000` for 10 min) on slow networks or large prompts. +- **`--cache-dir`** is off by default. Enable for repeatable runs to skip redundant generations of the same prompt+aspect+refs. +- **Authentication**: the wrapper uses the user's Codex subscription — no `OPENAI_API_KEY` is read or sent. + +## Stdout contract + +Single JSON line: + +- Success: `{"status":"ok","path":"...","bytes":N,"elapsed_seconds":N,"thread_id":"...","attempts":N,"cached":bool,...}` +- Failure: `{"status":"error","path":"...","bytes":0,"error":"...","error_kind":"..."}` + +`error_kind` values: `codex_not_installed`, `invalid_args`, `prompt_file_missing`, `spawn_failed`, `timeout`, `no_image_gen_tool_use`, `output_missing`, `invalid_png`, `agent_refused`, `lock_busy`. + +On retryable errors (timeout, spawn_failed, no_image_gen_tool_use, output_missing, invalid_png, agent_refused), ask the user whether to retry or fall back to another backend. + +## Batch semantics + +- Codex `image_gen` returns **one image per call** (`n=1` only). Multi-image jobs must dispatch one wrapper call per image. +- The wrapper does NOT accept a `--sessionId` flag. Chain/scene consistency must come from `--ref` reference images. +- `--size` and `--quality` are silently ignored — Codex picks pixel dimensions from `--aspect`. diff --git a/skills/baoyu-comic/SKILL.md b/skills/baoyu-comic/SKILL.md index 0fd800e..da0ff5d 100644 --- a/skills/baoyu-comic/SKILL.md +++ b/skills/baoyu-comic/SKILL.md @@ -1,7 +1,7 @@ --- name: baoyu-comic description: Knowledge comic creator supporting multiple art styles and tones. Creates original educational comics with detailed panel layouts and batch-capable image generation. Use when user asks to create "知识漫画", "教育漫画", "biography comic", "tutorial comic", or "Logicomix-style comic". -version: 1.117.3 +version: 1.117.4 metadata: openclaw: homepage: https://github.com/JimLiu/baoyu-skills#baoyu-comic @@ -33,6 +33,7 @@ When this skill needs to render an image, resolve the backend in this order: 2. **Saved preference** — if `EXTEND.md` sets `preferred_image_backend` to a backend available right now, use it. 3. **Auto-select** (when the preference is `auto`, unset, or the pinned backend isn't available): - **Codex (`imagegen`)** — first, inspect your available-skills / tool inventory. If a skill named `imagegen` is listed, you are running inside Codex and MUST use it: invoke via the `Skill` tool with `skill: "imagegen"`, passing the saved prompt file's content (plus output path and aspect ratio per Codex `imagegen`'s own args). Codex `imagegen` is the official raster backend in that runtime and outranks any non-native skill (e.g., `baoyu-image-gen`) unless the user has explicitly pinned a different `preferred_image_backend`. + - **Codex via `codex exec` (`codex-imagegen`)** — if the current runtime exposes no native `imagegen` skill but the `codex` CLI is on `PATH` with an active `codex login`, route through `baoyu-image-gen --provider codex-cli` (preferred), or — if baoyu-image-gen is unavailable — invoke the bundled wrapper directly. Details, parameters, and the runtime-discovery procedure live in [references/codex-imagegen.md](references/codex-imagegen.md) — load that file only when this branch is selected. - **Other runtime-native tools** — if the runtime exposes a different native image tool (e.g., Hermes `image_generate`), use it the same way. - Otherwise, if exactly one non-native backend is installed (e.g., `baoyu-image-gen`), use it. - Otherwise (multiple non-native backends with no runtime-native tool), ask the user once — batch with any other initial questions. @@ -247,6 +248,8 @@ Analyze → [Check Existing?] → [Confirm: Style + Reviews] → Storyboard → **Pick a backend once per session** using the `## Image Generation Tools` rule at the top. If the backend is a repo skill (e.g., `baoyu-image-gen`), read its `SKILL.md` and use its documented interface rather than its scripts. +**`codex-imagegen` invocation**: when the rule resolves to `codex-imagegen`, see [references/codex-imagegen.md](references/codex-imagegen.md) for the invocation contract (preferred `baoyu-image-gen --provider codex-cli` path, runtime wrapper discovery, parameter notes, stdout schema, batch semantics — n=1 per call so page batches must dispatch one wrapper call per page). + **7.1 Character sheet** — generate it (to `characters/characters.png`, aspect `4:3`) when the comic is multi-page with recurring characters. Skip for simple presets (e.g., four-panel minimalist) or single-page comics. Compress to JPEG before use-as-`--ref` (`sips -s format jpeg -s formatOptions 80 …` on macOS, `pngquant --quality=65-80 …` elsewhere) to avoid payload failures. The prompt file at `characters/characters.md` must exist before invoking the backend. **7.2 Pages** — each page's prompt MUST already be at `prompts/NN-{cover|page}-[slug].md` before invoking the backend; the file is the reproducibility record. Strategy depends on the character sheet: diff --git a/skills/baoyu-comic/references/codex-imagegen.md b/skills/baoyu-comic/references/codex-imagegen.md new file mode 100644 index 0000000..b9ea439 --- /dev/null +++ b/skills/baoyu-comic/references/codex-imagegen.md @@ -0,0 +1,65 @@ +# `codex-imagegen` Wrapper Invocation + +Load this reference only when the [Image Generation Tools](../SKILL.md#image-generation-tools) rule has resolved to `codex-imagegen` — i.e., the current runtime exposes no native `imagegen` skill but `codex` CLI is on `PATH` with an active `codex login`. + +## Preferred path: route through `baoyu-image-gen` + +If the `baoyu-image-gen` skill is available in this runtime, **always** invoke through it rather than calling the wrapper directly. It handles retry/cache/batch/EXTEND.md preferences uniformly with every other provider. + +```bash +${BUN_X} /scripts/main.ts \ + --provider codex-cli \ + --image \ + --promptfiles \ + --ar \ + [--ref ]... +``` + +Resolve `` the same way you resolve any sibling skill — through your runtime's skill registry (`Skill` tool, plugin marketplace, or `$HOME/.baoyu-skills/baoyu-image-gen/`). + +## Fallback: spawn the wrapper directly + +Only when `baoyu-image-gen` is NOT installed in the current runtime. Discover the wrapper's location at runtime — do NOT hard-code `../../packages/...` from this skill: + +1. **Honor explicit override**: if `$BAOYU_CODEX_IMAGEGEN_BIN` is set and points to a real file, use that path. It may be `.ts` (spawn `bun `) or `.sh`/binary (spawn directly). +2. **Search the plugin root**: walk up from this skill's directory looking for `packages/baoyu-codex-imagegen/src/main.ts`. If found, that is the wrapper. Spawn it with `bun`. +3. **Last resort**: tell the user that `codex-imagegen` is not available in this runtime and ask whether to install the `baoyu-skills` plugin (or set `BAOYU_CODEX_IMAGEGEN_BIN`) or pick another backend. + +Once located, the invocation shape is: + +```bash +bun /main.ts \ + --image \ + --prompt-file \ + --aspect \ + [--ref ]... \ + [--timeout ] \ + [--cache-dir ~/.cache/baoyu-codex-imagegen] \ + [--log-file ] +``` + +If `bun` is missing, `npx -y bun /main.ts ...` works as a fallback. + +## Parameter notes + +- **All filesystem inputs** are auto-resolved against `process.cwd()` when relative, but agents should pass absolute paths to be robust against cwd drift. +- **`--timeout`** defaults to `300000` (5 min) per `codex exec` attempt. Raise (e.g. `--timeout 600000` for 10 min) on slow networks or large prompts. +- **`--cache-dir`** is off by default. Enable for repeatable runs to skip redundant generations of the same prompt+aspect+refs. +- **Authentication**: the wrapper uses the user's Codex subscription — no `OPENAI_API_KEY` is read or sent. + +## Stdout contract + +Single JSON line: + +- Success: `{"status":"ok","path":"...","bytes":N,"elapsed_seconds":N,"thread_id":"...","attempts":N,"cached":bool,...}` +- Failure: `{"status":"error","path":"...","bytes":0,"error":"...","error_kind":"..."}` + +`error_kind` values: `codex_not_installed`, `invalid_args`, `prompt_file_missing`, `spawn_failed`, `timeout`, `no_image_gen_tool_use`, `output_missing`, `invalid_png`, `agent_refused`, `lock_busy`. + +On retryable errors (timeout, spawn_failed, no_image_gen_tool_use, output_missing, invalid_png, agent_refused), ask the user whether to retry or fall back to another backend. + +## Batch semantics + +- Codex `image_gen` returns **one image per call** (`n=1` only). Multi-image jobs must dispatch one wrapper call per image. +- The wrapper does NOT accept a `--sessionId` flag. Chain/scene consistency must come from `--ref` reference images. +- `--size` and `--quality` are silently ignored — Codex picks pixel dimensions from `--aspect`. diff --git a/skills/baoyu-infographic/SKILL.md b/skills/baoyu-infographic/SKILL.md index 0bad0ed..2108bc7 100644 --- a/skills/baoyu-infographic/SKILL.md +++ b/skills/baoyu-infographic/SKILL.md @@ -1,7 +1,7 @@ --- name: baoyu-infographic description: Generate professional infographics with 21 layout types and 22 visual styles. Analyzes content, recommends layout×style combinations, and generates publication-ready infographics. Use when user asks to create "infographic", "信息图", "visual summary", "可视化", or "高密度信息大图". -version: 1.117.3 +version: 1.117.4 metadata: openclaw: homepage: https://github.com/JimLiu/baoyu-skills#baoyu-infographic @@ -29,6 +29,7 @@ When this skill needs to render an image, resolve the backend in this order: 2. **Saved preference** — if `EXTEND.md` sets `preferred_image_backend` to a backend available right now, use it. 3. **Auto-select** (when the preference is `auto`, unset, or the pinned backend isn't available): - **Codex (`imagegen`)** — first, inspect your available-skills / tool inventory. If a skill named `imagegen` is listed, you are running inside Codex and MUST use it: invoke via the `Skill` tool with `skill: "imagegen"`, passing the saved prompt file's content (plus output path and aspect ratio per Codex `imagegen`'s own args). Codex `imagegen` is the official raster backend in that runtime and outranks any non-native skill (e.g., `baoyu-image-gen`) unless the user has explicitly pinned a different `preferred_image_backend`. + - **Codex via `codex exec` (`codex-imagegen`)** — if the current runtime exposes no native `imagegen` skill but the `codex` CLI is on `PATH` with an active `codex login`, route through `baoyu-image-gen --provider codex-cli` (preferred), or — if baoyu-image-gen is unavailable — invoke the bundled wrapper directly. Details, parameters, and the runtime-discovery procedure live in [references/codex-imagegen.md](references/codex-imagegen.md) — load that file only when this branch is selected. - **Other runtime-native tools** — if the runtime exposes a different native image tool (e.g., Hermes `image_generate`), use it the same way. - Otherwise, if exactly one non-native backend is installed (e.g., `baoyu-image-gen`), use it. - Otherwise (multiple non-native backends with no runtime-native tool), ask the user once — batch with any other initial questions. @@ -296,7 +297,8 @@ Combine: 2. Ensure the full final prompt is persisted at `prompts/infographic.md` (already written in Step 5) BEFORE invoking the backend — the file is the reproducibility record. 3. **Check for existing file**: Before generating, check if `infographic.png` exists - If exists: Rename to `infographic-backup-YYYYMMDD-HHMMSS.png` -4. Call the chosen backend with the prompt file and output path +4. Call the chosen backend with the prompt file and output path. + - **`codex-imagegen` invocation**: when the rule resolves to `codex-imagegen`, see [references/codex-imagegen.md](references/codex-imagegen.md) for the invocation contract (preferred `baoyu-image-gen --provider codex-cli` path, runtime wrapper discovery, parameter notes, stdout schema, batch semantics). 5. On failure, auto-retry once Text correction policy: diff --git a/skills/baoyu-infographic/references/codex-imagegen.md b/skills/baoyu-infographic/references/codex-imagegen.md new file mode 100644 index 0000000..3cc3c83 --- /dev/null +++ b/skills/baoyu-infographic/references/codex-imagegen.md @@ -0,0 +1,65 @@ +# `codex-imagegen` Wrapper Invocation + +Load this reference only when the [Image Generation Tools](../SKILL.md#image-generation-tools) rule has resolved to `codex-imagegen` — i.e., the current runtime exposes no native `imagegen` skill but `codex` CLI is on `PATH` with an active `codex login`. + +## Preferred path: route through `baoyu-image-gen` + +If the `baoyu-image-gen` skill is available in this runtime, **always** invoke through it rather than calling the wrapper directly. It handles retry/cache/batch/EXTEND.md preferences uniformly with every other provider. + +```bash +${BUN_X} /scripts/main.ts \ + --provider codex-cli \ + --image \ + --promptfiles \ + --ar \ + [--ref ]... +``` + +Resolve `` the same way you resolve any sibling skill — through your runtime's skill registry (`Skill` tool, plugin marketplace, or `$HOME/.baoyu-skills/baoyu-image-gen/`). + +## Fallback: spawn the wrapper directly + +Only when `baoyu-image-gen` is NOT installed in the current runtime. Discover the wrapper's location at runtime — do NOT hard-code `../../packages/...` from this skill: + +1. **Honor explicit override**: if `$BAOYU_CODEX_IMAGEGEN_BIN` is set and points to a real file, use that path. It may be `.ts` (spawn `bun `) or `.sh`/binary (spawn directly). +2. **Search the plugin root**: walk up from this skill's directory looking for `packages/baoyu-codex-imagegen/src/main.ts`. If found, that is the wrapper. Spawn it with `bun`. +3. **Last resort**: tell the user that `codex-imagegen` is not available in this runtime and ask whether to install the `baoyu-skills` plugin (or set `BAOYU_CODEX_IMAGEGEN_BIN`) or pick another backend. + +Once located, the invocation shape is: + +```bash +bun /main.ts \ + --image \ + --prompt-file \ + --aspect \ + [--ref ]... \ + [--timeout ] \ + [--cache-dir ~/.cache/baoyu-codex-imagegen] \ + [--log-file ] +``` + +If `bun` is missing, `npx -y bun /main.ts ...` works as a fallback. + +## Parameter notes + +- **All filesystem inputs** are auto-resolved against `process.cwd()` when relative, but agents should pass absolute paths to be robust against cwd drift. +- **`--timeout`** defaults to `300000` (5 min) per `codex exec` attempt. Raise (e.g. `--timeout 600000` for 10 min) on slow networks or large prompts. +- **`--cache-dir`** is off by default. Enable for repeatable runs to skip redundant generations of the same prompt+aspect+refs. +- **Authentication**: the wrapper uses the user's Codex subscription — no `OPENAI_API_KEY` is read or sent. + +## Stdout contract + +Single JSON line: + +- Success: `{"status":"ok","path":"...","bytes":N,"elapsed_seconds":N,"thread_id":"...","attempts":N,"cached":bool,...}` +- Failure: `{"status":"error","path":"...","bytes":0,"error":"...","error_kind":"..."}` + +`error_kind` values: `codex_not_installed`, `invalid_args`, `prompt_file_missing`, `spawn_failed`, `timeout`, `no_image_gen_tool_use`, `output_missing`, `invalid_png`, `agent_refused`, `lock_busy`. + +On retryable errors (timeout, spawn_failed, no_image_gen_tool_use, output_missing, invalid_png, agent_refused), ask the user whether to retry or fall back to another backend. + +## Batch semantics + +- Codex `image_gen` returns **one image per call** (`n=1` only). Multi-image jobs must dispatch one wrapper call per image. +- The wrapper does NOT accept a `--sessionId` flag. Chain/scene consistency must come from `--ref` reference images. +- `--size` and `--quality` are silently ignored — Codex picks pixel dimensions from `--aspect`. diff --git a/skills/baoyu-slide-deck/SKILL.md b/skills/baoyu-slide-deck/SKILL.md index a6788f6..ab34e90 100644 --- a/skills/baoyu-slide-deck/SKILL.md +++ b/skills/baoyu-slide-deck/SKILL.md @@ -1,7 +1,7 @@ --- name: baoyu-slide-deck description: Generates professional slide deck images from content. Creates outlines with style instructions, then generates individual slide images. Use when user asks to "create slides", "make a presentation", "generate deck", "slide deck", or "PPT". -version: 1.117.3 +version: 1.117.4 metadata: openclaw: homepage: https://github.com/JimLiu/baoyu-skills#baoyu-slide-deck @@ -33,6 +33,7 @@ When this skill needs to render an image, resolve the backend in this order: 2. **Saved preference** — if `EXTEND.md` sets `preferred_image_backend` to a backend available right now, use it. 3. **Auto-select** (when the preference is `auto`, unset, or the pinned backend isn't available): - **Codex (`imagegen`)** — first, inspect your available-skills / tool inventory. If a skill named `imagegen` is listed, you are running inside Codex and MUST use it: invoke via the `Skill` tool with `skill: "imagegen"`, passing the saved prompt file's content (plus output path and aspect ratio per Codex `imagegen`'s own args). Codex `imagegen` is the official raster backend in that runtime and outranks any non-native skill (e.g., `baoyu-image-gen`) unless the user has explicitly pinned a different `preferred_image_backend`. + - **Codex via `codex exec` (`codex-imagegen`)** — if the current runtime exposes no native `imagegen` skill but the `codex` CLI is on `PATH` with an active `codex login`, route through `baoyu-image-gen --provider codex-cli` (preferred), or — if baoyu-image-gen is unavailable — invoke the bundled wrapper directly. Details, parameters, and the runtime-discovery procedure live in [references/codex-imagegen.md](references/codex-imagegen.md) — load that file only when this branch is selected. - **Other runtime-native tools** — if the runtime exposes a different native image tool (e.g., Hermes `image_generate`), use it the same way. - Otherwise, if exactly one non-native backend is installed (e.g., `baoyu-image-gen`), use it. - Otherwise (multiple non-native backends with no runtime-native tool), ask the user once — batch with any other initial questions. @@ -297,6 +298,7 @@ Display the prompts index (`# | Filename | Slide Title`) and ask: proceed / edit ### Step 7: Generate Images 1. Resolve the image backend via the Image Generation Tools rule at the top — ask once if multiple are installed. + - **`codex-imagegen` invocation**: when the rule resolves to `codex-imagegen`, see [references/codex-imagegen.md](references/codex-imagegen.md) for the invocation contract (preferred `baoyu-image-gen --provider codex-cli` path, runtime wrapper discovery, parameter notes, stdout schema, batch semantics — n=1 per call so slide batches must dispatch one wrapper call per slide). 2. Confirm every `prompts/NN-slide-{slug}.md` exists (hard requirement; prompt files are the reproducibility record regardless of backend). 3. Session ID: `slides-{topic-slug}-{timestamp}` — pass to the backend only if it supports sessions. 4. Build a task list for selected slides with each slide's prompt file, output PNG path, aspect ratio, session ID, and verified direct references. diff --git a/skills/baoyu-slide-deck/references/codex-imagegen.md b/skills/baoyu-slide-deck/references/codex-imagegen.md new file mode 100644 index 0000000..9807494 --- /dev/null +++ b/skills/baoyu-slide-deck/references/codex-imagegen.md @@ -0,0 +1,65 @@ +# `codex-imagegen` Wrapper Invocation + +Load this reference only when the [Image Generation Tools](../SKILL.md#image-generation-tools) rule has resolved to `codex-imagegen` — i.e., the current runtime exposes no native `imagegen` skill but `codex` CLI is on `PATH` with an active `codex login`. + +## Preferred path: route through `baoyu-image-gen` + +If the `baoyu-image-gen` skill is available in this runtime, **always** invoke through it rather than calling the wrapper directly. It handles retry/cache/batch/EXTEND.md preferences uniformly with every other provider. + +```bash +${BUN_X} /scripts/main.ts \ + --provider codex-cli \ + --image \ + --promptfiles \ + --ar \ + [--ref ]... +``` + +Resolve `` the same way you resolve any sibling skill — through your runtime's skill registry (`Skill` tool, plugin marketplace, or `$HOME/.baoyu-skills/baoyu-image-gen/`). + +## Fallback: spawn the wrapper directly + +Only when `baoyu-image-gen` is NOT installed in the current runtime. Discover the wrapper's location at runtime — do NOT hard-code `../../packages/...` from this skill: + +1. **Honor explicit override**: if `$BAOYU_CODEX_IMAGEGEN_BIN` is set and points to a real file, use that path. It may be `.ts` (spawn `bun `) or `.sh`/binary (spawn directly). +2. **Search the plugin root**: walk up from this skill's directory looking for `packages/baoyu-codex-imagegen/src/main.ts`. If found, that is the wrapper. Spawn it with `bun`. +3. **Last resort**: tell the user that `codex-imagegen` is not available in this runtime and ask whether to install the `baoyu-skills` plugin (or set `BAOYU_CODEX_IMAGEGEN_BIN`) or pick another backend. + +Once located, the invocation shape is: + +```bash +bun /main.ts \ + --image \ + --prompt-file \ + --aspect \ + [--ref ]... \ + [--timeout ] \ + [--cache-dir ~/.cache/baoyu-codex-imagegen] \ + [--log-file ] +``` + +If `bun` is missing, `npx -y bun /main.ts ...` works as a fallback. + +## Parameter notes + +- **All filesystem inputs** are auto-resolved against `process.cwd()` when relative, but agents should pass absolute paths to be robust against cwd drift. +- **`--timeout`** defaults to `300000` (5 min) per `codex exec` attempt. Raise (e.g. `--timeout 600000` for 10 min) on slow networks or large prompts. +- **`--cache-dir`** is off by default. Enable for repeatable runs to skip redundant generations of the same prompt+aspect+refs. +- **Authentication**: the wrapper uses the user's Codex subscription — no `OPENAI_API_KEY` is read or sent. + +## Stdout contract + +Single JSON line: + +- Success: `{"status":"ok","path":"...","bytes":N,"elapsed_seconds":N,"thread_id":"...","attempts":N,"cached":bool,...}` +- Failure: `{"status":"error","path":"...","bytes":0,"error":"...","error_kind":"..."}` + +`error_kind` values: `codex_not_installed`, `invalid_args`, `prompt_file_missing`, `spawn_failed`, `timeout`, `no_image_gen_tool_use`, `output_missing`, `invalid_png`, `agent_refused`, `lock_busy`. + +On retryable errors (timeout, spawn_failed, no_image_gen_tool_use, output_missing, invalid_png, agent_refused), ask the user whether to retry or fall back to another backend. + +## Batch semantics + +- Codex `image_gen` returns **one image per call** (`n=1` only). Multi-image jobs must dispatch one wrapper call per image. +- The wrapper does NOT accept a `--sessionId` flag. Chain/scene consistency must come from `--ref` reference images. +- `--size` and `--quality` are silently ignored — Codex picks pixel dimensions from `--aspect`. diff --git a/skills/baoyu-xhs-images/SKILL.md b/skills/baoyu-xhs-images/SKILL.md index 1199388..a2924b2 100644 --- a/skills/baoyu-xhs-images/SKILL.md +++ b/skills/baoyu-xhs-images/SKILL.md @@ -1,7 +1,7 @@ --- name: baoyu-xhs-images description: Generates infographic image card series with 12 visual styles, 8 layouts, and 3 color palettes. Breaks content into 1-10 cartoon-style image cards optimized for social media engagement. Use when user mentions "小红书图片", "小红书种草", "小绿书", "微信图文", "微信贴图", "image cards", "图片卡片", baoyu-xhs-images, or wants social media infographic series. -version: 2.0.0 +version: 2.0.1 metadata: openclaw: homepage: https://github.com/JimLiu/baoyu-skills#baoyu-xhs-images @@ -29,6 +29,7 @@ When this skill needs to render an image, resolve the backend in this order: 2. **Saved preference** — if `EXTEND.md` sets `preferred_image_backend` to a backend available right now, use it. 3. **Auto-select** (when the preference is `auto`, unset, or the pinned backend isn't available): - **Codex (`imagegen`)** — first, inspect your available-skills / tool inventory. If a skill named `imagegen` is listed, you are running inside Codex and MUST use it: invoke via the `Skill` tool with `skill: "imagegen"`, passing the saved prompt file's content (plus output path and aspect ratio per Codex `imagegen`'s own args). Codex `imagegen` is the official raster backend in that runtime and outranks any non-native skill (e.g., `baoyu-image-gen`) unless the user has explicitly pinned a different `preferred_image_backend`. + - **Codex via `codex exec` (`codex-imagegen`)** — if the current runtime exposes no native `imagegen` skill but the `codex` CLI is on `PATH` with an active `codex login`, route through `baoyu-image-gen --provider codex-cli` (preferred), or — if baoyu-image-gen is unavailable — invoke the bundled wrapper directly. Details, parameters, and the runtime-discovery procedure live in [references/codex-imagegen.md](references/codex-imagegen.md) — load that file only when this branch is selected. - **Other runtime-native tools** — if the runtime exposes a different native image tool (e.g., Hermes `image_generate`), use it the same way. - Otherwise, if exactly one non-native backend is installed (e.g., `baoyu-image-gen`), use it. - Otherwise (multiple non-native backends with no runtime-native tool), ask the user once — batch with any other initial questions. @@ -387,6 +388,8 @@ See `references/config/watermark-guide.md`. **Backend selection**: per the Image Generation Tools rule at the top — use whatever is available, ask once if multiple, before any generation. Under `--yes`, use the EXTEND.md preference and fall back to the first available backend. Prompt files MUST exist before invoking any backend. +**`codex-imagegen` invocation**: when the rule resolves to `codex-imagegen`, see [references/codex-imagegen.md](references/codex-imagegen.md) for the invocation contract (preferred `baoyu-image-gen --provider codex-cli` path, runtime wrapper discovery, parameter notes, stdout schema, batch semantics — n=1 per call so card batches must dispatch one wrapper call per card; the wrapper does NOT accept `--sessionId`, so chain consistency must come from `--ref` per Step 3 above). + **Session ID** (if the backend supports `--sessionId`): use `cards-{topic-slug}-{timestamp}` for every image; combined with the ref chain this gives maximum consistency. ### Step 4: Completion Report diff --git a/skills/baoyu-xhs-images/references/codex-imagegen.md b/skills/baoyu-xhs-images/references/codex-imagegen.md new file mode 100644 index 0000000..fcd5264 --- /dev/null +++ b/skills/baoyu-xhs-images/references/codex-imagegen.md @@ -0,0 +1,65 @@ +# `codex-imagegen` Wrapper Invocation + +Load this reference only when the [Image Generation Tools](../SKILL.md#image-generation-tools) rule has resolved to `codex-imagegen` — i.e., the current runtime exposes no native `imagegen` skill but `codex` CLI is on `PATH` with an active `codex login`. + +## Preferred path: route through `baoyu-image-gen` + +If the `baoyu-image-gen` skill is available in this runtime, **always** invoke through it rather than calling the wrapper directly. It handles retry/cache/batch/EXTEND.md preferences uniformly with every other provider. + +```bash +${BUN_X} /scripts/main.ts \ + --provider codex-cli \ + --image \ + --promptfiles \ + --ar \ + [--ref ]... +``` + +Resolve `` the same way you resolve any sibling skill — through your runtime's skill registry (`Skill` tool, plugin marketplace, or `$HOME/.baoyu-skills/baoyu-image-gen/`). + +## Fallback: spawn the wrapper directly + +Only when `baoyu-image-gen` is NOT installed in the current runtime. Discover the wrapper's location at runtime — do NOT hard-code `../../packages/...` from this skill: + +1. **Honor explicit override**: if `$BAOYU_CODEX_IMAGEGEN_BIN` is set and points to a real file, use that path. It may be `.ts` (spawn `bun `) or `.sh`/binary (spawn directly). +2. **Search the plugin root**: walk up from this skill's directory looking for `packages/baoyu-codex-imagegen/src/main.ts`. If found, that is the wrapper. Spawn it with `bun`. +3. **Last resort**: tell the user that `codex-imagegen` is not available in this runtime and ask whether to install the `baoyu-skills` plugin (or set `BAOYU_CODEX_IMAGEGEN_BIN`) or pick another backend. + +Once located, the invocation shape is: + +```bash +bun /main.ts \ + --image \ + --prompt-file \ + --aspect \ + [--ref ]... \ + [--timeout ] \ + [--cache-dir ~/.cache/baoyu-codex-imagegen] \ + [--log-file ] +``` + +If `bun` is missing, `npx -y bun /main.ts ...` works as a fallback. + +## Parameter notes + +- **All filesystem inputs** are auto-resolved against `process.cwd()` when relative, but agents should pass absolute paths to be robust against cwd drift. +- **`--timeout`** defaults to `300000` (5 min) per `codex exec` attempt. Raise (e.g. `--timeout 600000` for 10 min) on slow networks or large prompts. +- **`--cache-dir`** is off by default. Enable for repeatable runs to skip redundant generations of the same prompt+aspect+refs. +- **Authentication**: the wrapper uses the user's Codex subscription — no `OPENAI_API_KEY` is read or sent. + +## Stdout contract + +Single JSON line: + +- Success: `{"status":"ok","path":"...","bytes":N,"elapsed_seconds":N,"thread_id":"...","attempts":N,"cached":bool,...}` +- Failure: `{"status":"error","path":"...","bytes":0,"error":"...","error_kind":"..."}` + +`error_kind` values: `codex_not_installed`, `invalid_args`, `prompt_file_missing`, `spawn_failed`, `timeout`, `no_image_gen_tool_use`, `output_missing`, `invalid_png`, `agent_refused`, `lock_busy`. + +On retryable errors (timeout, spawn_failed, no_image_gen_tool_use, output_missing, invalid_png, agent_refused), ask the user whether to retry or fall back to another backend. + +## Batch semantics + +- Codex `image_gen` returns **one image per call** (`n=1` only). Multi-image jobs must dispatch one wrapper call per image. +- The wrapper does NOT accept a `--sessionId` flag. Chain/scene consistency must come from `--ref` reference images. +- `--size` and `--quality` are silently ignored — Codex picks pixel dimensions from `--aspect`.