@elizaos/plugin-workflow 2.0.0-beta.1
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/README.md +71 -0
- package/auto-enable.ts +18 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +2 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/workflow.d.ts +23 -0
- package/dist/actions/workflow.d.ts.map +1 -0
- package/dist/actions/workflow.js +425 -0
- package/dist/actions/workflow.js.map +1 -0
- package/dist/data/defaultNodes.json +9887 -0
- package/dist/data/schemaIndex.json +1 -0
- package/dist/data/triggerSchemaIndex.json +1 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +2 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/schema.d.ts +588 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +59 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/automations-builder.d.ts +21 -0
- package/dist/lib/automations-builder.d.ts.map +1 -0
- package/dist/lib/automations-builder.js +557 -0
- package/dist/lib/automations-builder.js.map +1 -0
- package/dist/lib/automations-types.d.ts +153 -0
- package/dist/lib/automations-types.d.ts.map +1 -0
- package/dist/lib/automations-types.js +191 -0
- package/dist/lib/automations-types.js.map +1 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +3 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/legacy-task-migration.d.ts +20 -0
- package/dist/lib/legacy-task-migration.d.ts.map +1 -0
- package/dist/lib/legacy-task-migration.js +110 -0
- package/dist/lib/legacy-task-migration.js.map +1 -0
- package/dist/lib/legacy-text-trigger-migration.d.ts +18 -0
- package/dist/lib/legacy-text-trigger-migration.d.ts.map +1 -0
- package/dist/lib/legacy-text-trigger-migration.js +131 -0
- package/dist/lib/legacy-text-trigger-migration.js.map +1 -0
- package/dist/lib/workflow-clarification.d.ts +113 -0
- package/dist/lib/workflow-clarification.d.ts.map +1 -0
- package/dist/lib/workflow-clarification.js +425 -0
- package/dist/lib/workflow-clarification.js.map +1 -0
- package/dist/plugin-routes.d.ts +9 -0
- package/dist/plugin-routes.d.ts.map +1 -0
- package/dist/plugin-routes.js +147 -0
- package/dist/plugin-routes.js.map +1 -0
- package/dist/providers/activeWorkflows.d.ts +11 -0
- package/dist/providers/activeWorkflows.d.ts.map +1 -0
- package/dist/providers/activeWorkflows.js +72 -0
- package/dist/providers/activeWorkflows.js.map +1 -0
- package/dist/providers/index.d.ts +4 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +4 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/pendingDraft.d.ts +9 -0
- package/dist/providers/pendingDraft.d.ts.map +1 -0
- package/dist/providers/pendingDraft.js +48 -0
- package/dist/providers/pendingDraft.js.map +1 -0
- package/dist/providers/workflowStatus.d.ts +3 -0
- package/dist/providers/workflowStatus.d.ts.map +1 -0
- package/dist/providers/workflowStatus.js +69 -0
- package/dist/providers/workflowStatus.js.map +1 -0
- package/dist/register-routes.d.ts +2 -0
- package/dist/register-routes.d.ts.map +1 -0
- package/dist/register-routes.js +6 -0
- package/dist/register-routes.js.map +1 -0
- package/dist/routes/_helpers.d.ts +11 -0
- package/dist/routes/_helpers.d.ts.map +1 -0
- package/dist/routes/_helpers.js +22 -0
- package/dist/routes/_helpers.js.map +1 -0
- package/dist/routes/automations.d.ts +19 -0
- package/dist/routes/automations.d.ts.map +1 -0
- package/dist/routes/automations.js +32 -0
- package/dist/routes/automations.js.map +1 -0
- package/dist/routes/embedded-webhooks.d.ts +3 -0
- package/dist/routes/embedded-webhooks.d.ts.map +1 -0
- package/dist/routes/embedded-webhooks.js +47 -0
- package/dist/routes/embedded-webhooks.js.map +1 -0
- package/dist/routes/executions.d.ts +3 -0
- package/dist/routes/executions.d.ts.map +1 -0
- package/dist/routes/executions.js +58 -0
- package/dist/routes/executions.js.map +1 -0
- package/dist/routes/index.d.ts +4 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +14 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/nodes.d.ts +3 -0
- package/dist/routes/nodes.d.ts.map +1 -0
- package/dist/routes/nodes.js +168 -0
- package/dist/routes/nodes.js.map +1 -0
- package/dist/routes/validation.d.ts +3 -0
- package/dist/routes/validation.d.ts.map +1 -0
- package/dist/routes/validation.js +41 -0
- package/dist/routes/validation.js.map +1 -0
- package/dist/routes/workflow-routes.d.ts +27 -0
- package/dist/routes/workflow-routes.d.ts.map +1 -0
- package/dist/routes/workflow-routes.js +326 -0
- package/dist/routes/workflow-routes.js.map +1 -0
- package/dist/routes/workflows.d.ts +3 -0
- package/dist/routes/workflows.d.ts.map +1 -0
- package/dist/routes/workflows.js +252 -0
- package/dist/routes/workflows.js.map +1 -0
- package/dist/schemas/draftIntent.d.ts +22 -0
- package/dist/schemas/draftIntent.d.ts.map +1 -0
- package/dist/schemas/draftIntent.js +22 -0
- package/dist/schemas/draftIntent.js.map +1 -0
- package/dist/schemas/feasibility.d.ts +13 -0
- package/dist/schemas/feasibility.d.ts.map +1 -0
- package/dist/schemas/feasibility.js +9 -0
- package/dist/schemas/feasibility.js.map +1 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +5 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/keywordExtraction.d.ts +14 -0
- package/dist/schemas/keywordExtraction.d.ts.map +1 -0
- package/dist/schemas/keywordExtraction.js +12 -0
- package/dist/schemas/keywordExtraction.js.map +1 -0
- package/dist/schemas/workflowMatching.d.ts +36 -0
- package/dist/schemas/workflowMatching.d.ts.map +1 -0
- package/dist/schemas/workflowMatching.js +30 -0
- package/dist/schemas/workflowMatching.js.map +1 -0
- package/dist/services/embedded-workflow-service.d.ts +106 -0
- package/dist/services/embedded-workflow-service.d.ts.map +1 -0
- package/dist/services/embedded-workflow-service.js +1900 -0
- package/dist/services/embedded-workflow-service.js.map +1 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +5 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/workflow-credential-store.d.ts +27 -0
- package/dist/services/workflow-credential-store.d.ts.map +1 -0
- package/dist/services/workflow-credential-store.js +92 -0
- package/dist/services/workflow-credential-store.js.map +1 -0
- package/dist/services/workflow-dispatch.d.ts +41 -0
- package/dist/services/workflow-dispatch.d.ts.map +1 -0
- package/dist/services/workflow-dispatch.js +86 -0
- package/dist/services/workflow-dispatch.js.map +1 -0
- package/dist/services/workflow-service.d.ts +63 -0
- package/dist/services/workflow-service.d.ts.map +1 -0
- package/dist/services/workflow-service.js +492 -0
- package/dist/services/workflow-service.js.map +1 -0
- package/dist/trigger-routes.d.ts +153 -0
- package/dist/trigger-routes.d.ts.map +1 -0
- package/dist/trigger-routes.js +424 -0
- package/dist/trigger-routes.js.map +1 -0
- package/dist/types/index.d.ts +457 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +59 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/catalog.d.ts +16 -0
- package/dist/utils/catalog.d.ts.map +1 -0
- package/dist/utils/catalog.js +211 -0
- package/dist/utils/catalog.js.map +1 -0
- package/dist/utils/clarification.d.ts +17 -0
- package/dist/utils/clarification.d.ts.map +1 -0
- package/dist/utils/clarification.js +46 -0
- package/dist/utils/clarification.js.map +1 -0
- package/dist/utils/context.d.ts +4 -0
- package/dist/utils/context.d.ts.map +1 -0
- package/dist/utils/context.js +18 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/credentialResolver.d.ts +22 -0
- package/dist/utils/credentialResolver.d.ts.map +1 -0
- package/dist/utils/credentialResolver.js +146 -0
- package/dist/utils/credentialResolver.js.map +1 -0
- package/dist/utils/generation.d.ts +36 -0
- package/dist/utils/generation.d.ts.map +1 -0
- package/dist/utils/generation.js +701 -0
- package/dist/utils/generation.js.map +1 -0
- package/dist/utils/host-capabilities.d.ts +27 -0
- package/dist/utils/host-capabilities.d.ts.map +1 -0
- package/dist/utils/host-capabilities.js +59 -0
- package/dist/utils/host-capabilities.js.map +1 -0
- package/dist/utils/inferSyntheticOutputSchema.d.ts +20 -0
- package/dist/utils/inferSyntheticOutputSchema.d.ts.map +1 -0
- package/dist/utils/inferSyntheticOutputSchema.js +151 -0
- package/dist/utils/inferSyntheticOutputSchema.js.map +1 -0
- package/dist/utils/outputSchema.d.ts +26 -0
- package/dist/utils/outputSchema.d.ts.map +1 -0
- package/dist/utils/outputSchema.js +297 -0
- package/dist/utils/outputSchema.js.map +1 -0
- package/dist/utils/validateAndRepair.d.ts +41 -0
- package/dist/utils/validateAndRepair.d.ts.map +1 -0
- package/dist/utils/validateAndRepair.js +483 -0
- package/dist/utils/validateAndRepair.js.map +1 -0
- package/dist/utils/workflow-prompts/actionResponse.d.ts +2 -0
- package/dist/utils/workflow-prompts/actionResponse.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/actionResponse.js +17 -0
- package/dist/utils/workflow-prompts/actionResponse.js.map +1 -0
- package/dist/utils/workflow-prompts/draftIntent.d.ts +2 -0
- package/dist/utils/workflow-prompts/draftIntent.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/draftIntent.js +23 -0
- package/dist/utils/workflow-prompts/draftIntent.js.map +1 -0
- package/dist/utils/workflow-prompts/feasibilityCheck.d.ts +2 -0
- package/dist/utils/workflow-prompts/feasibilityCheck.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/feasibilityCheck.js +21 -0
- package/dist/utils/workflow-prompts/feasibilityCheck.js.map +1 -0
- package/dist/utils/workflow-prompts/fieldCorrection.d.ts +3 -0
- package/dist/utils/workflow-prompts/fieldCorrection.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/fieldCorrection.js +20 -0
- package/dist/utils/workflow-prompts/fieldCorrection.js.map +1 -0
- package/dist/utils/workflow-prompts/index.d.ts +8 -0
- package/dist/utils/workflow-prompts/index.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/index.js +8 -0
- package/dist/utils/workflow-prompts/index.js.map +1 -0
- package/dist/utils/workflow-prompts/keywordExtraction.d.ts +2 -0
- package/dist/utils/workflow-prompts/keywordExtraction.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/keywordExtraction.js +21 -0
- package/dist/utils/workflow-prompts/keywordExtraction.js.map +1 -0
- package/dist/utils/workflow-prompts/parameterCorrection.d.ts +3 -0
- package/dist/utils/workflow-prompts/parameterCorrection.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/parameterCorrection.js +29 -0
- package/dist/utils/workflow-prompts/parameterCorrection.js.map +1 -0
- package/dist/utils/workflow-prompts/workflowGeneration.d.ts +2 -0
- package/dist/utils/workflow-prompts/workflowGeneration.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/workflowGeneration.js +529 -0
- package/dist/utils/workflow-prompts/workflowGeneration.js.map +1 -0
- package/dist/utils/workflow-prompts/workflowMatching.d.ts +2 -0
- package/dist/utils/workflow-prompts/workflowMatching.d.ts.map +1 -0
- package/dist/utils/workflow-prompts/workflowMatching.js +23 -0
- package/dist/utils/workflow-prompts/workflowMatching.js.map +1 -0
- package/dist/utils/workflow.d.ts +62 -0
- package/dist/utils/workflow.d.ts.map +1 -0
- package/dist/utils/workflow.js +712 -0
- package/dist/utils/workflow.js.map +1 -0
- package/package.json +87 -0
- package/src/actions/index.ts +1 -0
- package/src/actions/workflow.ts +494 -0
- package/src/data/defaultNodes.json +9887 -0
- package/src/data/schemaIndex.json +1 -0
- package/src/data/triggerSchemaIndex.json +1 -0
- package/src/db/index.ts +8 -0
- package/src/db/schema.ts +94 -0
- package/src/index.ts +179 -0
- package/src/lib/automations-builder.ts +679 -0
- package/src/lib/automations-types.ts +391 -0
- package/src/lib/index.ts +8 -0
- package/src/lib/legacy-task-migration.ts +143 -0
- package/src/lib/legacy-text-trigger-migration.ts +178 -0
- package/src/lib/workflow-clarification.ts +497 -0
- package/src/plugin-routes.ts +164 -0
- package/src/providers/activeWorkflows.ts +81 -0
- package/src/providers/index.ts +3 -0
- package/src/providers/pendingDraft.ts +55 -0
- package/src/providers/workflowStatus.ts +88 -0
- package/src/register-routes.ts +6 -0
- package/src/routes/_helpers.ts +27 -0
- package/src/routes/automations.ts +46 -0
- package/src/routes/embedded-webhooks.ts +64 -0
- package/src/routes/executions.ts +75 -0
- package/src/routes/index.ts +16 -0
- package/src/routes/nodes.ts +211 -0
- package/src/routes/validation.ts +51 -0
- package/src/routes/workflow-routes.ts +469 -0
- package/src/routes/workflows.ts +310 -0
- package/src/schemas/draftIntent.ts +21 -0
- package/src/schemas/feasibility.ts +8 -0
- package/src/schemas/index.ts +4 -0
- package/src/schemas/keywordExtraction.ts +11 -0
- package/src/schemas/workflowMatching.ts +29 -0
- package/src/services/embedded-workflow-service.ts +2224 -0
- package/src/services/index.ts +17 -0
- package/src/services/workflow-credential-store.ts +132 -0
- package/src/services/workflow-dispatch.ts +121 -0
- package/src/services/workflow-service.ts +839 -0
- package/src/trigger-routes.ts +714 -0
- package/src/types/index.ts +562 -0
- package/src/utils/catalog.ts +260 -0
- package/src/utils/clarification.ts +52 -0
- package/src/utils/context.ts +22 -0
- package/src/utils/credentialResolver.ts +234 -0
- package/src/utils/generation.ts +987 -0
- package/src/utils/host-capabilities.ts +81 -0
- package/src/utils/inferSyntheticOutputSchema.ts +163 -0
- package/src/utils/outputSchema.ts +372 -0
- package/src/utils/validateAndRepair.ts +610 -0
- package/src/utils/workflow-prompts/actionResponse.ts +16 -0
- package/src/utils/workflow-prompts/draftIntent.ts +22 -0
- package/src/utils/workflow-prompts/feasibilityCheck.ts +20 -0
- package/src/utils/workflow-prompts/fieldCorrection.ts +20 -0
- package/src/utils/workflow-prompts/index.ts +10 -0
- package/src/utils/workflow-prompts/keywordExtraction.ts +20 -0
- package/src/utils/workflow-prompts/parameterCorrection.ts +29 -0
- package/src/utils/workflow-prompts/workflowGeneration.ts +528 -0
- package/src/utils/workflow-prompts/workflowMatching.ts +22 -0
- package/src/utils/workflow.ts +895 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draftIntent.js","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/draftIntent.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;yCAqBD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const FEASIBILITY_CHECK_PROMPT = "You are evaluating whether a user's workflow request can be fulfilled with a restricted set of integrations.\n\nSome integrations the user might need are NOT available on this platform. You must decide if the request is still feasible with what IS available.\n\n## Decision Rules\n\n- If a removed integration is the PRIMARY data source or destination and no functional equivalent exists among available integrations \u2192 NOT feasible\n Example: \"Send Stripe payments via Gmail\" with Stripe removed \u2192 NOT feasible (Gmail cannot provide payment data)\n\n- If a removed integration has a functional equivalent among available integrations \u2192 feasible\n Example: \"Send an email weekly\" with IMAP/SMTP removed but Gmail available \u2192 feasible (Gmail sends email)\n\n- If the removed integration is explicitly named by the user as a specific service \u2192 likely NOT feasible (user specifically wants that service)\n Example: \"Connect Jira to Slack\" with Jira removed \u2192 NOT feasible (user specifically asked for Jira)\n\n- Utility nodes (Schedule, Webhook, Code, IF, Set) are always available and don't count as replacements for service integrations\n\nRespond with structured JSON-style fields:\nfeasible: true | false\nreason: brief explanation";
|
|
2
|
+
//# sourceMappingURL=feasibilityCheck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feasibilityCheck.d.ts","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/feasibilityCheck.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,2vCAmBX,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const FEASIBILITY_CHECK_PROMPT = `You are evaluating whether a user's workflow request can be fulfilled with a restricted set of integrations.
|
|
2
|
+
|
|
3
|
+
Some integrations the user might need are NOT available on this platform. You must decide if the request is still feasible with what IS available.
|
|
4
|
+
|
|
5
|
+
## Decision Rules
|
|
6
|
+
|
|
7
|
+
- If a removed integration is the PRIMARY data source or destination and no functional equivalent exists among available integrations → NOT feasible
|
|
8
|
+
Example: "Send Stripe payments via Gmail" with Stripe removed → NOT feasible (Gmail cannot provide payment data)
|
|
9
|
+
|
|
10
|
+
- If a removed integration has a functional equivalent among available integrations → feasible
|
|
11
|
+
Example: "Send an email weekly" with IMAP/SMTP removed but Gmail available → feasible (Gmail sends email)
|
|
12
|
+
|
|
13
|
+
- If the removed integration is explicitly named by the user as a specific service → likely NOT feasible (user specifically wants that service)
|
|
14
|
+
Example: "Connect Jira to Slack" with Jira removed → NOT feasible (user specifically asked for Jira)
|
|
15
|
+
|
|
16
|
+
- Utility nodes (Schedule, Webhook, Code, IF, Set) are always available and don't count as replacements for service integrations
|
|
17
|
+
|
|
18
|
+
Respond with structured JSON-style fields:
|
|
19
|
+
feasible: true | false
|
|
20
|
+
reason: brief explanation`;
|
|
21
|
+
//# sourceMappingURL=feasibilityCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feasibilityCheck.js","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/feasibilityCheck.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;0BAmBd,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const FIELD_CORRECTION_SYSTEM_PROMPT = "Fix the workflows field reference to use a valid field path.\n\nYou will receive:\n1. A $json reference with an invalid field\n2. The available fields with their types from the source node's output schema\n\nPick the field that best matches the intent. Pay attention to types: if the expression expects text content, pick a string field, not an object or array.\n\nReturn ONLY the corrected $json reference. No explanation, no {{ }} wrapping.\n\nExample:\n- Expression: $json.sender\n- Available: from.value[0].address (string), from.value[0].name (string), subject (string), id (string)\n- Output: $json.from.value[0].address";
|
|
2
|
+
export declare const FIELD_CORRECTION_USER_PROMPT = "Expression: {expression}\nAvailable fields:\n{availableFields}\n\nReturn the corrected expression:";
|
|
3
|
+
//# sourceMappingURL=fieldCorrection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldCorrection.d.ts","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/fieldCorrection.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,unBAaL,CAAC;AAEvC,eAAO,MAAM,4BAA4B,uGAIR,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const FIELD_CORRECTION_SYSTEM_PROMPT = `Fix the workflows field reference to use a valid field path.
|
|
2
|
+
|
|
3
|
+
You will receive:
|
|
4
|
+
1. A $json reference with an invalid field
|
|
5
|
+
2. The available fields with their types from the source node's output schema
|
|
6
|
+
|
|
7
|
+
Pick the field that best matches the intent. Pay attention to types: if the expression expects text content, pick a string field, not an object or array.
|
|
8
|
+
|
|
9
|
+
Return ONLY the corrected $json reference. No explanation, no {{ }} wrapping.
|
|
10
|
+
|
|
11
|
+
Example:
|
|
12
|
+
- Expression: $json.sender
|
|
13
|
+
- Available: from.value[0].address (string), from.value[0].name (string), subject (string), id (string)
|
|
14
|
+
- Output: $json.from.value[0].address`;
|
|
15
|
+
export const FIELD_CORRECTION_USER_PROMPT = `Expression: {expression}
|
|
16
|
+
Available fields:
|
|
17
|
+
{availableFields}
|
|
18
|
+
|
|
19
|
+
Return the corrected expression:`;
|
|
20
|
+
//# sourceMappingURL=fieldCorrection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldCorrection.js","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/fieldCorrection.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;sCAaR,CAAC;AAEvC,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;iCAIX,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ACTION_RESPONSE_SYSTEM_PROMPT } from './actionResponse';
|
|
2
|
+
export { DRAFT_INTENT_SYSTEM_PROMPT } from './draftIntent';
|
|
3
|
+
export { FEASIBILITY_CHECK_PROMPT } from './feasibilityCheck';
|
|
4
|
+
export { FIELD_CORRECTION_SYSTEM_PROMPT, FIELD_CORRECTION_USER_PROMPT } from './fieldCorrection';
|
|
5
|
+
export { KEYWORD_EXTRACTION_SYSTEM_PROMPT } from './keywordExtraction';
|
|
6
|
+
export { PARAM_CORRECTION_SYSTEM_PROMPT, PARAM_CORRECTION_USER_PROMPT, } from './parameterCorrection';
|
|
7
|
+
export { WORKFLOW_GENERATION_SYSTEM_PROMPT } from './workflowGeneration';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ACTION_RESPONSE_SYSTEM_PROMPT } from './actionResponse';
|
|
2
|
+
export { DRAFT_INTENT_SYSTEM_PROMPT } from './draftIntent';
|
|
3
|
+
export { FEASIBILITY_CHECK_PROMPT } from './feasibilityCheck';
|
|
4
|
+
export { FIELD_CORRECTION_SYSTEM_PROMPT, FIELD_CORRECTION_USER_PROMPT } from './fieldCorrection';
|
|
5
|
+
export { KEYWORD_EXTRACTION_SYSTEM_PROMPT } from './keywordExtraction';
|
|
6
|
+
export { PARAM_CORRECTION_SYSTEM_PROMPT, PARAM_CORRECTION_USER_PROMPT, } from './parameterCorrection';
|
|
7
|
+
export { WORKFLOW_GENERATION_SYSTEM_PROMPT } from './workflowGeneration';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,8BAA8B,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,gCAAgC,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iCAAiC,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const KEYWORD_EXTRACTION_SYSTEM_PROMPT = "You are an expert at extracting relevant search terms for finding workflows nodes.\n\nGiven a user prompt describing an workflow, extract up to 5 concise keywords or phrases that best represent the core actions, services, or data transformations involved.\n\nFocus on terms likely to match workflows node names or functionalities. Avoid generic words.\n\nExamples:\n- request: Send me Stripe payment summaries via Gmail every Monday\n keywords: stripe, gmail, send, email, schedule\n- request: Post RSS feed updates to Slack channel\n keywords: rss, slack, post, feed, webhook\n- request: Summarize weekly GitHub issues and send to Notion\n keywords: github, issues, notion, summarize\n- request: Fetch weather data hourly and store in Google Sheets\n keywords: weather, http, schedule, google sheets, store\n- request: When new Stripe payment, create invoice in QuickBooks\n keywords: stripe, webhook, quickbooks, invoice, payment\n\nRespond with structured JSON-style fields:\nkeywords: 1-5 relevant search terms";
|
|
2
|
+
//# sourceMappingURL=keywordExtraction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keywordExtraction.d.ts","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/keywordExtraction.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,ggCAmBT,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const KEYWORD_EXTRACTION_SYSTEM_PROMPT = `You are an expert at extracting relevant search terms for finding workflows nodes.
|
|
2
|
+
|
|
3
|
+
Given a user prompt describing an workflow, extract up to 5 concise keywords or phrases that best represent the core actions, services, or data transformations involved.
|
|
4
|
+
|
|
5
|
+
Focus on terms likely to match workflows node names or functionalities. Avoid generic words.
|
|
6
|
+
|
|
7
|
+
Examples:
|
|
8
|
+
- request: Send me Stripe payment summaries via Gmail every Monday
|
|
9
|
+
keywords: stripe, gmail, send, email, schedule
|
|
10
|
+
- request: Post RSS feed updates to Slack channel
|
|
11
|
+
keywords: rss, slack, post, feed, webhook
|
|
12
|
+
- request: Summarize weekly GitHub issues and send to Notion
|
|
13
|
+
keywords: github, issues, notion, summarize
|
|
14
|
+
- request: Fetch weather data hourly and store in Google Sheets
|
|
15
|
+
keywords: weather, http, schedule, google sheets, store
|
|
16
|
+
- request: When new Stripe payment, create invoice in QuickBooks
|
|
17
|
+
keywords: stripe, webhook, quickbooks, invoice, payment
|
|
18
|
+
|
|
19
|
+
Respond with structured JSON-style fields:
|
|
20
|
+
keywords: 1-5 relevant search terms`;
|
|
21
|
+
//# sourceMappingURL=keywordExtraction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keywordExtraction.js","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/keywordExtraction.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;;;;;;;;;;;;;;oCAmBZ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const PARAM_CORRECTION_SYSTEM_PROMPT = "Fix workflows node parameters to match the node's property definition.\n\nYou receive:\n1. The node type and its current parameters (generated by another LLM \u2014 may use wrong names or structure)\n2. The node's valid property definitions from the catalog\n\nYour job: map the current parameter VALUES to the correct parameter NAMES and STRUCTURE from the definition.\n\nRules:\n- Use ONLY parameter names that exist in the property definitions\n- Preserve the user's intent and values\n- For \"fixedCollection\" type properties, values MUST be nested inside a \"values\" array of objects (see example below)\n- Keep \"resource\" and \"operation\" values unchanged (already validated)\n- If a parameter has no plausible match in the definitions, drop it\n- Return ONLY a valid JSON object \u2014 no explanation, no markdown fences\n\nExample \u2014 fixedCollection correction:\nWRONG: { \"prompt\": \"Say hello\" }\nIf the definition has a fixedCollection property \"responses\" with sub-property \"content\":\nRIGHT: { \"responses\": { \"values\": [{ \"content\": \"Say hello\" }] } }";
|
|
2
|
+
export declare const PARAM_CORRECTION_USER_PROMPT = "Node: {nodeType}\nCurrent parameters:\n{currentParams}\n\nProperty definitions:\n{propertyDefs}\n\nReturn corrected parameters JSON:";
|
|
3
|
+
//# sourceMappingURL=parameterCorrection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameterCorrection.d.ts","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/parameterCorrection.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,okCAmBwB,CAAC;AAEpE,eAAO,MAAM,4BAA4B,yIAOP,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const PARAM_CORRECTION_SYSTEM_PROMPT = `Fix workflows node parameters to match the node's property definition.
|
|
2
|
+
|
|
3
|
+
You receive:
|
|
4
|
+
1. The node type and its current parameters (generated by another LLM — may use wrong names or structure)
|
|
5
|
+
2. The node's valid property definitions from the catalog
|
|
6
|
+
|
|
7
|
+
Your job: map the current parameter VALUES to the correct parameter NAMES and STRUCTURE from the definition.
|
|
8
|
+
|
|
9
|
+
Rules:
|
|
10
|
+
- Use ONLY parameter names that exist in the property definitions
|
|
11
|
+
- Preserve the user's intent and values
|
|
12
|
+
- For "fixedCollection" type properties, values MUST be nested inside a "values" array of objects (see example below)
|
|
13
|
+
- Keep "resource" and "operation" values unchanged (already validated)
|
|
14
|
+
- If a parameter has no plausible match in the definitions, drop it
|
|
15
|
+
- Return ONLY a valid JSON object — no explanation, no markdown fences
|
|
16
|
+
|
|
17
|
+
Example — fixedCollection correction:
|
|
18
|
+
WRONG: { "prompt": "Say hello" }
|
|
19
|
+
If the definition has a fixedCollection property "responses" with sub-property "content":
|
|
20
|
+
RIGHT: { "responses": { "values": [{ "content": "Say hello" }] } }`;
|
|
21
|
+
export const PARAM_CORRECTION_USER_PROMPT = `Node: {nodeType}
|
|
22
|
+
Current parameters:
|
|
23
|
+
{currentParams}
|
|
24
|
+
|
|
25
|
+
Property definitions:
|
|
26
|
+
{propertyDefs}
|
|
27
|
+
|
|
28
|
+
Return corrected parameters JSON:`;
|
|
29
|
+
//# sourceMappingURL=parameterCorrection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameterCorrection.js","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/parameterCorrection.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;mEAmBqB,CAAC;AAEpE,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;kCAOV,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const WORKFLOW_GENERATION_SYSTEM_PROMPT = "## Workflow AI Definition: Core Concepts\n\n### 1. **Workflow**\n\nA workflow is a collection of nodes and the connections between them.\n\n```json\n{\n \"id\": \"uuid\",\n \"name\": \"string\",\n \"active\": true,\n \"nodes\": [/* array of Node objects */],\n \"connections\": {/* see below */},\n \"settings\": {/* workflow-specific settings, optional */},\n \"staticData\": {/* optional */},\n \"pinData\": {/* optional */}\n}\n```\n\n---\n\n### 2. **Node**\n\nA node is a single step in a workflow. Each node has:\n\n| Field | Type | Description |\n|:--------------|:----------|:----------------------------------|\n| id | string | Unique node identifier |\n| name | string | Node name (unique in workflow) |\n| type | string | Node type (e.g. `httpRequest`) |\n| typeVersion | number | Node type version |\n| position | [number, number] | Canvas position |\n| parameters | object | Node parameters (see below) |\n| credentials | object | Credential references (optional) |\n| disabled | boolean | If node is disabled (optional) |\n\n---\n\n### 3. **Connections**\n\nConnections define how nodes are linked.\n\n```json\n{\n \"NodeA\": {\n \"main\": [\n [ { \"node\": \"NodeB\", \"type\": \"main\", \"index\": 0 } ]\n ]\n }\n}\n```\n- Key: source node name\n- Each connection has a `type` (commonly `\"main\"`)\n- Each connection points to a destination node, with an index\n\n---\n\n### 4. **Node Parameters**\n\nEach node has parameters, which are defined in its node type description. Parameters can be:\n\n- Simple values (string, number, boolean)\n- Complex objects (collections, fixedCollections, etc.)\n- Resource locators (for referencing external resources)\n- Options (select from a list)\n\n**Parameter properties:**\n| Field | Type | Description |\n|:--------------|:----------|:----------------------------------|\n| displayName | string | Label shown in UI |\n| name | string | Internal parameter name |\n| type | string | Parameter type (`string`, `number`, `options`, etc.) |\n| default | any | Default value |\n| description | string | Help text (optional) |\n| required | boolean | Is required? (optional) |\n| options | array | For `options` type: choices |\n| displayOptions| object | Show/hide logic (optional) |\n\n---\n\n### 5. **Node Type Description**\n\nEach node type (e.g. HTTP Request, Slack, Google Sheets) defines:\n\n| Field | Type | Description |\n|:--------------|:----------|:----------------------------------|\n| name | string | Node type name |\n| displayName | string | Human-readable name |\n| group | array | Node group(s): e.g. input, output, trigger |\n| description | string | Node description |\n| version | number | Node version |\n| inputs | array | Allowed input connection types |\n| outputs | array | Allowed output connection types |\n| properties | array | Parameter definitions |\n| credentials | array | Credential requirements |\n| documentationUrl | string | Docs link (optional) |\n\n---\n\n### 6. **Credentials \u2014 MANDATORY INVARIANT**\n\nEVERY node whose definition has a non-empty `credentials` array MUST include a matching `credentials` block in the emitted node JSON. **This is a hard rule.** A workflow that omits the credentials block for a credentialed node is an invalid output.\n\n**IMPORTANT:** Always use native workflows nodes (e.g. `workflows-nodes-base.gmail`, `workflows-nodes-base.slack`) rather than generic HTTP Request nodes.\n\n**Exact shape \u2014 copy verbatim, do not omit, do not improvise:**\n\n```json\n{\n \"name\": \"Send Gmail\",\n \"type\": \"workflows-nodes-base.gmail\",\n \"credentials\": {\n \"<credentialTypeName>\": {\n \"id\": \"{{CREDENTIAL_ID}}\",\n \"name\": \"<Friendly Name>\"\n }\n }\n}\n```\n\nThe host injects the real `id` after generation; you write the literal string `\"{{CREDENTIAL_ID}}\"`.\n\nPick `<credentialTypeName>` from the node definition's `credentials[].name` field. Common names: `gmailOAuth2`, `slackOAuth2Api`, `discordApi`, `discordBotApi`, `telegramApi`, `googleSheetsOAuth2Api`, `googleCalendarOAuth2Api`. **Never invent type names** \u2014 always use the value from the node definition. When the host publishes a `## Available Credentials` section below, prefer those names.\n\nPick `<Friendly Name>` to match what the user would see in workflows's UI: \"Gmail Account\", \"Slack Workspace\", \"Discord Bot\", \"Telegram Bot\", etc.\n\n**Self-check before emitting:** for every node whose `credentials` array is non-empty in its definition, verify the emitted node has the `credentials` block. Missing this on a Gmail / Slack / Discord / Telegram node makes the workflow non-runnable.\n\n---\n\n### 6a. **`typeVersion` selection \u2014 MANDATORY INVARIANT**\n\nEach node definition includes `version: number[]` listing the EXACT versions workflows knows about (e.g. `[1, 2, 2.1]` for Gmail). You MUST pick `typeVersion` from this array \u2014 pick the highest available value.\n\n**Hard rule:** never invent versions not in the array. If the array is `[1, 2, 2.1]`, do NOT emit `2.2`, `2.3`, or `3`. workflows's runtime cannot find a node implementation for a version you invent and the workflow crashes at activation with `Cannot read properties of undefined (reading 'execute')`.\n\nIf a node definition lists `version: [2]` only, emit `typeVersion: 2`. If it lists `version: [1, 2, 2.1]`, emit `typeVersion: 2.1` (the highest).\n\n---\n\n### 6b. **`parameters.authentication` \u2194 credentials coupling \u2014 MANDATORY INVARIANT**\n\nSome nodes (Gmail, Discord, etc.) gate which credential type applies based on `parameters.authentication`. Each such node's definition includes a `credentialAuthMatrix` mapping credType to the required authentication value, e.g.:\n\n```json\n\"credentialAuthMatrix\": {\n \"gmailOAuth2\": \"oAuth2\",\n \"googleApi\": \"serviceAccount\"\n}\n```\n\n**Hard rule:** when you attach a `credentials` block of type X, set `parameters.authentication` to the matching value from `credentialAuthMatrix`. Mismatched (or missing) `authentication` values mean workflows cannot bind the credential at activation time and the workflow crashes the same way as a missing typeVersion.\n\nExample \u2014 attaching `gmailOAuth2` credentials to a Gmail node:\n\n```json\n{\n \"name\": \"Get Gmail Messages\",\n \"type\": \"workflows-nodes-base.gmail\",\n \"typeVersion\": 2.1,\n \"parameters\": {\n \"authentication\": \"oAuth2\",\n \"resource\": \"message\",\n \"operation\": \"getAll\"\n },\n \"credentials\": {\n \"gmailOAuth2\": { \"id\": \"{{CREDENTIAL_ID}}\", \"name\": \"Gmail Account\" }\n }\n}\n```\n\nIf a node has no `credentialAuthMatrix` field, no `authentication` parameter is required.\n\n---\n\n### 6c. **Resource and operation selection \u2014 match the user's verb to the operation, not just the node**\n\nEach service node groups its capabilities under `(resource, operation)` pairs. The user's verb is the strongest signal for the operation:\n\n| Verb in the user's prompt | Operation |\n|:--|:--|\n| \"send\", \"post\", \"deliver\" | `send` or `post` (NOT `create`) |\n| \"create\", \"make\", \"set up\", \"add\" (when the object is a *container* like a channel, server, list) | `create` |\n| \"list\", \"get all\", \"fetch all\" | `getAll` |\n| \"get\", \"fetch\" (singular), \"look up\" | `get` |\n| \"delete\", \"remove\" | `delete` |\n| \"update\", \"edit\", \"change\" | `update` |\n\nThe **resource** is the *object* of the verb. \"Send a meow message\" \u2192 `resource: \"message\"`, `operation: \"send\"`. NOT `resource: \"channel\"`. Picking the wrong resource means picking from a wrong operation set entirely; verify resource first, then operation.\n\nWhen the node definition lists multiple resources, pick the one whose name is the noun the user mentioned. Use `channel` only when the user wants to create / edit / delete the channel itself, not when they want to send a message *to* a channel. Use `server` / `guild` only when the user is acting on the workspace itself.\n\n**Self-check before emitting:** read your chosen `(resource, operation)` pair back as English: does it describe what the user asked for? \"Discord channel:create\" reads as *\"create a Discord channel\"* \u2014 only correct if the user actually wants a new channel. For *\"send a message to Discord\"*, the correct read-back is \"Discord message:send\".\n\n---\n\n### 6d. **Self-monitoring workflows is a Schedule + execution-history loop, NEVER errorTrigger**\n\nWhen the user wants to monitor their own workflows, accounts, or activity \u2014 phrasings like *\"review my activity\"*, *\"check stuck or errored\"*, *\"ping me when X is broken\"*, *\"alert me if my workflows fail\"*, *\"audit recent executions\"* \u2014 the canonical primitive is:\n\n```\nSchedule Trigger (every N minutes)\n \u2193\nExecution-history node (Execution: getAll, filters: status=error)\n \u2193\nIF / Filter (e.g. only those with no output, or running > 30 min)\n \u2193\nNotification node (Discord / Slack / Gmail / Telegram)\n```\n\n**Hard rules \u2014 `errorTrigger` is never the right answer for self-monitoring:**\n\n- `workflows-nodes-base.errorTrigger` is a *callback*, not a *poller*. It only fires when another workflow that has registered THIS workflow as its error workflow throws. It cannot inspect its own workflow's history, cannot detect *stuck* runs (those produce no error event), and produces a dead workflow if no other workflow is wired to call it. Even the phrase *\"monitor errors\"* maps to **Schedule + execution-history**, not errorTrigger.\n- A workflow whose only trigger is `errorTrigger` and whose intent is \"review my activity / check for errors\" is a **certain-broken output**. Refuse to emit it. Use `scheduleTrigger` as the trigger instead.\n\n**Hard rules \u2014 generic external scanners are also wrong:**\n\n- `workflows-nodes-base.urlScanIoApi` is a *URL-safety service*. It has nothing to do with workflow execution history. Never include it in a self-monitoring workflow.\n- Any node whose displayName / description hits \"scan\" / \"check\" / \"monitor\" but whose category is *not* in {`trigger`, `transform`} or whose target service is not the workflow runtime itself \u2014 skip it.\n\n---\n\n### 7. **Workflow Settings (optional)**\n\nWorkflow-level settings, e.g. timezone, error workflow, execution options.\n\n---\n\n## **Prompt Example for AI**\n\n> You are an workflow generator. Given a user's intent, generate a workflow as a JSON object.\n> Use the following structure:\n> - `nodes`: List of nodes, each with `id`, `name`, `type`, `typeVersion`, `position`, `parameters`, and optional `credentials`.\n> - `connections`: Object mapping node names to their output connections.\n> - `settings`: Optional workflow settings.\n\n> Reference [workflows node type documentation](https://docs.workflows.io/integrations/builtin/app-nodes/) for available node types and their parameters.\n\n**CRITICAL: You MUST only use node types from the \"Relevant Nodes Available\" list provided below.**\nDo not invent, guess, or use node types that are not in the provided list.\nIf a service the user mentioned is not in the available nodes, do NOT include it.\nUse `_meta.assumptions` to document when you used an alternative integration.\n\n**When creating nodes:**\n- **CRITICAL: Use EXACTLY the parameter names from each node's \"properties\" definitions.** Do NOT guess or use names from your training data. If the definition says `modelId`, use `modelId` \u2014 not `model`. If it says `responses`, use `responses` \u2014 not `prompt`. The exact `name` field in each property definition is what goes into `parameters`.\n- For `fixedCollection` type properties, values MUST be nested inside a `\"values\"` array of objects. Example: `\"responses\": { \"values\": [{ \"content\": \"...\" }] }`\n- For `options` type parameters, pick the most common or user-specified value from the property's `options` array.\n- Use unique names for each node.\n- Connect nodes using the `connections` object, with `\"main\"` as the default connection type.\n- For nodes requiring authentication, include the `credentials` field with the appropriate credential type.\n- Use native workflows nodes (workflows-nodes-base.*) instead of generic HTTP Request nodes.\n\n---\n\n## **Minimal Example Workflow**\n\n```json\n{\n \"nodes\": [\n {\n \"id\": \"uuid-1\",\n \"name\": \"Start\",\n \"type\": \"workflows-nodes-base.start\",\n \"typeVersion\": 1,\n \"position\": [0,0],\n \"parameters\": {}\n },\n {\n \"id\": \"uuid-2\",\n \"name\": \"Send Email\",\n \"type\": \"workflows-nodes-base.emailSend\",\n \"typeVersion\": 1,\n \"position\": [200,0],\n \"parameters\": {\n \"to\": \"user@example.com\",\n \"subject\": \"Hello\",\n \"text\": \"This is a test\"\n }\n }\n ],\n \"connections\": {\n \"Start\": { \"main\": [ [ { \"node\": \"Send Email\", \"type\": \"main\", \"index\": 0 } ] ] }\n }\n}\n```\n\n---\n\n## **Example with Credentials**\n\n```json\n{\n \"nodes\": [\n {\n \"id\": \"uuid-1\",\n \"name\": \"Schedule Trigger\",\n \"type\": \"workflows-nodes-base.scheduleTrigger\",\n \"typeVersion\": 1,\n \"position\": [0,0],\n \"parameters\": {\n \"rule\": {\n \"interval\": [\n {\n \"field\": \"hours\",\n \"hoursInterval\": 24\n }\n ]\n }\n }\n },\n {\n \"id\": \"uuid-2\",\n \"name\": \"Get Gmail Messages\",\n \"type\": \"workflows-nodes-base.gmail\",\n \"typeVersion\": 2,\n \"position\": [200,0],\n \"parameters\": {\n \"operation\": \"getAll\",\n \"returnAll\": false,\n \"limit\": 10\n },\n \"credentials\": {\n \"gmailOAuth2\": {\n \"id\": \"{{CREDENTIAL_ID}}\",\n \"name\": \"Gmail Account\"\n }\n }\n },\n {\n \"id\": \"uuid-3\",\n \"name\": \"Post to Slack\",\n \"type\": \"workflows-nodes-base.slack\",\n \"typeVersion\": 2,\n \"position\": [400,0],\n \"parameters\": {\n \"channel\": \"#notifications\",\n \"text\": \"Daily email summary: {{ $json.subject }}\"\n },\n \"credentials\": {\n \"slackOAuth2Api\": {\n \"id\": \"{{CREDENTIAL_ID}}\",\n \"name\": \"Slack Account\"\n }\n }\n }\n ],\n \"connections\": {\n \"Schedule Trigger\": { \"main\": [ [ { \"node\": \"Get Gmail Messages\", \"type\": \"main\", \"index\": 0 } ] ] },\n \"Get Gmail Messages\": { \"main\": [ [ { \"node\": \"Post to Slack\", \"type\": \"main\", \"index\": 0 } ] ] }\n }\n}\n```\n\n---\n\n## **Summary Table: Key Workflow Concepts**\n\n| Concept | Description/Key Fields |\n|:----------------|:----------------------------------------------------------|\n| Workflow | id, name, active, nodes, connections, settings |\n| Node | id, name, type, typeVersion, position, parameters, credentials, disabled |\n| Connections | Map of node names to output connection arrays |\n| Node Parameters | name, displayName, type, default, options, required, description |\n| Node Type | name, displayName, group, description, version, inputs, outputs, properties, credentials |\n| Credentials | Referenced in node, injected automatically by ID |\n| Settings | Workflow-level options |\n\n---\n\n**Use only these fields and structures for AI workflow generation.**\nFor parameter validation and types, rely on the node's type definition and basic TypeScript types.\n\n## **Workflow Naming**\n\nThe `name` field must be a short, descriptive label (3-6 words max) that summarizes what the workflow does.\n\n**Good names:**\n- \"Gmail R\u00E9sum\u00E9 vers Proton\"\n- \"Daily Stripe Summary via Gmail\"\n- \"New GitHub Issue \u2192 Slack Alert\"\n- \"Weekly Sales Report\"\n\n**Bad names (never do this):**\n- \"Workflow - Tu peux creer un workflow qui trigger a chaque fois que je recois un mail\" (user prompt as name)\n- \"My Workflow\" (too vague)\n- \"Automation\" (meaningless)\n\n---\n\n## **Runtime Facts \u2014 substitute, do not placeholder**\n\nThe host provides real values for the user's connectors in the optional `## Runtime Facts` block below. Use those values verbatim. NEVER emit a placeholder for a value the runtime has provided. Specifically, you must NOT emit:\n\n- `\"={{YOUR_SERVER_ID}}\"`, `\"={{YOUR_GUILD_ID}}\"`, `\"={{YOUR_CHANNEL_ID}}\"`, or any `\"={{YOUR_\u2026}}\"` template for an ID\n- `\"<your-email-here>\"`, `\"<channel-name>\"`, or any `<\u2026>`-bracketed pseudo-value for a fact the runtime has provided\n- `\"PLACEHOLDER\"`, `\"REPLACE_ME\"`, `\"FILL_ME_IN\"`, or similar literal placeholder strings\n\nWhen the runtime gives you a Discord guild id or channel id, write it verbatim as a JSON string of digits \u2014 e.g. `\"123456789012345678\"` \u2014 NOT as an unquoted number. Discord snowflake ids exceed JavaScript's safe-integer range (~17\u201320 digits), and workflows's Discord node expects them as JSON strings. `\"#general\"` is NOT a valid `channelId`. When the runtime gives you the user's Gmail email, write the email.\n\n**Display-name \u2192 id resolution is mandatory when a fact line covers it.** When the user names a server, channel, chat, or contact by display name (e.g. *Cozy Devs*, *#general*, *#alerts*), search the `## Runtime Facts` block for a matching entry and use the id from that fact line verbatim. Compare names case-insensitively and ignore a leading `#` on channel names. Never emit a placeholder, a guessed id, or the display name itself as the parameter value when a fact line resolves it. If the user said *\"Cozy Devs\"* and a fact reads `Discord guild \"Cozy Devs\" (id 1234567890) channels: #general (id 9876543210), \u2026`, then `guildId` is `\"1234567890\"` and `channelId` for *#general* is `\"9876543210\"` \u2014 no exceptions.\n\nIf a fact is genuinely missing AND the runtime did not provide it, do NOT guess. Emit a structured `ClarificationRequest` in `_meta.requiresClarification` (see \"Handling Incomplete or Ambiguous Prompts\" below) and stop populating the dependent node parameter rather than emitting a placeholder.\n\n---\n\n## **Node Output Field Names \u2014 exact match only**\n\nWhen you write `{{ $json.someField }}` or `{{ $node[\"X\"].json.someField }}`, `someField` MUST be one of:\n\n (a) a field listed in the optional `## Node Output Schemas` section for that node, OR\n (b) a field you yourself created earlier in the same workflow (in a Set / Code / Function node's `parameters`).\n\nIf neither applies, you MUST NOT invent a field name from training data. Pick the closest documented field, OR pass the entire `$json` object, OR add an explicit `Set` node upstream that creates the field.\n\n**Common Gmail mistake:** writing `{{ $json.subject }}` \u2014 Gmail's `getAll` operation returns `snippet` (top-level) and `payload.headers` (an array of `{name, value}` entries; extract Subject by filtering `name == 'Subject'`). Use the schema, not your guess.\n\n**Reference your own intermediate nodes precisely.** If a Code or Function node emits a field named `concatenated_snippet`, downstream nodes must reference exactly `concatenated_snippet` \u2014 not `concatenate_snippet`, not `concatenatedSnippet`. Typos are not auto-corrected; copy the field name verbatim from the upstream node.\n\n---\n\n## **Handling Incomplete or Ambiguous Prompts**\n\nThe workflow will be shown to the user as a preview before deployment. Use the `_meta` field to communicate assumptions, suggestions, and clarification needs.\n\nWhen the user prompt lacks specific details:\n\n1. **Make reasonable assumptions** based on common use cases\n2. **Use sensible defaults**:\n - Email service: Prefer Gmail over generic SMTP\n - Schedule: Default to daily at 9 AM if frequency not specified\n - Data format: Use JSON for structured data\n\n3. **Always include a `_meta` field** documenting your reasoning:\n\n```json\n{\n \"name\": \"Workflow Name\",\n \"nodes\": [...],\n \"connections\": {...},\n \"_meta\": {\n \"assumptions\": [\n \"Using Gmail as email service (not specified)\",\n \"Running daily at 9 AM (frequency not specified)\"\n ],\n \"suggestions\": [\n \"Consider adding error notification to Slack\",\n \"You may want to filter payments by status\"\n ],\n \"requiresClarification\": []\n }\n}\n```\n\n4. **Use `requiresClarification` aggressively** when:\n - The request is so vague that you cannot determine which services to use (e.g. \"automate something\", \"help me with work\")\n - Critical parameters are missing AND cannot be reasonably inferred (e.g. \"send data\" \u2014 send where? what data?)\n - Multiple fundamentally different interpretations exist (e.g. \"connect my CRM\" \u2014 which CRM? what operation?)\n - The request names a service but gives no indication of what action to perform on it\n - The user references a target (server, channel, chat, contact) by name OR generically (*\"Discord\"*, *\"my channel\"*) and `## Runtime Facts` does NOT contain a matching entry\n\n5. **Do NOT use `requiresClarification`** for:\n - Minor details that have sensible defaults (schedule frequency, email subject, timezone)\n - Preferences that can be changed later (formatting, specific field mappings)\n - Things you can reasonably infer from context\n - Targets you can resolve directly from `## Runtime Facts` \u2014 those MUST be filled in, not asked about\n\n6. **Structured ClarificationRequest format (preferred when a specific node parameter is unresolved).** Each item in `requiresClarification` may be a free-text string OR an object of the form:\n\n```json\n{\n \"kind\": \"target_channel\" | \"target_server\" | \"recipient\" | \"value\" | \"free_text\",\n \"platform\": \"discord\" | \"slack\" | \"telegram\" | \"gmail\" | \"...\",\n \"scope\": { \"guildId\": \"<numeric id>\" },\n \"question\": \"Short user-facing question.\",\n \"paramPath\": \"nodes[\"Discord Send\"].parameters.channelId\"\n}\n```\n\n - Use `kind: \"target_server\"` when the platform is known but the server/guild/workspace is not.\n - Use `kind: \"target_channel\"` when the server is known (set `scope.guildId` to the resolved guild id) but the specific channel is ambiguous or missing.\n - Use `kind: \"recipient\"` for an unresolved DM target / email address.\n - Use `kind: \"value\"` for any other unresolved scalar parameter.\n - Use `kind: \"free_text\"` (or a plain string) when no specific node parameter maps to the missing information.\n - `paramPath` MUST point at the exact JSON path inside the workflow draft where the user's choice should land. Use bracketed string syntax for keys with spaces or quotes (`nodes[\"Discord Send\"].parameters.channelId`). Stop populating that parameter \u2014 leave it absent \u2014 so the host can patch it after the user picks.\n - Always include a `question` short enough to fit above a row of buttons (\u2264 60 chars when possible).\n\n**Examples:**\n\nPrompt: \"Send me Stripe payment summaries via Gmail every Monday\"\n\u2192 Clear enough. Generate workflow. `requiresClarification: []`. Document email address assumption in `assumptions`.\n\nPrompt: \"automate my business\"\n\u2192 Too vague. Generate a minimal best-guess workflow and set `requiresClarification: [\"What specific task or process would you like to automate?\", \"Which services or tools are involved?\"]`.\n\nPrompt: \"connect Slack and Gmail\"\n\u2192 Ambiguous action. `requiresClarification: [\"What should happen between Slack and Gmail? For example: forward emails to Slack, post Slack messages via email, etc.\"]`. Still generate a best-guess workflow.\n\nPrompt: \"post a daily reminder to Cozy Devs\" (Runtime Facts has Cozy Devs guild with channels #general, #alerts)\n\u2192 Server resolves to the Cozy Devs guild id, but channel is ambiguous. Use `guildId` from facts; leave `channelId` unset and emit:\n\n```json\n{\n \"kind\": \"target_channel\",\n \"platform\": \"discord\",\n \"scope\": { \"guildId\": \"1234567890\" },\n \"question\": \"Which channel in Cozy Devs?\",\n \"paramPath\": \"nodes[\"Discord Send\"].parameters.channelId\"\n}\n```\n\nPrompt: \"send me a daily reminder on Discord\" (Runtime Facts lists user's Discord guilds)\n\u2192 No specific server named. Emit a server-picker clarification first:\n\n```json\n{\n \"kind\": \"target_server\",\n \"platform\": \"discord\",\n \"question\": \"Which Discord server should I post to?\",\n \"paramPath\": \"nodes[\"Discord Send\"].parameters.guildId\"\n}\n```\n\n Then a chained channel-picker clarification with `scope.guildId` and `paramPath` for `channelId`. Do not invent ids; the host will patch both after the user picks.\n\n---\n\n**IMPORTANT**: Always generate a complete, valid workflow even if assumptions are made. Never leave placeholders or incomplete nodes. The `requiresClarification` questions will be shown to the user alongside the preview \u2014 they can then refine their request.\n";
|
|
2
|
+
//# sourceMappingURL=workflowGeneration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflowGeneration.d.ts","sourceRoot":"","sources":["../../../src/utils/workflow-prompts/workflowGeneration.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iCAAiC,ywyBA+gB7C,CAAC"}
|