digital-tasks 2.0.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/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +10 -0
- package/dist/function-task.d.ts +319 -0
- package/dist/function-task.d.ts.map +1 -0
- package/dist/function-task.js +286 -0
- package/dist/function-task.js.map +1 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown.d.ts +112 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +510 -0
- package/dist/markdown.js.map +1 -0
- package/dist/project.d.ts +259 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +397 -0
- package/dist/project.js.map +1 -0
- package/dist/queue.d.ts +17 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +347 -0
- package/dist/queue.js.map +1 -0
- package/dist/task.d.ts +69 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +321 -0
- package/dist/task.js.map +1 -0
- package/dist/types.d.ts +292 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/dist/types.js.map +1 -0
- package/package.json +41 -0
- package/src/index.ts +161 -0
- package/src/markdown.ts +622 -0
- package/src/project.ts +571 -0
- package/src/queue.ts +424 -0
- package/src/task.ts +389 -0
- package/src/types.ts +403 -0
- package/test/markdown.test.ts +550 -0
- package/test/project.test.ts +562 -0
- package/test/queue.test.ts +482 -0
- package/test/task.test.ts +464 -0
- package/tsconfig.json +20 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-Task Integration
|
|
3
|
+
*
|
|
4
|
+
* Connects the task system with ai-functions Function definitions.
|
|
5
|
+
* Every task is essentially a function call with typed inputs/outputs.
|
|
6
|
+
*
|
|
7
|
+
* ## Function Types
|
|
8
|
+
*
|
|
9
|
+
* Tasks can execute different function types:
|
|
10
|
+
* - **Code**: Generates executable code
|
|
11
|
+
* - **Generative**: AI generates text/objects (no tools)
|
|
12
|
+
* - **Agentic**: AI with tools in a loop
|
|
13
|
+
* - **Human**: Requires human input/approval
|
|
14
|
+
*
|
|
15
|
+
* ## Data Flow
|
|
16
|
+
*
|
|
17
|
+
* Tasks form a typed DAG where outputs flow to dependent task inputs:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* const workflow = defineWorkflow({
|
|
21
|
+
* name: 'Data Pipeline',
|
|
22
|
+
* tasks: {
|
|
23
|
+
* fetchData: generativeTask({
|
|
24
|
+
* prompt: 'Fetch user data from API',
|
|
25
|
+
* output: z.object({ users: z.array(z.object({ name: z.string() })) }),
|
|
26
|
+
* }),
|
|
27
|
+
* processData: codeTask({
|
|
28
|
+
* input: (ctx) => ctx.outputs.fetchData, // Type-safe reference
|
|
29
|
+
* language: 'typescript',
|
|
30
|
+
* description: 'Filter active users',
|
|
31
|
+
* }),
|
|
32
|
+
* reviewResults: humanTask({
|
|
33
|
+
* input: (ctx) => ctx.outputs.processData,
|
|
34
|
+
* channel: 'slack',
|
|
35
|
+
* instructions: 'Review the processed user list',
|
|
36
|
+
* }),
|
|
37
|
+
* },
|
|
38
|
+
* // Dependencies inferred from input references
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @packageDocumentation
|
|
43
|
+
*/
|
|
44
|
+
import type { FunctionDefinition, AIFunctionDefinition, CodeLanguage, HumanChannel } from 'ai-functions';
|
|
45
|
+
import type { AnyTask, TaskStatus, TaskPriority, WorkerRef } from './types.js';
|
|
46
|
+
/**
|
|
47
|
+
* The type of function that executes this task
|
|
48
|
+
*/
|
|
49
|
+
export type FunctionTaskType = 'code' | 'generative' | 'agentic' | 'human';
|
|
50
|
+
/**
|
|
51
|
+
* Base function task - a task that executes a function
|
|
52
|
+
*/
|
|
53
|
+
export interface FunctionTask<TInput = unknown, TOutput = unknown> {
|
|
54
|
+
/** Task ID */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Task name */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Task description */
|
|
59
|
+
description?: string;
|
|
60
|
+
/** Function type */
|
|
61
|
+
functionType: FunctionTaskType;
|
|
62
|
+
/** Function definition (if pre-defined) */
|
|
63
|
+
functionRef?: string;
|
|
64
|
+
/** Inline function definition */
|
|
65
|
+
definition?: FunctionDefinition<TInput, TOutput>;
|
|
66
|
+
/** Input value or resolver */
|
|
67
|
+
input?: TInput | InputResolver<TInput>;
|
|
68
|
+
/** Expected output type (for type inference) */
|
|
69
|
+
outputType?: TOutput;
|
|
70
|
+
/** Task priority */
|
|
71
|
+
priority?: TaskPriority;
|
|
72
|
+
/** Assigned worker */
|
|
73
|
+
assignTo?: WorkerRef;
|
|
74
|
+
/** Tags */
|
|
75
|
+
tags?: string[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Input resolver - gets input from workflow context
|
|
79
|
+
*/
|
|
80
|
+
export type InputResolver<T> = (context: WorkflowContext) => T | Promise<T>;
|
|
81
|
+
/**
|
|
82
|
+
* Workflow execution context
|
|
83
|
+
*/
|
|
84
|
+
export interface WorkflowContext {
|
|
85
|
+
/** Outputs from completed tasks */
|
|
86
|
+
outputs: Record<string, unknown>;
|
|
87
|
+
/** Get typed output from a specific task */
|
|
88
|
+
getOutput: <T>(taskId: string) => T | undefined;
|
|
89
|
+
/** Workflow metadata */
|
|
90
|
+
metadata: Record<string, unknown>;
|
|
91
|
+
/** Current user/worker */
|
|
92
|
+
worker?: WorkerRef;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Code task - generates executable code
|
|
96
|
+
*/
|
|
97
|
+
export interface CodeTask<TInput = unknown, TOutput = string> extends FunctionTask<TInput, TOutput> {
|
|
98
|
+
functionType: 'code';
|
|
99
|
+
/** Target programming language */
|
|
100
|
+
language?: CodeLanguage;
|
|
101
|
+
/** Code generation instructions */
|
|
102
|
+
instructions?: string;
|
|
103
|
+
/** Include tests */
|
|
104
|
+
includeTests?: boolean;
|
|
105
|
+
/** Include examples */
|
|
106
|
+
includeExamples?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Generative task - AI generates content (no tools)
|
|
110
|
+
*/
|
|
111
|
+
export interface GenerativeTask<TInput = unknown, TOutput = unknown> extends FunctionTask<TInput, TOutput> {
|
|
112
|
+
functionType: 'generative';
|
|
113
|
+
/** Prompt template */
|
|
114
|
+
prompt: string;
|
|
115
|
+
/** System prompt */
|
|
116
|
+
system?: string;
|
|
117
|
+
/** Model to use */
|
|
118
|
+
model?: string;
|
|
119
|
+
/** Temperature */
|
|
120
|
+
temperature?: number;
|
|
121
|
+
/** Output schema (for structured output) */
|
|
122
|
+
outputSchema?: unknown;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Agentic task - AI with tools in a loop
|
|
126
|
+
*/
|
|
127
|
+
export interface AgenticTask<TInput = unknown, TOutput = unknown> extends FunctionTask<TInput, TOutput> {
|
|
128
|
+
functionType: 'agentic';
|
|
129
|
+
/** Agent instructions */
|
|
130
|
+
instructions: string;
|
|
131
|
+
/** Available tools */
|
|
132
|
+
tools?: AIFunctionDefinition[];
|
|
133
|
+
/** Tool names (if using registry) */
|
|
134
|
+
toolNames?: string[];
|
|
135
|
+
/** Maximum iterations */
|
|
136
|
+
maxIterations?: number;
|
|
137
|
+
/** Model to use */
|
|
138
|
+
model?: string;
|
|
139
|
+
/** Stream intermediate results */
|
|
140
|
+
stream?: boolean;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Human task - requires human input
|
|
144
|
+
*/
|
|
145
|
+
export interface HumanTask<TInput = unknown, TOutput = unknown> extends FunctionTask<TInput, TOutput> {
|
|
146
|
+
functionType: 'human';
|
|
147
|
+
/** Interaction channel */
|
|
148
|
+
channel: HumanChannel;
|
|
149
|
+
/** Instructions for the human */
|
|
150
|
+
instructions: string;
|
|
151
|
+
/** Timeout in ms */
|
|
152
|
+
timeout?: number;
|
|
153
|
+
/** Who should handle this */
|
|
154
|
+
assignee?: string;
|
|
155
|
+
/** Expected response schema */
|
|
156
|
+
responseSchema?: unknown;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Union of all function task types
|
|
160
|
+
*/
|
|
161
|
+
export type AnyFunctionTask = CodeTask | GenerativeTask | AgenticTask | HumanTask;
|
|
162
|
+
/**
|
|
163
|
+
* Create a code task
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* const task = codeTask({
|
|
168
|
+
* name: 'Generate API client',
|
|
169
|
+
* language: 'typescript',
|
|
170
|
+
* instructions: 'Generate a type-safe API client from OpenAPI spec',
|
|
171
|
+
* input: { spec: openApiSpec },
|
|
172
|
+
* })
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export declare function codeTask<TInput = unknown, TOutput = string>(options: Omit<CodeTask<TInput, TOutput>, 'id' | 'functionType'>): CodeTask<TInput, TOutput>;
|
|
176
|
+
/**
|
|
177
|
+
* Create a generative task
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* const task = generativeTask({
|
|
182
|
+
* name: 'Summarize document',
|
|
183
|
+
* prompt: 'Summarize the following document: {{document}}',
|
|
184
|
+
* outputSchema: { summary: 'string', keyPoints: ['string'] },
|
|
185
|
+
* })
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
export declare function generativeTask<TInput = unknown, TOutput = unknown>(options: Omit<GenerativeTask<TInput, TOutput>, 'id' | 'functionType'>): GenerativeTask<TInput, TOutput>;
|
|
189
|
+
/**
|
|
190
|
+
* Create an agentic task
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* const task = agenticTask({
|
|
195
|
+
* name: 'Research topic',
|
|
196
|
+
* instructions: 'Research the given topic and compile a report',
|
|
197
|
+
* tools: [searchTool, fetchTool, extractTool],
|
|
198
|
+
* maxIterations: 10,
|
|
199
|
+
* })
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
export declare function agenticTask<TInput = unknown, TOutput = unknown>(options: Omit<AgenticTask<TInput, TOutput>, 'id' | 'functionType'>): AgenticTask<TInput, TOutput>;
|
|
203
|
+
/**
|
|
204
|
+
* Create a human task
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```ts
|
|
208
|
+
* const task = humanTask({
|
|
209
|
+
* name: 'Review PR',
|
|
210
|
+
* channel: 'slack',
|
|
211
|
+
* instructions: 'Review the code changes and approve or request changes',
|
|
212
|
+
* responseSchema: { approved: 'boolean', feedback: 'string' },
|
|
213
|
+
* })
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
export declare function humanTask<TInput = unknown, TOutput = unknown>(options: Omit<HumanTask<TInput, TOutput>, 'id' | 'functionType'>): HumanTask<TInput, TOutput>;
|
|
217
|
+
/**
|
|
218
|
+
* Workflow definition with typed task graph
|
|
219
|
+
*/
|
|
220
|
+
export interface TypedWorkflow<TTasks extends Record<string, AnyFunctionTask> = Record<string, AnyFunctionTask>> {
|
|
221
|
+
/** Workflow ID */
|
|
222
|
+
id: string;
|
|
223
|
+
/** Workflow name */
|
|
224
|
+
name: string;
|
|
225
|
+
/** Workflow description */
|
|
226
|
+
description?: string;
|
|
227
|
+
/** Tasks in the workflow */
|
|
228
|
+
tasks: TTasks;
|
|
229
|
+
/** Explicit dependencies (if not using input resolvers) */
|
|
230
|
+
dependencies?: Array<{
|
|
231
|
+
task: keyof TTasks;
|
|
232
|
+
dependsOn: keyof TTasks | Array<keyof TTasks>;
|
|
233
|
+
}>;
|
|
234
|
+
/** Execution mode for tasks without explicit dependencies */
|
|
235
|
+
defaultMode?: 'parallel' | 'sequential';
|
|
236
|
+
/** Workflow metadata */
|
|
237
|
+
metadata?: Record<string, unknown>;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Options for defining a typed workflow
|
|
241
|
+
*/
|
|
242
|
+
export interface DefineWorkflowOptions<TTasks extends Record<string, AnyFunctionTask>> {
|
|
243
|
+
name: string;
|
|
244
|
+
description?: string;
|
|
245
|
+
tasks: TTasks;
|
|
246
|
+
dependencies?: TypedWorkflow<TTasks>['dependencies'];
|
|
247
|
+
defaultMode?: 'parallel' | 'sequential';
|
|
248
|
+
metadata?: Record<string, unknown>;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Create a typed workflow with automatic dependency inference
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* const contentPipeline = Workflow({
|
|
256
|
+
* name: 'Content Pipeline',
|
|
257
|
+
* tasks: {
|
|
258
|
+
* research: agenticTask({
|
|
259
|
+
* name: 'Research topic',
|
|
260
|
+
* instructions: 'Research AI trends',
|
|
261
|
+
* tools: [searchTool],
|
|
262
|
+
* }),
|
|
263
|
+
* outline: generativeTask({
|
|
264
|
+
* name: 'Create outline',
|
|
265
|
+
* prompt: 'Create outline from research',
|
|
266
|
+
* input: (ctx) => ctx.getOutput('research'),
|
|
267
|
+
* }),
|
|
268
|
+
* draft: generativeTask({
|
|
269
|
+
* name: 'Write draft',
|
|
270
|
+
* prompt: 'Write article from outline',
|
|
271
|
+
* input: (ctx) => ctx.getOutput('outline'),
|
|
272
|
+
* }),
|
|
273
|
+
* review: humanTask({
|
|
274
|
+
* name: 'Review article',
|
|
275
|
+
* channel: 'web',
|
|
276
|
+
* instructions: 'Review and approve the article',
|
|
277
|
+
* input: (ctx) => ctx.getOutput('draft'),
|
|
278
|
+
* }),
|
|
279
|
+
* },
|
|
280
|
+
* })
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
export declare function Workflow<TTasks extends Record<string, AnyFunctionTask>>(options: DefineWorkflowOptions<TTasks>): TypedWorkflow<TTasks>;
|
|
284
|
+
/**
|
|
285
|
+
* Workflow execution state
|
|
286
|
+
*/
|
|
287
|
+
export interface WorkflowExecutionState {
|
|
288
|
+
/** Workflow ID */
|
|
289
|
+
workflowId: string;
|
|
290
|
+
/** Current status */
|
|
291
|
+
status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
292
|
+
/** Task statuses */
|
|
293
|
+
taskStatuses: Record<string, TaskStatus>;
|
|
294
|
+
/** Task outputs */
|
|
295
|
+
outputs: Record<string, unknown>;
|
|
296
|
+
/** Execution context */
|
|
297
|
+
context: WorkflowContext;
|
|
298
|
+
/** Start time */
|
|
299
|
+
startedAt?: Date;
|
|
300
|
+
/** End time */
|
|
301
|
+
completedAt?: Date;
|
|
302
|
+
/** Current task being executed */
|
|
303
|
+
currentTask?: string;
|
|
304
|
+
/** Error if failed */
|
|
305
|
+
error?: string;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Convert a function task to a base Task
|
|
309
|
+
*/
|
|
310
|
+
export declare function functionTaskToTask(functionTask: AnyFunctionTask): Partial<AnyTask>;
|
|
311
|
+
/**
|
|
312
|
+
* Infer dependencies from input resolvers
|
|
313
|
+
*/
|
|
314
|
+
export declare function inferDependencies<TTasks extends Record<string, AnyFunctionTask>>(workflow: TypedWorkflow<TTasks>): Map<string, string[]>;
|
|
315
|
+
/**
|
|
316
|
+
* Get execution order for a workflow (topological sort)
|
|
317
|
+
*/
|
|
318
|
+
export declare function getExecutionOrder<TTasks extends Record<string, AnyFunctionTask>>(workflow: TypedWorkflow<TTasks>): string[][];
|
|
319
|
+
//# sourceMappingURL=function-task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-task.d.ts","sourceRoot":"","sources":["../src/function-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAKlB,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACb,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAEV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AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EAC9E,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAC9B,MAAM,EAAE,EAAE,CAyBZ"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-Task Integration
|
|
3
|
+
*
|
|
4
|
+
* Connects the task system with ai-functions Function definitions.
|
|
5
|
+
* Every task is essentially a function call with typed inputs/outputs.
|
|
6
|
+
*
|
|
7
|
+
* ## Function Types
|
|
8
|
+
*
|
|
9
|
+
* Tasks can execute different function types:
|
|
10
|
+
* - **Code**: Generates executable code
|
|
11
|
+
* - **Generative**: AI generates text/objects (no tools)
|
|
12
|
+
* - **Agentic**: AI with tools in a loop
|
|
13
|
+
* - **Human**: Requires human input/approval
|
|
14
|
+
*
|
|
15
|
+
* ## Data Flow
|
|
16
|
+
*
|
|
17
|
+
* Tasks form a typed DAG where outputs flow to dependent task inputs:
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* const workflow = defineWorkflow({
|
|
21
|
+
* name: 'Data Pipeline',
|
|
22
|
+
* tasks: {
|
|
23
|
+
* fetchData: generativeTask({
|
|
24
|
+
* prompt: 'Fetch user data from API',
|
|
25
|
+
* output: z.object({ users: z.array(z.object({ name: z.string() })) }),
|
|
26
|
+
* }),
|
|
27
|
+
* processData: codeTask({
|
|
28
|
+
* input: (ctx) => ctx.outputs.fetchData, // Type-safe reference
|
|
29
|
+
* language: 'typescript',
|
|
30
|
+
* description: 'Filter active users',
|
|
31
|
+
* }),
|
|
32
|
+
* reviewResults: humanTask({
|
|
33
|
+
* input: (ctx) => ctx.outputs.processData,
|
|
34
|
+
* channel: 'slack',
|
|
35
|
+
* instructions: 'Review the processed user list',
|
|
36
|
+
* }),
|
|
37
|
+
* },
|
|
38
|
+
* // Dependencies inferred from input references
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @packageDocumentation
|
|
43
|
+
*/
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Task Factory Functions
|
|
46
|
+
// ============================================================================
|
|
47
|
+
let taskIdCounter = 0;
|
|
48
|
+
function generateFunctionTaskId() {
|
|
49
|
+
return `ftask_${Date.now()}_${++taskIdCounter}`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a code task
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const task = codeTask({
|
|
57
|
+
* name: 'Generate API client',
|
|
58
|
+
* language: 'typescript',
|
|
59
|
+
* instructions: 'Generate a type-safe API client from OpenAPI spec',
|
|
60
|
+
* input: { spec: openApiSpec },
|
|
61
|
+
* })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export function codeTask(options) {
|
|
65
|
+
return {
|
|
66
|
+
id: generateFunctionTaskId(),
|
|
67
|
+
functionType: 'code',
|
|
68
|
+
...options,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create a generative task
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const task = generativeTask({
|
|
77
|
+
* name: 'Summarize document',
|
|
78
|
+
* prompt: 'Summarize the following document: {{document}}',
|
|
79
|
+
* outputSchema: { summary: 'string', keyPoints: ['string'] },
|
|
80
|
+
* })
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export function generativeTask(options) {
|
|
84
|
+
return {
|
|
85
|
+
id: generateFunctionTaskId(),
|
|
86
|
+
functionType: 'generative',
|
|
87
|
+
...options,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create an agentic task
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const task = agenticTask({
|
|
96
|
+
* name: 'Research topic',
|
|
97
|
+
* instructions: 'Research the given topic and compile a report',
|
|
98
|
+
* tools: [searchTool, fetchTool, extractTool],
|
|
99
|
+
* maxIterations: 10,
|
|
100
|
+
* })
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export function agenticTask(options) {
|
|
104
|
+
return {
|
|
105
|
+
id: generateFunctionTaskId(),
|
|
106
|
+
functionType: 'agentic',
|
|
107
|
+
...options,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Create a human task
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const task = humanTask({
|
|
116
|
+
* name: 'Review PR',
|
|
117
|
+
* channel: 'slack',
|
|
118
|
+
* instructions: 'Review the code changes and approve or request changes',
|
|
119
|
+
* responseSchema: { approved: 'boolean', feedback: 'string' },
|
|
120
|
+
* })
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export function humanTask(options) {
|
|
124
|
+
return {
|
|
125
|
+
id: generateFunctionTaskId(),
|
|
126
|
+
functionType: 'human',
|
|
127
|
+
...options,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Create a typed workflow with automatic dependency inference
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* const contentPipeline = Workflow({
|
|
136
|
+
* name: 'Content Pipeline',
|
|
137
|
+
* tasks: {
|
|
138
|
+
* research: agenticTask({
|
|
139
|
+
* name: 'Research topic',
|
|
140
|
+
* instructions: 'Research AI trends',
|
|
141
|
+
* tools: [searchTool],
|
|
142
|
+
* }),
|
|
143
|
+
* outline: generativeTask({
|
|
144
|
+
* name: 'Create outline',
|
|
145
|
+
* prompt: 'Create outline from research',
|
|
146
|
+
* input: (ctx) => ctx.getOutput('research'),
|
|
147
|
+
* }),
|
|
148
|
+
* draft: generativeTask({
|
|
149
|
+
* name: 'Write draft',
|
|
150
|
+
* prompt: 'Write article from outline',
|
|
151
|
+
* input: (ctx) => ctx.getOutput('outline'),
|
|
152
|
+
* }),
|
|
153
|
+
* review: humanTask({
|
|
154
|
+
* name: 'Review article',
|
|
155
|
+
* channel: 'web',
|
|
156
|
+
* instructions: 'Review and approve the article',
|
|
157
|
+
* input: (ctx) => ctx.getOutput('draft'),
|
|
158
|
+
* }),
|
|
159
|
+
* },
|
|
160
|
+
* })
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
export function Workflow(options) {
|
|
164
|
+
return {
|
|
165
|
+
id: `wf_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
|
|
166
|
+
name: options.name,
|
|
167
|
+
description: options.description,
|
|
168
|
+
tasks: options.tasks,
|
|
169
|
+
dependencies: options.dependencies,
|
|
170
|
+
defaultMode: options.defaultMode || 'sequential',
|
|
171
|
+
metadata: options.metadata,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Convert function task type to base task type
|
|
176
|
+
*/
|
|
177
|
+
function functionTypeToTaskType(functionType) {
|
|
178
|
+
switch (functionType) {
|
|
179
|
+
case 'code':
|
|
180
|
+
return 'generation';
|
|
181
|
+
case 'generative':
|
|
182
|
+
return 'generation';
|
|
183
|
+
case 'agentic':
|
|
184
|
+
return 'research';
|
|
185
|
+
case 'human':
|
|
186
|
+
return 'approval';
|
|
187
|
+
default:
|
|
188
|
+
return 'action';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Convert a function task to a base Task
|
|
193
|
+
*/
|
|
194
|
+
export function functionTaskToTask(functionTask) {
|
|
195
|
+
return {
|
|
196
|
+
title: functionTask.name,
|
|
197
|
+
description: functionTask.description,
|
|
198
|
+
type: functionTypeToTaskType(functionTask.functionType),
|
|
199
|
+
priority: functionTask.priority || 'normal',
|
|
200
|
+
tags: functionTask.tags,
|
|
201
|
+
allowedWorkers: functionTask.functionType === 'human'
|
|
202
|
+
? ['human']
|
|
203
|
+
: functionTask.functionType === 'agentic'
|
|
204
|
+
? ['agent']
|
|
205
|
+
: ['any'],
|
|
206
|
+
metadata: {
|
|
207
|
+
_functionTaskId: functionTask.id,
|
|
208
|
+
_functionType: functionTask.functionType,
|
|
209
|
+
_functionDefinition: functionTask.definition,
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Infer dependencies from input resolvers
|
|
215
|
+
*/
|
|
216
|
+
export function inferDependencies(workflow) {
|
|
217
|
+
const dependencies = new Map();
|
|
218
|
+
const taskIds = Object.keys(workflow.tasks);
|
|
219
|
+
for (const [taskId, task] of Object.entries(workflow.tasks)) {
|
|
220
|
+
const deps = [];
|
|
221
|
+
// Check if input is a resolver function
|
|
222
|
+
if (typeof task.input === 'function') {
|
|
223
|
+
// Create a mock context to track which outputs are accessed
|
|
224
|
+
const accessedOutputs = [];
|
|
225
|
+
const mockContext = {
|
|
226
|
+
outputs: new Proxy({}, {
|
|
227
|
+
get(_, prop) {
|
|
228
|
+
if (typeof prop === 'string' && taskIds.includes(prop)) {
|
|
229
|
+
accessedOutputs.push(prop);
|
|
230
|
+
}
|
|
231
|
+
return undefined;
|
|
232
|
+
},
|
|
233
|
+
}),
|
|
234
|
+
getOutput: (id) => {
|
|
235
|
+
if (taskIds.includes(id)) {
|
|
236
|
+
accessedOutputs.push(id);
|
|
237
|
+
}
|
|
238
|
+
return undefined;
|
|
239
|
+
},
|
|
240
|
+
metadata: {},
|
|
241
|
+
};
|
|
242
|
+
try {
|
|
243
|
+
// Call the resolver to detect accessed outputs
|
|
244
|
+
;
|
|
245
|
+
task.input(mockContext);
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
// Resolver may throw if outputs are not available, that's ok
|
|
249
|
+
}
|
|
250
|
+
deps.push(...accessedOutputs);
|
|
251
|
+
}
|
|
252
|
+
// Add explicit dependencies
|
|
253
|
+
const explicit = workflow.dependencies?.find(d => d.task === taskId);
|
|
254
|
+
if (explicit) {
|
|
255
|
+
const explicitDeps = Array.isArray(explicit.dependsOn)
|
|
256
|
+
? explicit.dependsOn
|
|
257
|
+
: [explicit.dependsOn];
|
|
258
|
+
deps.push(...explicitDeps);
|
|
259
|
+
}
|
|
260
|
+
dependencies.set(taskId, [...new Set(deps)]);
|
|
261
|
+
}
|
|
262
|
+
return dependencies;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get execution order for a workflow (topological sort)
|
|
266
|
+
*/
|
|
267
|
+
export function getExecutionOrder(workflow) {
|
|
268
|
+
const dependencies = inferDependencies(workflow);
|
|
269
|
+
const taskIds = Object.keys(workflow.tasks);
|
|
270
|
+
const result = [];
|
|
271
|
+
const completed = new Set();
|
|
272
|
+
while (completed.size < taskIds.length) {
|
|
273
|
+
// Find tasks whose dependencies are all completed
|
|
274
|
+
const ready = taskIds.filter(id => !completed.has(id) &&
|
|
275
|
+
(dependencies.get(id) || []).every(dep => completed.has(dep)));
|
|
276
|
+
if (ready.length === 0 && completed.size < taskIds.length) {
|
|
277
|
+
throw new Error('Circular dependency detected in workflow');
|
|
278
|
+
}
|
|
279
|
+
// Group ready tasks (can run in parallel)
|
|
280
|
+
result.push(ready);
|
|
281
|
+
// Mark as completed
|
|
282
|
+
ready.forEach(id => completed.add(id));
|
|
283
|
+
}
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=function-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-task.js","sourceRoot":"","sources":["../src/function-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAkKH,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E,IAAI,aAAa,GAAG,CAAC,CAAA;AAErB,SAAS,sBAAsB;IAC7B,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,CAAA;AACjD,CAAC;AAED;;;;;;;;;;;;GAYG;A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