@jiggai/recipes 0.4.36 → 0.4.38
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 +13 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/lib/workflows/media-drivers/kling-video.driver.ts +28 -1
- package/src/lib/workflows/media-drivers/luma-video.driver.ts +1 -1
- package/src/lib/workflows/media-drivers/runway-video.driver.ts +1 -1
- package/src/lib/workflows/media-drivers/utils.ts +2 -6
- package/src/lib/workflows/workflow-worker.ts +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,19 @@
|
|
|
4
4
|
<img src="https://github.com/JIGGAI/ClawRecipes/blob/main/clawcipes_cook.jpg" alt="ClawRecipes logo" width="240" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://img.shields.io/github/v/release/JIGGAI/ClawRecipes?color=green&label=Latest%20Release" alt="Latest Release">
|
|
9
|
+
<img src="https://img.shields.io/github/license/JIGGAI/ClawRecipes?color=orange" alt="License Apache 2.0">
|
|
10
|
+
<img src="https://img.shields.io/github/actions/workflow/status/JIGGAI/ClawRecipes/release.yml?label=Build" alt="Build Status">
|
|
11
|
+
<img src="https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white" alt="TypeScript">
|
|
12
|
+
<img src="https://img.shields.io/badge/Node.js-18+-339933?logo=node.js&logoColor=white" alt="Node.js 18+">
|
|
13
|
+
<br>
|
|
14
|
+
<img src="https://img.shields.io/badge/OpenClaw-Plugin-6366f1" alt="OpenClaw Plugin">
|
|
15
|
+
<img src="https://img.shields.io/badge/CLI-Tool-blue" alt="CLI Tool">
|
|
16
|
+
<img src="https://img.shields.io/badge/Team-Automation-8b5cf6" alt="Team Automation">
|
|
17
|
+
<img src="https://img.shields.io/badge/Workflow-Engine-0891b2" alt="Workflow Engine">
|
|
18
|
+
</p>
|
|
19
|
+
|
|
7
20
|
ClawRecipes is an **OpenClaw plugin** for scaffolding agents, teams, and file-first workflows from Markdown recipes.
|
|
8
21
|
|
|
9
22
|
If you want the short version:
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -3,6 +3,29 @@ import * as fs from 'fs';
|
|
|
3
3
|
import { MediaDriver, MediaDriverInvokeOpts, MediaDriverResult, DurationConstraints, parseDuration } from './types';
|
|
4
4
|
import { findSkillDir, runScript, parseMediaOutput } from './utils';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Map aspect ratios to Kling's supported values: 16:9, 9:16, 1:1
|
|
8
|
+
*/
|
|
9
|
+
function mapToKlingAspectRatio(ratio: string): string {
|
|
10
|
+
const normalized = ratio.toLowerCase().trim();
|
|
11
|
+
|
|
12
|
+
// Direct matches
|
|
13
|
+
if (normalized === '16:9' || normalized === '9:16' || normalized === '1:1') {
|
|
14
|
+
return normalized;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Map common ratios to closest Kling equivalent
|
|
18
|
+
const mappings: Record<string, string> = {
|
|
19
|
+
'4:3': '1:1', // 4:3 (1.33) → 1:1 (1.00) closest square-ish
|
|
20
|
+
'3:4': '9:16', // 3:4 (0.75) → 9:16 (0.56) closest vertical
|
|
21
|
+
'21:9': '16:9', // 21:9 (2.33) → 16:9 (1.78) closest widescreen
|
|
22
|
+
'2:1': '16:9', // 2:1 (2.00) → 16:9 (1.78) closest widescreen
|
|
23
|
+
'1:2': '9:16', // 1:2 (0.50) → 9:16 (0.56) closest vertical
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return mappings[normalized] || '16:9'; // default fallback
|
|
27
|
+
}
|
|
28
|
+
|
|
6
29
|
/**
|
|
7
30
|
* Kling AI video driver — uses official `klingai` ClawHub skill.
|
|
8
31
|
*
|
|
@@ -39,6 +62,10 @@ export class KlingVideo implements MediaDriver {
|
|
|
39
62
|
const rawDuration = Math.max(3, Math.min(15, Number(parseDuration(config))));
|
|
40
63
|
const duration = String(rawDuration);
|
|
41
64
|
|
|
65
|
+
// Kling only supports 16:9, 9:16, 1:1 — map other ratios to closest match
|
|
66
|
+
const rawAspectRatio = String(config?.aspect_ratio ?? config?.size ?? '16:9');
|
|
67
|
+
const aspectRatio = mapToKlingAspectRatio(rawAspectRatio);
|
|
68
|
+
|
|
42
69
|
const skillDir = await findSkillDir(this.slug);
|
|
43
70
|
if (!skillDir) {
|
|
44
71
|
throw new Error(
|
|
@@ -58,7 +85,7 @@ export class KlingVideo implements MediaDriver {
|
|
|
58
85
|
'--prompt', prompt,
|
|
59
86
|
'--output_dir', outputDir,
|
|
60
87
|
'--duration', duration,
|
|
61
|
-
'--aspect_ratio',
|
|
88
|
+
'--aspect_ratio', aspectRatio,
|
|
62
89
|
'--mode', 'pro',
|
|
63
90
|
],
|
|
64
91
|
env: {
|
|
@@ -3,7 +3,7 @@ import { MediaDriver, MediaDriverInvokeOpts, MediaDriverResult, DurationConstrai
|
|
|
3
3
|
import { findSkillDir, findVenvPython, runScript, parseMediaOutput } from './utils';
|
|
4
4
|
|
|
5
5
|
export class LumaVideo implements MediaDriver {
|
|
6
|
-
slug = '
|
|
6
|
+
slug = 'luma-video';
|
|
7
7
|
mediaType = 'video' as const;
|
|
8
8
|
displayName = 'Luma Video Generation';
|
|
9
9
|
requiredEnvVars = ['LUMAAI_API_KEY'];
|
|
@@ -3,7 +3,7 @@ import { MediaDriver, MediaDriverInvokeOpts, MediaDriverResult, DurationConstrai
|
|
|
3
3
|
import { findSkillDir, findVenvPython, runScript, parseMediaOutput } from './utils';
|
|
4
4
|
|
|
5
5
|
export class RunwayVideo implements MediaDriver {
|
|
6
|
-
slug = '
|
|
6
|
+
slug = 'runway-video';
|
|
7
7
|
mediaType = 'video' as const;
|
|
8
8
|
displayName = 'Runway Video Generation';
|
|
9
9
|
requiredEnvVars = ['RUNWAYML_API_SECRET'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs/promises';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { execFileSync } from 'child_process';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Find a skill directory by searching common skill roots
|
|
@@ -96,13 +96,9 @@ export interface RunScriptOpts {
|
|
|
96
96
|
|
|
97
97
|
export function runScript(opts: RunScriptOpts): string {
|
|
98
98
|
const { runner, script, args = [], stdin, env, cwd, timeout } = opts;
|
|
99
|
-
|
|
100
|
-
const command = args.length > 0
|
|
101
|
-
? `${runner} ${JSON.stringify(script)} ${args.map(arg => JSON.stringify(arg)).join(' ')}`
|
|
102
|
-
: `${runner} ${JSON.stringify(script)}`;
|
|
103
99
|
|
|
104
100
|
try {
|
|
105
|
-
return
|
|
101
|
+
return execFileSync(runner, [script, ...args], {
|
|
106
102
|
cwd,
|
|
107
103
|
timeout,
|
|
108
104
|
encoding: 'utf8',
|
|
@@ -1117,7 +1117,7 @@ export async function runWorkflowWorkerTick(api: OpenClawPluginApi, opts: {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
|
|
1119
1119
|
// ── Step 2: Invoke the media driver to generate actual media ─────
|
|
1120
|
-
const providerSlug = provider
|
|
1120
|
+
const providerSlug = provider;
|
|
1121
1121
|
const configEnv = await loadConfigEnv();
|
|
1122
1122
|
const mergedEnv = { ...process.env, ...configEnv } as Record<string, string>;
|
|
1123
1123
|
|