@n1k1t/pipelain 0.1.0 → 0.1.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/lib/src/env.d.ts +20 -0
- package/lib/src/env.d.ts.map +1 -0
- package/lib/src/env.js +36 -0
- package/lib/src/env.js.map +1 -0
- package/lib/src/index.d.ts +22 -0
- package/lib/src/index.d.ts.map +1 -0
- package/lib/src/index.js +61 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/models/bash.d.ts +27 -0
- package/lib/src/models/bash.d.ts.map +1 -0
- package/lib/src/models/bash.js +59 -0
- package/lib/src/models/bash.js.map +1 -0
- package/lib/src/models/content/factory.d.ts +36 -0
- package/lib/src/models/content/factory.d.ts.map +1 -0
- package/lib/src/models/content/factory.js +104 -0
- package/lib/src/models/content/factory.js.map +1 -0
- package/lib/src/models/content/index.d.ts +4 -0
- package/lib/src/models/content/index.d.ts.map +1 -0
- package/lib/src/models/content/index.js +20 -0
- package/lib/src/models/content/index.js.map +1 -0
- package/lib/src/models/content/kinds/article.d.ts +12 -0
- package/lib/src/models/content/kinds/article.d.ts.map +1 -0
- package/lib/src/models/content/kinds/article.js +20 -0
- package/lib/src/models/content/kinds/article.js.map +1 -0
- package/lib/src/models/content/kinds/attachment.d.ts +14 -0
- package/lib/src/models/content/kinds/attachment.d.ts.map +1 -0
- package/lib/src/models/content/kinds/attachment.js +30 -0
- package/lib/src/models/content/kinds/attachment.js.map +1 -0
- package/lib/src/models/content/kinds/group.d.ts +7 -0
- package/lib/src/models/content/kinds/group.d.ts.map +1 -0
- package/lib/src/models/content/kinds/group.js +23 -0
- package/lib/src/models/content/kinds/group.js.map +1 -0
- package/lib/src/models/content/kinds/index.d.ts +8 -0
- package/lib/src/models/content/kinds/index.d.ts.map +1 -0
- package/lib/src/models/content/kinds/index.js +24 -0
- package/lib/src/models/content/kinds/index.js.map +1 -0
- package/lib/src/models/content/kinds/model.d.ts +10 -0
- package/lib/src/models/content/kinds/model.d.ts.map +1 -0
- package/lib/src/models/content/kinds/model.js +11 -0
- package/lib/src/models/content/kinds/model.js.map +1 -0
- package/lib/src/models/content/kinds/plain.d.ts +6 -0
- package/lib/src/models/content/kinds/plain.d.ts.map +1 -0
- package/lib/src/models/content/kinds/plain.js +18 -0
- package/lib/src/models/content/kinds/plain.js.map +1 -0
- package/lib/src/models/content/kinds/rules.d.ts +6 -0
- package/lib/src/models/content/kinds/rules.d.ts.map +1 -0
- package/lib/src/models/content/kinds/rules.js +19 -0
- package/lib/src/models/content/kinds/rules.js.map +1 -0
- package/lib/src/models/content/kinds/sources.d.ts +10 -0
- package/lib/src/models/content/kinds/sources.d.ts.map +1 -0
- package/lib/src/models/content/kinds/sources.js +22 -0
- package/lib/src/models/content/kinds/sources.js.map +1 -0
- package/lib/src/models/content/kinds/tasks.d.ts +6 -0
- package/lib/src/models/content/kinds/tasks.d.ts.map +1 -0
- package/lib/src/models/content/kinds/tasks.js +19 -0
- package/lib/src/models/content/kinds/tasks.js.map +1 -0
- package/lib/src/models/file.d.ts +34 -0
- package/lib/src/models/file.d.ts.map +1 -0
- package/lib/src/models/file.js +101 -0
- package/lib/src/models/file.js.map +1 -0
- package/lib/src/models/index.d.ts +9 -0
- package/lib/src/models/index.d.ts.map +1 -0
- package/lib/src/models/index.js +25 -0
- package/lib/src/models/index.js.map +1 -0
- package/lib/src/models/llm/factory.d.ts +43 -0
- package/lib/src/models/llm/factory.d.ts.map +1 -0
- package/lib/src/models/llm/factory.js +134 -0
- package/lib/src/models/llm/factory.js.map +1 -0
- package/lib/src/models/llm/index.d.ts +9 -0
- package/lib/src/models/llm/index.d.ts.map +1 -0
- package/lib/src/models/llm/index.js +25 -0
- package/lib/src/models/llm/index.js.map +1 -0
- package/lib/src/models/llm/mcp.d.ts +30 -0
- package/lib/src/models/llm/mcp.d.ts.map +1 -0
- package/lib/src/models/llm/mcp.js +53 -0
- package/lib/src/models/llm/mcp.js.map +1 -0
- package/lib/src/models/llm/providers/anthropic.d.ts +15 -0
- package/lib/src/models/llm/providers/anthropic.d.ts.map +1 -0
- package/lib/src/models/llm/providers/anthropic.js +39 -0
- package/lib/src/models/llm/providers/anthropic.js.map +1 -0
- package/lib/src/models/llm/providers/google.d.ts +11 -0
- package/lib/src/models/llm/providers/google.d.ts.map +1 -0
- package/lib/src/models/llm/providers/google.js +39 -0
- package/lib/src/models/llm/providers/google.js.map +1 -0
- package/lib/src/models/llm/providers/index.d.ts +6 -0
- package/lib/src/models/llm/providers/index.d.ts.map +1 -0
- package/lib/src/models/llm/providers/index.js +22 -0
- package/lib/src/models/llm/providers/index.js.map +1 -0
- package/lib/src/models/llm/providers/mistral.d.ts +10 -0
- package/lib/src/models/llm/providers/mistral.d.ts.map +1 -0
- package/lib/src/models/llm/providers/mistral.js +31 -0
- package/lib/src/models/llm/providers/mistral.js.map +1 -0
- package/lib/src/models/llm/providers/model.d.ts +37 -0
- package/lib/src/models/llm/providers/model.d.ts.map +1 -0
- package/lib/src/models/llm/providers/model.js +47 -0
- package/lib/src/models/llm/providers/model.js.map +1 -0
- package/lib/src/models/llm/providers/openai.d.ts +12 -0
- package/lib/src/models/llm/providers/openai.d.ts.map +1 -0
- package/lib/src/models/llm/providers/openai.js +36 -0
- package/lib/src/models/llm/providers/openai.js.map +1 -0
- package/lib/src/models/llm/providers/proxy.d.ts +10 -0
- package/lib/src/models/llm/providers/proxy.d.ts.map +1 -0
- package/lib/src/models/llm/providers/proxy.js +31 -0
- package/lib/src/models/llm/providers/proxy.js.map +1 -0
- package/lib/src/models/llm/router.d.ts +15 -0
- package/lib/src/models/llm/router.d.ts.map +1 -0
- package/lib/src/models/llm/router.js +86 -0
- package/lib/src/models/llm/router.js.map +1 -0
- package/lib/src/models/llm/tools/edit.d.ts +17 -0
- package/lib/src/models/llm/tools/edit.d.ts.map +1 -0
- package/lib/src/models/llm/tools/edit.js +59 -0
- package/lib/src/models/llm/tools/edit.js.map +1 -0
- package/lib/src/models/llm/tools/fetch.d.ts +12 -0
- package/lib/src/models/llm/tools/fetch.d.ts.map +1 -0
- package/lib/src/models/llm/tools/fetch.js +131 -0
- package/lib/src/models/llm/tools/fetch.js.map +1 -0
- package/lib/src/models/llm/tools/glob.d.ts +10 -0
- package/lib/src/models/llm/tools/glob.d.ts.map +1 -0
- package/lib/src/models/llm/tools/glob.js +36 -0
- package/lib/src/models/llm/tools/glob.js.map +1 -0
- package/lib/src/models/llm/tools/grep.d.ts +12 -0
- package/lib/src/models/llm/tools/grep.d.ts.map +1 -0
- package/lib/src/models/llm/tools/grep.js +69 -0
- package/lib/src/models/llm/tools/grep.js.map +1 -0
- package/lib/src/models/llm/tools/index.d.ts +14 -0
- package/lib/src/models/llm/tools/index.d.ts.map +1 -0
- package/lib/src/models/llm/tools/index.js +33 -0
- package/lib/src/models/llm/tools/index.js.map +1 -0
- package/lib/src/models/llm/tools/ls.d.ts +10 -0
- package/lib/src/models/llm/tools/ls.d.ts.map +1 -0
- package/lib/src/models/llm/tools/ls.js +45 -0
- package/lib/src/models/llm/tools/ls.js.map +1 -0
- package/lib/src/models/llm/tools/mkdir.d.ts +10 -0
- package/lib/src/models/llm/tools/mkdir.d.ts.map +1 -0
- package/lib/src/models/llm/tools/mkdir.js +29 -0
- package/lib/src/models/llm/tools/mkdir.js.map +1 -0
- package/lib/src/models/llm/tools/model.d.ts +55 -0
- package/lib/src/models/llm/tools/model.d.ts.map +1 -0
- package/lib/src/models/llm/tools/model.js +76 -0
- package/lib/src/models/llm/tools/model.js.map +1 -0
- package/lib/src/models/llm/tools/npm.d.ts +10 -0
- package/lib/src/models/llm/tools/npm.d.ts.map +1 -0
- package/lib/src/models/llm/tools/npm.js +25 -0
- package/lib/src/models/llm/tools/npm.js.map +1 -0
- package/lib/src/models/llm/tools/npx.d.ts +10 -0
- package/lib/src/models/llm/tools/npx.d.ts.map +1 -0
- package/lib/src/models/llm/tools/npx.js +25 -0
- package/lib/src/models/llm/tools/npx.js.map +1 -0
- package/lib/src/models/llm/tools/read.d.ts +12 -0
- package/lib/src/models/llm/tools/read.d.ts.map +1 -0
- package/lib/src/models/llm/tools/read.js +68 -0
- package/lib/src/models/llm/tools/read.js.map +1 -0
- package/lib/src/models/llm/tools/rm.d.ts +13 -0
- package/lib/src/models/llm/tools/rm.d.ts.map +1 -0
- package/lib/src/models/llm/tools/rm.js +40 -0
- package/lib/src/models/llm/tools/rm.js.map +1 -0
- package/lib/src/models/llm/tools/search.d.ts +14 -0
- package/lib/src/models/llm/tools/search.d.ts.map +1 -0
- package/lib/src/models/llm/tools/search.js +95 -0
- package/lib/src/models/llm/tools/search.js.map +1 -0
- package/lib/src/models/llm/tools/skill.d.ts +10 -0
- package/lib/src/models/llm/tools/skill.d.ts.map +1 -0
- package/lib/src/models/llm/tools/skill.js +31 -0
- package/lib/src/models/llm/tools/skill.js.map +1 -0
- package/lib/src/models/llm/tools/utils.d.ts +3 -0
- package/lib/src/models/llm/tools/utils.d.ts.map +1 -0
- package/lib/src/models/llm/tools/utils.js +28 -0
- package/lib/src/models/llm/tools/utils.js.map +1 -0
- package/lib/src/models/llm/tools/write.d.ts +14 -0
- package/lib/src/models/llm/tools/write.d.ts.map +1 -0
- package/lib/src/models/llm/tools/write.js +39 -0
- package/lib/src/models/llm/tools/write.js.map +1 -0
- package/lib/src/models/llm/types.d.ts +9 -0
- package/lib/src/models/llm/types.d.ts.map +1 -0
- package/lib/src/models/llm/types.js +5 -0
- package/lib/src/models/llm/types.js.map +1 -0
- package/lib/src/models/pipeline/context.d.ts +23 -0
- package/lib/src/models/pipeline/context.d.ts.map +1 -0
- package/lib/src/models/pipeline/context.js +49 -0
- package/lib/src/models/pipeline/context.js.map +1 -0
- package/lib/src/models/pipeline/factory.d.ts +22 -0
- package/lib/src/models/pipeline/factory.d.ts.map +1 -0
- package/lib/src/models/pipeline/factory.js +39 -0
- package/lib/src/models/pipeline/factory.js.map +1 -0
- package/lib/src/models/pipeline/index.d.ts +8 -0
- package/lib/src/models/pipeline/index.d.ts.map +1 -0
- package/lib/src/models/pipeline/index.js +24 -0
- package/lib/src/models/pipeline/index.js.map +1 -0
- package/lib/src/models/pipeline/model.d.ts +72 -0
- package/lib/src/models/pipeline/model.d.ts.map +1 -0
- package/lib/src/models/pipeline/model.js +138 -0
- package/lib/src/models/pipeline/model.js.map +1 -0
- package/lib/src/models/pipeline/parameters.d.ts +26 -0
- package/lib/src/models/pipeline/parameters.d.ts.map +1 -0
- package/lib/src/models/pipeline/parameters.js +31 -0
- package/lib/src/models/pipeline/parameters.js.map +1 -0
- package/lib/src/models/pipeline/session.d.ts +61 -0
- package/lib/src/models/pipeline/session.d.ts.map +1 -0
- package/lib/src/models/pipeline/session.js +26 -0
- package/lib/src/models/pipeline/session.js.map +1 -0
- package/lib/src/models/pipeline/stdout/compiled/console.d.ts +4 -0
- package/lib/src/models/pipeline/stdout/compiled/console.d.ts.map +1 -0
- package/lib/src/models/pipeline/stdout/compiled/console.js +71 -0
- package/lib/src/models/pipeline/stdout/compiled/console.js.map +1 -0
- package/lib/src/models/pipeline/stdout/compiled/index.d.ts +2 -0
- package/lib/src/models/pipeline/stdout/compiled/index.d.ts.map +1 -0
- package/lib/src/models/pipeline/stdout/compiled/index.js +9 -0
- package/lib/src/models/pipeline/stdout/compiled/index.js.map +1 -0
- package/lib/src/models/pipeline/stdout/index.d.ts +2 -0
- package/lib/src/models/pipeline/stdout/index.d.ts.map +1 -0
- package/lib/src/models/pipeline/stdout/index.js +18 -0
- package/lib/src/models/pipeline/stdout/index.js.map +1 -0
- package/lib/src/models/pipeline/stdout/model.d.ts +16 -0
- package/lib/src/models/pipeline/stdout/model.d.ts.map +1 -0
- package/lib/src/models/pipeline/stdout/model.js +32 -0
- package/lib/src/models/pipeline/stdout/model.js.map +1 -0
- package/lib/src/models/pipeline/steps/ai.d.ts +40 -0
- package/lib/src/models/pipeline/steps/ai.d.ts.map +1 -0
- package/lib/src/models/pipeline/steps/ai.js +538 -0
- package/lib/src/models/pipeline/steps/ai.js.map +1 -0
- package/lib/src/models/pipeline/steps/errors.d.ts +5 -0
- package/lib/src/models/pipeline/steps/errors.d.ts.map +1 -0
- package/lib/src/models/pipeline/steps/errors.js +10 -0
- package/lib/src/models/pipeline/steps/errors.js.map +1 -0
- package/lib/src/models/pipeline/steps/index.d.ts +7 -0
- package/lib/src/models/pipeline/steps/index.d.ts.map +1 -0
- package/lib/src/models/pipeline/steps/index.js +23 -0
- package/lib/src/models/pipeline/steps/index.js.map +1 -0
- package/lib/src/models/pipeline/steps/loop.d.ts +68 -0
- package/lib/src/models/pipeline/steps/loop.d.ts.map +1 -0
- package/lib/src/models/pipeline/steps/loop.js +96 -0
- package/lib/src/models/pipeline/steps/loop.js.map +1 -0
- package/lib/src/models/pipeline/steps/model.d.ts +28 -0
- package/lib/src/models/pipeline/steps/model.d.ts.map +1 -0
- package/lib/src/models/pipeline/steps/model.js +25 -0
- package/lib/src/models/pipeline/steps/model.js.map +1 -0
- package/lib/src/models/pipeline/steps/self.d.ts +25 -0
- package/lib/src/models/pipeline/steps/self.d.ts.map +1 -0
- package/lib/src/models/pipeline/steps/self.js +62 -0
- package/lib/src/models/pipeline/steps/self.js.map +1 -0
- package/lib/src/models/pipeline/steps/swarm.d.ts +25 -0
- package/lib/src/models/pipeline/steps/swarm.d.ts.map +1 -0
- package/lib/src/models/pipeline/steps/swarm.js +68 -0
- package/lib/src/models/pipeline/steps/swarm.js.map +1 -0
- package/lib/src/models/pipeline/steps/types.d.ts +6 -0
- package/lib/src/models/pipeline/steps/types.d.ts.map +1 -0
- package/lib/src/models/pipeline/steps/types.js +3 -0
- package/lib/src/models/pipeline/steps/types.js.map +1 -0
- package/lib/src/models/pipeline/types.d.ts +22 -0
- package/lib/src/models/pipeline/types.d.ts.map +1 -0
- package/lib/src/models/pipeline/types.js +3 -0
- package/lib/src/models/pipeline/types.js.map +1 -0
- package/lib/src/models/project.d.ts +29 -0
- package/lib/src/models/project.d.ts.map +1 -0
- package/lib/src/models/project.js +117 -0
- package/lib/src/models/project.js.map +1 -0
- package/lib/src/models/rg.d.ts +268 -0
- package/lib/src/models/rg.d.ts.map +1 -0
- package/lib/src/models/rg.js +154 -0
- package/lib/src/models/rg.js.map +1 -0
- package/lib/src/models/vfs.d.ts +11 -0
- package/lib/src/models/vfs.d.ts.map +1 -0
- package/lib/src/models/vfs.js +23 -0
- package/lib/src/models/vfs.js.map +1 -0
- package/lib/src/opentelemetry.d.ts +2 -0
- package/lib/src/opentelemetry.d.ts.map +1 -0
- package/lib/src/opentelemetry.js +19 -0
- package/lib/src/opentelemetry.js.map +1 -0
- package/lib/src/setup.d.ts +2 -0
- package/lib/src/setup.d.ts.map +1 -0
- package/lib/src/setup.js +25 -0
- package/lib/src/setup.js.map +1 -0
- package/lib/src/utils/common.d.ts +81 -0
- package/lib/src/utils/common.d.ts.map +1 -0
- package/lib/src/utils/common.js +133 -0
- package/lib/src/utils/common.js.map +1 -0
- package/lib/src/utils/index.d.ts +3 -0
- package/lib/src/utils/index.d.ts.map +1 -0
- package/lib/src/utils/index.js +19 -0
- package/lib/src/utils/index.js.map +1 -0
- package/lib/src/utils/meta.d.ts +9 -0
- package/lib/src/utils/meta.d.ts.map +1 -0
- package/lib/src/utils/meta.js +15 -0
- package/lib/src/utils/meta.js.map +1 -0
- package/lib/types/common.d.ts +73 -0
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/common.js +3 -0
- package/lib/types/common.js.map +1 -0
- package/lib/types/html-to-markdown.global.d.ts +6 -0
- package/lib/types/html-to-markdown.global.d.ts.map +1 -0
- package/lib/types/html-to-markdown.global.js +2 -0
- package/lib/types/html-to-markdown.global.js.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +18 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/json2md.global.d.ts +14 -0
- package/lib/types/json2md.global.d.ts.map +1 -0
- package/lib/types/json2md.global.js +4 -0
- package/lib/types/json2md.global.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { IPipelineConfiguration, TPipelineContentPredicate } from '../types';
|
|
2
|
+
import type { PipelineCompiler } from '../model';
|
|
3
|
+
import type { TFunction } from '../../../../types';
|
|
4
|
+
import { IPipelineStepDefinition, IPipelineStepSource, PipelineStep, PipelineStepCompiler } from './model';
|
|
5
|
+
import { PipelineParameters } from '../parameters';
|
|
6
|
+
export type TPipelineLoopStepVerdictStatus = 'initial' | 'fulfilled' | 'pending' | 'rejected' | 'voided';
|
|
7
|
+
export type TPipelineLoopStepSchema<K extends TPipelineLoopStepVerdictStatus = TPipelineLoopStepVerdictStatus, TValue = any> = {
|
|
8
|
+
initial: {
|
|
9
|
+
status: 'initial';
|
|
10
|
+
value: null;
|
|
11
|
+
};
|
|
12
|
+
fulfilled: {
|
|
13
|
+
status: 'fulfilled';
|
|
14
|
+
value: TValue;
|
|
15
|
+
};
|
|
16
|
+
pending: {
|
|
17
|
+
status: 'pending';
|
|
18
|
+
value: TValue;
|
|
19
|
+
};
|
|
20
|
+
rejected: {
|
|
21
|
+
status: 'rejected';
|
|
22
|
+
reason: Error;
|
|
23
|
+
};
|
|
24
|
+
voided: {
|
|
25
|
+
status: 'voided';
|
|
26
|
+
value: null;
|
|
27
|
+
};
|
|
28
|
+
}[K];
|
|
29
|
+
export type TPipelineLoopStepConditionVerdict = Pick<TPipelineLoopStepSchema<'fulfilled' | 'voided'>, 'status'> | Pick<TPipelineLoopStepSchema<'pending'>, 'status'> & {
|
|
30
|
+
content?: TPipelineContentPredicate;
|
|
31
|
+
};
|
|
32
|
+
export type TPipelineLoopStepActionVerdict = Pick<TPipelineLoopStepSchema<'initial' | 'pending'>, 'status'> & {
|
|
33
|
+
content?: TPipelineContentPredicate;
|
|
34
|
+
};
|
|
35
|
+
export type TPipelineLoopStepConditionHandler<TConfiguration extends IPipelineConfiguration = any, TResult = any> = TFunction<TPipelineLoopStepConditionVerdict | Promise<TPipelineLoopStepConditionVerdict>, [
|
|
36
|
+
Omit<PipelineParameters<TConfiguration>, 'factory'> & {
|
|
37
|
+
result: TResult;
|
|
38
|
+
}
|
|
39
|
+
]>;
|
|
40
|
+
export type TPipelineLoopStepActionHandler<TConfiguration extends IPipelineConfiguration = any, TCompiler extends PipelineStepCompiler | PipelineCompiler = PipelineStepCompiler | PipelineCompiler> = TFunction<TCompiler | Promise<TCompiler>, [
|
|
41
|
+
PipelineParameters<TConfiguration> & {
|
|
42
|
+
verdict: TPipelineLoopStepActionVerdict;
|
|
43
|
+
iteration: number;
|
|
44
|
+
}
|
|
45
|
+
]>;
|
|
46
|
+
interface IDefinition<TConfiguration extends IPipelineConfiguration, TValue = any> extends IPipelineStepDefinition {
|
|
47
|
+
condition: TPipelineLoopStepConditionHandler<TConfiguration, TValue>;
|
|
48
|
+
action: TPipelineLoopStepActionHandler<TConfiguration>;
|
|
49
|
+
limit?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare class PipelineLoopStepCompiler<TConfiguration extends IPipelineConfiguration = any, TValue = any, TSchema extends TPipelineLoopStepSchema<TPipelineLoopStepVerdictStatus, TValue> = TPipelineLoopStepSchema<TPipelineLoopStepVerdictStatus, TValue>> extends PipelineStepCompiler<TSchema> {
|
|
52
|
+
private definition;
|
|
53
|
+
private type;
|
|
54
|
+
constructor(definition: Partial<IDefinition<TConfiguration>>);
|
|
55
|
+
/** Provides limit for a loop */
|
|
56
|
+
limit(value: number): this;
|
|
57
|
+
/** Provides condition executor that signals when loop should be stopped */
|
|
58
|
+
condition(handler: TPipelineLoopStepConditionHandler<TConfiguration, TValue>): this;
|
|
59
|
+
/** Provides action steps or pipelines to execute in a loop */
|
|
60
|
+
action<T extends PipelineStepCompiler | PipelineCompiler, TReturn extends PipelineLoopStepCompiler<TConfiguration, T['TSchema'], TPipelineLoopStepSchema<TPipelineLoopStepVerdictStatus, T['TSchema']>>>(handler: TPipelineLoopStepActionHandler<TConfiguration, T>): TReturn;
|
|
61
|
+
compile(provided: IPipelineStepSource): PipelineLoopStep<TConfiguration, TSchema>;
|
|
62
|
+
static build<TConfiguration extends IPipelineConfiguration, TSchema extends TPipelineLoopStepSchema>(title?: string): PipelineLoopStepCompiler<TConfiguration, TSchema>;
|
|
63
|
+
}
|
|
64
|
+
export declare class PipelineLoopStep<TConfiguration extends IPipelineConfiguration = any, TSchema extends TPipelineLoopStepSchema = TPipelineLoopStepSchema> extends PipelineStep<'loop', TConfiguration, TSchema, IDefinition<TConfiguration>> {
|
|
65
|
+
run(parameters: PipelineParameters<TConfiguration>): Promise<TSchema>;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG3G,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,8BAA8B,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEzG,MAAM,MAAM,uBAAuB,CACjC,CAAC,SAAS,8BAA8B,GAAG,8BAA8B,EACzE,MAAM,GAAG,GAAG,IACV;IACF,OAAO,EAAE;QACP,MAAM,EAAE,SAAS,CAAC;QAClB,KAAK,EAAE,IAAI,CAAC;KACb,CAAC;IAEF,SAAS,EAAE;QACT,MAAM,EAAE,WAAW,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,OAAO,EAAE;QACP,MAAM,EAAE,S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M,GACb,wBAAwB,CAAC,cAAc,EAAE,OAAO,CAAC;CAGrD;AAED,qBAAa,gBAAgB,CAC3B,cAAc,SAAS,sBAAsB,GAAG,GAAG,EACnD,OAAO,SAAS,uBAAuB,GAAG,uBAAuB,CACjE,SAAQ,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACrE,GAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAsDnF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PipelineLoopStep = exports.PipelineLoopStepCompiler = void 0;
|
|
4
|
+
const model_1 = require("./model");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
class PipelineLoopStepCompiler extends model_1.PipelineStepCompiler {
|
|
8
|
+
constructor(definition) {
|
|
9
|
+
super();
|
|
10
|
+
this.definition = definition;
|
|
11
|
+
this.type = 'loop';
|
|
12
|
+
}
|
|
13
|
+
/** Provides limit for a loop */
|
|
14
|
+
limit(value) {
|
|
15
|
+
this.definition.limit = value;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
/** Provides condition executor that signals when loop should be stopped */
|
|
19
|
+
condition(handler) {
|
|
20
|
+
this.definition.condition = handler;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
/** Provides action steps or pipelines to execute in a loop */
|
|
24
|
+
action(handler) {
|
|
25
|
+
this.definition.action = handler;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
compile(provided) {
|
|
29
|
+
if (!this.definition.condition) {
|
|
30
|
+
throw new errors_1.PipelineStepCompilationError(this.type, '[condition] is missing');
|
|
31
|
+
}
|
|
32
|
+
if (!this.definition.action) {
|
|
33
|
+
throw new errors_1.PipelineStepCompilationError(this.type, '[action] is missing');
|
|
34
|
+
}
|
|
35
|
+
return new PipelineLoopStep(this.type, {
|
|
36
|
+
title: this.definition.title,
|
|
37
|
+
condition: this.definition.condition,
|
|
38
|
+
action: this.definition.action,
|
|
39
|
+
pipeline: provided.pipeline,
|
|
40
|
+
parent: provided.parent,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
static build(title) {
|
|
44
|
+
return new PipelineLoopStepCompiler({ title });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.PipelineLoopStepCompiler = PipelineLoopStepCompiler;
|
|
48
|
+
class PipelineLoopStep extends model_1.PipelineStep {
|
|
49
|
+
async run(parameters) {
|
|
50
|
+
const meta = (0, utils_1.buildMetaManager)();
|
|
51
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.init() });
|
|
52
|
+
try {
|
|
53
|
+
const limit = this.definition.limit ?? 5;
|
|
54
|
+
const verdict = {
|
|
55
|
+
status: 'initial',
|
|
56
|
+
};
|
|
57
|
+
for (let i = 0; i < limit; i++) {
|
|
58
|
+
const action = await this.definition.action(parameters.extend({ verdict, iteration: i }));
|
|
59
|
+
const compiled = await action.compile({
|
|
60
|
+
pipeline: this.pipeline,
|
|
61
|
+
parent: this,
|
|
62
|
+
});
|
|
63
|
+
const result = compiled instanceof model_1.PipelineStep
|
|
64
|
+
? await compiled.run(parameters)
|
|
65
|
+
: await compiled.run(undefined);
|
|
66
|
+
const [checked] = await Promise.allSettled([
|
|
67
|
+
this.definition.condition(parameters.extend({ result }))
|
|
68
|
+
]);
|
|
69
|
+
if (checked.status === 'rejected') {
|
|
70
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.error() });
|
|
71
|
+
return checked;
|
|
72
|
+
}
|
|
73
|
+
if (checked.value.status === 'pending') {
|
|
74
|
+
verdict.status = 'pending';
|
|
75
|
+
verdict.content = checked.value.content;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.done() });
|
|
79
|
+
return {
|
|
80
|
+
status: checked.value.status,
|
|
81
|
+
value: result,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.done() });
|
|
85
|
+
return {
|
|
86
|
+
status: 'voided',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.error() });
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.PipelineLoopStep = PipelineLoopStep;
|
|
96
|
+
//# sourceMappingURL=loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/loop.ts"],"names":[],"mappings":";;;AAKA,mCAA2G;AAC3G,qCAAwD;AACxD,0CAAkD;AA0ElD,MAAa,wBAOX,SAAQ,4BAA6B;IAGrC,YAAoB,UAAgD;QAClE,KAAK,EAAE,CAAC;QADU,eAAU,GAAV,UAAU,CAAsC;QAF5D,SAAI,GAAuC,MAAM,CAAC;IAI1D,CAAC;IAED,gCAAgC;IACzB,KAAK,CAAC,KAAa;QACxB,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,2EAA2E;IACpE,SAAS,CAAC,OAAkE;QACjF,IAAI,CAAC,UAAU,CAAC,SAAS,GAAG,OAAO,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,8DAA8D;IACvD,MAAM,CAOX,OAA0D;QAC1D,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC;QACjC,OAAuB,IAAI,CAAC;IAC9B,CAAC;IAEM,OAAO,CAAC,QAA6B;QAC1C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YAC/B,MAAM,IAAI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MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;oBAC5B,KAAK,EAAE,MAAM;iBACd,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAE1E,OAA0C;gBACxC,MAAM,EAAE,QAAQ;aACjB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3E,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA1DD,4CA0DC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IPipelineConfiguration } from '../types';
|
|
2
|
+
import type { PipelineParameters } from '../parameters';
|
|
3
|
+
import type { TPipelineStepType } from './types';
|
|
4
|
+
import type { Pipeline } from '../model';
|
|
5
|
+
export interface IPipelineStepSource {
|
|
6
|
+
pipeline: Pipeline;
|
|
7
|
+
parent: Pipeline | PipelineStep;
|
|
8
|
+
}
|
|
9
|
+
export interface IPipelineStepDefinition extends IPipelineStepSource {
|
|
10
|
+
title?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class PipelineStepCompiler<TSchema = any> {
|
|
13
|
+
TSchema: TSchema;
|
|
14
|
+
abstract compile(provided: IPipelineStepSource): PipelineStep;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class PipelineStep<K extends TPipelineStepType = TPipelineStepType, TConfiguration extends IPipelineConfiguration = any, TSchema = any, TDefinition extends IPipelineStepDefinition = IPipelineStepDefinition> {
|
|
17
|
+
type: K;
|
|
18
|
+
protected definition: TDefinition;
|
|
19
|
+
TSchema: TSchema;
|
|
20
|
+
title: string;
|
|
21
|
+
pipeline: TDefinition['pipeline'];
|
|
22
|
+
parent: TDefinition['parent'];
|
|
23
|
+
constructor(type: K, definition: TDefinition);
|
|
24
|
+
abstract run(parameters: PipelineParameters<TConfiguration>): Promise<TSchema>;
|
|
25
|
+
/** Traces instances from this to origin */
|
|
26
|
+
trace(): (Pipeline | PipelineStep)[];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIzC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,QAAQ,GAAG,YAAY,CAAC;CACjC;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,8BAAsB,oBAAoB,CAAC,OAAO,GAAG,GAAG;IAC/C,OAAO,EAAG,OAAO,CAAC;aAET,OAAO,CAAC,QAAQ,EAAE,mBAAmB,GAAG,YAAY;CACrE;AAED,8BAAsB,YAAY,CAChC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,EAC/C,cAAc,SAAS,sBAAsB,GAAG,GAAG,EACnD,OAAO,GAAG,GAAG,EACb,WAAW,SAAS,uBAAuB,GAAG,uBAAuB;IASlD,IAAI,EAAE,CAAC;IAAE,SAAS,CAAC,UAAU,EAAE,WAAW;IAPtD,OAAO,EAAG,OAAO,CAAC;IAElB,KAAK,EAAE,MAAM,CAAgD;IAE7D,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAA4B;IAC7D,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAA0B;gBAE3C,IAAI,EAAE,CAAC,EAAY,UAAU,EAAE,WAAW;aAE7C,GAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAErF,2CAA2C;IACpC,KAAK,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,EAAE;CAK5C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PipelineStep = exports.PipelineStepCompiler = void 0;
|
|
4
|
+
const utils_1 = require("../../../utils");
|
|
5
|
+
const counter = (0, utils_1.buildCounter)();
|
|
6
|
+
class PipelineStepCompiler {
|
|
7
|
+
}
|
|
8
|
+
exports.PipelineStepCompiler = PipelineStepCompiler;
|
|
9
|
+
class PipelineStep {
|
|
10
|
+
constructor(type, definition) {
|
|
11
|
+
this.type = type;
|
|
12
|
+
this.definition = definition;
|
|
13
|
+
this.title = this.definition.title ?? `Step ${counter()}`;
|
|
14
|
+
this.pipeline = this.definition.pipeline;
|
|
15
|
+
this.parent = this.definition.parent;
|
|
16
|
+
}
|
|
17
|
+
/** Traces instances from this to origin */
|
|
18
|
+
trace() {
|
|
19
|
+
return this.parent
|
|
20
|
+
? (0, utils_1.cast)([this]).concat(this.parent.trace())
|
|
21
|
+
: [this];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.PipelineStep = PipelineStep;
|
|
25
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/model.ts"],"names":[],"mappings":";;;AAKA,0CAAoD;AAWpD,MAAM,OAAO,GAAG,IAAA,oBAAY,GAAE,CAAC;AAE/B,MAAsB,oBAAoB;CAIzC;AAJD,oDAIC;AAED,MAAsB,YAAY;IAahC,YAAmB,IAAO,EAAY,UAAuB;QAA1C,SAAI,GAAJ,IAAI,CAAG;QAAY,eAAU,GAAV,UAAU,CAAa;QALtD,UAAK,GAAW,IAAI,CAAC,UAAU,CAAC,KAAK,IAAI,QAAQ,OAAO,EAAE,EAAE,CAAC;QAE7D,aAAQ,GAA4B,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC7D,WAAM,GAA0B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;IAEE,CAAC;IAIjE,2CAA2C;IACpC,KAAK;QACV,OAAO,IAAI,CAAC,MAAM;YAChB,CAAC,CAAC,IAAA,YAAI,EAA8B,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACvE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACb,CAAC;CACF;AAvBD,oCAuBC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ZodType } from 'zod/v3';
|
|
2
|
+
import { IPipelineStepDefinition, IPipelineStepSource, PipelineStep, PipelineStepCompiler } from './model';
|
|
3
|
+
import { TPipelineStepNestedHandler } from './types';
|
|
4
|
+
import { IPipelineConfiguration } from '../types';
|
|
5
|
+
import { PipelineParameters } from '../parameters';
|
|
6
|
+
interface IDefinition<TConfiguration extends IPipelineConfiguration, TSchema> extends IPipelineStepDefinition {
|
|
7
|
+
exec: TPipelineStepNestedHandler<TConfiguration, TSchema>;
|
|
8
|
+
schema?: ZodType | TPipelineStepNestedHandler<TConfiguration, ZodType>;
|
|
9
|
+
}
|
|
10
|
+
export declare class PipelineSelfStepCompiler<TConfiguration extends IPipelineConfiguration = any, TSchema = any> extends PipelineStepCompiler<TSchema> {
|
|
11
|
+
private definition;
|
|
12
|
+
private type;
|
|
13
|
+
constructor(definition: Partial<IDefinition<TConfiguration, TSchema>>);
|
|
14
|
+
/** Provides schema to check output payload it self */
|
|
15
|
+
schema<T, TReturn extends PipelineSelfStepCompiler<TConfiguration, T>>(predicate: ZodType<T> | TPipelineStepNestedHandler<TConfiguration, ZodType<T>>): TReturn;
|
|
16
|
+
/** Provides executor */
|
|
17
|
+
exec<T extends TSchema, TReturn extends PipelineSelfStepCompiler<TConfiguration, T>>(handler: TPipelineStepNestedHandler<TConfiguration, T>): TReturn;
|
|
18
|
+
compile(provided: IPipelineStepSource): PipelineSelfStep<TConfiguration, TSchema>;
|
|
19
|
+
static build<TConfiguration extends IPipelineConfiguration, TSchema>(title?: string): PipelineSelfStepCompiler<TConfiguration, TSchema>;
|
|
20
|
+
}
|
|
21
|
+
export declare class PipelineSelfStep<TConfiguration extends IPipelineConfiguration = any, TSchema = any> extends PipelineStep<'self', TConfiguration, TSchema, IDefinition<TConfiguration, TSchema>> {
|
|
22
|
+
run(parameters: PipelineParameters<TConfiguration>): Promise<TSchema>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=self.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self.d.ts","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/self.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC3G,OAAO,EAAE,0BAA0B,EAAqB,MAAM,SAAS,CAAC;AAExE,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD,UAAU,WAAW,CAAC,cAAc,SAAS,sBAAsB,EAAE,OAAO,CAAE,SAAQ,uBAAuB;IAC3G,IAAI,EAAE,0BAA0B,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC1D,MAAM,CAAC,EAAE,OAAO,GAAG,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@@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PipelineSelfStep = exports.PipelineSelfStepCompiler = void 0;
|
|
4
|
+
const model_1 = require("./model");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
class PipelineSelfStepCompiler extends model_1.PipelineStepCompiler {
|
|
8
|
+
constructor(definition) {
|
|
9
|
+
super();
|
|
10
|
+
this.definition = definition;
|
|
11
|
+
this.type = 'self';
|
|
12
|
+
}
|
|
13
|
+
/** Provides schema to check output payload it self */
|
|
14
|
+
schema(predicate) {
|
|
15
|
+
this.definition.schema = predicate;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
/** Provides executor */
|
|
19
|
+
exec(handler) {
|
|
20
|
+
this.definition.exec = handler;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
compile(provided) {
|
|
24
|
+
if (!this.definition.exec) {
|
|
25
|
+
throw new errors_1.PipelineStepCompilationError(this.type, '[exec] is missing');
|
|
26
|
+
}
|
|
27
|
+
return new PipelineSelfStep(this.type, {
|
|
28
|
+
title: this.definition.title,
|
|
29
|
+
exec: this.definition.exec,
|
|
30
|
+
schema: this.definition.schema,
|
|
31
|
+
pipeline: provided.pipeline,
|
|
32
|
+
parent: provided.parent,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
static build(title) {
|
|
36
|
+
return new PipelineSelfStepCompiler({ title });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.PipelineSelfStepCompiler = PipelineSelfStepCompiler;
|
|
40
|
+
class PipelineSelfStep extends model_1.PipelineStep {
|
|
41
|
+
async run(parameters) {
|
|
42
|
+
const meta = (0, utils_1.buildMetaManager)();
|
|
43
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.init() });
|
|
44
|
+
try {
|
|
45
|
+
const schema = this.definition.schema
|
|
46
|
+
? typeof this.definition.schema === 'function'
|
|
47
|
+
? await this.definition.schema(parameters)
|
|
48
|
+
: this.definition.schema
|
|
49
|
+
: null;
|
|
50
|
+
const result = await this.definition.exec(parameters);
|
|
51
|
+
await schema?.parseAsync(result);
|
|
52
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.done() });
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.error() });
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.PipelineSelfStep = PipelineSelfStep;
|
|
62
|
+
//# sourceMappingURL=self.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"self.js","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/self.ts"],"names":[],"mappings":";;;AAEA,mCAA2G;AAE3G,qCAAwD;AAGxD,0CAAkD;AAOlD,MAAa,wBAGX,SAAQ,4BAA6B;IAGrC,YAAoB,UAAyD;QAC3E,KAAK,EAAE,CAAC;QADU,eAAU,GAAV,UAAU,CAA+C;QAFrE,SAAI,GAAuC,MAAM,CAAC;IAI1D,CAAC;IAED,sDAAsD;IAC/C,MAAM,CACX,SAA8E;QAE9E,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC;QACnC,OAAuB,IAAI,CAAC;IAC9B,CAAC;IAED,wBAAwB;IACjB,IAAI,CACT,OAAsD;QAEtD,IAAI,CAAC,UAAU,CAAC,IAAI,GAAG,OAAO,CAAC;QAC/B,OAAuB,IAAI,CAAC;IAC9B,CAAC;IAEM,OAAO,CAAC,QAA6B;QAC1C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YAC1B,MAAM,IAAI,qCAA4B,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAA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AAE,EAAE,CAAC,CAAC;YAC1E,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3E,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AA1BD,4CA0BC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TPipelineStepNestedHandler } from './types';
|
|
2
|
+
import type { IPipelineConfiguration } from '../types';
|
|
3
|
+
import type { PipelineCompiler } from '../model';
|
|
4
|
+
import { IPipelineStepDefinition, IPipelineStepSource, PipelineStep, PipelineStepCompiler } from './model';
|
|
5
|
+
import { PipelineParameters } from '../parameters';
|
|
6
|
+
interface IDefinition<TConfiguration extends IPipelineConfiguration> extends IPipelineStepDefinition {
|
|
7
|
+
subtasks: (PipelineStepCompiler | PipelineCompiler)[] | TPipelineStepNestedHandler<TConfiguration, (PipelineStepCompiler | PipelineCompiler)[]>;
|
|
8
|
+
limit?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class PipelineSwarmStepCompiler<TConfiguration extends IPipelineConfiguration = any, TSchema extends PromiseSettledResult<any>[] = PromiseSettledResult<any>[]> extends PipelineStepCompiler<TSchema> {
|
|
11
|
+
private definition;
|
|
12
|
+
private type;
|
|
13
|
+
constructor(definition: Partial<IDefinition<TConfiguration>>);
|
|
14
|
+
/** Provides subtask executors */
|
|
15
|
+
subtasks<T extends PipelineStepCompiler | PipelineCompiler, TReturn extends PipelineSwarmStepCompiler<TConfiguration, PromiseSettledResult<T['TSchema']>[]>>(predicate: T[] | TPipelineStepNestedHandler<TConfiguration, T[]>): TReturn;
|
|
16
|
+
/** Provides a bottle neck limit for parallel executions */
|
|
17
|
+
limit(value: number): this;
|
|
18
|
+
compile(provided: IPipelineStepSource): PipelineSwarmStep<TConfiguration, TSchema>;
|
|
19
|
+
static build<TConfiguration extends IPipelineConfiguration, TSchema extends PromiseSettledResult<any>[]>(title?: string): PipelineSwarmStepCompiler<TConfiguration, TSchema>;
|
|
20
|
+
}
|
|
21
|
+
export declare class PipelineSwarmStep<TConfiguration extends IPipelineConfiguration = any, TSchema extends PromiseSettledResult<any>[] = PromiseSettledResult<any>[]> extends PipelineStep<'swarm', TConfiguration, TSchema, IDefinition<TConfiguration>> {
|
|
22
|
+
run(parameters: PipelineParameters<TConfiguration>): Promise<TSchema>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=swarm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/swarm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAqB,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE3G,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAInD,UAAU,WAAW,CAAC,cAAc,SAAS,sBAAsB,CAAE,SAAQ,uBAAuB;IAClG,QAAQ,EACJ,CAAC,oBAAoB,GAAG,gBAAgB,CAAC,EAAE,GAC3C,0BAA0B,CAAC,cAAc,EAAE,CAAC,oBAAoB,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAE5F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,yBAAyB,CACpC,cAAc,SAAS,sBAAsB,GAAG,GAAG,EACnD,OAAO,SAAS,oBAAoB,CAAC,GAAG,CAAC,EAAE,GAAG,oBAAo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mStep = exports.PipelineSwarmStepCompiler = void 0;
|
|
4
|
+
const model_1 = require("./model");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const utils_2 = require("../../../utils");
|
|
8
|
+
class PipelineSwarmStepCompiler extends model_1.PipelineStepCompiler {
|
|
9
|
+
constructor(definition) {
|
|
10
|
+
super();
|
|
11
|
+
this.definition = definition;
|
|
12
|
+
this.type = 'swarm';
|
|
13
|
+
}
|
|
14
|
+
/** Provides subtask executors */
|
|
15
|
+
subtasks(predicate) {
|
|
16
|
+
this.definition.subtasks = predicate;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
/** Provides a bottle neck limit for parallel executions */
|
|
20
|
+
limit(value) {
|
|
21
|
+
this.definition.limit = value;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
compile(provided) {
|
|
25
|
+
if (!this.definition.subtasks) {
|
|
26
|
+
throw new errors_1.PipelineStepCompilationError(this.type, '[subtasks] are empty');
|
|
27
|
+
}
|
|
28
|
+
return new PipelineSwarmStep(this.type, {
|
|
29
|
+
title: this.definition.title,
|
|
30
|
+
subtasks: this.definition.subtasks,
|
|
31
|
+
limit: this.definition.limit,
|
|
32
|
+
pipeline: provided.pipeline,
|
|
33
|
+
parent: provided.parent,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static build(title) {
|
|
37
|
+
return new PipelineSwarmStepCompiler({ title });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.PipelineSwarmStepCompiler = PipelineSwarmStepCompiler;
|
|
41
|
+
class PipelineSwarmStep extends model_1.PipelineStep {
|
|
42
|
+
async run(parameters) {
|
|
43
|
+
const meta = (0, utils_1.buildMetaManager)();
|
|
44
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.init() });
|
|
45
|
+
try {
|
|
46
|
+
const subtasks = typeof this.definition.subtasks === 'function'
|
|
47
|
+
? await this.definition.subtasks(parameters)
|
|
48
|
+
: this.definition.subtasks;
|
|
49
|
+
const handled = await (0, utils_2.chunkify)(subtasks, this.definition.limit ?? Infinity, async (subtask) => {
|
|
50
|
+
const compiled = await subtask.compile({
|
|
51
|
+
pipeline: this.pipeline,
|
|
52
|
+
parent: this,
|
|
53
|
+
});
|
|
54
|
+
return compiled instanceof model_1.PipelineStep
|
|
55
|
+
? compiled.run(parameters)
|
|
56
|
+
: compiled.run(undefined);
|
|
57
|
+
});
|
|
58
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.done() });
|
|
59
|
+
return handled.map((subtask) => subtask.result);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
this.pipeline.session.emit('step:run', { step: this, meta: meta.error() });
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.PipelineSwarmStep = PipelineSwarmStep;
|
|
68
|
+
//# sourceMappingURL=swarm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swarm.js","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/swarm.ts"],"names":[],"mappings":";;;AAIA,mCAA2G;AAC3G,qCAAwD;AAExD,0CAAkD;AAClD,0CAA0C;AAU1C,MAAa,yBAGX,SAAQ,4BAA6B;IAGrC,YAAoB,UAAgD;QAClE,KAAK,EAAE,CAAC;QADU,eAAU,GAAV,UAAU,CAAsC;QAF5D,SAAI,GAAwC,OAAO,CAAC;IAI5D,CAAC;IAED,iCAAiC;IAC1B,QAAQ,CAGb,SAAgE;QAChE,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,SAAS,CAAC;QACrC,OAAuB,IAAI,CAAC;IAC9B,CAAC;IAED,2DAA2D;IACpD,KAAK,CAAC,KAAa;QACxB,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO,CAAC,QAA6B;QAC1C,IAAI,CA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,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;oBACrC,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,MAAM,EAAE,IAAI;iBACb,CAAC,CAAC;gBAEH,OAAO,QAAQ,YAAY,oBAAY;oBACrC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC;oBAC1B,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAE1E,OAAgB,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC3E,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAhCD,8CAgCC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IPipelineConfiguration } from '../types';
|
|
2
|
+
import type { PipelineParameters } from '../parameters';
|
|
3
|
+
import type { TFunction } from '../../../../types';
|
|
4
|
+
export type TPipelineStepType = 'self' | 'ai' | 'swarm' | 'loop';
|
|
5
|
+
export type TPipelineStepNestedHandler<TConfiguration extends IPipelineConfiguration = any, TReturn = any> = TFunction<TReturn | Promise<TReturn>, [Omit<PipelineParameters<TConfiguration>, 'factory'>]>;
|
|
6
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjE,MAAM,MAAM,0BAA0B,CACpC,cAAc,SAAS,sBAAsB,GAAG,GAAG,EACnD,OAAO,GAAG,GAAG,IACX,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/models/pipeline/steps/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PipelineParameters } from './parameters';
|
|
2
|
+
import type { TFunction } from '../../../types';
|
|
3
|
+
import type { Content } from '../content';
|
|
4
|
+
export type TPipelineCompilerConfigurationStepType = 'named' | 'anonymous';
|
|
5
|
+
export type TPipelineContentPredicate = (string | Content)[];
|
|
6
|
+
export interface IPipelineConfiguration {
|
|
7
|
+
input: unknown;
|
|
8
|
+
state: {};
|
|
9
|
+
}
|
|
10
|
+
export type TPipelineStepGeneralHandler<TConfiguration extends IPipelineConfiguration = any, TReturn = any> = TFunction<TReturn | Promise<TReturn>, [PipelineParameters<TConfiguration>]>;
|
|
11
|
+
export type TPipelineCompilerConfigurationStep<K extends TPipelineCompilerConfigurationStepType = TPipelineCompilerConfigurationStepType, TConfiguration extends IPipelineConfiguration = any> = {
|
|
12
|
+
named: {
|
|
13
|
+
type: 'named';
|
|
14
|
+
name: string;
|
|
15
|
+
handler: TPipelineStepGeneralHandler<TConfiguration>;
|
|
16
|
+
};
|
|
17
|
+
anonymous: {
|
|
18
|
+
type: 'anonymous';
|
|
19
|
+
handler: TPipelineStepGeneralHandler<TConfiguration>;
|
|
20
|
+
};
|
|
21
|
+
}[K];
|
|
22
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/models/pipeline/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,MAAM,sCAAsC,GAAG,OAAO,GAAG,WAAW,CAAC;AAC3E,MAAM,MAAM,yBAAyB,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,EAAE,CAAC;CACX;AAED,MAAM,MAAM,2BAA2B,CACrC,cAAc,SAAS,sBAAsB,GAAG,GAAG,EACnD,OAAO,GAAG,GAAG,IACX,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAEhF,MAAM,MAAM,kCAAkC,CAC5C,CAAC,SAAS,sCAAsC,GAAG,sCAAsC,EACzF,cAAc,SAAS,sBAAsB,GAAG,GAAG,IACjD;IACF,KAAK,EAAE;QACL,IAAI,EAAE,OAAO,CAAC;QAEd,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,2BAA2B,CAAC,cAAc,CAAC,CAAC;KACtD,CAAC;IAEF,SAAS,EAAE;QACT,IAAI,EAAE,WAAW,CAAA;QACjB,OAAO,EAAE,2BAA2B,CAAC,cAAc,CAAC,CAAC;KACtD,CAAC;CACH,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/models/pipeline/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Content } from './content';
|
|
2
|
+
import { ILlmSkill } from './llm';
|
|
3
|
+
export declare class Project {
|
|
4
|
+
private provided;
|
|
5
|
+
cwd: string;
|
|
6
|
+
sources: {
|
|
7
|
+
skills: Record<string, ILlmSkill>;
|
|
8
|
+
ignore: string[];
|
|
9
|
+
files: string[];
|
|
10
|
+
editorconfig?: string;
|
|
11
|
+
};
|
|
12
|
+
content: {
|
|
13
|
+
/** Renders `.editorconfig` content */
|
|
14
|
+
editorconfig: () => Content;
|
|
15
|
+
/** Renders project files tree */
|
|
16
|
+
tree: (patterns?: string[]) => Content;
|
|
17
|
+
};
|
|
18
|
+
files: {
|
|
19
|
+
/** Returns glob result of the project files */
|
|
20
|
+
glob: (patterns?: string[]) => string[];
|
|
21
|
+
/** Adds path to the project files */
|
|
22
|
+
add: (path: string) => void;
|
|
23
|
+
/** Removes file or directory from the project files */
|
|
24
|
+
rm: (path: string) => void;
|
|
25
|
+
};
|
|
26
|
+
constructor(provided: Pick<Project, 'sources'> & Partial<Pick<Project, 'cwd'>>);
|
|
27
|
+
static build(options?: Partial<Pick<Project, 'cwd'>>): Promise<Project>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/models/project.ts"],"names":[],"mappings":"AAOA,OAAO,EAAqB,OAAO,EAAgB,MAAM,WAAW,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAalC,qBAAa,OAAO;IAwFN,OAAO,CAAC,QAAQ;IAvFrB,GAAG,EAAE,MAAM,CAAsC;IAEjD,OAAO,EAAE;QACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAElC,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,KAAK,EAAE,MAAM,EAAE,CAAC;QAEhB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAyB;IAEnB,OAAO;QACZ,sCAAsC;4BACpB,OAAO;QAazB,iCAAiC;0BACf,MAAM,EAAE,KAAG,OAAO;MAyBgB;IAE/C,KAAK;QACV,+CAA+C;0BAC7B,MAAM,EAAE,KAAG,MAAM,EAAE;QAkBrC,qCAAqC;oBACzB,MAAM,KAAG,IAAI;QAMzB,uDAAuD;mBAC5C,MAAM,KAAG,IAAI;MAGxB;gBAEkB,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;WAEzE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CA2C9E"}
|