@nodetool-ai/llm-nodes 0.8.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 +52 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/agent-control-tools.d.ts +22 -0
- package/dist/nodes/agent-control-tools.d.ts.map +1 -0
- package/dist/nodes/agent-control-tools.js +123 -0
- package/dist/nodes/agent-control-tools.js.map +1 -0
- package/dist/nodes/agent-loop.d.ts +73 -0
- package/dist/nodes/agent-loop.d.ts.map +1 -0
- package/dist/nodes/agent-loop.js +168 -0
- package/dist/nodes/agent-loop.js.map +1 -0
- package/dist/nodes/agent-recommended-models.d.ts +152 -0
- package/dist/nodes/agent-recommended-models.d.ts.map +1 -0
- package/dist/nodes/agent-recommended-models.js +656 -0
- package/dist/nodes/agent-recommended-models.js.map +1 -0
- package/dist/nodes/agent-thinking.d.ts +29 -0
- package/dist/nodes/agent-thinking.d.ts.map +1 -0
- package/dist/nodes/agent-thinking.js +139 -0
- package/dist/nodes/agent-thinking.js.map +1 -0
- package/dist/nodes/agent-threads.d.ts +17 -0
- package/dist/nodes/agent-threads.d.ts.map +1 -0
- package/dist/nodes/agent-threads.js +93 -0
- package/dist/nodes/agent-threads.js.map +1 -0
- package/dist/nodes/agent-tool-hydration.d.ts +50 -0
- package/dist/nodes/agent-tool-hydration.d.ts.map +1 -0
- package/dist/nodes/agent-tool-hydration.js +106 -0
- package/dist/nodes/agent-tool-hydration.js.map +1 -0
- package/dist/nodes/agent-utils.d.ts +174 -0
- package/dist/nodes/agent-utils.d.ts.map +1 -0
- package/dist/nodes/agent-utils.js +553 -0
- package/dist/nodes/agent-utils.js.map +1 -0
- package/dist/nodes/agents.d.ts +402 -0
- package/dist/nodes/agents.d.ts.map +1 -0
- package/dist/nodes/agents.js +1491 -0
- package/dist/nodes/agents.js.map +1 -0
- package/dist/nodes/director.d.ts +126 -0
- package/dist/nodes/director.d.ts.map +1 -0
- package/dist/nodes/director.js +337 -0
- package/dist/nodes/director.js.map +1 -0
- package/dist/nodes/gemini.d.ts +171 -0
- package/dist/nodes/gemini.d.ts.map +1 -0
- package/dist/nodes/gemini.js +985 -0
- package/dist/nodes/gemini.js.map +1 -0
- package/dist/nodes/generators.d.ts +162 -0
- package/dist/nodes/generators.d.ts.map +1 -0
- package/dist/nodes/generators.js +966 -0
- package/dist/nodes/generators.js.map +1 -0
- package/dist/nodes/mistral.d.ts +109 -0
- package/dist/nodes/mistral.d.ts.map +1 -0
- package/dist/nodes/mistral.js +447 -0
- package/dist/nodes/mistral.js.map +1 -0
- package/dist/nodes/openai.d.ts +292 -0
- package/dist/nodes/openai.d.ts.map +1 -0
- package/dist/nodes/openai.js +1806 -0
- package/dist/nodes/openai.js.map +1 -0
- package/dist/nodes/provider-spend.d.ts +45 -0
- package/dist/nodes/provider-spend.d.ts.map +1 -0
- package/dist/nodes/provider-spend.js +69 -0
- package/dist/nodes/provider-spend.js.map +1 -0
- package/dist/nodes/shots.d.ts +108 -0
- package/dist/nodes/shots.d.ts.map +1 -0
- package/dist/nodes/shots.js +378 -0
- package/dist/nodes/shots.js.map +1 -0
- package/dist/nodes/xai.d.ts +99 -0
- package/dist/nodes/xai.d.ts.map +1 -0
- package/dist/nodes/xai.js +360 -0
- package/dist/nodes/xai.js.map +1 -0
- package/package.json +111 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nodetool-ai/llm-nodes — Shot pipeline nodes.
|
|
3
|
+
*
|
|
4
|
+
* ShotBatch flattens a {@link Screenplay} into generation-ready shot specs (one
|
|
5
|
+
* prompt + timing + optional keyframe per shot). ShotChain animates those specs
|
|
6
|
+
* into clips sequentially, feeding each clip's last frame into the next shot's
|
|
7
|
+
* first frame for cross-shot continuity. The pure helpers (toShotSpecs,
|
|
8
|
+
* planShotChain) carry the logic so they can be unit-tested without a provider.
|
|
9
|
+
*/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
import { BaseNode, prop } from "@nodetool-ai/node-sdk";
|
|
17
|
+
import { loadMediaRefBytes } from "@nodetool-ai/runtime";
|
|
18
|
+
import { isScreenplay } from "@nodetool-ai/protocol";
|
|
19
|
+
import { tagAsServer } from "@nodetool-ai/nodes-utils";
|
|
20
|
+
import { execFile as execFileCb } from "node:child_process";
|
|
21
|
+
import { promises as fs } from "node:fs";
|
|
22
|
+
import os from "node:os";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
import { promisify } from "node:util";
|
|
25
|
+
import { composeShotPrompt } from "./director.js";
|
|
26
|
+
import { isCallable, isNumber, isObjectLike, isRecord, isString } from "@nodetool-ai/node-sdk";
|
|
27
|
+
const execFile = promisify(execFileCb);
|
|
28
|
+
const DEFAULT_VIDEO_MODEL = {
|
|
29
|
+
type: "video_model",
|
|
30
|
+
provider: "gemini",
|
|
31
|
+
id: "veo-3.1-generate-preview",
|
|
32
|
+
name: "Veo 3.1 Preview",
|
|
33
|
+
path: null,
|
|
34
|
+
supported_tasks: []
|
|
35
|
+
};
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Pure helpers (unit-tested; no context / network dependency)
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
function str(value) {
|
|
40
|
+
return isString(value) ? value : "";
|
|
41
|
+
}
|
|
42
|
+
function optionalStr(value) {
|
|
43
|
+
const s = str(value).trim();
|
|
44
|
+
return s.length > 0 ? s : undefined;
|
|
45
|
+
}
|
|
46
|
+
function optionalNumber(value) {
|
|
47
|
+
const n = isNumber(value) ? value : Number(value);
|
|
48
|
+
return Number.isFinite(n) ? n : undefined;
|
|
49
|
+
}
|
|
50
|
+
function asImageRef(value) {
|
|
51
|
+
if (!isObjectLike(value))
|
|
52
|
+
return null;
|
|
53
|
+
// SAFETY: the model returns a ref-shaped object here; only its object-ness
|
|
54
|
+
// is checkable without duplicating the ImageRef schema. Widening to
|
|
55
|
+
// `unknown` first keeps this to one assertion — asserting the narrowed
|
|
56
|
+
// `Record<string, unknown>` straight to ImageRef does not compile, because
|
|
57
|
+
// the record has no `type` discriminator.
|
|
58
|
+
const ref = value;
|
|
59
|
+
return ref;
|
|
60
|
+
}
|
|
61
|
+
/** Coerce a screenplay-shaped value (typed or plain dict) to a {@link Shot}. */
|
|
62
|
+
function coerceShot(raw, index) {
|
|
63
|
+
const obj = isObjectLike(raw) ? raw : {};
|
|
64
|
+
const shot = {
|
|
65
|
+
type: "shot",
|
|
66
|
+
id: str(obj.id) || `shot-${index}`,
|
|
67
|
+
index: optionalNumber(obj.index) ?? index,
|
|
68
|
+
action: str(obj.action),
|
|
69
|
+
status: "planned"
|
|
70
|
+
};
|
|
71
|
+
if (isObjectLike(obj.camera)) {
|
|
72
|
+
shot.camera = obj.camera;
|
|
73
|
+
}
|
|
74
|
+
const motion = optionalStr(obj.motion);
|
|
75
|
+
if (motion)
|
|
76
|
+
shot.motion = motion;
|
|
77
|
+
const duration = optionalNumber(obj.duration_seconds);
|
|
78
|
+
if (duration !== undefined)
|
|
79
|
+
shot.duration_seconds = duration;
|
|
80
|
+
const keyframe = asImageRef(obj.keyframe);
|
|
81
|
+
if (keyframe)
|
|
82
|
+
shot.keyframe = keyframe;
|
|
83
|
+
return shot;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Coerce any screenplay-shaped input (a typed {@link Screenplay} or a plain
|
|
87
|
+
* dict) to a Screenplay, preserving each shot's keyframe. Unlike the Director's
|
|
88
|
+
* `parseScreenplay`, this never clamps or drops keyframes — it feeds the shot
|
|
89
|
+
* chain, which must keep the storyboard stills.
|
|
90
|
+
*/
|
|
91
|
+
function coerceScreenplay(raw) {
|
|
92
|
+
if (isScreenplay(raw))
|
|
93
|
+
return raw;
|
|
94
|
+
const obj = isRecord(raw) ? raw : {};
|
|
95
|
+
const rawShots = Array.isArray(obj.shots) ? obj.shots : [];
|
|
96
|
+
const screenplay = {
|
|
97
|
+
type: "screenplay",
|
|
98
|
+
id: str(obj.id) || "screenplay-1",
|
|
99
|
+
title: str(obj.title) || "Untitled Screenplay",
|
|
100
|
+
shots: rawShots.map((rawShot, i) => coerceShot(rawShot, i))
|
|
101
|
+
};
|
|
102
|
+
const styleBible = optionalStr(obj.style_bible);
|
|
103
|
+
if (styleBible)
|
|
104
|
+
screenplay.style_bible = styleBible;
|
|
105
|
+
const aspectRatio = optionalStr(obj.aspect_ratio);
|
|
106
|
+
if (aspectRatio)
|
|
107
|
+
screenplay.aspect_ratio = aspectRatio;
|
|
108
|
+
return screenplay;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Flatten a screenplay into one generation-ready {@link ShotSpec} per shot:
|
|
112
|
+
* a composed prompt, the shared aspect ratio, a per-shot (or default) duration,
|
|
113
|
+
* and the shot's keyframe when it already has one.
|
|
114
|
+
*/
|
|
115
|
+
export function toShotSpecs(screenplay, opts = {}) {
|
|
116
|
+
const sp = coerceScreenplay(screenplay);
|
|
117
|
+
const aspectRatio = optionalStr(opts.aspectRatio) ?? sp.aspect_ratio ?? "16:9";
|
|
118
|
+
const defaultDuration = optionalNumber(opts.defaultDuration) !== undefined
|
|
119
|
+
? opts.defaultDuration
|
|
120
|
+
: 4;
|
|
121
|
+
return sp.shots.map((shot) => ({
|
|
122
|
+
index: shot.index,
|
|
123
|
+
prompt: composeShotPrompt(shot, sp),
|
|
124
|
+
aspect_ratio: aspectRatio,
|
|
125
|
+
duration_seconds: shot.duration_seconds ?? defaultDuration,
|
|
126
|
+
keyframe: shot.keyframe ?? null
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Plan the seeding order for a sequential shot chain: the first shot is seeded
|
|
131
|
+
* from its own keyframe (or nothing when it has none); every later shot is
|
|
132
|
+
* seeded from the previous clip's last frame for continuity.
|
|
133
|
+
*/
|
|
134
|
+
export function planShotChain(specs) {
|
|
135
|
+
const list = Array.isArray(specs) ? specs : [];
|
|
136
|
+
return list.map((spec, i) => ({
|
|
137
|
+
index: spec.index ?? i,
|
|
138
|
+
seedFrom: i === 0 ? (spec.keyframe ? "keyframe" : "none") : "previous"
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
export class ShotBatchNode extends BaseNode {
|
|
142
|
+
static nodeType = "nodetool.creative.ShotBatch";
|
|
143
|
+
static title = "Shot Batch";
|
|
144
|
+
static description = "Flatten a screenplay into generation-ready shot specs (prompt, timing, keyframe).\n creative, shots, batch, screenplay, prompts\n\n Use cases:\n - Preparing a screenplay's shots for batch keyframe/clip generation\n - Producing one prompt + duration per shot in a single list\n - Feeding the Shot Chain node a ready-to-render spec list";
|
|
145
|
+
static metadataOutputTypes = {
|
|
146
|
+
shots: "list[dict]"
|
|
147
|
+
};
|
|
148
|
+
static inlineFields = [];
|
|
149
|
+
static inputFields = ["screenplay"];
|
|
150
|
+
async process() {
|
|
151
|
+
const shots = toShotSpecs(this.screenplay, {
|
|
152
|
+
aspectRatio: str(this.aspect_ratio ?? "").trim() || "16:9",
|
|
153
|
+
defaultDuration: Number(this.default_duration ?? 4)
|
|
154
|
+
});
|
|
155
|
+
return { shots };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
__decorate([
|
|
159
|
+
prop({
|
|
160
|
+
type: "dict",
|
|
161
|
+
default: {},
|
|
162
|
+
title: "Screenplay",
|
|
163
|
+
description: "The screenplay to flatten into per-shot generation specs."
|
|
164
|
+
})
|
|
165
|
+
], ShotBatchNode.prototype, "screenplay", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
prop({
|
|
168
|
+
type: "str",
|
|
169
|
+
default: "16:9",
|
|
170
|
+
title: "Aspect Ratio",
|
|
171
|
+
description: "Aspect ratio applied to every shot spec (e.g. 16:9, 9:16, 1:1)."
|
|
172
|
+
})
|
|
173
|
+
], ShotBatchNode.prototype, "aspect_ratio", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
prop({
|
|
176
|
+
type: "int",
|
|
177
|
+
default: 4,
|
|
178
|
+
title: "Default Duration",
|
|
179
|
+
description: "Clip length in seconds for shots without their own duration.",
|
|
180
|
+
min: 1,
|
|
181
|
+
max: 60
|
|
182
|
+
})
|
|
183
|
+
], ShotBatchNode.prototype, "default_duration", void 0);
|
|
184
|
+
export class ShotChainNode extends BaseNode {
|
|
185
|
+
static nodeType = "nodetool.creative.ShotChain";
|
|
186
|
+
static title = "Shot Chain";
|
|
187
|
+
static description = "Animate a list of shot specs into clips sequentially, seeding each shot's first frame from the previous clip's last frame for continuity.\n creative, shots, video, continuity, chain\n\n Use cases:\n - Turning a storyboard's shots into a continuous animated sequence\n - Keeping motion and framing consistent across generated clips\n - Rendering a directed shot list into a cut-ready set of videos";
|
|
188
|
+
static requiredRuntimes = ["ffmpeg"];
|
|
189
|
+
static metadataOutputTypes = {
|
|
190
|
+
videos: "list[video]"
|
|
191
|
+
};
|
|
192
|
+
static inlineFields = [];
|
|
193
|
+
static inputFields = ["shots"];
|
|
194
|
+
async process(context) {
|
|
195
|
+
const specs = (Array.isArray(this.shots) ? this.shots : []).map((raw, i) => coerceSpec(raw, i));
|
|
196
|
+
const plan = planShotChain(specs);
|
|
197
|
+
const videos = [];
|
|
198
|
+
let lastFrame = null;
|
|
199
|
+
// plan[i] describes specs[i] positionally; step.index is the shot's own
|
|
200
|
+
// label and must not be used as an array subscript (subset/reordered
|
|
201
|
+
// lists would pair the wrong spec).
|
|
202
|
+
for (let i = 0; i < plan.length; i += 1) {
|
|
203
|
+
const step = plan[i];
|
|
204
|
+
const spec = specs[i];
|
|
205
|
+
if (!spec)
|
|
206
|
+
continue;
|
|
207
|
+
const startImage = step.seedFrom === "keyframe"
|
|
208
|
+
? spec.keyframe
|
|
209
|
+
: step.seedFrom === "previous"
|
|
210
|
+
? lastFrame
|
|
211
|
+
: null;
|
|
212
|
+
const clip = await this.generateClip(context, spec, startImage);
|
|
213
|
+
videos.push(clip);
|
|
214
|
+
lastFrame = await this.extractLastFrame(clip, context);
|
|
215
|
+
}
|
|
216
|
+
return { videos };
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Wrap the same provider path ImageToVideo uses: dispatch the model's
|
|
220
|
+
* `image_to_video` capability with the shot prompt, the seed image bytes, and
|
|
221
|
+
* this node's aspect ratio / resolution / the shot's duration.
|
|
222
|
+
*/
|
|
223
|
+
async generateClip(context, spec, startImage) {
|
|
224
|
+
const images = [];
|
|
225
|
+
if (startImage) {
|
|
226
|
+
const bytes = await loadMediaRefBytes(startImage, context);
|
|
227
|
+
if (bytes && bytes.length > 0)
|
|
228
|
+
images.push(bytes);
|
|
229
|
+
}
|
|
230
|
+
// A seeded shot may need a different model id from an unseeded one. One
|
|
231
|
+
// `video_model` prop is enough for Gemini/Veo, where a single id serves
|
|
232
|
+
// both capabilities; kie publishes `kling-2.6/text-to-video` and
|
|
233
|
+
// `kling-2.6/image-to-video` as separate endpoints and submits whichever
|
|
234
|
+
// id it is handed, so chaining there needs both. Falls back to `model`,
|
|
235
|
+
// which keeps every existing graph behaving exactly as before.
|
|
236
|
+
const seeded = images.length > 0;
|
|
237
|
+
const chosen = seeded && str(this.continuation_model?.id)
|
|
238
|
+
? this.continuation_model
|
|
239
|
+
: this.model;
|
|
240
|
+
const providerId = str(chosen?.provider);
|
|
241
|
+
const modelId = str(chosen?.id);
|
|
242
|
+
if (!context ||
|
|
243
|
+
!isCallable(context.runProviderPrediction) ||
|
|
244
|
+
!providerId ||
|
|
245
|
+
!modelId) {
|
|
246
|
+
throw new Error("No provider available for shot chain generation.");
|
|
247
|
+
}
|
|
248
|
+
// `planShotChain` already says the first shot has nothing to seed from
|
|
249
|
+
// ("none" when the screenplay carries no keyframe), and this call has to
|
|
250
|
+
// agree with it. Asking for `image_to_video` with an empty image list is
|
|
251
|
+
// not a soft no-op: the kie provider throws "The input image is empty."
|
|
252
|
+
// and gemini/veo silently produced an unseeded clip, which is why the
|
|
253
|
+
// mismatch survived. Route the unseeded shot to `text_to_video` — the
|
|
254
|
+
// capability it actually is — and keep continuity on every later shot.
|
|
255
|
+
const shotSettings = {
|
|
256
|
+
prompt: spec.prompt,
|
|
257
|
+
aspect_ratio: str(this.aspect_ratio ?? "").trim() || spec.aspect_ratio,
|
|
258
|
+
resolution: str(this.resolution ?? "").trim() || "720p",
|
|
259
|
+
duration_seconds: Number(spec.duration_seconds) || undefined
|
|
260
|
+
};
|
|
261
|
+
const output = await context.runProviderPrediction({
|
|
262
|
+
provider: providerId,
|
|
263
|
+
capability: seeded ? "image_to_video" : "text_to_video",
|
|
264
|
+
model: modelId,
|
|
265
|
+
// An unseeded shot sends no `images` key at all, which is what routes
|
|
266
|
+
// it to `text_to_video` above.
|
|
267
|
+
params: seeded ? { images, ...shotSettings } : shotSettings
|
|
268
|
+
});
|
|
269
|
+
const bytes = coerceProviderBytes(output);
|
|
270
|
+
return {
|
|
271
|
+
type: "video",
|
|
272
|
+
data: Buffer.from(bytes).toString("base64")
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Extract the clip's last frame (the seed for the next shot). Mirrors the
|
|
277
|
+
* ExtractFrame node's ffmpeg approach, seeking near the end and letting
|
|
278
|
+
* `-update 1` leave the final decoded frame. Returns null when the frame
|
|
279
|
+
* cannot be produced, so the chain simply drops continuity for that step.
|
|
280
|
+
*/
|
|
281
|
+
async extractLastFrame(clip, context) {
|
|
282
|
+
const bytes = await loadMediaRefBytes(clip, context);
|
|
283
|
+
if (!bytes || bytes.length === 0)
|
|
284
|
+
return null;
|
|
285
|
+
const workDir = await fs.mkdtemp(path.join(os.tmpdir(), "nodetool-shotchain-"));
|
|
286
|
+
const inputPath = path.join(workDir, "clip.mp4");
|
|
287
|
+
const outputPath = path.join(workDir, "last.png");
|
|
288
|
+
try {
|
|
289
|
+
await fs.writeFile(inputPath, bytes);
|
|
290
|
+
await execFile("ffmpeg", [
|
|
291
|
+
"-y",
|
|
292
|
+
"-sseof",
|
|
293
|
+
"-1",
|
|
294
|
+
"-i",
|
|
295
|
+
inputPath,
|
|
296
|
+
"-update",
|
|
297
|
+
"1",
|
|
298
|
+
"-frames:v",
|
|
299
|
+
"1",
|
|
300
|
+
outputPath
|
|
301
|
+
], { maxBuffer: 10 * 1024 * 1024 });
|
|
302
|
+
const frame = new Uint8Array(await fs.readFile(outputPath));
|
|
303
|
+
return {
|
|
304
|
+
type: "image",
|
|
305
|
+
data: Buffer.from(frame).toString("base64")
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
// A frame we cannot extract just means this step loses continuity — the
|
|
310
|
+
// next shot falls back to a text-only animation instead of failing.
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
finally {
|
|
314
|
+
await fs.rm(workDir, { recursive: true, force: true });
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
__decorate([
|
|
319
|
+
prop({
|
|
320
|
+
type: "video_model",
|
|
321
|
+
default: DEFAULT_VIDEO_MODEL,
|
|
322
|
+
title: "Model",
|
|
323
|
+
description: "The video generation model used to animate each shot."
|
|
324
|
+
})
|
|
325
|
+
], ShotChainNode.prototype, "model", void 0);
|
|
326
|
+
__decorate([
|
|
327
|
+
prop({
|
|
328
|
+
type: "video_model",
|
|
329
|
+
default: { type: "video_model" },
|
|
330
|
+
title: "Continuation Model",
|
|
331
|
+
description: "Model for shots seeded from the previous clip's last frame. Leave empty to reuse Model. Needed only where a provider splits text-to-video and image-to-video across different model ids — kie does (kling-2.6/text-to-video vs kling-2.6/image-to-video), Gemini/Veo does not."
|
|
332
|
+
})
|
|
333
|
+
], ShotChainNode.prototype, "continuation_model", void 0);
|
|
334
|
+
__decorate([
|
|
335
|
+
prop({
|
|
336
|
+
type: "list[dict]",
|
|
337
|
+
default: [],
|
|
338
|
+
title: "Shots",
|
|
339
|
+
description: "Shot specs (from Shot Batch): each with a prompt, optional keyframe, and duration."
|
|
340
|
+
})
|
|
341
|
+
], ShotChainNode.prototype, "shots", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
prop({
|
|
344
|
+
type: "str",
|
|
345
|
+
default: "16:9",
|
|
346
|
+
title: "Aspect Ratio",
|
|
347
|
+
description: "Aspect ratio for the generated clips (e.g. 16:9, 9:16, 1:1)."
|
|
348
|
+
})
|
|
349
|
+
], ShotChainNode.prototype, "aspect_ratio", void 0);
|
|
350
|
+
__decorate([
|
|
351
|
+
prop({
|
|
352
|
+
type: "str",
|
|
353
|
+
default: "720p",
|
|
354
|
+
title: "Resolution",
|
|
355
|
+
description: "Resolution for the generated clips (e.g. 720p, 1080p)."
|
|
356
|
+
})
|
|
357
|
+
], ShotChainNode.prototype, "resolution", void 0);
|
|
358
|
+
/** Coerce a raw list[dict] item into a {@link ShotSpec}. */
|
|
359
|
+
function coerceSpec(raw, index) {
|
|
360
|
+
const obj = isObjectLike(raw) ? raw : {};
|
|
361
|
+
return {
|
|
362
|
+
index: optionalNumber(obj.index) ?? index,
|
|
363
|
+
prompt: str(obj.prompt),
|
|
364
|
+
aspect_ratio: optionalStr(obj.aspect_ratio) ?? "16:9",
|
|
365
|
+
duration_seconds: optionalNumber(obj.duration_seconds) ?? 4,
|
|
366
|
+
keyframe: asImageRef(obj.keyframe)
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
/** Normalize provider-prediction output to `Uint8Array`. */
|
|
370
|
+
function coerceProviderBytes(value) {
|
|
371
|
+
if (value instanceof Uint8Array)
|
|
372
|
+
return value;
|
|
373
|
+
if (value instanceof ArrayBuffer)
|
|
374
|
+
return new Uint8Array(value);
|
|
375
|
+
throw new Error("Shot Chain: provider returned no video bytes (expected Uint8Array/Buffer).");
|
|
376
|
+
}
|
|
377
|
+
export const SHOTS_NODES = tagAsServer([ShotBatchNode, ShotChainNode]);
|
|
378
|
+
//# sourceMappingURL=shots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shots.js","sourceRoot":"","sources":["../../src/nodes/shots.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;;;;;;;AAEH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,QAAQ,EACT,MAAM,uBAAuB,CAAC;AAE/B,MAAM,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAYvC,MAAM,mBAAmB,GAAkB;IACzC,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,QAAQ;IAClB,EAAE,EAAE,0BAA0B;IAC9B,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,IAAI;IACV,eAAe,EA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MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC;QACvB,YAAY,EAAE,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,MAAM;QACrD,gBAAgB,EAAE,cAAc,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC;QAC3D,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC;KACnC,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,KAAK,YAAY,UAAU;QAAE,OAAO,KAAK,CAAC;IAC9C,IAAI,KAAK,YAAY,WAAW;QAAE,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/D,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { BaseNode } from "@nodetool-ai/node-sdk";
|
|
2
|
+
import type { ImageRef } from "@nodetool-ai/node-sdk";
|
|
3
|
+
/** Output handles ChatComplete.process() emits. */
|
|
4
|
+
type ChatCompleteOutputs = {
|
|
5
|
+
output: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class ChatComplete extends BaseNode {
|
|
8
|
+
static readonly nodeType = "xai.text.ChatComplete";
|
|
9
|
+
static readonly body = "content_card";
|
|
10
|
+
static readonly title = "Chat Complete";
|
|
11
|
+
static readonly description = "Generate text using xAI's Grok chat completion models.\n xai, grok, chat, ai, text generation, llm, completion\n\n Uses xAI's Grok models to generate responses from prompts via the\n OpenAI-compatible chat completions endpoint. Requires an xAI API key.\n\n Use cases:\n - Generate text responses to prompts\n - Build conversational AI applications\n - Summarize, rewrite, and classify text\n - Reasoning tasks with Grok models";
|
|
12
|
+
static readonly metadataOutputTypes: {
|
|
13
|
+
output: string;
|
|
14
|
+
};
|
|
15
|
+
static readonly inlineFields: never[];
|
|
16
|
+
static readonly inputFields: string[];
|
|
17
|
+
static readonly requiredSettings: string[];
|
|
18
|
+
model: string;
|
|
19
|
+
prompt: string;
|
|
20
|
+
system_prompt: string;
|
|
21
|
+
temperature: number;
|
|
22
|
+
max_tokens: number;
|
|
23
|
+
process(): Promise<ChatCompleteOutputs>;
|
|
24
|
+
}
|
|
25
|
+
/** Output handles WebSearch.process() emits. */
|
|
26
|
+
type WebSearchOutputs = {
|
|
27
|
+
output: string;
|
|
28
|
+
citations: string[];
|
|
29
|
+
};
|
|
30
|
+
export declare class WebSearch extends BaseNode {
|
|
31
|
+
static readonly nodeType = "xai.text.WebSearch";
|
|
32
|
+
static readonly body = "content_card";
|
|
33
|
+
static readonly title = "Web Search";
|
|
34
|
+
static readonly description = "Answer questions using Grok with xAI Live Search over the web and X.\n xai, grok, search, web, live, realtime, citations\n\n Uses xAI's Live Search (search_parameters) so Grok can pull in\n real-time information from the web and X to answer the query.\n Requires an xAI API key.\n\n Use cases:\n - Answer questions about current events\n - Research with up-to-date sources\n - Summarize recent news";
|
|
35
|
+
static readonly metadataOutputTypes: {
|
|
36
|
+
output: string;
|
|
37
|
+
citations: string;
|
|
38
|
+
};
|
|
39
|
+
static readonly inlineFields: string[];
|
|
40
|
+
static readonly inputFields: string[];
|
|
41
|
+
static readonly requiredSettings: string[];
|
|
42
|
+
model: string;
|
|
43
|
+
query: string;
|
|
44
|
+
search_mode: string;
|
|
45
|
+
max_results: number;
|
|
46
|
+
process(): Promise<WebSearchOutputs>;
|
|
47
|
+
}
|
|
48
|
+
/** Output handles ImageToText.process() emits. */
|
|
49
|
+
type ImageToTextOutputs = {
|
|
50
|
+
output: string;
|
|
51
|
+
};
|
|
52
|
+
export declare class ImageToText extends BaseNode {
|
|
53
|
+
static readonly nodeType = "xai.vision.ImageToText";
|
|
54
|
+
static readonly title = "Image To Text";
|
|
55
|
+
static readonly description = "Analyze images and generate text using xAI's Grok vision models.\n xai, grok, vision, image, ocr, analysis, multimodal\n\n Uses Grok's multimodal models to understand and describe images via the\n OpenAI-compatible chat completions endpoint. Can perform OCR, image\n analysis, and answer questions about images. Requires an xAI API key.\n\n Use cases:\n - Describe image contents\n - Answer questions about images\n - Extract text from images (OCR)\n - Analyze charts and diagrams";
|
|
56
|
+
static readonly metadataOutputTypes: {
|
|
57
|
+
output: string;
|
|
58
|
+
};
|
|
59
|
+
static readonly inlineFields: never[];
|
|
60
|
+
static readonly inputFields: string[];
|
|
61
|
+
static readonly requiredSettings: string[];
|
|
62
|
+
image: ImageRef;
|
|
63
|
+
prompt: string;
|
|
64
|
+
model: string;
|
|
65
|
+
temperature: number;
|
|
66
|
+
max_tokens: number;
|
|
67
|
+
process(): Promise<ImageToTextOutputs>;
|
|
68
|
+
}
|
|
69
|
+
/** Output handles GenerateImage.process() emits. */
|
|
70
|
+
type GenerateImageOutputs = {
|
|
71
|
+
output: {
|
|
72
|
+
type: string;
|
|
73
|
+
data: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: string;
|
|
76
|
+
uri: string;
|
|
77
|
+
};
|
|
78
|
+
revised_prompt: string;
|
|
79
|
+
};
|
|
80
|
+
export declare class GenerateImage extends BaseNode {
|
|
81
|
+
static readonly nodeType = "xai.image.GenerateImage";
|
|
82
|
+
static readonly body = "content_card";
|
|
83
|
+
static readonly title = "Generate Image";
|
|
84
|
+
static readonly description = "Generate images from text using xAI's Grok image models.\n xai, grok, image, t2i, text-to-image, create, generate, picture, art\n\n Uses xAI's OpenAI-compatible image generations endpoint. The model\n automatically revises the prompt; the revised prompt is returned as a\n second output. Requires an xAI API key.";
|
|
85
|
+
static readonly metadataOutputTypes: {
|
|
86
|
+
output: string;
|
|
87
|
+
revised_prompt: string;
|
|
88
|
+
};
|
|
89
|
+
static readonly inlineFields: never[];
|
|
90
|
+
static readonly inputFields: string[];
|
|
91
|
+
static readonly requiredSettings: string[];
|
|
92
|
+
static readonly autoSaveAsset = true;
|
|
93
|
+
prompt: string;
|
|
94
|
+
model: string;
|
|
95
|
+
process(): Promise<GenerateImageOutputs>;
|
|
96
|
+
}
|
|
97
|
+
export declare const XAI_NODES: (typeof ChatComplete | typeof WebSearch | typeof ImageToText | typeof GenerateImage)[];
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=xai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xai.d.ts","sourceRoot":"","sources":["../../src/nodes/xai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AA0DtD,mDAAmD;AACnD,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,YAAa,SAAQ,QAAQ;IACxC,MAAM,CAAC,QAAQ,CAAC,QAAQ,2BAA2B;IACnD,MAAM,CAAC,QAAQ,CAAC,IAAI,kBAAkB;IACtC,MAAM,CAAC,QAAQ,CAAC,KAAK,mBAAmB;IACxC,MAAM,CAAC,QAAQ,CAAC,WAAW,wcAC4a;IACvc,MAAM,CAAC,QAAQ,CAAC,mBAAmB;QACjC,MAAM;MACN;IACF,MAAM,CAAC,QAAQ,CAAC,YAAY,UAAM;IAClC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAA+B;IACpE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,WAAmB;IAS3C,KAAK,EAAE,MAAM,CAAC;IAQd,MAAM,EAAE,MAAM,CAAC;IAQf,aAAa,EAAE,MAAM,CAAC;IAUtB,WAAW,EAAE,MAAM,CAAC;IAUpB,UAAU,EAAE,MAAM,CAAC;IAErB,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAsB5C;CACF;AAID,gDAAgD;AAChD,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EA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