@elizaos/plugin-workflow 2.0.0-beta.1 → 2.0.3-beta.6
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/LICENSE +21 -0
- package/README.md +28 -26
- package/dist/actions/eval-code.d.ts +12 -0
- package/dist/actions/eval-code.d.ts.map +1 -0
- package/dist/actions/eval-code.js +59 -0
- package/dist/actions/eval-code.js.map +1 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +1 -0
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/workflow.d.ts +7 -0
- package/dist/actions/workflow.d.ts.map +1 -1
- package/dist/actions/workflow.js +462 -10
- package/dist/actions/workflow.js.map +1 -1
- package/dist/db/schema.d.ts +196 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +23 -0
- package/dist/db/schema.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -64
- package/dist/index.js.map +1 -1
- package/dist/lib/automations-builder.d.ts.map +1 -1
- package/dist/lib/automations-builder.js +10 -35
- package/dist/lib/automations-builder.js.map +1 -1
- package/dist/lib/automations-types.d.ts +2 -2
- package/dist/lib/automations-types.d.ts.map +1 -1
- package/dist/lib/automations-types.js.map +1 -1
- package/dist/lib/index.d.ts +0 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/workflow-clarification.d.ts +2 -2
- package/dist/lib/workflow-clarification.d.ts.map +1 -1
- package/dist/lib/workflow-clarification.js +15 -11
- package/dist/lib/workflow-clarification.js.map +1 -1
- package/dist/plugin-routes.d.ts.map +1 -1
- package/dist/plugin-routes.js +6 -0
- package/dist/plugin-routes.js.map +1 -1
- package/dist/providers/activeWorkflows.js +2 -2
- package/dist/providers/activeWorkflows.js.map +1 -1
- package/dist/providers/workflowStatus.js +1 -1
- package/dist/providers/workflowStatus.js.map +1 -1
- package/dist/routes/workflow-routes.d.ts.map +1 -1
- package/dist/routes/workflow-routes.js +68 -2
- package/dist/routes/workflow-routes.js.map +1 -1
- package/dist/routes/workflows.d.ts.map +1 -1
- package/dist/routes/workflows.js +5 -1
- package/dist/routes/workflows.js.map +1 -1
- package/dist/services/embedded-workflow-service.d.ts +74 -17
- package/dist/services/embedded-workflow-service.d.ts.map +1 -1
- package/dist/services/embedded-workflow-service.js +343 -149
- package/dist/services/embedded-workflow-service.js.map +1 -1
- package/dist/services/smithers-runtime.d.ts +47 -0
- package/dist/services/smithers-runtime.d.ts.map +1 -0
- package/dist/services/smithers-runtime.js +444 -0
- package/dist/services/smithers-runtime.js.map +1 -0
- package/dist/services/workflow-credential-store.js +1 -1
- package/dist/services/workflow-credential-store.js.map +1 -1
- package/dist/services/workflow-dispatch.d.ts +31 -1
- package/dist/services/workflow-dispatch.d.ts.map +1 -1
- package/dist/services/workflow-dispatch.js +75 -10
- package/dist/services/workflow-dispatch.js.map +1 -1
- package/dist/services/workflow-service.d.ts +27 -1
- package/dist/services/workflow-service.d.ts.map +1 -1
- package/dist/services/workflow-service.js +133 -11
- package/dist/services/workflow-service.js.map +1 -1
- package/dist/trigger-routes.d.ts +2 -18
- package/dist/trigger-routes.d.ts.map +1 -1
- package/dist/trigger-routes.js +11 -39
- package/dist/trigger-routes.js.map +1 -1
- package/dist/types/index.d.ts +82 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/workflow-contracts.d.ts +118 -0
- package/dist/types/workflow-contracts.d.ts.map +1 -0
- package/dist/types/workflow-contracts.js +2 -0
- package/dist/types/workflow-contracts.js.map +1 -0
- package/dist/utils/catalog.js +2 -2
- package/dist/utils/catalog.js.map +1 -1
- package/dist/utils/clarification.d.ts +1 -1
- package/dist/utils/clarification.d.ts.map +1 -1
- package/dist/utils/clarification.js +15 -4
- package/dist/utils/clarification.js.map +1 -1
- package/dist/utils/context.js +1 -1
- package/dist/utils/context.js.map +1 -1
- package/dist/utils/evaluation-samples.d.ts +6 -0
- package/dist/utils/evaluation-samples.d.ts.map +1 -0
- package/dist/utils/evaluation-samples.js +216 -0
- package/dist/utils/evaluation-samples.js.map +1 -0
- package/dist/utils/execution-diagnostics.d.ts +26 -0
- package/dist/utils/execution-diagnostics.d.ts.map +1 -0
- package/dist/utils/execution-diagnostics.js +159 -0
- package/dist/utils/execution-diagnostics.js.map +1 -0
- package/dist/utils/generation.d.ts.map +1 -1
- package/dist/utils/generation.js +134 -19
- package/dist/utils/generation.js.map +1 -1
- package/dist/utils/host-capabilities.d.ts.map +1 -1
- package/dist/utils/host-capabilities.js +20 -5
- package/dist/utils/host-capabilities.js.map +1 -1
- package/dist/utils/inferSyntheticOutputSchema.js +3 -3
- package/dist/utils/inferSyntheticOutputSchema.js.map +1 -1
- package/dist/utils/outputSchema.js +1 -1
- package/dist/utils/outputSchema.js.map +1 -1
- package/dist/utils/validateAndRepair.js +10 -10
- package/dist/utils/validateAndRepair.js.map +1 -1
- package/dist/utils/workflow-prompts/draftIntent.d.ts +1 -1
- package/dist/utils/workflow-prompts/draftIntent.d.ts.map +1 -1
- package/dist/utils/workflow-prompts/draftIntent.js +1 -1
- package/dist/utils/workflow-prompts/keywordExtraction.d.ts +1 -1
- package/dist/utils/workflow-prompts/keywordExtraction.d.ts.map +1 -1
- package/dist/utils/workflow-prompts/keywordExtraction.js +1 -1
- package/dist/utils/workflow-prompts/workflowGeneration.d.ts +1 -1
- package/dist/utils/workflow-prompts/workflowGeneration.d.ts.map +1 -1
- package/dist/utils/workflow-prompts/workflowGeneration.js +4 -4
- package/dist/utils/workflow-prompts/workflowMatching.d.ts +1 -1
- package/dist/utils/workflow-prompts/workflowMatching.d.ts.map +1 -1
- package/dist/utils/workflow-prompts/workflowMatching.js +1 -1
- package/dist/utils/workflow.d.ts +1 -0
- package/dist/utils/workflow.d.ts.map +1 -1
- package/dist/utils/workflow.js +44 -8
- package/dist/utils/workflow.js.map +1 -1
- package/package.json +27 -8
- package/registry-entry.json +25 -0
- package/src/actions/eval-code.ts +81 -0
- package/src/actions/index.ts +1 -0
- package/src/actions/workflow.ts +518 -10
- package/src/db/schema.ts +31 -0
- package/src/index.ts +9 -82
- package/src/lib/automations-builder.ts +11 -35
- package/src/lib/automations-types.ts +1 -2
- package/src/lib/index.ts +0 -8
- package/src/lib/workflow-clarification.ts +18 -13
- package/src/plugin-routes.ts +6 -0
- package/src/providers/activeWorkflows.ts +2 -2
- package/src/providers/workflowStatus.ts +1 -1
- package/src/routes/workflow-routes.ts +100 -2
- package/src/routes/workflows.ts +5 -1
- package/src/services/embedded-workflow-service.ts +447 -172
- package/src/services/smithers-runtime.ts +526 -0
- package/src/services/workflow-credential-store.ts +1 -1
- package/src/services/workflow-dispatch.ts +116 -13
- package/src/services/workflow-service.ts +186 -10
- package/src/trigger-routes.ts +12 -70
- package/src/types/index.ts +94 -2
- package/src/types/workflow-contracts.ts +166 -0
- package/src/utils/catalog.ts +2 -2
- package/src/utils/clarification.ts +19 -5
- package/src/utils/context.ts +1 -1
- package/src/utils/evaluation-samples.ts +239 -0
- package/src/utils/execution-diagnostics.ts +192 -0
- package/src/utils/generation.ts +224 -32
- package/src/utils/host-capabilities.ts +21 -5
- package/src/utils/inferSyntheticOutputSchema.ts +3 -3
- package/src/utils/outputSchema.ts +1 -1
- package/src/utils/validateAndRepair.ts +10 -10
- package/src/utils/workflow-prompts/draftIntent.ts +1 -1
- package/src/utils/workflow-prompts/keywordExtraction.ts +1 -1
- package/src/utils/workflow-prompts/workflowGeneration.ts +4 -4
- package/src/utils/workflow-prompts/workflowMatching.ts +1 -1
- package/src/utils/workflow.ts +56 -8
- package/dist/lib/legacy-task-migration.d.ts +0 -20
- package/dist/lib/legacy-task-migration.d.ts.map +0 -1
- package/dist/lib/legacy-task-migration.js +0 -110
- package/dist/lib/legacy-task-migration.js.map +0 -1
- package/dist/lib/legacy-text-trigger-migration.d.ts +0 -18
- package/dist/lib/legacy-text-trigger-migration.d.ts.map +0 -1
- package/dist/lib/legacy-text-trigger-migration.js +0 -131
- package/dist/lib/legacy-text-trigger-migration.js.map +0 -1
- package/src/lib/legacy-task-migration.ts +0 -143
- package/src/lib/legacy-text-trigger-migration.ts +0 -178
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-workflow",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3-beta.6",
|
|
4
4
|
"description": "ElizaOS plugin for generating and running workflows in-process",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,11 +9,28 @@
|
|
|
9
9
|
"./package.json": "./package.json",
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
+
"eliza-source": {
|
|
13
|
+
"types": "./src/index.ts",
|
|
14
|
+
"import": "./src/index.ts",
|
|
15
|
+
"default": "./src/index.ts"
|
|
16
|
+
},
|
|
12
17
|
"import": "./dist/index.js",
|
|
13
18
|
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./*.css": "./dist/*.css",
|
|
21
|
+
"./*": {
|
|
22
|
+
"types": "./dist/*.d.ts",
|
|
23
|
+
"eliza-source": {
|
|
24
|
+
"types": "./src/*.ts",
|
|
25
|
+
"import": "./src/*.ts",
|
|
26
|
+
"default": "./src/*.ts"
|
|
27
|
+
},
|
|
28
|
+
"import": "./dist/*.js",
|
|
29
|
+
"default": "./dist/*.js"
|
|
14
30
|
}
|
|
15
31
|
},
|
|
16
32
|
"files": [
|
|
33
|
+
"registry-entry.json",
|
|
17
34
|
"dist",
|
|
18
35
|
"src",
|
|
19
36
|
"auto-enable.ts"
|
|
@@ -28,9 +45,9 @@
|
|
|
28
45
|
}
|
|
29
46
|
},
|
|
30
47
|
"scripts": {
|
|
31
|
-
"build": "node -
|
|
48
|
+
"build": "node ../../packages/scripts/rm-path-recursive.mjs dist && tsc --noCheck -p tsconfig.json",
|
|
32
49
|
"dev": "tsc --watch",
|
|
33
|
-
"typecheck": "
|
|
50
|
+
"typecheck": "tsgo --noEmit -p tsconfig.typecheck.json",
|
|
34
51
|
"test": "bun test",
|
|
35
52
|
"test:unit": "bun test __tests__/unit/",
|
|
36
53
|
"test:e2e": "node ../../packages/app-core/scripts/run-local-plugin-live-smoke.mjs",
|
|
@@ -58,12 +75,12 @@
|
|
|
58
75
|
},
|
|
59
76
|
"homepage": "https://github.com/elizaos-plugins/plugin-workflow#readme",
|
|
60
77
|
"peerDependencies": {
|
|
61
|
-
"@elizaos/core": "2.0.
|
|
78
|
+
"@elizaos/core": "2.0.3-beta.6"
|
|
62
79
|
},
|
|
63
80
|
"devDependencies": {
|
|
64
81
|
"@biomejs/biome": "^2.4.14",
|
|
65
82
|
"@electric-sql/pglite": "^0.2.17",
|
|
66
|
-
"@elizaos/core": "2.0.
|
|
83
|
+
"@elizaos/core": "2.0.3-beta.6",
|
|
67
84
|
"@types/bun": "^1.3.8",
|
|
68
85
|
"@types/node": "^25.1.0",
|
|
69
86
|
"bun-types": "^1.3.8",
|
|
@@ -80,8 +97,10 @@
|
|
|
80
97
|
"node": ">=24.0.0"
|
|
81
98
|
},
|
|
82
99
|
"dependencies": {
|
|
83
|
-
"@elizaos/workflows": "2.0.0-beta.1",
|
|
84
100
|
"drizzle-orm": "^0.45.1",
|
|
85
|
-
"
|
|
86
|
-
|
|
101
|
+
"effect": "^3.21.1",
|
|
102
|
+
"quickjs-emscripten": "0.32.0",
|
|
103
|
+
"smithers-orchestrator": "0.22.0"
|
|
104
|
+
},
|
|
105
|
+
"gitHead": "990dc996172b3e0fb525a75052a5ac28a4cd4de5"
|
|
87
106
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "workflow",
|
|
3
|
+
"name": "Workflow",
|
|
4
|
+
"description": "Natural-language workflow actions (create, activate, deactivate, delete). Workflows run in-process with the agent runtime using workflows.",
|
|
5
|
+
"npmName": "@elizaos/plugin-workflow",
|
|
6
|
+
"version": "1.2.10",
|
|
7
|
+
"source": "bundled",
|
|
8
|
+
"tags": ["workflow", "automation"],
|
|
9
|
+
"config": {},
|
|
10
|
+
"render": {
|
|
11
|
+
"visible": true,
|
|
12
|
+
"pinTo": [],
|
|
13
|
+
"style": "card",
|
|
14
|
+
"group": "feature-other",
|
|
15
|
+
"groupOrder": 12,
|
|
16
|
+
"actions": ["enable", "configure"]
|
|
17
|
+
},
|
|
18
|
+
"resources": {
|
|
19
|
+
"homepage": "https://elizaos.ai",
|
|
20
|
+
"repository": "https://github.com/elizaos/eliza"
|
|
21
|
+
},
|
|
22
|
+
"dependsOn": [],
|
|
23
|
+
"kind": "plugin",
|
|
24
|
+
"subtype": "other"
|
|
25
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EVAL_CODE — run a snippet of JavaScript in the isolated QuickJS sandbox and
|
|
3
|
+
* return its result (#8914).
|
|
4
|
+
*
|
|
5
|
+
* Reuses the same sandbox the workflow Code node uses (`evalQuickJsCode`): a
|
|
6
|
+
* throwaway QuickJS VM with a 5s deadline, a 32 MiB memory cap, and no host /
|
|
7
|
+
* network / filesystem access. Owner-gated (`minRole: OWNER`) since it executes
|
|
8
|
+
* caller-supplied code, even though that code can't escape the sandbox.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
Action,
|
|
13
|
+
ActionResult,
|
|
14
|
+
HandlerCallback,
|
|
15
|
+
HandlerOptions,
|
|
16
|
+
IAgentRuntime,
|
|
17
|
+
Memory,
|
|
18
|
+
State,
|
|
19
|
+
} from '@elizaos/core';
|
|
20
|
+
import { evalQuickJsCode } from '../services/embedded-workflow-service';
|
|
21
|
+
|
|
22
|
+
const EVAL_CODE_CONTEXTS = ['automation', 'tasks', 'agent_internal'];
|
|
23
|
+
|
|
24
|
+
interface EvalCodeParameters {
|
|
25
|
+
/** The JavaScript to run. The snippet body runs inside an IIFE, so
|
|
26
|
+
* `return <value>` yields the result. */
|
|
27
|
+
jsCode?: string;
|
|
28
|
+
code?: string;
|
|
29
|
+
/** Optional JSON exposed to the snippet as `$json` / `item.json`. */
|
|
30
|
+
inputJson?: unknown;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function previewResult(value: unknown): string {
|
|
34
|
+
try {
|
|
35
|
+
if (value === undefined) return 'undefined';
|
|
36
|
+
const json = JSON.stringify(value);
|
|
37
|
+
return typeof json === 'string' ? json : String(value);
|
|
38
|
+
} catch {
|
|
39
|
+
return String(value);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const evalCodeAction: Action = {
|
|
44
|
+
name: 'EVAL_CODE',
|
|
45
|
+
contexts: [...EVAL_CODE_CONTEXTS],
|
|
46
|
+
contextGate: { anyOf: [...EVAL_CODE_CONTEXTS] },
|
|
47
|
+
roleGate: { minRole: 'OWNER' },
|
|
48
|
+
similes: ['RUN_CODE', 'EVALUATE_CODE', 'EXEC_JS', 'RUN_JS', 'EVAL_JS'],
|
|
49
|
+
description:
|
|
50
|
+
'Run a snippet of JavaScript in an isolated QuickJS sandbox (5s deadline, ' +
|
|
51
|
+
'32MiB cap, no network/fs/host access) and return its result. Provide a ' +
|
|
52
|
+
'`jsCode` parameter; the body runs inside a function, so `return <value>` ' +
|
|
53
|
+
'produces the output. Optional `inputJson` is exposed as `$json`.',
|
|
54
|
+
validate: async () => true,
|
|
55
|
+
handler: async (
|
|
56
|
+
_runtime: IAgentRuntime,
|
|
57
|
+
_message: Memory,
|
|
58
|
+
_state?: State,
|
|
59
|
+
options?: HandlerOptions,
|
|
60
|
+
callback?: HandlerCallback
|
|
61
|
+
): Promise<ActionResult> => {
|
|
62
|
+
const params = (options?.parameters ?? {}) as EvalCodeParameters;
|
|
63
|
+
const jsCode = (params.jsCode ?? params.code ?? '').trim();
|
|
64
|
+
if (!jsCode) {
|
|
65
|
+
const text = 'EVAL_CODE requires a `jsCode` parameter (the JavaScript to run).';
|
|
66
|
+
if (callback) await callback({ text });
|
|
67
|
+
return { success: false, text };
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const result = await evalQuickJsCode(jsCode, params.inputJson);
|
|
71
|
+
const text = previewResult(result);
|
|
72
|
+
if (callback) await callback({ text });
|
|
73
|
+
return { success: true, text };
|
|
74
|
+
} catch (err) {
|
|
75
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
76
|
+
const text = `EVAL_CODE failed: ${message}`;
|
|
77
|
+
if (callback) await callback({ text });
|
|
78
|
+
return { success: false, text };
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
};
|
package/src/actions/index.ts
CHANGED