@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.
Files changed (294) hide show
  1. package/README.md +71 -0
  2. package/auto-enable.ts +18 -0
  3. package/dist/actions/index.d.ts +2 -0
  4. package/dist/actions/index.d.ts.map +1 -0
  5. package/dist/actions/index.js +2 -0
  6. package/dist/actions/index.js.map +1 -0
  7. package/dist/actions/workflow.d.ts +23 -0
  8. package/dist/actions/workflow.d.ts.map +1 -0
  9. package/dist/actions/workflow.js +425 -0
  10. package/dist/actions/workflow.js.map +1 -0
  11. package/dist/data/defaultNodes.json +9887 -0
  12. package/dist/data/schemaIndex.json +1 -0
  13. package/dist/data/triggerSchemaIndex.json +1 -0
  14. package/dist/db/index.d.ts +2 -0
  15. package/dist/db/index.d.ts.map +1 -0
  16. package/dist/db/index.js +2 -0
  17. package/dist/db/index.js.map +1 -0
  18. package/dist/db/schema.d.ts +588 -0
  19. package/dist/db/schema.d.ts.map +1 -0
  20. package/dist/db/schema.js +59 -0
  21. package/dist/db/schema.js.map +1 -0
  22. package/dist/index.d.ts +34 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +126 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/lib/automations-builder.d.ts +21 -0
  27. package/dist/lib/automations-builder.d.ts.map +1 -0
  28. package/dist/lib/automations-builder.js +557 -0
  29. package/dist/lib/automations-builder.js.map +1 -0
  30. package/dist/lib/automations-types.d.ts +153 -0
  31. package/dist/lib/automations-types.d.ts.map +1 -0
  32. package/dist/lib/automations-types.js +191 -0
  33. package/dist/lib/automations-types.js.map +1 -0
  34. package/dist/lib/index.d.ts +3 -0
  35. package/dist/lib/index.d.ts.map +1 -0
  36. package/dist/lib/index.js +3 -0
  37. package/dist/lib/index.js.map +1 -0
  38. package/dist/lib/legacy-task-migration.d.ts +20 -0
  39. package/dist/lib/legacy-task-migration.d.ts.map +1 -0
  40. package/dist/lib/legacy-task-migration.js +110 -0
  41. package/dist/lib/legacy-task-migration.js.map +1 -0
  42. package/dist/lib/legacy-text-trigger-migration.d.ts +18 -0
  43. package/dist/lib/legacy-text-trigger-migration.d.ts.map +1 -0
  44. package/dist/lib/legacy-text-trigger-migration.js +131 -0
  45. package/dist/lib/legacy-text-trigger-migration.js.map +1 -0
  46. package/dist/lib/workflow-clarification.d.ts +113 -0
  47. package/dist/lib/workflow-clarification.d.ts.map +1 -0
  48. package/dist/lib/workflow-clarification.js +425 -0
  49. package/dist/lib/workflow-clarification.js.map +1 -0
  50. package/dist/plugin-routes.d.ts +9 -0
  51. package/dist/plugin-routes.d.ts.map +1 -0
  52. package/dist/plugin-routes.js +147 -0
  53. package/dist/plugin-routes.js.map +1 -0
  54. package/dist/providers/activeWorkflows.d.ts +11 -0
  55. package/dist/providers/activeWorkflows.d.ts.map +1 -0
  56. package/dist/providers/activeWorkflows.js +72 -0
  57. package/dist/providers/activeWorkflows.js.map +1 -0
  58. package/dist/providers/index.d.ts +4 -0
  59. package/dist/providers/index.d.ts.map +1 -0
  60. package/dist/providers/index.js +4 -0
  61. package/dist/providers/index.js.map +1 -0
  62. package/dist/providers/pendingDraft.d.ts +9 -0
  63. package/dist/providers/pendingDraft.d.ts.map +1 -0
  64. package/dist/providers/pendingDraft.js +48 -0
  65. package/dist/providers/pendingDraft.js.map +1 -0
  66. package/dist/providers/workflowStatus.d.ts +3 -0
  67. package/dist/providers/workflowStatus.d.ts.map +1 -0
  68. package/dist/providers/workflowStatus.js +69 -0
  69. package/dist/providers/workflowStatus.js.map +1 -0
  70. package/dist/register-routes.d.ts +2 -0
  71. package/dist/register-routes.d.ts.map +1 -0
  72. package/dist/register-routes.js +6 -0
  73. package/dist/register-routes.js.map +1 -0
  74. package/dist/routes/_helpers.d.ts +11 -0
  75. package/dist/routes/_helpers.d.ts.map +1 -0
  76. package/dist/routes/_helpers.js +22 -0
  77. package/dist/routes/_helpers.js.map +1 -0
  78. package/dist/routes/automations.d.ts +19 -0
  79. package/dist/routes/automations.d.ts.map +1 -0
  80. package/dist/routes/automations.js +32 -0
  81. package/dist/routes/automations.js.map +1 -0
  82. package/dist/routes/embedded-webhooks.d.ts +3 -0
  83. package/dist/routes/embedded-webhooks.d.ts.map +1 -0
  84. package/dist/routes/embedded-webhooks.js +47 -0
  85. package/dist/routes/embedded-webhooks.js.map +1 -0
  86. package/dist/routes/executions.d.ts +3 -0
  87. package/dist/routes/executions.d.ts.map +1 -0
  88. package/dist/routes/executions.js +58 -0
  89. package/dist/routes/executions.js.map +1 -0
  90. package/dist/routes/index.d.ts +4 -0
  91. package/dist/routes/index.d.ts.map +1 -0
  92. package/dist/routes/index.js +14 -0
  93. package/dist/routes/index.js.map +1 -0
  94. package/dist/routes/nodes.d.ts +3 -0
  95. package/dist/routes/nodes.d.ts.map +1 -0
  96. package/dist/routes/nodes.js +168 -0
  97. package/dist/routes/nodes.js.map +1 -0
  98. package/dist/routes/validation.d.ts +3 -0
  99. package/dist/routes/validation.d.ts.map +1 -0
  100. package/dist/routes/validation.js +41 -0
  101. package/dist/routes/validation.js.map +1 -0
  102. package/dist/routes/workflow-routes.d.ts +27 -0
  103. package/dist/routes/workflow-routes.d.ts.map +1 -0
  104. package/dist/routes/workflow-routes.js +326 -0
  105. package/dist/routes/workflow-routes.js.map +1 -0
  106. package/dist/routes/workflows.d.ts +3 -0
  107. package/dist/routes/workflows.d.ts.map +1 -0
  108. package/dist/routes/workflows.js +252 -0
  109. package/dist/routes/workflows.js.map +1 -0
  110. package/dist/schemas/draftIntent.d.ts +22 -0
  111. package/dist/schemas/draftIntent.d.ts.map +1 -0
  112. package/dist/schemas/draftIntent.js +22 -0
  113. package/dist/schemas/draftIntent.js.map +1 -0
  114. package/dist/schemas/feasibility.d.ts +13 -0
  115. package/dist/schemas/feasibility.d.ts.map +1 -0
  116. package/dist/schemas/feasibility.js +9 -0
  117. package/dist/schemas/feasibility.js.map +1 -0
  118. package/dist/schemas/index.d.ts +5 -0
  119. package/dist/schemas/index.d.ts.map +1 -0
  120. package/dist/schemas/index.js +5 -0
  121. package/dist/schemas/index.js.map +1 -0
  122. package/dist/schemas/keywordExtraction.d.ts +14 -0
  123. package/dist/schemas/keywordExtraction.d.ts.map +1 -0
  124. package/dist/schemas/keywordExtraction.js +12 -0
  125. package/dist/schemas/keywordExtraction.js.map +1 -0
  126. package/dist/schemas/workflowMatching.d.ts +36 -0
  127. package/dist/schemas/workflowMatching.d.ts.map +1 -0
  128. package/dist/schemas/workflowMatching.js +30 -0
  129. package/dist/schemas/workflowMatching.js.map +1 -0
  130. package/dist/services/embedded-workflow-service.d.ts +106 -0
  131. package/dist/services/embedded-workflow-service.d.ts.map +1 -0
  132. package/dist/services/embedded-workflow-service.js +1900 -0
  133. package/dist/services/embedded-workflow-service.js.map +1 -0
  134. package/dist/services/index.d.ts +5 -0
  135. package/dist/services/index.d.ts.map +1 -0
  136. package/dist/services/index.js +5 -0
  137. package/dist/services/index.js.map +1 -0
  138. package/dist/services/workflow-credential-store.d.ts +27 -0
  139. package/dist/services/workflow-credential-store.d.ts.map +1 -0
  140. package/dist/services/workflow-credential-store.js +92 -0
  141. package/dist/services/workflow-credential-store.js.map +1 -0
  142. package/dist/services/workflow-dispatch.d.ts +41 -0
  143. package/dist/services/workflow-dispatch.d.ts.map +1 -0
  144. package/dist/services/workflow-dispatch.js +86 -0
  145. package/dist/services/workflow-dispatch.js.map +1 -0
  146. package/dist/services/workflow-service.d.ts +63 -0
  147. package/dist/services/workflow-service.d.ts.map +1 -0
  148. package/dist/services/workflow-service.js +492 -0
  149. package/dist/services/workflow-service.js.map +1 -0
  150. package/dist/trigger-routes.d.ts +153 -0
  151. package/dist/trigger-routes.d.ts.map +1 -0
  152. package/dist/trigger-routes.js +424 -0
  153. package/dist/trigger-routes.js.map +1 -0
  154. package/dist/types/index.d.ts +457 -0
  155. package/dist/types/index.d.ts.map +1 -0
  156. package/dist/types/index.js +59 -0
  157. package/dist/types/index.js.map +1 -0
  158. package/dist/utils/catalog.d.ts +16 -0
  159. package/dist/utils/catalog.d.ts.map +1 -0
  160. package/dist/utils/catalog.js +211 -0
  161. package/dist/utils/catalog.js.map +1 -0
  162. package/dist/utils/clarification.d.ts +17 -0
  163. package/dist/utils/clarification.d.ts.map +1 -0
  164. package/dist/utils/clarification.js +46 -0
  165. package/dist/utils/clarification.js.map +1 -0
  166. package/dist/utils/context.d.ts +4 -0
  167. package/dist/utils/context.d.ts.map +1 -0
  168. package/dist/utils/context.js +18 -0
  169. package/dist/utils/context.js.map +1 -0
  170. package/dist/utils/credentialResolver.d.ts +22 -0
  171. package/dist/utils/credentialResolver.d.ts.map +1 -0
  172. package/dist/utils/credentialResolver.js +146 -0
  173. package/dist/utils/credentialResolver.js.map +1 -0
  174. package/dist/utils/generation.d.ts +36 -0
  175. package/dist/utils/generation.d.ts.map +1 -0
  176. package/dist/utils/generation.js +701 -0
  177. package/dist/utils/generation.js.map +1 -0
  178. package/dist/utils/host-capabilities.d.ts +27 -0
  179. package/dist/utils/host-capabilities.d.ts.map +1 -0
  180. package/dist/utils/host-capabilities.js +59 -0
  181. package/dist/utils/host-capabilities.js.map +1 -0
  182. package/dist/utils/inferSyntheticOutputSchema.d.ts +20 -0
  183. package/dist/utils/inferSyntheticOutputSchema.d.ts.map +1 -0
  184. package/dist/utils/inferSyntheticOutputSchema.js +151 -0
  185. package/dist/utils/inferSyntheticOutputSchema.js.map +1 -0
  186. package/dist/utils/outputSchema.d.ts +26 -0
  187. package/dist/utils/outputSchema.d.ts.map +1 -0
  188. package/dist/utils/outputSchema.js +297 -0
  189. package/dist/utils/outputSchema.js.map +1 -0
  190. package/dist/utils/validateAndRepair.d.ts +41 -0
  191. package/dist/utils/validateAndRepair.d.ts.map +1 -0
  192. package/dist/utils/validateAndRepair.js +483 -0
  193. package/dist/utils/validateAndRepair.js.map +1 -0
  194. package/dist/utils/workflow-prompts/actionResponse.d.ts +2 -0
  195. package/dist/utils/workflow-prompts/actionResponse.d.ts.map +1 -0
  196. package/dist/utils/workflow-prompts/actionResponse.js +17 -0
  197. package/dist/utils/workflow-prompts/actionResponse.js.map +1 -0
  198. package/dist/utils/workflow-prompts/draftIntent.d.ts +2 -0
  199. package/dist/utils/workflow-prompts/draftIntent.d.ts.map +1 -0
  200. package/dist/utils/workflow-prompts/draftIntent.js +23 -0
  201. package/dist/utils/workflow-prompts/draftIntent.js.map +1 -0
  202. package/dist/utils/workflow-prompts/feasibilityCheck.d.ts +2 -0
  203. package/dist/utils/workflow-prompts/feasibilityCheck.d.ts.map +1 -0
  204. package/dist/utils/workflow-prompts/feasibilityCheck.js +21 -0
  205. package/dist/utils/workflow-prompts/feasibilityCheck.js.map +1 -0
  206. package/dist/utils/workflow-prompts/fieldCorrection.d.ts +3 -0
  207. package/dist/utils/workflow-prompts/fieldCorrection.d.ts.map +1 -0
  208. package/dist/utils/workflow-prompts/fieldCorrection.js +20 -0
  209. package/dist/utils/workflow-prompts/fieldCorrection.js.map +1 -0
  210. package/dist/utils/workflow-prompts/index.d.ts +8 -0
  211. package/dist/utils/workflow-prompts/index.d.ts.map +1 -0
  212. package/dist/utils/workflow-prompts/index.js +8 -0
  213. package/dist/utils/workflow-prompts/index.js.map +1 -0
  214. package/dist/utils/workflow-prompts/keywordExtraction.d.ts +2 -0
  215. package/dist/utils/workflow-prompts/keywordExtraction.d.ts.map +1 -0
  216. package/dist/utils/workflow-prompts/keywordExtraction.js +21 -0
  217. package/dist/utils/workflow-prompts/keywordExtraction.js.map +1 -0
  218. package/dist/utils/workflow-prompts/parameterCorrection.d.ts +3 -0
  219. package/dist/utils/workflow-prompts/parameterCorrection.d.ts.map +1 -0
  220. package/dist/utils/workflow-prompts/parameterCorrection.js +29 -0
  221. package/dist/utils/workflow-prompts/parameterCorrection.js.map +1 -0
  222. package/dist/utils/workflow-prompts/workflowGeneration.d.ts +2 -0
  223. package/dist/utils/workflow-prompts/workflowGeneration.d.ts.map +1 -0
  224. package/dist/utils/workflow-prompts/workflowGeneration.js +529 -0
  225. package/dist/utils/workflow-prompts/workflowGeneration.js.map +1 -0
  226. package/dist/utils/workflow-prompts/workflowMatching.d.ts +2 -0
  227. package/dist/utils/workflow-prompts/workflowMatching.d.ts.map +1 -0
  228. package/dist/utils/workflow-prompts/workflowMatching.js +23 -0
  229. package/dist/utils/workflow-prompts/workflowMatching.js.map +1 -0
  230. package/dist/utils/workflow.d.ts +62 -0
  231. package/dist/utils/workflow.d.ts.map +1 -0
  232. package/dist/utils/workflow.js +712 -0
  233. package/dist/utils/workflow.js.map +1 -0
  234. package/package.json +87 -0
  235. package/src/actions/index.ts +1 -0
  236. package/src/actions/workflow.ts +494 -0
  237. package/src/data/defaultNodes.json +9887 -0
  238. package/src/data/schemaIndex.json +1 -0
  239. package/src/data/triggerSchemaIndex.json +1 -0
  240. package/src/db/index.ts +8 -0
  241. package/src/db/schema.ts +94 -0
  242. package/src/index.ts +179 -0
  243. package/src/lib/automations-builder.ts +679 -0
  244. package/src/lib/automations-types.ts +391 -0
  245. package/src/lib/index.ts +8 -0
  246. package/src/lib/legacy-task-migration.ts +143 -0
  247. package/src/lib/legacy-text-trigger-migration.ts +178 -0
  248. package/src/lib/workflow-clarification.ts +497 -0
  249. package/src/plugin-routes.ts +164 -0
  250. package/src/providers/activeWorkflows.ts +81 -0
  251. package/src/providers/index.ts +3 -0
  252. package/src/providers/pendingDraft.ts +55 -0
  253. package/src/providers/workflowStatus.ts +88 -0
  254. package/src/register-routes.ts +6 -0
  255. package/src/routes/_helpers.ts +27 -0
  256. package/src/routes/automations.ts +46 -0
  257. package/src/routes/embedded-webhooks.ts +64 -0
  258. package/src/routes/executions.ts +75 -0
  259. package/src/routes/index.ts +16 -0
  260. package/src/routes/nodes.ts +211 -0
  261. package/src/routes/validation.ts +51 -0
  262. package/src/routes/workflow-routes.ts +469 -0
  263. package/src/routes/workflows.ts +310 -0
  264. package/src/schemas/draftIntent.ts +21 -0
  265. package/src/schemas/feasibility.ts +8 -0
  266. package/src/schemas/index.ts +4 -0
  267. package/src/schemas/keywordExtraction.ts +11 -0
  268. package/src/schemas/workflowMatching.ts +29 -0
  269. package/src/services/embedded-workflow-service.ts +2224 -0
  270. package/src/services/index.ts +17 -0
  271. package/src/services/workflow-credential-store.ts +132 -0
  272. package/src/services/workflow-dispatch.ts +121 -0
  273. package/src/services/workflow-service.ts +839 -0
  274. package/src/trigger-routes.ts +714 -0
  275. package/src/types/index.ts +562 -0
  276. package/src/utils/catalog.ts +260 -0
  277. package/src/utils/clarification.ts +52 -0
  278. package/src/utils/context.ts +22 -0
  279. package/src/utils/credentialResolver.ts +234 -0
  280. package/src/utils/generation.ts +987 -0
  281. package/src/utils/host-capabilities.ts +81 -0
  282. package/src/utils/inferSyntheticOutputSchema.ts +163 -0
  283. package/src/utils/outputSchema.ts +372 -0
  284. package/src/utils/validateAndRepair.ts +610 -0
  285. package/src/utils/workflow-prompts/actionResponse.ts +16 -0
  286. package/src/utils/workflow-prompts/draftIntent.ts +22 -0
  287. package/src/utils/workflow-prompts/feasibilityCheck.ts +20 -0
  288. package/src/utils/workflow-prompts/fieldCorrection.ts +20 -0
  289. package/src/utils/workflow-prompts/index.ts +10 -0
  290. package/src/utils/workflow-prompts/keywordExtraction.ts +20 -0
  291. package/src/utils/workflow-prompts/parameterCorrection.ts +29 -0
  292. package/src/utils/workflow-prompts/workflowGeneration.ts +528 -0
  293. package/src/utils/workflow-prompts/workflowMatching.ts +22 -0
  294. package/src/utils/workflow.ts +895 -0
@@ -0,0 +1,457 @@
1
+ import type { EventPayload } from '@elizaos/core';
2
+ import type { INode, INodeCredentialsDetails, INodeProperties, INodeTypeDescription, IWorkflowSettings } from '@elizaos/workflows';
3
+ export interface WorkflowDefinition {
4
+ name: string;
5
+ nodes: WorkflowNode[];
6
+ connections: WorkflowConnections;
7
+ active?: boolean;
8
+ settings?: Partial<IWorkflowSettings>;
9
+ tags?: WorkflowTag[];
10
+ meta?: Record<string, unknown>;
11
+ id?: string;
12
+ createdAt?: string;
13
+ updatedAt?: string;
14
+ /**
15
+ * Metadata generated by LLM (not sent to workflow API)
16
+ * Used internally for preview and clarification
17
+ */
18
+ _meta?: WorkflowMeta;
19
+ }
20
+ /**
21
+ * Workflow metadata for internal use
22
+ * Generated by LLM, used for preview and clarification
23
+ * NOT sent to workflow API
24
+ */
25
+ export interface WorkflowMeta {
26
+ assumptions?: string[];
27
+ suggestions?: string[];
28
+ /**
29
+ * Accepts either legacy free-text strings (one question per item) or
30
+ * structured ClarificationRequest objects. Hosts that consume this field
31
+ * should run it through `coerceClarificationRequests` to normalize.
32
+ */
33
+ requiresClarification?: Array<string | ClarificationRequest>;
34
+ }
35
+ /**
36
+ * A structured request for additional information from the user before
37
+ * a workflow can be deployed. Lets the host render a quick-pick UI and
38
+ * patch the draft at the named param path on resolution, instead of
39
+ * regenerating the workflow with the LLM.
40
+ */
41
+ export interface ClarificationRequest {
42
+ /**
43
+ * Semantic category of the missing value. Determines how the host
44
+ * renders the picker (channel/server/recipient pickers vs. free text).
45
+ */
46
+ kind: 'target_channel' | 'target_server' | 'recipient' | 'value' | 'free_text';
47
+ /**
48
+ * Connector platform this clarification belongs to (e.g. 'discord',
49
+ * 'slack', 'telegram', 'gmail'). Drives catalog source selection.
50
+ */
51
+ platform?: string;
52
+ /**
53
+ * Narrowing scope for catalog lookups. For Discord channel pickers,
54
+ * `scope.guildId` constrains the channel list to a single guild.
55
+ */
56
+ scope?: {
57
+ guildId?: string;
58
+ };
59
+ /**
60
+ * Short, user-facing question rendered above the picker.
61
+ */
62
+ question: string;
63
+ /**
64
+ * JSON-style path into the draft workflow that points at the parameter
65
+ * the user's choice should populate. Supports dot and bracketed-string
66
+ * segments, e.g. `nodes["Discord Send"].parameters.channelId`.
67
+ */
68
+ paramPath: string;
69
+ }
70
+ export interface WorkflowNode extends Omit<INode, 'id' | 'parameters' | 'credentials' | 'position'> {
71
+ id?: string;
72
+ position: [number, number];
73
+ parameters: Record<string, unknown>;
74
+ credentials?: Record<string, WorkflowCredentialReference>;
75
+ color?: string;
76
+ }
77
+ export interface WorkflowCredentialReference extends Omit<INodeCredentialsDetails, 'id'> {
78
+ id: string;
79
+ }
80
+ export interface WorkflowConnections {
81
+ [nodeName: string]: {
82
+ [outputType: string]: Array<Array<{
83
+ node: string;
84
+ type: string;
85
+ index: number;
86
+ }>>;
87
+ };
88
+ }
89
+ export interface WorkflowDefinitionResponse extends WorkflowDefinition {
90
+ id: string;
91
+ createdAt: string;
92
+ updatedAt: string;
93
+ versionId: string;
94
+ }
95
+ export interface WorkflowCredential {
96
+ id: string;
97
+ name: string;
98
+ type: string;
99
+ data?: Record<string, unknown>;
100
+ isResolvable?: boolean;
101
+ createdAt: string;
102
+ updatedAt: string;
103
+ }
104
+ export interface WorkflowExecution {
105
+ id: string;
106
+ finished: boolean;
107
+ mode: 'cli' | 'error' | 'integrated' | 'internal' | 'manual' | 'retry' | 'trigger' | 'webhook' | 'evaluation' | 'chat';
108
+ retryOf?: string | null;
109
+ retrySuccessId?: string | null;
110
+ startedAt: string;
111
+ stoppedAt?: string | null;
112
+ workflowId: string;
113
+ status: 'canceled' | 'crashed' | 'error' | 'new' | 'running' | 'success' | 'unknown' | 'waiting';
114
+ waitTill?: string | null;
115
+ customData?: Record<string, unknown>;
116
+ data?: {
117
+ resultData?: {
118
+ runData?: Record<string, unknown[]>;
119
+ lastNodeExecuted?: string;
120
+ error?: {
121
+ message: string;
122
+ stack?: string;
123
+ };
124
+ };
125
+ executionData?: {
126
+ contextData?: Record<string, unknown>;
127
+ nodeExecutionStack?: unknown[];
128
+ waitingExecution?: Record<string, unknown>;
129
+ };
130
+ };
131
+ }
132
+ export interface WorkflowTag {
133
+ id: string;
134
+ name: string;
135
+ createdAt: string;
136
+ updatedAt: string;
137
+ }
138
+ export interface NodeDefinition extends Omit<INodeTypeDescription, 'credentials' | 'group' | 'icon' | 'iconUrl' | 'inputs' | 'outputs' | 'polling' | 'properties' | 'triggerPanel' | 'webhooks'> {
139
+ icon?: string;
140
+ iconUrl?: string;
141
+ group: string[];
142
+ defaults: {
143
+ name: string;
144
+ color?: string;
145
+ };
146
+ inputs: string[] | string;
147
+ outputs: string[] | string;
148
+ credentials?: Array<{
149
+ name: string;
150
+ required: boolean;
151
+ displayOptions?: unknown;
152
+ }>;
153
+ properties: NodeProperty[];
154
+ webhooks?: Array<Record<string, unknown>>;
155
+ polling?: boolean;
156
+ triggerPanel?: unknown;
157
+ }
158
+ export interface NodePropertyOption {
159
+ name: string;
160
+ value?: string | number | boolean;
161
+ displayName?: string;
162
+ description?: string;
163
+ [key: string]: unknown;
164
+ }
165
+ export interface NodePropertyCollection {
166
+ name: string;
167
+ displayName?: string;
168
+ values: NodeProperty[];
169
+ [key: string]: unknown;
170
+ }
171
+ export interface NodeProperty extends Omit<INodeProperties, 'default' | 'displayOptions' | 'options' | 'routing' | 'type'> {
172
+ type: string;
173
+ default: unknown;
174
+ options?: Array<NodePropertyOption | NodePropertyCollection>;
175
+ displayOptions?: unknown;
176
+ placeholder?: string;
177
+ hint?: string;
178
+ routing?: unknown;
179
+ [key: string]: unknown;
180
+ }
181
+ export interface NodeSearchResult {
182
+ node: NodeDefinition;
183
+ score: number;
184
+ matchReason: string;
185
+ }
186
+ export interface IntegrationFilterResult {
187
+ remaining: NodeSearchResult[];
188
+ removed: NodeSearchResult[];
189
+ }
190
+ export interface KeywordExtractionResult {
191
+ keywords: string[];
192
+ }
193
+ /**
194
+ * Result of semantic workflow matching
195
+ */
196
+ export interface WorkflowMatchResult {
197
+ matchedWorkflowId: string | null;
198
+ confidence: 'high' | 'medium' | 'low' | 'none';
199
+ matches: Array<{
200
+ id: string;
201
+ name: string;
202
+ score: number;
203
+ }>;
204
+ reason: string;
205
+ }
206
+ export interface WorkflowValidationResult {
207
+ valid: boolean;
208
+ errors: string[];
209
+ warnings: string[];
210
+ }
211
+ export declare const WORKFLOW_CREDENTIAL_PROVIDER_TYPE = "workflow_credential_provider";
212
+ /**
213
+ * Result of a credential resolution attempt by an external provider.
214
+ */
215
+ export type CredentialProviderResult = {
216
+ status: 'credential_data';
217
+ data: Record<string, unknown>;
218
+ } | {
219
+ status: 'needs_auth';
220
+ authUrl: string;
221
+ } | null;
222
+ /**
223
+ * External credential provider interface.
224
+ *
225
+ * Hosts (e.g. eliza-cloud) can register a service implementing this interface
226
+ * to automatically resolve credentials (via OAuth, API keys, etc.).
227
+ * The plugin works without one — it's an optional enhancement.
228
+ *
229
+ * Register on runtime as service type 'workflow_credential_provider'.
230
+ */
231
+ export interface CredentialProvider {
232
+ resolve(userId: string, credType: string): Promise<CredentialProviderResult>;
233
+ checkCredentialTypes?(credTypes: string[]): CheckCredentialTypesResult;
234
+ }
235
+ export interface CheckCredentialTypesResult {
236
+ supported: string[];
237
+ unsupported: string[];
238
+ }
239
+ export interface FeasibilityResult {
240
+ feasible: boolean;
241
+ reason: string;
242
+ }
243
+ /**
244
+ * Type guard to check if a service implements CredentialProvider
245
+ */
246
+ export declare function isCredentialProvider(service: unknown): service is CredentialProvider;
247
+ export declare const WORKFLOW_RUNTIME_CONTEXT_PROVIDER_TYPE = "workflow_runtime_context_provider";
248
+ export interface RuntimeContextSupportedCredential {
249
+ credType: string;
250
+ friendlyName: string;
251
+ nodeTypes: string[];
252
+ }
253
+ /**
254
+ * Optional runtime-supplied context the host injects into the workflow-generation
255
+ * prompt. The plugin treats this as advisory information for the LLM:
256
+ * - `supportedCredentials` becomes a "## Available Credentials" section so the
257
+ * LLM only references credential types the host can actually resolve.
258
+ * - `facts` becomes a "## Runtime Facts" section with real values (Discord
259
+ * guilds/channels, the user's Gmail email, etc.) so the LLM substitutes
260
+ * them verbatim instead of emitting `{{YOUR_…}}` placeholders.
261
+ *
262
+ * The plugin works without a provider — both sections are simply omitted.
263
+ */
264
+ export interface RuntimeContext {
265
+ /**
266
+ * Optional. When omitted (or empty), the generation prompt simply
267
+ * skips the "## Available Credentials" section. Implementers can
268
+ * return only what they have without fabricating empty arrays.
269
+ */
270
+ supportedCredentials?: RuntimeContextSupportedCredential[];
271
+ /**
272
+ * Optional. When omitted (or empty), the generation prompt simply
273
+ * skips the "## Runtime Facts" section.
274
+ */
275
+ facts?: string[];
276
+ /**
277
+ * Optional bias hint for keyword extraction. Lowercase provider tags the
278
+ * host knows it can satisfy (e.g. `["gmail", "discord"]`). When present,
279
+ * keyword extraction nudges the LLM toward these providers and away from
280
+ * generic fallbacks (e.g. emit `gmail` not `imap`, `discord` not
281
+ * `webhook`). Always optional — older hosts that omit it keep working.
282
+ */
283
+ preferredProviders?: string[];
284
+ }
285
+ /**
286
+ * Originating-conversation routing context. Hosts pass this when the workflow
287
+ * is being generated from inside a platform conversation (e.g. a Discord DM),
288
+ * so the LLM can target "this channel" / "back to me" without the user having
289
+ * to name an ID. The host typically derives it from the inbound message's
290
+ * `MessageMetadata` and surfaces it as a fact line ("This workflow was
291
+ * prompted from Discord channel #foo (id 123) in Bar (id 456)…").
292
+ *
293
+ * All fields are optional. Hosts only fill the platform block that matches
294
+ * the trigger source. `resolvedNames` lets the host pass human names for the
295
+ * channel / server (when available) so the prompt can reference them in
296
+ * natural language.
297
+ */
298
+ export interface TriggerContext {
299
+ /** Source platform — `"discord" | "telegram" | "slack" | "gmail" | …` */
300
+ source?: string;
301
+ discord?: {
302
+ channelId?: string;
303
+ guildId?: string;
304
+ threadId?: string;
305
+ };
306
+ telegram?: {
307
+ chatId?: string | number;
308
+ threadId?: string | number;
309
+ };
310
+ slack?: {
311
+ channelId?: string;
312
+ teamId?: string;
313
+ };
314
+ resolvedNames?: {
315
+ channel?: string;
316
+ server?: string;
317
+ };
318
+ }
319
+ export interface RuntimeContextProviderInput {
320
+ userId: string;
321
+ relevantNodes: NodeDefinition[];
322
+ relevantCredTypes: string[];
323
+ /**
324
+ * Optional originating-conversation context. Forward-compatible: hosts that
325
+ * don't know about it simply omit the field.
326
+ */
327
+ triggerContext?: TriggerContext;
328
+ }
329
+ export interface RuntimeContextProvider {
330
+ getRuntimeContext(input: RuntimeContextProviderInput): Promise<RuntimeContext>;
331
+ }
332
+ /**
333
+ * Type guard to check if a service implements RuntimeContextProvider.
334
+ */
335
+ export declare function isRuntimeContextProvider(service: unknown): service is RuntimeContextProvider;
336
+ export declare const WORKFLOW_CREDENTIAL_STORE_TYPE = "workflow_credential_store";
337
+ /**
338
+ * Runtime event emitted by the host (e.g. agent connector routes) when a
339
+ * connector is disconnected. WorkflowCredentialStore subscribes to this in
340
+ * `start()` and purges its cached credential ids for the supplied credTypes,
341
+ * so the next workflow generation surfaces `needs_auth` instead of returning
342
+ * a stale id.
343
+ *
344
+ * Payload shape kept minimal and serializable so any host can emit without
345
+ * pulling in plugin-workflow types — `userId` + `credTypes` is enough for
346
+ * the store to do its job. `connectorName` is informational for subscribers
347
+ * that want richer context.
348
+ */
349
+ export declare const CONNECTOR_DISCONNECTED_EVENT = "connector_disconnected";
350
+ export interface ConnectorDisconnectedPayload extends EventPayload {
351
+ /** Owner of the credentials to purge — typically `runtime.agentId`. */
352
+ userId: string;
353
+ /**
354
+ * Workflow credential type ids tied to the disconnected connector
355
+ * (e.g. `['gmailOAuth2', 'gmailOAuth2Api']`). Empty list ⇒ no-op.
356
+ */
357
+ credTypes: readonly string[];
358
+ /** Connector name (e.g. `'gmail'`). Informational. */
359
+ connectorName?: string;
360
+ }
361
+ export interface CredentialMapping {
362
+ credType: string;
363
+ workflowCredentialId: string;
364
+ }
365
+ export interface WorkflowCredentialStoreApi {
366
+ get(userId: string, credType: string): Promise<string | null>;
367
+ set(userId: string, credType: string, workflowCredId: string): Promise<void>;
368
+ listByUser(userId: string): Promise<CredentialMapping[]>;
369
+ /**
370
+ * Forget the cached workflows credential id for (userId, credType). The next
371
+ * resolution falls back to credProvider so a disconnect-then-prompt flow
372
+ * surfaces `needs_auth` instead of reusing stale credentials.
373
+ *
374
+ * Optional: external/custom credential-store implementations that pre-date
375
+ * this method continue to satisfy the interface; hosts that need to cascade
376
+ * a disconnect must check for the method (`store.delete?.(userId, credType)`)
377
+ * before calling.
378
+ */
379
+ delete?(userId: string, credType: string): Promise<void>;
380
+ }
381
+ export interface CredentialResolutionResult {
382
+ workflow: WorkflowDefinition;
383
+ missingConnections: MissingConnection[];
384
+ injectedCredentials: Map<string, string>;
385
+ }
386
+ export interface MissingConnection {
387
+ credType: string;
388
+ authUrl?: string;
389
+ }
390
+ export interface WorkflowPluginConfig {
391
+ apiKey: string;
392
+ host: string;
393
+ credentials?: Record<string, string>;
394
+ }
395
+ export interface WorkflowDraft {
396
+ workflow: WorkflowDefinition;
397
+ prompt: string;
398
+ userId: string;
399
+ createdAt: number;
400
+ /** ID of the message that created this draft — used to prevent same-turn auto-confirm. */
401
+ originMessageId?: string;
402
+ }
403
+ export interface DraftIntentResult {
404
+ intent: 'confirm' | 'cancel' | 'modify' | 'new' | 'show_preview';
405
+ modificationRequest?: string;
406
+ reason: string;
407
+ }
408
+ export interface WorkflowCreationResult {
409
+ id: string;
410
+ name: string;
411
+ active: boolean;
412
+ nodeCount: number;
413
+ missingCredentials: MissingConnection[];
414
+ }
415
+ export declare class WorkflowApiError extends Error {
416
+ statusCode?: number | undefined;
417
+ response?: unknown | undefined;
418
+ constructor(message: string, statusCode?: number | undefined, response?: unknown | undefined);
419
+ }
420
+ export declare class UnsupportedIntegrationError extends Error {
421
+ unsupportedServices: string[];
422
+ availableServices: string[];
423
+ constructor(unsupportedServices: string[], availableServices: string[]);
424
+ }
425
+ /**
426
+ * JSON schema content from workflows output schemas
427
+ */
428
+ export interface SchemaContent {
429
+ type: string;
430
+ properties?: Record<string, unknown>;
431
+ items?: SchemaContent;
432
+ [key: string]: unknown;
433
+ }
434
+ /**
435
+ * Expression reference found in node parameters
436
+ */
437
+ export interface ExpressionRef {
438
+ fullExpression: string;
439
+ field: string;
440
+ path: string[];
441
+ paramPath: string;
442
+ sourceNodeName?: string;
443
+ }
444
+ /**
445
+ * Invalid output reference detected during validation
446
+ */
447
+ export interface OutputRefValidation {
448
+ nodeName: string;
449
+ expression: string;
450
+ field: string;
451
+ sourceNodeName: string;
452
+ sourceNodeType: string;
453
+ resource: string;
454
+ operation: string;
455
+ availableFields: string[];
456
+ }
457
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EACV,KAAK,EACL,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAI5B,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,mBAAmB,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACtC,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,oBAAoB,CAAC,CAAC;CAC9D;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,IAAI,EAAE,gBAAgB,GAAG,eAAe,GAAG,WAAW,GAAG,OAAO,GAAG,WAAW,CAAC;IAC/E;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,K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E,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B"}
@@ -0,0 +1,59 @@
1
+ // Credential provider types
2
+ export const WORKFLOW_CREDENTIAL_PROVIDER_TYPE = 'workflow_credential_provider';
3
+ /**
4
+ * Type guard to check if a service implements CredentialProvider
5
+ */
6
+ export function isCredentialProvider(service) {
7
+ if (!service || typeof service !== 'object') {
8
+ return false;
9
+ }
10
+ return typeof service.resolve === 'function';
11
+ }
12
+ // Runtime context provider types
13
+ export const WORKFLOW_RUNTIME_CONTEXT_PROVIDER_TYPE = 'workflow_runtime_context_provider';
14
+ /**
15
+ * Type guard to check if a service implements RuntimeContextProvider.
16
+ */
17
+ export function isRuntimeContextProvider(service) {
18
+ if (!service || typeof service !== 'object') {
19
+ return false;
20
+ }
21
+ return typeof service.getRuntimeContext === 'function';
22
+ }
23
+ // Credential store types
24
+ export const WORKFLOW_CREDENTIAL_STORE_TYPE = 'workflow_credential_store';
25
+ /**
26
+ * Runtime event emitted by the host (e.g. agent connector routes) when a
27
+ * connector is disconnected. WorkflowCredentialStore subscribes to this in
28
+ * `start()` and purges its cached credential ids for the supplied credTypes,
29
+ * so the next workflow generation surfaces `needs_auth` instead of returning
30
+ * a stale id.
31
+ *
32
+ * Payload shape kept minimal and serializable so any host can emit without
33
+ * pulling in plugin-workflow types — `userId` + `credTypes` is enough for
34
+ * the store to do its job. `connectorName` is informational for subscribers
35
+ * that want richer context.
36
+ */
37
+ export const CONNECTOR_DISCONNECTED_EVENT = 'connector_disconnected';
38
+ // Error types
39
+ export class WorkflowApiError extends Error {
40
+ statusCode;
41
+ response;
42
+ constructor(message, statusCode, response) {
43
+ super(message);
44
+ this.statusCode = statusCode;
45
+ this.response = response;
46
+ this.name = 'WorkflowApiError';
47
+ }
48
+ }
49
+ export class UnsupportedIntegrationError extends Error {
50
+ unsupportedServices;
51
+ availableServices;
52
+ constructor(unsupportedServices, availableServices) {
53
+ super(`Unsupported integrations: ${unsupportedServices.join(', ')}`);
54
+ this.unsupportedServices = unsupportedServices;
55
+ this.availableServices = availableServices;
56
+ this.name = 'UnsupportedIntegrationError';
57
+ }
58
+ }
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AA6QA,4BAA4B;AAE5B,MAAM,CAAC,MAAM,iCAAiC,GAAG,8BAA8B,CAAC;AAkChF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAQ,OAAmC,CAAC,OAAO,KAAK,UAAU,CAAC;AAC5E,CAAC;AAED,iCAAiC;AAEjC,MAAM,CAAC,MAAM,sCAAsC,GAAG,mCAAmC,CAAC;AA8E1F;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,OAAQ,OAAmC,CAAC,iBAAiB,KAAK,UAAU,CAAC;AACtF,CAAC;AAED,yBAAyB;AAEzB,MAAM,CAAC,MAAM,8BAA8B,GAAG,2BAA2B,CAAC;AAE1E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AAkFrE,cAAc;AAEd,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAGhC;IACA;IAHT,YACE,OAAe,EACR,UAAmB,EACnB,QAAkB;QAEzB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,eAAU,GAAV,UAAU,CAAS;QACnB,aAAQ,GAAR,QAAQ,CAAU;QAGzB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAE3C;IACA;IAFT,YACS,mBAA6B,EAC7B,iBAA2B;QAElC,KAAK,CAAC,6BAA6B,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAH9D,wBAAmB,GAAnB,mBAAmB,CAAU;QAC7B,sBAAiB,GAAjB,iBAAiB,CAAU;QAGlC,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC5C,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ import type { IntegrationFilterResult, NodeDefinition, NodeSearchResult } from '../types/index';
2
+ /** Get all nodes in the catalog. Used by route handlers for unfiltered listing. */
3
+ export declare function getAllNodes(): NodeDefinition[];
4
+ /**
5
+ * Look up a node definition by its type name.
6
+ *
7
+ * Handles full names ("workflows-nodes-base.httpRequest") and bare names ("httpRequest").
8
+ */
9
+ export declare function getNodeDefinition(typeName: string): NodeDefinition | undefined;
10
+ /**
11
+ * Scoring: exact name 10, word-boundary 7, substring 3, category 3, description 2, word 1
12
+ */
13
+ export declare function searchNodes(keywords: string[], limit?: number): NodeSearchResult[];
14
+ export declare function filterNodesByIntegrationSupport(nodes: NodeSearchResult[], supportedCredTypes: Set<string>): IntegrationFilterResult;
15
+ export declare function simplifyNodeForLLM(node: NodeDefinition): NodeDefinition;
16
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/utils/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EAEd,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAUxB,mFAAmF;AACnF,wBAAgB,WAAW,IAAI,cAAc,EAAE,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAW9E;AAWD;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,KAAK,SAAK,GAAG,gBAAgB,EAAE,CAiE9E;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,gBAAgB,EAAE,EACzB,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,GAC9B,uBAAuB,CAuBzB;AAmFD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc,CAgCvE"}