@unityclaw/skills 1.1.1 → 1.1.3

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.
@@ -1,274 +0,0 @@
1
- ---
2
- name: unityclaw-image-compress
3
- description: Compress images with quality control to reduce file size
4
- version: 1.1.1
5
- metadata:
6
- openclaw:
7
- requires:
8
- env:
9
- - UNITYCLAW_API_KEY
10
- bins:
11
- - node
12
- - npm
13
- primaryEnv: UNITYCLAW_API_KEY
14
- emoji: "🗜️"
15
- homepage: https://unityclaw.com
16
- install:
17
- - kind: node
18
- package: "@unityclaw/sdk"
19
- bins: []
20
- ---
21
-
22
- # UnityClaw Image Compress
23
-
24
- Compress images to reduce file size while maintaining visual quality.
25
-
26
- ## Installation
27
-
28
- ```bash
29
- npm install @unityclaw/sdk
30
- ```
31
-
32
- ## Configuration
33
-
34
- Set your API key using one of these methods:
35
-
36
- ```bash
37
- # Method 1: Use SDK CLI (recommended - persists across sessions)
38
- npx @unityclaw/sdk config set apiKey your-api-key
39
-
40
- # Method 2: Environment variable
41
- export UNITYCLAW_API_KEY=your-api-key
42
- ```
43
-
44
- ## Response Structure
45
-
46
- > **IMPORTANT:** The result has a nested structure. Use `result.success` to check overall success, and access data via `result.response.data`.
47
-
48
- ```typescript
49
- interface UnityClawResult {
50
- success: boolean; // ✅ Use this to check if SDK call succeeded
51
- taskId: string; // Task identifier
52
- taskFolder: string; // Path to task folder with logs
53
- duration: number; // Request duration in ms
54
- response: { // API response object
55
- code: number; // 0 = success
56
- data: Array<{ // ✅ Result data here
57
- name: string;
58
- contentType: string;
59
- content: string; // URL to compressed image
60
- }> | null;
61
- };
62
- logs: Array<{ timestamp; level; message }>;
63
- attachments: any[];
64
- }
65
- ```
66
-
67
- ## Quick Start
68
-
69
- ```typescript
70
- import { UnityClawClient } from '@unityclaw/sdk';
71
-
72
- const client = new UnityClawClient();
73
-
74
- const result = await client.image.compress({
75
- attachment: [
76
- { tmp_url: 'https://example.com/large-image.jpg', name: 'image.jpg' }
77
- ],
78
- quality: 80
79
- });
80
-
81
- // ✅ Correct: Check result.success, access data via result.response.data
82
- if (result.success && result.response?.data) {
83
- console.log('Compressed images:', result.response.data);
84
- }
85
- ```
86
-
87
- ## API Reference
88
-
89
- ### compress()
90
-
91
- Compress one or more images with customizable quality.
92
-
93
- ```typescript
94
- await client.image.compress({
95
- attachment: AttachmentFieldItem[],
96
- quality?: number
97
- }): Promise<APIResponse<AttachmentResult[]>>
98
- ```
99
-
100
- ## Parameters
101
-
102
- | Parameter | Type | Required | Description |
103
- |-----------|------|----------|-------------|
104
- | `attachment` | `AttachmentFieldItem[]` | Yes | Array of images to compress |
105
- | `quality` | `number` | No | Compression quality (0-100, default: 80) |
106
-
107
- ### AttachmentFieldItem
108
-
109
- ```typescript
110
- interface AttachmentFieldItem {
111
- tmp_url: string; // URL of the image to compress
112
- name?: string; // File name
113
- type?: string; // MIME type (e.g., 'image/jpeg')
114
- }
115
- ```
116
-
117
- ## Examples
118
-
119
- ### Single Image Compression
120
-
121
- ```typescript
122
- const client = new UnityClawClient();
123
-
124
- const result = await client.image.compress({
125
- attachment: [
126
- { tmp_url: 'https://example.com/photo.jpg', name: 'photo.jpg', type: 'image/jpeg' }
127
- ],
128
- quality: 75
129
- });
130
-
131
- if (result.success && result.response?.data) {
132
- const compressedImage = result.response.data[0];
133
- console.log('Compressed URL:', compressedImage.content);
134
- }
135
- ```
136
-
137
- ### Batch Compression
138
-
139
- ```typescript
140
- const images = [
141
- { tmp_url: 'https://example.com/img1.jpg', name: 'img1.jpg' },
142
- { tmp_url: 'https://example.com/img2.png', name: 'img2.png' },
143
- { tmp_url: 'https://example.com/img3.webp', name: 'img3.webp' }
144
- ];
145
-
146
- const result = await client.image.compress({
147
- attachment: images,
148
- quality: 80
149
- });
150
-
151
- if (result.success && result.response?.data) {
152
- result.response.data.forEach((img, i) => {
153
- console.log(`Image ${i + 1}: ${img.content}`);
154
- });
155
- }
156
- ```
157
-
158
- ### High Quality Compression
159
-
160
- ```typescript
161
- // Preserve more detail (larger file size)
162
- const result = await client.image.compress({
163
- attachment: [{ tmp_url: 'https://...', name: 'photo.jpg' }],
164
- quality: 90
165
- });
166
- ```
167
-
168
- ### Aggressive Compression
169
-
170
- ```typescript
171
- // Smaller file size (more quality loss)
172
- const result = await client.image.compress({
173
- attachment: [{ tmp_url: 'https://...', name: 'photo.jpg' }],
174
- quality: 50
175
- });
176
- ```
177
-
178
- ### With Generated Images
179
-
180
- ```typescript
181
- // Generate then compress
182
- const generated = await client.image.gemini({
183
- prompt: 'A beautiful landscape'
184
- });
185
-
186
- if (generated.success && generated.response?.data) {
187
- const compressed = await client.image.compress({
188
- attachment: generated.response.data.map(img => ({
189
- tmp_url: img.content,
190
- name: img.name
191
- })),
192
- quality: 75
193
- });
194
-
195
- console.log('Compressed generated images:', compressed.response?.data);
196
- }
197
- ```
198
-
199
- ## Response Format
200
-
201
- ```typescript
202
- interface AttachmentResult {
203
- name: string;
204
- contentType: 'attachment/url';
205
- content: string; // URL to compressed image
206
- }
207
- ```
208
-
209
- ## Error Handling
210
-
211
- ```typescript
212
- const result = await client.image.compress({
213
- attachment: [{ tmp_url: 'invalid-url', name: 'test.jpg' }],
214
- quality: 80
215
- });
216
-
217
- if (!result.success) {
218
- console.error('Request failed');
219
- console.log('Check logs:', result.logs);
220
- return;
221
- }
222
-
223
- if (result.response?.code !== 0) {
224
- console.error('API error:', result.response);
225
- return;
226
- }
227
-
228
- // Success
229
- console.log('Success:', result.response.data);
230
- ```
231
-
232
- ## Quality Guidelines
233
-
234
- | Quality | Use Case | File Size Reduction |
235
- |---------|----------|---------------------|
236
- | 90-100 | Print, professional photography | Minimal |
237
- | 75-89 | Web display, social media | Moderate |
238
- | 50-74 | Thumbnails, previews | Significant |
239
- | 0-49 | Aggressive optimization | Maximum |
240
-
241
- ## Supported Formats
242
-
243
- - JPEG/JPG
244
- - PNG
245
- - WebP
246
- - GIF (static)
247
-
248
- ## Task Folders
249
-
250
- Each execution creates a task folder with logs and downloaded attachments:
251
-
252
- ```typescript
253
- const result = await client.image.compress({
254
- attachment: [{ tmp_url: 'https://...', name: 'image.jpg' }],
255
- quality: 80
256
- });
257
-
258
- console.log('Task ID:', result.taskId);
259
- console.log('Task Folder:', result.taskFolder);
260
- console.log('Local Attachments:', result.attachments);
261
- ```
262
-
263
- ## Related Skills
264
-
265
- - [unityclaw-image-generation](../unityclaw-image-generation/SKILL.md) - Generate images before compression
266
-
267
- <!-- SDK_VERSION_RULE_START -->
268
- ## SDK Version Check Rule
269
-
270
- - Before invoking this skill, check local `@unityclaw/sdk` version.
271
- - Required minimum SDK version: `1.1.1`
272
- - If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
273
- - Suggested command: `npm i @unityclaw/sdk@latest`
274
- <!-- SDK_VERSION_RULE_END -->
@@ -1,313 +0,0 @@
1
- ---
2
- name: unityclaw-image-generation
3
- description: Generate high-quality images using Gemini or JiMeng (Doubao) models
4
- version: 1.1.1
5
- metadata:
6
- openclaw:
7
- requires:
8
- env:
9
- - UNITYCLAW_API_KEY
10
- bins:
11
- - node
12
- - npm
13
- primaryEnv: UNITYCLAW_API_KEY
14
- emoji: "🎨"
15
- homepage: https://unityclaw.com
16
- install:
17
- - kind: node
18
- package: "@unityclaw/sdk"
19
- bins: []
20
- ---
21
-
22
- # UnityClaw Image Generation
23
-
24
- Generate high-quality images using Gemini or JiMeng (Doubao) AI models.
25
- This skill keeps JiMeng as one unified entry (no separate v3 skill).
26
-
27
- ## Installation
28
-
29
- ```bash
30
- npm install @unityclaw/sdk
31
- ```
32
-
33
- ## Configuration
34
-
35
- Set your API key using one of these methods:
36
-
37
- ```bash
38
- # Method 1: Use SDK CLI (recommended - persists across sessions)
39
- npx @unityclaw/sdk config set apiKey your-api-key
40
-
41
- # Method 2: Environment variable
42
- export UNITYCLAW_API_KEY=your-api-key
43
- ```
44
-
45
- ## Response Structure
46
-
47
- > **IMPORTANT:** The result has a nested structure. Use `result.success` to check overall success, and access image data via `result.response.data`.
48
-
49
- ```typescript
50
- interface ImageGenerationResult {
51
- success: boolean; // ✅ Use this to check if SDK call succeeded
52
- taskId: string; // Task identifier (e.g., "b7b613d1")
53
- taskFolder: string; // Path to task folder with logs
54
- duration: number; // Request duration in ms
55
- response: { // API response object
56
- code: number; // 0 = success
57
- data: Array<{ // ✅ Generated images here
58
- name: string; // File name
59
- contentType: string; // "attachment/url"
60
- content: string; // Image URL
61
- }> | null;
62
- };
63
- logs: Array<{ // Execution logs
64
- timestamp: string;
65
- level: string;
66
- message: string;
67
- }>;
68
- attachments: any[]; // Downloaded attachments
69
- }
70
- ```
71
-
72
- ## Quick Start
73
-
74
- ```typescript
75
- import { UnityClawClient } from '@unityclaw/sdk';
76
-
77
- const client = new UnityClawClient();
78
-
79
- // Generate image with Gemini
80
- const result = await client.image.gemini({
81
- prompt: 'A beautiful sunset over mountains',
82
- aspect_ratio: { value: '16:9', label: '16:9' }
83
- });
84
-
85
- // ✅ Correct: Check result.success, access data via result.response.data
86
- if (result.success && result.response?.data) {
87
- console.log('Generated images:', result.response.data);
88
- } else {
89
- console.error('Error:', result.response);
90
- }
91
- ```
92
-
93
- You can pass local files directly and SDK will auto-upload them:
94
-
95
- ```typescript
96
- attachment: [{ path: './files/reference.jpg' }]
97
- ```
98
-
99
- ## Available APIs
100
-
101
- ### Gemini Image Generation
102
-
103
- ```typescript
104
- // Basic usage
105
- const result = await client.image.gemini({
106
- prompt: 'A beautiful sunset over mountains'
107
- });
108
-
109
- // With all options
110
- const result = await client.image.gemini({
111
- prompt: 'A futuristic city at night',
112
- attachment: [{ tmp_url: 'https://...', name: 'reference.jpg' }],
113
- model: { value: 'gemini-2.0-flash-exp', label: 'Gemini 2.0 Flash' },
114
- aspect_ratio: { value: '16:9', label: '16:9' },
115
- size: { value: '2K', label: '2K' }
116
- });
117
-
118
- // Gemini V2
119
- const result = await client.image.geminiV2({
120
- prompt: 'An abstract digital art piece',
121
- aspect_ratio: { value: '1:1', label: '1:1' }
122
- });
123
- ```
124
-
125
- ### JiMeng Image Generation
126
-
127
- > **IMPORTANT:** JiMeng uses different parameters than Gemini. Pay attention to the `size` and `model_selector` values.
128
-
129
- ```typescript
130
- // Basic usage (defaults to Seedream 5.0 Lite model)
131
- const result = await client.image.jimeng({
132
- prompt: '一只可爱的猫咪在花园里玩耍',
133
- size: { value: '2048x2048', label: '2K 1:1' }
134
- });
135
-
136
- // With Seedream 5.0 Lite (supports web_search, 2K and 3K resolutions)
137
- const result = await client.image.jimeng({
138
- prompt: 'A serene Japanese garden in autumn',
139
- attachment: [{ tmp_url: 'https://...', name: 'style.jpg' }],
140
- size: { value: '2048x2048', label: '2K 1:1' },
141
- model_selector: { value: 'doubao-seedream-5-0-260128', label: 'Seedream 5.0 Lite' },
142
- web_search: { value: 'true', label: 'Enable' },
143
- image_count: { value: 4, label: '4 images' }
144
- });
145
-
146
- // With Seedream 4.5 (supports 4K resolution, no web_search)
147
- const result = await client.image.jimeng({
148
- prompt: 'A mystical forest with glowing mushrooms',
149
- size: { value: '4096x4096', label: '4K 1:1' },
150
- model_selector: { value: 'doubao-seedream-4-5-251128', label: 'Seedream 4.5' }
151
- });
152
-
153
- ```
154
-
155
- #### JiMeng Size Options
156
-
157
- | Resolution | 5.0 Lite | 4.5 | Size Values |
158
- |------------|----------|-----|-------------|
159
- | 2K | ✅ | ✅ | `2048x2048`, `1728x2304`, `2304x1728`, `2848x1600`, `1600x2848`, `2496x1664`, `1664x2496`, `3136x1344` |
160
- | 3K | ✅ | ❌ | `3072x3072`, `2592x3456`, `3456x2592`, `4096x2304`, `2304x4096`, `3744x2496`, `2496x3744`, `4704x2016` |
161
- | 4K | ❌ | ✅ | `4096x4096`, `3520x4704`, `4704x3520`, `5504x3040`, `3040x5504`, `4992x3328`, `3328x4992`, `6240x2656` |
162
-
163
- > **Note:** `web_search` only works with Seedream 5.0 Lite model.
164
-
165
- ## Troubleshooting (`/api/jimeng/image`)
166
-
167
- If you see backend errors like `{"code":1254500}`, check these first:
168
-
169
- - Do not use `jimeng/image/v3` size values (for example `1152x896`) on `/api/jimeng/image`.
170
- - For `/api/jimeng/image`, use 2K/3K/4K size values such as:
171
- `2048x2048`, `3072x3072`, `4096x4096`.
172
- - Model and size must match:
173
- - `doubao-seedream-5-0-260128` does **not** support 4K.
174
- - `doubao-seedream-4-5-251128` does **not** support 3K.
175
- - `web_search=true` only works with `doubao-seedream-5-0-260128`.
176
-
177
- ## Parameter Types
178
-
179
- ### GeminiImageParams
180
-
181
- | Parameter | Type | Required | Description |
182
- |-----------|------|----------|-------------|
183
- | `prompt` | `string \| TextFieldItem[]` | Yes | Text description of the image |
184
- | `attachment` | `AttachmentFieldItem[]` | No | Reference images for style transfer |
185
- | `model` | `LabelFieldItem` | No | Model selection (default: gemini-2.0-flash-exp) |
186
- | `aspect_ratio` | `LabelFieldItem` | No | Aspect ratio: `'1:1'`, `'9:16'`, `'16:9'` |
187
- | `size` | `LabelFieldItem` | No | Resolution: `'1K'`, `'2K'`, `'4K'` |
188
-
189
- ### JiMengImageParams
190
-
191
- | Parameter | Type | Required | Description |
192
- |-----------|------|----------|-------------|
193
- | `prompt` | `string \| TextFieldItem[]` | Yes | Text description (supports Chinese) |
194
- | `attachment` | `AttachmentFieldItem[]` | No | Reference images for style transfer |
195
- | `size` | `LabelFieldItem` | Yes | Size: `'2048x2048'` (2K), `'3072x3072'` (3K), `'4096x4096'` (4K) and more |
196
- | `model_selector` | `LabelFieldItem` | No | Model: `'doubao-seedream-5-0-260128'` (5.0 Lite) or `'doubao-seedream-4-5-251128'` (4.5) |
197
- | `web_search` | `LabelFieldItem` | No | Enable web search (5.0 Lite only): `'true'` or `'false'` |
198
- | `image_count` | `LabelFieldItem \| number` | No | Number of images to generate (0-5) |
199
- | `model` | `string` | No | Direct model override |
200
-
201
- ## Examples
202
-
203
- ### Text-to-Image
204
-
205
- ```typescript
206
- const client = new UnityClawClient();
207
-
208
- const result = await client.image.gemini({
209
- prompt: 'A cyberpunk cityscape with neon lights reflecting on wet streets',
210
- aspect_ratio: { value: '16:9', label: '16:9' },
211
- size: { value: '2K', label: '2K' }
212
- });
213
-
214
- if (result.success && result.response?.data) {
215
- result.response.data.forEach((img, i) => {
216
- console.log(`Image ${i + 1}: ${img.content}`);
217
- });
218
- }
219
- ```
220
-
221
- ### Image-to-Image (Style Transfer)
222
-
223
- ```typescript
224
- const result = await client.image.gemini({
225
- prompt: 'Transform this photo into a watercolor painting style',
226
- attachment: [
227
- { tmp_url: 'https://example.com/photo.jpg', name: 'photo.jpg' }
228
- ],
229
- aspect_ratio: { value: '1:1', label: '1:1' }
230
- });
231
-
232
- if (result.success) {
233
- console.log('Style transfer complete:', result.response.data);
234
- }
235
- ```
236
-
237
- ### Batch Generation
238
-
239
- ```typescript
240
- const prompts = [
241
- 'A serene mountain lake at dawn',
242
- 'A bustling Tokyo street at night',
243
- 'An underwater coral reef scene'
244
- ];
245
-
246
- const results = await Promise.all(
247
- prompts.map(prompt => client.image.gemini({ prompt }))
248
- );
249
-
250
- results.forEach((result, i) => {
251
- if (result.success) {
252
- console.log(`Prompt ${i + 1}: Success`);
253
- }
254
- });
255
- ```
256
-
257
- ## Error Handling
258
-
259
- > **IMPORTANT:** Always check `result.success` first, then access data via `result.response.data`.
260
-
261
- ```typescript
262
- const result = await client.image.gemini({ prompt: 'test' });
263
-
264
- if (!result.success) {
265
- console.error('Request failed');
266
- console.log('Check logs:', result.logs);
267
- return;
268
- }
269
-
270
- // Check API response code
271
- if (result.response?.code !== 0) {
272
- console.error('API error:', result.response);
273
- return;
274
- }
275
-
276
- // Success - access result.response.data
277
- console.log('Success:', result.response.data);
278
- console.log('Task ID:', result.taskId);
279
- ```
280
-
281
- ## Task Folders
282
-
283
- Each execution creates a task folder with detailed logs:
284
-
285
- ```typescript
286
- const result = await client.image.gemini({ prompt: 'test' });
287
-
288
- console.log('Task ID:', result.taskId); // e.g., "609600db"
289
- console.log('Task Folder:', result.taskFolder); // e.g., "~/Documents/tasks/20260312_202723_609600db/"
290
-
291
- // Task folder structure:
292
- // ├── attachments/ - Generated images
293
- // │ └── xxx.png
294
- // └── logs/
295
- // ├── execution.log
296
- // ├── request.json - API request payload
297
- // ├── response.json - Raw API response
298
- // └── summary.json - Task summary with success status
299
- ```
300
-
301
- ## Related Skills
302
-
303
- - [unityclaw-image-compress](../unityclaw-image-compress/SKILL.md) - Compress generated images
304
- - [unityclaw-video-generation-kling](../unityclaw-video-generation-kling/SKILL.md) - Generate videos
305
-
306
- <!-- SDK_VERSION_RULE_START -->
307
- ## SDK Version Check Rule
308
-
309
- - Before invoking this skill, check local `@unityclaw/sdk` version.
310
- - Required minimum SDK version: `1.1.1`
311
- - If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
312
- - Suggested command: `npm i @unityclaw/sdk@latest`
313
- <!-- SDK_VERSION_RULE_END -->
@@ -1,50 +0,0 @@
1
- ---
2
- name: unityclaw-video-frame-extract
3
- description: Extract first/last/specified-time frame from video attachments
4
- version: 1.1.1
5
- metadata:
6
- openclaw:
7
- requires:
8
- env:
9
- - UNITYCLAW_API_KEY
10
- bins:
11
- - node
12
- - npm
13
- primaryEnv: UNITYCLAW_API_KEY
14
- emoji: "🖼️"
15
- homepage: https://unityclaw.com
16
- install:
17
- - kind: node
18
- package: "@unityclaw/sdk"
19
- bins: []
20
- ---
21
-
22
- # UnityClaw Video Frame Extract
23
-
24
- Extract one frame from video at first frame, last frame, or specific `mm:ss`.
25
-
26
- ```typescript
27
- import { UnityClawClient } from '@unityclaw/sdk';
28
-
29
- const client = new UnityClawClient();
30
- const result = await client.media.extractFrame({
31
- attachment: [{ path: './files/demo.mp4' }],
32
- frame_option: 'first',
33
- });
34
-
35
- if (result.success && result.response?.data?.[0]) {
36
- console.log(result.response.data[0].content);
37
- }
38
- ```
39
-
40
- - API: `/api/video/frame`
41
- - field-feishu: `video/frame`
42
-
43
- <!-- SDK_VERSION_RULE_START -->
44
- ## SDK Version Check Rule
45
-
46
- - Before invoking this skill, check local `@unityclaw/sdk` version.
47
- - Required minimum SDK version: `1.1.1`
48
- - If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
49
- - Suggested command: `npm i @unityclaw/sdk@latest`
50
- <!-- SDK_VERSION_RULE_END -->