@ai-agent-tools/picgen 0.1.0-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/.env.example +8 -0
- package/README.md +105 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1602 -0
- package/docs/proposal.md +105 -0
- package/docs/release-alpha.md +159 -0
- package/docs/specs/agent-invocation-contract.md +245 -0
- package/docs/specs/agent-invocation-contract.zh-CN.md +334 -0
- package/examples/picgen.yaml +78 -0
- package/package.json +53 -0
- package/skills/picgen/SKILL.md +107 -0
package/.env.example
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# PicGen
|
|
2
|
+
|
|
3
|
+
PicGen is a lightweight image generation connector for AI agents. It lets Codex and similar agents turn the current conversation context into images through user-owned providers and API keys.
|
|
4
|
+
|
|
5
|
+
Alpha goals:
|
|
6
|
+
|
|
7
|
+
- TypeScript Node.js CLI
|
|
8
|
+
- OpenAI-compatible `/v1/images/generations` adapter
|
|
9
|
+
- Gemini image API adapter
|
|
10
|
+
- Gemini reference-image generation
|
|
11
|
+
- `provider + preset + routing` configuration
|
|
12
|
+
- `picgen setup`, `picgen doctor`, `picgen create --dry-run`
|
|
13
|
+
- Local Codex skill instructions
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
Project conventions are documented in [AGENTS.md](./AGENTS.md).
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install
|
|
21
|
+
npm run dev -- --help
|
|
22
|
+
npm run typecheck
|
|
23
|
+
npm run build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install -g @ai-agent-tools/picgen
|
|
30
|
+
picgen --help
|
|
31
|
+
picgen quickstart
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Agent trial prompt:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
请安装并体验 @ai-agent-tools/picgen:全局安装 npm install -g @ai-agent-tools/picgen,运行 picgen setup 配置,然后先 dry-run 预览,再确认生成一张测试图。如果我要用参考图,请使用 --reference <图片路径>。
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For first-user rollout, see [docs/release-alpha.md](./docs/release-alpha.md).
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
picgen setup
|
|
46
|
+
picgen quickstart
|
|
47
|
+
picgen doctor --json
|
|
48
|
+
picgen create --dry-run "一张产品发布会主视觉"
|
|
49
|
+
picgen create --yes "一张产品发布会主视觉"
|
|
50
|
+
picgen create --dry-run --provider gemini_official --reference ./reference.png "基于参考图生成一张品牌海报"
|
|
51
|
+
picgen create --yes --provider gemini_official --reference ./reference.png "基于参考图生成一张品牌海报"
|
|
52
|
+
picgen provider list
|
|
53
|
+
picgen provider add
|
|
54
|
+
picgen provider test openai_official --json
|
|
55
|
+
picgen provider prefer gemini_official
|
|
56
|
+
picgen provider disable gemini_proxy
|
|
57
|
+
picgen provider remove gemini_proxy
|
|
58
|
+
picgen mode prefer premium
|
|
59
|
+
picgen preset prefer poster
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`picgen setup` is repeatable. Use it to quick-add a common provider/channel, choose the default provider, choose the default generation preference, test providers, or add a custom provider/channel.
|
|
63
|
+
|
|
64
|
+
Quick-add setup asks only for the essentials: provider name, host URL, API key environment variable, and model list with recommended defaults. Advanced custom setup is still available when you need to choose protocol and channel manually.
|
|
65
|
+
|
|
66
|
+
Real `picgen create` calls ask for confirmation before contacting a provider. Use `--yes` only when you want to skip that CLI confirmation.
|
|
67
|
+
|
|
68
|
+
`--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
|
+
|
|
70
|
+
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.
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
By default PicGen reads and writes:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
~/.picgen/config.yaml
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
You can override it for development:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
PICGEN_CONFIG=/path/to/picgen.yaml npm run dev -- doctor
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
PicGen also loads `.env` from the current working directory:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
OPENAI_API_KEY=...
|
|
90
|
+
GEMINI_API_KEY=...
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
You can start from the included example:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
cp .env.example .env
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Provider `base_url` values should be host-only. Do not include `/v1` or `/v1beta`; PicGen adds protocol paths automatically.
|
|
100
|
+
|
|
101
|
+
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
|
+
|
|
103
|
+
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
|
+
|
|
105
|
+
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.
|
package/dist/cli.d.ts
ADDED