@nodetool-ai/reve-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 +34 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/create-image.d.ts +28 -0
- package/dist/nodes/create-image.d.ts.map +1 -0
- package/dist/nodes/create-image.js +84 -0
- package/dist/nodes/create-image.js.map +1 -0
- package/dist/nodes/edit-image.d.ts +30 -0
- package/dist/nodes/edit-image.d.ts.map +1 -0
- package/dist/nodes/edit-image.js +107 -0
- package/dist/nodes/edit-image.js.map +1 -0
- package/dist/nodes/remix-image.d.ts +30 -0
- package/dist/nodes/remix-image.d.ts.map +1 -0
- package/dist/nodes/remix-image.js +113 -0
- package/dist/nodes/remix-image.js.map +1 -0
- package/dist/reve-base.d.ts +93 -0
- package/dist/reve-base.d.ts.map +1 -0
- package/dist/reve-base.js +131 -0
- package/dist/reve-base.js.map +1 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @nodetool-ai/reve-nodes
|
|
2
|
+
|
|
3
|
+
[Reve](https://reve.com) image generation, editing, and remix nodes for NodeTool.
|
|
4
|
+
|
|
5
|
+
Wraps Reve's image API (https://api.reve.com/console/docs) and exposes three
|
|
6
|
+
workflow nodes:
|
|
7
|
+
|
|
8
|
+
| Node | Node type | Endpoint | Description |
|
|
9
|
+
| ---------------- | ----------------- | ------------------- | ----------------------------------------------- |
|
|
10
|
+
| **Create Image** | `reve.CreateImage` | `POST /v1/image/create` | Generate an image from a text prompt. |
|
|
11
|
+
| **Edit Image** | `reve.EditImage` | `POST /v1/image/edit` | Edit a reference image with a text instruction. |
|
|
12
|
+
| **Remix Image** | `reve.RemixImage` | `POST /v1/image/remix` | Combine a prompt with 1–6 reference images. |
|
|
13
|
+
|
|
14
|
+
## Configuration
|
|
15
|
+
|
|
16
|
+
Set the `REVE_API_KEY` secret (Settings → API Keys, or the `REVE_API_KEY`
|
|
17
|
+
environment variable). Requests authenticate with `Authorization: Bearer
|
|
18
|
+
<REVE_API_KEY>`.
|
|
19
|
+
|
|
20
|
+
## Shared parameters
|
|
21
|
+
|
|
22
|
+
- **aspect_ratio** — one of `16:9`, `9:16`, `3:2`, `2:3`, `4:3`, `3:4`, `1:1`.
|
|
23
|
+
Edit/Remix also accept `none` (keep the reference ratio / let the model
|
|
24
|
+
choose).
|
|
25
|
+
- **version** — model version (`latest`, dated pins, and the `-fast` variants
|
|
26
|
+
for edit/remix).
|
|
27
|
+
- **postprocessing** — optional `upscale`, `remove_background`, `fit_image`, or
|
|
28
|
+
`effect`.
|
|
29
|
+
- **test_time_scaling** — quality/effort multiplier (1–15).
|
|
30
|
+
|
|
31
|
+
## Remix prompt references
|
|
32
|
+
|
|
33
|
+
In Remix, reference individual images by index with XML tags:
|
|
34
|
+
`A cat wearing <img>0</img> in the style of <img>1</img>` (0 = first image).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2026-09-28T09:19:07.609Z
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NodeClass } from "@nodetool-ai/node-sdk";
|
|
2
|
+
export { CreateImageNode } from "./nodes/create-image.js";
|
|
3
|
+
export { EditImageNode } from "./nodes/edit-image.js";
|
|
4
|
+
export { RemixImageNode } from "./nodes/remix-image.js";
|
|
5
|
+
export * from "./reve-base.js";
|
|
6
|
+
export declare const REVE_NODES: readonly NodeClass[];
|
|
7
|
+
export declare function registerReveNodes(registry: {
|
|
8
|
+
register: (nodeClass: NodeClass) => void;
|
|
9
|
+
}): void;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,cAAc,gBAAgB,CAAC;AAE/B,eAAO,MAAM,UAAU,EAAE,SAAS,SAAS,EAI1C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE;IAC1C,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CAC1C,GAAG,IAAI,CAIP"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CREATE_IMAGE_NODES } from "./nodes/create-image.js";
|
|
2
|
+
import { EDIT_IMAGE_NODES } from "./nodes/edit-image.js";
|
|
3
|
+
import { REMIX_IMAGE_NODES } from "./nodes/remix-image.js";
|
|
4
|
+
export { CreateImageNode } from "./nodes/create-image.js";
|
|
5
|
+
export { EditImageNode } from "./nodes/edit-image.js";
|
|
6
|
+
export { RemixImageNode } from "./nodes/remix-image.js";
|
|
7
|
+
export * from "./reve-base.js";
|
|
8
|
+
export const REVE_NODES = [
|
|
9
|
+
...CREATE_IMAGE_NODES,
|
|
10
|
+
...EDIT_IMAGE_NODES,
|
|
11
|
+
...REMIX_IMAGE_NODES
|
|
12
|
+
];
|
|
13
|
+
export function registerReveNodes(registry) {
|
|
14
|
+
for (const nodeClass of REVE_NODES) {
|
|
15
|
+
registry.register(nodeClass);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,cAAc,gBAAgB,CAAC;AAE/B,MAAM,CAAC,MAAM,UAAU,GAAyB;IAC9C,GAAG,kBAAkB;IACrB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB;CACrB,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,QAEjC;IACC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseNode } from "@nodetool-ai/node-sdk";
|
|
2
|
+
import type { NodeClass } from "@nodetool-ai/node-sdk";
|
|
3
|
+
import { type ReveImageRef } from "../reve-base.js";
|
|
4
|
+
/** Output handles CreateImageNode.process() emits. */
|
|
5
|
+
type CreateImageNodeOutputs = {
|
|
6
|
+
output: ReveImageRef;
|
|
7
|
+
};
|
|
8
|
+
export declare class CreateImageNode extends BaseNode {
|
|
9
|
+
static readonly nodeType = "reve.CreateImage";
|
|
10
|
+
static readonly body = "content_card";
|
|
11
|
+
static readonly title = "Create Image";
|
|
12
|
+
static readonly description: string;
|
|
13
|
+
static readonly metadataOutputTypes: {
|
|
14
|
+
output: string;
|
|
15
|
+
};
|
|
16
|
+
static readonly inlineFields: string[];
|
|
17
|
+
static readonly requiredSettings: string[];
|
|
18
|
+
static readonly autoSaveAsset = true;
|
|
19
|
+
prompt: any;
|
|
20
|
+
aspect_ratio: any;
|
|
21
|
+
version: any;
|
|
22
|
+
postprocessing: any;
|
|
23
|
+
test_time_scaling: any;
|
|
24
|
+
process(): Promise<CreateImageNodeOutputs>;
|
|
25
|
+
}
|
|
26
|
+
export declare const CREATE_IMAGE_NODES: readonly NodeClass[];
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=create-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-image.d.ts","sourceRoot":"","sources":["../../src/nodes/create-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,sDAAsD;AACtD,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,MAAM,CAAC,QAAQ,CAAC,QAAQ,sBAAsB;IAC9C,MAAM,CAAC,QAAQ,CAAC,IAAI,kBAAkB;IACtC,MAAM,CAAC,QAAQ,CAAC,KAAK,kBAAkB;IACvC,MAAM,CAAC,QAAQ,CAAC,WAAW,SAMa;IACxC,MAAM,CAAC,QAAQ,CAAC,mBAAmB;QAAK,MAAM;MAAY;IAC1D,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAc;IACpD,MAAM,CAAC,QAAQ,CAAC,gBAAgB,WAAoB;IACpD,MAAM,CAAC,QAAQ,CAAC,aAAa,QAAQ;IAQ7B,MAAM,EAAE,GAAG,CAAC;IASZ,YAAY,EAAE,GAAG,CAAC;IASlB,OAAO,EAAE,GAAG,CAAC;IASb,cAAc,EAAE,GAAG,CAAC;IAUpB,iBAAiB,EAAE,GAAG,CAAC;IAEzB,OAAO,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAe/C;CACF;AAED,eAAO,MAAM,kBAAkB,EAAE,SAAS,SAAS,EAAsB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseNode, prop } from "@nodetool-ai/node-sdk";
|
|
8
|
+
import { getReveApiKey, postprocessingArray, reveGenerate, reveImageToRef, REVE_ASPECT_RATIOS, REVE_POSTPROCESSING } from "../reve-base.js";
|
|
9
|
+
export class CreateImageNode extends BaseNode {
|
|
10
|
+
static nodeType = "reve.CreateImage";
|
|
11
|
+
static body = "content_card";
|
|
12
|
+
static title = "Create Image";
|
|
13
|
+
static description = "Generate an image from a text prompt using Reve.\n" +
|
|
14
|
+
"image, generate, text-to-image, reve\n\n" +
|
|
15
|
+
"Use cases:\n" +
|
|
16
|
+
"- Produce images with strong prompt adherence\n" +
|
|
17
|
+
"- Render legible typography and posters\n" +
|
|
18
|
+
"- Create on-brand marketing visuals";
|
|
19
|
+
static metadataOutputTypes = { output: "image" };
|
|
20
|
+
static inlineFields = ["prompt"];
|
|
21
|
+
static requiredSettings = ["REVE_API_KEY"];
|
|
22
|
+
static autoSaveAsset = true;
|
|
23
|
+
async process() {
|
|
24
|
+
const apiKey = getReveApiKey(this._secrets);
|
|
25
|
+
const prompt = String(this.prompt ?? "");
|
|
26
|
+
if (!prompt)
|
|
27
|
+
throw new Error("Prompt is required");
|
|
28
|
+
const result = await reveGenerate(apiKey, "create", {
|
|
29
|
+
prompt,
|
|
30
|
+
aspect_ratio: String(this.aspect_ratio ?? "3:2"),
|
|
31
|
+
version: String(this.version ?? "latest"),
|
|
32
|
+
postprocessing: postprocessingArray(this.postprocessing),
|
|
33
|
+
test_time_scaling: Number(this.test_time_scaling ?? 1)
|
|
34
|
+
});
|
|
35
|
+
return { output: await reveImageToRef(result.image) };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
__decorate([
|
|
39
|
+
prop({
|
|
40
|
+
type: "str",
|
|
41
|
+
default: "",
|
|
42
|
+
title: "Prompt",
|
|
43
|
+
description: "Text description of the image to generate (max 2560 chars)."
|
|
44
|
+
})
|
|
45
|
+
], CreateImageNode.prototype, "prompt", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
prop({
|
|
48
|
+
type: "enum",
|
|
49
|
+
default: "3:2",
|
|
50
|
+
title: "Aspect Ratio",
|
|
51
|
+
description: "Proportions of the generated image.",
|
|
52
|
+
values: [...REVE_ASPECT_RATIOS]
|
|
53
|
+
})
|
|
54
|
+
], CreateImageNode.prototype, "aspect_ratio", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
prop({
|
|
57
|
+
type: "enum",
|
|
58
|
+
default: "latest",
|
|
59
|
+
title: "Version",
|
|
60
|
+
description: "Model version to use.",
|
|
61
|
+
values: ["latest", "reve-create@20250915"]
|
|
62
|
+
})
|
|
63
|
+
], CreateImageNode.prototype, "version", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
prop({
|
|
66
|
+
type: "enum",
|
|
67
|
+
default: "none",
|
|
68
|
+
title: "Postprocessing",
|
|
69
|
+
description: "Optional postprocessing operation applied to the result.",
|
|
70
|
+
values: [...REVE_POSTPROCESSING]
|
|
71
|
+
})
|
|
72
|
+
], CreateImageNode.prototype, "postprocessing", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
prop({
|
|
75
|
+
type: "int",
|
|
76
|
+
default: 1,
|
|
77
|
+
title: "Test Time Scaling",
|
|
78
|
+
description: "Effort multiplier for quality (1-15). Higher costs more.",
|
|
79
|
+
min: 1,
|
|
80
|
+
max: 15
|
|
81
|
+
})
|
|
82
|
+
], CreateImageNode.prototype, "test_time_scaling", void 0);
|
|
83
|
+
export const CREATE_IMAGE_NODES = [CreateImageNode];
|
|
84
|
+
//# sourceMappingURL=create-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-image.js","sourceRoot":"","sources":["../../src/nodes/create-image.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAC3C,MAAM,CAAU,QAAQ,GAAG,kBAAkB,CAAC;IAC9C,MAAM,CAAU,IAAI,GAAG,cAAc,CAAC;IACtC,MAAM,CAAU,KAAK,GAAG,cAAc,CAAC;IACvC,MAAM,CAAU,WAAW,GACzB,oDAAoD;QACpD,0CAA0C;QAC1C,cAAc;QACd,iDAAiD;QACjD,2CAA2C;QAC3C,qCAAqC,CAAC;IACxC,MAAM,CAAU,mBAAmB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC1D,MAAM,CAAU,YAAY,GAAa,CAAC,QAAQ,CAAC,CAAC;IACpD,MAAM,CAAU,gBAAgB,GAAG,CAAC,cAAc,CAAC,CAAC;IACpD,MAAM,CAAU,aAAa,GAAG,IAAI,CAAC;IA+CrC,KAAK,CAAC,OAAO;QACX,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE5C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAEnD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE;YAClD,MAAM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CAAC;QACN,GAAG,EAAE,EAAE;KACR,CAAC;0DAC6B;AAoBjC,MAAM,CAAC,MAAM,kBAAkB,GAAyB,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseNode } from "@nodetool-ai/node-sdk";
|
|
2
|
+
import type { NodeClass } from "@nodetool-ai/node-sdk";
|
|
3
|
+
import { type ReveImageRef } from "../reve-base.js";
|
|
4
|
+
/** Output handles EditImageNode.process() emits. */
|
|
5
|
+
type EditImageNodeOutputs = {
|
|
6
|
+
output: ReveImageRef;
|
|
7
|
+
};
|
|
8
|
+
export declare class EditImageNode extends BaseNode {
|
|
9
|
+
static readonly nodeType = "reve.EditImage";
|
|
10
|
+
static readonly body = "content_card";
|
|
11
|
+
static readonly title = "Edit Image";
|
|
12
|
+
static readonly description: string;
|
|
13
|
+
static readonly metadataOutputTypes: {
|
|
14
|
+
output: string;
|
|
15
|
+
};
|
|
16
|
+
static readonly inlineFields: string[];
|
|
17
|
+
static readonly inputFields: string[];
|
|
18
|
+
static readonly requiredSettings: string[];
|
|
19
|
+
static readonly autoSaveAsset = true;
|
|
20
|
+
image: any;
|
|
21
|
+
edit_instruction: any;
|
|
22
|
+
aspect_ratio: any;
|
|
23
|
+
version: any;
|
|
24
|
+
postprocessing: any;
|
|
25
|
+
test_time_scaling: any;
|
|
26
|
+
process(context?: Parameters<BaseNode["process"]>[0]): Promise<EditImageNodeOutputs>;
|
|
27
|
+
}
|
|
28
|
+
export declare const EDIT_IMAGE_NODES: readonly NodeClass[];
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=edit-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-image.d.ts","sourceRoot":"","sources":["../../src/nodes/edit-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,oDAAoD;AACpD,KAAK,oBAAoB,GAAG;IAC1B,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,qBAAa,aAAc,SAAQ,QAAQ;IACzC,MAAM,CAAC,QAAQ,CAAC,QAAQ,oBAAoB;IAC5C,MAAM,CAAC,QAAQ,CAAC,IAAI,kBAAkB;IACtC,MAAM,CAAC,QAAQ,CAAC,KAAK,gBAAgB;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,SAMgB;IAC3C,MAAM,CAAC,QAAQ,CAAC,mBAAmB;QAAK,MAAM;MAAY;IAC1D,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAwB;IAC9D,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAa;IAClD,MAAM,CAAC,QAAQ,CAAC,gBAAgB,WAAoB;IACpD,MAAM,CAAC,QAAQ,CAAC,aAAa,QAAQ;IAc7B,KAAK,EAAE,GAAG,CAAC;IAQX,gBAAgB,EAAE,GAAG,CAAC;IAUtB,YAAY,EAAE,GAAG,CAAC;IAclB,OAAO,EAAE,GAAG,CAAC;IASb,cAAc,EAAE,GAAG,CAAC;IAUpB,iBAAiB,EAAE,GAAG,CAAC;IAEzB,OAAO,CACX,OAAO,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC3C,OAAO,CAAC,oBAAoB,CAAC,CAmB/B;CACF;AAED,eAAO,MAAM,gBAAgB,EAAE,SAAS,SAAS,EAAoB,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseNode, prop } from "@nodetool-ai/node-sdk";
|
|
8
|
+
import { getReveApiKey, postprocessingArray, refToBase64, reveGenerate, reveImageToRef, REVE_ASPECT_RATIOS, REVE_POSTPROCESSING } from "../reve-base.js";
|
|
9
|
+
export class EditImageNode extends BaseNode {
|
|
10
|
+
static nodeType = "reve.EditImage";
|
|
11
|
+
static body = "content_card";
|
|
12
|
+
static title = "Edit Image";
|
|
13
|
+
static description = "Edit an existing image with a text instruction using Reve.\n" +
|
|
14
|
+
"image, edit, instruct, inpaint, reve\n\n" +
|
|
15
|
+
"Use cases:\n" +
|
|
16
|
+
"- Apply targeted edits described in plain language\n" +
|
|
17
|
+
"- Change styles, colors, or objects in a photo\n" +
|
|
18
|
+
"- Add or remove elements from an image";
|
|
19
|
+
static metadataOutputTypes = { output: "image" };
|
|
20
|
+
static inlineFields = ["edit_instruction"];
|
|
21
|
+
static inputFields = ["image"];
|
|
22
|
+
static requiredSettings = ["REVE_API_KEY"];
|
|
23
|
+
static autoSaveAsset = true;
|
|
24
|
+
async process(context) {
|
|
25
|
+
const apiKey = getReveApiKey(this._secrets);
|
|
26
|
+
const instruction = String(this.edit_instruction ?? "");
|
|
27
|
+
if (!instruction)
|
|
28
|
+
throw new Error("Edit instruction is required");
|
|
29
|
+
const referenceImage = await refToBase64(this.image, context);
|
|
30
|
+
const aspectRatio = String(this.aspect_ratio ?? "none");
|
|
31
|
+
const result = await reveGenerate(apiKey, "edit", {
|
|
32
|
+
edit_instruction: instruction,
|
|
33
|
+
reference_image: referenceImage,
|
|
34
|
+
aspect_ratio: aspectRatio === "none" ? undefined : aspectRatio,
|
|
35
|
+
version: String(this.version ?? "latest"),
|
|
36
|
+
postprocessing: postprocessingArray(this.postprocessing),
|
|
37
|
+
test_time_scaling: Number(this.test_time_scaling ?? 1)
|
|
38
|
+
});
|
|
39
|
+
return { output: await reveImageToRef(result.image) };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
__decorate([
|
|
43
|
+
prop({
|
|
44
|
+
type: "image",
|
|
45
|
+
default: {
|
|
46
|
+
type: "image",
|
|
47
|
+
uri: "",
|
|
48
|
+
asset_id: null,
|
|
49
|
+
data: null,
|
|
50
|
+
metadata: null
|
|
51
|
+
},
|
|
52
|
+
title: "Image",
|
|
53
|
+
description: "The reference image to edit."
|
|
54
|
+
})
|
|
55
|
+
], EditImageNode.prototype, "image", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
prop({
|
|
58
|
+
type: "str",
|
|
59
|
+
default: "",
|
|
60
|
+
title: "Edit Instruction",
|
|
61
|
+
description: "How to modify the image (max 2560 chars)."
|
|
62
|
+
})
|
|
63
|
+
], EditImageNode.prototype, "edit_instruction", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
prop({
|
|
66
|
+
type: "enum",
|
|
67
|
+
default: "none",
|
|
68
|
+
title: "Aspect Ratio",
|
|
69
|
+
description: "Output proportions. 'none' keeps the reference image's aspect ratio.",
|
|
70
|
+
values: ["none", ...REVE_ASPECT_RATIOS]
|
|
71
|
+
})
|
|
72
|
+
], EditImageNode.prototype, "aspect_ratio", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
prop({
|
|
75
|
+
type: "enum",
|
|
76
|
+
default: "latest",
|
|
77
|
+
title: "Version",
|
|
78
|
+
description: "Model version to use.",
|
|
79
|
+
values: [
|
|
80
|
+
"latest-fast",
|
|
81
|
+
"latest",
|
|
82
|
+
"reve-edit-fast@20251030",
|
|
83
|
+
"reve-edit@20250915"
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
], EditImageNode.prototype, "version", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
prop({
|
|
89
|
+
type: "enum",
|
|
90
|
+
default: "none",
|
|
91
|
+
title: "Postprocessing",
|
|
92
|
+
description: "Optional postprocessing operation applied to the result.",
|
|
93
|
+
values: [...REVE_POSTPROCESSING]
|
|
94
|
+
})
|
|
95
|
+
], EditImageNode.prototype, "postprocessing", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
prop({
|
|
98
|
+
type: "int",
|
|
99
|
+
default: 1,
|
|
100
|
+
title: "Test Time Scaling",
|
|
101
|
+
description: "Effort multiplier for quality (1-15). Higher costs more.",
|
|
102
|
+
min: 1,
|
|
103
|
+
max: 15
|
|
104
|
+
})
|
|
105
|
+
], EditImageNode.prototype, "test_time_scaling", void 0);
|
|
106
|
+
export const EDIT_IMAGE_NODES = [EditImageNode];
|
|
107
|
+
//# sourceMappingURL=edit-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edit-image.js","sourceRoot":"","sources":["../../src/nodes/edit-image.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,OAAO,aAAc,SAAQ,QAAQ;IACzC,MAAM,CAAU,QAAQ,GAAG,gBAAgB,CAAC;IAC5C,MAAM,CAAU,IAAI,GAAG,cAAc,CAAC;IACtC,MAAM,CAAU,KAAK,GAAG,YAAY,CAAC;IACrC,MAAM,CAAU,WAAW,GACzB,8DAA8D;QAC9D,0CAA0C;QAC1C,cAAc;QACd,sDAAsD;QACtD,kDAAkD;QAClD,wCAAwC,CAAC;IAC3C,MAAM,CAAU,mBAAmB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC1D,MAAM,CAAU,YAAY,GAAa,CAAC,kBAAkB,CAAC,CAA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node-sdk";
|
|
3
|
+
import { type ReveImageRef } from "../reve-base.js";
|
|
4
|
+
/** Output handles RemixImageNode.process() emits. */
|
|
5
|
+
type RemixImageNodeOutputs = {
|
|
6
|
+
output: ReveImageRef;
|
|
7
|
+
};
|
|
8
|
+
export declare class RemixImageNode extends BaseNode {
|
|
9
|
+
static readonly nodeType = "reve.RemixImage";
|
|
10
|
+
static readonly body = "content_card";
|
|
11
|
+
static readonly title = "Remix Image";
|
|
12
|
+
static readonly description: string;
|
|
13
|
+
static readonly metadataOutputTypes: {
|
|
14
|
+
output: string;
|
|
15
|
+
};
|
|
16
|
+
static readonly inlineFields: string[];
|
|
17
|
+
static readonly inputFields: string[];
|
|
18
|
+
static readonly requiredSettings: string[];
|
|
19
|
+
static readonly autoSaveAsset = true;
|
|
20
|
+
prompt: any;
|
|
21
|
+
reference_images: any;
|
|
22
|
+
aspect_ratio: any;
|
|
23
|
+
version: any;
|
|
24
|
+
postprocessing: any;
|
|
25
|
+
test_time_scaling: any;
|
|
26
|
+
process(context?: Parameters<BaseNode["process"]>[0]): Promise<RemixImageNodeOutputs>;
|
|
27
|
+
}
|
|
28
|
+
export declare const REMIX_IMAGE_NODES: readonly NodeClass[];
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=remix-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remix-image.d.ts","sourceRoot":"","sources":["../../src/nodes/remix-image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAQ,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,qDAAqD;AACrD,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,qBAAa,cAAe,SAAQ,QAAQ;IAC1C,MAAM,CAAC,QAAQ,CAAC,QAAQ,qBAAqB;IAC7C,MAAM,CAAC,QAAQ,CAAC,IAAI,kBAAkB;IACtC,MAAM,CAAC,QAAQ,CAAC,KAAK,iBAAiB;IACtC,MAAM,CAAC,QAAQ,CAAC,WAAW,SAQC;IAC5B,MAAM,CAAC,QAAQ,CAAC,mBAAmB;QAAK,MAAM;MAAY;IAC1D,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAc;IACpD,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAwB;IAC7D,MAAM,CAAC,QAAQ,CAAC,gBAAgB,WAAoB;IACpD,MAAM,CAAC,QAAQ,CAAC,aAAa,QAAQ;IAU7B,MAAM,EAAE,GAAG,CAAC;IAQZ,gBAAgB,EAAE,GAAG,CAAC;IAUtB,YAAY,EAAE,GAAG,CAAC;IAclB,OAAO,EAAE,GAAG,CAAC;IASb,cAAc,EAAE,GAAG,CAAC;IAUpB,iBAAiB,EAAE,GAAG,CAAC;IAEzB,OAAO,CACX,OAAO,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAC3C,OAAO,CAAC,qBAAqB,CAAC,CA+BhC;CACF;AAED,eAAO,MAAM,iBAAiB,EAAE,SAAS,SAAS,EAAqB,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseNode, prop } from "@nodetool-ai/node-sdk";
|
|
8
|
+
import { getReveApiKey, postprocessingArray, refToBase64, reveGenerate, reveImageToRef, REVE_ASPECT_RATIOS, REVE_POSTPROCESSING } from "../reve-base.js";
|
|
9
|
+
export class RemixImageNode extends BaseNode {
|
|
10
|
+
static nodeType = "reve.RemixImage";
|
|
11
|
+
static body = "content_card";
|
|
12
|
+
static title = "Remix Image";
|
|
13
|
+
static description = "Combine a prompt with 1-6 reference images using Reve.\n" +
|
|
14
|
+
"image, remix, reference, compose, reve\n\n" +
|
|
15
|
+
"Use cases:\n" +
|
|
16
|
+
"- Blend subjects and styles from several images\n" +
|
|
17
|
+
"- Place a referenced product into a new scene\n" +
|
|
18
|
+
"- Compose characters from multiple references\n\n" +
|
|
19
|
+
"Reference specific images in the prompt with <img>0</img>, <img>1</img>, " +
|
|
20
|
+
"etc. (0 = first image).";
|
|
21
|
+
static metadataOutputTypes = { output: "image" };
|
|
22
|
+
static inlineFields = ["prompt"];
|
|
23
|
+
static inputFields = ["reference_images"];
|
|
24
|
+
static requiredSettings = ["REVE_API_KEY"];
|
|
25
|
+
static autoSaveAsset = true;
|
|
26
|
+
async process(context) {
|
|
27
|
+
const apiKey = getReveApiKey(this._secrets);
|
|
28
|
+
const prompt = String(this.prompt ?? "");
|
|
29
|
+
if (!prompt)
|
|
30
|
+
throw new Error("Prompt is required");
|
|
31
|
+
const refs = Array.isArray(this.reference_images)
|
|
32
|
+
? this.reference_images
|
|
33
|
+
: [];
|
|
34
|
+
if (refs.length === 0) {
|
|
35
|
+
throw new Error("At least one reference image is required");
|
|
36
|
+
}
|
|
37
|
+
if (refs.length > 6) {
|
|
38
|
+
throw new Error("Remix accepts at most 6 reference images");
|
|
39
|
+
}
|
|
40
|
+
const referenceImages = await Promise.all(refs.map((ref) => refToBase64(ref, context)));
|
|
41
|
+
const aspectRatio = String(this.aspect_ratio ?? "none");
|
|
42
|
+
const result = await reveGenerate(apiKey, "remix", {
|
|
43
|
+
prompt,
|
|
44
|
+
reference_images: referenceImages,
|
|
45
|
+
aspect_ratio: aspectRatio === "none" ? undefined : aspectRatio,
|
|
46
|
+
version: String(this.version ?? "latest"),
|
|
47
|
+
postprocessing: postprocessingArray(this.postprocessing),
|
|
48
|
+
test_time_scaling: Number(this.test_time_scaling ?? 1)
|
|
49
|
+
});
|
|
50
|
+
return { output: await reveImageToRef(result.image) };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
__decorate([
|
|
54
|
+
prop({
|
|
55
|
+
type: "str",
|
|
56
|
+
default: "",
|
|
57
|
+
title: "Prompt",
|
|
58
|
+
description: "Text prompt (max 2560 chars). Use <img>0</img>, <img>1</img>, ... to " +
|
|
59
|
+
"reference images by index."
|
|
60
|
+
})
|
|
61
|
+
], RemixImageNode.prototype, "prompt", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
prop({
|
|
64
|
+
type: "list",
|
|
65
|
+
default: [],
|
|
66
|
+
title: "Reference Images",
|
|
67
|
+
description: "1-6 reference images to remix."
|
|
68
|
+
})
|
|
69
|
+
], RemixImageNode.prototype, "reference_images", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
prop({
|
|
72
|
+
type: "enum",
|
|
73
|
+
default: "none",
|
|
74
|
+
title: "Aspect Ratio",
|
|
75
|
+
description: "Output proportions. 'none' lets the model choose the aspect ratio.",
|
|
76
|
+
values: ["none", ...REVE_ASPECT_RATIOS]
|
|
77
|
+
})
|
|
78
|
+
], RemixImageNode.prototype, "aspect_ratio", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
prop({
|
|
81
|
+
type: "enum",
|
|
82
|
+
default: "latest",
|
|
83
|
+
title: "Version",
|
|
84
|
+
description: "Model version to use.",
|
|
85
|
+
values: [
|
|
86
|
+
"latest-fast",
|
|
87
|
+
"latest",
|
|
88
|
+
"reve-remix-fast@20251030",
|
|
89
|
+
"reve-remix@20250915"
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
], RemixImageNode.prototype, "version", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
prop({
|
|
95
|
+
type: "enum",
|
|
96
|
+
default: "none",
|
|
97
|
+
title: "Postprocessing",
|
|
98
|
+
description: "Optional postprocessing operation applied to the result.",
|
|
99
|
+
values: [...REVE_POSTPROCESSING]
|
|
100
|
+
})
|
|
101
|
+
], RemixImageNode.prototype, "postprocessing", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
prop({
|
|
104
|
+
type: "int",
|
|
105
|
+
default: 1,
|
|
106
|
+
title: "Test Time Scaling",
|
|
107
|
+
description: "Effort multiplier for quality (1-15). Higher costs more.",
|
|
108
|
+
min: 1,
|
|
109
|
+
max: 15
|
|
110
|
+
})
|
|
111
|
+
], RemixImageNode.prototype, "test_time_scaling", void 0);
|
|
112
|
+
export const REMIX_IMAGE_NODES = [RemixImageNode];
|
|
113
|
+
//# sourceMappingURL=remix-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remix-image.js","sourceRoot":"","sources":["../../src/nodes/remix-image.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,OAAO,cAAe,SAAQ,QAAQ;IAC1C,MAAM,CAAU,QAAQ,GAAG,iBAAiB,CAAC;IAC7C,MAAM,CAAU,IAAI,GAAG,cAAc,CAAC;IACtC,MAAM,CAAU,KAAK,GAAG,aAAa,CAAC;IACtC,MAAM,CAAU,WAAW,GACzB,0DAA0D;QAC1D,4CAA4C;QAC5C,cAAc;QACd,mDAAmD;QACnD,iDAAiD;QACjD,mDAAmD;QACnD,2EAA2E;QAC3E,yBAAyB,CAAC;IAC5B,MAAM,CAAU,mBAAmB,GAAG,EAAE,MAAM,EAAE,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AAE,CAAC,GAAG,mBAAmB,CAAC;KACjC,CAAC;sDAC0B;AAUpB;IARP,IAAI,CAAC;QACJ,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,CAAC;QACV,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,0DAA0D;QACvE,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;KACR,CAAC;yDAC6B;AAsCjC,MAAM,CAAC,MAAM,iBAAiB,GAAyB,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Reve API utilities.
|
|
3
|
+
*
|
|
4
|
+
* Reve's image API (https://api.reve.com/console/docs) exposes three POST
|
|
5
|
+
* endpoints that all share the same auth, postprocessing, and JSON response
|
|
6
|
+
* shape:
|
|
7
|
+
* - POST /v1/image/create — text → image
|
|
8
|
+
* - POST /v1/image/edit — instruction + reference image → image
|
|
9
|
+
* - POST /v1/image/remix — prompt + 1–6 reference images → image
|
|
10
|
+
*
|
|
11
|
+
* Wire spec:
|
|
12
|
+
* - Auth: `Authorization: Bearer <REVE_API_KEY>`.
|
|
13
|
+
* - Accept: `application/json` → response carries a base64 PNG in `image`.
|
|
14
|
+
* - Images: `reference_image` / `reference_images[]` are base64-encoded
|
|
15
|
+
* strings (no data: prefix).
|
|
16
|
+
* - Response (200): { image, version, content_violation, request_id,
|
|
17
|
+
* credits_used, credits_remaining }.
|
|
18
|
+
*
|
|
19
|
+
* Uses native fetch (Node 18+). Asset → base64 resolution mirrors the other
|
|
20
|
+
* media node packs: inline data, data URIs, the workflow storage backend,
|
|
21
|
+
* `file://` paths, and remote `http(s)` URLs are all supported.
|
|
22
|
+
*/
|
|
23
|
+
import type { ProcessingContext } from "@nodetool-ai/runtime";
|
|
24
|
+
import type { EncodedImageRef } from "@nodetool-ai/runtime/provider-transport";
|
|
25
|
+
export declare const REVE_API_BASE = "https://api.reve.com";
|
|
26
|
+
/** Aspect ratios accepted by every Reve image endpoint. */
|
|
27
|
+
export declare const REVE_ASPECT_RATIOS: readonly ["16:9", "9:16", "3:2", "2:3", "4:3", "3:4", "1:1"];
|
|
28
|
+
/** Optional postprocessing operations applied to the generated image. */
|
|
29
|
+
export declare const REVE_POSTPROCESSING: readonly ["none", "upscale", "remove_background", "fit_image", "effect"];
|
|
30
|
+
export type ReveEndpoint = "create" | "edit" | "remix";
|
|
31
|
+
export interface ReveImageResponse {
|
|
32
|
+
image: string;
|
|
33
|
+
version?: string;
|
|
34
|
+
content_violation?: boolean;
|
|
35
|
+
request_id?: string;
|
|
36
|
+
credits_used?: number;
|
|
37
|
+
credits_remaining?: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function getReveApiKey(secrets: Record<string, string>): string;
|
|
40
|
+
/**
|
|
41
|
+
* The `ImageRef` fields this pack resolves bytes from. Node props arrive
|
|
42
|
+
* untyped from the graph, so the contract is stated here rather than at each
|
|
43
|
+
* read: bytes inline, base64 (bare or as a data URI), or a URI to fetch.
|
|
44
|
+
*/
|
|
45
|
+
export interface ReveImageInput {
|
|
46
|
+
uri?: string;
|
|
47
|
+
data?: Uint8Array | string;
|
|
48
|
+
asset_id?: string | null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve an ImageRef-like value to raw bytes. Delegates to the canonical
|
|
52
|
+
* {@link loadMediaRefBytes}, which — unlike the copy this replaced — checks
|
|
53
|
+
* `data.length > 0` rather than bare truthiness (a zero-length `Uint8Array` is
|
|
54
|
+
* truthy and shadowed a perfectly good `uri`) and resolves an `asset_id`-only
|
|
55
|
+
* ref. Throws rather than returning null: every caller here needs the bytes.
|
|
56
|
+
*/
|
|
57
|
+
export declare function refToBytes(ref: ReveImageInput | null | undefined, context?: ProcessingContext): Promise<Uint8Array>;
|
|
58
|
+
/** Resolve an ImageRef-like value to a base64 string (no data: prefix). */
|
|
59
|
+
export declare function refToBase64(ref: ReveImageInput | null | undefined, context?: ProcessingContext): Promise<string>;
|
|
60
|
+
/** The `ImageRef` this pack emits: a base64 image, sized when sharp is present. */
|
|
61
|
+
export type ReveImageRef = EncodedImageRef;
|
|
62
|
+
/** Build an ImageRef from the base64 image Reve returns. */
|
|
63
|
+
export declare function reveImageToRef(base64: string): Promise<ReveImageRef>;
|
|
64
|
+
/**
|
|
65
|
+
* The fields the three Reve image endpoints accept. Each node fills the subset
|
|
66
|
+
* its endpoint uses, and `cleanBody` drops whatever it left unset.
|
|
67
|
+
*/
|
|
68
|
+
export interface ReveRequestBody {
|
|
69
|
+
/** `create` and `remix`. */
|
|
70
|
+
prompt?: string;
|
|
71
|
+
/** `edit`. */
|
|
72
|
+
edit_instruction?: string;
|
|
73
|
+
/** `edit`: one base64 image, no data: prefix. */
|
|
74
|
+
reference_image?: string;
|
|
75
|
+
/** `remix`: 1–6 base64 images, no data: prefix. */
|
|
76
|
+
reference_images?: string[];
|
|
77
|
+
aspect_ratio?: string;
|
|
78
|
+
version?: string;
|
|
79
|
+
postprocessing?: string[];
|
|
80
|
+
test_time_scaling?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Normalize a postprocessing enum selection into the API's array form. The
|
|
84
|
+
* selection is a node prop, so it arrives as whatever the graph stored.
|
|
85
|
+
*/
|
|
86
|
+
export declare function postprocessingArray(value: string | null | undefined): string[];
|
|
87
|
+
/**
|
|
88
|
+
* POST to a Reve image endpoint and return the parsed JSON response. Throws on
|
|
89
|
+
* non-2xx responses and on flagged content (a content violation yields no
|
|
90
|
+
* usable image).
|
|
91
|
+
*/
|
|
92
|
+
export declare function reveGenerate(apiKey: string, endpoint: ReveEndpoint, body: ReveRequestBody): Promise<ReveImageResponse>;
|
|
93
|
+
//# sourceMappingURL=reve-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reve-base.d.ts","sourceRoot":"","sources":["../src/reve-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAiB,iBAA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AiB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAGjB;AAMD,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC;AAE3C,4DAA4D;AAC5D,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAE1E;AAMD;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAgBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAG9E;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,iBAAiB,CAAC,CA2B5B"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Reve API utilities.
|
|
3
|
+
*
|
|
4
|
+
* Reve's image API (https://api.reve.com/console/docs) exposes three POST
|
|
5
|
+
* endpoints that all share the same auth, postprocessing, and JSON response
|
|
6
|
+
* shape:
|
|
7
|
+
* - POST /v1/image/create — text → image
|
|
8
|
+
* - POST /v1/image/edit — instruction + reference image → image
|
|
9
|
+
* - POST /v1/image/remix — prompt + 1–6 reference images → image
|
|
10
|
+
*
|
|
11
|
+
* Wire spec:
|
|
12
|
+
* - Auth: `Authorization: Bearer <REVE_API_KEY>`.
|
|
13
|
+
* - Accept: `application/json` → response carries a base64 PNG in `image`.
|
|
14
|
+
* - Images: `reference_image` / `reference_images[]` are base64-encoded
|
|
15
|
+
* strings (no data: prefix).
|
|
16
|
+
* - Response (200): { image, version, content_violation, request_id,
|
|
17
|
+
* credits_used, credits_remaining }.
|
|
18
|
+
*
|
|
19
|
+
* Uses native fetch (Node 18+). Asset → base64 resolution mirrors the other
|
|
20
|
+
* media node packs: inline data, data URIs, the workflow storage backend,
|
|
21
|
+
* `file://` paths, and remote `http(s)` URLs are all supported.
|
|
22
|
+
*/
|
|
23
|
+
import { loadMediaRefBytes } from "@nodetool-ai/runtime";
|
|
24
|
+
import { imageRefFromBytes } from "@nodetool-ai/runtime/provider-transport";
|
|
25
|
+
export const REVE_API_BASE = "https://api.reve.com";
|
|
26
|
+
/** Aspect ratios accepted by every Reve image endpoint. */
|
|
27
|
+
export const REVE_ASPECT_RATIOS = [
|
|
28
|
+
"16:9",
|
|
29
|
+
"9:16",
|
|
30
|
+
"3:2",
|
|
31
|
+
"2:3",
|
|
32
|
+
"4:3",
|
|
33
|
+
"3:4",
|
|
34
|
+
"1:1"
|
|
35
|
+
];
|
|
36
|
+
/** Optional postprocessing operations applied to the generated image. */
|
|
37
|
+
export const REVE_POSTPROCESSING = [
|
|
38
|
+
"none",
|
|
39
|
+
"upscale",
|
|
40
|
+
"remove_background",
|
|
41
|
+
"fit_image",
|
|
42
|
+
"effect"
|
|
43
|
+
];
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// API key
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
export function getReveApiKey(secrets) {
|
|
48
|
+
const key = secrets?.REVE_API_KEY || process.env.REVE_API_KEY || "";
|
|
49
|
+
if (!key)
|
|
50
|
+
throw new Error("REVE_API_KEY is not configured");
|
|
51
|
+
return key;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Resolve an ImageRef-like value to raw bytes. Delegates to the canonical
|
|
55
|
+
* {@link loadMediaRefBytes}, which — unlike the copy this replaced — checks
|
|
56
|
+
* `data.length > 0` rather than bare truthiness (a zero-length `Uint8Array` is
|
|
57
|
+
* truthy and shadowed a perfectly good `uri`) and resolves an `asset_id`-only
|
|
58
|
+
* ref. Throws rather than returning null: every caller here needs the bytes.
|
|
59
|
+
*/
|
|
60
|
+
export async function refToBytes(ref, context) {
|
|
61
|
+
if (!ref) {
|
|
62
|
+
throw new Error("Image is required");
|
|
63
|
+
}
|
|
64
|
+
// SAFETY: ReveImageInput is the union of the ref shapes loadMediaRefBytes
|
|
65
|
+
// accepts; it is narrower than MediaRefValue, not a different shape.
|
|
66
|
+
const bytes = await loadMediaRefBytes(ref, context);
|
|
67
|
+
if (!bytes)
|
|
68
|
+
throw new Error("Image has no data or URI");
|
|
69
|
+
return bytes;
|
|
70
|
+
}
|
|
71
|
+
/** Resolve an ImageRef-like value to a base64 string (no data: prefix). */
|
|
72
|
+
export async function refToBase64(ref, context) {
|
|
73
|
+
const bytes = await refToBytes(ref, context);
|
|
74
|
+
return Buffer.from(bytes).toString("base64");
|
|
75
|
+
}
|
|
76
|
+
/** Build an ImageRef from the base64 image Reve returns. */
|
|
77
|
+
export async function reveImageToRef(base64) {
|
|
78
|
+
return imageRefFromBytes(new Uint8Array(Buffer.from(base64, "base64")));
|
|
79
|
+
}
|
|
80
|
+
/** Drop null/undefined/empty fields and an all-"none" postprocessing array. */
|
|
81
|
+
function cleanBody(body) {
|
|
82
|
+
const out = {};
|
|
83
|
+
for (const [k, v] of Object.entries(body)) {
|
|
84
|
+
if (v === null || v === undefined || v === "")
|
|
85
|
+
continue;
|
|
86
|
+
if (Array.isArray(v) && v.length === 0)
|
|
87
|
+
continue;
|
|
88
|
+
out[k] = v;
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Normalize a postprocessing enum selection into the API's array form. The
|
|
94
|
+
* selection is a node prop, so it arrives as whatever the graph stored.
|
|
95
|
+
*/
|
|
96
|
+
export function postprocessingArray(value) {
|
|
97
|
+
const v = String(value ?? "none");
|
|
98
|
+
return v === "none" ? [] : [v];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* POST to a Reve image endpoint and return the parsed JSON response. Throws on
|
|
102
|
+
* non-2xx responses and on flagged content (a content violation yields no
|
|
103
|
+
* usable image).
|
|
104
|
+
*/
|
|
105
|
+
export async function reveGenerate(apiKey, endpoint, body) {
|
|
106
|
+
const response = await fetch(`${REVE_API_BASE}/v1/image/${endpoint}`, {
|
|
107
|
+
method: "POST",
|
|
108
|
+
headers: {
|
|
109
|
+
Authorization: `Bearer ${apiKey}`,
|
|
110
|
+
"Content-Type": "application/json",
|
|
111
|
+
Accept: "application/json"
|
|
112
|
+
},
|
|
113
|
+
body: JSON.stringify(cleanBody(body))
|
|
114
|
+
});
|
|
115
|
+
if (!response.ok) {
|
|
116
|
+
const errorText = await response.text();
|
|
117
|
+
throw new Error(`Reve API error (${response.status}): ${errorText}`);
|
|
118
|
+
}
|
|
119
|
+
// SAFETY: a 2xx from the documented Reve endpoints carries this JSON shape;
|
|
120
|
+
// the two fields read below (`content_violation`, `image`) are checked
|
|
121
|
+
// immediately, and a missing `image` throws rather than reaching a node.
|
|
122
|
+
const result = (await response.json());
|
|
123
|
+
if (result.content_violation) {
|
|
124
|
+
throw new Error("Reve flagged this request as a content policy violation");
|
|
125
|
+
}
|
|
126
|
+
if (!result.image) {
|
|
127
|
+
throw new Error("Reve returned no image");
|
|
128
|
+
}
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=reve-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reve-base.js","sourceRoot":"","sources":["../src/reve-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;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,MAAM,EAAE,kBAAkB;SAC3B;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KACtC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,CAAC,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,4EAA4E;IAC5E,uEAAuE;IACvE,yEAAyE;IACzE,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAsB,CAAC;IAC5D,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nodetool-ai/reve-nodes",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=22.0.0"
|
|
6
|
+
},
|
|
7
|
+
"version": "0.8.1",
|
|
8
|
+
"description": "Reve AI image generation, editing, and remix nodes for nodetool",
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "node ../../scripts/build-typescript-workspace.mjs",
|
|
13
|
+
"test": "node ../../scripts/run-vitest.mjs run",
|
|
14
|
+
"test:watch": "node ../../scripts/run-vitest.mjs",
|
|
15
|
+
"lint": "node ../../scripts/run-tsc.mjs --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@nodetool-ai/node-sdk": "^0.8.1",
|
|
19
|
+
"@nodetool-ai/runtime": "^0.8.1"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^22.0.0",
|
|
23
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
24
|
+
"vitest": "^5.0.1"
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/nodetool-ai/nodetool.git",
|
|
37
|
+
"directory": "packages/reve-nodes"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://nodetool.ai",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/nodetool-ai/nodetool/issues"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"README.md"
|
|
49
|
+
],
|
|
50
|
+
"keywords": [
|
|
51
|
+
"nodetool",
|
|
52
|
+
"ai",
|
|
53
|
+
"workflow",
|
|
54
|
+
"workflow-automation",
|
|
55
|
+
"typescript",
|
|
56
|
+
"ai-nodes",
|
|
57
|
+
"no-code",
|
|
58
|
+
"visual-programming",
|
|
59
|
+
"workflow-nodes",
|
|
60
|
+
"reve",
|
|
61
|
+
"image-generation"
|
|
62
|
+
]
|
|
63
|
+
}
|