feat(server): enhance script execution and workflow management

- Introduced compileWorkflowScripts function to parse and validate workflow scripts, supporting both linear and DAG execution modes.
- Added runLinearSteps and runDagSteps functions for executing compiled workflows based on their structure.
- Updated createRegistry function to utilize the new workflow compilation and execution logic.
- Enhanced script sandbox with meta extraction and instantiation capabilities for better script management.
- Improved API endpoints to return script metadata and handle errors more effectively.
- Removed deprecated scripts and updated workflows to reflect new structure and functionality.
This commit is contained in:
2026-08-14 19:14:44 +07:00
parent ddff33cf49
commit 049f5c56e3
21 changed files with 809 additions and 87 deletions
+29 -1
View File
@@ -29,7 +29,7 @@ function previewValue(value) {
return { preview: `${json.slice(0, 500)}...`, truncated: true };
}
export default async function fetchHtml(ctx) {
async function fetchHtml(ctx) {
const url = ctx.config?.url;
if (typeof url !== "string" || url.length === 0) {
throw new Error("fetch-html: ctx.config.url is required");
@@ -83,3 +83,31 @@ export default async function fetchHtml(ctx) {
return ctx;
}
fetchHtml.meta = {
description: "Fetch HTML and optionally select elements or transform with JSONata",
config: {
url: { type: "string", required: true, description: "Page URL" },
selector: { type: "string", required: false, description: "CSS selector" },
outputVar: {
type: "string",
required: false,
description: "Required when selector or jsonata is set",
},
jsonata: { type: "string", required: false, description: "JSONata applied to selector matches" },
},
input: {},
output: {
httpResponse: { type: "string", description: "Raw HTML" },
},
example: {
data: {},
config: {
url: "https://example.com/",
selector: "h1",
outputVar: "headings",
},
},
};
export default fetchHtml;