@nodetool-ai/base-nodes 0.7.0-rc.11
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/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +270 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/audio-wav.d.ts +66 -0
- package/dist/lib/audio-wav.d.ts.map +1 -0
- package/dist/lib/audio-wav.js +215 -0
- package/dist/lib/audio-wav.js.map +1 -0
- package/dist/nodes/agents.d.ts +253 -0
- package/dist/nodes/agents.d.ts.map +1 -0
- package/dist/nodes/agents.js +2784 -0
- package/dist/nodes/agents.js.map +1 -0
- package/dist/nodes/anthropic.d.ts +26 -0
- package/dist/nodes/anthropic.d.ts.map +1 -0
- package/dist/nodes/anthropic.js +133 -0
- package/dist/nodes/anthropic.js.map +1 -0
- package/dist/nodes/apify.d.ts +120 -0
- package/dist/nodes/apify.d.ts.map +1 -0
- package/dist/nodes/apify.js +618 -0
- package/dist/nodes/apify.js.map +1 -0
- package/dist/nodes/audio.d.ts +301 -0
- package/dist/nodes/audio.d.ts.map +1 -0
- package/dist/nodes/audio.js +1274 -0
- package/dist/nodes/audio.js.map +1 -0
- package/dist/nodes/code-node.d.ts +34 -0
- package/dist/nodes/code-node.d.ts.map +1 -0
- package/dist/nodes/code-node.js +343 -0
- package/dist/nodes/code-node.js.map +1 -0
- package/dist/nodes/code.d.ts +301 -0
- package/dist/nodes/code.d.ts.map +1 -0
- package/dist/nodes/code.js +850 -0
- package/dist/nodes/code.js.map +1 -0
- package/dist/nodes/compare.d.ts +18 -0
- package/dist/nodes/compare.d.ts.map +1 -0
- package/dist/nodes/compare.js +122 -0
- package/dist/nodes/compare.js.map +1 -0
- package/dist/nodes/constant.d.ts +315 -0
- package/dist/nodes/constant.d.ts.map +1 -0
- package/dist/nodes/constant.js +715 -0
- package/dist/nodes/constant.js.map +1 -0
- package/dist/nodes/control.d.ts +83 -0
- package/dist/nodes/control.d.ts.map +1 -0
- package/dist/nodes/control.js +212 -0
- package/dist/nodes/control.js.map +1 -0
- package/dist/nodes/data.d.ts +369 -0
- package/dist/nodes/data.d.ts.map +1 -0
- package/dist/nodes/data.js +1590 -0
- package/dist/nodes/data.js.map +1 -0
- package/dist/nodes/document.d.ts +134 -0
- package/dist/nodes/document.d.ts.map +1 -0
- package/dist/nodes/document.js +984 -0
- package/dist/nodes/document.js.map +1 -0
- package/dist/nodes/extended-placeholders.d.ts +6 -0
- package/dist/nodes/extended-placeholders.d.ts.map +1 -0
- package/dist/nodes/extended-placeholders.js +19 -0
- package/dist/nodes/extended-placeholders.js.map +1 -0
- package/dist/nodes/gemini.d.ts +109 -0
- package/dist/nodes/gemini.d.ts.map +1 -0
- package/dist/nodes/gemini.js +861 -0
- package/dist/nodes/gemini.js.map +1 -0
- package/dist/nodes/generators.d.ts +84 -0
- package/dist/nodes/generators.d.ts.map +1 -0
- package/dist/nodes/generators.js +937 -0
- package/dist/nodes/generators.js.map +1 -0
- package/dist/nodes/image.d.ts +232 -0
- package/dist/nodes/image.d.ts.map +1 -0
- package/dist/nodes/image.js +1395 -0
- package/dist/nodes/image.js.map +1 -0
- package/dist/nodes/input.d.ts +445 -0
- package/dist/nodes/input.d.ts.map +1 -0
- package/dist/nodes/input.js +1459 -0
- package/dist/nodes/input.js.map +1 -0
- package/dist/nodes/kie-dynamic.d.ts +31 -0
- package/dist/nodes/kie-dynamic.d.ts.map +1 -0
- package/dist/nodes/kie-dynamic.js +270 -0
- package/dist/nodes/kie-dynamic.js.map +1 -0
- package/dist/nodes/lib-audio-dsp.d.ts +85 -0
- package/dist/nodes/lib-audio-dsp.d.ts.map +1 -0
- package/dist/nodes/lib-audio-dsp.js +450 -0
- package/dist/nodes/lib-audio-dsp.js.map +1 -0
- package/dist/nodes/lib-audio-effects.d.ts +116 -0
- package/dist/nodes/lib-audio-effects.d.ts.map +1 -0
- package/dist/nodes/lib-audio-effects.js +905 -0
- package/dist/nodes/lib-audio-effects.js.map +1 -0
- package/dist/nodes/lib-browser.d.ts +99 -0
- package/dist/nodes/lib-browser.d.ts.map +1 -0
- package/dist/nodes/lib-browser.js +692 -0
- package/dist/nodes/lib-browser.js.map +1 -0
- package/dist/nodes/lib-charts.d.ts +20 -0
- package/dist/nodes/lib-charts.d.ts.map +1 -0
- package/dist/nodes/lib-charts.js +245 -0
- package/dist/nodes/lib-charts.js.map +1 -0
- package/dist/nodes/lib-datetime.d.ts +108 -0
- package/dist/nodes/lib-datetime.d.ts.map +1 -0
- package/dist/nodes/lib-datetime.js +421 -0
- package/dist/nodes/lib-datetime.js.map +1 -0
- package/dist/nodes/lib-doc-convert.d.ts +19 -0
- package/dist/nodes/lib-doc-convert.d.ts.map +1 -0
- package/dist/nodes/lib-doc-convert.js +257 -0
- package/dist/nodes/lib-doc-convert.js.map +1 -0
- package/dist/nodes/lib-doc-transform.d.ts +39 -0
- package/dist/nodes/lib-doc-transform.d.ts.map +1 -0
- package/dist/nodes/lib-doc-transform.js +335 -0
- package/dist/nodes/lib-doc-transform.js.map +1 -0
- package/dist/nodes/lib-docx.d.ts +106 -0
- package/dist/nodes/lib-docx.d.ts.map +1 -0
- package/dist/nodes/lib-docx.js +595 -0
- package/dist/nodes/lib-docx.js.map +1 -0
- package/dist/nodes/lib-epub.d.ts +55 -0
- package/dist/nodes/lib-epub.d.ts.map +1 -0
- package/dist/nodes/lib-epub.js +220 -0
- package/dist/nodes/lib-epub.js.map +1 -0
- package/dist/nodes/lib-excel.d.ts +74 -0
- package/dist/nodes/lib-excel.d.ts.map +1 -0
- package/dist/nodes/lib-excel.js +448 -0
- package/dist/nodes/lib-excel.js.map +1 -0
- package/dist/nodes/lib-graphql.d.ts +66 -0
- package/dist/nodes/lib-graphql.d.ts.map +1 -0
- package/dist/nodes/lib-graphql.js +333 -0
- package/dist/nodes/lib-graphql.js.map +1 -0
- package/dist/nodes/lib-grid.d.ts +27 -0
- package/dist/nodes/lib-grid.d.ts.map +1 -0
- package/dist/nodes/lib-grid.js +172 -0
- package/dist/nodes/lib-grid.js.map +1 -0
- package/dist/nodes/lib-html-parse.d.ts +108 -0
- package/dist/nodes/lib-html-parse.d.ts.map +1 -0
- package/dist/nodes/lib-html-parse.js +365 -0
- package/dist/nodes/lib-html-parse.js.map +1 -0
- package/dist/nodes/lib-http.d.ts +98 -0
- package/dist/nodes/lib-http.d.ts.map +1 -0
- package/dist/nodes/lib-http.js +267 -0
- package/dist/nodes/lib-http.js.map +1 -0
- package/dist/nodes/lib-image-color-grading.d.ts +3 -0
- package/dist/nodes/lib-image-color-grading.d.ts.map +1 -0
- package/dist/nodes/lib-image-color-grading.js +1386 -0
- package/dist/nodes/lib-image-color-grading.js.map +1 -0
- package/dist/nodes/lib-image-draw.d.ts +3 -0
- package/dist/nodes/lib-image-draw.d.ts.map +1 -0
- package/dist/nodes/lib-image-draw.js +470 -0
- package/dist/nodes/lib-image-draw.js.map +1 -0
- package/dist/nodes/lib-image-enhance.d.ts +3 -0
- package/dist/nodes/lib-image-enhance.d.ts.map +1 -0
- package/dist/nodes/lib-image-enhance.js +731 -0
- package/dist/nodes/lib-image-enhance.js.map +1 -0
- package/dist/nodes/lib-image-filter.d.ts +3 -0
- package/dist/nodes/lib-image-filter.d.ts.map +1 -0
- package/dist/nodes/lib-image-filter.js +684 -0
- package/dist/nodes/lib-image-filter.js.map +1 -0
- package/dist/nodes/lib-image-utils.d.ts +24 -0
- package/dist/nodes/lib-image-utils.d.ts.map +1 -0
- package/dist/nodes/lib-image-utils.js +150 -0
- package/dist/nodes/lib-image-utils.js.map +1 -0
- package/dist/nodes/lib-mail.d.ts +74 -0
- package/dist/nodes/lib-mail.d.ts.map +1 -0
- package/dist/nodes/lib-mail.js +452 -0
- package/dist/nodes/lib-mail.js.map +1 -0
- package/dist/nodes/lib-markdown.d.ts +70 -0
- package/dist/nodes/lib-markdown.d.ts.map +1 -0
- package/dist/nodes/lib-markdown.js +236 -0
- package/dist/nodes/lib-markdown.js.map +1 -0
- package/dist/nodes/lib-nlp.d.ts +98 -0
- package/dist/nodes/lib-nlp.d.ts.map +1 -0
- package/dist/nodes/lib-nlp.js +374 -0
- package/dist/nodes/lib-nlp.js.map +1 -0
- package/dist/nodes/lib-notion.d.ts +99 -0
- package/dist/nodes/lib-notion.d.ts.map +1 -0
- package/dist/nodes/lib-notion.js +601 -0
- package/dist/nodes/lib-notion.js.map +1 -0
- package/dist/nodes/lib-ocr.d.ts +31 -0
- package/dist/nodes/lib-ocr.d.ts.map +1 -0
- package/dist/nodes/lib-ocr.js +143 -0
- package/dist/nodes/lib-ocr.js.map +1 -0
- package/dist/nodes/lib-os.d.ts +312 -0
- package/dist/nodes/lib-os.d.ts.map +1 -0
- package/dist/nodes/lib-os.js +909 -0
- package/dist/nodes/lib-os.js.map +1 -0
- package/dist/nodes/lib-pdf.d.ts +142 -0
- package/dist/nodes/lib-pdf.d.ts.map +1 -0
- package/dist/nodes/lib-pdf.js +871 -0
- package/dist/nodes/lib-pdf.js.map +1 -0
- package/dist/nodes/lib-pptx.d.ts +29 -0
- package/dist/nodes/lib-pptx.d.ts.map +1 -0
- package/dist/nodes/lib-pptx.js +122 -0
- package/dist/nodes/lib-pptx.js.map +1 -0
- package/dist/nodes/lib-rss.d.ts +31 -0
- package/dist/nodes/lib-rss.d.ts.map +1 -0
- package/dist/nodes/lib-rss.js +163 -0
- package/dist/nodes/lib-rss.js.map +1 -0
- package/dist/nodes/lib-s3.d.ts +112 -0
- package/dist/nodes/lib-s3.d.ts.map +1 -0
- package/dist/nodes/lib-s3.js +521 -0
- package/dist/nodes/lib-s3.js.map +1 -0
- package/dist/nodes/lib-secret.d.ts +15 -0
- package/dist/nodes/lib-secret.d.ts.map +1 -0
- package/dist/nodes/lib-secret.js +42 -0
- package/dist/nodes/lib-secret.js.map +1 -0
- package/dist/nodes/lib-sqlite.d.ts +102 -0
- package/dist/nodes/lib-sqlite.d.ts.map +1 -0
- package/dist/nodes/lib-sqlite.js +532 -0
- package/dist/nodes/lib-sqlite.js.map +1 -0
- package/dist/nodes/lib-supabase.d.ts +86 -0
- package/dist/nodes/lib-supabase.d.ts.map +1 -0
- package/dist/nodes/lib-supabase.js +425 -0
- package/dist/nodes/lib-supabase.js.map +1 -0
- package/dist/nodes/lib-svg.d.ts +199 -0
- package/dist/nodes/lib-svg.d.ts.map +1 -0
- package/dist/nodes/lib-svg.js +1027 -0
- package/dist/nodes/lib-svg.js.map +1 -0
- package/dist/nodes/lib-tensorflow.d.ts +71 -0
- package/dist/nodes/lib-tensorflow.d.ts.map +1 -0
- package/dist/nodes/lib-tensorflow.js +351 -0
- package/dist/nodes/lib-tensorflow.js.map +1 -0
- package/dist/nodes/lib-twilio.d.ts +71 -0
- package/dist/nodes/lib-twilio.d.ts.map +1 -0
- package/dist/nodes/lib-twilio.js +469 -0
- package/dist/nodes/lib-twilio.js.map +1 -0
- package/dist/nodes/lib-validate.d.ts +84 -0
- package/dist/nodes/lib-validate.d.ts.map +1 -0
- package/dist/nodes/lib-validate.js +215 -0
- package/dist/nodes/lib-validate.js.map +1 -0
- package/dist/nodes/lib-video-download.d.ts +26 -0
- package/dist/nodes/lib-video-download.d.ts.map +1 -0
- package/dist/nodes/lib-video-download.js +299 -0
- package/dist/nodes/lib-video-download.js.map +1 -0
- package/dist/nodes/messaging.d.ts +88 -0
- package/dist/nodes/messaging.d.ts.map +1 -0
- package/dist/nodes/messaging.js +418 -0
- package/dist/nodes/messaging.js.map +1 -0
- package/dist/nodes/mistral.d.ts +83 -0
- package/dist/nodes/mistral.d.ts.map +1 -0
- package/dist/nodes/mistral.js +450 -0
- package/dist/nodes/mistral.js.map +1 -0
- package/dist/nodes/model3d/analysis.d.ts +13 -0
- package/dist/nodes/model3d/analysis.d.ts.map +1 -0
- package/dist/nodes/model3d/analysis.js +36 -0
- package/dist/nodes/model3d/analysis.js.map +1 -0
- package/dist/nodes/model3d/base.d.ts +11 -0
- package/dist/nodes/model3d/base.d.ts.map +1 -0
- package/dist/nodes/model3d/base.js +20 -0
- package/dist/nodes/model3d/base.js.map +1 -0
- package/dist/nodes/model3d/boolean-ops.d.ts +2 -0
- package/dist/nodes/model3d/boolean-ops.d.ts.map +1 -0
- package/dist/nodes/model3d/boolean-ops.js +172 -0
- package/dist/nodes/model3d/boolean-ops.js.map +1 -0
- package/dist/nodes/model3d/cleanup.d.ts +47 -0
- package/dist/nodes/model3d/cleanup.d.ts.map +1 -0
- package/dist/nodes/model3d/cleanup.js +136 -0
- package/dist/nodes/model3d/cleanup.js.map +1 -0
- package/dist/nodes/model3d/convert.d.ts +14 -0
- package/dist/nodes/model3d/convert.d.ts.map +1 -0
- package/dist/nodes/model3d/convert.js +64 -0
- package/dist/nodes/model3d/convert.js.map +1 -0
- package/dist/nodes/model3d/defaults.d.ts +34 -0
- package/dist/nodes/model3d/defaults.d.ts.map +1 -0
- package/dist/nodes/model3d/defaults.js +28 -0
- package/dist/nodes/model3d/defaults.js.map +1 -0
- package/dist/nodes/model3d/document-ops.d.ts +4 -0
- package/dist/nodes/model3d/document-ops.d.ts.map +1 -0
- package/dist/nodes/model3d/document-ops.js +40 -0
- package/dist/nodes/model3d/document-ops.js.map +1 -0
- package/dist/nodes/model3d/generation.d.ts +39 -0
- package/dist/nodes/model3d/generation.d.ts.map +1 -0
- package/dist/nodes/model3d/generation.js +179 -0
- package/dist/nodes/model3d/generation.js.map +1 -0
- package/dist/nodes/model3d/glb.d.ts +29 -0
- package/dist/nodes/model3d/glb.d.ts.map +1 -0
- package/dist/nodes/model3d/glb.js +255 -0
- package/dist/nodes/model3d/glb.js.map +1 -0
- package/dist/nodes/model3d/index.d.ts +20 -0
- package/dist/nodes/model3d/index.d.ts.map +1 -0
- package/dist/nodes/model3d/index.js +38 -0
- package/dist/nodes/model3d/index.js.map +1 -0
- package/dist/nodes/model3d/io.d.ts +38 -0
- package/dist/nodes/model3d/io.d.ts.map +1 -0
- package/dist/nodes/model3d/io.js +162 -0
- package/dist/nodes/model3d/io.js.map +1 -0
- package/dist/nodes/model3d/mesh-ops.d.ts +40 -0
- package/dist/nodes/model3d/mesh-ops.d.ts.map +1 -0
- package/dist/nodes/model3d/mesh-ops.js +775 -0
- package/dist/nodes/model3d/mesh-ops.js.map +1 -0
- package/dist/nodes/model3d/nodes.d.ts +2 -0
- package/dist/nodes/model3d/nodes.d.ts.map +1 -0
- package/dist/nodes/model3d/nodes.js +2 -0
- package/dist/nodes/model3d/nodes.js.map +1 -0
- package/dist/nodes/model3d/ops.d.ts +37 -0
- package/dist/nodes/model3d/ops.d.ts.map +1 -0
- package/dist/nodes/model3d/ops.js +137 -0
- package/dist/nodes/model3d/ops.js.map +1 -0
- package/dist/nodes/model3d/transforms.d.ts +49 -0
- package/dist/nodes/model3d/transforms.d.ts.map +1 -0
- package/dist/nodes/model3d/transforms.js +142 -0
- package/dist/nodes/model3d/transforms.js.map +1 -0
- package/dist/nodes/model3d/types.d.ts +81 -0
- package/dist/nodes/model3d/types.d.ts.map +1 -0
- package/dist/nodes/model3d/types.js +2 -0
- package/dist/nodes/model3d/types.js.map +1 -0
- package/dist/nodes/model3d/utils.d.ts +34 -0
- package/dist/nodes/model3d/utils.d.ts.map +1 -0
- package/dist/nodes/model3d/utils.js +185 -0
- package/dist/nodes/model3d/utils.js.map +1 -0
- package/dist/nodes/model3d.d.ts +2 -0
- package/dist/nodes/model3d.d.ts.map +1 -0
- package/dist/nodes/model3d.js +2 -0
- package/dist/nodes/model3d.js.map +1 -0
- package/dist/nodes/openai.d.ts +172 -0
- package/dist/nodes/openai.d.ts.map +1 -0
- package/dist/nodes/openai.js +1294 -0
- package/dist/nodes/openai.js.map +1 -0
- package/dist/nodes/output.d.ts +29 -0
- package/dist/nodes/output.d.ts.map +1 -0
- package/dist/nodes/output.js +87 -0
- package/dist/nodes/output.js.map +1 -0
- package/dist/nodes/sandbox.d.ts +67 -0
- package/dist/nodes/sandbox.d.ts.map +1 -0
- package/dist/nodes/sandbox.js +681 -0
- package/dist/nodes/sandbox.js.map +1 -0
- package/dist/nodes/search.d.ts +117 -0
- package/dist/nodes/search.d.ts.map +1 -0
- package/dist/nodes/search.js +607 -0
- package/dist/nodes/search.js.map +1 -0
- package/dist/nodes/team.d.ts +74 -0
- package/dist/nodes/team.d.ts.map +1 -0
- package/dist/nodes/team.js +304 -0
- package/dist/nodes/team.js.map +1 -0
- package/dist/nodes/text-extra.d.ts +633 -0
- package/dist/nodes/text-extra.d.ts.map +1 -0
- package/dist/nodes/text-extra.js +2226 -0
- package/dist/nodes/text-extra.js.map +1 -0
- package/dist/nodes/tool-agents.d.ts +334 -0
- package/dist/nodes/tool-agents.d.ts.map +1 -0
- package/dist/nodes/tool-agents.js +1861 -0
- package/dist/nodes/tool-agents.js.map +1 -0
- package/dist/nodes/triggers.d.ts +107 -0
- package/dist/nodes/triggers.d.ts.map +1 -0
- package/dist/nodes/triggers.js +706 -0
- package/dist/nodes/triggers.js.map +1 -0
- package/dist/nodes/vector.d.ts +168 -0
- package/dist/nodes/vector.d.ts.map +1 -0
- package/dist/nodes/vector.js +1121 -0
- package/dist/nodes/vector.js.map +1 -0
- package/dist/nodes/video.d.ts +387 -0
- package/dist/nodes/video.d.ts.map +1 -0
- package/dist/nodes/video.js +2361 -0
- package/dist/nodes/video.js.map +1 -0
- package/dist/nodes/workflow.d.ts +24 -0
- package/dist/nodes/workflow.d.ts.map +1 -0
- package/dist/nodes/workflow.js +146 -0
- package/dist/nodes/workflow.js.map +1 -0
- package/dist/nodes/workspace.d.ts +203 -0
- package/dist/nodes/workspace.d.ts.map +1 -0
- package/dist/nodes/workspace.js +795 -0
- package/dist/nodes/workspace.js.map +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1,795 @@
|
|
|
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 { promises as fs } from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
function workspaceDirFrom(props) {
|
|
11
|
+
return String(props.workspace_dir ?? process.cwd());
|
|
12
|
+
}
|
|
13
|
+
export function ensureWorkspacePath(workspaceDir, relativePath) {
|
|
14
|
+
if (!relativePath) {
|
|
15
|
+
throw new Error("Path cannot be empty");
|
|
16
|
+
}
|
|
17
|
+
if (path.isAbsolute(relativePath)) {
|
|
18
|
+
throw new Error("Absolute paths are not allowed. Use relative paths within workspace.");
|
|
19
|
+
}
|
|
20
|
+
if (relativePath.split(/[\\/]/).includes("..")) {
|
|
21
|
+
throw new Error("Parent directory traversal (..) is not allowed");
|
|
22
|
+
}
|
|
23
|
+
const full = path.resolve(workspaceDir, relativePath);
|
|
24
|
+
const root = path.resolve(workspaceDir);
|
|
25
|
+
if (!full.startsWith(root)) {
|
|
26
|
+
throw new Error("Path must be within workspace directory");
|
|
27
|
+
}
|
|
28
|
+
return full;
|
|
29
|
+
}
|
|
30
|
+
function formatTimestampedName(name) {
|
|
31
|
+
const now = new Date();
|
|
32
|
+
const pad = (v) => String(v).padStart(2, "0");
|
|
33
|
+
return name
|
|
34
|
+
.replaceAll("%Y", String(now.getFullYear()))
|
|
35
|
+
.replaceAll("%m", pad(now.getMonth() + 1))
|
|
36
|
+
.replaceAll("%d", pad(now.getDate()))
|
|
37
|
+
.replaceAll("%H", pad(now.getHours()))
|
|
38
|
+
.replaceAll("%M", pad(now.getMinutes()))
|
|
39
|
+
.replaceAll("%S", pad(now.getSeconds()));
|
|
40
|
+
}
|
|
41
|
+
function wildcardToRegExp(pattern) {
|
|
42
|
+
const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
43
|
+
return new RegExp(`^${escaped.replaceAll("*", ".*")}$`);
|
|
44
|
+
}
|
|
45
|
+
async function walk(dir, recursive) {
|
|
46
|
+
const out = [];
|
|
47
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
48
|
+
for (const entry of entries) {
|
|
49
|
+
const full = path.join(dir, entry.name);
|
|
50
|
+
out.push(full);
|
|
51
|
+
if (recursive && entry.isDirectory()) {
|
|
52
|
+
out.push(...(await walk(full, true)));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
function fileUri(fullPath) {
|
|
58
|
+
return `file://${fullPath}`;
|
|
59
|
+
}
|
|
60
|
+
function bytesFromUnknown(value) {
|
|
61
|
+
if (value instanceof Uint8Array) {
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(value) && value.every((x) => Number.isInteger(x))) {
|
|
65
|
+
return new Uint8Array(value);
|
|
66
|
+
}
|
|
67
|
+
if (typeof value === "string") {
|
|
68
|
+
return Uint8Array.from(Buffer.from(value, "base64"));
|
|
69
|
+
}
|
|
70
|
+
return new Uint8Array();
|
|
71
|
+
}
|
|
72
|
+
export class GetWorkspaceDirNode extends BaseNode {
|
|
73
|
+
static nodeType = "nodetool.workspace.GetWorkspaceDir";
|
|
74
|
+
static title = "Get Workspace Dir";
|
|
75
|
+
static description = "Get the current workspace directory path.\n workspace, directory, path";
|
|
76
|
+
static metadataOutputTypes = {
|
|
77
|
+
output: "str"
|
|
78
|
+
};
|
|
79
|
+
async process() {
|
|
80
|
+
return { output: workspaceDirFrom(this.serialize()) };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
__decorate([
|
|
84
|
+
prop({
|
|
85
|
+
type: "str",
|
|
86
|
+
default: "",
|
|
87
|
+
title: "Workspace Dir",
|
|
88
|
+
description: "The workspace directory"
|
|
89
|
+
})
|
|
90
|
+
], GetWorkspaceDirNode.prototype, "workspace_dir", void 0);
|
|
91
|
+
export class ListWorkspaceFilesNode extends BaseNode {
|
|
92
|
+
static nodeType = "nodetool.workspace.ListWorkspaceFiles";
|
|
93
|
+
static title = "List Workspace Files";
|
|
94
|
+
static description = "List files in the workspace directory matching a pattern.\n workspace, files, list, directory";
|
|
95
|
+
static metadataOutputTypes = {
|
|
96
|
+
file: "str",
|
|
97
|
+
files: "list"
|
|
98
|
+
};
|
|
99
|
+
static isStreamingOutput = true;
|
|
100
|
+
async process() {
|
|
101
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
102
|
+
const relative = String(this.path ?? ".");
|
|
103
|
+
const pattern = String(this.pattern ?? "*");
|
|
104
|
+
const recursive = Boolean(this.recursive ?? false);
|
|
105
|
+
const root = ensureWorkspacePath(workspace, relative);
|
|
106
|
+
const regex = wildcardToRegExp(pattern);
|
|
107
|
+
const all = await walk(root, recursive);
|
|
108
|
+
const results = [];
|
|
109
|
+
for (const item of all) {
|
|
110
|
+
if (regex.test(path.basename(item))) {
|
|
111
|
+
results.push(path.relative(workspace, item));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
file: results[0] ?? "",
|
|
116
|
+
files: results
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
async *genProcess() {
|
|
120
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
121
|
+
const relative = String(this.path ?? ".");
|
|
122
|
+
const pattern = String(this.pattern ?? "*");
|
|
123
|
+
const recursive = Boolean(this.recursive ?? false);
|
|
124
|
+
const root = ensureWorkspacePath(workspace, relative);
|
|
125
|
+
const regex = wildcardToRegExp(pattern);
|
|
126
|
+
const all = await walk(root, recursive);
|
|
127
|
+
const results = [];
|
|
128
|
+
for (const item of all) {
|
|
129
|
+
if (regex.test(path.basename(item))) {
|
|
130
|
+
const rel = path.relative(workspace, item);
|
|
131
|
+
results.push(rel);
|
|
132
|
+
yield { file: rel };
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
yield { files: results };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
__decorate([
|
|
139
|
+
prop({
|
|
140
|
+
type: "str",
|
|
141
|
+
default: ".",
|
|
142
|
+
title: "Path",
|
|
143
|
+
description: "Relative path within workspace (use . for workspace root)"
|
|
144
|
+
})
|
|
145
|
+
], ListWorkspaceFilesNode.prototype, "path", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
prop({
|
|
148
|
+
type: "str",
|
|
149
|
+
default: "*",
|
|
150
|
+
title: "Pattern",
|
|
151
|
+
description: "File pattern to match (e.g. *.txt, *.json)"
|
|
152
|
+
})
|
|
153
|
+
], ListWorkspaceFilesNode.prototype, "pattern", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
prop({
|
|
156
|
+
type: "bool",
|
|
157
|
+
default: false,
|
|
158
|
+
title: "Recursive",
|
|
159
|
+
description: "Search subdirectories recursively"
|
|
160
|
+
})
|
|
161
|
+
], ListWorkspaceFilesNode.prototype, "recursive", void 0);
|
|
162
|
+
export class ReadTextFileNode extends BaseNode {
|
|
163
|
+
static nodeType = "nodetool.workspace.ReadTextFile";
|
|
164
|
+
static title = "Read Text File";
|
|
165
|
+
static description = "Read a text file from the workspace.\n workspace, file, read, text";
|
|
166
|
+
static metadataOutputTypes = {
|
|
167
|
+
output: "str"
|
|
168
|
+
};
|
|
169
|
+
async process() {
|
|
170
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
171
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
172
|
+
const encoding = String(this.encoding ?? this.encoding ?? "utf-8");
|
|
173
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
174
|
+
const text = await fs.readFile(full, { encoding });
|
|
175
|
+
return { output: text };
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
__decorate([
|
|
179
|
+
prop({
|
|
180
|
+
type: "str",
|
|
181
|
+
default: "",
|
|
182
|
+
title: "Path",
|
|
183
|
+
description: "Relative path to file within workspace"
|
|
184
|
+
})
|
|
185
|
+
], ReadTextFileNode.prototype, "path", void 0);
|
|
186
|
+
__decorate([
|
|
187
|
+
prop({
|
|
188
|
+
type: "str",
|
|
189
|
+
default: "utf-8",
|
|
190
|
+
title: "Encoding",
|
|
191
|
+
description: "Text encoding (utf-8, ascii, etc.)"
|
|
192
|
+
})
|
|
193
|
+
], ReadTextFileNode.prototype, "encoding", void 0);
|
|
194
|
+
export class WriteTextFileNode extends BaseNode {
|
|
195
|
+
static nodeType = "nodetool.workspace.WriteTextFile";
|
|
196
|
+
static title = "Write Text File";
|
|
197
|
+
static description = "Write text to a file in the workspace.\n workspace, file, write, text, save";
|
|
198
|
+
static metadataOutputTypes = {
|
|
199
|
+
output: "str"
|
|
200
|
+
};
|
|
201
|
+
async process() {
|
|
202
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
203
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
204
|
+
const content = String(this.content ?? this.content ?? "");
|
|
205
|
+
const append = Boolean(this.append ?? this.append ?? false);
|
|
206
|
+
const encoding = String(this.encoding ?? this.encoding ?? "utf-8");
|
|
207
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
208
|
+
await fs.mkdir(path.dirname(full), { recursive: true });
|
|
209
|
+
if (append) {
|
|
210
|
+
await fs.appendFile(full, content, { encoding });
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
await fs.writeFile(full, content, { encoding });
|
|
214
|
+
}
|
|
215
|
+
return { output: relative };
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
__decorate([
|
|
219
|
+
prop({
|
|
220
|
+
type: "str",
|
|
221
|
+
default: "",
|
|
222
|
+
title: "Path",
|
|
223
|
+
description: "Relative path to file within workspace"
|
|
224
|
+
})
|
|
225
|
+
], WriteTextFileNode.prototype, "path", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
prop({
|
|
228
|
+
type: "str",
|
|
229
|
+
default: "",
|
|
230
|
+
title: "Content",
|
|
231
|
+
description: "Text content to write"
|
|
232
|
+
})
|
|
233
|
+
], WriteTextFileNode.prototype, "content", void 0);
|
|
234
|
+
__decorate([
|
|
235
|
+
prop({
|
|
236
|
+
type: "str",
|
|
237
|
+
default: "utf-8",
|
|
238
|
+
title: "Encoding",
|
|
239
|
+
description: "Text encoding (utf-8, ascii, etc.)"
|
|
240
|
+
})
|
|
241
|
+
], WriteTextFileNode.prototype, "encoding", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
prop({
|
|
244
|
+
type: "bool",
|
|
245
|
+
default: false,
|
|
246
|
+
title: "Append",
|
|
247
|
+
description: "Append to file instead of overwriting"
|
|
248
|
+
})
|
|
249
|
+
], WriteTextFileNode.prototype, "append", void 0);
|
|
250
|
+
export class ReadBinaryFileNode extends BaseNode {
|
|
251
|
+
static nodeType = "nodetool.workspace.ReadBinaryFile";
|
|
252
|
+
static title = "Read Binary File";
|
|
253
|
+
static description = "Read a binary file from the workspace as base64-encoded string.\n workspace, file, read, binary";
|
|
254
|
+
static metadataOutputTypes = {
|
|
255
|
+
output: "str"
|
|
256
|
+
};
|
|
257
|
+
async process() {
|
|
258
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
259
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
260
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
261
|
+
const data = await fs.readFile(full);
|
|
262
|
+
return { output: Buffer.from(data).toString("base64") };
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
__decorate([
|
|
266
|
+
prop({
|
|
267
|
+
type: "str",
|
|
268
|
+
default: "",
|
|
269
|
+
title: "Path",
|
|
270
|
+
description: "Relative path to file within workspace"
|
|
271
|
+
})
|
|
272
|
+
], ReadBinaryFileNode.prototype, "path", void 0);
|
|
273
|
+
export class WriteBinaryFileNode extends BaseNode {
|
|
274
|
+
static nodeType = "nodetool.workspace.WriteBinaryFile";
|
|
275
|
+
static title = "Write Binary File";
|
|
276
|
+
static description = "Write binary data (base64-encoded) to a file in the workspace.\n workspace, file, write, binary, save";
|
|
277
|
+
static metadataOutputTypes = {
|
|
278
|
+
output: "str"
|
|
279
|
+
};
|
|
280
|
+
async process() {
|
|
281
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
282
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
283
|
+
const content = String(this.content ?? this.content ?? "");
|
|
284
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
285
|
+
await fs.mkdir(path.dirname(full), { recursive: true });
|
|
286
|
+
await fs.writeFile(full, Buffer.from(content, "base64"));
|
|
287
|
+
return { output: relative };
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
__decorate([
|
|
291
|
+
prop({
|
|
292
|
+
type: "str",
|
|
293
|
+
default: "",
|
|
294
|
+
title: "Path",
|
|
295
|
+
description: "Relative path to file within workspace"
|
|
296
|
+
})
|
|
297
|
+
], WriteBinaryFileNode.prototype, "path", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
prop({
|
|
300
|
+
type: "str",
|
|
301
|
+
default: "",
|
|
302
|
+
title: "Content",
|
|
303
|
+
description: "Base64-encoded binary content to write"
|
|
304
|
+
})
|
|
305
|
+
], WriteBinaryFileNode.prototype, "content", void 0);
|
|
306
|
+
export class DeleteWorkspaceFileNode extends BaseNode {
|
|
307
|
+
static nodeType = "nodetool.workspace.DeleteWorkspaceFile";
|
|
308
|
+
static title = "Delete Workspace File";
|
|
309
|
+
static description = "Delete a file or directory from the workspace.\n workspace, file, delete, remove";
|
|
310
|
+
static metadataOutputTypes = {
|
|
311
|
+
output: "none"
|
|
312
|
+
};
|
|
313
|
+
async process() {
|
|
314
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
315
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
316
|
+
const recursive = Boolean(this.recursive ?? this.recursive ?? false);
|
|
317
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
318
|
+
const stat = await fs.stat(full);
|
|
319
|
+
if (stat.isDirectory()) {
|
|
320
|
+
if (!recursive) {
|
|
321
|
+
throw new Error("Path is a directory. Set recursive=true to delete.");
|
|
322
|
+
}
|
|
323
|
+
await fs.rm(full, { recursive: true, force: false });
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
await fs.unlink(full);
|
|
327
|
+
}
|
|
328
|
+
return { output: null };
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
__decorate([
|
|
332
|
+
prop({
|
|
333
|
+
type: "str",
|
|
334
|
+
default: "",
|
|
335
|
+
title: "Path",
|
|
336
|
+
description: "Relative path to file or directory within workspace"
|
|
337
|
+
})
|
|
338
|
+
], DeleteWorkspaceFileNode.prototype, "path", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
prop({
|
|
341
|
+
type: "bool",
|
|
342
|
+
default: false,
|
|
343
|
+
title: "Recursive",
|
|
344
|
+
description: "Delete directories recursively"
|
|
345
|
+
})
|
|
346
|
+
], DeleteWorkspaceFileNode.prototype, "recursive", void 0);
|
|
347
|
+
export class CreateWorkspaceDirectoryNode extends BaseNode {
|
|
348
|
+
static nodeType = "nodetool.workspace.CreateWorkspaceDirectory";
|
|
349
|
+
static title = "Create Workspace Directory";
|
|
350
|
+
static description = "Create a directory in the workspace.\n workspace, directory, create, folder";
|
|
351
|
+
static metadataOutputTypes = {
|
|
352
|
+
output: "str"
|
|
353
|
+
};
|
|
354
|
+
async process() {
|
|
355
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
356
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
357
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
358
|
+
await fs.mkdir(full, { recursive: true });
|
|
359
|
+
return { output: relative };
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
__decorate([
|
|
363
|
+
prop({
|
|
364
|
+
type: "str",
|
|
365
|
+
default: "",
|
|
366
|
+
title: "Path",
|
|
367
|
+
description: "Relative path to directory within workspace"
|
|
368
|
+
})
|
|
369
|
+
], CreateWorkspaceDirectoryNode.prototype, "path", void 0);
|
|
370
|
+
export class WorkspaceFileExistsNode extends BaseNode {
|
|
371
|
+
static nodeType = "nodetool.workspace.WorkspaceFileExists";
|
|
372
|
+
static title = "Workspace File Exists";
|
|
373
|
+
static description = "Check if a file or directory exists in the workspace.\n workspace, file, exists, check";
|
|
374
|
+
static metadataOutputTypes = {
|
|
375
|
+
output: "bool"
|
|
376
|
+
};
|
|
377
|
+
async process() {
|
|
378
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
379
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
380
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
381
|
+
try {
|
|
382
|
+
await fs.access(full);
|
|
383
|
+
return { output: true };
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
return { output: false };
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
__decorate([
|
|
391
|
+
prop({
|
|
392
|
+
type: "str",
|
|
393
|
+
default: "",
|
|
394
|
+
title: "Path",
|
|
395
|
+
description: "Relative path within workspace to check"
|
|
396
|
+
})
|
|
397
|
+
], WorkspaceFileExistsNode.prototype, "path", void 0);
|
|
398
|
+
export class GetWorkspaceFileInfoNode extends BaseNode {
|
|
399
|
+
static nodeType = "nodetool.workspace.GetWorkspaceFileInfo";
|
|
400
|
+
static title = "Get Workspace File Info";
|
|
401
|
+
static description = "Get information about a file in the workspace.\n workspace, file, info, metadata";
|
|
402
|
+
static metadataOutputTypes = {
|
|
403
|
+
output: "dict"
|
|
404
|
+
};
|
|
405
|
+
async process() {
|
|
406
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
407
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
408
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
409
|
+
const stats = await fs.stat(full);
|
|
410
|
+
return {
|
|
411
|
+
output: {
|
|
412
|
+
path: relative,
|
|
413
|
+
name: path.basename(relative),
|
|
414
|
+
size: stats.size,
|
|
415
|
+
is_file: stats.isFile(),
|
|
416
|
+
is_directory: stats.isDirectory(),
|
|
417
|
+
created: new Date(stats.birthtimeMs).toISOString(),
|
|
418
|
+
modified: new Date(stats.mtimeMs).toISOString(),
|
|
419
|
+
accessed: new Date(stats.atimeMs).toISOString()
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
__decorate([
|
|
425
|
+
prop({
|
|
426
|
+
type: "str",
|
|
427
|
+
default: "",
|
|
428
|
+
title: "Path",
|
|
429
|
+
description: "Relative path to file within workspace"
|
|
430
|
+
})
|
|
431
|
+
], GetWorkspaceFileInfoNode.prototype, "path", void 0);
|
|
432
|
+
export class CopyWorkspaceFileNode extends BaseNode {
|
|
433
|
+
static nodeType = "nodetool.workspace.CopyWorkspaceFile";
|
|
434
|
+
static title = "Copy Workspace File";
|
|
435
|
+
static description = "Copy a file within the workspace.\n workspace, file, copy, duplicate";
|
|
436
|
+
static metadataOutputTypes = {
|
|
437
|
+
output: "str"
|
|
438
|
+
};
|
|
439
|
+
async process() {
|
|
440
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
441
|
+
const source = ensureWorkspacePath(workspace, String(this.source ?? this.source ?? ""));
|
|
442
|
+
const destRelative = String(this.destination ?? this.destination ?? "");
|
|
443
|
+
const destination = ensureWorkspacePath(workspace, destRelative);
|
|
444
|
+
await fs.mkdir(path.dirname(destination), { recursive: true });
|
|
445
|
+
await fs.cp(source, destination, { recursive: true });
|
|
446
|
+
return { output: destRelative };
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
__decorate([
|
|
450
|
+
prop({
|
|
451
|
+
type: "str",
|
|
452
|
+
default: "",
|
|
453
|
+
title: "Source",
|
|
454
|
+
description: "Relative source path within workspace"
|
|
455
|
+
})
|
|
456
|
+
], CopyWorkspaceFileNode.prototype, "source", void 0);
|
|
457
|
+
__decorate([
|
|
458
|
+
prop({
|
|
459
|
+
type: "str",
|
|
460
|
+
default: "",
|
|
461
|
+
title: "Destination",
|
|
462
|
+
description: "Relative destination path within workspace"
|
|
463
|
+
})
|
|
464
|
+
], CopyWorkspaceFileNode.prototype, "destination", void 0);
|
|
465
|
+
export class MoveWorkspaceFileNode extends BaseNode {
|
|
466
|
+
static nodeType = "nodetool.workspace.MoveWorkspaceFile";
|
|
467
|
+
static title = "Move Workspace File";
|
|
468
|
+
static description = "Move or rename a file within the workspace.\n workspace, file, move, rename";
|
|
469
|
+
static metadataOutputTypes = {
|
|
470
|
+
output: "str"
|
|
471
|
+
};
|
|
472
|
+
async process() {
|
|
473
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
474
|
+
const source = ensureWorkspacePath(workspace, String(this.source ?? this.source ?? ""));
|
|
475
|
+
const destRelative = String(this.destination ?? this.destination ?? "");
|
|
476
|
+
const destination = ensureWorkspacePath(workspace, destRelative);
|
|
477
|
+
await fs.mkdir(path.dirname(destination), { recursive: true });
|
|
478
|
+
await fs.rename(source, destination);
|
|
479
|
+
return { output: destRelative };
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
__decorate([
|
|
483
|
+
prop({
|
|
484
|
+
type: "str",
|
|
485
|
+
default: "",
|
|
486
|
+
title: "Source",
|
|
487
|
+
description: "Relative source path within workspace"
|
|
488
|
+
})
|
|
489
|
+
], MoveWorkspaceFileNode.prototype, "source", void 0);
|
|
490
|
+
__decorate([
|
|
491
|
+
prop({
|
|
492
|
+
type: "str",
|
|
493
|
+
default: "",
|
|
494
|
+
title: "Destination",
|
|
495
|
+
description: "Relative destination path within workspace"
|
|
496
|
+
})
|
|
497
|
+
], MoveWorkspaceFileNode.prototype, "destination", void 0);
|
|
498
|
+
export class GetWorkspaceFileSizeNode extends BaseNode {
|
|
499
|
+
static nodeType = "nodetool.workspace.GetWorkspaceFileSize";
|
|
500
|
+
static title = "Get Workspace File Size";
|
|
501
|
+
static description = "Get file size in bytes for a workspace file.\n workspace, file, size, bytes";
|
|
502
|
+
static metadataOutputTypes = {
|
|
503
|
+
output: "int"
|
|
504
|
+
};
|
|
505
|
+
async process() {
|
|
506
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
507
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
508
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
509
|
+
const stats = await fs.stat(full);
|
|
510
|
+
if (!stats.isFile()) {
|
|
511
|
+
throw new Error(`Path is not a file: ${relative}`);
|
|
512
|
+
}
|
|
513
|
+
return { output: stats.size };
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
__decorate([
|
|
517
|
+
prop({
|
|
518
|
+
type: "str",
|
|
519
|
+
default: "",
|
|
520
|
+
title: "Path",
|
|
521
|
+
description: "Relative path to file within workspace"
|
|
522
|
+
})
|
|
523
|
+
], GetWorkspaceFileSizeNode.prototype, "path", void 0);
|
|
524
|
+
export class IsWorkspaceFileNode extends BaseNode {
|
|
525
|
+
static nodeType = "nodetool.workspace.IsWorkspaceFile";
|
|
526
|
+
static title = "Is Workspace File";
|
|
527
|
+
static description = "Check if a path in the workspace is a file.\n workspace, file, check, type";
|
|
528
|
+
static metadataOutputTypes = {
|
|
529
|
+
output: "bool"
|
|
530
|
+
};
|
|
531
|
+
async process() {
|
|
532
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
533
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
534
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
535
|
+
try {
|
|
536
|
+
const stats = await fs.stat(full);
|
|
537
|
+
return { output: stats.isFile() };
|
|
538
|
+
}
|
|
539
|
+
catch {
|
|
540
|
+
return { output: false };
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
__decorate([
|
|
545
|
+
prop({
|
|
546
|
+
type: "str",
|
|
547
|
+
default: "",
|
|
548
|
+
title: "Path",
|
|
549
|
+
description: "Relative path within workspace to check"
|
|
550
|
+
})
|
|
551
|
+
], IsWorkspaceFileNode.prototype, "path", void 0);
|
|
552
|
+
export class IsWorkspaceDirectoryNode extends BaseNode {
|
|
553
|
+
static nodeType = "nodetool.workspace.IsWorkspaceDirectory";
|
|
554
|
+
static title = "Is Workspace Directory";
|
|
555
|
+
static description = "Check if a path in the workspace is a directory.\n workspace, directory, check, type";
|
|
556
|
+
static metadataOutputTypes = {
|
|
557
|
+
output: "bool"
|
|
558
|
+
};
|
|
559
|
+
async process() {
|
|
560
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
561
|
+
const relative = String(this.path ?? this.path ?? "");
|
|
562
|
+
const full = ensureWorkspacePath(workspace, relative);
|
|
563
|
+
try {
|
|
564
|
+
const stats = await fs.stat(full);
|
|
565
|
+
return { output: stats.isDirectory() };
|
|
566
|
+
}
|
|
567
|
+
catch {
|
|
568
|
+
return { output: false };
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
__decorate([
|
|
573
|
+
prop({
|
|
574
|
+
type: "str",
|
|
575
|
+
default: "",
|
|
576
|
+
title: "Path",
|
|
577
|
+
description: "Relative path within workspace to check"
|
|
578
|
+
})
|
|
579
|
+
], IsWorkspaceDirectoryNode.prototype, "path", void 0);
|
|
580
|
+
export class JoinWorkspacePathsNode extends BaseNode {
|
|
581
|
+
static nodeType = "nodetool.workspace.JoinWorkspacePaths";
|
|
582
|
+
static title = "Join Workspace Paths";
|
|
583
|
+
static description = "Join path components relative to workspace.\n workspace, path, join, combine";
|
|
584
|
+
static metadataOutputTypes = {
|
|
585
|
+
output: "str"
|
|
586
|
+
};
|
|
587
|
+
async process() {
|
|
588
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
589
|
+
const parts = Array.isArray(this.paths ?? this.paths)
|
|
590
|
+
? (this.paths ?? this.paths)
|
|
591
|
+
: [];
|
|
592
|
+
if (parts.length === 0) {
|
|
593
|
+
throw new Error("paths cannot be empty");
|
|
594
|
+
}
|
|
595
|
+
// Workspace-relative paths are part of the workflow contract and must
|
|
596
|
+
// be portable across operating systems. Always emit POSIX separators
|
|
597
|
+
// and use the OS-native form only for the worktree validation below.
|
|
598
|
+
const joined = path.posix.join(...parts.map((p) => String(p)));
|
|
599
|
+
ensureWorkspacePath(workspace, joined);
|
|
600
|
+
return { output: joined };
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
__decorate([
|
|
604
|
+
prop({
|
|
605
|
+
type: "list[str]",
|
|
606
|
+
default: [],
|
|
607
|
+
title: "Paths",
|
|
608
|
+
description: "Path components to join (relative to workspace)"
|
|
609
|
+
})
|
|
610
|
+
], JoinWorkspacePathsNode.prototype, "paths", void 0);
|
|
611
|
+
export class SaveImageFileNode extends BaseNode {
|
|
612
|
+
static nodeType = "nodetool.workspace.SaveImageFile";
|
|
613
|
+
static title = "Save Image File";
|
|
614
|
+
static description = "Save an image to a file in the workspace.\n workspace, image, save, file, output";
|
|
615
|
+
static metadataOutputTypes = {
|
|
616
|
+
output: "image"
|
|
617
|
+
};
|
|
618
|
+
async process() {
|
|
619
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
620
|
+
const image = (this.image ?? this.image ?? {});
|
|
621
|
+
const folder = String(this.folder ?? this.folder ?? ".");
|
|
622
|
+
const filename = formatTimestampedName(String(this.filename ?? this.filename ?? "image.png"));
|
|
623
|
+
const overwrite = Boolean(this.overwrite ?? this.overwrite ?? false);
|
|
624
|
+
let relative = path.join(folder, filename);
|
|
625
|
+
let full = ensureWorkspacePath(workspace, relative);
|
|
626
|
+
await fs.mkdir(path.dirname(full), { recursive: true });
|
|
627
|
+
if (!overwrite) {
|
|
628
|
+
let count = 1;
|
|
629
|
+
while (true) {
|
|
630
|
+
try {
|
|
631
|
+
await fs.access(full);
|
|
632
|
+
const ext = path.extname(filename);
|
|
633
|
+
const base = filename.slice(0, Math.max(0, filename.length - ext.length));
|
|
634
|
+
const next = `${base}_${count}${ext}`;
|
|
635
|
+
relative = path.join(folder, next);
|
|
636
|
+
full = ensureWorkspacePath(workspace, relative);
|
|
637
|
+
count += 1;
|
|
638
|
+
}
|
|
639
|
+
catch {
|
|
640
|
+
break;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
const bytes = bytesFromUnknown(image.data);
|
|
645
|
+
await fs.writeFile(full, bytes);
|
|
646
|
+
return {
|
|
647
|
+
output: {
|
|
648
|
+
uri: fileUri(full),
|
|
649
|
+
data: Buffer.from(bytes).toString("base64")
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
__decorate([
|
|
655
|
+
prop({
|
|
656
|
+
type: "image",
|
|
657
|
+
default: {
|
|
658
|
+
type: "image",
|
|
659
|
+
uri: "",
|
|
660
|
+
asset_id: null,
|
|
661
|
+
data: null,
|
|
662
|
+
metadata: null
|
|
663
|
+
},
|
|
664
|
+
title: "Image",
|
|
665
|
+
description: "The image to save"
|
|
666
|
+
})
|
|
667
|
+
], SaveImageFileNode.prototype, "image", void 0);
|
|
668
|
+
__decorate([
|
|
669
|
+
prop({
|
|
670
|
+
type: "str",
|
|
671
|
+
default: ".",
|
|
672
|
+
title: "Folder",
|
|
673
|
+
description: "Relative folder path within workspace (use . for workspace root)"
|
|
674
|
+
})
|
|
675
|
+
], SaveImageFileNode.prototype, "folder", void 0);
|
|
676
|
+
__decorate([
|
|
677
|
+
prop({
|
|
678
|
+
type: "str",
|
|
679
|
+
default: "image.png",
|
|
680
|
+
title: "Filename",
|
|
681
|
+
description: "\n The name of the image file.\n You can use time and date variables to create unique names:\n %Y - Year\n %m - Month\n %d - Day\n %H - Hour\n %M - Minute\n %S - Second\n "
|
|
682
|
+
})
|
|
683
|
+
], SaveImageFileNode.prototype, "filename", void 0);
|
|
684
|
+
__decorate([
|
|
685
|
+
prop({
|
|
686
|
+
type: "bool",
|
|
687
|
+
default: false,
|
|
688
|
+
title: "Overwrite",
|
|
689
|
+
description: "Overwrite the file if it already exists, otherwise file will be renamed"
|
|
690
|
+
})
|
|
691
|
+
], SaveImageFileNode.prototype, "overwrite", void 0);
|
|
692
|
+
export class SaveVideoFileNode extends BaseNode {
|
|
693
|
+
static nodeType = "nodetool.workspace.SaveVideoFile";
|
|
694
|
+
static title = "Save Video File";
|
|
695
|
+
static description = "Save a video file to the workspace.\n workspace, video, save, file, output\n\n The filename can include time and date variables:\n %Y - Year, %m - Month, %d - Day\n %H - Hour, %M - Minute, %S - Second";
|
|
696
|
+
static metadataOutputTypes = {
|
|
697
|
+
output: "video"
|
|
698
|
+
};
|
|
699
|
+
async process() {
|
|
700
|
+
const workspace = workspaceDirFrom(this.serialize());
|
|
701
|
+
const video = (this.video ?? this.video ?? {});
|
|
702
|
+
const folder = String(this.folder ?? this.folder ?? ".");
|
|
703
|
+
const filename = formatTimestampedName(String(this.filename ?? this.filename ?? "video.mp4"));
|
|
704
|
+
const overwrite = Boolean(this.overwrite ?? this.overwrite ?? false);
|
|
705
|
+
let relative = path.join(folder, filename);
|
|
706
|
+
let full = ensureWorkspacePath(workspace, relative);
|
|
707
|
+
await fs.mkdir(path.dirname(full), { recursive: true });
|
|
708
|
+
if (!overwrite) {
|
|
709
|
+
let count = 1;
|
|
710
|
+
while (true) {
|
|
711
|
+
try {
|
|
712
|
+
await fs.access(full);
|
|
713
|
+
const ext = path.extname(filename);
|
|
714
|
+
const base = filename.slice(0, Math.max(0, filename.length - ext.length));
|
|
715
|
+
const next = `${base}_${count}${ext}`;
|
|
716
|
+
relative = path.join(folder, next);
|
|
717
|
+
full = ensureWorkspacePath(workspace, relative);
|
|
718
|
+
count += 1;
|
|
719
|
+
}
|
|
720
|
+
catch {
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
const bytes = bytesFromUnknown(video.data);
|
|
726
|
+
await fs.writeFile(full, bytes);
|
|
727
|
+
return {
|
|
728
|
+
output: {
|
|
729
|
+
uri: fileUri(full),
|
|
730
|
+
data: Buffer.from(bytes).toString("base64")
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
__decorate([
|
|
736
|
+
prop({
|
|
737
|
+
type: "video",
|
|
738
|
+
default: {
|
|
739
|
+
type: "video",
|
|
740
|
+
uri: "",
|
|
741
|
+
asset_id: null,
|
|
742
|
+
data: null,
|
|
743
|
+
metadata: null,
|
|
744
|
+
duration: null,
|
|
745
|
+
format: null
|
|
746
|
+
},
|
|
747
|
+
title: "Video",
|
|
748
|
+
description: "The video to save"
|
|
749
|
+
})
|
|
750
|
+
], SaveVideoFileNode.prototype, "video", void 0);
|
|
751
|
+
__decorate([
|
|
752
|
+
prop({
|
|
753
|
+
type: "str",
|
|
754
|
+
default: ".",
|
|
755
|
+
title: "Folder",
|
|
756
|
+
description: "Relative folder path within workspace (use . for workspace root)"
|
|
757
|
+
})
|
|
758
|
+
], SaveVideoFileNode.prototype, "folder", void 0);
|
|
759
|
+
__decorate([
|
|
760
|
+
prop({
|
|
761
|
+
type: "str",
|
|
762
|
+
default: "video.mp4",
|
|
763
|
+
title: "Filename",
|
|
764
|
+
description: "\n Name of the file to save.\n You can use time and date variables to create unique names:\n %Y - Year\n %m - Month\n %d - Day\n %H - Hour\n %M - Minute\n %S - Second\n "
|
|
765
|
+
})
|
|
766
|
+
], SaveVideoFileNode.prototype, "filename", void 0);
|
|
767
|
+
__decorate([
|
|
768
|
+
prop({
|
|
769
|
+
type: "bool",
|
|
770
|
+
default: false,
|
|
771
|
+
title: "Overwrite",
|
|
772
|
+
description: "Overwrite the file if it already exists, otherwise file will be renamed"
|
|
773
|
+
})
|
|
774
|
+
], SaveVideoFileNode.prototype, "overwrite", void 0);
|
|
775
|
+
export const WORKSPACE_NODES = [
|
|
776
|
+
GetWorkspaceDirNode,
|
|
777
|
+
ListWorkspaceFilesNode,
|
|
778
|
+
ReadTextFileNode,
|
|
779
|
+
WriteTextFileNode,
|
|
780
|
+
ReadBinaryFileNode,
|
|
781
|
+
WriteBinaryFileNode,
|
|
782
|
+
DeleteWorkspaceFileNode,
|
|
783
|
+
CreateWorkspaceDirectoryNode,
|
|
784
|
+
WorkspaceFileExistsNode,
|
|
785
|
+
GetWorkspaceFileInfoNode,
|
|
786
|
+
CopyWorkspaceFileNode,
|
|
787
|
+
MoveWorkspaceFileNode,
|
|
788
|
+
GetWorkspaceFileSizeNode,
|
|
789
|
+
IsWorkspaceFileNode,
|
|
790
|
+
IsWorkspaceDirectoryNode,
|
|
791
|
+
JoinWorkspacePathsNode,
|
|
792
|
+
SaveImageFileNode,
|
|
793
|
+
SaveVideoFileNode
|
|
794
|
+
];
|
|
795
|
+
//# sourceMappingURL=workspace.js.map
|