@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,424 +0,0 @@
1
- ---
2
- name: unityclaw-document-convert
3
- description: Convert documents between formats (PDF, Word, PPT, Excel, Image)
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 Document Convert
23
-
24
- Convert documents between various formats including PDF, Word, PowerPoint, Excel, and images.
25
- Recommended API is unified `client.document.convertDocument(...)`.
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 data via `result.response.data`.
48
-
49
- ```typescript
50
- interface UnityClawResult {
51
- success: boolean; // โœ… Use this to check if SDK call succeeded
52
- taskId: string; // Task identifier
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<{ // โœ… Result data here
58
- name: string;
59
- contentType: string;
60
- content: string; // URL to converted document
61
- }> | null;
62
- };
63
- logs: Array<{ timestamp; level; message }>;
64
- attachments: any[];
65
- }
66
- ```
67
-
68
- ## Quick Start
69
-
70
- ```typescript
71
- import { UnityClawClient } from '@unityclaw/sdk';
72
-
73
- const client = new UnityClawClient();
74
-
75
- // Convert PDF to Word (unified API)
76
- const result = await client.document.convertDocument({
77
- attachment: [
78
- { path: './files/document.pdf' }
79
- ],
80
- input_format: 'pdf',
81
- output_format: 'docx'
82
- });
83
-
84
- // โœ… Correct: Check result.success, access data via result.response.data
85
- if (result.success && result.response?.data) {
86
- console.log('Converted document:', result.response.data);
87
- }
88
- ```
89
-
90
- ## Available APIs
91
-
92
- ### Image Conversions
93
-
94
- | Method | Description |
95
- |--------|-------------|
96
- | `image2Word()` | Convert image to Word document |
97
- | `image2Ppt()` | Convert image to PowerPoint |
98
- | `image2Excel()` | Convert image to Excel |
99
- | `image2Pdf()` | Convert image to PDF |
100
-
101
- ### PDF Conversions
102
-
103
- | Method | Description |
104
- |--------|-------------|
105
- | `pdf2Word()` | Convert PDF to Word document |
106
- | `pdf2Ppt()` | Convert PDF to PowerPoint |
107
- | `pdf2Excel()` | Convert PDF to Excel |
108
- | `pdf2Image()` | Convert PDF to images |
109
-
110
- ### Generic Conversion
111
-
112
- | Method | Description |
113
- |--------|-------------|
114
- | `convertDocument()` | Recommended unified conversion API |
115
- | `convert()` | Generic conversion with format specification |
116
-
117
- ## API Reference
118
-
119
- ### Image to Word
120
-
121
- ```typescript
122
- await client.document.image2Word({
123
- attachment: AttachmentFieldItem[]
124
- }): Promise<APIResponse<AttachmentResult[]>>
125
- ```
126
-
127
- ### Image to PowerPoint
128
-
129
- ```typescript
130
- await client.document.image2Ppt({
131
- attachment: AttachmentFieldItem[]
132
- }): Promise<APIResponse<AttachmentResult[]>>
133
- ```
134
-
135
- ### Image to Excel
136
-
137
- ```typescript
138
- await client.document.image2Excel({
139
- attachment: AttachmentFieldItem[]
140
- }): Promise<APIResponse<AttachmentResult[]>>
141
- ```
142
-
143
- ### Image to PDF
144
-
145
- ```typescript
146
- await client.document.image2Pdf({
147
- attachment: AttachmentFieldItem[]
148
- }): Promise<APIResponse<AttachmentResult[]>>
149
- ```
150
-
151
- ### PDF to Word
152
-
153
- ```typescript
154
- await client.document.pdf2Word({
155
- attachment: AttachmentFieldItem[]
156
- }): Promise<APIResponse<AttachmentResult[]>>
157
- ```
158
-
159
- ### PDF to PowerPoint
160
-
161
- ```typescript
162
- await client.document.pdf2Ppt({
163
- attachment: AttachmentFieldItem[]
164
- }): Promise<APIResponse<AttachmentResult[]>>
165
- ```
166
-
167
- ### PDF to Excel
168
-
169
- ```typescript
170
- await client.document.pdf2Excel({
171
- attachment: AttachmentFieldItem[]
172
- }): Promise<APIResponse<AttachmentResult[]>>
173
- ```
174
-
175
- ### PDF to Image
176
-
177
- ```typescript
178
- await client.document.pdf2Image({
179
- attachment: AttachmentFieldItem[]
180
- }): Promise<APIResponse<AttachmentResult[]>>
181
- ```
182
-
183
- ### Generic Convert
184
-
185
- ```typescript
186
- await client.document.convert({
187
- attachment: AttachmentFieldItem[];
188
- input_format?: string;
189
- output_format: string;
190
- }): Promise<APIResponse<AttachmentResult[]>>
191
- ```
192
-
193
- ## Examples
194
-
195
- ### PDF to Word
196
-
197
- ```typescript
198
- const client = new UnityClawClient();
199
-
200
- const result = await client.document.pdf2Word({
201
- attachment: [
202
- { tmp_url: 'https://example.com/report.pdf', name: 'report.pdf' }
203
- ]
204
- });
205
-
206
- if (result.success && result.response?.data) {
207
- console.log('Word document:', result.response.data[0].content);
208
- }
209
- ```
210
-
211
- ### PDF to PowerPoint
212
-
213
- ```typescript
214
- const result = await client.document.pdf2Ppt({
215
- attachment: [
216
- { tmp_url: 'https://example.com/slides.pdf', name: 'slides.pdf' }
217
- ]
218
- });
219
- ```
220
-
221
- ### PDF to Excel
222
-
223
- ```typescript
224
- const result = await client.document.pdf2Excel({
225
- attachment: [
226
- { tmp_url: 'https://example.com/data.pdf', name: 'data.pdf' }
227
- ]
228
- });
229
- ```
230
-
231
- ### PDF to Image
232
-
233
- ```typescript
234
- const result = await client.document.pdf2Image({
235
- attachment: [
236
- { tmp_url: 'https://example.com/document.pdf', name: 'document.pdf' }
237
- ]
238
- });
239
-
240
- // Returns array of images (one per page)
241
- if (result.success && result.response?.data) {
242
- result.response.data.forEach((img, i) => {
243
- console.log(`Page ${i + 1}: ${img.content}`);
244
- });
245
- }
246
- ```
247
-
248
- ### Image to Word (OCR)
249
-
250
- ```typescript
251
- const result = await client.document.image2Word({
252
- attachment: [
253
- { tmp_url: 'https://example.com/scanned-doc.jpg', name: 'scanned.jpg' }
254
- ]
255
- });
256
- ```
257
-
258
- ### Image to PowerPoint
259
-
260
- ```typescript
261
- const result = await client.document.image2Ppt({
262
- attachment: [
263
- { tmp_url: 'https://example.com/diagram.png', name: 'diagram.png' }
264
- ]
265
- });
266
- ```
267
-
268
- ### Image to Excel
269
-
270
- ```typescript
271
- const result = await client.document.image2Excel({
272
- attachment: [
273
- { tmp_url: 'https://example.com/spreadsheet.png', name: 'spreadsheet.png' }
274
- ]
275
- });
276
- ```
277
-
278
- ### Image to PDF
279
-
280
- ```typescript
281
- const result = await client.document.image2Pdf({
282
- attachment: [
283
- { tmp_url: 'https://example.com/page1.jpg', name: 'page1.jpg' },
284
- { tmp_url: 'https://example.com/page2.jpg', name: 'page2.jpg' }
285
- ]
286
- });
287
- ```
288
-
289
- ### Generic Convert
290
-
291
- ```typescript
292
- // Image to PDF
293
- const result = await client.document.convert({
294
- attachment: [{ tmp_url: 'https://...', name: 'image.jpg' }],
295
- input_format: 'image',
296
- output_format: 'pdf'
297
- });
298
-
299
- // PDF to Word
300
- const result = await client.document.convert({
301
- attachment: [{ tmp_url: 'https://...', name: 'doc.pdf' }],
302
- input_format: 'pdf',
303
- output_format: 'word'
304
- });
305
- ```
306
-
307
- ### Batch Conversion
308
-
309
- ```typescript
310
- const pdfFiles = [
311
- { tmp_url: 'https://example.com/doc1.pdf', name: 'doc1.pdf' },
312
- { tmp_url: 'https://example.com/doc2.pdf', name: 'doc2.pdf' },
313
- { tmp_url: 'https://example.com/doc3.pdf', name: 'doc3.pdf' }
314
- ];
315
-
316
- const results = await Promise.all(
317
- pdfFiles.map(file => client.document.pdf2Word({ attachment: [file] }))
318
- );
319
-
320
- results.forEach((result, i) => {
321
- if (result.success && result.response?.data) {
322
- console.log(`File ${i + 1} converted: ${result.response.data?.[0]?.content}`);
323
- }
324
- });
325
- ```
326
-
327
- ### Convert Then Translate
328
-
329
- ```typescript
330
- // Convert image to Word, then translate
331
- const converted = await client.document.image2Word({
332
- attachment: [{ tmp_url: 'https://...', name: 'image.jpg' }]
333
- });
334
-
335
- if (converted.success && converted.response?.data) {
336
- const translated = await client.document.translate({
337
- attachment: converted.response.data,
338
- source_language: 'en',
339
- target_language: 'zh'
340
- });
341
-
342
- console.log('Translated document:', translated.response?.data);
343
- }
344
- ```
345
-
346
- ## Response Format
347
-
348
- ```typescript
349
- interface AttachmentResult {
350
- name: string;
351
- contentType: 'attachment/url';
352
- content: string; // URL to converted document
353
- }
354
- ```
355
-
356
- ## Error Handling
357
-
358
- ```typescript
359
- const result = await client.document.pdf2Word({
360
- attachment: [{ tmp_url: 'https://...', name: 'doc.pdf' }]
361
- });
362
-
363
- if (!result.success) {
364
- console.error('Request failed');
365
- console.log('Check logs:', result.logs);
366
- return;
367
- }
368
-
369
- if (result.response?.code !== 0) {
370
- console.error('API error:', result.response);
371
- return;
372
- }
373
-
374
- // Success
375
- console.log('Success:', result.response.data);
376
- ```
377
-
378
- ## Task Folders
379
-
380
- Each execution creates a task folder:
381
-
382
- ```typescript
383
- const result = await client.document.pdf2Word({
384
- attachment: [{ tmp_url: 'https://...', name: 'doc.pdf' }]
385
- });
386
-
387
- console.log('Task ID:', result.taskId);
388
- console.log('Task Folder:', result.taskFolder);
389
- console.log('Downloaded Files:', result.attachments);
390
- ```
391
-
392
- ## Conversion Matrix
393
-
394
- | From | To | Method |
395
- |------|-----|--------|
396
- | PDF | Word | `pdf2Word()` |
397
- | PDF | PowerPoint | `pdf2Ppt()` |
398
- | PDF | Excel | `pdf2Excel()` |
399
- | PDF | Image | `pdf2Image()` |
400
- | Image | Word | `image2Word()` |
401
- | Image | PowerPoint | `image2Ppt()` |
402
- | Image | Excel | `image2Excel()` |
403
- | Image | PDF | `image2Pdf()` |
404
-
405
- ## Best Practices
406
-
407
- 1. **File Size**: Large files may take longer to process
408
- 2. **Format Fidelity**: Complex formatting may have minor differences
409
- 3. **Batch Processing**: Use Promise.all for multiple files
410
- 4. **Error Recovery**: Always check result.code before proceeding
411
-
412
- ## Related Skills
413
-
414
- - [unityclaw-document-translation](../unityclaw-document-translation/SKILL.md) - Translate documents
415
- - [unityclaw-image-compress](../unityclaw-image-compress/SKILL.md) - Compress images before conversion
416
-
417
- <!-- SDK_VERSION_RULE_START -->
418
- ## SDK Version Check Rule
419
-
420
- - Before invoking this skill, check local `@unityclaw/sdk` version.
421
- - Required minimum SDK version: `1.1.1`
422
- - If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
423
- - Suggested command: `npm i @unityclaw/sdk@latest`
424
- <!-- SDK_VERSION_RULE_END -->
@@ -1,63 +0,0 @@
1
- ---
2
- name: unityclaw-idp-business-extraction
3
- description: Extract fields from business documents (business license, business card)
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 IDP - Business Extraction
23
-
24
- Use this skill for business document extraction:
25
- - `business_license`
26
- - `business_card`
27
-
28
- ## SDK APIs
29
-
30
- ```typescript
31
- await client.idp.businessLicense({ attachments: [{ path: './files/business-license.jpg' }] });
32
- await client.idp.businessCard({ attachments: [{ path: './files/business-card.jpg' }] });
33
- ```
34
-
35
- Or generic API:
36
-
37
- ```typescript
38
- await client.idp.extract('business_license', {
39
- attachments: [{ path: './files/business-license.jpg' }]
40
- });
41
- ```
42
-
43
- ## Input
44
-
45
- ```typescript
46
- {
47
- attachments: AttachmentInput[]
48
- }
49
- ```
50
-
51
- ## Notes
52
-
53
- - This skill groups enterprise scenarios to avoid over-generic routing.
54
- - Output fields vary between license and card extraction.
55
-
56
- <!-- SDK_VERSION_RULE_START -->
57
- ## SDK Version Check Rule
58
-
59
- - Before invoking this skill, check local `@unityclaw/sdk` version.
60
- - Required minimum SDK version: `1.1.1`
61
- - If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
62
- - Suggested command: `npm i @unityclaw/sdk@latest`
63
- <!-- SDK_VERSION_RULE_END -->
@@ -1,63 +0,0 @@
1
- ---
2
- name: unityclaw-idp-contract-extraction
3
- description: Extract structured fields from contract files
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 IDP - Contract Extraction
23
-
24
- Use this skill for contract parsing:
25
- - `contract`
26
-
27
- ## SDK APIs
28
-
29
- ```typescript
30
- await client.idp.contract({
31
- attachments: [{ path: './files/contract.pdf' }]
32
- });
33
- ```
34
-
35
- Or generic API:
36
-
37
- ```typescript
38
- await client.idp.extract('contract', {
39
- attachments: [{ path: './files/contract.pdf' }]
40
- });
41
- ```
42
-
43
- ## Input
44
-
45
- ```typescript
46
- {
47
- attachments: AttachmentInput[]
48
- }
49
- ```
50
-
51
- ## Notes
52
-
53
- - Preferred for long contract OCR + key field extraction scenarios.
54
- - Read extracted data from `result.response.data`.
55
-
56
- <!-- SDK_VERSION_RULE_START -->
57
- ## SDK Version Check Rule
58
-
59
- - Before invoking this skill, check local `@unityclaw/sdk` version.
60
- - Required minimum SDK version: `1.1.1`
61
- - If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
62
- - Suggested command: `npm i @unityclaw/sdk@latest`
63
- <!-- SDK_VERSION_RULE_END -->
@@ -1,65 +0,0 @@
1
- ---
2
- name: unityclaw-idp-invoice-extraction
3
- description: Extract fields from invoice and ticket documents (VAT, train, taxi)
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 IDP - Invoice Extraction
23
-
24
- Use this skill for invoice/ticket extraction:
25
- - `vat_invoice`
26
- - `train_invoice`
27
- - `taxi_invoice`
28
-
29
- ## SDK APIs
30
-
31
- ```typescript
32
- await client.idp.vatInvoice({ attachments: [{ path: './files/vat-invoice.pdf' }] });
33
- await client.idp.trainInvoice({ attachments: [{ path: './files/train-ticket.jpg' }] });
34
- await client.idp.taxiInvoice({ attachments: [{ path: './files/taxi-invoice.jpg' }] });
35
- ```
36
-
37
- Or generic API:
38
-
39
- ```typescript
40
- await client.idp.extract('vat_invoice', {
41
- attachments: [{ path: './files/vat-invoice.pdf' }]
42
- });
43
- ```
44
-
45
- ## Input
46
-
47
- ```typescript
48
- {
49
- attachments: AttachmentInput[]
50
- }
51
- ```
52
-
53
- ## Notes
54
-
55
- - Files can be image/PDF according to each underlying IDP type.
56
- - Output schema differs by type; parse from `result.response.data`.
57
-
58
- <!-- SDK_VERSION_RULE_START -->
59
- ## SDK Version Check Rule
60
-
61
- - Before invoking this skill, check local `@unityclaw/sdk` version.
62
- - Required minimum SDK version: `1.1.1`
63
- - If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
64
- - Suggested command: `npm i @unityclaw/sdk@latest`
65
- <!-- SDK_VERSION_RULE_END -->
@@ -1,69 +0,0 @@
1
- ---
2
- name: unityclaw-idp-personal-documents
3
- description: Extract structured fields from personal identity documents (ID card, vehicle license, bank card)
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 IDP - Personal Documents
23
-
24
- Use this skill for personal document extraction:
25
- - `id_card`
26
- - `vehicle_license`
27
- - `bank_card`
28
-
29
- ## SDK APIs
30
-
31
- ```typescript
32
- await client.idp.idCard({ attachments: [{ path: './files/id-card.jpg' }] });
33
- await client.idp.vehicleLicense({ attachments: [{ path: './files/vehicle-license.jpg' }] });
34
- await client.idp.bankCard({ attachments: [{ path: './files/bank-card.jpg' }] });
35
- ```
36
-
37
- Or generic API:
38
-
39
- ```typescript
40
- await client.idp.extract('id_card', {
41
- attachments: [{ path: './files/id-card.jpg' }]
42
- });
43
- ```
44
-
45
- ## Input
46
-
47
- ```typescript
48
- {
49
- attachments: AttachmentInput[]
50
- }
51
- ```
52
-
53
- `AttachmentInput` supports:
54
- - `tmp_url`
55
- - local path (`path` / `localPath` / `filePath`), SDK auto-uploads to `/api/upload`
56
-
57
- ## Notes
58
-
59
- - This category is split from invoice/business/contract to improve skill routing success.
60
- - Output fields vary by type; read from `result.response.data`.
61
-
62
- <!-- SDK_VERSION_RULE_START -->
63
- ## SDK Version Check Rule
64
-
65
- - Before invoking this skill, check local `@unityclaw/sdk` version.
66
- - Required minimum SDK version: `1.1.1`
67
- - If local SDK version is lower than this skill version, stop and prompt user to upgrade SDK first.
68
- - Suggested command: `npm i @unityclaw/sdk@latest`
69
- <!-- SDK_VERSION_RULE_END -->