@unityclaw/skills 1.1.2 → 1.1.4
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 +10 -19
- package/package.json +1 -1
- package/{unityclaw-image-generation → unityclaw-image-generation-jimeng}/SKILL.md +3 -3
- package/unityclaw-media-analysis/SKILL.md +2 -2
- package/unityclaw-media-download-xhs/SKILL.md +2 -2
- package/unityclaw-media-stats/SKILL.md +2 -2
- package/unityclaw-media-user-info/SKILL.md +2 -2
- package/unityclaw-video-generation-jimeng-doubao/SKILL.md +2 -2
- package/unityclaw-video-generation-kling/SKILL.md +2 -2
- package/unityclaw-video-generation-wan-minimax/SKILL.md +2 -2
- package/unityclaw-document-convert/SKILL.md +0 -424
- package/unityclaw-document-translation/SKILL.md +0 -318
- package/unityclaw-idp-business-extraction/SKILL.md +0 -63
- package/unityclaw-idp-contract-extraction/SKILL.md +0 -63
- package/unityclaw-idp-invoice-extraction/SKILL.md +0 -65
- package/unityclaw-idp-personal-documents/SKILL.md +0 -69
- package/unityclaw-image-compress/SKILL.md +0 -275
- package/unityclaw-video-frame-extract/SKILL.md +0 -50
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: unityclaw-image-compress
|
|
3
|
-
description: Compress images with quality control to reduce file size
|
|
4
|
-
version: 1.1.2
|
|
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.jimeng({
|
|
183
|
-
prompt: 'A beautiful landscape',
|
|
184
|
-
size: '2048x2048'
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
if (generated.success && generated.response?.data) {
|
|
188
|
-
const compressed = await client.image.compress({
|
|
189
|
-
attachment: generated.response.data.map(img => ({
|
|
190
|
-
tmp_url: img.content,
|
|
191
|
-
name: img.name
|
|
192
|
-
})),
|
|
193
|
-
quality: 75
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
console.log('Compressed generated images:', compressed.response?.data);
|
|
197
|
-
}
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
## Response Format
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
interface AttachmentResult {
|
|
204
|
-
name: string;
|
|
205
|
-
contentType: string;
|
|
206
|
-
content: string; // URL to compressed image
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Error Handling
|
|
211
|
-
|
|
212
|
-
```typescript
|
|
213
|
-
const result = await client.image.compress({
|
|
214
|
-
attachment: [{ tmp_url: 'invalid-url', name: 'test.jpg' }],
|
|
215
|
-
quality: 80
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
if (!result.success) {
|
|
219
|
-
console.error('Request failed');
|
|
220
|
-
console.log('Check logs:', result.logs);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if (result.response?.code !== 0) {
|
|
225
|
-
console.error('API error:', result.response);
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Success
|
|
230
|
-
console.log('Success:', result.response.data);
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
## Quality Guidelines
|
|
234
|
-
|
|
235
|
-
| Quality | Use Case | File Size Reduction |
|
|
236
|
-
|---------|----------|---------------------|
|
|
237
|
-
| 90-100 | Print, professional photography | Minimal |
|
|
238
|
-
| 75-89 | Web display, social media | Moderate |
|
|
239
|
-
| 50-74 | Thumbnails, previews | Significant |
|
|
240
|
-
| 0-49 | Aggressive optimization | Maximum |
|
|
241
|
-
|
|
242
|
-
## Supported Formats
|
|
243
|
-
|
|
244
|
-
- JPEG/JPG
|
|
245
|
-
- PNG
|
|
246
|
-
- WebP
|
|
247
|
-
- GIF (static)
|
|
248
|
-
|
|
249
|
-
## Task Folders
|
|
250
|
-
|
|
251
|
-
Each execution creates a task folder with logs and downloaded attachments:
|
|
252
|
-
|
|
253
|
-
```typescript
|
|
254
|
-
const result = await client.image.compress({
|
|
255
|
-
attachment: [{ tmp_url: 'https://...', name: 'image.jpg' }],
|
|
256
|
-
quality: 80
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
console.log('Task ID:', result.taskId);
|
|
260
|
-
console.log('Task Folder:', result.taskFolder);
|
|
261
|
-
console.log('Local Attachments:', result.attachments);
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
## Related Skills
|
|
265
|
-
|
|
266
|
-
- [unityclaw-image-generation](../unityclaw-image-generation/SKILL.md) - Generate images before compression
|
|
267
|
-
|
|
268
|
-
<!-- SDK_VERSION_RULE_START -->
|
|
269
|
-
## SDK Version Check Rule
|
|
270
|
-
|
|
271
|
-
- Before invoking this skill, check local `@unityclaw/sdk` version.
|
|
272
|
-
- Required minimum SDK version: `1.1.2`
|
|
273
|
-
- If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
|
|
274
|
-
- Suggested command: `npm i @unityclaw/sdk@latest`
|
|
275
|
-
<!-- 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.2
|
|
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.2`
|
|
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 -->
|