@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,850 @@
|
|
|
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 { PythonDockerRunner, JavaScriptDockerRunner, BashDockerRunner, RubyDockerRunner, LuaRunner, LuaSubprocessRunner, CommandDockerRunner, ContainerFailureError } from "@nodetool-ai/code-runners";
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Helpers
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
/** Collect all streamed output from a runner into buffered stdout/stderr. */
|
|
13
|
+
async function collectRunnerOutput(runner, userCode, envLocals, options) {
|
|
14
|
+
const stdoutBuf = [];
|
|
15
|
+
const stderrBuf = [];
|
|
16
|
+
let exitCode = 0;
|
|
17
|
+
try {
|
|
18
|
+
for await (const [slot, line] of runner.stream(userCode, envLocals, options)) {
|
|
19
|
+
if (slot === "stdout")
|
|
20
|
+
stdoutBuf.push(line);
|
|
21
|
+
else if (slot === "stderr")
|
|
22
|
+
stderrBuf.push(line);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
if (err instanceof ContainerFailureError) {
|
|
27
|
+
exitCode = err.exitCode;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
exitCode = 1;
|
|
31
|
+
stderrBuf.push(String(err));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
stdout: stdoutBuf.join(""),
|
|
36
|
+
stderr: stderrBuf.join(""),
|
|
37
|
+
exit_code: exitCode
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Build an async stdin iterable from a static string. */
|
|
41
|
+
async function* stdinFromString(s) {
|
|
42
|
+
if (s)
|
|
43
|
+
yield s;
|
|
44
|
+
}
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// Execute* nodes — streaming, use runners with execution_mode
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
export class ExecutePythonNode extends BaseNode {
|
|
49
|
+
static nodeType = "nodetool.code.ExecutePython";
|
|
50
|
+
static title = "Execute Python";
|
|
51
|
+
static description = "Executes Python code with safety restrictions.\n python, code, execute\n\n Use cases:\n - Run custom data transformations\n - Prototype node functionality\n - Debug and testing workflows\n\n IMPORTANT: Only enabled in non-production environments";
|
|
52
|
+
static isStreamingOutput = true;
|
|
53
|
+
static isDynamic = true;
|
|
54
|
+
static supportsDynamicOutputs = true;
|
|
55
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
56
|
+
static requiredRuntimes = ["python"];
|
|
57
|
+
async process() {
|
|
58
|
+
const code = String(this.code ?? this.code ?? "");
|
|
59
|
+
if (!code.trim())
|
|
60
|
+
throw new Error("Code is required");
|
|
61
|
+
const mode = String(this.execution_mode ?? this.execution_mode ?? "docker");
|
|
62
|
+
const image = String(this.image ?? this.image ?? "python:3.11-slim");
|
|
63
|
+
const stdinStr = String(this.stdin ?? this.stdin ?? "");
|
|
64
|
+
const runner = new PythonDockerRunner({ image, mode });
|
|
65
|
+
const result = await collectRunnerOutput(runner, code, {}, {
|
|
66
|
+
stdinStream: stdinStr ? stdinFromString(stdinStr) : undefined
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
...result,
|
|
70
|
+
output: result.stdout,
|
|
71
|
+
success: result.exit_code === 0
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
__decorate([
|
|
76
|
+
prop({
|
|
77
|
+
type: "str",
|
|
78
|
+
default: "",
|
|
79
|
+
title: "Code",
|
|
80
|
+
description: "Python code to execute as-is. Dynamic inputs are provided as local vars. Stdout lines are emitted on 'stdout'; stderr lines on 'stderr'."
|
|
81
|
+
})
|
|
82
|
+
], ExecutePythonNode.prototype, "code", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
prop({
|
|
85
|
+
type: "enum",
|
|
86
|
+
default: "python:3.11-slim",
|
|
87
|
+
title: "Image",
|
|
88
|
+
description: "Docker image to use for execution",
|
|
89
|
+
values: ["python:3.11-slim", "jupyter/scipy-notebook:latest"]
|
|
90
|
+
})
|
|
91
|
+
], ExecutePythonNode.prototype, "image", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
prop({
|
|
94
|
+
type: "enum",
|
|
95
|
+
default: "docker",
|
|
96
|
+
title: "Execution Mode",
|
|
97
|
+
description: "Execution mode: 'docker' or 'subprocess'",
|
|
98
|
+
values: ["docker", "subprocess"]
|
|
99
|
+
})
|
|
100
|
+
], ExecutePythonNode.prototype, "execution_mode", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
prop({
|
|
103
|
+
type: "str",
|
|
104
|
+
default: "",
|
|
105
|
+
title: "Stdin",
|
|
106
|
+
description: "String to write to process stdin before any streaming input. Use newlines to separate lines."
|
|
107
|
+
})
|
|
108
|
+
], ExecutePythonNode.prototype, "stdin", void 0);
|
|
109
|
+
export class ExecuteJavaScriptNode extends BaseNode {
|
|
110
|
+
static nodeType = "nodetool.code.ExecuteJavaScript";
|
|
111
|
+
static title = "Execute Java Script";
|
|
112
|
+
static description = "Executes JavaScript (Node.js) code with safety restrictions.\n javascript, nodejs, code, execute";
|
|
113
|
+
static isDynamic = true;
|
|
114
|
+
static supportsDynamicOutputs = true;
|
|
115
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
116
|
+
static requiredRuntimes = ["nodejs"];
|
|
117
|
+
async process() {
|
|
118
|
+
const code = String(this.code ?? this.code ?? "");
|
|
119
|
+
if (!code.trim())
|
|
120
|
+
throw new Error("Code is required");
|
|
121
|
+
const mode = String(this.execution_mode ?? this.execution_mode ?? "docker");
|
|
122
|
+
const image = String(this.image ?? this.image ?? "node:22-alpine");
|
|
123
|
+
const stdinStr = String(this.stdin ?? this.stdin ?? "");
|
|
124
|
+
const runner = new JavaScriptDockerRunner({ image, mode });
|
|
125
|
+
const result = await collectRunnerOutput(runner, code, {}, {
|
|
126
|
+
stdinStream: stdinStr ? stdinFromString(stdinStr) : undefined
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
...result,
|
|
130
|
+
output: result.stdout,
|
|
131
|
+
success: result.exit_code === 0
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
__decorate([
|
|
136
|
+
prop({
|
|
137
|
+
type: "str",
|
|
138
|
+
default: "",
|
|
139
|
+
title: "Code",
|
|
140
|
+
description: "JavaScript code to execute as-is under Node.js. Dynamic inputs are provided as local vars. Stdout lines are emitted on 'stdout'; stderr lines on 'stderr'."
|
|
141
|
+
})
|
|
142
|
+
], ExecuteJavaScriptNode.prototype, "code", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
prop({
|
|
145
|
+
type: "enum",
|
|
146
|
+
default: "node:22-alpine",
|
|
147
|
+
title: "Image",
|
|
148
|
+
description: "Docker image to use for execution",
|
|
149
|
+
values: ["node:22-alpine"]
|
|
150
|
+
})
|
|
151
|
+
], ExecuteJavaScriptNode.prototype, "image", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
prop({
|
|
154
|
+
type: "enum",
|
|
155
|
+
default: "docker",
|
|
156
|
+
title: "Execution Mode",
|
|
157
|
+
description: "Execution mode: 'docker' or 'subprocess'",
|
|
158
|
+
values: ["docker", "subprocess"]
|
|
159
|
+
})
|
|
160
|
+
], ExecuteJavaScriptNode.prototype, "execution_mode", void 0);
|
|
161
|
+
__decorate([
|
|
162
|
+
prop({
|
|
163
|
+
type: "str",
|
|
164
|
+
default: "",
|
|
165
|
+
title: "Stdin",
|
|
166
|
+
description: "String to write to process stdin before any streaming input. Use newlines to separate lines."
|
|
167
|
+
})
|
|
168
|
+
], ExecuteJavaScriptNode.prototype, "stdin", void 0);
|
|
169
|
+
export class ExecuteBashNode extends BaseNode {
|
|
170
|
+
static nodeType = "nodetool.code.ExecuteBash";
|
|
171
|
+
static title = "Execute Bash";
|
|
172
|
+
static description = "Executes Bash script with safety restrictions.\n bash, shell, code, execute";
|
|
173
|
+
static isStreamingOutput = true;
|
|
174
|
+
static isDynamic = true;
|
|
175
|
+
static supportsDynamicOutputs = true;
|
|
176
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
177
|
+
static requiredRuntimes = ["bash"];
|
|
178
|
+
async process() {
|
|
179
|
+
const code = String(this.code ?? this.code ?? "");
|
|
180
|
+
if (!code.trim())
|
|
181
|
+
throw new Error("Code is required");
|
|
182
|
+
const mode = String(this.execution_mode ?? this.execution_mode ?? "docker");
|
|
183
|
+
const image = String(this.image ?? this.image ?? "ubuntu:22.04");
|
|
184
|
+
const stdinStr = String(this.stdin ?? this.stdin ?? "");
|
|
185
|
+
const runner = new BashDockerRunner({ image, mode });
|
|
186
|
+
const result = await collectRunnerOutput(runner, code, {}, {
|
|
187
|
+
stdinStream: stdinStr ? stdinFromString(stdinStr) : undefined
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
...result,
|
|
191
|
+
output: result.stdout,
|
|
192
|
+
success: result.exit_code === 0
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
__decorate([
|
|
197
|
+
prop({
|
|
198
|
+
type: "str",
|
|
199
|
+
default: "",
|
|
200
|
+
title: "Code",
|
|
201
|
+
description: "Bash script to execute as-is. Dynamic inputs are provided as env vars. Stdout lines are emitted on 'stdout'; stderr lines on 'stderr'."
|
|
202
|
+
})
|
|
203
|
+
], ExecuteBashNode.prototype, "code", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
prop({
|
|
206
|
+
type: "enum",
|
|
207
|
+
default: "ubuntu:22.04",
|
|
208
|
+
title: "Image",
|
|
209
|
+
description: "Docker image to use for execution",
|
|
210
|
+
values: [
|
|
211
|
+
"bash:5.2",
|
|
212
|
+
"debian:12",
|
|
213
|
+
"ubuntu:22.04",
|
|
214
|
+
"ubuntu:24.04",
|
|
215
|
+
"jupyter/scipy-notebook:latest"
|
|
216
|
+
]
|
|
217
|
+
})
|
|
218
|
+
], ExecuteBashNode.prototype, "image", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
prop({
|
|
221
|
+
type: "enum",
|
|
222
|
+
default: "docker",
|
|
223
|
+
title: "Execution Mode",
|
|
224
|
+
description: "Execution mode: 'docker' or 'subprocess'",
|
|
225
|
+
values: ["docker", "subprocess"]
|
|
226
|
+
})
|
|
227
|
+
], ExecuteBashNode.prototype, "execution_mode", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
prop({
|
|
230
|
+
type: "str",
|
|
231
|
+
default: "",
|
|
232
|
+
title: "Stdin",
|
|
233
|
+
description: "String to write to process stdin before any streaming input. Use newlines to separate lines."
|
|
234
|
+
})
|
|
235
|
+
], ExecuteBashNode.prototype, "stdin", void 0);
|
|
236
|
+
export class ExecuteRubyNode extends BaseNode {
|
|
237
|
+
static nodeType = "nodetool.code.ExecuteRuby";
|
|
238
|
+
static title = "Execute Ruby";
|
|
239
|
+
static description = "Executes Ruby code with safety restrictions.\n ruby, code, execute";
|
|
240
|
+
static isStreamingOutput = true;
|
|
241
|
+
static isDynamic = true;
|
|
242
|
+
static supportsDynamicOutputs = true;
|
|
243
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
244
|
+
static requiredRuntimes = ["ruby"];
|
|
245
|
+
async process() {
|
|
246
|
+
const code = String(this.code ?? this.code ?? "");
|
|
247
|
+
if (!code.trim())
|
|
248
|
+
throw new Error("Code is required");
|
|
249
|
+
const mode = String(this.execution_mode ?? this.execution_mode ?? "docker");
|
|
250
|
+
const image = String(this.image ?? this.image ?? "ruby:3.3-alpine");
|
|
251
|
+
const stdinStr = String(this.stdin ?? this.stdin ?? "");
|
|
252
|
+
const runner = new RubyDockerRunner({ image, mode });
|
|
253
|
+
const result = await collectRunnerOutput(runner, code, {}, {
|
|
254
|
+
stdinStream: stdinStr ? stdinFromString(stdinStr) : undefined
|
|
255
|
+
});
|
|
256
|
+
return {
|
|
257
|
+
...result,
|
|
258
|
+
output: result.stdout,
|
|
259
|
+
success: result.exit_code === 0
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
__decorate([
|
|
264
|
+
prop({
|
|
265
|
+
type: "str",
|
|
266
|
+
default: "",
|
|
267
|
+
title: "Code",
|
|
268
|
+
description: "Ruby code to execute as-is. Dynamic inputs are provided as env vars. Stdout lines are emitted on 'stdout'; stderr lines on 'stderr'."
|
|
269
|
+
})
|
|
270
|
+
], ExecuteRubyNode.prototype, "code", void 0);
|
|
271
|
+
__decorate([
|
|
272
|
+
prop({
|
|
273
|
+
type: "enum",
|
|
274
|
+
default: "ruby:3.3-alpine",
|
|
275
|
+
title: "Image",
|
|
276
|
+
description: "Docker image to use for execution",
|
|
277
|
+
values: ["ruby:3.3-alpine"]
|
|
278
|
+
})
|
|
279
|
+
], ExecuteRubyNode.prototype, "image", void 0);
|
|
280
|
+
__decorate([
|
|
281
|
+
prop({
|
|
282
|
+
type: "enum",
|
|
283
|
+
default: "docker",
|
|
284
|
+
title: "Execution Mode",
|
|
285
|
+
description: "Execution mode: 'docker' or 'subprocess'",
|
|
286
|
+
values: ["docker", "subprocess"]
|
|
287
|
+
})
|
|
288
|
+
], ExecuteRubyNode.prototype, "execution_mode", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
prop({
|
|
291
|
+
type: "str",
|
|
292
|
+
default: "",
|
|
293
|
+
title: "Stdin",
|
|
294
|
+
description: "String to write to process stdin before any streaming input. Use newlines to separate lines."
|
|
295
|
+
})
|
|
296
|
+
], ExecuteRubyNode.prototype, "stdin", void 0);
|
|
297
|
+
export class ExecuteLuaNode extends BaseNode {
|
|
298
|
+
static nodeType = "nodetool.code.ExecuteLua";
|
|
299
|
+
static title = "Execute Lua";
|
|
300
|
+
static description = "Executes Lua code with a local sandbox (no Docker).\n lua, code, execute, sandbox";
|
|
301
|
+
static isStreamingOutput = true;
|
|
302
|
+
static isDynamic = true;
|
|
303
|
+
static supportsDynamicOutputs = true;
|
|
304
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
305
|
+
static requiredRuntimes = ["lua"];
|
|
306
|
+
async process() {
|
|
307
|
+
const code = String(this.code ?? this.code ?? "");
|
|
308
|
+
if (!code.trim())
|
|
309
|
+
throw new Error("Code is required");
|
|
310
|
+
const mode = String(this.execution_mode ?? this.execution_mode ?? "subprocess");
|
|
311
|
+
const executable = String(this.executable ?? this.executable ?? "lua");
|
|
312
|
+
const timeoutSeconds = Number(this.timeout_seconds ?? this.timeout_seconds ?? 10);
|
|
313
|
+
const stdinStr = String(this.stdin ?? this.stdin ?? "");
|
|
314
|
+
const runner = mode === "subprocess"
|
|
315
|
+
? new LuaSubprocessRunner({ executable, timeoutSeconds })
|
|
316
|
+
: new LuaRunner({
|
|
317
|
+
image: "nickblah/lua:5.2.4-luarocks-ubuntu",
|
|
318
|
+
executable,
|
|
319
|
+
mode,
|
|
320
|
+
timeoutSeconds
|
|
321
|
+
});
|
|
322
|
+
const result = await collectRunnerOutput(runner, code, {}, {
|
|
323
|
+
stdinStream: stdinStr ? stdinFromString(stdinStr) : undefined
|
|
324
|
+
});
|
|
325
|
+
return {
|
|
326
|
+
...result,
|
|
327
|
+
output: result.stdout,
|
|
328
|
+
success: result.exit_code === 0
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
__decorate([
|
|
333
|
+
prop({
|
|
334
|
+
type: "str",
|
|
335
|
+
default: "",
|
|
336
|
+
title: "Code",
|
|
337
|
+
description: "Lua code to execute as-is in a restricted environment. Dynamic inputs are provided as variables. Stdout lines are emitted on 'stdout'; stderr lines on 'stderr'."
|
|
338
|
+
})
|
|
339
|
+
], ExecuteLuaNode.prototype, "code", void 0);
|
|
340
|
+
__decorate([
|
|
341
|
+
prop({
|
|
342
|
+
type: "enum",
|
|
343
|
+
default: "lua",
|
|
344
|
+
title: "Executable",
|
|
345
|
+
description: "Lua executable to use",
|
|
346
|
+
values: ["lua", "luajit"]
|
|
347
|
+
})
|
|
348
|
+
], ExecuteLuaNode.prototype, "executable", void 0);
|
|
349
|
+
__decorate([
|
|
350
|
+
prop({
|
|
351
|
+
type: "enum",
|
|
352
|
+
default: "subprocess",
|
|
353
|
+
title: "Execution Mode",
|
|
354
|
+
description: "Execution mode: 'docker' or 'subprocess'",
|
|
355
|
+
values: ["docker", "subprocess"]
|
|
356
|
+
})
|
|
357
|
+
], ExecuteLuaNode.prototype, "execution_mode", void 0);
|
|
358
|
+
__decorate([
|
|
359
|
+
prop({
|
|
360
|
+
type: "int",
|
|
361
|
+
default: 10,
|
|
362
|
+
title: "Timeout Seconds",
|
|
363
|
+
description: "Max seconds to allow execution before forced stop"
|
|
364
|
+
})
|
|
365
|
+
], ExecuteLuaNode.prototype, "timeout_seconds", void 0);
|
|
366
|
+
__decorate([
|
|
367
|
+
prop({
|
|
368
|
+
type: "str",
|
|
369
|
+
default: "",
|
|
370
|
+
title: "Stdin",
|
|
371
|
+
description: "String to write to process stdin before any streaming input. Use newlines to separate lines."
|
|
372
|
+
})
|
|
373
|
+
], ExecuteLuaNode.prototype, "stdin", void 0);
|
|
374
|
+
export class ExecuteCommandNode extends BaseNode {
|
|
375
|
+
static nodeType = "nodetool.code.ExecuteCommand";
|
|
376
|
+
static title = "Execute Command";
|
|
377
|
+
static description = "Executes a single shell command inside a Docker container.\n command, execute, shell, bash, sh\n\n IMPORTANT: Only enabled in non-production environments";
|
|
378
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
379
|
+
static isDynamic = true;
|
|
380
|
+
static supportsDynamicOutputs = true;
|
|
381
|
+
static isStreamingOutput = true;
|
|
382
|
+
async process() {
|
|
383
|
+
const command = String(this.command ?? this.command ?? "");
|
|
384
|
+
if (!command.trim())
|
|
385
|
+
throw new Error("Command is required");
|
|
386
|
+
const mode = String(this.execution_mode ?? this.execution_mode ?? "docker");
|
|
387
|
+
const image = String(this.image ?? this.image ?? "bash:5.2");
|
|
388
|
+
const stdinStr = String(this.stdin ?? this.stdin ?? "");
|
|
389
|
+
const runner = new CommandDockerRunner({ image, mode });
|
|
390
|
+
const result = await collectRunnerOutput(runner, command, {}, {
|
|
391
|
+
stdinStream: stdinStr ? stdinFromString(stdinStr) : undefined
|
|
392
|
+
});
|
|
393
|
+
return {
|
|
394
|
+
...result,
|
|
395
|
+
output: result.stdout,
|
|
396
|
+
success: result.exit_code === 0
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
__decorate([
|
|
401
|
+
prop({
|
|
402
|
+
type: "str",
|
|
403
|
+
default: "",
|
|
404
|
+
title: "Command",
|
|
405
|
+
description: "Single command to run via the selected shell. Stdout lines are emitted on 'stdout'; stderr lines on 'stderr'."
|
|
406
|
+
})
|
|
407
|
+
], ExecuteCommandNode.prototype, "command", void 0);
|
|
408
|
+
__decorate([
|
|
409
|
+
prop({
|
|
410
|
+
type: "enum",
|
|
411
|
+
default: "bash:5.2",
|
|
412
|
+
title: "Image",
|
|
413
|
+
description: "Docker image to use for execution",
|
|
414
|
+
values: ["bash:5.2", "alpine:3", "ubuntu:22.04", "ubuntu:24.04"]
|
|
415
|
+
})
|
|
416
|
+
], ExecuteCommandNode.prototype, "image", void 0);
|
|
417
|
+
__decorate([
|
|
418
|
+
prop({
|
|
419
|
+
type: "enum",
|
|
420
|
+
default: "docker",
|
|
421
|
+
title: "Execution Mode",
|
|
422
|
+
description: "Execution mode: 'docker' or 'subprocess'",
|
|
423
|
+
values: ["docker", "subprocess"]
|
|
424
|
+
})
|
|
425
|
+
], ExecuteCommandNode.prototype, "execution_mode", void 0);
|
|
426
|
+
__decorate([
|
|
427
|
+
prop({
|
|
428
|
+
type: "str",
|
|
429
|
+
default: "",
|
|
430
|
+
title: "Stdin",
|
|
431
|
+
description: "String to write to process stdin before any streaming input. Use newlines to separate lines."
|
|
432
|
+
})
|
|
433
|
+
], ExecuteCommandNode.prototype, "stdin", void 0);
|
|
434
|
+
// ---------------------------------------------------------------------------
|
|
435
|
+
// RunCommand* nodes — buffered, use runners
|
|
436
|
+
// ---------------------------------------------------------------------------
|
|
437
|
+
/** Helper: create a runner for a RunCommand node given its language and mode. */
|
|
438
|
+
function createRunner(lang, mode, opts) {
|
|
439
|
+
const m = mode;
|
|
440
|
+
switch (lang) {
|
|
441
|
+
case "python":
|
|
442
|
+
return new PythonDockerRunner({
|
|
443
|
+
image: opts?.image ?? "python:3.11-slim",
|
|
444
|
+
mode: m
|
|
445
|
+
});
|
|
446
|
+
case "javascript":
|
|
447
|
+
return new JavaScriptDockerRunner({
|
|
448
|
+
image: opts?.image ?? "node:22-alpine",
|
|
449
|
+
mode: m
|
|
450
|
+
});
|
|
451
|
+
case "bash":
|
|
452
|
+
return new BashDockerRunner({
|
|
453
|
+
image: opts?.image ?? "bash:5.2",
|
|
454
|
+
mode: m
|
|
455
|
+
});
|
|
456
|
+
case "ruby":
|
|
457
|
+
return new RubyDockerRunner({
|
|
458
|
+
image: opts?.image ?? "ruby:3.3-alpine",
|
|
459
|
+
mode: m
|
|
460
|
+
});
|
|
461
|
+
case "lua":
|
|
462
|
+
if (m === "subprocess")
|
|
463
|
+
return new LuaSubprocessRunner({
|
|
464
|
+
executable: opts?.executable ?? "lua",
|
|
465
|
+
timeoutSeconds: opts?.timeoutSeconds ?? 10
|
|
466
|
+
});
|
|
467
|
+
return new LuaRunner({
|
|
468
|
+
image: opts?.image ?? "nickblah/lua:5.2.4-luarocks-ubuntu",
|
|
469
|
+
executable: opts?.executable ?? "lua",
|
|
470
|
+
mode: m,
|
|
471
|
+
timeoutSeconds: opts?.timeoutSeconds ?? 10
|
|
472
|
+
});
|
|
473
|
+
case "command":
|
|
474
|
+
return new CommandDockerRunner({
|
|
475
|
+
image: opts?.image ?? "bash:5.2",
|
|
476
|
+
mode: m
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
class RunCommandNode extends BaseNode {
|
|
481
|
+
/** Language for creating the runner */
|
|
482
|
+
static lang = "command";
|
|
483
|
+
/** Default execution mode */
|
|
484
|
+
static defaultMode = "subprocess";
|
|
485
|
+
async process() {
|
|
486
|
+
const command = String(this.command ?? "");
|
|
487
|
+
if (!command.trim())
|
|
488
|
+
return {
|
|
489
|
+
stdout: "",
|
|
490
|
+
stderr: "",
|
|
491
|
+
exit_code: 0,
|
|
492
|
+
output: "",
|
|
493
|
+
success: true
|
|
494
|
+
};
|
|
495
|
+
const cls = this.constructor;
|
|
496
|
+
const mode = String(this.execution_mode ?? cls.defaultMode);
|
|
497
|
+
const image = this.image ?? undefined;
|
|
498
|
+
const executable = this.executable ?? undefined;
|
|
499
|
+
const timeoutSeconds = Number(this.timeout_seconds ?? 10);
|
|
500
|
+
const stdinStr = typeof this.stdin === "string"
|
|
501
|
+
? String(this.stdin ?? "")
|
|
502
|
+
: undefined;
|
|
503
|
+
const runner = createRunner(cls.lang, mode, {
|
|
504
|
+
image,
|
|
505
|
+
executable,
|
|
506
|
+
timeoutSeconds
|
|
507
|
+
});
|
|
508
|
+
const result = await collectRunnerOutput(runner, command, {}, {
|
|
509
|
+
stdinStream: stdinStr ? stdinFromString(stdinStr) : undefined
|
|
510
|
+
});
|
|
511
|
+
return {
|
|
512
|
+
...result,
|
|
513
|
+
output: result.stdout,
|
|
514
|
+
success: result.exit_code === 0
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
// --- Subprocess (local) variants ---
|
|
519
|
+
export class RunPythonCommandNode extends RunCommandNode {
|
|
520
|
+
static nodeType = "nodetool.code.RunPythonCommand";
|
|
521
|
+
static title = "Run Python Command";
|
|
522
|
+
static description = "Executes a single Python command and buffers the output.\n python, code, execute, command\n\n Use cases:\n - Run a single Python script or command\n - Execute Python code with buffered stdout/stderr output\n - One-shot Python execution without streaming\n\n The command is executed once and the complete output is returned.\n IMPORTANT: Only enabled in non-production environments";
|
|
523
|
+
static isDynamic = true;
|
|
524
|
+
static supportsDynamicOutputs = true;
|
|
525
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
526
|
+
static lang = "python";
|
|
527
|
+
static defaultMode = "subprocess";
|
|
528
|
+
static requiredRuntimes = ["python"];
|
|
529
|
+
}
|
|
530
|
+
__decorate([
|
|
531
|
+
prop({
|
|
532
|
+
type: "str",
|
|
533
|
+
default: "",
|
|
534
|
+
title: "Command",
|
|
535
|
+
description: "Python command to execute"
|
|
536
|
+
})
|
|
537
|
+
], RunPythonCommandNode.prototype, "command", void 0);
|
|
538
|
+
export class RunJavaScriptCommandNode extends RunCommandNode {
|
|
539
|
+
static nodeType = "nodetool.code.RunJavaScriptCommand";
|
|
540
|
+
static title = "Run Java Script Command";
|
|
541
|
+
static description = "Executes a single JavaScript command and buffers the output.\n javascript, nodejs, code, execute, command\n\n Use cases:\n - Run a single JavaScript script or command\n - Execute JavaScript code with buffered stdout/stderr output\n - One-shot JavaScript execution without streaming\n\n The command is executed once and the complete output is returned.";
|
|
542
|
+
static isDynamic = true;
|
|
543
|
+
static supportsDynamicOutputs = true;
|
|
544
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
545
|
+
static lang = "javascript";
|
|
546
|
+
static defaultMode = "subprocess";
|
|
547
|
+
static requiredRuntimes = ["nodejs"];
|
|
548
|
+
}
|
|
549
|
+
__decorate([
|
|
550
|
+
prop({
|
|
551
|
+
type: "str",
|
|
552
|
+
default: "",
|
|
553
|
+
title: "Command",
|
|
554
|
+
description: "JavaScript command to execute"
|
|
555
|
+
})
|
|
556
|
+
], RunJavaScriptCommandNode.prototype, "command", void 0);
|
|
557
|
+
export class RunBashCommandNode extends RunCommandNode {
|
|
558
|
+
static nodeType = "nodetool.code.RunBashCommand";
|
|
559
|
+
static title = "Run Bash Command";
|
|
560
|
+
static description = "Executes a single Bash command and buffers the output.\n bash, shell, code, execute, command\n\n Use cases:\n - Run a single Bash script or command\n - Execute shell commands with buffered stdout/stderr output\n - One-shot Bash execution without streaming\n\n The command is executed once and the complete output is returned.";
|
|
561
|
+
static isDynamic = true;
|
|
562
|
+
static supportsDynamicOutputs = true;
|
|
563
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
564
|
+
static lang = "bash";
|
|
565
|
+
static defaultMode = "subprocess";
|
|
566
|
+
static requiredRuntimes = ["bash"];
|
|
567
|
+
}
|
|
568
|
+
__decorate([
|
|
569
|
+
prop({
|
|
570
|
+
type: "str",
|
|
571
|
+
default: "",
|
|
572
|
+
title: "Command",
|
|
573
|
+
description: "Bash command to execute"
|
|
574
|
+
})
|
|
575
|
+
], RunBashCommandNode.prototype, "command", void 0);
|
|
576
|
+
export class RunRubyCommandNode extends RunCommandNode {
|
|
577
|
+
static nodeType = "nodetool.code.RunRubyCommand";
|
|
578
|
+
static title = "Run Ruby Command";
|
|
579
|
+
static description = "Executes a single Ruby command and buffers the output.\n ruby, code, execute, command\n\n Use cases:\n - Run a single Ruby script or command\n - Execute Ruby code with buffered stdout/stderr output\n - One-shot Ruby execution without streaming\n\n The command is executed once and the complete output is returned.";
|
|
580
|
+
static isDynamic = true;
|
|
581
|
+
static supportsDynamicOutputs = true;
|
|
582
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
583
|
+
static lang = "ruby";
|
|
584
|
+
static defaultMode = "subprocess";
|
|
585
|
+
static requiredRuntimes = ["ruby"];
|
|
586
|
+
}
|
|
587
|
+
__decorate([
|
|
588
|
+
prop({
|
|
589
|
+
type: "str",
|
|
590
|
+
default: "",
|
|
591
|
+
title: "Command",
|
|
592
|
+
description: "Ruby command to execute"
|
|
593
|
+
})
|
|
594
|
+
], RunRubyCommandNode.prototype, "command", void 0);
|
|
595
|
+
export class RunLuaCommandNode extends RunCommandNode {
|
|
596
|
+
static nodeType = "nodetool.code.RunLuaCommand";
|
|
597
|
+
static title = "Run Lua Command";
|
|
598
|
+
static description = "Executes a single Lua command and buffers the output.\n lua, code, execute, command, sandbox\n\n Use cases:\n - Run a single Lua script or command\n - Execute Lua code with buffered stdout/stderr output\n - One-shot Lua execution without streaming\n\n The command is executed once and the complete output is returned.";
|
|
599
|
+
static isDynamic = true;
|
|
600
|
+
static supportsDynamicOutputs = true;
|
|
601
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
602
|
+
static lang = "lua";
|
|
603
|
+
static defaultMode = "subprocess";
|
|
604
|
+
static requiredRuntimes = ["lua"];
|
|
605
|
+
}
|
|
606
|
+
__decorate([
|
|
607
|
+
prop({
|
|
608
|
+
type: "str",
|
|
609
|
+
default: "",
|
|
610
|
+
title: "Command",
|
|
611
|
+
description: "Lua command to execute"
|
|
612
|
+
})
|
|
613
|
+
], RunLuaCommandNode.prototype, "command", void 0);
|
|
614
|
+
__decorate([
|
|
615
|
+
prop({
|
|
616
|
+
type: "enum",
|
|
617
|
+
default: "lua",
|
|
618
|
+
title: "Executable",
|
|
619
|
+
description: "Lua executable to use",
|
|
620
|
+
values: ["lua", "luajit"]
|
|
621
|
+
})
|
|
622
|
+
], RunLuaCommandNode.prototype, "executable", void 0);
|
|
623
|
+
__decorate([
|
|
624
|
+
prop({
|
|
625
|
+
type: "int",
|
|
626
|
+
default: 10,
|
|
627
|
+
title: "Timeout Seconds",
|
|
628
|
+
description: "Max seconds to allow execution before forced stop"
|
|
629
|
+
})
|
|
630
|
+
], RunLuaCommandNode.prototype, "timeout_seconds", void 0);
|
|
631
|
+
export class RunShellCommandNode extends RunCommandNode {
|
|
632
|
+
static nodeType = "nodetool.code.RunShellCommand";
|
|
633
|
+
static title = "Run Shell Command";
|
|
634
|
+
static description = "Executes a single shell command and buffers the output.\n command, execute, shell, bash, sh\n\n Use cases:\n - Run a single shell command\n - Execute shell commands with buffered stdout/stderr output\n - One-shot command execution without streaming\n\n The command is executed once and the complete output is returned.\n IMPORTANT: Only enabled in non-production environments";
|
|
635
|
+
static isDynamic = true;
|
|
636
|
+
static supportsDynamicOutputs = true;
|
|
637
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
638
|
+
static lang = "command";
|
|
639
|
+
static defaultMode = "subprocess";
|
|
640
|
+
static requiredRuntimes = ["bash"];
|
|
641
|
+
}
|
|
642
|
+
__decorate([
|
|
643
|
+
prop({
|
|
644
|
+
type: "str",
|
|
645
|
+
default: "",
|
|
646
|
+
title: "Command",
|
|
647
|
+
description: "Shell command to execute"
|
|
648
|
+
})
|
|
649
|
+
], RunShellCommandNode.prototype, "command", void 0);
|
|
650
|
+
// --- Docker variants ---
|
|
651
|
+
export class RunLuaCommandDockerNode extends RunCommandNode {
|
|
652
|
+
static nodeType = "nodetool.code.RunLuaCommandDocker";
|
|
653
|
+
static title = "Run Lua Command Docker";
|
|
654
|
+
static description = "Executes a single Lua command in Docker and buffers the output.\n lua, code, execute, command, sandbox, docker";
|
|
655
|
+
static isDynamic = true;
|
|
656
|
+
static supportsDynamicOutputs = true;
|
|
657
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
658
|
+
static lang = "lua";
|
|
659
|
+
static defaultMode = "docker";
|
|
660
|
+
}
|
|
661
|
+
__decorate([
|
|
662
|
+
prop({
|
|
663
|
+
type: "str",
|
|
664
|
+
default: "",
|
|
665
|
+
title: "Command",
|
|
666
|
+
description: "Lua command to execute"
|
|
667
|
+
})
|
|
668
|
+
], RunLuaCommandDockerNode.prototype, "command", void 0);
|
|
669
|
+
__decorate([
|
|
670
|
+
prop({
|
|
671
|
+
type: "enum",
|
|
672
|
+
default: "nickblah/lua:5.2.4-luarocks-ubuntu",
|
|
673
|
+
title: "Image",
|
|
674
|
+
description: "Docker image to use for execution",
|
|
675
|
+
values: ["nickblah/lua:5.2.4-luarocks-ubuntu"]
|
|
676
|
+
})
|
|
677
|
+
], RunLuaCommandDockerNode.prototype, "image", void 0);
|
|
678
|
+
__decorate([
|
|
679
|
+
prop({
|
|
680
|
+
type: "int",
|
|
681
|
+
default: 10,
|
|
682
|
+
title: "Timeout Seconds",
|
|
683
|
+
description: "Max seconds to allow execution before forced stop"
|
|
684
|
+
})
|
|
685
|
+
], RunLuaCommandDockerNode.prototype, "timeout_seconds", void 0);
|
|
686
|
+
export class RunPythonCommandDockerNode extends RunCommandNode {
|
|
687
|
+
static nodeType = "nodetool.code.RunPythonCommandDocker";
|
|
688
|
+
static title = "Run Python Command Docker";
|
|
689
|
+
static description = "Executes a single Python command in Docker and buffers the output.\n python, code, execute, command, docker";
|
|
690
|
+
static isDynamic = true;
|
|
691
|
+
static supportsDynamicOutputs = true;
|
|
692
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
693
|
+
static lang = "python";
|
|
694
|
+
static defaultMode = "docker";
|
|
695
|
+
}
|
|
696
|
+
__decorate([
|
|
697
|
+
prop({
|
|
698
|
+
type: "str",
|
|
699
|
+
default: "",
|
|
700
|
+
title: "Command",
|
|
701
|
+
description: "Python command to execute"
|
|
702
|
+
})
|
|
703
|
+
], RunPythonCommandDockerNode.prototype, "command", void 0);
|
|
704
|
+
__decorate([
|
|
705
|
+
prop({
|
|
706
|
+
type: "enum",
|
|
707
|
+
default: "python:3.11-slim",
|
|
708
|
+
title: "Image",
|
|
709
|
+
description: "Docker image to use for execution",
|
|
710
|
+
values: ["python:3.11-slim", "jupyter/scipy-notebook:latest"]
|
|
711
|
+
})
|
|
712
|
+
], RunPythonCommandDockerNode.prototype, "image", void 0);
|
|
713
|
+
export class RunJavaScriptCommandDockerNode extends RunCommandNode {
|
|
714
|
+
static nodeType = "nodetool.code.RunJavaScriptCommandDocker";
|
|
715
|
+
static title = "Run Java Script Command Docker";
|
|
716
|
+
static description = "Executes a single JavaScript command in Docker and buffers the output.\n javascript, nodejs, code, execute, command, docker";
|
|
717
|
+
static isDynamic = true;
|
|
718
|
+
static supportsDynamicOutputs = true;
|
|
719
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
720
|
+
static lang = "javascript";
|
|
721
|
+
static defaultMode = "docker";
|
|
722
|
+
}
|
|
723
|
+
__decorate([
|
|
724
|
+
prop({
|
|
725
|
+
type: "str",
|
|
726
|
+
default: "",
|
|
727
|
+
title: "Command",
|
|
728
|
+
description: "JavaScript command to execute"
|
|
729
|
+
})
|
|
730
|
+
], RunJavaScriptCommandDockerNode.prototype, "command", void 0);
|
|
731
|
+
__decorate([
|
|
732
|
+
prop({
|
|
733
|
+
type: "enum",
|
|
734
|
+
default: "node:22-alpine",
|
|
735
|
+
title: "Image",
|
|
736
|
+
description: "Docker image to use for execution",
|
|
737
|
+
values: ["node:22-alpine"]
|
|
738
|
+
})
|
|
739
|
+
], RunJavaScriptCommandDockerNode.prototype, "image", void 0);
|
|
740
|
+
export class RunBashCommandDockerNode extends RunCommandNode {
|
|
741
|
+
static nodeType = "nodetool.code.RunBashCommandDocker";
|
|
742
|
+
static title = "Run Bash Command Docker";
|
|
743
|
+
static description = "Executes a single Bash command in Docker and buffers the output.\n bash, shell, code, execute, command, docker";
|
|
744
|
+
static isDynamic = true;
|
|
745
|
+
static supportsDynamicOutputs = true;
|
|
746
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
747
|
+
static lang = "bash";
|
|
748
|
+
static defaultMode = "docker";
|
|
749
|
+
}
|
|
750
|
+
__decorate([
|
|
751
|
+
prop({
|
|
752
|
+
type: "str",
|
|
753
|
+
default: "",
|
|
754
|
+
title: "Command",
|
|
755
|
+
description: "Bash command to execute"
|
|
756
|
+
})
|
|
757
|
+
], RunBashCommandDockerNode.prototype, "command", void 0);
|
|
758
|
+
__decorate([
|
|
759
|
+
prop({
|
|
760
|
+
type: "enum",
|
|
761
|
+
default: "ubuntu:22.04",
|
|
762
|
+
title: "Image",
|
|
763
|
+
description: "Docker image to use for execution",
|
|
764
|
+
values: [
|
|
765
|
+
"bash:5.2",
|
|
766
|
+
"debian:12",
|
|
767
|
+
"ubuntu:22.04",
|
|
768
|
+
"ubuntu:24.04",
|
|
769
|
+
"jupyter/scipy-notebook:latest"
|
|
770
|
+
]
|
|
771
|
+
})
|
|
772
|
+
], RunBashCommandDockerNode.prototype, "image", void 0);
|
|
773
|
+
export class RunRubyCommandDockerNode extends RunCommandNode {
|
|
774
|
+
static nodeType = "nodetool.code.RunRubyCommandDocker";
|
|
775
|
+
static title = "Run Ruby Command Docker";
|
|
776
|
+
static description = "Executes a single Ruby command in Docker and buffers the output.\n ruby, code, execute, command, docker";
|
|
777
|
+
static isDynamic = true;
|
|
778
|
+
static supportsDynamicOutputs = true;
|
|
779
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
780
|
+
static lang = "ruby";
|
|
781
|
+
static defaultMode = "docker";
|
|
782
|
+
}
|
|
783
|
+
__decorate([
|
|
784
|
+
prop({
|
|
785
|
+
type: "str",
|
|
786
|
+
default: "",
|
|
787
|
+
title: "Command",
|
|
788
|
+
description: "Ruby command to execute"
|
|
789
|
+
})
|
|
790
|
+
], RunRubyCommandDockerNode.prototype, "command", void 0);
|
|
791
|
+
__decorate([
|
|
792
|
+
prop({
|
|
793
|
+
type: "enum",
|
|
794
|
+
default: "ruby:3.3-alpine",
|
|
795
|
+
title: "Image",
|
|
796
|
+
description: "Docker image to use for execution",
|
|
797
|
+
values: ["ruby:3.3-alpine"]
|
|
798
|
+
})
|
|
799
|
+
], RunRubyCommandDockerNode.prototype, "image", void 0);
|
|
800
|
+
export class RunShellCommandDockerNode extends RunCommandNode {
|
|
801
|
+
static nodeType = "nodetool.code.RunShellCommandDocker";
|
|
802
|
+
static title = "Run Shell Command Docker";
|
|
803
|
+
static description = "Executes a single shell command in Docker and buffers the output.\n command, execute, shell, bash, sh, docker";
|
|
804
|
+
static isDynamic = true;
|
|
805
|
+
static supportsDynamicOutputs = true;
|
|
806
|
+
static metadataOutputTypes = { stdout: "str", stderr: "str" };
|
|
807
|
+
static lang = "command";
|
|
808
|
+
static defaultMode = "docker";
|
|
809
|
+
}
|
|
810
|
+
__decorate([
|
|
811
|
+
prop({
|
|
812
|
+
type: "str",
|
|
813
|
+
default: "",
|
|
814
|
+
title: "Command",
|
|
815
|
+
description: "Shell command to execute"
|
|
816
|
+
})
|
|
817
|
+
], RunShellCommandDockerNode.prototype, "command", void 0);
|
|
818
|
+
__decorate([
|
|
819
|
+
prop({
|
|
820
|
+
type: "enum",
|
|
821
|
+
default: "bash:5.2",
|
|
822
|
+
title: "Image",
|
|
823
|
+
description: "Docker image to use for execution",
|
|
824
|
+
values: ["bash:5.2", "alpine:3", "ubuntu:22.04", "ubuntu:24.04"]
|
|
825
|
+
})
|
|
826
|
+
], RunShellCommandDockerNode.prototype, "image", void 0);
|
|
827
|
+
// ---------------------------------------------------------------------------
|
|
828
|
+
// Export list (same order as before for compatibility)
|
|
829
|
+
// ---------------------------------------------------------------------------
|
|
830
|
+
export const CODE_NODES = [
|
|
831
|
+
ExecutePythonNode,
|
|
832
|
+
ExecuteJavaScriptNode,
|
|
833
|
+
ExecuteBashNode,
|
|
834
|
+
ExecuteRubyNode,
|
|
835
|
+
ExecuteLuaNode,
|
|
836
|
+
ExecuteCommandNode,
|
|
837
|
+
RunPythonCommandNode,
|
|
838
|
+
RunJavaScriptCommandNode,
|
|
839
|
+
RunBashCommandNode,
|
|
840
|
+
RunRubyCommandNode,
|
|
841
|
+
RunLuaCommandNode,
|
|
842
|
+
RunLuaCommandDockerNode,
|
|
843
|
+
RunShellCommandNode,
|
|
844
|
+
RunPythonCommandDockerNode,
|
|
845
|
+
RunJavaScriptCommandDockerNode,
|
|
846
|
+
RunBashCommandDockerNode,
|
|
847
|
+
RunRubyCommandDockerNode,
|
|
848
|
+
RunShellCommandDockerNode
|
|
849
|
+
];
|
|
850
|
+
//# sourceMappingURL=code.js.map
|