@nodetool-ai/protocol 0.8.11 → 0.8.14
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/dist/.nodetool-build-stamp +1 -1
- package/dist/agent-model-fit.d.ts +35 -0
- package/dist/agent-model-fit.d.ts.map +1 -0
- package/dist/agent-model-fit.js +62 -0
- package/dist/agent-model-fit.js.map +1 -0
- package/dist/ai-video-production.d.ts +4 -0
- package/dist/ai-video-production.d.ts.map +1 -1
- package/dist/api-schemas/admin.d.ts +533 -0
- package/dist/api-schemas/admin.d.ts.map +1 -0
- package/dist/api-schemas/admin.js +172 -0
- package/dist/api-schemas/admin.js.map +1 -0
- package/dist/api-schemas/agent-access.d.ts +40 -0
- package/dist/api-schemas/agent-access.d.ts.map +1 -1
- package/dist/api-schemas/agent-access.js +24 -1
- package/dist/api-schemas/agent-access.js.map +1 -1
- package/dist/api-schemas/api-error-code.d.ts +35 -1
- package/dist/api-schemas/api-error-code.d.ts.map +1 -1
- package/dist/api-schemas/api-error-code.js +34 -0
- package/dist/api-schemas/api-error-code.js.map +1 -1
- package/dist/api-schemas/app-runs.d.ts +20 -0
- package/dist/api-schemas/app-runs.d.ts.map +1 -1
- package/dist/api-schemas/applications.d.ts +46 -0
- package/dist/api-schemas/applications.d.ts.map +1 -1
- package/dist/api-schemas/applications.js +4 -1
- package/dist/api-schemas/applications.js.map +1 -1
- package/dist/api-schemas/assets.d.ts +79 -0
- package/dist/api-schemas/assets.d.ts.map +1 -1
- package/dist/api-schemas/assets.js +61 -7
- package/dist/api-schemas/assets.js.map +1 -1
- package/dist/api-schemas/cloud-local.d.ts +194 -0
- package/dist/api-schemas/cloud-local.d.ts.map +1 -0
- package/dist/api-schemas/cloud-local.js +88 -0
- package/dist/api-schemas/cloud-local.js.map +1 -0
- package/dist/api-schemas/cloud-transfer-local.d.ts +999 -0
- package/dist/api-schemas/cloud-transfer-local.d.ts.map +1 -0
- package/dist/api-schemas/cloud-transfer-local.js +189 -0
- package/dist/api-schemas/cloud-transfer-local.js.map +1 -0
- package/dist/api-schemas/deleted-documents.d.ts +45 -0
- package/dist/api-schemas/deleted-documents.d.ts.map +1 -0
- package/dist/api-schemas/deleted-documents.js +30 -0
- package/dist/api-schemas/deleted-documents.js.map +1 -0
- package/dist/api-schemas/document-sharing.d.ts +191 -0
- package/dist/api-schemas/document-sharing.d.ts.map +1 -1
- package/dist/api-schemas/document-sharing.js +41 -4
- package/dist/api-schemas/document-sharing.js.map +1 -1
- package/dist/api-schemas/index.d.ts +8 -0
- package/dist/api-schemas/index.d.ts.map +1 -1
- package/dist/api-schemas/index.js +8 -0
- package/dist/api-schemas/index.js.map +1 -1
- package/dist/api-schemas/js-scripts.d.ts +1 -1
- package/dist/api-schemas/js-scripts.d.ts.map +1 -1
- package/dist/api-schemas/js-scripts.js +1 -1
- package/dist/api-schemas/js-scripts.js.map +1 -1
- package/dist/api-schemas/messages.d.ts +30 -0
- package/dist/api-schemas/messages.d.ts.map +1 -1
- package/dist/api-schemas/messages.js +32 -1
- package/dist/api-schemas/messages.js.map +1 -1
- package/dist/api-schemas/openverse.d.ts +2 -0
- package/dist/api-schemas/openverse.d.ts.map +1 -1
- package/dist/api-schemas/people.d.ts +27 -0
- package/dist/api-schemas/people.d.ts.map +1 -0
- package/dist/api-schemas/people.js +21 -0
- package/dist/api-schemas/people.js.map +1 -0
- package/dist/api-schemas/projects.d.ts +412 -0
- package/dist/api-schemas/projects.d.ts.map +1 -1
- package/dist/api-schemas/projects.js +212 -2
- package/dist/api-schemas/projects.js.map +1 -1
- package/dist/api-schemas/receive.d.ts +95 -0
- package/dist/api-schemas/receive.d.ts.map +1 -0
- package/dist/api-schemas/receive.js +69 -0
- package/dist/api-schemas/receive.js.map +1 -0
- package/dist/api-schemas/recipes.d.ts +4 -0
- package/dist/api-schemas/recipes.d.ts.map +1 -1
- package/dist/api-schemas/recipes.js +8 -2
- package/dist/api-schemas/recipes.js.map +1 -1
- package/dist/api-schemas/scripts.d.ts +56 -0
- package/dist/api-schemas/scripts.d.ts.map +1 -1
- package/dist/api-schemas/sdk-execution-v1.d.ts +0 -2
- package/dist/api-schemas/sdk-execution-v1.d.ts.map +1 -1
- package/dist/api-schemas/settings.d.ts +134 -0
- package/dist/api-schemas/settings.d.ts.map +1 -1
- package/dist/api-schemas/settings.js +73 -2
- package/dist/api-schemas/settings.js.map +1 -1
- package/dist/api-schemas/storage.d.ts +96 -0
- package/dist/api-schemas/storage.d.ts.map +1 -1
- package/dist/api-schemas/storage.js +48 -0
- package/dist/api-schemas/storage.js.map +1 -1
- package/dist/api-schemas/storyboards.d.ts +283 -24
- package/dist/api-schemas/storyboards.d.ts.map +1 -1
- package/dist/api-schemas/storyboards.js +64 -11
- package/dist/api-schemas/storyboards.js.map +1 -1
- package/dist/api-schemas/sync.d.ts +78 -0
- package/dist/api-schemas/sync.d.ts.map +1 -0
- package/dist/api-schemas/sync.js +78 -0
- package/dist/api-schemas/sync.js.map +1 -0
- package/dist/api-schemas/threads.d.ts +18 -0
- package/dist/api-schemas/threads.d.ts.map +1 -1
- package/dist/api-schemas/threads.js +5 -1
- package/dist/api-schemas/threads.js.map +1 -1
- package/dist/api-schemas/timeline-tool-contracts.d.ts +165 -2
- package/dist/api-schemas/timeline-tool-contracts.d.ts.map +1 -1
- package/dist/api-schemas/timeline-tool-contracts.js +54 -3
- package/dist/api-schemas/timeline-tool-contracts.js.map +1 -1
- package/dist/api-schemas/timeline-tool-params.d.ts +124 -1
- package/dist/api-schemas/timeline-tool-params.d.ts.map +1 -1
- package/dist/api-schemas/timeline-tool-params.js +118 -9
- package/dist/api-schemas/timeline-tool-params.js.map +1 -1
- package/dist/api-schemas/timeline.d.ts +4350 -170
- package/dist/api-schemas/timeline.d.ts.map +1 -1
- package/dist/api-schemas/timeline.js +193 -8
- package/dist/api-schemas/timeline.js.map +1 -1
- package/dist/api-schemas/transfer.d.ts +890 -0
- package/dist/api-schemas/transfer.d.ts.map +1 -0
- package/dist/api-schemas/transfer.js +297 -0
- package/dist/api-schemas/transfer.js.map +1 -0
- package/dist/api-schemas/workflows.d.ts +314 -0
- package/dist/api-schemas/workflows.d.ts.map +1 -1
- package/dist/api-schemas/workflows.js +114 -7
- package/dist/api-schemas/workflows.js.map +1 -1
- package/dist/api-schemas/workspace.d.ts +0 -22
- package/dist/api-schemas/workspace.d.ts.map +1 -1
- package/dist/api-schemas/workspace.js +0 -21
- package/dist/api-schemas/workspace.js.map +1 -1
- package/dist/api-types.d.ts +103 -29
- package/dist/api-types.d.ts.map +1 -1
- package/dist/api-types.js +62 -24
- package/dist/api-types.js.map +1 -1
- package/dist/audio-run.d.ts +14 -0
- package/dist/audio-run.d.ts.map +1 -0
- package/dist/audio-run.js +23 -0
- package/dist/audio-run.js.map +1 -0
- package/dist/caption-word.d.ts +4 -0
- package/dist/caption-word.d.ts.map +1 -1
- package/dist/caption-word.js +3 -1
- package/dist/caption-word.js.map +1 -1
- package/dist/chat-attachment.d.ts +28 -0
- package/dist/chat-attachment.d.ts.map +1 -0
- package/dist/chat-attachment.js +101 -0
- package/dist/chat-attachment.js.map +1 -0
- package/dist/closure.d.ts +33 -0
- package/dist/closure.d.ts.map +1 -0
- package/dist/closure.js +116 -0
- package/dist/closure.js.map +1 -0
- package/dist/cloud-profile.d.ts.map +1 -1
- package/dist/cloud-profile.js +11 -2
- package/dist/cloud-profile.js.map +1 -1
- package/dist/comfy-graph.d.ts +36 -6
- package/dist/comfy-graph.d.ts.map +1 -1
- package/dist/comfy-graph.js +212 -18
- package/dist/comfy-graph.js.map +1 -1
- package/dist/creative.d.ts +32 -0
- package/dist/creative.d.ts.map +1 -1
- package/dist/creative.js +18 -0
- package/dist/creative.js.map +1 -1
- package/dist/gemini-models.d.ts +39 -0
- package/dist/gemini-models.d.ts.map +1 -0
- package/dist/gemini-models.js +104 -0
- package/dist/gemini-models.js.map +1 -0
- package/dist/graph.d.ts +1 -0
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js.map +1 -1
- package/dist/identity-encoding.d.ts +2 -0
- package/dist/identity-encoding.d.ts.map +1 -0
- package/dist/identity-encoding.js +56 -0
- package/dist/identity-encoding.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/messages.d.ts +118 -8
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +40 -0
- package/dist/messages.js.map +1 -1
- package/dist/missing-runtime-package.d.ts +1 -3
- package/dist/missing-runtime-package.d.ts.map +1 -1
- package/dist/missing-runtime-package.js +13 -16
- package/dist/missing-runtime-package.js.map +1 -1
- package/dist/processing-messages.schema.json +169 -2
- package/dist/production-authoring.d.ts +12 -0
- package/dist/production-authoring.d.ts.map +1 -1
- package/dist/project-directories.d.ts +127 -0
- package/dist/project-directories.d.ts.map +1 -0
- package/dist/project-directories.js +208 -0
- package/dist/project-directories.js.map +1 -0
- package/dist/provider-failure.d.ts +42 -0
- package/dist/provider-failure.d.ts.map +1 -0
- package/dist/provider-failure.js +70 -0
- package/dist/provider-failure.js.map +1 -0
- package/dist/reasoning-effort.d.ts +10 -4
- package/dist/reasoning-effort.d.ts.map +1 -1
- package/dist/reasoning-effort.js +39 -18
- package/dist/reasoning-effort.js.map +1 -1
- package/dist/render-record.d.ts +4 -0
- package/dist/render-record.d.ts.map +1 -1
- package/dist/run-trace.js +1 -1
- package/dist/run-trace.js.map +1 -1
- package/dist/runtime-npm-packages.d.ts +3 -13
- package/dist/runtime-npm-packages.d.ts.map +1 -1
- package/dist/runtime-npm-packages.js +3 -37
- package/dist/runtime-npm-packages.js.map +1 -1
- package/dist/sandbox-host.d.ts +1 -1
- package/dist/sandbox-host.d.ts.map +1 -1
- package/dist/sandbox-host.js +2 -51
- package/dist/sandbox-host.js.map +1 -1
- package/dist/storyboard-markdown.d.ts +154 -0
- package/dist/storyboard-markdown.d.ts.map +1 -0
- package/dist/storyboard-markdown.js +905 -0
- package/dist/storyboard-markdown.js.map +1 -0
- package/dist/token-providers.d.ts.map +1 -1
- package/dist/token-providers.js +1 -0
- package/dist/token-providers.js.map +1 -1
- package/dist/toolSchemas.d.ts +46 -0
- package/dist/toolSchemas.d.ts.map +1 -1
- package/dist/toolSchemas.js +87 -3
- package/dist/toolSchemas.js.map +1 -1
- package/dist/video-accessories.d.ts +14 -0
- package/dist/video-accessories.d.ts.map +1 -1
- package/dist/video-accessories.js +51 -0
- package/dist/video-accessories.js.map +1 -1
- package/dist/workflow-document-revision.d.ts +1 -1
- package/dist/workflow-document-revision.d.ts.map +1 -1
- package/dist/workflow-document-revision.js +2 -1
- package/dist/workflow-document-revision.js.map +1 -1
- package/dist/ws-commands.d.ts +3 -1
- package/dist/ws-commands.d.ts.map +1 -1
- package/dist/ws-commands.js +2 -0
- package/dist/ws-commands.js.map +1 -1
- package/package.json +7 -1
- package/schema/sdk-v1.execution.schema.json +0 -4
- package/schema/sdk-v1.manifest.json +1 -1
package/dist/closure.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference sets: the files a piece of document content refers to
|
|
3
|
+
* (docs/plans/native-cloud-sync/technical-design.md, "Reference sets and file
|
|
4
|
+
* authorization").
|
|
5
|
+
*
|
|
6
|
+
* A file is named by its asset id. The server stores the result per document
|
|
7
|
+
* and scope, and serves a file of another person only when it is in a set the
|
|
8
|
+
* reader may read.
|
|
9
|
+
*/
|
|
10
|
+
/** The document kinds that have a reference set function. */
|
|
11
|
+
export const REF_DOCUMENT_KINDS = ["workflow", "timeline"];
|
|
12
|
+
export function isRefDocumentKind(value) {
|
|
13
|
+
return REF_DOCUMENT_KINDS.includes(value);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The four sets stored per document. `viewer` and `editor` describe the
|
|
17
|
+
* current revision. `version_viewer` and `version_editor` describe one saved
|
|
18
|
+
* version. For whole documents, the viewer and editor sets are equal.
|
|
19
|
+
*/
|
|
20
|
+
export const DOCUMENT_REF_SCOPES = [
|
|
21
|
+
"viewer",
|
|
22
|
+
"editor",
|
|
23
|
+
"version_viewer",
|
|
24
|
+
"version_editor"
|
|
25
|
+
];
|
|
26
|
+
import { isRecord, isString } from "./predicates.js";
|
|
27
|
+
const ASSET_ID = /^[0-9a-f]{32}$/;
|
|
28
|
+
/** A field whose value is asset ids: `assetId`, `asset_ids`, `sourceVideoAssetId`, … */
|
|
29
|
+
const ASSET_ID_KEY = /asset_?ids?$/i;
|
|
30
|
+
/** A map keyed by asset id, such as `durationsByAssetId`. */
|
|
31
|
+
const BY_ASSET_ID_KEY = /by_?asset_?id$/i;
|
|
32
|
+
/** `/api/storage/<id>.<ext>` or `/api/storage/<owner>/<id>_thumb.<ext>` inside a URL. */
|
|
33
|
+
const STORAGE_PATH = /\/api\/storage\/(?:[^/?#]+\/)?([0-9a-f]{32})(?:_thumb|_proxy)?\.[A-Za-z0-9]+/g;
|
|
34
|
+
/** The asset id an `asset://` locator names, or null for any other string. */
|
|
35
|
+
function idFromLocator(value) {
|
|
36
|
+
if (!value.startsWith("asset://"))
|
|
37
|
+
return null;
|
|
38
|
+
const rest = value.slice("asset://".length).split(/[?#]/)[0];
|
|
39
|
+
const last = rest.slice(rest.lastIndexOf("/") + 1);
|
|
40
|
+
const id = last.replace(/\.[^.]+$/, "");
|
|
41
|
+
return ASSET_ID.test(id) ? id : null;
|
|
42
|
+
}
|
|
43
|
+
function addFromString(value, found) {
|
|
44
|
+
const locator = idFromLocator(value);
|
|
45
|
+
if (locator)
|
|
46
|
+
found.add(locator);
|
|
47
|
+
if (value.includes("/api/storage/")) {
|
|
48
|
+
for (const match of value.matchAll(STORAGE_PATH))
|
|
49
|
+
found.add(match[1]);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function addIds(value, found) {
|
|
53
|
+
if (isString(value)) {
|
|
54
|
+
if (ASSET_ID.test(value))
|
|
55
|
+
found.add(value);
|
|
56
|
+
}
|
|
57
|
+
else if (Array.isArray(value)) {
|
|
58
|
+
for (const item of value)
|
|
59
|
+
addIds(item, found);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function collect(content) {
|
|
63
|
+
const found = new Set();
|
|
64
|
+
const pending = [content];
|
|
65
|
+
while (pending.length > 0) {
|
|
66
|
+
const current = pending.pop();
|
|
67
|
+
if (isString(current)) {
|
|
68
|
+
addFromString(current, found);
|
|
69
|
+
}
|
|
70
|
+
else if (Array.isArray(current)) {
|
|
71
|
+
for (const item of current)
|
|
72
|
+
pending.push(item);
|
|
73
|
+
}
|
|
74
|
+
else if (isRecord(current)) {
|
|
75
|
+
for (const [key, child] of Object.entries(current)) {
|
|
76
|
+
if (ASSET_ID_KEY.test(key))
|
|
77
|
+
addIds(child, found);
|
|
78
|
+
if (BY_ASSET_ID_KEY.test(key) && isRecord(child)) {
|
|
79
|
+
for (const id of Object.keys(child)) {
|
|
80
|
+
if (ASSET_ID.test(id))
|
|
81
|
+
found.add(id);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
pending.push(child);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return found;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* The asset ids `content` refers to, sorted. `content` is the stored
|
|
92
|
+
* document: a workflow's graph, or a timeline's document. It may also be
|
|
93
|
+
* the JSON text of either.
|
|
94
|
+
*
|
|
95
|
+
* Both kinds are whole documents in phase 1, so every value they hold is
|
|
96
|
+
* current content: a clip's versions and a node's properties are followed
|
|
97
|
+
* like any other field. A reference is an `asset://` locator, a storage URL,
|
|
98
|
+
* a 32-character id under a field named like `assetId` or `asset_ids`, or a
|
|
99
|
+
* key of a map named like `durationsByAssetId`.
|
|
100
|
+
*/
|
|
101
|
+
export function refsOf(kind, content) {
|
|
102
|
+
if (!isRefDocumentKind(kind)) {
|
|
103
|
+
throw new Error(`No reference set function for ${String(kind)}`);
|
|
104
|
+
}
|
|
105
|
+
let value = content;
|
|
106
|
+
if (isString(content)) {
|
|
107
|
+
try {
|
|
108
|
+
value = JSON.parse(content);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// Not JSON: read the text as one string value.
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return [...collect(value)].sort();
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=closure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"closure.js","sourceRoot":"","sources":["../src/closure.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,UAAU,CAAU,CAAC;AAGpE,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAQ,kBAAyC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ;IACR,QAAQ;IACR,gBAAgB;IAChB,gBAAgB;CACR,CAAC;AAGX,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAElC,wFAAwF;AACxF,MAAM,YAAY,GAAG,eAAe,CAAC;AAErC,6DAA6D;AAC7D,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAE1C,yFAAyF;AACzF,MAAM,YAAY,GAChB,+EAA+E,CAAC;AAElF,8EAA8E;AAC9E,SAAS,aAAa,CAAC,KAAa;IAClC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CA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;YACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAY,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACP,+CAA+C;QACjD,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-profile.d.ts","sourceRoot":"","sources":["../src/cloud-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,oDAAoD;AACpD,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAEzC,8DAA8D;AAC9D,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EACvC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GACtC,OAAO,CAKT;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAsClD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAOjD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"cloud-profile.d.ts","sourceRoot":"","sources":["../src/cloud-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,oDAAoD;AACpD,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD,kFAAkF;AAClF,eAAO,MAAM,m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G,OAAO,CAMzD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|
package/dist/cloud-profile.js
CHANGED
|
@@ -148,7 +148,7 @@ export const CLOUD_HOST_FILE_NODES = [
|
|
|
148
148
|
"nodetool.input.FilePathInput",
|
|
149
149
|
"nodetool.input.FolderPathInput",
|
|
150
150
|
// Media loaders/savers that go to disk. Their asset-store siblings
|
|
151
|
-
// (
|
|
151
|
+
// (SaveImage, SaveAudio, SaveVideo, …) stay.
|
|
152
152
|
"nodetool.audio.LoadAudioFile",
|
|
153
153
|
"nodetool.audio.LoadAudioFolder",
|
|
154
154
|
"nodetool.audio.SaveAudioFile",
|
|
@@ -158,7 +158,14 @@ export const CLOUD_HOST_FILE_NODES = [
|
|
|
158
158
|
"nodetool.video.LoadVideoFile",
|
|
159
159
|
"nodetool.video.SaveVideoFile",
|
|
160
160
|
"nodetool.model3d.LoadModel3DFile",
|
|
161
|
-
"nodetool.model3d.SaveModel3DFile"
|
|
161
|
+
"nodetool.model3d.SaveModel3DFile",
|
|
162
|
+
// Named "Assets", but they read the folder ref's `uri` (or a plain string)
|
|
163
|
+
// as a host directory with fs.readdir/readFile. They never consult the
|
|
164
|
+
// asset store, so on a shared server they read whatever directory a graph
|
|
165
|
+
// names. nodetool.text.LoadTextAssets has the same shape (listed below).
|
|
166
|
+
"nodetool.image.LoadImageAssets",
|
|
167
|
+
"nodetool.audio.LoadAudioAssets",
|
|
168
|
+
"nodetool.video.LoadVideoAssets"
|
|
162
169
|
];
|
|
163
170
|
/**
|
|
164
171
|
* Node types removed even though their namespace is allowed. Three groups:
|
|
@@ -228,6 +235,8 @@ export const NON_CLOUD_PROVIDER_IDS = [
|
|
|
228
235
|
"claude_agent_sdk",
|
|
229
236
|
// A personal account reached by spawning the local `agy` CLI.
|
|
230
237
|
"antigravity",
|
|
238
|
+
// A personal account reached by spawning the local `copilot` CLI.
|
|
239
|
+
"copilot",
|
|
231
240
|
// A logged-in Dreamina tab in the user's own Chrome, reached through the
|
|
232
241
|
// NodeTool extension.
|
|
233
242
|
"dreamina",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-profile.js","sourceRoot":"","sources":["../src/cloud-profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,oDAAoD;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAEzD,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAC3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAClC,YAAuC,EACvC,YAAuC;IAEvC,IAAI,YAAY,IAAI,IAAI,IAAI,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACvD,OAAO,YAAY,KAAK,mBAAmB,CAAC;IAC9C,CAAC;IACD,OAAO,YAAY,KAAK,oBAAoB,CAAC;AAC/C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,uDAAuD;IACvD,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,oBAAoB,EAAE,+CAA+C;IACrE,gBAAgB,EAAE,+BAA+B;IACjD,cAAc,EAAE,mDAAmD;IAEnE,+BAA+B;IAC/B,4EAA4E;IAC5E,oDAAoD;IACpD,eAAe,EAAE,oEAAoE;IACrF,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB,EAAE,8BAA8B;IAChD,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,qBAAqB;IACrB,iBAAiB,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;IACR,UAAU;IACV,cAAc;IACd,oBAAoB;IACpB,UAAU;IACV,YAAY;IACZ,kBAAkB;IAClB,QAAQ;IACR,aAAa;IACb,aAAa;IACb,YAAY;CACb,CAAC;AAEF,wEAAwE;AACxE,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,OAAO,CAAC,2BAA2B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEhF;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,IAAI,oBAAoB,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IACzD,IAAI,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IACzD,OAAO,qBAAqB,CAAC,IAAI,CAC/B,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,EAAE,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CACzD,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,OAAO,CAAC,sBAAsB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AACtD,CAAC"}
|
package/dist/comfy-graph.d.ts
CHANGED
|
@@ -88,8 +88,14 @@ export declare function isComfyNodeType(type: unknown): type is string;
|
|
|
88
88
|
/** The ComfyUI class name behind a `comfy.<ClassName>` node type. */
|
|
89
89
|
export declare function comfyClassType(nodeType: string): string;
|
|
90
90
|
/**
|
|
91
|
-
* True
|
|
92
|
-
*
|
|
91
|
+
* True for a standard workflow Input or Output node. These nodes give a Comfy
|
|
92
|
+
* workflow the same inputs and outputs as any other workflow.
|
|
93
|
+
*/
|
|
94
|
+
export declare function isComfyBoundaryNodeType(type: unknown): type is string;
|
|
95
|
+
/**
|
|
96
|
+
* True when the graph has a ComfyUI node class and every other runnable node
|
|
97
|
+
* is a workflow Input or Output. Editor annotations (comments, groups,
|
|
98
|
+
* previews) do not count either way.
|
|
93
99
|
*/
|
|
94
100
|
export declare function isComfyGraph(graph: {
|
|
95
101
|
nodes: ReadonlyArray<{
|
|
@@ -102,9 +108,16 @@ export declare function isComfyGraph(graph: {
|
|
|
102
108
|
*/
|
|
103
109
|
export declare function comfyOutputNames(entry: ComfyObjectInfoEntry): string[];
|
|
104
110
|
/** NodeTool metadata for one ComfyUI node class. */
|
|
105
|
-
|
|
111
|
+
/**
|
|
112
|
+
* `requiredSettings` names the settings a run on the selected target needs:
|
|
113
|
+
* `COMFY_API_KEY` for Comfy Cloud, none for the user's own server or worker.
|
|
114
|
+
*/
|
|
115
|
+
export interface ComfyMetadataOptions {
|
|
116
|
+
requiredSettings?: string[];
|
|
117
|
+
}
|
|
118
|
+
export declare function comfyEntryToMetadata(className: string, entry: ComfyObjectInfoEntry, options?: ComfyMetadataOptions): NodeMetadata;
|
|
106
119
|
/** NodeTool metadata for every class in a ComfyUI `/api/object_info` map. */
|
|
107
|
-
export declare function comfyObjectInfoToMetadata(info: ComfyObjectInfo): NodeMetadata[];
|
|
120
|
+
export declare function comfyObjectInfoToMetadata(info: ComfyObjectInfo, options?: ComfyMetadataOptions): NodeMetadata[];
|
|
108
121
|
/**
|
|
109
122
|
* Compile a graph of `comfy.*` nodes to ComfyUI's API format.
|
|
110
123
|
*
|
|
@@ -119,15 +132,32 @@ export declare function buildComfyPrompt(graph: ComfyGraph, outputNames: (classT
|
|
|
119
132
|
* left to right by dependency depth.
|
|
120
133
|
*/
|
|
121
134
|
export declare function comfyPromptToGraph(prompt: ComfyApiPrompt, outputNames: (classType: string) => string[] | undefined): ComfyGraph;
|
|
135
|
+
/**
|
|
136
|
+
* The graph as contract readers and the kernel see it. A stored Comfy graph
|
|
137
|
+
* holds only ComfyUI nodes, so this derives its contract: one input per Load
|
|
138
|
+
* node and for the positive prompt, one output per Save node. The result is
|
|
139
|
+
* never saved. A graph with its own Input or Output nodes keeps them, and any
|
|
140
|
+
* other graph is returned unchanged.
|
|
141
|
+
*
|
|
142
|
+
* Node ids are derived from the Comfy node and field, so a binding to a derived
|
|
143
|
+
* input stays valid across runs.
|
|
144
|
+
*/
|
|
145
|
+
export declare function exposeComfyInterface<G extends {
|
|
146
|
+
nodes: readonly object[];
|
|
147
|
+
edges: readonly object[];
|
|
148
|
+
}>(source: G): G;
|
|
122
149
|
/**
|
|
123
150
|
* Replace a Comfy graph with the single runner node the kernel executes. The
|
|
124
151
|
* runner carries the original nodes and edges and compiles them at run time,
|
|
125
|
-
* when it has the Comfy catalog to resolve output socket indexes.
|
|
152
|
+
* when it has the Comfy catalog to resolve output socket indexes. Input and
|
|
153
|
+
* Output nodes stay in the graph. An edge from an Input becomes a runner input
|
|
154
|
+
* `<comfyNodeId>:<field>`, and an edge to an Output reads the runner output
|
|
155
|
+
* `<comfyNodeId>:<handle>`.
|
|
126
156
|
*
|
|
127
157
|
* Returns the graph unchanged when it is not a Comfy graph.
|
|
128
158
|
*/
|
|
129
159
|
export declare function collapseComfyGraph<G extends {
|
|
130
160
|
nodes: readonly object[];
|
|
131
161
|
edges: readonly object[];
|
|
132
|
-
}>(
|
|
162
|
+
}>(source: G): G;
|
|
133
163
|
//# sourceMappingURL=comfy-graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comfy-graph.d.ts","sourceRoot":"","sources":["../src/comfy-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA8C,MAAM,gBAAgB,CAAC;AAG/F,8DAA8D;AAC9D,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C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"}
|
package/dist/comfy-graph.js
CHANGED
|
@@ -51,14 +51,25 @@ export function comfyClassType(nodeType) {
|
|
|
51
51
|
return nodeType.slice(COMFY_NODE_PREFIX.length);
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* True
|
|
55
|
-
*
|
|
54
|
+
* True for a standard workflow Input or Output node. These nodes give a Comfy
|
|
55
|
+
* workflow the same inputs and outputs as any other workflow.
|
|
56
|
+
*/
|
|
57
|
+
export function isComfyBoundaryNodeType(type) {
|
|
58
|
+
return (isString(type) &&
|
|
59
|
+
(type.startsWith("nodetool.input.") || type.startsWith("nodetool.output.")));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* True when the graph has a ComfyUI node class and every other runnable node
|
|
63
|
+
* is a workflow Input or Output. Editor annotations (comments, groups,
|
|
64
|
+
* previews) do not count either way.
|
|
56
65
|
*/
|
|
57
66
|
export function isComfyGraph(graph) {
|
|
58
67
|
let comfy = 0;
|
|
59
68
|
for (const node of graph.nodes) {
|
|
60
69
|
if (isString(node.type) && EDITOR_ONLY_TYPES.has(node.type))
|
|
61
70
|
continue;
|
|
71
|
+
if (isComfyBoundaryNodeType(node.type))
|
|
72
|
+
continue;
|
|
62
73
|
if (!isComfyNodeType(node.type))
|
|
63
74
|
return false;
|
|
64
75
|
comfy += 1;
|
|
@@ -95,7 +106,7 @@ function enumProperty(name, values, opts, required) {
|
|
|
95
106
|
/**
|
|
96
107
|
* Properties for one ComfyUI input. A dynamic combo (`COMFY_DYNAMICCOMBO_V3`)
|
|
97
108
|
* is an enum of its option keys plus the inputs of its default option,
|
|
98
|
-
* flattened, which is how the API format carries them (`format`, `codec`).
|
|
109
|
+
* flattened, which is how the API format carries them (`format`, `format.codec`).
|
|
99
110
|
*/
|
|
100
111
|
function inputProperties(name, spec, required, depth = 0) {
|
|
101
112
|
if (!Array.isArray(spec) || spec.length === 0)
|
|
@@ -128,7 +139,7 @@ function inputProperties(name, spec, required, depth = 0) {
|
|
|
128
139
|
if (!isRecord(group))
|
|
129
140
|
continue;
|
|
130
141
|
for (const [child, childSpec] of Object.entries(group)) {
|
|
131
|
-
out.push(...inputProperties(child
|
|
142
|
+
out.push(...inputProperties(`${name}.${child}`, childSpec, section === "required" && required, depth + 1));
|
|
132
143
|
}
|
|
133
144
|
}
|
|
134
145
|
}
|
|
@@ -212,8 +223,7 @@ function orderedInputs(entry, section) {
|
|
|
212
223
|
const names = Array.isArray(order) && order.length > 0 ? order : Object.keys(group);
|
|
213
224
|
return names.filter((n) => n in group).map((n) => [n, group[n]]);
|
|
214
225
|
}
|
|
215
|
-
|
|
216
|
-
export function comfyEntryToMetadata(className, entry) {
|
|
226
|
+
export function comfyEntryToMetadata(className, entry, options = {}) {
|
|
217
227
|
const properties = [];
|
|
218
228
|
const seen = new Set();
|
|
219
229
|
for (const section of ["required", "optional"]) {
|
|
@@ -272,7 +282,7 @@ export function comfyEntryToMetadata(className, entry) {
|
|
|
272
282
|
inline_fields: properties
|
|
273
283
|
.filter((p) => !(p.type.type === "any" || p.type.type.startsWith(COMFY_SOCKET_PREFIX)))
|
|
274
284
|
.map((p) => p.name),
|
|
275
|
-
required_settings: ["COMFY_API_KEY"],
|
|
285
|
+
required_settings: options.requiredSettings ?? ["COMFY_API_KEY"],
|
|
276
286
|
supports_dynamic_inputs: false,
|
|
277
287
|
supports_dynamic_outputs: false,
|
|
278
288
|
is_streaming_output: false,
|
|
@@ -280,17 +290,20 @@ export function comfyEntryToMetadata(className, entry) {
|
|
|
280
290
|
deprecated: entry.deprecated === true,
|
|
281
291
|
platforms: ["node"]
|
|
282
292
|
};
|
|
283
|
-
if (primaryOutput)
|
|
293
|
+
if (primaryOutput) {
|
|
284
294
|
metadata.primary_output = primaryOutput;
|
|
295
|
+
// The runner saves this node's files under its id, so its history reloads.
|
|
296
|
+
metadata.auto_save_asset = true;
|
|
297
|
+
}
|
|
285
298
|
return metadata;
|
|
286
299
|
}
|
|
287
300
|
/** NodeTool metadata for every class in a ComfyUI `/api/object_info` map. */
|
|
288
|
-
export function comfyObjectInfoToMetadata(info) {
|
|
301
|
+
export function comfyObjectInfoToMetadata(info, options = {}) {
|
|
289
302
|
const out = [];
|
|
290
303
|
for (const [className, entry] of Object.entries(info)) {
|
|
291
304
|
if (!isRecord(entry))
|
|
292
305
|
continue;
|
|
293
|
-
out.push(comfyEntryToMetadata(className, entry));
|
|
306
|
+
out.push(comfyEntryToMetadata(className, entry, options));
|
|
294
307
|
}
|
|
295
308
|
return out;
|
|
296
309
|
}
|
|
@@ -423,19 +436,172 @@ export function comfyPromptToGraph(prompt, outputNames) {
|
|
|
423
436
|
}
|
|
424
437
|
return { nodes, edges };
|
|
425
438
|
}
|
|
439
|
+
const SAVE_CLASS = /^(Save|VHS_VideoCombine)/;
|
|
440
|
+
const INPUT_NODE_TYPES = {
|
|
441
|
+
image: "nodetool.input.ImageInput",
|
|
442
|
+
audio: "nodetool.input.AudioInput",
|
|
443
|
+
video: "nodetool.input.VideoInput"
|
|
444
|
+
};
|
|
445
|
+
/** The Load classes a run can feed, with the field that names the file. */
|
|
446
|
+
const LOAD_CLASSES = {
|
|
447
|
+
LoadImage: { kind: "image", field: "image" },
|
|
448
|
+
LoadAudio: { kind: "audio", field: "audio" },
|
|
449
|
+
LoadVideo: { kind: "video", field: "file" }
|
|
450
|
+
};
|
|
451
|
+
const PROMPT_FIELDS = ["text", "prompt", "tags", "caption"];
|
|
452
|
+
function saveKind(classType) {
|
|
453
|
+
if (!SAVE_CLASS.test(classType))
|
|
454
|
+
return null;
|
|
455
|
+
if (/Video/.test(classType))
|
|
456
|
+
return "video";
|
|
457
|
+
if (/Audio/.test(classType))
|
|
458
|
+
return "audio";
|
|
459
|
+
return /Image|WEBP|PNG/.test(classType) ? "image" : null;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* The node and field that hold the positive prompt: walk upstream from the
|
|
463
|
+
* `positive` socket to the first node with a literal prompt field. A graph with
|
|
464
|
+
* no `positive` socket uses its only text encoder.
|
|
465
|
+
*/
|
|
466
|
+
function positivePrompt(graph) {
|
|
467
|
+
const byId = new Map(graph.nodes.map((node) => [node.id, node]));
|
|
468
|
+
const promptField = (node) => /^comfy\.PrimitiveString/.test(node.type) && isString(nodeValues(node).value)
|
|
469
|
+
? "value"
|
|
470
|
+
: PROMPT_FIELDS.find((field) => isString(nodeValues(node)[field]));
|
|
471
|
+
const pending = graph.edges.filter((e) => e.targetHandle === "positive").map((e) => e.source);
|
|
472
|
+
const seen = new Set();
|
|
473
|
+
while (pending.length > 0) {
|
|
474
|
+
const id = pending.shift();
|
|
475
|
+
if (seen.has(id))
|
|
476
|
+
continue;
|
|
477
|
+
seen.add(id);
|
|
478
|
+
const node = byId.get(id);
|
|
479
|
+
if (!node)
|
|
480
|
+
continue;
|
|
481
|
+
const field = promptField(node);
|
|
482
|
+
if (field)
|
|
483
|
+
return { node, field };
|
|
484
|
+
pending.push(...graph.edges.filter((e) => e.target === id).map((e) => e.source));
|
|
485
|
+
}
|
|
486
|
+
const encoders = graph.nodes.filter((node) => isComfyNodeType(node.type) && /TextEncode/.test(node.type) && promptField(node));
|
|
487
|
+
const [only] = encoders;
|
|
488
|
+
return encoders.length === 1 && only ? { node: only, field: promptField(only) } : null;
|
|
489
|
+
}
|
|
490
|
+
function nodePosition(node) {
|
|
491
|
+
const position = isRecord(node.ui_properties) ? node.ui_properties.position : null;
|
|
492
|
+
return isRecord(position) && isNumber(position.x) && isNumber(position.y)
|
|
493
|
+
? { x: position.x, y: position.y }
|
|
494
|
+
: { x: 0, y: 0 };
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* The graph as contract readers and the kernel see it. A stored Comfy graph
|
|
498
|
+
* holds only ComfyUI nodes, so this derives its contract: one input per Load
|
|
499
|
+
* node and for the positive prompt, one output per Save node. The result is
|
|
500
|
+
* never saved. A graph with its own Input or Output nodes keeps them, and any
|
|
501
|
+
* other graph is returned unchanged.
|
|
502
|
+
*
|
|
503
|
+
* Node ids are derived from the Comfy node and field, so a binding to a derived
|
|
504
|
+
* input stays valid across runs.
|
|
505
|
+
*/
|
|
506
|
+
export function exposeComfyInterface(source) {
|
|
507
|
+
const nodesIn = source.nodes;
|
|
508
|
+
if (!isComfyGraph({ nodes: nodesIn }))
|
|
509
|
+
return source;
|
|
510
|
+
if (nodesIn.some((node) => isComfyBoundaryNodeType(node.type)))
|
|
511
|
+
return source;
|
|
512
|
+
const graph = source;
|
|
513
|
+
const added = [];
|
|
514
|
+
const addedEdges = [];
|
|
515
|
+
const counts = new Map();
|
|
516
|
+
const uniqueName = (base) => {
|
|
517
|
+
const count = (counts.get(base) ?? 0) + 1;
|
|
518
|
+
counts.set(base, count);
|
|
519
|
+
return count === 1 ? base : `${base}_${count}`;
|
|
520
|
+
};
|
|
521
|
+
const addInput = (target, field, type, name, value) => {
|
|
522
|
+
const id = `input_${target.id}_${field}`;
|
|
523
|
+
const { x, y } = nodePosition(target);
|
|
524
|
+
added.push({
|
|
525
|
+
id,
|
|
526
|
+
type,
|
|
527
|
+
data: { name, description: "", value },
|
|
528
|
+
// Editor readers use `data`, and the kernel uses `properties`.
|
|
529
|
+
properties: { name, description: "", value },
|
|
530
|
+
ui_properties: { position: { x: x - 340, y }, width: 280 },
|
|
531
|
+
dynamic_properties: {},
|
|
532
|
+
dynamic_outputs: {}
|
|
533
|
+
});
|
|
534
|
+
addedEdges.push({
|
|
535
|
+
id: `${id}-${target.id}`,
|
|
536
|
+
source: id,
|
|
537
|
+
sourceHandle: "output",
|
|
538
|
+
target: target.id,
|
|
539
|
+
targetHandle: field,
|
|
540
|
+
ui_properties: null
|
|
541
|
+
});
|
|
542
|
+
};
|
|
543
|
+
const prompt = positivePrompt(graph);
|
|
544
|
+
if (prompt) {
|
|
545
|
+
addInput(prompt.node, prompt.field, "nodetool.input.StringInput", uniqueName("prompt"), nodeValues(prompt.node)[prompt.field]);
|
|
546
|
+
}
|
|
547
|
+
const nodes = graph.nodes.map((node) => {
|
|
548
|
+
if (!isComfyNodeType(node.type))
|
|
549
|
+
return node;
|
|
550
|
+
const classType = comfyClassType(node.type);
|
|
551
|
+
const load = LOAD_CLASSES[classType];
|
|
552
|
+
if (load) {
|
|
553
|
+
addInput(node, load.field, INPUT_NODE_TYPES[load.kind], uniqueName(load.kind), { type: load.kind, uri: "" });
|
|
554
|
+
return node;
|
|
555
|
+
}
|
|
556
|
+
const kind = saveKind(classType);
|
|
557
|
+
if (!kind)
|
|
558
|
+
return node;
|
|
559
|
+
const id = `output_${node.id}`;
|
|
560
|
+
const outputName = uniqueName("output");
|
|
561
|
+
const { x, y } = nodePosition(node);
|
|
562
|
+
added.push({
|
|
563
|
+
id,
|
|
564
|
+
type: "nodetool.output.Output",
|
|
565
|
+
data: { name: outputName, description: "" },
|
|
566
|
+
properties: { name: outputName, description: "" },
|
|
567
|
+
ui_properties: { position: { x: x + 340, y }, width: 280 },
|
|
568
|
+
dynamic_properties: {},
|
|
569
|
+
dynamic_outputs: {}
|
|
570
|
+
});
|
|
571
|
+
addedEdges.push({
|
|
572
|
+
id: `${node.id}-${id}`,
|
|
573
|
+
source: node.id,
|
|
574
|
+
sourceHandle: "output",
|
|
575
|
+
target: id,
|
|
576
|
+
targetHandle: "value",
|
|
577
|
+
ui_properties: null
|
|
578
|
+
});
|
|
579
|
+
const dynamicOutputs = { ...node.dynamic_outputs };
|
|
580
|
+
dynamicOutputs.output = { type: kind, optional: true, type_args: [] };
|
|
581
|
+
return { ...node, dynamic_outputs: dynamicOutputs };
|
|
582
|
+
});
|
|
583
|
+
return { ...source, nodes: [...nodes, ...added], edges: [...graph.edges, ...addedEdges] };
|
|
584
|
+
}
|
|
426
585
|
/**
|
|
427
586
|
* Replace a Comfy graph with the single runner node the kernel executes. The
|
|
428
587
|
* runner carries the original nodes and edges and compiles them at run time,
|
|
429
|
-
* when it has the Comfy catalog to resolve output socket indexes.
|
|
588
|
+
* when it has the Comfy catalog to resolve output socket indexes. Input and
|
|
589
|
+
* Output nodes stay in the graph. An edge from an Input becomes a runner input
|
|
590
|
+
* `<comfyNodeId>:<field>`, and an edge to an Output reads the runner output
|
|
591
|
+
* `<comfyNodeId>:<handle>`.
|
|
430
592
|
*
|
|
431
593
|
* Returns the graph unchanged when it is not a Comfy graph.
|
|
432
594
|
*/
|
|
433
|
-
export function collapseComfyGraph(
|
|
595
|
+
export function collapseComfyGraph(source) {
|
|
596
|
+
if (!isComfyGraph({ nodes: source.nodes }))
|
|
597
|
+
return source;
|
|
598
|
+
const graph = exposeComfyInterface(source);
|
|
434
599
|
const nodes = graph.nodes;
|
|
435
600
|
const edges = graph.edges;
|
|
436
|
-
if (!isComfyGraph({ nodes }))
|
|
437
|
-
return graph;
|
|
438
601
|
const comfyNodes = nodes.filter((n) => isComfyNodeType(n.type));
|
|
602
|
+
const boundaryNodes = nodes.filter((n) => isComfyBoundaryNodeType(n.type));
|
|
603
|
+
const comfyIds = new Set(comfyNodes.map((n) => String(n.id)));
|
|
604
|
+
const keptIds = new Set(boundaryNodes.map((n) => String(n.id)));
|
|
439
605
|
const data = {
|
|
440
606
|
nodes: comfyNodes.map((n) => ({
|
|
441
607
|
id: String(n.id),
|
|
@@ -444,21 +610,49 @@ export function collapseComfyGraph(graph) {
|
|
|
444
610
|
ui_properties: isRecord(n.ui_properties) ? { title: n.ui_properties.title } : null
|
|
445
611
|
})),
|
|
446
612
|
edges: edges
|
|
447
|
-
.filter((e) => e.edge_type !== "control"
|
|
613
|
+
.filter((e) => e.edge_type !== "control" &&
|
|
614
|
+
comfyIds.has(String(e.source)) &&
|
|
615
|
+
comfyIds.has(String(e.target)))
|
|
448
616
|
.map((e) => ({
|
|
449
617
|
source: String(e.source),
|
|
450
618
|
sourceHandle: String(e.sourceHandle ?? ""),
|
|
451
619
|
target: String(e.target),
|
|
452
620
|
targetHandle: String(e.targetHandle ?? "")
|
|
453
|
-
}))
|
|
621
|
+
})),
|
|
622
|
+
output_slots: []
|
|
454
623
|
};
|
|
624
|
+
const dynamicOutputs = {};
|
|
625
|
+
const boundaryEdges = [];
|
|
626
|
+
for (const edge of edges) {
|
|
627
|
+
const fromComfy = comfyIds.has(String(edge.source));
|
|
628
|
+
const toComfy = comfyIds.has(String(edge.target));
|
|
629
|
+
if (fromComfy && toComfy)
|
|
630
|
+
continue;
|
|
631
|
+
if (fromComfy && keptIds.has(String(edge.target))) {
|
|
632
|
+
const slot = `${String(edge.source)}:${String(edge.sourceHandle ?? "")}`;
|
|
633
|
+
data.output_slots.push(slot);
|
|
634
|
+
dynamicOutputs[slot] = { type: "any", optional: true, type_args: [] };
|
|
635
|
+
boundaryEdges.push({ ...edge, source: COMFY_CLOUD_GRAPH_NODE_ID, sourceHandle: slot });
|
|
636
|
+
}
|
|
637
|
+
else if (toComfy && keptIds.has(String(edge.source))) {
|
|
638
|
+
boundaryEdges.push({
|
|
639
|
+
...edge,
|
|
640
|
+
target: COMFY_CLOUD_GRAPH_NODE_ID,
|
|
641
|
+
targetHandle: `${String(edge.target)}:${String(edge.targetHandle ?? "")}`
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
else if (keptIds.has(String(edge.source)) && keptIds.has(String(edge.target))) {
|
|
645
|
+
boundaryEdges.push(edge);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
455
648
|
// The saved form reads `data`, the normalized form `properties`.
|
|
456
649
|
const runner = {
|
|
457
650
|
id: COMFY_CLOUD_GRAPH_NODE_ID,
|
|
458
651
|
type: COMFY_CLOUD_GRAPH_NODE_TYPE,
|
|
459
652
|
data,
|
|
460
|
-
properties: data
|
|
653
|
+
properties: data,
|
|
654
|
+
dynamic_outputs: dynamicOutputs
|
|
461
655
|
};
|
|
462
|
-
return { ...graph, nodes: [runner], edges:
|
|
656
|
+
return { ...graph, nodes: [runner, ...boundaryNodes], edges: boundaryEdges };
|
|
463
657
|
}
|
|
464
658
|
//# sourceMappingURL=comfy-graph.js.map
|