pi-agnes-tools 0.1.0 → 0.3.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/README.md CHANGED
@@ -1,62 +1,88 @@
1
1
  # pi-agnes-tools
2
2
 
3
- Pi extension that exposes **Agnes AI** image/video generation as callable tools — no model switch required. Pairs with [`pi-agnes`](https://pi.dev/packages/pi-agnes) for model registration / auth.
3
+ The single Agnes AI plugin for pi: text model catalog (selectable via `/model`)
4
+ plus image/video generation as custom tools + skill. No model switch needed
5
+ for media.
4
6
 
5
7
  ## Install
6
8
 
7
9
  ```bash
8
- pi install path:/path/to/pi-agnes-tools
10
+ pi install npm:pi-agnes-tools
9
11
  ```
10
12
 
13
+ Or from git:
14
+
15
+ ```bash
16
+ pi install git:github.com/DraconDev/pi-agnes-tools
17
+ ```
18
+
19
+ > Replaces `pi-agnes` — uninstall it if you have it (this plugin owns the
20
+ > `agnes` / `agnes-cn` providers outright; keeping both installed causes the
21
+ > two registrations to overwrite each other).
22
+
11
23
  ## What it registers
12
24
 
13
- | Tool | Endpoint | What it does |
14
- |---|---|---|
15
- | `agnes_image` | `POST /v1/images/generations` | Generate an image. Saves to `.pi/generated-images/`. Returns the local path and (possibly expiring) remote URL. |
16
- | `agnes_video` | `POST /v1/videos` + poll | Generate a video. Polls every 5s (up to 30 min). Saves `.mp4` to `.pi/generated-videos/`. Supports image-to-video (1 ref image) and keyframes (>1 image). |
25
+ ### Models (`/model` selector)
17
26
 
18
- ## Parameters
27
+ Only **text/LLM** models are registered — image and video live in the skill
28
+ + tools, not in the chat model list. Both regions:
19
29
 
20
- ### `agnes_image`
21
- - `prompt` (required): text prompt
22
- - `model` (default `agnes-image-2.1-flash`): any `agnes-image-*` id
23
- - `endpoint` (`agnes` | `agnes-cn`, default `agnes`): which Agnes region
24
- - `images` (optional): array of base64 data URIs for reference/conditioning
25
- - `response_format` (default `png`)
30
+ | Provider | Region | Base URL | Auth |
31
+ |---|---|---|---|
32
+ | `agnes` | International | `https://apihub.agnes-ai.com/v1` | `AGNES_API_KEY` |
33
+ | `agnes-cn` | China | `https://api.agnes-ai.cn/v1` | `AGNES_CN_API_KEY` |
26
34
 
27
- ### `agnes_video`
28
- - `prompt` (required): text prompt
29
- - `model` (default `agnes-video-2.5-flash`): any `agnes-video-*` id
30
- - `endpoint` (default `agnes`)
31
- - `images` (optional): 1 image → image-to-video, >1 → keyframes mode
32
- - `num_frames` (default 121), `frame_rate` (default 24)
35
+ Text models: `agnes-2.0-flash`, `agnes-2.5-flash`, `agnes-2.5-pro`,
36
+ `agnes-2.5-pro-alpha`, `agnes-3.0-flash`. Live `/v1/models` discovery adds
37
+ newer text models automatically (image/video are filtered out).
33
38
 
34
- ## Auth
39
+ ```bash
40
+ pi --model agnes/agnes-2.5-flash "hello"
41
+ pi --model agnes-cn/agnes-2.5-flash "你好"
42
+ ```
35
43
 
36
- Key resolution order:
44
+ ### Image / video — via tools + skill (not in `/model`)
37
45
 
38
- 1. `AGNES_API_KEY` / `AGNES_CN_API_KEY` env vars (same as `pi-agnes`)
39
- 2. `/login`-stored key from `~/.pi/agent/auth.json` (`agnes` provider)
46
+ Two ways to generate media:
40
47
 
41
- | Provider | Endpoint | Env var |
42
- |---|---|---|
43
- | `agnes` | `https://apihub.agnes-ai.com/v1` | `AGNES_API_KEY` |
44
- | `agnes-cn` | `https://api.agnes-ai.cn/v1` | `AGNES_CN_API_KEY` |
48
+ 1. **Tool calls** — `agnes_image`, `agnes_video` are exposed to any chat model.
49
+ 2. **Skill** — `agnes-media` (auto-loaded with this package) tells the agent
50
+ exactly how to call the tools: prompt shaping, reference-image handling,
51
+ endpoint selection, defaults.
45
52
 
46
- ## Example (what the LLM sees / can call)
53
+ The LLM does not need to switch models. Default image model:
54
+ `agnes-image-2.5-flash`. Default video model: `agnes-video-2.5-flash`.
47
55
 
48
- ```jsonc
49
- // Text-to-image
50
- {"name": "agnes_image", "arguments": {"prompt": "a watercolor painting of a fox in a misty pine forest"}}
56
+ #### `agnes_image`
51
57
 
52
- // Image-to-video
53
- {"name": "agnes_video", "arguments": {"prompt": "the fox slowly turns its head", "images": ["data:image/png;base64,..."]}}
58
+ | Param | Notes |
59
+ |---|---|
60
+ | `prompt` | required |
61
+ | `model` | default `agnes-image-2.5-flash`; others: `agnes-image-2.1-flash`, `agnes-image-2.0-flash` |
62
+ | `endpoint` | `agnes` (default) or `agnes-cn` |
63
+ | `images` | optional base64 data URIs for reference/conditioning |
64
+ | `response_format` | default `png` |
54
65
 
55
- // Multi-frame keyframes
56
- {"name": "agnes_video", "arguments": {"prompt": "fly through a canyon", "images": ["data:...frame1", "data:...frame2"], "model": "agnes-video-2.5"}}
57
- ```
66
+ #### `agnes_video`
67
+
68
+ | Param | Notes |
69
+ |---|---|
70
+ | `prompt` | required |
71
+ | `model` | default `agnes-video-2.5-flash`; others: `agnes-video-2.5`, `agnes-video-v2.0` |
72
+ | `endpoint` | `agnes` (default) or `agnes-cn` |
73
+ | `images` | 1 image = image-to-video; >1 = keyframes mode |
74
+ | `num_frames` / `frame_rate` | defaults 121 / 24 |
75
+
76
+ Output paths are project-relative (`.pi/generated-images/`, `.pi/generated-videos/`).
77
+
78
+ ## Auth
79
+
80
+ Key resolution order: env var → `/login`-stored key in `~/.pi/agent/auth.json`.
81
+
82
+ `agnes-cn` only appears in the model list once a CN key is configured
83
+ (`AGNES_CN_API_KEY` env or a key stored under `agnes-cn` in auth.json).
58
84
 
59
85
  ## Notes
60
86
 
61
- - Output paths are project-relative (`.pi/generated-images/`, `.pi/generated-videos/`) — matches where `pi-agnes` model-based generation saves.
62
- - `executionMode: parallel` for image (fast, stateless), `sequential` for video (long-running task, poll loop).
87
+ - `executionMode: parallel` for image (fast, stateless), `sequential` for video (long-running poll loop, up to 30 min).
88
+ - Debug: `PI_AGNES_TOOLS_DEBUG=1` logs registration decisions to stderr.