@agentuity/core 2.0.1 → 2.0.3

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 (52) hide show
  1. package/AGENTS.md +15 -0
  2. package/dist/deprecation.d.ts +1 -1
  3. package/dist/deprecation.d.ts.map +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/services/auth/index.d.ts +1 -1
  9. package/dist/services/auth/index.d.ts.map +1 -1
  10. package/dist/services/index.d.ts +1 -0
  11. package/dist/services/index.d.ts.map +1 -1
  12. package/dist/services/index.js +1 -0
  13. package/dist/services/index.js.map +1 -1
  14. package/dist/services/queue/destinations.d.ts +60 -4
  15. package/dist/services/queue/destinations.d.ts.map +1 -1
  16. package/dist/services/queue/destinations.js.map +1 -1
  17. package/dist/services/queue/types.d.ts +121 -37
  18. package/dist/services/queue/types.d.ts.map +1 -1
  19. package/dist/services/queue/types.js +66 -7
  20. package/dist/services/queue/types.js.map +1 -1
  21. package/dist/services/webhook/types.d.ts +1 -0
  22. package/dist/services/webhook/types.d.ts.map +1 -1
  23. package/dist/services/webhook/types.js +1 -0
  24. package/dist/services/webhook/types.js.map +1 -1
  25. package/dist/services/workflow/api-reference.d.ts +4 -0
  26. package/dist/services/workflow/api-reference.d.ts.map +1 -0
  27. package/dist/services/workflow/api-reference.js +337 -0
  28. package/dist/services/workflow/api-reference.js.map +1 -0
  29. package/dist/services/workflow/index.d.ts +3 -0
  30. package/dist/services/workflow/index.d.ts.map +1 -0
  31. package/dist/services/workflow/index.js +3 -0
  32. package/dist/services/workflow/index.js.map +1 -0
  33. package/dist/services/workflow/service.d.ts +235 -0
  34. package/dist/services/workflow/service.d.ts.map +1 -0
  35. package/dist/services/workflow/service.js +555 -0
  36. package/dist/services/workflow/service.js.map +1 -0
  37. package/dist/services/workflow/types.d.ts +270 -0
  38. package/dist/services/workflow/types.d.ts.map +1 -0
  39. package/dist/services/workflow/types.js +174 -0
  40. package/dist/services/workflow/types.js.map +1 -0
  41. package/package.json +2 -2
  42. package/src/deprecation.ts +1 -1
  43. package/src/index.ts +1 -1
  44. package/src/services/auth/index.ts +1 -1
  45. package/src/services/index.ts +1 -0
  46. package/src/services/queue/destinations.ts +1 -1
  47. package/src/services/queue/types.ts +72 -9
  48. package/src/services/webhook/types.ts +1 -0
  49. package/src/services/workflow/api-reference.ts +352 -0
  50. package/src/services/workflow/index.ts +2 -0
  51. package/src/services/workflow/service.ts +633 -0
  52. package/src/services/workflow/types.ts +233 -0
@@ -0,0 +1,233 @@
1
+ import { z } from 'zod';
2
+
3
+ export const WorkflowSourceTypeSchema = z
4
+ .enum(['email', 'queue', 'webhook', 'schedule'])
5
+ .describe('The type of source that triggers the workflow');
6
+
7
+ export type WorkflowSourceType = z.infer<typeof WorkflowSourceTypeSchema>;
8
+
9
+ export const WorkflowStatusSchema = z
10
+ .enum(['enabled', 'disabled'])
11
+ .describe('The status of the workflow');
12
+
13
+ export type WorkflowStatus = z.infer<typeof WorkflowStatusSchema>;
14
+
15
+ export const WorkflowSchema = z
16
+ .object({
17
+ id: z.string().describe('Unique identifier for the workflow (prefixed with wf_)'),
18
+ created_at: z.string().describe('ISO 8601 timestamp when the workflow was created'),
19
+ updated_at: z.string().describe('ISO 8601 timestamp when the workflow was last updated'),
20
+ created_by: z.string().describe('ID of the user who created the workflow'),
21
+ org_id: z.string().describe('Organization ID that owns the workflow'),
22
+ name: z.string().describe('Human-readable name for the workflow'),
23
+ description: z.string().nullable().describe('Optional description of the workflow'),
24
+ source_type: WorkflowSourceTypeSchema.describe(
25
+ 'The type of source that triggers this workflow'
26
+ ),
27
+ source_ref_id: z
28
+ .string()
29
+ .describe('The ID of the source (email address, queue, webhook, or schedule)'),
30
+ source_config: z
31
+ .record(z.string(), z.unknown())
32
+ .nullable()
33
+ .describe('Optional configuration for the source'),
34
+ status: WorkflowStatusSchema.describe('The current status of the workflow'),
35
+ graph_json: z
36
+ .record(z.string(), z.unknown())
37
+ .nullable()
38
+ .describe('The workflow graph definition (nodes and edges)'),
39
+ execution_count: z
40
+ .number()
41
+ .optional()
42
+ .describe('Number of times this workflow has been executed'),
43
+ link: z.string().optional().describe('Link to the workflow detail page'),
44
+ })
45
+ .describe('Workflow configuration');
46
+
47
+ export type Workflow = z.infer<typeof WorkflowSchema>;
48
+
49
+ export const WorkflowExecutionSchema = z
50
+ .object({
51
+ id: z.string().describe('Unique identifier for the execution'),
52
+ workflow_id: z.string().describe('ID of the workflow that was executed'),
53
+ status: z.enum(['pending', 'running', 'completed', 'failed']).describe('Execution status'),
54
+ started_at: z.string().nullable().describe('When the execution started'),
55
+ completed_at: z.string().nullable().describe('When the execution completed'),
56
+ error: z.string().nullable().describe('Error message if the execution failed'),
57
+ steps: z
58
+ .array(
59
+ z.object({
60
+ node_id: z.string(),
61
+ node_type: z.string(),
62
+ status: z.string(),
63
+ started_at: z.string().nullable(),
64
+ completed_at: z.string().nullable(),
65
+ error: z.string().nullable(),
66
+ })
67
+ )
68
+ .optional()
69
+ .describe('Individual step execution details'),
70
+ })
71
+ .describe('Workflow execution record');
72
+
73
+ export type WorkflowExecution = z.infer<typeof WorkflowExecutionSchema>;
74
+
75
+ export const WorkflowDeliverySchema = z
76
+ .object({
77
+ id: z.string().describe('Unique identifier for the delivery'),
78
+ workflow_id: z.string().describe('ID of the workflow'),
79
+ execution_id: z.string().describe('ID of the execution this delivery belongs to'),
80
+ destination_type: z.string().describe('Type of destination'),
81
+ destination_id: z.string().describe('ID of the destination'),
82
+ status: z.enum(['pending', 'success', 'failed']).describe('Delivery status'),
83
+ sent_at: z.string().nullable().describe('When the delivery was sent'),
84
+ response: z.unknown().nullable().describe('Response from the destination'),
85
+ error: z.string().nullable().describe('Error message if delivery failed'),
86
+ })
87
+ .describe('Workflow delivery record');
88
+
89
+ export type WorkflowDelivery = z.infer<typeof WorkflowDeliverySchema>;
90
+
91
+ export const WorkflowActivitySchema = z
92
+ .object({
93
+ total_workflows: z.number().describe('Total number of workflows'),
94
+ enabled_workflows: z.number().describe('Number of enabled workflows'),
95
+ disabled_workflows: z.number().describe('Number of disabled workflows'),
96
+ total_executions: z.number().describe('Total number of executions'),
97
+ succeeded_executions: z.number().describe('Number of successful executions'),
98
+ failed_executions: z.number().describe('Number of failed executions'),
99
+ last_activity_at: z.string().nullable().describe('When the last activity occurred'),
100
+ })
101
+ .describe('Workflow activity statistics');
102
+
103
+ export type WorkflowActivity = z.infer<typeof WorkflowActivitySchema>;
104
+
105
+ export const CreateWorkflowRequestSchema = z
106
+ .object({
107
+ name: z.string().min(1).describe('Human-readable name for the workflow'),
108
+ description: z.string().optional().describe('Optional description of the workflow'),
109
+ source_type: WorkflowSourceTypeSchema.describe(
110
+ 'The type of source that triggers this workflow'
111
+ ),
112
+ source_ref_id: z.string().describe('The ID of the source'),
113
+ source_config: z
114
+ .record(z.string(), z.unknown())
115
+ .optional()
116
+ .describe('Optional source configuration'),
117
+ })
118
+ .describe('Request for creating a new workflow');
119
+
120
+ export type CreateWorkflowRequest = z.infer<typeof CreateWorkflowRequestSchema>;
121
+
122
+ export const UpdateWorkflowRequestSchema = z
123
+ .object({
124
+ name: z.string().min(1).optional().describe('New name for the workflow'),
125
+ description: z.string().nullable().optional().describe('New description for the workflow'),
126
+ status: WorkflowStatusSchema.optional().describe('New status for the workflow'),
127
+ })
128
+ .describe('Request for updating an existing workflow');
129
+
130
+ export type UpdateWorkflowRequest = z.infer<typeof UpdateWorkflowRequestSchema>;
131
+
132
+ export const UpdateWorkflowGraphRequestSchema = z
133
+ .object({
134
+ nodes: z
135
+ .array(
136
+ z.object({
137
+ id: z.string(),
138
+ type: z.string().optional(),
139
+ position: z.object({ x: z.number(), y: z.number() }).optional(),
140
+ data: z.unknown().optional(),
141
+ })
142
+ )
143
+ .describe('Array of workflow nodes'),
144
+ edges: z
145
+ .array(
146
+ z.object({
147
+ id: z.string(),
148
+ source: z.string(),
149
+ target: z.string(),
150
+ sourceHandle: z.string().optional(),
151
+ targetHandle: z.string().optional(),
152
+ })
153
+ )
154
+ .describe('Array of workflow edges'),
155
+ })
156
+ .describe('Request for updating the workflow graph');
157
+
158
+ export type UpdateWorkflowGraphRequest = z.infer<typeof UpdateWorkflowGraphRequestSchema>;
159
+
160
+ export const TestWorkflowRequestSchema = z
161
+ .object({
162
+ payload: z.unknown().describe('Test payload to send through the workflow'),
163
+ })
164
+ .describe('Request for testing a workflow');
165
+
166
+ export type TestWorkflowRequest = z.infer<typeof TestWorkflowRequestSchema>;
167
+
168
+ export const TestWorkflowResultSchema = z
169
+ .object({
170
+ execution_id: z.string().describe('ID of the test execution'),
171
+ status: z.string().describe('Status of the test execution'),
172
+ steps: z
173
+ .array(
174
+ z.object({
175
+ node_id: z.string(),
176
+ node_type: z.string(),
177
+ status: z.string(),
178
+ output: z.unknown().optional(),
179
+ error: z.string().optional(),
180
+ })
181
+ )
182
+ .optional()
183
+ .describe('Individual step results'),
184
+ error: z.string().optional().describe('Error message if test failed'),
185
+ })
186
+ .describe('Result of a workflow test');
187
+
188
+ export type TestWorkflowResult = z.infer<typeof TestWorkflowResultSchema>;
189
+
190
+ export const ListWorkflowsRequestSchema = z
191
+ .object({
192
+ limit: z.number().optional().describe('Maximum number of workflows to return'),
193
+ offset: z.number().optional().describe('Number of workflows to skip'),
194
+ status: WorkflowStatusSchema.optional().describe('Filter by status'),
195
+ source_type: WorkflowSourceTypeSchema.optional().describe('Filter by source type'),
196
+ filter: z.string().optional().describe('Filter string for workflows'),
197
+ })
198
+ .describe('Request for listing workflows');
199
+
200
+ export type ListWorkflowsRequest = z.infer<typeof ListWorkflowsRequestSchema>;
201
+
202
+ export const WorkflowListResultSchema = z
203
+ .object({
204
+ workflows: z.array(WorkflowSchema).describe('Array of workflows'),
205
+ total: z.number().describe('Total number of workflows'),
206
+ })
207
+ .describe('Result of listing workflows');
208
+
209
+ export type WorkflowListResult = z.infer<typeof WorkflowListResultSchema>;
210
+
211
+ export const WorkflowGetResultSchema = z
212
+ .object({
213
+ workflow: WorkflowSchema.describe('The requested workflow'),
214
+ })
215
+ .describe('Result of getting a single workflow');
216
+
217
+ export type WorkflowGetResult = z.infer<typeof WorkflowGetResultSchema>;
218
+
219
+ export const WorkflowCreateResultSchema = z
220
+ .object({
221
+ workflow: WorkflowSchema.describe('The newly created workflow'),
222
+ })
223
+ .describe('Result of creating a workflow');
224
+
225
+ export type WorkflowCreateResult = z.infer<typeof WorkflowCreateResultSchema>;
226
+
227
+ export const WorkflowUpdateResultSchema = z
228
+ .object({
229
+ workflow: WorkflowSchema.describe('The updated workflow'),
230
+ })
231
+ .describe('Result of updating a workflow');
232
+
233
+ export type WorkflowUpdateResult = z.infer<typeof WorkflowUpdateResultSchema>;