@ai-agent-tools/picgen 0.1.0-alpha.0 → 0.1.0-alpha.10

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 CHANGED
@@ -10,6 +10,7 @@ Alpha goals:
10
10
  - Gemini reference-image generation
11
11
  - `provider + preset + routing` configuration
12
12
  - `picgen setup`, `picgen doctor`, `picgen create --dry-run`
13
+ - Local web interface with settings, generation, and history
13
14
  - Local Codex skill instructions
14
15
 
15
16
  ## Development
@@ -26,31 +27,46 @@ npm run build
26
27
  ## Install
27
28
 
28
29
  ```bash
30
+ node -v
31
+ npm -v
29
32
  npm install -g @ai-agent-tools/picgen
33
+ npx -y skills add ai-agent-tools/picgen --skill picgen -g -y --copy
34
+ picgen skill install codex
30
35
  picgen --help
31
36
  picgen quickstart
37
+ picgen open
32
38
  ```
33
39
 
40
+ Use `npx -y skills add ...` for cross-agent skill installation when supported. `picgen skill install codex` is a Codex-only fallback that copies the bundled skill into `~/.codex/skills/picgen`.
41
+
34
42
  Agent trial prompt:
35
43
 
36
44
  ```text
37
- 请安装并体验 @ai-agent-tools/picgen:全局安装 npm install -g @ai-agent-tools/picgen,运行 picgen setup 配置,然后先 dry-run 预览,再确认生成一张测试图。如果我要用参考图,请使用 --reference <图片路径>。
45
+ 请帮我安装并配置 PicGen 生图工具。请先阅读并按这个指南执行:https://raw.githubusercontent.com/ai-agent-tools/picgen/refs/heads/main/docs/agent-install.md 。你负责判断是否在本机持久环境、安装 CLI skill、引导我配置 provider/API key,并先预览生成方案,等我确认后再生成测试图。不要让我理解命令细节,也不要让我把 API key 发到聊天里。
38
46
  ```
39
47
 
40
- For first-user rollout, see [docs/release-alpha.md](./docs/release-alpha.md).
48
+ For agent-assisted installation, see [docs/agent-install.md](./docs/agent-install.md). For first-user rollout, see [docs/release-alpha.md](./docs/release-alpha.md).
41
49
 
42
50
  ## Commands
43
51
 
44
52
  ```bash
45
53
  picgen setup
46
54
  picgen quickstart
55
+ picgen open
56
+ npx -y skills add ai-agent-tools/picgen --skill picgen -g -y --copy
57
+ picgen skill install codex
58
+ picgen update check
47
59
  picgen doctor --json
48
- picgen create --dry-run "一张产品发布会主视觉"
49
- picgen create --yes "一张产品发布会主视觉"
60
+ picgen create --dry-run --preset fast-draft "一张简洁的 PicGen 测试图"
61
+ picgen create --yes --preset fast-draft "一张简洁的 PicGen 测试图"
50
62
  picgen create --dry-run --provider gemini_official --reference ./reference.png "基于参考图生成一张品牌海报"
51
63
  picgen create --yes --provider gemini_official --reference ./reference.png "基于参考图生成一张品牌海报"
52
64
  picgen provider list
53
65
  picgen provider add
66
+ picgen provider quick-add gemini-proxy --host https://www.pandai.vip --prefer
67
+ picgen key set PICGEN_GEMINI_PROXY_KEY --clipboard
68
+ picgen key set PICGEN_GEMINI_PROXY_KEY --stdin
69
+ picgen key list --json
54
70
  picgen provider test openai_official --json
55
71
  picgen provider prefer gemini_official
56
72
  picgen provider disable gemini_proxy
@@ -65,6 +81,8 @@ Quick-add setup asks only for the essentials: provider name, host URL, API key e
65
81
 
66
82
  Real `picgen create` calls ask for confirmation before contacting a provider. Use `--yes` only when you want to skip that CLI confirmation.
67
83
 
84
+ `picgen open` starts a local web interface at `127.0.0.1`, defaulting to port `8188`. It is a foreground local server: keep the terminal open while using the page, and press Ctrl+C to close it. The page can configure multiple providers, save API keys to PicGen's managed env file, preview generation plans, generate images, and browse saved history under `outputs/picgen`.
85
+
68
86
  `--reference <path>` can be repeated to pass local reference images. Alpha supports reference images through the Gemini adapter. The OpenAI-compatible `/v1/images/generations` adapter does not support reference images yet; use a Gemini provider for reference-image generation.
69
87
 
70
88
  Gemini generation requests ask for image-only responses with `responseModalities: ["IMAGE"]`. Provider health checks still use a text-only request so they can verify host, key, model, and endpoint readiness without triggering image generation.
@@ -90,6 +108,20 @@ OPENAI_API_KEY=...
90
108
  GEMINI_API_KEY=...
91
109
  ```
92
110
 
111
+ For non-technical users, `picgen setup` can save API keys for you in:
112
+
113
+ ```text
114
+ ~/.picgen/.env
115
+ ```
116
+
117
+ PicGen loads this managed env file automatically. Shell environment variables take priority, and a project `.env` can override the managed file for local testing.
118
+
119
+ Each provider should have its own `api_key_env` value. When adding another provider of the same type, PicGen assigns a new key name by default, such as `PICGEN_GEMINI_PROXY_2_KEY`, so multiple channels do not overwrite each other's API keys.
120
+
121
+ Older configs that reused the same `api_key_env` across multiple providers are migrated automatically when PicGen loads the config. PicGen keeps the first provider unchanged, assigns unique key names to the later providers, and copies the existing key value into the managed env file when the value is available.
122
+
123
+ When agents inspect key configuration, they should use `picgen key list/show` so chat output only contains masked key status. To inspect or edit the full saved key directly, open `~/.picgen/.env`; a project `.env` in the current directory may override it, and shell environment variables take highest priority.
124
+
93
125
  You can start from the included example:
94
126
 
95
127
  ```bash
@@ -100,6 +132,26 @@ Provider `base_url` values should be host-only. Do not include `/v1` or `/v1beta
100
132
 
101
133
  Providers may optionally set `test_model` in `~/.picgen/config.yaml` when health checks should use a lightweight model instead of the first generation model.
102
134
 
135
+ Generation requests use adaptive provider timeouts: fast draft requests allow 120s, balanced requests allow 180s, and high quality or large requests allow 300s. If a third-party channel is slower, override it with `PICGEN_PROVIDER_TIMEOUT_MS`:
136
+
137
+ ```bash
138
+ PICGEN_PROVIDER_TIMEOUT_MS=450000 picgen create --yes --preset poster "一张产品发布会主视觉"
139
+ ```
140
+
103
141
  Providers expose capabilities such as `text-to-image` and `reference-image`. Old configs that omit capabilities are upgraded in memory from the provider protocol: Gemini supports both text and reference-image generation, while OpenAI-compatible `/v1/images/generations` supports text-to-image only.
104
142
 
105
143
  Generated image data and provider-only fields such as base64 image payloads and Gemini thought signatures are redacted from metadata. PicGen keeps the generated assets as local image files and keeps stdout compact for agent workflows.
144
+
145
+ ## Updates
146
+
147
+ Check npm for the latest PicGen version:
148
+
149
+ ```bash
150
+ picgen update check
151
+ ```
152
+
153
+ `picgen doctor` and `picgen quickstart` may show a lightweight update hint. PicGen caches update checks for 24 hours. Disable update checks with:
154
+
155
+ ```bash
156
+ PICGEN_DISABLE_UPDATE_CHECK=1 picgen doctor
157
+ ```